Exim 4.91 release
[exim-website.git] / docbook / 4.91 / 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 15 Apr 2018
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.91</revnumber>
22 <date>15 Apr 2018</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2018
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of the program,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para revisionflag="changed">
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.91 of Exim.
206 Substantive changes from the 4.90 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 </para>
336 <para revisionflag="changed">
337 The primary site for Exim source distributions is the <option>exim.org</option> FTP site,
338 available over HTTPS, HTTP and FTP.  These services, and the <option>exim.org</option>
339 website, are hosted at the University of Cambridge.
340 </para>
341 <para>
342 <indexterm role="concept">
343 <primary>wiki</primary>
344 </indexterm>
345 <indexterm role="concept">
346 <primary>FAQ</primary>
347 </indexterm>
348 As well as Exim distribution tar files, the Exim web site contains a number of
349 differently formatted versions of the documentation. A recent addition to the
350 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
351 which contains what used to be a separate FAQ, as well as various other
352 examples, tips, and know-how that have been contributed by Exim users.
353 </para>
354 <para revisionflag="changed">
355 The wiki site should always redirect to the correct place, which is currently
356 provided by GitHub, and is open to editing by anyone with a GitHub account.
357 </para>
358 <para>
359 <indexterm role="concept">
360 <primary>Bugzilla</primary>
361 </indexterm>
362 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
363 this to report bugs, and also to add items to the wish list. Please search
364 first to check that you are not duplicating a previous entry.
365 </para>
366 <para revisionflag="changed">
367 Please do not ask for configuration help in the bug-tracker.
368 </para>
369 </section>
370 <section id="SECID3">
371 <title>Mailing lists</title>
372 <para>
373 <indexterm role="concept">
374 <primary>mailing lists</primary>
375 <secondary>for Exim users</secondary>
376 </indexterm>
377 The following Exim mailing lists exist:
378 </para>
379 <informaltable frame="none">
380 <tgroup cols="2" colsep="0" rowsep="0">
381 <colspec colwidth="140pt" align="left"/>
382 <colspec colwidth="254pt" align="left"/>
383 <tbody>
384 <row>
385 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
386 <entry>Moderated, low volume announcements list</entry>
387 </row>
388 <row>
389 <entry><emphasis>exim-users@exim.org</emphasis></entry>
390 <entry>General discussion list</entry>
391 </row>
392 <row>
393 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
394 <entry>Discussion of bugs, enhancements, etc.</entry>
395 </row>
396 <row>
397 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
398 <entry>Automated commit messages from the VCS</entry>
399 </row>
400 </tbody>
401 </tgroup>
402 </informaltable>
403 <para>
404 You can subscribe to these lists, change your existing subscriptions, and view
405 or search the archives via the mailing lists link on the Exim home page.
406 <indexterm role="concept">
407 <primary>Debian</primary>
408 <secondary>mailing list for</secondary>
409 </indexterm>
410 If you are using a Debian distribution of Exim, you may wish to subscribe to
411 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
412 via this web page:
413 </para>
414 <literallayout>
415 <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>
416 </literallayout>
417 <para>
418 Please ask Debian-specific questions on this list and not on the general Exim
419 lists.
420 </para>
421 </section>
422 <section id="SECID5">
423 <title>Bug reports</title>
424 <para>
425 <indexterm role="concept">
426 <primary>bug reports</primary>
427 </indexterm>
428 <indexterm role="concept">
429 <primary>reporting bugs</primary>
430 </indexterm>
431 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
432 via the Bugzilla (<emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>). However, if you are unsure
433 whether some behaviour is a bug or not, the best thing to do is to post a
434 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
435 </para>
436 </section>
437 <section id="SECTavail">
438 <title>Where to find the Exim distribution</title>
439 <para>
440 <indexterm role="concept">
441 <primary>FTP site</primary>
442 </indexterm>
443 <indexterm role="concept">
444 <primary>HTTPS download site</primary>
445 </indexterm>
446 <indexterm role="concept">
447 <primary>distribution</primary>
448 <secondary>ftp site</secondary>
449 </indexterm>
450 <indexterm role="concept">
451 <primary>distribution</primary>
452 <secondary>https site</secondary>
453 </indexterm>
454 </para>
455 <para revisionflag="changed">
456 The master distribution site for the Exim distribution is
457 </para>
458 <literallayout revisionflag="changed">
459 <emphasis role="bold">https://downloads.exim.org/</emphasis>
460 </literallayout>
461 <para revisionflag="changed">
462 The service is available over HTTPS, HTTP and FTP.
463 We encourage people to migrate to HTTPS.
464 </para>
465 <para revisionflag="changed">
466 The content served at <emphasis>https://downloads.exim.org/</emphasis> is identical to the
467 content served at <emphasis>https://ftp.exim.org/pub/exim</emphasis> and
468 <emphasis>ftp://ftp.exim.org/pub/exim</emphasis>.
469 </para>
470 <para revisionflag="changed">
471 If accessing via a hostname containing <emphasis>ftp</emphasis>, then the file references that
472 follow are relative to the <filename>exim</filename> directories at these sites.
473 If accessing via the hostname <emphasis>downloads</emphasis> then the subdirectories described
474 here are top-level directories.
475 </para>
476 <para>
477 There are now quite a number of independent mirror sites around
478 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
479 </para>
480 <para>
481 Within the top exim directory there are subdirectories called <filename>exim3</filename> (for
482 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
483 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
484 subdirectory, the current release can always be found in files called
485 </para>
486 <literallayout>
487 <filename>exim-n.nn.tar.xz</filename>
488 <filename>exim-n.nn.tar.gz</filename>
489 <filename>exim-n.nn.tar.bz2</filename>
490 </literallayout>
491 <para>
492 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The three
493 files contain identical data; the only difference is the type of compression.
494 </para>
495 <para revisionflag="changed">
496 The <filename>.xz</filename> file is usually the smallest, while the <filename>.gz</filename> file is the
497 most portable to old systems.
498 </para>
499 <para>
500 <indexterm role="concept">
501 <primary>distribution</primary>
502 <secondary>signing details</secondary>
503 </indexterm>
504 <indexterm role="concept">
505 <primary>distribution</primary>
506 <secondary>public key</secondary>
507 </indexterm>
508 <indexterm role="concept">
509 <primary>public key for signed distribution</primary>
510 </indexterm>
511 The distributions will be PGP signed by an individual key of the Release
512 Coordinator.  This key will have a uid containing an email address in the
513 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
514 other Exim maintainers.  We expect that the key will be in the "strong set" of
515 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
516 PGP key, a version of which can be found in the release directory in the file
517 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
518 such as <emphasis>pool.sks-keyservers.net</emphasis>.
519 </para>
520 <para revisionflag="changed">
521 At time of last update, releases were being made by Jeremy Harris and signed
522 with key <emphasis>0xBCE58C8CE41F32DF</emphasis>.  Other recent keys used for signing are those
523 of Heiko Schlittermann, <emphasis>0x26101B62F69376CE</emphasis>,
524 and of Phil Pennock, <emphasis>0x4D1E900E14C1CC04</emphasis>.
525 </para>
526 <para>
527 The signatures for the tar bundles are in:
528 </para>
529 <literallayout>
530 <filename>exim-n.nn.tar.xz.asc</filename>
531 <filename>exim-n.nn.tar.gz.asc</filename>
532 <filename>exim-n.nn.tar.bz2.asc</filename>
533 </literallayout>
534 <para>
535 For each released version, the log of changes is made separately available in a
536 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
537 find out what has changed without having to download the entire distribution.
538 </para>
539 <para>
540 <indexterm role="concept">
541 <primary>documentation</primary>
542 <secondary>available formats</secondary>
543 </indexterm>
544 The main distribution contains ASCII versions of this specification and other
545 documentation; other formats of the documents are available in separate files
546 inside the <filename>exim4</filename> directory of the FTP site:
547 </para>
548 <literallayout>
549 <filename>exim-html-n.nn.tar.gz</filename>
550 <filename>exim-pdf-n.nn.tar.gz</filename>
551 <filename>exim-postscript-n.nn.tar.gz</filename>
552 <filename>exim-texinfo-n.nn.tar.gz</filename>
553 </literallayout>
554 <para revisionflag="changed">
555 These tar files contain only the <filename>doc</filename> directory, not the complete
556 distribution, and are also available in <filename>.bz2</filename> and <filename>.xz</filename> forms.
557 </para>
558 </section>
559 <section id="SECID6">
560 <title>Limitations</title>
561 <itemizedlist>
562 <listitem>
563 <para>
564 <indexterm role="concept">
565 <primary>limitations of Exim</primary>
566 </indexterm>
567 <indexterm role="concept">
568 <primary>bang paths</primary>
569 <secondary>not handled by Exim</secondary>
570 </indexterm>
571 Exim is designed for use as an Internet MTA, and therefore handles addresses in
572 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
573 simple two-component bang paths can be converted by a straightforward rewriting
574 configuration. This restriction does not prevent Exim from being interfaced to
575 UUCP as a transport mechanism, provided that domain addresses are used.
576 </para>
577 </listitem>
578 <listitem>
579 <para>
580 <indexterm role="concept">
581 <primary>domainless addresses</primary>
582 </indexterm>
583 <indexterm role="concept">
584 <primary>address</primary>
585 <secondary>without domain</secondary>
586 </indexterm>
587 Exim insists that every address it handles has a domain attached. For incoming
588 local messages, domainless addresses are automatically qualified with a
589 configured domain value. Configuration options specify from which remote
590 systems unqualified addresses are acceptable. These are then qualified on
591 arrival.
592 </para>
593 </listitem>
594 <listitem>
595 <para>
596 <indexterm role="concept">
597 <primary>transport</primary>
598 <secondary>external</secondary>
599 </indexterm>
600 <indexterm role="concept">
601 <primary>external transports</primary>
602 </indexterm>
603 The only external transport mechanisms that are currently implemented are SMTP
604 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
605 transport is available, and there are facilities for writing messages to files
606 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
607 to send messages to other transport mechanisms such as UUCP, provided they can
608 handle domain-style addresses. Batched SMTP input is also catered for.
609 </para>
610 </listitem>
611 <listitem>
612 <para>
613 Exim is not designed for storing mail for dial-in hosts. When the volumes of
614 such mail are large, it is better to get the messages <quote>delivered</quote> into files
615 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
616 other means.
617 </para>
618 </listitem>
619 <listitem>
620 <para>
621 Although Exim does have basic facilities for scanning incoming messages, these
622 are not comprehensive enough to do full virus or spam scanning. Such operations
623 are best carried out using additional specialized software packages. If you
624 compile Exim with the content-scanning extension, straightforward interfaces to
625 a number of common scanners are provided.
626 </para>
627 </listitem>
628 </itemizedlist>
629 </section>
630 <section id="SECID7">
631 <title>Run time configuration</title>
632 <para>
633 Exim&#x2019;s run time configuration is held in a single text file that is divided
634 into a number of sections. The entries in this file consist of keywords and
635 values, in the style of Smail 3 configuration files. A default configuration
636 file which is suitable for simple online installations is provided in the
637 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
638 </para>
639 </section>
640 <section id="SECID8">
641 <title>Calling interface</title>
642 <para>
643 <indexterm role="concept">
644 <primary>Sendmail compatibility</primary>
645 <secondary>command line interface</secondary>
646 </indexterm>
647 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
648 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
649 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
650 about Sendmail in order to run Exim. For actions other than sending messages,
651 Sendmail-compatible options also exist, but those that produce output (for
652 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
653 format. There are also some additional options that are compatible with Smail
654 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
655 documents all Exim&#x2019;s command line options. This information is automatically
656 made into the man page that forms part of the Exim distribution.
657 </para>
658 <para>
659 Control of messages on the queue can be done via certain privileged command
660 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
661 which displays current information in an X window, and which contains a menu
662 interface to Exim&#x2019;s command line administration options.
663 </para>
664 </section>
665 <section id="SECID9">
666 <title>Terminology</title>
667 <para>
668 <indexterm role="concept">
669 <primary>terminology definitions</primary>
670 </indexterm>
671 <indexterm role="concept">
672 <primary>body of message</primary>
673 <secondary>definition of</secondary>
674 </indexterm>
675 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
676 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
677 below) by a blank line.
678 </para>
679 <para>
680 <indexterm role="concept">
681 <primary>bounce message</primary>
682 <secondary>definition of</secondary>
683 </indexterm>
684 When a message cannot be delivered, it is normally returned to the sender in a
685 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
686 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
687 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
688 failure error report</quote>. Such messages have an empty sender address in the
689 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
690 rise to further bounce messages.
691 </para>
692 <para>
693 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
694 value which is used in the absence of any setting in the configuration. It may
695 also qualify an action which is taken unless a configuration setting specifies
696 otherwise.
697 </para>
698 <para>
699 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
700 destination cannot immediately take place for some reason (a remote host may be
701 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
702 until a later time.
703 </para>
704 <para>
705 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
706 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
707 the part of an email address following the @ sign.
708 </para>
709 <para>
710 <indexterm role="concept">
711 <primary>envelope, definition of</primary>
712 </indexterm>
713 <indexterm role="concept">
714 <primary>sender</primary>
715 <secondary>definition of</secondary>
716 </indexterm>
717 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
718 body. The envelope contains a sender address (to which bounce messages should
719 be delivered), and any number of recipient addresses. References to the
720 sender or the recipients of a message usually mean the addresses in the
721 envelope. An MTA uses these addresses for delivery, and for returning bounce
722 messages, not the addresses that appear in the header lines.
723 </para>
724 <para>
725 <indexterm role="concept">
726 <primary>message</primary>
727 <secondary>header, definition of</secondary>
728 </indexterm>
729 <indexterm role="concept">
730 <primary>header section</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
734 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
735 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
736 indenting the continuations. The header is separated from the body by a blank
737 line.
738 </para>
739 <para>
740 <indexterm role="concept">
741 <primary>local part</primary>
742 <secondary>definition of</secondary>
743 </indexterm>
744 <indexterm role="concept">
745 <primary>domain</primary>
746 <secondary>definition of</secondary>
747 </indexterm>
748 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
749 part of an email address that precedes the @ sign. The part that follows the
750 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
751 </para>
752 <para>
753 <indexterm role="concept">
754 <primary>local delivery</primary>
755 <secondary>definition of</secondary>
756 </indexterm>
757 <indexterm role="concept">
758 <primary>remote delivery, definition of</primary>
759 </indexterm>
760 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
761 delivery to a file or a pipe on the local host from delivery by SMTP over
762 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
763 host it is running on are <emphasis>remote</emphasis>.
764 </para>
765 <para>
766 <indexterm role="concept">
767 <primary>return path</primary>
768 <secondary>definition of</secondary>
769 </indexterm>
770 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
771 message&#x2019;s envelope.
772 </para>
773 <para>
774 <indexterm role="concept">
775 <primary>queue</primary>
776 <secondary>definition of</secondary>
777 </indexterm>
778 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
779 because this term is in widespread use in the context of MTAs. However, in
780 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
781 normally no ordering of waiting messages.
782 </para>
783 <para>
784 <indexterm role="concept">
785 <primary>queue runner</primary>
786 <secondary>definition of</secondary>
787 </indexterm>
788 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
789 and attempts to deliver those messages whose retry times have come. This term
790 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
791 the waiting messages are normally processed in an unpredictable order.
792 </para>
793 <para>
794 <indexterm role="concept">
795 <primary>spool directory</primary>
796 <secondary>definition of</secondary>
797 </indexterm>
798 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
799 messages on its queue &ndash; that is, those that it is in the process of
800 delivering. This should not be confused with the directory in which local
801 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
802 the Exim documentation, <quote>spool</quote> is always used in the first sense.
803 </para>
804 </section>
805 </chapter>
806
807 <chapter id="CHID2">
808 <title>Incorporated code</title>
809 <para>
810 <indexterm role="concept">
811 <primary>incorporated code</primary>
812 </indexterm>
813 <indexterm role="concept">
814 <primary>regular expressions</primary>
815 <secondary>library</secondary>
816 </indexterm>
817 <indexterm role="concept">
818 <primary>PCRE</primary>
819 </indexterm>
820 <indexterm role="concept">
821 <primary>OpenDMARC</primary>
822 </indexterm>
823 A number of pieces of external code are included in the Exim distribution.
824 </para>
825 <itemizedlist>
826 <listitem>
827 <para>
828 Regular expressions are supported in the main Exim program and in the
829 Exim monitor using the freely-distributable PCRE library, copyright
830 &copy; University of Cambridge. The source to PCRE is no longer shipped with
831 Exim, so you will need to use the version of PCRE shipped with your system,
832 or obtain and install the full version of the library from
833 <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>.
834 </para>
835 </listitem>
836 <listitem>
837 <para>
838 <indexterm role="concept">
839 <primary>cdb</primary>
840 <secondary>acknowledgment</secondary>
841 </indexterm>
842 Support for the cdb (Constant DataBase) lookup method is provided by code
843 contributed by Nigel Metheringham of (at the time he contributed it) Planet
844 Online Ltd. The implementation is completely contained within the code of Exim.
845 It does not link against an external cdb library. The code contains the
846 following statements:
847 </para>
848 <blockquote>
849 <para>
850 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
851 </para>
852 <para>
853 This program is free software; you can redistribute it and/or modify it under
854 the terms of the GNU General Public License as published by the Free Software
855 Foundation; either version 2 of the License, or (at your option) any later
856 version.
857 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
858 the spec and sample code for cdb can be obtained from
859 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
860 some code from Dan Bernstein&#x2019;s implementation (which has no license
861 restrictions applied to it).
862 </para>
863 </blockquote>
864 </listitem>
865 <listitem>
866 <para>
867 <indexterm role="concept">
868 <primary>SPA authentication</primary>
869 </indexterm>
870 <indexterm role="concept">
871 <primary>Samba project</primary>
872 </indexterm>
873 <indexterm role="concept">
874 <primary>Microsoft Secure Password Authentication</primary>
875 </indexterm>
876 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
877 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
878 Tom Kistner. This includes code taken from the Samba project, which is released
879 under the Gnu GPL.
880 </para>
881 </listitem>
882 <listitem>
883 <para>
884 <indexterm role="concept">
885 <primary>Cyrus</primary>
886 </indexterm>
887 <indexterm role="concept">
888 <primary><emphasis>pwcheck</emphasis> daemon</primary>
889 </indexterm>
890 <indexterm role="concept">
891 <primary><emphasis>pwauthd</emphasis> daemon</primary>
892 </indexterm>
893 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
894 by code taken from the Cyrus-SASL library and adapted by Alexander S.
895 Sabourenkov. The permission notice appears below, in accordance with the
896 conditions expressed therein.
897 </para>
898 <blockquote>
899 <para>
900 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
901 </para>
902 <para>
903 Redistribution and use in source and binary forms, with or without
904 modification, are permitted provided that the following conditions
905 are met:
906 </para>
907 <orderedlist numeration="arabic">
908 <listitem>
909 <para>
910 Redistributions of source code must retain the above copyright
911 notice, this list of conditions and the following disclaimer.
912 </para>
913 </listitem>
914 <listitem>
915 <para>
916 Redistributions in binary form must reproduce the above copyright
917 notice, this list of conditions and the following disclaimer in
918 the documentation and/or other materials provided with the
919 distribution.
920 </para>
921 </listitem>
922 <listitem>
923 <para>
924 The name <quote>Carnegie Mellon University</quote> must not be used to
925 endorse or promote products derived from this software without
926 prior written permission. For permission or any other legal
927 details, please contact
928 </para>
929 <literallayout>
930               Office of Technology Transfer
931               Carnegie Mellon University
932               5000 Forbes Avenue
933               Pittsburgh, PA  15213-3890
934               (412) 268-4387, fax: (412) 268-7395
935               tech-transfer@andrew.cmu.edu
936 </literallayout>
937 </listitem>
938 <listitem>
939 <para>
940 Redistributions of any form whatsoever must retain the following
941 acknowledgment:
942 </para>
943 <para>
944 <quote>This product includes software developed by Computing Services
945 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
946 </para>
947 <para>
948 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
949 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
950 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
951 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
952 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
953 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
954 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
955 </para>
956 </listitem>
957 </orderedlist>
958 </blockquote>
959 </listitem>
960 <listitem>
961 <para>
962 <indexterm role="concept">
963 <primary>Exim monitor</primary>
964 <secondary>acknowledgment</secondary>
965 </indexterm>
966 <indexterm role="concept">
967 <primary>X-windows</primary>
968 </indexterm>
969 <indexterm role="concept">
970 <primary>Athena</primary>
971 </indexterm>
972 The Exim Monitor program, which is an X-Window application, includes
973 modified versions of the Athena StripChart and TextPop widgets.
974 This code is copyright by DEC and MIT, and their permission notice appears
975 below, in accordance with the conditions expressed therein.
976 </para>
977 <blockquote>
978 <para>
979 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
980 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
981 </para>
982 <para>
983 All Rights Reserved
984 </para>
985 <para>
986 Permission to use, copy, modify, and distribute this software and its
987 documentation for any purpose and without fee is hereby granted,
988 provided that the above copyright notice appear in all copies and that
989 both that copyright notice and this permission notice appear in
990 supporting documentation, and that the names of Digital or MIT not be
991 used in advertising or publicity pertaining to distribution of the
992 software without specific, written prior permission.
993 </para>
994 <para>
995 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
996 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
997 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
998 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
999 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1000 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1001 SOFTWARE.
1002 </para>
1003 </blockquote>
1004 </listitem>
1005 <listitem>
1006 <para>
1007 <indexterm role="concept">
1008 <primary>opendmarc</primary>
1009 <secondary>acknowledgment</secondary>
1010 </indexterm>
1011 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1012 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1013 derived code are indicated in the respective source files. The full OpenDMARC
1014 license is provided in the LICENSE.opendmarc file contained in the distributed
1015 source code.
1016 </para>
1017 </listitem>
1018 <listitem>
1019 <para>
1020 Many people have contributed code fragments, some large, some small, that were
1021 not covered by any specific licence requirements. It is assumed that the
1022 contributors are happy to see their code incorporated into Exim under the GPL.
1023 </para>
1024 </listitem>
1025 </itemizedlist>
1026 </chapter>
1027
1028 <chapter id="CHID11">
1029 <title>How Exim receives and delivers mail</title>
1030 <titleabbrev>Receiving and delivering mail</titleabbrev>
1031 <section id="SECID10">
1032 <title>Overall philosophy</title>
1033 <para>
1034 <indexterm role="concept">
1035 <primary>design philosophy</primary>
1036 </indexterm>
1037 Exim is designed to work efficiently on systems that are permanently connected
1038 to the Internet and are handling a general mix of mail. In such circumstances,
1039 most messages can be delivered immediately. Consequently, Exim does not
1040 maintain independent queues of messages for specific domains or hosts, though
1041 it does try to send several messages in a single SMTP connection after a host
1042 has been down, and it also maintains per-host retry information.
1043 </para>
1044 </section>
1045 <section id="SECID11">
1046 <title>Policy control</title>
1047 <para>
1048 <indexterm role="concept">
1049 <primary>policy control</primary>
1050 <secondary>overview</secondary>
1051 </indexterm>
1052 Policy controls are now an important feature of MTAs that are connected to the
1053 Internet. Perhaps their most important job is to stop MTAs being abused as
1054 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1055 unsolicited junk, and want to disguise its source. Exim provides flexible
1056 facilities for specifying policy controls on incoming mail:
1057 </para>
1058 <itemizedlist>
1059 <listitem>
1060 <para>
1061 <indexterm role="concept">
1062 <primary>access control lists (ACLs)</primary>
1063 <secondary>introduction</secondary>
1064 </indexterm>
1065 Exim 4 (unlike previous versions of Exim) implements policy controls on
1066 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1067 series of statements that may either grant or deny access. ACLs can be used at
1068 several places in the SMTP dialogue while receiving a message from a remote
1069 host. However, the most common places are after each RCPT command, and at the
1070 very end of the message. The sysadmin can specify conditions for accepting or
1071 rejecting individual recipients or the entire message, respectively, at these
1072 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1073 error code.
1074 </para>
1075 </listitem>
1076 <listitem>
1077 <para>
1078 An ACL is also available for locally generated, non-SMTP messages. In this
1079 case, the only available actions are to accept or deny the entire message.
1080 </para>
1081 </listitem>
1082 <listitem>
1083 <para>
1084 When Exim is compiled with the content-scanning extension, facilities are
1085 provided in the ACL mechanism for passing the message to external virus and/or
1086 spam scanning software. The result of such a scan is passed back to the ACL,
1087 which can then use it to decide what to do with the message.
1088 </para>
1089 </listitem>
1090 <listitem>
1091 <para>
1092 When a message has been received, either from a remote host or from the local
1093 host, but before the final acknowledgment has been sent, a locally supplied C
1094 function called <function>local_scan()</function> can be run to inspect the message and decide
1095 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1096 is accepted, the list of recipients can be modified by the function.
1097 </para>
1098 </listitem>
1099 <listitem>
1100 <para>
1101 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1102 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1103 Exim to be compiled with the content-scanning extension.
1104 </para>
1105 </listitem>
1106 <listitem>
1107 <para>
1108 After a message has been accepted, a further checking mechanism is available in
1109 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1110 runs at the start of every delivery process.
1111 </para>
1112 </listitem>
1113 </itemizedlist>
1114 </section>
1115 <section id="SECID12">
1116 <title>User filters</title>
1117 <para>
1118 <indexterm role="concept">
1119 <primary>filter</primary>
1120 <secondary>introduction</secondary>
1121 </indexterm>
1122 <indexterm role="concept">
1123 <primary>Sieve filter</primary>
1124 </indexterm>
1125 In a conventional Exim configuration, users are able to run private filters by
1126 setting up appropriate <filename>.forward</filename> files in their home directories. See
1127 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1128 configuration needed to support this, and the separate document entitled
1129 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1130 of filtering are available:
1131 </para>
1132 <itemizedlist>
1133 <listitem>
1134 <para>
1135 Sieve filters are written in the standard filtering language that is defined
1136 by RFC 3028.
1137 </para>
1138 </listitem>
1139 <listitem>
1140 <para>
1141 Exim filters are written in a syntax that is unique to Exim, but which is more
1142 powerful than Sieve, which it pre-dates.
1143 </para>
1144 </listitem>
1145 </itemizedlist>
1146 <para>
1147 User filters are run as part of the routing process, described below.
1148 </para>
1149 </section>
1150 <section id="SECTmessiden">
1151 <title>Message identification</title>
1152 <para>
1153 <indexterm role="concept">
1154 <primary>message ids</primary>
1155 <secondary>details of format</secondary>
1156 </indexterm>
1157 <indexterm role="concept">
1158 <primary>format</primary>
1159 <secondary>of message id</secondary>
1160 </indexterm>
1161 <indexterm role="concept">
1162 <primary>id of message</primary>
1163 </indexterm>
1164 <indexterm role="concept">
1165 <primary>base62</primary>
1166 </indexterm>
1167 <indexterm role="concept">
1168 <primary>base36</primary>
1169 </indexterm>
1170 <indexterm role="concept">
1171 <primary>Darwin</primary>
1172 </indexterm>
1173 <indexterm role="concept">
1174 <primary>Cygwin</primary>
1175 </indexterm>
1176 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1177 characters long. It is divided into three parts, separated by hyphens, for
1178 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1179 normally encoding numbers in base 62. However, in the Darwin operating
1180 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1181 (avoiding the use of lower case letters) is used instead, because the message
1182 id is used to construct file names, and the names of files in those systems are
1183 not always case-sensitive.
1184 </para>
1185 <para>
1186 <indexterm role="concept">
1187 <primary>pid (process id)</primary>
1188 <secondary>re-use of</secondary>
1189 </indexterm>
1190 The detail of the contents of the message id have changed as Exim has evolved.
1191 Earlier versions relied on the operating system not re-using a process id (pid)
1192 within one second. On modern operating systems, this assumption can no longer
1193 be made, so the algorithm had to be changed. To retain backward compatibility,
1194 the format of the message id was retained, which is why the following rules are
1195 somewhat eccentric:
1196 </para>
1197 <itemizedlist>
1198 <listitem>
1199 <para>
1200 The first six characters of the message id are the time at which the message
1201 started to be received, to a granularity of one second. That is, this field
1202 contains the number of seconds since the start of the epoch (the normal Unix
1203 way of representing the date and time of day).
1204 </para>
1205 </listitem>
1206 <listitem>
1207 <para>
1208 After the first hyphen, the next six characters are the id of the process that
1209 received the message.
1210 </para>
1211 </listitem>
1212 <listitem>
1213 <para>
1214 There are two different possibilities for the final two characters:
1215 </para>
1216 <orderedlist numeration="arabic">
1217 <listitem>
1218 <para>
1219 <indexterm role="option">
1220 <primary><option>localhost_number</option></primary>
1221 </indexterm>
1222 If <option>localhost_number</option> is not set, this value is the fractional part of the
1223 time of reception, normally in units of 1/2000 of a second, but for systems
1224 that must use base 36 instead of base 62 (because of case-insensitive file
1225 systems), the units are 1/1000 of a second.
1226 </para>
1227 </listitem>
1228 <listitem>
1229 <para>
1230 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1231 the fractional part of the time, which in this case is in units of 1/200
1232 (1/100) of a second.
1233 </para>
1234 </listitem>
1235 </orderedlist>
1236 </listitem>
1237 </itemizedlist>
1238 <para>
1239 After a message has been received, Exim waits for the clock to tick at the
1240 appropriate resolution before proceeding, so that if another message is
1241 received by the same process, or by another process with the same (re-used)
1242 pid, it is guaranteed that the time will be different. In most cases, the clock
1243 will already have ticked while the message was being received.
1244 </para>
1245 </section>
1246 <section id="SECID13">
1247 <title>Receiving mail</title>
1248 <para>
1249 <indexterm role="concept">
1250 <primary>receiving mail</primary>
1251 </indexterm>
1252 <indexterm role="concept">
1253 <primary>message</primary>
1254 <secondary>reception</secondary>
1255 </indexterm>
1256 The only way Exim can receive mail from another host is using SMTP over
1257 TCP/IP, in which case the sender and recipient addresses are transferred using
1258 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1259 there are several possibilities:
1260 </para>
1261 <itemizedlist>
1262 <listitem>
1263 <para>
1264 If the process runs Exim with the <option>-bm</option> option, the message is read
1265 non-interactively (usually via a pipe), with the recipients taken from the
1266 command line, or from the body of the message if <option>-t</option> is also used.
1267 </para>
1268 </listitem>
1269 <listitem>
1270 <para>
1271 If the process runs Exim with the <option>-bS</option> option, the message is also read
1272 non-interactively, but in this case the recipients are listed at the start of
1273 the message in a series of SMTP RCPT commands, terminated by a DATA
1274 command. This is so-called <quote>batch SMTP</quote> format,
1275 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1276 envelope addresses in a non-interactive submission.
1277 </para>
1278 </listitem>
1279 <listitem>
1280 <para>
1281 If the process runs Exim with the <option>-bs</option> option, the message is read
1282 interactively, using the SMTP protocol. A two-way pipe is normally used for
1283 passing data between the local process and the Exim process.
1284 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1285 example, the ACLs for SMTP commands are used for this form of submission.
1286 </para>
1287 </listitem>
1288 <listitem>
1289 <para>
1290 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1291 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1292 does not treat the loopback address specially. It treats all such connections
1293 in the same way as connections from other hosts.
1294 </para>
1295 </listitem>
1296 </itemizedlist>
1297 <para>
1298 <indexterm role="concept">
1299 <primary>message sender, constructed by Exim</primary>
1300 </indexterm>
1301 <indexterm role="concept">
1302 <primary>sender</primary>
1303 <secondary>constructed by Exim</secondary>
1304 </indexterm>
1305 In the three cases that do not involve TCP/IP, the sender address is
1306 constructed from the login name of the user that called Exim and a default
1307 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1308 option). For local or batch SMTP, a sender address that is passed using the
1309 SMTP MAIL command is ignored. However, the system administrator may allow
1310 certain users (<quote>trusted users</quote>) to specify a different sender address
1311 unconditionally, or all users to specify certain forms of different sender
1312 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1313 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1314 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1315 users to change sender addresses.
1316 </para>
1317 <para>
1318 Messages received by either of the non-interactive mechanisms are subject to
1319 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1320 (either over TCP/IP, or interacting with a local process) can be checked by a
1321 number of ACLs that operate at different times during the SMTP session. Either
1322 individual recipients, or the entire message, can be rejected if local policy
1323 requirements are not met. The <function>local_scan()</function> function (see chapter
1324 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1325 </para>
1326 <para>
1327 Exim can be configured not to start a delivery process when a message is
1328 received; this can be unconditional, or depend on the number of incoming SMTP
1329 connections or the system load. In these situations, new messages wait on the
1330 queue until a queue runner process picks them up. However, in standard
1331 configurations under normal conditions, delivery is started as soon as a
1332 message is received.
1333 </para>
1334 </section>
1335 <section id="SECID14">
1336 <title>Handling an incoming message</title>
1337 <para>
1338 <indexterm role="concept">
1339 <primary>spool directory</primary>
1340 <secondary>files that hold a message</secondary>
1341 </indexterm>
1342 <indexterm role="concept">
1343 <primary>file</primary>
1344 <secondary>how a message is held</secondary>
1345 </indexterm>
1346 When Exim accepts a message, it writes two files in its spool directory. The
1347 first contains the envelope information, the current status of the message, and
1348 the header lines, and the second contains the body of the message. The names of
1349 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1350 file containing the envelope and header, and <literal>-D</literal> for the data file.
1351 </para>
1352 <para>
1353 <indexterm role="concept">
1354 <primary>spool directory</primary>
1355 <secondary><filename>input</filename> sub-directory</secondary>
1356 </indexterm>
1357 By default all these message files are held in a single directory called
1358 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1359 not perform very well if the number of files in a directory gets large; to
1360 improve performance in such cases, the <option>split_spool_directory</option> option can be
1361 used. This causes Exim to split up the input files into 62 sub-directories
1362 whose names are single letters or digits. When this is done, the queue is
1363 processed one sub-directory at a time instead of all at once, which can improve
1364 overall performance even when there are not enough files in each directory to
1365 affect file system performance.
1366 </para>
1367 <para>
1368 The envelope information consists of the address of the message&#x2019;s sender and
1369 the addresses of the recipients. This information is entirely separate from
1370 any addresses contained in the header lines. The status of the message includes
1371 a list of recipients who have already received the message. The format of the
1372 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1373 </para>
1374 <para>
1375 <indexterm role="concept">
1376 <primary>rewriting</primary>
1377 <secondary>addresses</secondary>
1378 </indexterm>
1379 Address rewriting that is specified in the rewrite section of the configuration
1380 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1381 both in the header lines and the envelope, at the time the message is accepted.
1382 If during the course of delivery additional addresses are generated (for
1383 example, via aliasing), these new addresses are rewritten as soon as they are
1384 generated. At the time a message is actually delivered (transported) further
1385 rewriting can take place; because this is a transport option, it can be
1386 different for different forms of delivery. It is also possible to specify the
1387 addition or removal of certain header lines at the time the message is
1388 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1389 <xref linkend="CHAPtransportgeneric"/>).
1390 </para>
1391 </section>
1392 <section id="SECID15">
1393 <title>Life of a message</title>
1394 <para>
1395 <indexterm role="concept">
1396 <primary>message</primary>
1397 <secondary>life of</secondary>
1398 </indexterm>
1399 <indexterm role="concept">
1400 <primary>message</primary>
1401 <secondary>frozen</secondary>
1402 </indexterm>
1403 A message remains in the spool directory until it is completely delivered to
1404 its recipients or to an error address, or until it is deleted by an
1405 administrator or by the user who originally created it. In cases when delivery
1406 cannot proceed &ndash; for example, when a message can neither be delivered to its
1407 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1408 spool, and no more deliveries are attempted.
1409 </para>
1410 <para>
1411 <indexterm role="concept">
1412 <primary>frozen messages</primary>
1413 <secondary>thawing</secondary>
1414 </indexterm>
1415 <indexterm role="concept">
1416 <primary>message</primary>
1417 <secondary>thawing frozen</secondary>
1418 </indexterm>
1419 An administrator can <quote>thaw</quote> such messages when the problem has been
1420 corrected, and can also freeze individual messages by hand if necessary. In
1421 addition, an administrator can force a delivery error, causing a bounce message
1422 to be sent.
1423 </para>
1424 <para>
1425 <indexterm role="option">
1426 <primary><option>timeout_frozen_after</option></primary>
1427 </indexterm>
1428 <indexterm role="option">
1429 <primary><option>ignore_bounce_errors_after</option></primary>
1430 </indexterm>
1431 There are options called <option>ignore_bounce_errors_after</option> and
1432 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1433 The first applies only to frozen bounces, the second to any frozen messages.
1434 </para>
1435 <para>
1436 <indexterm role="concept">
1437 <primary>message</primary>
1438 <secondary>log file for</secondary>
1439 </indexterm>
1440 <indexterm role="concept">
1441 <primary>log</primary>
1442 <secondary>file for each message</secondary>
1443 </indexterm>
1444 While Exim is working on a message, it writes information about each delivery
1445 attempt to its main log file. This includes successful, unsuccessful, and
1446 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1447 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1448 These logs are solely for the benefit of the administrator, and are normally
1449 deleted along with the spool files when processing of a message is complete.
1450 The use of individual message logs can be disabled by setting
1451 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1452 systems.
1453 </para>
1454 <para>
1455 <indexterm role="concept">
1456 <primary>journal file</primary>
1457 </indexterm>
1458 <indexterm role="concept">
1459 <primary>file</primary>
1460 <secondary>journal</secondary>
1461 </indexterm>
1462 All the information Exim itself needs to set up a delivery is kept in the first
1463 spool file, along with the header lines. When a successful delivery occurs, the
1464 address is immediately written at the end of a journal file, whose name is the
1465 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1466 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1467 is updated to indicate which these are, and the journal file is then deleted.
1468 Updating the spool file is done by writing a new file and renaming it, to
1469 minimize the possibility of data loss.
1470 </para>
1471 <para>
1472 Should the system or the program crash after a successful delivery but before
1473 the spool file has been updated, the journal is left lying around. The next
1474 time Exim attempts to deliver the message, it reads the journal file and
1475 updates the spool file before proceeding. This minimizes the chances of double
1476 deliveries caused by crashes.
1477 </para>
1478 </section>
1479 <section id="SECTprocaddress">
1480 <title>Processing an address for delivery</title>
1481 <para>
1482 <indexterm role="concept">
1483 <primary>drivers</primary>
1484 <secondary>definition of</secondary>
1485 </indexterm>
1486 <indexterm role="concept">
1487 <primary>router</primary>
1488 <secondary>definition of</secondary>
1489 </indexterm>
1490 <indexterm role="concept">
1491 <primary>transport</primary>
1492 <secondary>definition of</secondary>
1493 </indexterm>
1494 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1495 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1496 number of them is provided in the source distribution, and compile-time options
1497 specify which ones are included in the binary. Run time options specify which
1498 ones are actually used for delivering messages.
1499 </para>
1500 <para>
1501 <indexterm role="concept">
1502 <primary>drivers</primary>
1503 <secondary>instance definition</secondary>
1504 </indexterm>
1505 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1506 of that particular driver type. Multiple instances are allowed; for example,
1507 you can set up several different <command>smtp</command> transports, each with different
1508 option values that might specify different ports or different timeouts. Each
1509 instance has its own identifying name. In what follows we will normally use the
1510 instance name when discussing one particular instance (that is, one specific
1511 configuration of the driver), and the generic driver name when discussing
1512 the driver&#x2019;s features in general.
1513 </para>
1514 <para>
1515 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1516 its delivery should happen, by assigning it to a specific transport, or
1517 converting the address into one or more new addresses (for example, via an
1518 alias file). A router may also explicitly choose to fail an address, causing it
1519 to be bounced.
1520 </para>
1521 <para>
1522 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1523 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1524 transport, the destination is a file or a pipe on the local host, whereas for a
1525 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1526 to a specific transport as a result of successful routing. If a message has
1527 several recipients, it may be passed to a number of different transports.
1528 </para>
1529 <para>
1530 <indexterm role="concept">
1531 <primary>preconditions</primary>
1532 <secondary>definition of</secondary>
1533 </indexterm>
1534 An address is processed by passing it to each configured router instance in
1535 turn, subject to certain preconditions, until a router accepts the address or
1536 specifies that it should be bounced. We will describe this process in more
1537 detail shortly. First, as a simple example, we consider how each recipient
1538 address in a message is processed in a small configuration of three routers.
1539 </para>
1540 <para>
1541 To make this a more concrete example, it is described in terms of some actual
1542 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1543 routers in many different ways, and there may be any number of routers in a
1544 configuration.
1545 </para>
1546 <para>
1547 The first router that is specified in a configuration is often one that handles
1548 addresses in domains that are not recognized specially by the local host. These
1549 are typically addresses for arbitrary domains on the Internet. A precondition
1550 is set up which looks for the special domains known to the host (for example,
1551 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1552 match. Typically, this is a router that looks up domains in the DNS in order to
1553 find the hosts to which this address routes. If it succeeds, the address is
1554 assigned to a suitable SMTP transport; if it does not succeed, the router is
1555 configured to fail the address.
1556 </para>
1557 <para>
1558 The second router is reached only when the domain is recognized as one that
1559 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1560 aliasing and forwarding. When it generates one or more new addresses from the
1561 original, each of them is routed independently from the start. Otherwise, the
1562 router may cause an address to fail, or it may simply decline to handle the
1563 address, in which case the address is passed to the next router.
1564 </para>
1565 <para>
1566 The final router in many configurations is one that checks to see if the
1567 address belongs to a local mailbox. The precondition may involve a check to
1568 see if the local part is the name of a login account, or it may look up the
1569 local part in a file or a database. If its preconditions are not met, or if
1570 the router declines, we have reached the end of the routers. When this happens,
1571 the address is bounced.
1572 </para>
1573 </section>
1574 <section id="SECID16">
1575 <title>Processing an address for verification</title>
1576 <para>
1577 <indexterm role="concept">
1578 <primary>router</primary>
1579 <secondary>for verification</secondary>
1580 </indexterm>
1581 <indexterm role="concept">
1582 <primary>verifying address</primary>
1583 <secondary>overview</secondary>
1584 </indexterm>
1585 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1586 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1587 one of the checks to be performed in an ACL for incoming messages, on both
1588 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1589 <option>-bvs</option> command line options.
1590 </para>
1591 <para>
1592 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1593 does not affect the way the routers work, but it is a state that can be
1594 detected. By this means, a router can be skipped or made to behave differently
1595 when verifying. A common example is a configuration in which the first router
1596 sends all messages to a message-scanning program, unless they have been
1597 previously scanned. Thus, the first router accepts all addresses without any
1598 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1599 would be set for such a router, causing it to be skipped in verify mode.
1600 </para>
1601 </section>
1602 <section id="SECTrunindrou">
1603 <title>Running an individual router</title>
1604 <para>
1605 <indexterm role="concept">
1606 <primary>router</primary>
1607 <secondary>running details</secondary>
1608 </indexterm>
1609 <indexterm role="concept">
1610 <primary>preconditions</primary>
1611 <secondary>checking</secondary>
1612 </indexterm>
1613 <indexterm role="concept">
1614 <primary>router</primary>
1615 <secondary>result of running</secondary>
1616 </indexterm>
1617 As explained in the example above, a number of preconditions are checked before
1618 running a router. If any are not met, the router is skipped, and the address is
1619 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1620 the router is run. What happens next depends on the outcome, which is one of
1621 the following:
1622 </para>
1623 <itemizedlist>
1624 <listitem>
1625 <para>
1626 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1627 transport, or generates one or more <quote>child</quote> addresses. Processing the
1628 original address ceases,
1629 <indexterm role="option">
1630 <primary><option>unseen</option></primary>
1631 </indexterm>
1632 unless the <option>unseen</option> option is set on the router. This option
1633 can be used to set up multiple deliveries with different routing (for example,
1634 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1635 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1636 end of routing.
1637 </para>
1638 <para>
1639 Any child addresses generated by the router are processed independently,
1640 starting with the first router by default. It is possible to change this by
1641 setting the <option>redirect_router</option> option to specify which router to start at for
1642 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1643 <option>redirect_router</option> may be anywhere in the router configuration.
1644 </para>
1645 </listitem>
1646 <listitem>
1647 <para>
1648 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1649 requests that the address be passed to another router. By default the address
1650 is passed to the next router, but this can be changed by setting the
1651 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1652 must be below the current router (to avoid loops).
1653 </para>
1654 </listitem>
1655 <listitem>
1656 <para>
1657 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1658 recognize it at all. By default, the address is passed to the next router, but
1659 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1660 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1661 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1662 </para>
1663 </listitem>
1664 <listitem>
1665 <para>
1666 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1667 the generation of a bounce message. There is no further processing of the
1668 original address unless <option>unseen</option> is set on the router.
1669 </para>
1670 </listitem>
1671 <listitem>
1672 <para>
1673 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1674 database may be offline, or a DNS lookup may have timed out.) No further
1675 processing of the address happens in this delivery attempt. It is tried again
1676 next time the message is considered for delivery.
1677 </para>
1678 </listitem>
1679 <listitem>
1680 <para>
1681 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1682 its configuration). The action is as for defer.
1683 </para>
1684 </listitem>
1685 </itemizedlist>
1686 <para>
1687 If an address reaches the end of the routers without having been accepted by
1688 any of them, it is bounced as unrouteable. The default error message in this
1689 situation is <quote>unrouteable address</quote>, but you can set your own message by
1690 making use of the <option>cannot_route_message</option> option. This can be set for any
1691 router; the value from the last router that <quote>saw</quote> the address is used.
1692 </para>
1693 <para>
1694 Sometimes while routing you want to fail a delivery when some conditions are
1695 met but others are not, instead of passing the address on for further routing.
1696 You can do this by having a second router that explicitly fails the delivery
1697 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1698 facility for this purpose.
1699 </para>
1700 </section>
1701 <section id="SECID17">
1702 <title>Duplicate addresses</title>
1703 <para>
1704 <indexterm role="concept">
1705 <primary>case of local parts</primary>
1706 </indexterm>
1707 <indexterm role="concept">
1708 <primary>address duplicate, discarding</primary>
1709 </indexterm>
1710 <indexterm role="concept">
1711 <primary>duplicate addresses</primary>
1712 </indexterm>
1713 Once routing is complete, Exim scans the addresses that are assigned to local
1714 and remote transports, and discards any duplicates that it finds. During this
1715 check, local parts are treated as case-sensitive. This happens only when
1716 actually delivering a message; when testing routers with <option>-bt</option>, all the
1717 routed addresses are shown.
1718 </para>
1719 </section>
1720 <section id="SECTrouprecon">
1721 <title>Router preconditions</title>
1722 <para>
1723 <indexterm role="concept">
1724 <primary>router</primary>
1725 <secondary>preconditions, order of processing</secondary>
1726 </indexterm>
1727 <indexterm role="concept">
1728 <primary>preconditions</primary>
1729 <secondary>order of processing</secondary>
1730 </indexterm>
1731 The preconditions that are tested for each router are listed below, in the
1732 order in which they are tested. The individual configuration options are
1733 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1734 </para>
1735 <itemizedlist>
1736 <listitem>
1737 <para>
1738 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1739 the local parts handled by the router may or must have certain prefixes and/or
1740 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1741 skipped. These conditions are tested first. When an affix is present, it is
1742 removed from the local part before further processing, including the evaluation
1743 of any other conditions.
1744 </para>
1745 </listitem>
1746 <listitem>
1747 <para>
1748 Routers can be designated for use only when not verifying an address, that is,
1749 only when routing it for delivery (or testing its delivery routing). If the
1750 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1751 address.
1752 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1753 <option>verify_recipient</option>, which independently control the use of the router for
1754 sender and recipient verification. You can set these options directly if
1755 you want a router to be used for only one type of verification.
1756 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1757 </para>
1758 </listitem>
1759 <listitem>
1760 <para>
1761 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1762 run with the <option>-bt</option> option to test an address routing. This can be helpful
1763 when the first router sends all new messages to a scanner of some sort; it
1764 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1765 having to simulate the effect of the scanner.
1766 </para>
1767 </listitem>
1768 <listitem>
1769 <para>
1770 Routers can be designated for use only when verifying an address, as
1771 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1772 Again, cutthrough delivery counts as a verification.
1773 </para>
1774 </listitem>
1775 <listitem>
1776 <para>
1777 Individual routers can be explicitly skipped when running the routers to
1778 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1779 </para>
1780 </listitem>
1781 <listitem>
1782 <para>
1783 If the <option>domains</option> option is set, the domain of the address must be in the set
1784 of domains that it defines.
1785 </para>
1786 </listitem>
1787 <listitem>
1788 <para>
1789 <indexterm role="variable">
1790 <primary><varname>$local_part_prefix</varname></primary>
1791 </indexterm>
1792 <indexterm role="variable">
1793 <primary><varname>$local_part</varname></primary>
1794 </indexterm>
1795 <indexterm role="variable">
1796 <primary><varname>$local_part_suffix</varname></primary>
1797 </indexterm>
1798 If the <option>local_parts</option> option is set, the local part of the address must be in
1799 the set of local parts that it defines. If <option>local_part_prefix</option> or
1800 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1801 part before this check. If you want to do precondition tests on local parts
1802 that include affixes, you can do so by using a <option>condition</option> option (see below)
1803 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1804 <varname>$local_part_suffix</varname> as necessary.
1805 </para>
1806 </listitem>
1807 <listitem>
1808 <para>
1809 <indexterm role="variable">
1810 <primary><varname>$local_user_uid</varname></primary>
1811 </indexterm>
1812 <indexterm role="variable">
1813 <primary><varname>$local_user_gid</varname></primary>
1814 </indexterm>
1815 <indexterm role="variable">
1816 <primary><varname>$home</varname></primary>
1817 </indexterm>
1818 If the <option>check_local_user</option> option is set, the local part must be the name of
1819 an account on the local host. If this check succeeds, the uid and gid of the
1820 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1821 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1822 remaining preconditions.
1823 </para>
1824 </listitem>
1825 <listitem>
1826 <para>
1827 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1828 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1829 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1830 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1831 could lead to confusion.
1832 </para>
1833 </listitem>
1834 <listitem>
1835 <para>
1836 If the <option>senders</option> option is set, the envelope sender address must be in the
1837 set of addresses that it defines.
1838 </para>
1839 </listitem>
1840 <listitem>
1841 <para>
1842 If the <option>require_files</option> option is set, the existence or non-existence of
1843 specified files is tested.
1844 </para>
1845 </listitem>
1846 <listitem>
1847 <para>
1848 <indexterm role="concept">
1849 <primary>customizing</primary>
1850 <secondary>precondition</secondary>
1851 </indexterm>
1852 If the <option>condition</option> option is set, it is evaluated and tested. This option
1853 uses an expanded string to allow you to set up your own custom preconditions.
1854 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1855 </para>
1856 </listitem>
1857 </itemizedlist>
1858 <para>
1859 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1860 it to check for the existence of a file in which to lookup up a domain, local
1861 part, or sender. However, as these options are all expanded, you can use the
1862 <option>exists</option> expansion condition to make such tests within each condition. The
1863 <option>require_files</option> option is intended for checking files that the router may be
1864 going to use internally, or which are needed by a specific transport (for
1865 example, <filename>.procmailrc</filename>).
1866 </para>
1867 </section>
1868 <section id="SECID18">
1869 <title>Delivery in detail</title>
1870 <para>
1871 <indexterm role="concept">
1872 <primary>delivery</primary>
1873 <secondary>in detail</secondary>
1874 </indexterm>
1875 When a message is to be delivered, the sequence of events is as follows:
1876 </para>
1877 <itemizedlist>
1878 <listitem>
1879 <para>
1880 If a system-wide filter file is specified, the message is passed to it. The
1881 filter may add recipients to the message, replace the recipients, discard the
1882 message, cause a new message to be generated, or cause the message delivery to
1883 fail. The format of the system filter file is the same as for Exim user filter
1884 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1885 filtering</emphasis>.
1886 <indexterm role="concept">
1887 <primary>Sieve filter</primary>
1888 <secondary>not available for system filter</secondary>
1889 </indexterm>
1890 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1891 </para>
1892 <para>
1893 Some additional features are available in system filters &ndash; see chapter
1894 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1895 filter only once per delivery attempt, however many recipients it has. However,
1896 if there are several delivery attempts because one or more addresses could not
1897 be immediately delivered, the system filter is run each time. The filter
1898 condition <option>first_delivery</option> can be used to detect the first run of the system
1899 filter.
1900 </para>
1901 </listitem>
1902 <listitem>
1903 <para>
1904 Each recipient address is offered to each configured router in turn, subject to
1905 its preconditions, until one is able to handle it. If no router can handle the
1906 address, that is, if they all decline, the address is failed. Because routers
1907 can be targeted at particular domains, several locally handled domains can be
1908 processed entirely independently of each other.
1909 </para>
1910 </listitem>
1911 <listitem>
1912 <para>
1913 <indexterm role="concept">
1914 <primary>routing</primary>
1915 <secondary>loops in</secondary>
1916 </indexterm>
1917 <indexterm role="concept">
1918 <primary>loop</primary>
1919 <secondary>while routing</secondary>
1920 </indexterm>
1921 A router that accepts an address may assign it to a local or a remote
1922 transport. However, the transport is not run at this time. Instead, the address
1923 is placed on a list for the particular transport, which will be run later.
1924 Alternatively, the router may generate one or more new addresses (typically
1925 from alias, forward, or filter files). New addresses are fed back into this
1926 process from the top, but in order to avoid loops, a router ignores any address
1927 which has an identically-named ancestor that was processed by itself.
1928 </para>
1929 </listitem>
1930 <listitem>
1931 <para>
1932 When all the routing has been done, addresses that have been successfully
1933 handled are passed to their assigned transports. When local transports are
1934 doing real local deliveries, they handle only one address at a time, but if a
1935 local transport is being used as a pseudo-remote transport (for example, to
1936 collect batched SMTP messages for transmission by some other means) multiple
1937 addresses can be handled. Remote transports can always handle more than one
1938 address at a time, but can be configured not to do so, or to restrict multiple
1939 addresses to the same domain.
1940 </para>
1941 </listitem>
1942 <listitem>
1943 <para>
1944 Each local delivery to a file or a pipe runs in a separate process under a
1945 non-privileged uid, and these deliveries are run one at a time. Remote
1946 deliveries also run in separate processes, normally under a uid that is private
1947 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1948 run in parallel. The maximum number of simultaneous remote deliveries for any
1949 one message is set by the <option>remote_max_parallel</option> option.
1950 The order in which deliveries are done is not defined, except that all local
1951 deliveries happen before any remote deliveries.
1952 </para>
1953 </listitem>
1954 <listitem>
1955 <para>
1956 <indexterm role="concept">
1957 <primary>queue runner</primary>
1958 </indexterm>
1959 When it encounters a local delivery during a queue run, Exim checks its retry
1960 database to see if there has been a previous temporary delivery failure for the
1961 address before running the local transport. If there was a previous failure,
1962 Exim does not attempt a new delivery until the retry time for the address is
1963 reached. However, this happens only for delivery attempts that are part of a
1964 queue run. Local deliveries are always attempted when delivery immediately
1965 follows message reception, even if retry times are set for them. This makes for
1966 better behaviour if one particular message is causing problems (for example,
1967 causing quota overflow, or provoking an error in a filter file).
1968 </para>
1969 </listitem>
1970 <listitem>
1971 <para>
1972 <indexterm role="concept">
1973 <primary>delivery</primary>
1974 <secondary>retry in remote transports</secondary>
1975 </indexterm>
1976 Remote transports do their own retry handling, since an address may be
1977 deliverable to one of a number of hosts, each of which may have a different
1978 retry time. If there have been previous temporary failures and no host has
1979 reached its retry time, no delivery is attempted, whether in a queue run or
1980 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1981 </para>
1982 </listitem>
1983 <listitem>
1984 <para>
1985 If there were any permanent errors, a bounce message is returned to an
1986 appropriate address (the sender in the common case), with details of the error
1987 for each failing address. Exim can be configured to send copies of bounce
1988 messages to other addresses.
1989 </para>
1990 </listitem>
1991 <listitem>
1992 <para>
1993 <indexterm role="concept">
1994 <primary>delivery</primary>
1995 <secondary>deferral</secondary>
1996 </indexterm>
1997 If one or more addresses suffered a temporary failure, the message is left on
1998 the queue, to be tried again later. Delivery of these addresses is said to be
1999 <emphasis>deferred</emphasis>.
2000 </para>
2001 </listitem>
2002 <listitem>
2003 <para>
2004 When all the recipient addresses have either been delivered or bounced,
2005 handling of the message is complete. The spool files and message log are
2006 deleted, though the message log can optionally be preserved if required.
2007 </para>
2008 </listitem>
2009 </itemizedlist>
2010 </section>
2011 <section id="SECID19">
2012 <title>Retry mechanism</title>
2013 <para>
2014 <indexterm role="concept">
2015 <primary>delivery</primary>
2016 <secondary>retry mechanism</secondary>
2017 </indexterm>
2018 <indexterm role="concept">
2019 <primary>retry</primary>
2020 <secondary>description of mechanism</secondary>
2021 </indexterm>
2022 <indexterm role="concept">
2023 <primary>queue runner</primary>
2024 </indexterm>
2025 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2026 attempt is the queue runner process. You must either run an Exim daemon that
2027 uses the <option>-q</option> option with a time interval to start queue runners at regular
2028 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2029 not arrange for queue runners to be run, messages that fail temporarily at the
2030 first attempt will remain on your queue for ever. A queue runner process works
2031 its way through the queue, one message at a time, trying each delivery that has
2032 passed its retry time.
2033 You can run several queue runners at once.
2034 </para>
2035 <para>
2036 Exim uses a set of configured rules to determine when next to retry the failing
2037 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2038 should give up trying to deliver to the address, at which point it generates a
2039 bounce message. If no retry rules are set for a particular host, address, and
2040 error combination, no retries are attempted, and temporary errors are treated
2041 as permanent.
2042 </para>
2043 </section>
2044 <section id="SECID20">
2045 <title>Temporary delivery failure</title>
2046 <para>
2047 <indexterm role="concept">
2048 <primary>delivery</primary>
2049 <secondary>temporary failure</secondary>
2050 </indexterm>
2051 There are many reasons why a message may not be immediately deliverable to a
2052 particular address. Failure to connect to a remote machine (because it, or the
2053 connection to it, is down) is one of the most common. Temporary failures may be
2054 detected during routing as well as during the transport stage of delivery.
2055 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2056 is on a file system where the user is over quota. Exim can be configured to
2057 impose its own quotas on local mailboxes; where system quotas are set they will
2058 also apply.
2059 </para>
2060 <para>
2061 If a host is unreachable for a period of time, a number of messages may be
2062 waiting for it by the time it recovers, and sending them in a single SMTP
2063 connection is clearly beneficial. Whenever a delivery to a remote host is
2064 deferred,
2065 <indexterm role="concept">
2066 <primary>hints database</primary>
2067 <secondary>deferred deliveries</secondary>
2068 </indexterm>
2069 Exim makes a note in its hints database, and whenever a successful
2070 SMTP delivery has happened, it looks to see if any other messages are waiting
2071 for the same host. If any are found, they are sent over the same SMTP
2072 connection, subject to a configuration limit as to the maximum number in any
2073 one connection.
2074 </para>
2075 </section>
2076 <section id="SECID21">
2077 <title>Permanent delivery failure</title>
2078 <para>
2079 <indexterm role="concept">
2080 <primary>delivery</primary>
2081 <secondary>permanent failure</secondary>
2082 </indexterm>
2083 <indexterm role="concept">
2084 <primary>bounce message</primary>
2085 <secondary>when generated</secondary>
2086 </indexterm>
2087 When a message cannot be delivered to some or all of its intended recipients, a
2088 bounce message is generated. Temporary delivery failures turn into permanent
2089 errors when their timeout expires. All the addresses that fail in a given
2090 delivery attempt are listed in a single message. If the original message has
2091 many recipients, it is possible for some addresses to fail in one delivery
2092 attempt and others to fail subsequently, giving rise to more than one bounce
2093 message. The wording of bounce messages can be customized by the administrator.
2094 See chapter <xref linkend="CHAPemsgcust"/> for details.
2095 </para>
2096 <para>
2097 <indexterm role="concept">
2098 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2099 </indexterm>
2100 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2101 failed addresses, for the benefit of programs that try to analyse such messages
2102 automatically.
2103 </para>
2104 <para>
2105 <indexterm role="concept">
2106 <primary>bounce message</primary>
2107 <secondary>recipient of</secondary>
2108 </indexterm>
2109 A bounce message is normally sent to the sender of the original message, as
2110 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2111 address given in the MAIL command. However, when an address is expanded via a
2112 forward or alias file, an alternative address can be specified for delivery
2113 failures of the generated addresses. For a mailing list expansion (see section
2114 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2115 of the list.
2116 </para>
2117 </section>
2118 <section id="SECID22">
2119 <title>Failures to deliver bounce messages</title>
2120 <para>
2121 <indexterm role="concept">
2122 <primary>bounce message</primary>
2123 <secondary>failure to deliver</secondary>
2124 </indexterm>
2125 If a bounce message (either locally generated or received from a remote host)
2126 itself suffers a permanent delivery failure, the message is left on the queue,
2127 but it is frozen, awaiting the attention of an administrator. There are options
2128 that can be used to make Exim discard such failed messages, or to keep them
2129 for only a short time (see <option>timeout_frozen_after</option> and
2130 <option>ignore_bounce_errors_after</option>).
2131 </para>
2132 </section>
2133 </chapter>
2134
2135 <chapter id="CHID3">
2136 <title>Building and installing Exim</title>
2137 <para>
2138 <indexterm role="concept" id="IIDbuex" class="startofrange">
2139 <primary>building Exim</primary>
2140 </indexterm>
2141 </para>
2142 <section id="SECID23">
2143 <title>Unpacking</title>
2144 <para>
2145 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2146 creates a directory with the name of the current release (for example,
2147 <filename>exim-4.91</filename>) into which the following files are placed:
2148 </para>
2149 <informaltable frame="none">
2150 <tgroup cols="2" colsep="0" rowsep="0">
2151 <colspec colwidth="140pt" align="left"/>
2152 <colspec colwidth="254pt" align="left"/>
2153 <tbody>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2156 <entry>contains some acknowledgments</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2160 <entry>contains a reference to where changes are documented</entry>
2161 </row>
2162 <row>
2163 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2164 <entry>the GNU General Public Licence</entry>
2165 </row>
2166 <row>
2167 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2168 <entry>top-level make file</entry>
2169 </row>
2170 <row>
2171 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2172 <entry>conditions for the use of Exim</entry>
2173 </row>
2174 <row>
2175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2176 <entry>list of files, directories and simple build instructions</entry>
2177 </row>
2178 </tbody>
2179 </tgroup>
2180 </informaltable>
2181 <para>
2182 Other files whose names begin with <filename>README</filename> may also be present. The
2183 following subdirectories are created:
2184 </para>
2185 <informaltable frame="none">
2186 <tgroup cols="2" colsep="0" rowsep="0">
2187 <colspec colwidth="140pt" align="left"/>
2188 <colspec colwidth="254pt" align="left"/>
2189 <tbody>
2190 <row>
2191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2192 <entry>an empty directory for local configuration files</entry>
2193 </row>
2194 <row>
2195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2196 <entry>OS-specific files</entry>
2197 </row>
2198 <row>
2199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2200 <entry>documentation files</entry>
2201 </row>
2202 <row>
2203 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2204 <entry>source files for the Exim monitor</entry>
2205 </row>
2206 <row>
2207 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2208 <entry>scripts used in the build process</entry>
2209 </row>
2210 <row>
2211 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2212 <entry>remaining source files</entry>
2213 </row>
2214 <row>
2215 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2216 <entry>independent utilities</entry>
2217 </row>
2218 </tbody>
2219 </tgroup>
2220 </informaltable>
2221 <para>
2222 The main utility programs are contained in the <filename>src</filename> directory, and are built
2223 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2224 that may be useful to some sites.
2225 </para>
2226 </section>
2227 <section id="SECID24">
2228 <title>Multiple machine architectures and operating systems</title>
2229 <para>
2230 <indexterm role="concept">
2231 <primary>building Exim</primary>
2232 <secondary>multiple OS/architectures</secondary>
2233 </indexterm>
2234 The building process for Exim is arranged to make it easy to build binaries for
2235 a number of different architectures and operating systems from the same set of
2236 source files. Compilation does not take place in the <filename>src</filename> directory.
2237 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2238 system.
2239 <indexterm role="concept">
2240 <primary>symbolic link</primary>
2241 <secondary>to build directory</secondary>
2242 </indexterm>
2243 Symbolic links to the sources are installed in this directory, which is where
2244 the actual building takes place. In most cases, Exim can discover the machine
2245 architecture and operating system for itself, but the defaults can be
2246 overridden if necessary.
2247 <indexterm role="concept">
2248 <primary>compiler</primary>
2249 <secondary>requirements</secondary>
2250 </indexterm>
2251 <indexterm role="concept">
2252 <primary>compiler</primary>
2253 <secondary>version</secondary>
2254 </indexterm>
2255 A C99-capable compiler will be required for the build.
2256 </para>
2257 </section>
2258 <section id="SECTpcre">
2259 <title>PCRE library</title>
2260 <para>
2261 <indexterm role="concept">
2262 <primary>PCRE library</primary>
2263 </indexterm>
2264 Exim no longer has an embedded PCRE library as the vast majority of
2265 modern systems include PCRE as a system library, although you may need
2266 to install the PCRE or PCRE development package for your operating
2267 system. If your system has a normal PCRE installation the Exim build
2268 process will need no further configuration. If the library or the
2269 headers are in an unusual location you will need to either set the PCRE_LIBS
2270 and INCLUDE directives appropriately,
2271 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2272 If your operating system has no
2273 PCRE support then you will need to obtain and build the current PCRE
2274 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>.
2275 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2276 </para>
2277 </section>
2278 <section id="SECTdb">
2279 <title>DBM libraries</title>
2280 <para>
2281 <indexterm role="concept">
2282 <primary>DBM libraries</primary>
2283 <secondary>discussion of</secondary>
2284 </indexterm>
2285 <indexterm role="concept">
2286 <primary>hints database</primary>
2287 <secondary>DBM files used for</secondary>
2288 </indexterm>
2289 Even if you do not use any DBM files in your configuration, Exim still needs a
2290 DBM library in order to operate, because it uses indexed files for its hints
2291 databases. Unfortunately, there are a number of DBM libraries in existence, and
2292 different operating systems often have different ones installed.
2293 </para>
2294 <para>
2295 <indexterm role="concept">
2296 <primary>Solaris</primary>
2297 <secondary>DBM library for</secondary>
2298 </indexterm>
2299 <indexterm role="concept">
2300 <primary>IRIX, DBM library for</primary>
2301 </indexterm>
2302 <indexterm role="concept">
2303 <primary>BSD, DBM library for</primary>
2304 </indexterm>
2305 <indexterm role="concept">
2306 <primary>Linux, DBM library for</primary>
2307 </indexterm>
2308 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2309 Linux distribution, the DBM configuration should happen automatically, and you
2310 may be able to ignore this section. Otherwise, you may have to learn more than
2311 you would like about DBM libraries from what follows.
2312 </para>
2313 <para>
2314 <indexterm role="concept">
2315 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2316 </indexterm>
2317 Licensed versions of Unix normally contain a library of DBM functions operating
2318 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2319 versions of Unix seem to vary in what they contain as standard. In particular,
2320 some early versions of Linux have no default DBM library, and different
2321 distributors have chosen to bundle different libraries with their packaged
2322 versions. However, the more recent releases seem to have standardized on the
2323 Berkeley DB library.
2324 </para>
2325 <para>
2326 Different DBM libraries have different conventions for naming the files they
2327 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2328 possibilities:
2329 </para>
2330 <orderedlist numeration="arabic">
2331 <listitem>
2332 <para>
2333 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2334 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2335 </para>
2336 </listitem>
2337 <listitem>
2338 <para>
2339 <indexterm role="concept">
2340 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2341 </indexterm>
2342 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2343 compatibility interface it makes two different hard links to it with names
2344 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2345 file name is used unmodified.
2346 </para>
2347 </listitem>
2348 <listitem>
2349 <para>
2350 <indexterm role="concept">
2351 <primary>Berkeley DB library</primary>
2352 </indexterm>
2353 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2354 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2355 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2356 </para>
2357 </listitem>
2358 <listitem>
2359 <para>
2360 If the Berkeley package is used in its native mode, it operates on a single
2361 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2362 the traditional <emphasis>ndbm</emphasis> interface.
2363 </para>
2364 </listitem>
2365 <listitem>
2366 <para>
2367 To complicate things further, there are several very different versions of the
2368 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2369 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2370 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2371 versions of Berkeley DB can be obtained from
2372 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2373 </para>
2374 </listitem>
2375 <listitem>
2376 <para>
2377 <indexterm role="concept">
2378 <primary><emphasis>tdb</emphasis> DBM library</primary>
2379 </indexterm>
2380 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2381 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2382 operates on a single file.
2383 </para>
2384 </listitem>
2385 </orderedlist>
2386 <para>
2387 <indexterm role="concept">
2388 <primary>USE_DB</primary>
2389 </indexterm>
2390 <indexterm role="concept">
2391 <primary>DBM libraries</primary>
2392 <secondary>configuration for building</secondary>
2393 </indexterm>
2394 Exim and its utilities can be compiled to use any of these interfaces. In order
2395 to use any version of the Berkeley DB package in native mode, you must set
2396 USE_DB in an appropriate configuration file (typically
2397 <filename>Local/Makefile</filename>). For example:
2398 </para>
2399 <literallayout class="monospaced">
2400 USE_DB=yes
2401 </literallayout>
2402 <para>
2403 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2404 error is diagnosed if you set more than one of these.
2405 </para>
2406 <para>
2407 At the lowest level, the build-time configuration sets none of these options,
2408 thereby assuming an interface of type (1). However, some operating system
2409 configuration files (for example, those for the BSD operating systems and
2410 Linux) assume type (4) by setting USE_DB as their default, and the
2411 configuration files for Cygwin set USE_GDBM. Anything you set in
2412 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2413 </para>
2414 <para>
2415 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2416 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2417 in one of these lines:
2418 </para>
2419 <literallayout class="monospaced">
2420 DBMLIB = -ldb
2421 DBMLIB = -ltdb
2422 </literallayout>
2423 <para>
2424 Settings like that will work if the DBM library is installed in the standard
2425 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2426 the default path. You may need to set INCLUDE to specify where the header
2427 file is, and to specify the path to the library more fully in DBMLIB, as in
2428 this example:
2429 </para>
2430 <literallayout class="monospaced">
2431 INCLUDE=-I/usr/local/include/db-4.1
2432 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2433 </literallayout>
2434 <para>
2435 There is further detailed discussion about the various DBM libraries in the
2436 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2437 </para>
2438 </section>
2439 <section id="SECID25">
2440 <title>Pre-building configuration</title>
2441 <para>
2442 <indexterm role="concept">
2443 <primary>building Exim</primary>
2444 <secondary>pre-building configuration</secondary>
2445 </indexterm>
2446 <indexterm role="concept">
2447 <primary>configuration for building Exim</primary>
2448 </indexterm>
2449 <indexterm role="concept">
2450 <primary><filename>Local/Makefile</filename></primary>
2451 </indexterm>
2452 <indexterm role="concept">
2453 <primary><filename>src/EDITME</filename></primary>
2454 </indexterm>
2455 Before building Exim, a local configuration file that specifies options
2456 independent of any operating system has to be created with the name
2457 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2458 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2459 therein. These descriptions are therefore not repeated here. If you are
2460 building Exim for the first time, the simplest thing to do is to copy
2461 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2462 </para>
2463 <para>
2464 There are three settings that you must supply, because Exim will not build
2465 without them. They are the location of the run time configuration file
2466 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2467 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2468 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2469 a colon-separated list of file names; Exim uses the first of them that exists.
2470 </para>
2471 <para>
2472 There are a few other parameters that can be specified either at build time or
2473 at run time, to enable the same binary to be used on a number of different
2474 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2475 directory (if not within the spool directory) are fixed, it is recommended that
2476 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2477 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2478 be logged.
2479 </para>
2480 <para>
2481 <indexterm role="concept">
2482 <primary>content scanning</primary>
2483 <secondary>specifying at build time</secondary>
2484 </indexterm>
2485 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2486 access control lists are not compiled by default. If you want to include these
2487 facilities, you need to set
2488 </para>
2489 <literallayout class="monospaced">
2490 WITH_CONTENT_SCAN=yes
2491 </literallayout>
2492 <para>
2493 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2494 chapter <xref linkend="CHAPexiscan"/>.
2495 </para>
2496 <para>
2497 <indexterm role="concept">
2498 <primary><filename>Local/eximon.conf</filename></primary>
2499 </indexterm>
2500 <indexterm role="concept">
2501 <primary><filename>exim_monitor/EDITME</filename></primary>
2502 </indexterm>
2503 If you are going to build the Exim monitor, a similar configuration process is
2504 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2505 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2506 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2507 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2508 </para>
2509 <para>
2510 This is all the configuration that is needed in straightforward cases for known
2511 operating systems. However, the building process is set up so that it is easy
2512 to override options that are set by default or by operating-system-specific
2513 configuration files, for example to change the name of the C compiler, which
2514 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2515 do this.
2516 </para>
2517 </section>
2518 <section id="SECID26">
2519 <title>Support for iconv()</title>
2520 <para>
2521 <indexterm role="concept">
2522 <primary><function>iconv()</function> support</primary>
2523 </indexterm>
2524 <indexterm role="concept">
2525 <primary>RFC 2047</primary>
2526 </indexterm>
2527 The contents of header lines in messages may be encoded according to the rules
2528 described RFC 2047. This makes it possible to transmit characters that are not
2529 in the ASCII character set, and to label them as being in a particular
2530 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2531 mechanism, it decodes them, and translates them into a specified character set
2532 (default is set at build time). The translation is possible only if the operating system
2533 supports the <function>iconv()</function> function.
2534 </para>
2535 <para>
2536 However, some of the operating systems that supply <function>iconv()</function> do not support
2537 very many conversions. The GNU <option>libiconv</option> library (available from
2538 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2539 systems to remedy this deficiency, as well as on systems that do not supply
2540 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2541 </para>
2542 <literallayout class="monospaced">
2543 HAVE_ICONV=yes
2544 </literallayout>
2545 <para>
2546 to your <filename>Local/Makefile</filename> and rebuild Exim.
2547 </para>
2548 </section>
2549 <section id="SECTinctlsssl">
2550 <title>Including TLS/SSL encryption support</title>
2551 <para>
2552 <indexterm role="concept">
2553 <primary>TLS</primary>
2554 <secondary>including support for TLS</secondary>
2555 </indexterm>
2556 <indexterm role="concept">
2557 <primary>encryption</primary>
2558 <secondary>including support for</secondary>
2559 </indexterm>
2560 <indexterm role="concept">
2561 <primary>SUPPORT_TLS</primary>
2562 </indexterm>
2563 <indexterm role="concept">
2564 <primary>OpenSSL</primary>
2565 <secondary>building Exim with</secondary>
2566 </indexterm>
2567 <indexterm role="concept">
2568 <primary>GnuTLS</primary>
2569 <secondary>building Exim with</secondary>
2570 </indexterm>
2571 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2572 command as per RFC 2487. It can also support legacy clients that expect to
2573 start a TLS session immediately on connection to a non-standard port (see the
2574 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2575 line option).
2576 </para>
2577 <para>
2578 If you want to build Exim with TLS support, you must first install either the
2579 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2580 implementing SSL.
2581 </para>
2582 <para>
2583 If OpenSSL is installed, you should set
2584 </para>
2585 <literallayout class="monospaced">
2586 SUPPORT_TLS=yes
2587 TLS_LIBS=-lssl -lcrypto
2588 </literallayout>
2589 <para>
2590 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2591 OpenSSL library and include files. For example:
2592 </para>
2593 <literallayout class="monospaced">
2594 SUPPORT_TLS=yes
2595 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2596 TLS_INCLUDE=-I/usr/local/openssl/include/
2597 </literallayout>
2598 <para>
2599 <indexterm role="concept">
2600 <primary>pkg-config</primary>
2601 <secondary>OpenSSL</secondary>
2602 </indexterm>
2603 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2604 </para>
2605 <literallayout class="monospaced">
2606 SUPPORT_TLS=yes
2607 USE_OPENSSL_PC=openssl
2608 </literallayout>
2609 <para>
2610 <indexterm role="concept">
2611 <primary>USE_GNUTLS</primary>
2612 </indexterm>
2613 If GnuTLS is installed, you should set
2614 </para>
2615 <literallayout class="monospaced">
2616 SUPPORT_TLS=yes
2617 USE_GNUTLS=yes
2618 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2619 </literallayout>
2620 <para>
2621 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2622 library and include files. For example:
2623 </para>
2624 <literallayout class="monospaced">
2625 SUPPORT_TLS=yes
2626 USE_GNUTLS=yes
2627 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2628 TLS_INCLUDE=-I/usr/gnu/include
2629 </literallayout>
2630 <para>
2631 <indexterm role="concept">
2632 <primary>pkg-config</primary>
2633 <secondary>GnuTLS</secondary>
2634 </indexterm>
2635 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2636 </para>
2637 <literallayout class="monospaced">
2638 SUPPORT_TLS=yes
2639 USE_GNUTLS=yes
2640 USE_GNUTLS_PC=gnutls
2641 </literallayout>
2642 <para>
2643 You do not need to set TLS_INCLUDE if the relevant directory is already
2644 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2645 given in chapter <xref linkend="CHAPTLS"/>.
2646 </para>
2647 </section>
2648 <section id="SECID27">
2649 <title>Use of tcpwrappers</title>
2650 <para>
2651 <indexterm role="concept">
2652 <primary>tcpwrappers, building Exim to support</primary>
2653 </indexterm>
2654 <indexterm role="concept">
2655 <primary>USE_TCP_WRAPPERS</primary>
2656 </indexterm>
2657 <indexterm role="concept">
2658 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2659 </indexterm>
2660 <indexterm role="concept">
2661 <primary>tcp_wrappers_daemon_name</primary>
2662 </indexterm>
2663 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2664 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2665 alternative to Exim&#x2019;s own checking facilities for installations that are
2666 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2667 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2668 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2669 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2670 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2671 you might have
2672 </para>
2673 <literallayout class="monospaced">
2674 USE_TCP_WRAPPERS=yes
2675 CFLAGS=-O -I/usr/local/include
2676 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2677 </literallayout>
2678 <para>
2679 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2680 files is <quote>exim</quote>. For example, the line
2681 </para>
2682 <literallayout class="monospaced">
2683 exim : LOCAL  192.168.1.  .friendly.domain.example
2684 </literallayout>
2685 <para>
2686 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2687 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2688 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2689 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2690 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2691 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2692 further details.
2693 </para>
2694 </section>
2695 <section id="SECID28">
2696 <title>Including support for IPv6</title>
2697 <para>
2698 <indexterm role="concept">
2699 <primary>IPv6</primary>
2700 <secondary>including support for</secondary>
2701 </indexterm>
2702 Exim contains code for use on systems that have IPv6 support. Setting
2703 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2704 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2705 where the IPv6 support is not fully integrated into the normal include and
2706 library files.
2707 </para>
2708 <para>
2709 Two different types of DNS record for handling IPv6 addresses have been
2710 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2711 currently seen as the mainstream. Another record type called A6 was proposed
2712 as better than AAAA because it had more flexibility. However, it was felt to be
2713 over-complex, and its status was reduced to <quote>experimental</quote>.
2714 Exim used to
2715 have a compile option for including A6 record support but this has now been
2716 withdrawn.
2717 </para>
2718 </section>
2719 <section id="SECTdynamicmodules">
2720 <title>Dynamically loaded lookup module support</title>
2721 <para>
2722 <indexterm role="concept">
2723 <primary>lookup modules</primary>
2724 </indexterm>
2725 <indexterm role="concept">
2726 <primary>dynamic modules</primary>
2727 </indexterm>
2728 <indexterm role="concept">
2729 <primary>.so building</primary>
2730 </indexterm>
2731 On some platforms, Exim supports not compiling all lookup types directly into
2732 the main binary, instead putting some into external modules which can be loaded
2733 on demand.
2734 This permits packagers to build Exim with support for lookups with extensive
2735 library dependencies without requiring all users to install all of those
2736 dependencies.
2737 Most, but not all, lookup types can be built this way.
2738 </para>
2739 <para>
2740 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2741 installed; Exim will only load modules from that directory, as a security
2742 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2743 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2744 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2745 see <filename>src/EDITME</filename> for details.
2746 </para>
2747 <para>
2748 Then, for each module to be loaded dynamically, define the relevant
2749 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2750 For example, this will build in lsearch but load sqlite and mysql support
2751 on demand:
2752 </para>
2753 <literallayout class="monospaced">
2754 LOOKUP_LSEARCH=yes
2755 LOOKUP_SQLITE=2
2756 LOOKUP_MYSQL=2
2757 </literallayout>
2758 </section>
2759 <section id="SECID29">
2760 <title>The building process</title>
2761 <para>
2762 <indexterm role="concept">
2763 <primary>build directory</primary>
2764 </indexterm>
2765 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2766 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2767 operating system types, and creates a build directory if one does not exist.
2768 For example, on a Sun system running Solaris 8, the directory
2769 <filename>build-SunOS5-5.8-sparc</filename> is created.
2770 <indexterm role="concept">
2771 <primary>symbolic link</primary>
2772 <secondary>to source files</secondary>
2773 </indexterm>
2774 Symbolic links to relevant source files are installed in the build directory.
2775 </para>
2776 <para>
2777 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2778 a make file inside the build directory, using the configuration files from the
2779 <filename>Local</filename> directory. The new make file is then passed to another instance of
2780 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2781 then compiling and linking the binaries for the Exim monitor (if configured), a
2782 number of utility programs, and finally Exim itself. The command <literal>make
2783 makefile</literal> can be used to force a rebuild of the make file in the build
2784 directory, should this ever be necessary.
2785 </para>
2786 <para>
2787 If you have problems building Exim, check for any comments there may be in the
2788 <filename>README</filename> file concerning your operating system, and also take a look at the
2789 FAQ, where some common problems are covered.
2790 </para>
2791 </section>
2792 <section id="SECID283">
2793 <title>Output from <quote>make</quote></title>
2794 <para>
2795 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2796 unreadable, because these lines can be very long. For this reason, the normal
2797 output is suppressed by default, and instead output similar to that which
2798 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2799 each module that is being compiled or linked. However, it is still possible to
2800 get the full output, by calling <emphasis>make</emphasis> like this:
2801 </para>
2802 <literallayout class="monospaced">
2803 FULLECHO='' make -e
2804 </literallayout>
2805 <para>
2806 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2807 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2808 given in addition to the short output.
2809 </para>
2810 </section>
2811 <section id="SECToverride">
2812 <title>Overriding build-time options for Exim</title>
2813 <para>
2814 <indexterm role="concept">
2815 <primary>build-time options, overriding</primary>
2816 </indexterm>
2817 The main make file that is created at the beginning of the building process
2818 consists of the concatenation of a number of files which set configuration
2819 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2820 more than once, the last setting overrides any previous ones. This provides a
2821 convenient way of overriding defaults. The files that are concatenated are, in
2822 order:
2823 </para>
2824 <literallayout>
2825 <filename>OS/Makefile-Default</filename>
2826 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2827 <filename>Local/Makefile</filename>
2828 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2829 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2830 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2831 <filename>OS/Makefile-Base</filename>
2832 </literallayout>
2833 <para>
2834 <indexterm role="concept">
2835 <primary><filename>Local/Makefile</filename></primary>
2836 </indexterm>
2837 <indexterm role="concept">
2838 <primary>building Exim</primary>
2839 <secondary>operating system type</secondary>
2840 </indexterm>
2841 <indexterm role="concept">
2842 <primary>building Exim</primary>
2843 <secondary>architecture type</secondary>
2844 </indexterm>
2845 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2846 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2847 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2848 and are often not needed.
2849 </para>
2850 <para>
2851 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2852 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2853 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2854 values are used, thereby providing a means of forcing particular settings.
2855 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2856 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2857 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2858 that Exim expects. You can run these scripts directly from the shell in order
2859 to find out what values are being used on your system.
2860 </para>
2861 <para>
2862 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2863 therein. Some (but not all) are mentioned below. If there is something that
2864 needs changing, review the contents of this file and the contents of the make
2865 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2866 default values are.
2867 </para>
2868 <para>
2869 <indexterm role="concept">
2870 <primary>building Exim</primary>
2871 <secondary>overriding default settings</secondary>
2872 </indexterm>
2873 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2874 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2875 need to change the original files. Instead, you should make the changes by
2876 putting the new values in an appropriate <filename>Local</filename> file. For example,
2877 <indexterm role="concept">
2878 <primary>Tru64-Unix build-time settings</primary>
2879 </indexterm>
2880 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2881 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2882 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2883 called with the option <option>-std1</option>, to make it recognize some of the features of
2884 Standard C that Exim uses. (Most other compilers recognize Standard C by
2885 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2886 containing the lines
2887 </para>
2888 <literallayout class="monospaced">
2889 CC=cc
2890 CFLAGS=-std1
2891 </literallayout>
2892 <para>
2893 If you are compiling for just one operating system, it may be easier to put
2894 these lines directly into <filename>Local/Makefile</filename>.
2895 </para>
2896 <para>
2897 Keeping all your local configuration settings separate from the distributed
2898 files makes it easy to transfer them to new versions of Exim simply by copying
2899 the contents of the <filename>Local</filename> directory.
2900 </para>
2901 <para>
2902 <indexterm role="concept">
2903 <primary>NIS lookup type</primary>
2904 <secondary>including support for</secondary>
2905 </indexterm>
2906 <indexterm role="concept">
2907 <primary>NIS+ lookup type</primary>
2908 <secondary>including support for</secondary>
2909 </indexterm>
2910 <indexterm role="concept">
2911 <primary>LDAP</primary>
2912 <secondary>including support for</secondary>
2913 </indexterm>
2914 <indexterm role="concept">
2915 <primary>lookup</primary>
2916 <secondary>inclusion in binary</secondary>
2917 </indexterm>
2918 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2919 lookup, but not all systems have these components installed, so the default is
2920 not to include the relevant code in the binary. All the different kinds of file
2921 and database lookup that Exim supports are implemented as separate code modules
2922 which are included only if the relevant compile-time options are set. In the
2923 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2924 </para>
2925 <literallayout class="monospaced">
2926 LOOKUP_LDAP=yes
2927 LOOKUP_NIS=yes
2928 LOOKUP_NISPLUS=yes
2929 </literallayout>
2930 <para>
2931 and similar settings apply to the other lookup types. They are all listed in
2932 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2933 libraries need to be installed before compiling Exim.
2934 <indexterm role="concept">
2935 <primary>cdb</primary>
2936 <secondary>including support for</secondary>
2937 </indexterm>
2938 However, there are some optional lookup types (such as cdb) for which
2939 the code is entirely contained within Exim, and no external include
2940 files or libraries are required. When a lookup type is not included in the
2941 binary, attempts to configure Exim to use it cause run time configuration
2942 errors.
2943 </para>
2944 <para>
2945 <indexterm role="concept">
2946 <primary>pkg-config</primary>
2947 <secondary>lookups</secondary>
2948 </indexterm>
2949 <indexterm role="concept">
2950 <primary>pkg-config</primary>
2951 <secondary>authenticators</secondary>
2952 </indexterm>
2953 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2954 about how to compile against a library; Exim has some initial support for
2955 being able to use pkg-config for lookups and authenticators.  For any given
2956 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2957 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2958 name of the package to be queried.  The results of querying via the
2959 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2960 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2961 syntax.  For instance:
2962 </para>
2963 <literallayout class="monospaced">
2964 LOOKUP_SQLITE=yes
2965 LOOKUP_SQLITE_PC=sqlite3
2966 AUTH_GSASL=yes
2967 AUTH_GSASL_PC=libgsasl
2968 AUTH_HEIMDAL_GSSAPI=yes
2969 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2970 </literallayout>
2971 <para>
2972 <indexterm role="concept">
2973 <primary>Perl</primary>
2974 <secondary>including support for</secondary>
2975 </indexterm>
2976 Exim can be linked with an embedded Perl interpreter, allowing Perl
2977 subroutines to be called during string expansion. To enable this facility,
2978 </para>
2979 <literallayout class="monospaced">
2980 EXIM_PERL=perl.o
2981 </literallayout>
2982 <para>
2983 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2984 chapter <xref linkend="CHAPperl"/>.
2985 </para>
2986 <para>
2987 <indexterm role="concept">
2988 <primary>X11 libraries, location of</primary>
2989 </indexterm>
2990 The location of the X11 libraries is something that varies a lot between
2991 operating systems, and there may be different versions of X11 to cope
2992 with. Exim itself makes no use of X11, but if you are compiling the Exim
2993 monitor, the X11 libraries must be available.
2994 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2995 </para>
2996 <literallayout class="monospaced">
2997 X11=/usr/X11R6
2998 XINCLUDE=-I$(X11)/include
2999 XLFLAGS=-L$(X11)/lib
3000 </literallayout>
3001 <para>
3002 These are overridden in some of the operating-system configuration files. For
3003 example, in <filename>OS/Makefile-SunOS5</filename> there is
3004 </para>
3005 <literallayout class="monospaced">
3006 X11=/usr/openwin
3007 XINCLUDE=-I$(X11)/include
3008 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
3009 </literallayout>
3010 <para>
3011 If you need to override the default setting for your operating system, place a
3012 definition of all three of these variables into your
3013 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
3014 </para>
3015 <para>
3016 <indexterm role="concept">
3017 <primary>EXTRALIBS</primary>
3018 </indexterm>
3019 If you need to add any extra libraries to the link steps, these can be put in a
3020 variable called EXTRALIBS, which appears in all the link commands, but by
3021 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3022 command for linking the main Exim binary, and not for any associated utilities.
3023 </para>
3024 <para>
3025 <indexterm role="concept">
3026 <primary>DBM libraries</primary>
3027 <secondary>configuration for building</secondary>
3028 </indexterm>
3029 There is also DBMLIB, which appears in the link commands for binaries that
3030 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3031 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3032 binary, and which can be used, for example, to include additional X11
3033 libraries.
3034 </para>
3035 <para>
3036 <indexterm role="concept">
3037 <primary>configuration file</primary>
3038 <secondary>editing</secondary>
3039 </indexterm>
3040 The make file copes with rebuilding Exim correctly if any of the configuration
3041 files are edited. However, if an optional configuration file is deleted, it is
3042 necessary to touch the associated non-optional file (that is,
3043 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3044 </para>
3045 </section>
3046 <section id="SECID30">
3047 <title>OS-specific header files</title>
3048 <para>
3049 <indexterm role="concept">
3050 <primary><filename>os.h</filename></primary>
3051 </indexterm>
3052 <indexterm role="concept">
3053 <primary>building Exim</primary>
3054 <secondary>OS-specific C header files</secondary>
3055 </indexterm>
3056 The <filename>OS</filename> directory contains a number of files with names of the form
3057 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3058 normally need to be changed. There is a list of macro settings that are
3059 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3060 are porting Exim to a new operating system.
3061 </para>
3062 </section>
3063 <section id="SECID31">
3064 <title>Overriding build-time options for the monitor</title>
3065 <para>
3066 <indexterm role="concept">
3067 <primary>building Eximon</primary>
3068 </indexterm>
3069 A similar process is used for overriding things when building the Exim monitor,
3070 where the files that are involved are
3071 </para>
3072 <literallayout>
3073 <filename>OS/eximon.conf-Default</filename>
3074 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3075 <filename>Local/eximon.conf</filename>
3076 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3077 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3078 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3079 </literallayout>
3080 <para>
3081 <indexterm role="concept">
3082 <primary><filename>Local/eximon.conf</filename></primary>
3083 </indexterm>
3084 As with Exim itself, the final three files need not exist, and in this case the
3085 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3086 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3087 variables of the same name, preceded by EXIMON_. For example, setting
3088 EXIMON_LOG_DEPTH in the environment overrides the value of
3089 LOG_DEPTH at run time.
3090 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3091 </para>
3092 </section>
3093 <section id="SECID32">
3094 <title>Installing Exim binaries and scripts</title>
3095 <para>
3096 <indexterm role="concept">
3097 <primary>installing Exim</primary>
3098 </indexterm>
3099 <indexterm role="concept">
3100 <primary>BIN_DIRECTORY</primary>
3101 </indexterm>
3102 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3103 arguments. The script copies binaries and utility scripts into the directory
3104 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3105 <indexterm role="concept">
3106 <primary>setuid</primary>
3107 <secondary>installing Exim with</secondary>
3108 </indexterm>
3109 The install script copies files only if they are newer than the files they are
3110 going to replace. The Exim binary is required to be owned by root and have the
3111 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3112 install</literal> as root so that it can set up the Exim binary in this way. However, in
3113 some special situations (for example, if a host is doing no local deliveries)
3114 it may be possible to run Exim without making the binary setuid root (see
3115 chapter <xref linkend="CHAPsecurity"/> for details).
3116 </para>
3117 <para>
3118 <indexterm role="concept">
3119 <primary>CONFIGURE_FILE</primary>
3120 </indexterm>
3121 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3122 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3123 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3124 by the installation script. If a run time configuration file already exists, it
3125 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3126 alternative files, no default is installed.
3127 </para>
3128 <para>
3129 <indexterm role="concept">
3130 <primary>system aliases file</primary>
3131 </indexterm>
3132 <indexterm role="concept">
3133 <primary><filename>/etc/aliases</filename></primary>
3134 </indexterm>
3135 One change is made to the default configuration file when it is installed: the
3136 default configuration contains a router that references a system aliases file.
3137 The path to this file is set to the value specified by
3138 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3139 If the system aliases file does not exist, the installation script creates it,
3140 and outputs a comment to the user.
3141 </para>
3142 <para>
3143 The created file contains no aliases, but it does contain comments about the
3144 aliases a site should normally have. Mail aliases have traditionally been
3145 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3146 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3147 Exim&#x2019;s configuration if necessary.
3148 </para>
3149 <para>
3150 The default configuration uses the local host&#x2019;s name as the only local domain,
3151 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3152 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3153 directories are supported, but no NIS or NIS+ support is configured. Domains
3154 other than the name of the local host are routed using the DNS, with delivery
3155 over SMTP.
3156 </para>
3157 <para>
3158 It is possible to install Exim for special purposes (such as building a binary
3159 distribution) in a private part of the file system. You can do this by a
3160 command such as
3161 </para>
3162 <literallayout class="monospaced">
3163 make DESTDIR=/some/directory/ install
3164 </literallayout>
3165 <para>
3166 This has the effect of pre-pending the specified directory to all the file
3167 paths, except the name of the system aliases file that appears in the default
3168 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3169 For backwards compatibility, ROOT is used if DESTDIR is not set,
3170 but this usage is deprecated.
3171 </para>
3172 <para>
3173 <indexterm role="concept">
3174 <primary>installing Exim</primary>
3175 <secondary>what is not installed</secondary>
3176 </indexterm>
3177 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3178 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3179 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3180 directory are copied, except for the info files when you have set
3181 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3182 </para>
3183 <para>
3184 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3185 to their names. The Exim binary itself, however, is handled differently. It is
3186 installed under a name that includes the version number and the compile number,
3187 for example <filename>exim-4.91-1</filename>. The script then arranges for a symbolic link
3188 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3189 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3190 from the directory (as seen by other processes).
3191 </para>
3192 <para>
3193 <indexterm role="concept">
3194 <primary>installing Exim</primary>
3195 <secondary>testing the script</secondary>
3196 </indexterm>
3197 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3198 real, you can pass the <option>-n</option> option to the installation script by this
3199 command:
3200 </para>
3201 <literallayout class="monospaced">
3202 make INSTALL_ARG=-n install
3203 </literallayout>
3204 <para>
3205 The contents of the variable INSTALL_ARG are passed to the installation
3206 script. You do not need to be root to run this test. Alternatively, you can run
3207 the installation script directly, but this must be from within the build
3208 directory. For example, from the top-level Exim directory you could use this
3209 command:
3210 </para>
3211 <literallayout class="monospaced">
3212 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3213 </literallayout>
3214 <para>
3215 <indexterm role="concept">
3216 <primary>installing Exim</primary>
3217 <secondary>install script options</secondary>
3218 </indexterm>
3219 There are two other options that can be supplied to the installation script.
3220 </para>
3221 <itemizedlist>
3222 <listitem>
3223 <para>
3224 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3225 to root, and the call to make it a setuid binary.
3226 </para>
3227 </listitem>
3228 <listitem>
3229 <para>
3230 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3231 installed binary.
3232 </para>
3233 </listitem>
3234 </itemizedlist>
3235 <para>
3236 INSTALL_ARG can be used to pass these options to the script. For example:
3237 </para>
3238 <literallayout class="monospaced">
3239 make INSTALL_ARG=-no_symlink install
3240 </literallayout>
3241 <para>
3242 The installation script can also be given arguments specifying which files are
3243 to be copied. For example, to install just the Exim binary, and nothing else,
3244 without creating the symbolic link, you could use:
3245 </para>
3246 <literallayout class="monospaced">
3247 make INSTALL_ARG='-no_symlink exim' install
3248 </literallayout>
3249 </section>
3250 <section id="SECTinsinfdoc">
3251 <title>Installing info documentation</title>
3252 <para>
3253 <indexterm role="concept">
3254 <primary>installing Exim</primary>
3255 <secondary><emphasis>info</emphasis> documentation</secondary>
3256 </indexterm>
3257 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3258 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3259 distribution. Instead it is available separately from the ftp site (see section
3260 <xref linkend="SECTavail"/>).
3261 </para>
3262 <para>
3263 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3264 source of the documentation is found in the source tree, running <literal>make
3265 install</literal> automatically builds the info files and installs them.
3266 </para>
3267 </section>
3268 <section id="SECID33">
3269 <title>Setting up the spool directory</title>
3270 <para>
3271 <indexterm role="concept">
3272 <primary>spool directory</primary>
3273 <secondary>creating</secondary>
3274 </indexterm>
3275 When it starts up, Exim tries to create its spool directory if it does not
3276 exist. The Exim uid and gid are used for the owner and group of the spool
3277 directory. Sub-directories are automatically created in the spool directory as
3278 necessary.
3279 </para>
3280 </section>
3281 <section id="SECID34">
3282 <title>Testing</title>
3283 <para>
3284 <indexterm role="concept">
3285 <primary>testing</primary>
3286 <secondary>installation</secondary>
3287 </indexterm>
3288 Having installed Exim, you can check that the run time configuration file is
3289 syntactically valid by running the following command, which assumes that the
3290 Exim binary directory is within your PATH environment variable:
3291 </para>
3292 <literallayout class="monospaced">
3293 exim -bV
3294 </literallayout>
3295 <para>
3296 If there are any errors in the configuration file, Exim outputs error messages.
3297 Otherwise it outputs the version number and build date,
3298 the DBM library that is being used, and information about which drivers and
3299 other optional code modules are included in the binary.
3300 Some simple routing tests can be done by using the address testing option. For
3301 example,
3302 </para>
3303 <literallayout>
3304 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3305 </literallayout>
3306 <para>
3307 should verify that it recognizes a local mailbox, and
3308 </para>
3309 <literallayout>
3310 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3311 </literallayout>
3312 <para>
3313 a remote one. Then try getting it to deliver mail, both locally and remotely.
3314 This can be done by passing messages directly to Exim, without going through a
3315 user agent. For example:
3316 </para>
3317 <literallayout class="monospaced">
3318 exim -v postmaster@your.domain.example
3319 From: user@your.domain.example
3320 To: postmaster@your.domain.example
3321 Subject: Testing Exim
3322
3323 This is a test message.
3324 ^D
3325 </literallayout>
3326 <para>
3327 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3328 In this case you should see copies of three log lines, one for the message&#x2019;s
3329 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3330 </para>
3331 <para>
3332 <indexterm role="concept">
3333 <primary>delivery</primary>
3334 <secondary>problems with</secondary>
3335 </indexterm>
3336 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3337 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3338 of information is running Exim with debugging turned on, by specifying the
3339 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3340 with debugging turned on by a command of the form
3341 </para>
3342 <literallayout>
3343 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3344 </literallayout>
3345 <para>
3346 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3347 produces rather a lot of output, but you can cut this down to specific areas.
3348 For example, if you use <option>-d-all+route</option> only the debugging information
3349 relevant to routing is included. (See the <option>-d</option> option in chapter
3350 <xref linkend="CHAPcommandline"/> for more details.)
3351 </para>
3352 <para>
3353 <indexterm role="concept">
3354 <primary><quote>sticky</quote> bit</primary>
3355 </indexterm>
3356 <indexterm role="concept">
3357 <primary>lock files</primary>
3358 </indexterm>
3359 One specific problem that has shown up on some sites is the inability to do
3360 local deliveries into a shared mailbox directory, because it does not have the
3361 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3362 writing to a mailbox file, and if it cannot create the lock file, the delivery
3363 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3364 directory, or by setting a specific group for local deliveries and allowing
3365 that group to create files in the directory (see the comments above the
3366 <command>local_delivery</command> transport in the default configuration file). Another
3367 approach is to configure Exim not to use lock files, but just to rely on
3368 <function>fcntl()</function> locking instead. However, you should do this only if all user
3369 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3370 see chapter <xref linkend="CHAPappendfile"/>.
3371 </para>
3372 <para>
3373 One thing that cannot be tested on a system that is already running an MTA is
3374 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3375 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3376 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3377 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3378 incoming SMTP mail.
3379 </para>
3380 <para>
3381 Testing a new version on a system that is already running Exim can most easily
3382 be done by building a binary with a different CONFIGURE_FILE setting. From
3383 within the run time configuration, all other file and directory names
3384 that Exim uses can be altered, in order to keep it entirely clear of the
3385 production version.
3386 </para>
3387 </section>
3388 <section id="SECID35">
3389 <title>Replacing another MTA with Exim</title>
3390 <para>
3391 <indexterm role="concept">
3392 <primary>replacing another MTA</primary>
3393 </indexterm>
3394 Building and installing Exim for the first time does not of itself put it in
3395 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3396 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3397 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3398 binary in order to get the user agents to pass messages to Exim. This is
3399 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3400 or <filename>/usr/lib/sendmail</filename>
3401 <indexterm role="concept">
3402 <primary>symbolic link</primary>
3403 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3404 </indexterm>
3405 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3406 privilege and executable status from the old MTA. It is then necessary to stop
3407 and restart the mailer daemon, if one is running.
3408 </para>
3409 <para>
3410 <indexterm role="concept">
3411 <primary>FreeBSD, MTA indirection</primary>
3412 </indexterm>
3413 <indexterm role="concept">
3414 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3415 </indexterm>
3416 Some operating systems have introduced alternative ways of switching MTAs. For
3417 example, if you are running FreeBSD, you need to edit the file
3418 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3419 described. A typical example of the contents of this file for running Exim is
3420 as follows:
3421 </para>
3422 <literallayout class="monospaced">
3423 sendmail            /usr/exim/bin/exim
3424 send-mail           /usr/exim/bin/exim
3425 mailq               /usr/exim/bin/exim -bp
3426 newaliases          /usr/bin/true
3427 </literallayout>
3428 <para>
3429 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3430 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3431 favourite user agent.
3432 </para>
3433 <para>
3434 You should consider what to tell your users about the change of MTA. Exim may
3435 have different capabilities to what was previously running, and there are
3436 various operational differences such as the text of messages produced by
3437 command line options and in bounce messages. If you allow your users to make
3438 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3439 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3440 </para>
3441 </section>
3442 <section id="SECID36">
3443 <title>Upgrading Exim</title>
3444 <para>
3445 <indexterm role="concept">
3446 <primary>upgrading Exim</primary>
3447 </indexterm>
3448 If you are already running Exim on your host, building and installing a new
3449 version automatically makes it available to MUAs, or any other programs that
3450 call the MTA directly. However, if you are running an Exim daemon, you do need
3451 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3452 new binary. You do not need to stop processing mail in order to install a new
3453 version of Exim. The install script does not modify an existing runtime
3454 configuration file.
3455 </para>
3456 </section>
3457 <section id="SECID37">
3458 <title>Stopping the Exim daemon on Solaris</title>
3459 <para>
3460 <indexterm role="concept">
3461 <primary>Solaris</primary>
3462 <secondary>stopping Exim on</secondary>
3463 </indexterm>
3464 The standard command for stopping the mailer daemon on Solaris is
3465 </para>
3466 <literallayout class="monospaced">
3467 /etc/init.d/sendmail stop
3468 </literallayout>
3469 <para>
3470 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3471 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3472 for the text <quote>sendmail</quote>; this is not present because the actual program name
3473 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3474 solution is to replace the line that finds the process id with something like
3475 </para>
3476 <literallayout class="monospaced">
3477 pid=`cat /var/spool/exim/exim-daemon.pid`
3478 </literallayout>
3479 <para>
3480 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3481 </para>
3482 <para>
3483 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3484 still be received from local processes, and if automatic delivery is configured
3485 (the normal case), deliveries will still occur.
3486 </para>
3487 </section>
3488 </chapter>
3489
3490 <chapter id="CHAPcommandline">
3491 <title>The Exim command line</title>
3492 <para>
3493 <indexterm role="concept" id="IIDclo1" class="startofrange">
3494 <primary>command line</primary>
3495 <secondary>options</secondary>
3496 </indexterm>
3497 <indexterm role="concept" id="IIDclo2" class="startofrange">
3498 <primary>options</primary>
3499 <secondary>command line</secondary>
3500 </indexterm>
3501 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3502 each starting with a hyphen character, followed by a number of arguments. The
3503 options are compatible with the main options of Sendmail, and there are also
3504 some additional options, some of which are compatible with Smail 3. Certain
3505 combinations of options do not make sense, and provoke an error if used.
3506 The form of the arguments depends on which options are set.
3507 </para>
3508 <section id="SECID38">
3509 <title>Setting options by program name</title>
3510 <para>
3511 <indexterm role="concept">
3512 <primary><emphasis>mailq</emphasis></primary>
3513 </indexterm>
3514 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3515 were present before any other options.
3516 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3517 standard output.
3518 This feature is for compatibility with some systems that contain a command of
3519 that name in one of the standard libraries, symbolically linked to
3520 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3521 </para>
3522 <para>
3523 <indexterm role="concept">
3524 <primary><emphasis>rsmtp</emphasis></primary>
3525 </indexterm>
3526 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3527 were present before any other options, for compatibility with Smail. The
3528 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3529 format.
3530 </para>
3531 <para>
3532 <indexterm role="concept">
3533 <primary><emphasis>rmail</emphasis></primary>
3534 </indexterm>
3535 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3536 <option>-oee</option> options were present before any other options, for compatibility with
3537 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3538 </para>
3539 <para>
3540 <indexterm role="concept">
3541 <primary><emphasis>runq</emphasis></primary>
3542 </indexterm>
3543 <indexterm role="concept">
3544 <primary>queue runner</primary>
3545 </indexterm>
3546 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3547 were present before any other options, for compatibility with Smail. The <option>-q</option>
3548 option causes a single queue runner process to be started.
3549 </para>
3550 <para>
3551 <indexterm role="concept">
3552 <primary><emphasis>newaliases</emphasis></primary>
3553 </indexterm>
3554 <indexterm role="concept">
3555 <primary>alias file</primary>
3556 <secondary>building</secondary>
3557 </indexterm>
3558 <indexterm role="concept">
3559 <primary>Sendmail compatibility</primary>
3560 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3561 </indexterm>
3562 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3563 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3564 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3565 the concept of a single alias file, but can be configured to run a given
3566 command if called with the <option>-bi</option> option.
3567 </para>
3568 </section>
3569 <section id="SECTtrustedadmin">
3570 <title>Trusted and admin users</title>
3571 <para>
3572 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3573 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3574 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3575 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3576 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3577 </para>
3578 <itemizedlist>
3579 <listitem>
3580 <para>
3581 <indexterm role="concept">
3582 <primary>trusted users</primary>
3583 <secondary>definition of</secondary>
3584 </indexterm>
3585 <indexterm role="concept">
3586 <primary>user</primary>
3587 <secondary>trusted definition of</secondary>
3588 </indexterm>
3589 The trusted users are root, the Exim user, any user listed in the
3590 <option>trusted_users</option> configuration option, and any user whose current group or any
3591 supplementary group is one of those listed in the <option>trusted_groups</option>
3592 configuration option. Note that the Exim group is not automatically trusted.
3593 </para>
3594 <para>
3595 <indexterm role="concept">
3596 <primary><quote>From</quote> line</primary>
3597 </indexterm>
3598 <indexterm role="concept">
3599 <primary>envelope sender</primary>
3600 </indexterm>
3601 Trusted users are always permitted to use the <option>-f</option> option or a leading
3602 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3603 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3604 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3605 users to set envelope senders.
3606 </para>
3607 <para>
3608 <indexterm role="concept">
3609 <primary><emphasis>From:</emphasis> header line</primary>
3610 </indexterm>
3611 <indexterm role="concept">
3612 <primary><emphasis>Sender:</emphasis> header line</primary>
3613 </indexterm>
3614 <indexterm role="concept">
3615 <primary>header lines</primary>
3616 <secondary>From:</secondary>
3617 </indexterm>
3618 <indexterm role="concept">
3619 <primary>header lines</primary>
3620 <secondary>Sender:</secondary>
3621 </indexterm>
3622 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3623 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3624 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3625 </para>
3626 <para>
3627 Trusted users may also specify a host name, host address, interface address,
3628 protocol name, ident value, and authentication data when submitting a message
3629 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3630 have the characteristics of messages received from a remote host. Untrusted
3631 users may in some circumstances use <option>-f</option>, but can never set the other values
3632 that are available to trusted users.
3633 </para>
3634 </listitem>
3635 <listitem>
3636 <para>
3637 <indexterm role="concept">
3638 <primary>user</primary>
3639 <secondary>admin definition of</secondary>
3640 </indexterm>
3641 <indexterm role="concept">
3642 <primary>admin user</primary>
3643 <secondary>definition of</secondary>
3644 </indexterm>
3645 The admin users are root, the Exim user, and any user that is a member of the
3646 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3647 The current group does not have to be one of these groups.
3648 </para>
3649 <para>
3650 Admin users are permitted to list the queue, and to carry out certain
3651 operations on messages, for example, to force delivery failures. It is also
3652 necessary to be an admin user in order to see the full information provided by
3653 the Exim monitor, and full debugging output.
3654 </para>
3655 <para>
3656 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3657 Exim to attempt delivery of messages on its queue is restricted to admin users.
3658 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3659 option false (that is, specifying <option>no_prod_requires_admin</option>).
3660 </para>
3661 <para>
3662 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3663 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3664 false.
3665 </para>
3666 </listitem>
3667 </itemizedlist>
3668 <para>
3669 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3670 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3671 getting root. There is further discussion of this issue at the start of chapter
3672 <xref linkend="CHAPconf"/>.
3673 </para>
3674 </section>
3675 <section id="SECID39">
3676 <title>Command line options</title>
3677 <para>
3678 Exim&#x2019;s command line options are described in alphabetical order below. If none
3679 of the options that specifies a specific action (such as starting the daemon or
3680 a queue runner, or testing an address, or receiving a message in a specific
3681 format, or listing the queue) are present, and there is at least one argument
3682 on the command line, <option>-bm</option> (accept a local message on the standard input,
3683 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3684 outputs a brief message about itself and exits.
3685 </para>
3686 <!-- === Start of command line options === -->
3687 <variablelist>
3688 <varlistentry>
3689 <term><option>--</option></term>
3690 <listitem>
3691 <para>
3692 <indexterm role="option">
3693 <primary>--</primary>
3694 </indexterm>
3695 <indexterm role="concept">
3696 <primary>options</primary>
3697 <secondary>command line; terminating</secondary>
3698 </indexterm>
3699 This is a pseudo-option whose only purpose is to terminate the options and
3700 therefore to cause subsequent command line items to be treated as arguments
3701 rather than options, even if they begin with hyphens.
3702 </para>
3703 </listitem></varlistentry>
3704 <varlistentry>
3705 <term><option>--help</option></term>
3706 <listitem>
3707 <para>
3708 <indexterm role="option">
3709 <primary><option>--help</option></primary>
3710 </indexterm>
3711 This option causes Exim to output a few sentences stating what it is.
3712 The same output is generated if the Exim binary is called with no options and
3713 no arguments.
3714 </para>
3715 </listitem></varlistentry>
3716 <varlistentry>
3717 <term><option>--version</option></term>
3718 <listitem>
3719 <para>
3720 <indexterm role="option">
3721 <primary><option>--version</option></primary>
3722 </indexterm>
3723 This option is an alias for <option>-bV</option> and causes version information to be
3724 displayed.
3725 </para>
3726 </listitem></varlistentry>
3727 <varlistentry>
3728 <term><option>-Ac</option></term>
3729 <term><option>-Am</option></term>
3730 <listitem>
3731 <para>
3732 <indexterm role="option">
3733 <primary><option>-Ac</option></primary>
3734 </indexterm>
3735 <indexterm role="option">
3736 <primary><option>-Am</option></primary>
3737 </indexterm>
3738 These options are used by Sendmail for selecting configuration files and are
3739 ignored by Exim.
3740 </para>
3741 </listitem></varlistentry>
3742 <varlistentry>
3743 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3744 <listitem>
3745 <para>
3746 <indexterm role="option">
3747 <primary><option>-B</option></primary>
3748 </indexterm>
3749 <indexterm role="concept">
3750 <primary>8-bit characters</primary>
3751 </indexterm>
3752 <indexterm role="concept">
3753 <primary>Sendmail compatibility</primary>
3754 <secondary>8-bit characters</secondary>
3755 </indexterm>
3756 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3757 clean; it ignores this option.
3758 </para>
3759 </listitem></varlistentry>
3760 <varlistentry>
3761 <term><option>-bd</option></term>
3762 <listitem>
3763 <para>
3764 <indexterm role="option">
3765 <primary><option>-bd</option></primary>
3766 </indexterm>
3767 <indexterm role="concept">
3768 <primary>daemon</primary>
3769 </indexterm>
3770 <indexterm role="concept">
3771 <primary>SMTP</primary>
3772 <secondary>listener</secondary>
3773 </indexterm>
3774 <indexterm role="concept">
3775 <primary>queue runner</primary>
3776 </indexterm>
3777 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3778 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3779 that the daemon should also initiate periodic queue runs.
3780 </para>
3781 <para>
3782 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3783 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3784 disconnect from the controlling terminal. When running this way, it can be
3785 stopped by pressing ctrl-C.
3786 </para>
3787 <para>
3788 By default, Exim listens for incoming connections to the standard SMTP port on
3789 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3790 ports, on multiple ports, and only on specific interfaces. Chapter
3791 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3792 </para>
3793 <para>
3794 When a listening daemon
3795 <indexterm role="concept">
3796 <primary>daemon</primary>
3797 <secondary>process id (pid)</secondary>
3798 </indexterm>
3799 <indexterm role="concept">
3800 <primary>pid (process id)</primary>
3801 <secondary>of daemon</secondary>
3802 </indexterm>
3803 is started without the use of <option>-oX</option> (that is, without overriding the normal
3804 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3805 in Exim&#x2019;s spool directory. This location can be overridden by setting
3806 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3807 running as root.
3808 </para>
3809 <para>
3810 When <option>-oX</option> is used on the command line to start a listening daemon, the
3811 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3812 used to specify a path on the command line if a pid file is required.
3813 </para>
3814 <para>
3815 The SIGHUP signal
3816 <indexterm role="concept">
3817 <primary>SIGHUP</primary>
3818 </indexterm>
3819 <indexterm role="concept">
3820 <primary>daemon</primary>
3821 <secondary>restarting</secondary>
3822 </indexterm>
3823 can be used to cause the daemon to re-execute itself. This should be done
3824 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3825 means of the <option>.include</option> facility, is changed, and also whenever a new version
3826 of Exim is installed. It is not necessary to do this when other files that are
3827 referenced from the configuration (for example, alias files) are changed,
3828 because these are reread each time they are used.
3829 </para>
3830 </listitem></varlistentry>
3831 <varlistentry>
3832 <term><option>-bdf</option></term>
3833 <listitem>
3834 <para>
3835 <indexterm role="option">
3836 <primary><option>-bdf</option></primary>
3837 </indexterm>
3838 This option has the same effect as <option>-bd</option> except that it never disconnects
3839 from the controlling terminal, even when no debugging is specified.
3840 </para>
3841 </listitem></varlistentry>
3842 <varlistentry>
3843 <term><option>-be</option></term>
3844 <listitem>
3845 <para>
3846 <indexterm role="option">
3847 <primary><option>-be</option></primary>
3848 </indexterm>
3849 <indexterm role="concept">
3850 <primary>testing</primary>
3851 <secondary>string expansion</secondary>
3852 </indexterm>
3853 <indexterm role="concept">
3854 <primary>expansion</primary>
3855 <secondary>testing</secondary>
3856 </indexterm>
3857 Run Exim in expansion testing mode. Exim discards its root privilege, to
3858 prevent ordinary users from using this mode to read otherwise inaccessible
3859 files. If no arguments are given, Exim runs interactively, prompting for lines
3860 of data. Otherwise, it processes each argument in turn.
3861 </para>
3862 <para>
3863 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3864 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3865 used without command line arguments. If successful, it uses the <function>readline()</function>
3866 function, which provides extensive line-editing facilities, for reading the
3867 test data. A line history is supported.
3868 </para>
3869 <para>
3870 Long expansion expressions can be split over several lines by using backslash
3871 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3872 continuation lines is ignored. Each argument or data line is passed through the
3873 string expansion mechanism, and the result is output. Variable values from the
3874 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3875 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3876 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3877 </para>
3878 <para>
3879 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3880 files or databases you are using, you must exit and restart Exim before trying
3881 the same lookup again. Otherwise, because each Exim process caches the results
3882 of lookups, you will just get the same result as before.
3883 </para>
3884 <para>
3885 Macro processing is done on lines before string-expansion: new macros can be
3886 defined and macros will be expanded.
3887 Because macros in the config file are often used for secrets, those are only
3888 available to admin users.
3889 </para>
3890 </listitem></varlistentry>
3891 <varlistentry>
3892 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3893 <listitem>
3894 <para>
3895 <indexterm role="option">
3896 <primary><option>-bem</option></primary>
3897 </indexterm>
3898 <indexterm role="concept">
3899 <primary>testing</primary>
3900 <secondary>string expansion</secondary>
3901 </indexterm>
3902 <indexterm role="concept">
3903 <primary>expansion</primary>
3904 <secondary>testing</secondary>
3905 </indexterm>
3906 This option operates like <option>-be</option> except that it must be followed by the name
3907 of a file. For example:
3908 </para>
3909 <literallayout class="monospaced">
3910 exim -bem /tmp/testmessage
3911 </literallayout>
3912 <para>
3913 The file is read as a message (as if receiving a locally-submitted non-SMTP
3914 message) before any of the test expansions are done. Thus, message-specific
3915 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3916 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3917 recipients are read from the headers in the normal way, and are shown in the
3918 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3919 line, because further arguments are taken as strings to expand (just like
3920 <option>-be</option>).
3921 </para>
3922 </listitem></varlistentry>
3923 <varlistentry>
3924 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3925 <listitem>
3926 <para>
3927 <indexterm role="option">
3928 <primary><option>-bF</option></primary>
3929 </indexterm>
3930 <indexterm role="concept">
3931 <primary>system filter</primary>
3932 <secondary>testing</secondary>
3933 </indexterm>
3934 <indexterm role="concept">
3935 <primary>testing</primary>
3936 <secondary>system filter</secondary>
3937 </indexterm>
3938 This option is the same as <option>-bf</option> except that it assumes that the filter being
3939 tested is a system filter. The additional commands that are available only in
3940 system filters are recognized.
3941 </para>
3942 </listitem></varlistentry>
3943 <varlistentry>
3944 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3945 <listitem>
3946 <para>
3947 <indexterm role="option">
3948 <primary><option>-bf</option></primary>
3949 </indexterm>
3950 <indexterm role="concept">
3951 <primary>filter</primary>
3952 <secondary>testing</secondary>
3953 </indexterm>
3954 <indexterm role="concept">
3955 <primary>testing</primary>
3956 <secondary>filter file</secondary>
3957 </indexterm>
3958 <indexterm role="concept">
3959 <primary>forward file</primary>
3960 <secondary>testing</secondary>
3961 </indexterm>
3962 <indexterm role="concept">
3963 <primary>testing</primary>
3964 <secondary>forward file</secondary>
3965 </indexterm>
3966 <indexterm role="concept">
3967 <primary>Sieve filter</primary>
3968 <secondary>testing</secondary>
3969 </indexterm>
3970 This option runs Exim in user filter testing mode; the file is the filter file
3971 to be tested, and a test message must be supplied on the standard input. If
3972 there are no message-dependent tests in the filter, an empty file can be
3973 supplied.
3974 </para>
3975 <para>
3976 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3977 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3978 filter and a user filter in the same run. For example:
3979 </para>
3980 <literallayout class="monospaced">
3981 exim -bF /system/filter -bf /user/filter &lt;/test/message
3982 </literallayout>
3983 <para>
3984 This is helpful when the system filter adds header lines or sets filter
3985 variables that are used by the user filter.
3986 </para>
3987 <para>
3988 If the test filter file does not begin with one of the special lines
3989 </para>
3990 <literallayout class="monospaced">
3991 # Exim filter
3992 # Sieve filter
3993 </literallayout>
3994 <para>
3995 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3996 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3997 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3998 redirection lists.
3999 </para>
4000 <para>
4001 The result of an Exim command that uses <option>-bf</option>, provided no errors are
4002 detected, is a list of the actions that Exim would try to take if presented
4003 with the message for real. More details of filter testing are given in the
4004 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
4005 </para>
4006 <para>
4007 When testing a filter file,
4008 <indexterm role="concept">
4009 <primary><quote>From</quote> line</primary>
4010 </indexterm>
4011 <indexterm role="concept">
4012 <primary>envelope sender</primary>
4013 </indexterm>
4014 <indexterm role="option">
4015 <primary><option>-f</option></primary>
4016 <secondary>for filter testing</secondary>
4017 </indexterm>
4018 the envelope sender can be set by the <option>-f</option> option,
4019 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
4020 that would normally be taken from the envelope recipient address of the message
4021 can be set by means of additional command line options (see the next four
4022 options).
4023 </para>
4024 </listitem></varlistentry>
4025 <varlistentry>
4026 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4027 <listitem>
4028 <para>
4029 <indexterm role="option">
4030 <primary><option>-bfd</option></primary>
4031 </indexterm>
4032 <indexterm role="variable">
4033 <primary><varname>$qualify_domain</varname></primary>
4034 </indexterm>
4035 This sets the domain of the recipient address when a filter file is being
4036 tested by means of the <option>-bf</option> option. The default is the value of
4037 <varname>$qualify_domain</varname>.
4038 </para>
4039 </listitem></varlistentry>
4040 <varlistentry>
4041 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4042 <listitem>
4043 <para>
4044 <indexterm role="option">
4045 <primary><option>-bfl</option></primary>
4046 </indexterm>
4047 This sets the local part of the recipient address when a filter file is being
4048 tested by means of the <option>-bf</option> option. The default is the username of the
4049 process that calls Exim. A local part should be specified with any prefix or
4050 suffix stripped, because that is how it appears to the filter when a message is
4051 actually being delivered.
4052 </para>
4053 </listitem></varlistentry>
4054 <varlistentry>
4055 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4056 <listitem>
4057 <para>
4058 <indexterm role="option">
4059 <primary><option>-bfp</option></primary>
4060 </indexterm>
4061 This sets the prefix of the local part of the recipient address when a filter
4062 file is being tested by means of the <option>-bf</option> option. The default is an empty
4063 prefix.
4064 </para>
4065 </listitem></varlistentry>
4066 <varlistentry>
4067 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4068 <listitem>
4069 <para>
4070 <indexterm role="option">
4071 <primary><option>-bfs</option></primary>
4072 </indexterm>
4073 This sets the suffix of the local part of the recipient address when a filter
4074 file is being tested by means of the <option>-bf</option> option. The default is an empty
4075 suffix.
4076 </para>
4077 </listitem></varlistentry>
4078 <varlistentry>
4079 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4080 <listitem>
4081 <para>
4082 <indexterm role="option">
4083 <primary><option>-bh</option></primary>
4084 </indexterm>
4085 <indexterm role="concept">
4086 <primary>testing</primary>
4087 <secondary>incoming SMTP</secondary>
4088 </indexterm>
4089 <indexterm role="concept">
4090 <primary>SMTP</primary>
4091 <secondary>testing incoming</secondary>
4092 </indexterm>
4093 <indexterm role="concept">
4094 <primary>testing</primary>
4095 <secondary>relay control</secondary>
4096 </indexterm>
4097 <indexterm role="concept">
4098 <primary>relaying</primary>
4099 <secondary>testing configuration</secondary>
4100 </indexterm>
4101 <indexterm role="concept">
4102 <primary>policy control</primary>
4103 <secondary>testing</secondary>
4104 </indexterm>
4105 <indexterm role="concept">
4106 <primary>debugging</primary>
4107 <secondary><option>-bh</option> option</secondary>
4108 </indexterm>
4109 This option runs a fake SMTP session as if from the given IP address, using the
4110 standard input and output. The IP address may include a port number at the end,
4111 after a full stop. For example:
4112 </para>
4113 <literallayout class="monospaced">
4114 exim -bh 10.9.8.7.1234
4115 exim -bh fe80::a00:20ff:fe86:a061.5678
4116 </literallayout>
4117 <para>
4118 When an IPv6 address is given, it is converted into canonical form. In the case
4119 of the second example above, the value of <varname>$sender_host_address</varname> after
4120 conversion to the canonical form is
4121 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4122 </para>
4123 <para>
4124 Comments as to what is going on are written to the standard error file. These
4125 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4126 This facility is provided for testing configuration options for incoming
4127 messages, to make sure they implement the required policy. For example, you can
4128 test your relay controls using <option>-bh</option>.
4129 </para>
4130 <para>
4131 <emphasis role="bold">Warning 1</emphasis>:
4132 <indexterm role="concept">
4133 <primary>RFC 1413</primary>
4134 </indexterm>
4135 You can test features of the configuration that rely on ident (RFC 1413)
4136 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4137 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4138 connection.
4139 </para>
4140 <para>
4141 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4142 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4143 occur, use <option>-bhc</option> instead.
4144 </para>
4145 <para>
4146 Messages supplied during the testing session are discarded, and nothing is
4147 written to any of the real log files. There may be pauses when DNS (and other)
4148 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4149 can be used to specify a specific IP interface and port if this is important,
4150 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4151 session were authenticated.
4152 </para>
4153 <para>
4154 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4155 output just states whether a given recipient address from a given host is
4156 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4157 </para>
4158 <para>
4159 Features such as authentication and encryption, where the client input is not
4160 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4161 specialized SMTP test program such as
4162 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4163 </para>
4164 </listitem></varlistentry>
4165 <varlistentry>
4166 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4167 <listitem>
4168 <para>
4169 <indexterm role="option">
4170 <primary><option>-bhc</option></primary>
4171 </indexterm>
4172 This option operates in the same way as <option>-bh</option>, except that address
4173 verification callouts are performed if required. This includes consulting and
4174 updating the callout cache database.
4175 </para>
4176 </listitem></varlistentry>
4177 <varlistentry>
4178 <term><option>-bi</option></term>
4179 <listitem>
4180 <para>
4181 <indexterm role="option">
4182 <primary><option>-bi</option></primary>
4183 </indexterm>
4184 <indexterm role="concept">
4185 <primary>alias file</primary>
4186 <secondary>building</secondary>
4187 </indexterm>
4188 <indexterm role="concept">
4189 <primary>building alias file</primary>
4190 </indexterm>
4191 <indexterm role="concept">
4192 <primary>Sendmail compatibility</primary>
4193 <secondary><option>-bi</option> option</secondary>
4194 </indexterm>
4195 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4196 Exim does not have the concept of a single alias file, and so it cannot mimic
4197 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4198 tend to appear in various scripts such as NIS make files, so the option must be
4199 recognized.
4200 </para>
4201 <para>
4202 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4203 configuration option is run, under the uid and gid of the caller of Exim. If
4204 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4205 The command set by <option>bi_command</option> may not contain arguments. The command can
4206 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4207 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4208 <option>-bi</option> is a no-op.
4209 </para>
4210 </listitem></varlistentry>
4211 <varlistentry>
4212 <term><option>-bI:help</option></term>
4213 <listitem>
4214 <para>
4215 <indexterm role="option">
4216 <primary><option>-bI:help</option></primary>
4217 </indexterm>
4218 <indexterm role="concept">
4219 <primary>querying exim information</primary>
4220 </indexterm>
4221 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4222 information.  The output of many of these will be intended for machine
4223 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4224 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4225 options shall cause Exim to exit after producing the requested output.
4226 </para>
4227 </listitem></varlistentry>
4228 <varlistentry>
4229 <term><option>-bI:dscp</option></term>
4230 <listitem>
4231 <para>
4232 <indexterm role="option">
4233 <primary><option>-bI:dscp</option></primary>
4234 </indexterm>
4235 <indexterm role="concept">
4236 <primary>DSCP</primary>
4237 <secondary>values</secondary>
4238 </indexterm>
4239 This option causes Exim to emit an alphabetically sorted list of all
4240 recognised DSCP names.
4241 </para>
4242 </listitem></varlistentry>
4243 <varlistentry>
4244 <term><option>-bI:sieve</option></term>
4245 <listitem>
4246 <para>
4247 <indexterm role="option">
4248 <primary><option>-bI:sieve</option></primary>
4249 </indexterm>
4250 <indexterm role="concept">
4251 <primary>Sieve filter</primary>
4252 <secondary>capabilities</secondary>
4253 </indexterm>
4254 This option causes Exim to emit an alphabetically sorted list of all supported
4255 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4256 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4257 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4258 compile-time build options, which this option will adapt to, this is the only
4259 way to guarantee a correct response.
4260 </para>
4261 </listitem></varlistentry>
4262 <varlistentry>
4263 <term><option>-bm</option></term>
4264 <listitem>
4265 <para>
4266 <indexterm role="option">
4267 <primary><option>-bm</option></primary>
4268 </indexterm>
4269 <indexterm role="concept">
4270 <primary>local message reception</primary>
4271 </indexterm>
4272 This option runs an Exim receiving process that accepts an incoming,
4273 locally-generated message on the standard input. The recipients are given as the
4274 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4275 argument can be a comma-separated list of RFC 2822 addresses. This is the
4276 default option for selecting the overall action of an Exim call; it is assumed
4277 if no other conflicting option is present.
4278 </para>
4279 <para>
4280 If any addresses in the message are unqualified (have no domain), they are
4281 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4282 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4283 suppressing this for special cases.
4284 </para>
4285 <para>
4286 Policy checks on the contents of local messages can be enforced by means of
4287 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4288 </para>
4289 <para>
4290 <indexterm role="concept">
4291 <primary>return code</primary>
4292 <secondary>for <option>-bm</option></secondary>
4293 </indexterm>
4294 The return code is zero if the message is successfully accepted. Otherwise, the
4295 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4296 </para>
4297 <para>
4298 The format
4299 <indexterm role="concept">
4300 <primary>message</primary>
4301 <secondary>format</secondary>
4302 </indexterm>
4303 <indexterm role="concept">
4304 <primary>format</primary>
4305 <secondary>message</secondary>
4306 </indexterm>
4307 <indexterm role="concept">
4308 <primary><quote>From</quote> line</primary>
4309 </indexterm>
4310 <indexterm role="concept">
4311 <primary>UUCP</primary>
4312 <secondary><quote>From</quote> line</secondary>
4313 </indexterm>
4314 <indexterm role="concept">
4315 <primary>Sendmail compatibility</primary>
4316 <secondary><quote>From</quote> line</secondary>
4317 </indexterm>
4318 of the message must be as defined in RFC 2822, except that, for
4319 compatibility with Sendmail and Smail, a line in one of the forms
4320 </para>
4321 <literallayout class="monospaced">
4322 From sender Fri Jan  5 12:55 GMT 1997
4323 From sender Fri, 5 Jan 97 12:55:01
4324 </literallayout>
4325 <para>
4326 (with the weekday optional, and possibly with additional text after the date)
4327 is permitted to appear at the start of the message. There appears to be no
4328 authoritative specification of the format of this line. Exim recognizes it by
4329 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4330 option, which can be changed if necessary.
4331 </para>
4332 <para>
4333 <indexterm role="option">
4334 <primary><option>-f</option></primary>
4335 <secondary>overriding <quote>From</quote> line</secondary>
4336 </indexterm>
4337 The specified sender is treated as if it were given as the argument to the
4338 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4339 preference to the address taken from the message. The caller of Exim must be a
4340 trusted user for the sender of a message to be set in this way.
4341 </para>
4342 </listitem></varlistentry>
4343 <varlistentry>
4344 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4345 <listitem>
4346 <para>
4347 <indexterm role="option">
4348 <primary><option>-bmalware</option></primary>
4349 </indexterm>
4350 <indexterm role="concept">
4351 <primary>testing</primary>
4352 <secondary>,</secondary>
4353 </indexterm>
4354 <indexterm role="concept">
4355 <primary>malware scan test</primary>
4356 </indexterm>
4357 This debugging option causes Exim to scan the given file or directory
4358 (depending on the used scanner interface),
4359 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4360 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4361 the expansion should have defaults which apply to this invocation.  ACLs are
4362 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4363 will never be populated and <option>-bmalware</option> will fail.
4364 </para>
4365 <para>
4366 Exim will have changed working directory before resolving the filename, so
4367 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4368 user when it tries to open the file, rather than as the invoking user.
4369 This option requires admin privileges.
4370 </para>
4371 <para>
4372 The <option>-bmalware</option> option will not be extended to be more generally useful,
4373 there are better tools for file-scanning.  This option exists to help
4374 administrators verify their Exim and AV scanner configuration.
4375 </para>
4376 </listitem></varlistentry>
4377 <varlistentry>
4378 <term><option>-bnq</option></term>
4379 <listitem>
4380 <para>
4381 <indexterm role="option">
4382 <primary><option>-bnq</option></primary>
4383 </indexterm>
4384 <indexterm role="concept">
4385 <primary>address qualification, suppressing</primary>
4386 </indexterm>
4387 By default, Exim automatically qualifies unqualified addresses (those
4388 without domains) that appear in messages that are submitted locally (that
4389 is, not over TCP/IP). This qualification applies both to addresses in
4390 envelopes, and addresses in header lines. Sender addresses are qualified using
4391 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4392 defaults to the value of <option>qualify_domain</option>).
4393 </para>
4394 <para>
4395 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4396 being used to re-submit messages that originally came from remote hosts after
4397 content scanning, you probably do not want to qualify unqualified addresses in
4398 header lines. (Such lines will be present only if you have not enabled a header
4399 syntax check in the appropriate ACL.)
4400 </para>
4401 <para>
4402 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4403 messages that originate on the local host. When this is used, unqualified
4404 addresses in the envelope provoke errors (causing message rejection) and
4405 unqualified addresses in header lines are left alone.
4406 </para>
4407 </listitem></varlistentry>
4408 <varlistentry>
4409 <term><option>-bP</option></term>
4410 <listitem>
4411 <para>
4412 <indexterm role="option">
4413 <primary><option>-bP</option></primary>
4414 </indexterm>
4415 <indexterm role="concept">
4416 <primary>configuration options</primary>
4417 <secondary>extracting</secondary>
4418 </indexterm>
4419 <indexterm role="concept">
4420 <primary>options</primary>
4421 <secondary>configuration &ndash; extracting</secondary>
4422 </indexterm>
4423 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4424 main configuration options to be written to the standard output. The values
4425 of one or more specific options can be requested by giving their names as
4426 arguments, for example:
4427 </para>
4428 <literallayout class="monospaced">
4429 exim -bP qualify_domain hold_domains
4430 </literallayout>
4431 <para>
4432 <indexterm role="concept">
4433 <primary>hiding configuration option values</primary>
4434 </indexterm>
4435 <indexterm role="concept">
4436 <primary>configuration options</primary>
4437 <secondary>hiding value of</secondary>
4438 </indexterm>
4439 <indexterm role="concept">
4440 <primary>options</primary>
4441 <secondary>hiding value of</secondary>
4442 </indexterm>
4443 However, any option setting that is preceded by the word <quote>hide</quote> in the
4444 configuration file is not shown in full, except to an admin user. For other
4445 users, the output is as in this example:
4446 </para>
4447 <literallayout class="monospaced">
4448 mysql_servers = &lt;value not displayable&gt;
4449 </literallayout>
4450 <para>
4451 If <option>config</option> is given as an argument, the config is
4452 output, as it was parsed, any include file resolved, any comment removed.
4453 </para>
4454 <para>
4455 If <option>config_file</option> is given as an argument, the name of the run time
4456 configuration file is output. (<option>configure_file</option> works too, for
4457 backward compatibility.)
4458 If a list of configuration files was supplied, the value that is output here
4459 is the name of the file that was actually used.
4460 </para>
4461 <para>
4462 <indexterm role="concept">
4463 <primary>options</primary>
4464 <secondary>hiding name of</secondary>
4465 </indexterm>
4466 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4467 name will not be output.
4468 </para>
4469 <para>
4470 <indexterm role="concept">
4471 <primary>daemon</primary>
4472 <secondary>process id (pid)</secondary>
4473 </indexterm>
4474 <indexterm role="concept">
4475 <primary>pid (process id)</primary>
4476 <secondary>of daemon</secondary>
4477 </indexterm>
4478 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4479 directories where log files and daemon pid files are written are output,
4480 respectively. If these values are unset, log files are written in a
4481 sub-directory of the spool directory called <option>log</option>, and the pid file is
4482 written directly into the spool directory.
4483 </para>
4484 <para>
4485 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4486 </para>
4487 <literallayout class="monospaced">
4488 exim -bP +local_domains
4489 </literallayout>
4490 <para>
4491 it searches for a matching named list of any type (domain, host, address, or
4492 local part) and outputs what it finds.
4493 </para>
4494 <para>
4495 <indexterm role="concept">
4496 <primary>options</primary>
4497 <secondary>router &ndash; extracting</secondary>
4498 </indexterm>
4499 <indexterm role="concept">
4500 <primary>options</primary>
4501 <secondary>transport &ndash; extracting</secondary>
4502 </indexterm>
4503 <indexterm role="concept">
4504 <primary>options</primary>
4505 <secondary>authenticator &ndash; extracting</secondary>
4506 </indexterm>
4507 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4508 followed by the name of an appropriate driver instance, the option settings for
4509 that driver are output. For example:
4510 </para>
4511 <literallayout class="monospaced">
4512 exim -bP transport local_delivery
4513 </literallayout>
4514 <para>
4515 The generic driver options are output first, followed by the driver&#x2019;s private
4516 options. A list of the names of drivers of a particular type can be obtained by
4517 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4518 <option>authenticator_list</option>, and a complete list of all drivers with their option
4519 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4520 <option>authenticators</option>.
4521 </para>
4522 <para>
4523 <indexterm role="concept">
4524 <primary>environment</primary>
4525 </indexterm>
4526 If <option>environment</option> is given as an argument, the set of environment
4527 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4528 variables.
4529 </para>
4530 <para>
4531 <indexterm role="concept">
4532 <primary>options</primary>
4533 <secondary>macro &ndash; extracting</secondary>
4534 </indexterm>
4535 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4536 are available, similarly to the drivers.  Because macros are sometimes used
4537 for storing passwords, this option is restricted.
4538 The output format is one item per line.
4539 </para>
4540 <para revisionflag="changed">
4541 For the "-bP macro &lt;name&gt;" form, if no such macro is found
4542 the exit status will be nonzero.
4543 </para>
4544 </listitem></varlistentry>
4545 <varlistentry>
4546 <term><option>-bp</option></term>
4547 <listitem>
4548 <para>
4549 <indexterm role="option">
4550 <primary><option>-bp</option></primary>
4551 </indexterm>
4552 <indexterm role="concept">
4553 <primary>queue</primary>
4554 <secondary>listing messages on</secondary>
4555 </indexterm>
4556 <indexterm role="concept">
4557 <primary>listing</primary>
4558 <secondary>messages on the queue</secondary>
4559 </indexterm>
4560 This option requests a listing of the contents of the mail queue on the
4561 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4562 just those messages are listed. By default, this option can be used only by an
4563 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4564 to allow any user to see the queue.
4565 </para>
4566 <para>
4567 Each message on the queue is displayed as in the following example:
4568 </para>
4569 <literallayout class="monospaced">
4570 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4571           red.king@looking-glass.fict.example
4572           &lt;other addresses&gt;
4573 </literallayout>
4574 <para>
4575 <indexterm role="concept">
4576 <primary>message</primary>
4577 <secondary>size in queue listing</secondary>
4578 </indexterm>
4579 <indexterm role="concept">
4580 <primary>size</primary>
4581 <secondary>of message</secondary>
4582 </indexterm>
4583 The first line contains the length of time the message has been on the queue
4584 (in this case 25 minutes), the size of the message (2.9K), the unique local
4585 identifier for the message, and the message sender, as contained in the
4586 envelope. For bounce messages, the sender address is empty, and appears as
4587 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4588 the default sender address, the user&#x2019;s login name is shown in parentheses
4589 before the sender address.
4590 </para>
4591 <para>
4592 <indexterm role="concept">
4593 <primary>frozen messages</primary>
4594 <secondary>in queue listing</secondary>
4595 </indexterm>
4596 If the message is frozen (attempts to deliver it are suspended) then the text
4597 <quote>*** frozen ***</quote> is displayed at the end of this line.
4598 </para>
4599 <para>
4600 The recipients of the message (taken from the envelope, not the headers) are
4601 displayed on subsequent lines. Those addresses to which the message has already
4602 been delivered are marked with the letter D. If an original address gets
4603 expanded into several addresses via an alias or forward file, the original is
4604 displayed with a D only when deliveries for all of its child addresses are
4605 complete.
4606 </para>
4607 </listitem></varlistentry>
4608 <varlistentry>
4609 <term><option>-bpa</option></term>
4610 <listitem>
4611 <para>
4612 <indexterm role="option">
4613 <primary><option>-bpa</option></primary>
4614 </indexterm>
4615 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4616 that were generated from the original top level address(es) in each message by
4617 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4618 of just <quote>D</quote>.
4619 </para>
4620 </listitem></varlistentry>
4621 <varlistentry>
4622 <term><option>-bpc</option></term>
4623 <listitem>
4624 <para>
4625 <indexterm role="option">
4626 <primary><option>-bpc</option></primary>
4627 </indexterm>
4628 <indexterm role="concept">
4629 <primary>queue</primary>
4630 <secondary>count of messages on</secondary>
4631 </indexterm>
4632 This option counts the number of messages on the queue, and writes the total
4633 to the standard output. It is restricted to admin users, unless
4634 <option>queue_list_requires_admin</option> is set false.
4635 </para>
4636 </listitem></varlistentry>
4637 <varlistentry>
4638 <term><option>-bpr</option></term>
4639 <listitem>
4640 <para>
4641 <indexterm role="option">
4642 <primary><option>-bpr</option></primary>
4643 </indexterm>
4644 This option operates like <option>-bp</option>, but the output is not sorted into
4645 chronological order of message arrival. This can speed it up when there are
4646 lots of messages on the queue, and is particularly useful if the output is
4647 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4648 </para>
4649 </listitem></varlistentry>
4650 <varlistentry>
4651 <term><option>-bpra</option></term>
4652 <listitem>
4653 <para>
4654 <indexterm role="option">
4655 <primary><option>-bpra</option></primary>
4656 </indexterm>
4657 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4658 </para>
4659 </listitem></varlistentry>
4660 <varlistentry>
4661 <term><option>-bpru</option></term>
4662 <listitem>
4663 <para>
4664 <indexterm role="option">
4665 <primary><option>-bpru</option></primary>
4666 </indexterm>
4667 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4668 </para>
4669 </listitem></varlistentry>
4670 <varlistentry>
4671 <term><option>-bpu</option></term>
4672 <listitem>
4673 <para>
4674 <indexterm role="option">
4675 <primary><option>-bpu</option></primary>
4676 </indexterm>
4677 This option operates like <option>-bp</option> but shows only undelivered top-level
4678 addresses for each message displayed. Addresses generated by aliasing or
4679 forwarding are not shown, unless the message was deferred after processing by a
4680 router with the <option>one_time</option> option set.
4681 </para>
4682 </listitem></varlistentry>
4683 <varlistentry>
4684 <term><option>-brt</option></term>
4685 <listitem>
4686 <para>
4687 <indexterm role="option">
4688 <primary><option>-brt</option></primary>
4689 </indexterm>
4690 <indexterm role="concept">
4691 <primary>testing</primary>
4692 <secondary>retry configuration</secondary>
4693 </indexterm>
4694 <indexterm role="concept">
4695 <primary>retry</primary>
4696 <secondary>configuration testing</secondary>
4697 </indexterm>
4698 This option is for testing retry rules, and it must be followed by up to three
4699 arguments. It causes Exim to look for a retry rule that matches the values
4700 and to write it to the standard output. For example:
4701 </para>
4702 <literallayout class="monospaced">
4703 exim -brt bach.comp.mus.example
4704 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4705 </literallayout>
4706 <para>
4707 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4708 argument, which is required, can be a complete address in the form
4709 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4710 contains a dot, it is interpreted as an optional second domain name; if no
4711 retry rule is found for the first argument, the second is tried. This ties in
4712 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4713 rule is found that matches the host, one that matches the mail domain is
4714 sought. Finally, an argument that is the name of a specific delivery error, as
4715 used in setting up retry rules, can be given. For example:
4716 </para>
4717 <literallayout class="monospaced">
4718 exim -brt haydn.comp.mus.example quota_3d
4719 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4720 </literallayout>
4721 </listitem></varlistentry>
4722 <varlistentry>
4723 <term><option>-brw</option></term>
4724 <listitem>
4725 <para>
4726 <indexterm role="option">
4727 <primary><option>-brw</option></primary>
4728 </indexterm>
4729 <indexterm role="concept">
4730 <primary>testing</primary>
4731 <secondary>rewriting</secondary>
4732 </indexterm>
4733 <indexterm role="concept">
4734 <primary>rewriting</primary>
4735 <secondary>testing</secondary>
4736 </indexterm>
4737 This option is for testing address rewriting rules, and it must be followed by
4738 a single argument, consisting of either a local part without a domain, or a
4739 complete address with a fully qualified domain. Exim outputs how this address
4740 would be rewritten for each possible place it might appear. See chapter
4741 <xref linkend="CHAPrewrite"/> for further details.
4742 </para>
4743 </listitem></varlistentry>
4744 <varlistentry>
4745 <term><option>-bS</option></term>
4746 <listitem>
4747 <para>
4748 <indexterm role="option">
4749 <primary><option>-bS</option></primary>
4750 </indexterm>
4751 <indexterm role="concept">
4752 <primary>SMTP</primary>
4753 <secondary>batched incoming</secondary>
4754 </indexterm>
4755 <indexterm role="concept">
4756 <primary>batched SMTP input</primary>
4757 </indexterm>
4758 This option is used for batched SMTP input, which is an alternative interface
4759 for non-interactive local message submission. A number of messages can be
4760 submitted in a single run. However, despite its name, this is not really SMTP
4761 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4762 input, but generates no responses. If the caller is trusted, or
4763 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4764 believed; otherwise the sender is always the caller of Exim.
4765 </para>
4766 <para>
4767 The message itself is read from the standard input, in SMTP format (leading
4768 dots doubled), terminated by a line containing just a single dot. An error is
4769 provoked if the terminating dot is missing. A further message may then follow.
4770 </para>
4771 <para>
4772 As for other local message submissions, the contents of incoming batch SMTP
4773 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4774 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4775 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4776 </para>
4777 <para>
4778 Some other SMTP commands are recognized in the input. HELO and EHLO act
4779 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4780 QUIT quits, ignoring the rest of the standard input.
4781 </para>
4782 <para>
4783 <indexterm role="concept">
4784 <primary>return code</primary>
4785 <secondary>for <option>-bS</option></secondary>
4786 </indexterm>
4787 If any error is encountered, reports are written to the standard output and
4788 error streams, and Exim gives up immediately. The return code is 0 if no error
4789 was detected; it is 1 if one or more messages were accepted before the error
4790 was detected; otherwise it is 2.
4791 </para>
4792 <para>
4793 More details of input using batched SMTP are given in section
4794 <xref linkend="SECTincomingbatchedSMTP"/>.
4795 </para>
4796 </listitem></varlistentry>
4797 <varlistentry>
4798 <term><option>-bs</option></term>
4799 <listitem>
4800 <para>
4801 <indexterm role="option">
4802 <primary><option>-bs</option></primary>
4803 </indexterm>
4804 <indexterm role="concept">
4805 <primary>SMTP</primary>
4806 <secondary>local input</secondary>
4807 </indexterm>
4808 <indexterm role="concept">
4809 <primary>local SMTP input</primary>
4810 </indexterm>
4811 This option causes Exim to accept one or more messages by reading SMTP commands
4812 on the standard input, and producing SMTP replies on the standard output. SMTP
4813 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4814 Some user agents use this interface as a way of passing locally-generated
4815 messages to the MTA.
4816 </para>
4817 <para>
4818 In
4819 <indexterm role="concept">
4820 <primary>sender</primary>
4821 <secondary>source of</secondary>
4822 </indexterm>
4823 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4824 set, the senders of messages are taken from the SMTP MAIL commands.
4825 Otherwise the content of these commands is ignored and the sender is set up as
4826 the calling user. Unqualified addresses are automatically qualified using
4827 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4828 <option>-bnq</option> option is used.
4829 </para>
4830 <para>
4831 <indexterm role="concept">
4832 <primary>inetd</primary>
4833 </indexterm>
4834 The
4835 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4836 using a listening daemon. Exim can distinguish the two cases by checking
4837 whether the standard input is a TCP/IP socket. When Exim is called from
4838 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4839 above concerning senders and qualification do not apply. In this situation,
4840 Exim behaves in exactly the same way as it does when receiving a message via
4841 the listening daemon.
4842 </para>
4843 </listitem></varlistentry>
4844 <varlistentry>
4845 <term><option>-bt</option></term>
4846 <listitem>
4847 <para>
4848 <indexterm role="option">
4849 <primary><option>-bt</option></primary>
4850 </indexterm>
4851 <indexterm role="concept">
4852 <primary>testing</primary>
4853 <secondary>addresses</secondary>
4854 </indexterm>
4855 <indexterm role="concept">
4856 <primary>address</primary>
4857 <secondary>testing</secondary>
4858 </indexterm>
4859 This option runs Exim in address testing mode, in which each argument is taken
4860 as a recipient address to be tested for deliverability. The results are
4861 written to the standard output. If a test fails, and the caller is not an admin
4862 user, no details of the failure are output, because these might contain
4863 sensitive information such as usernames and passwords for database lookups.
4864 </para>
4865 <para>
4866 If no arguments are given, Exim runs in an interactive manner, prompting with a
4867 right angle bracket for addresses to be tested.
4868 </para>
4869 <para>
4870 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4871 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4872 security issues.
4873 </para>
4874 <para>
4875 Each address is handled as if it were the recipient address of a message
4876 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4877 written to the standard output. However, any router that has
4878 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4879 genuine routing tests if your first router passes everything to a scanner
4880 program.
4881 </para>
4882 <para>
4883 <indexterm role="concept">
4884 <primary>return code</primary>
4885 <secondary>for <option>-bt</option></secondary>
4886 </indexterm>
4887 The return code is 2 if any address failed outright; it is 1 if no address
4888 failed outright but at least one could not be resolved for some reason. Return
4889 code 0 is given only when all addresses succeed.
4890 </para>
4891 <para>
4892 <indexterm role="concept">
4893 <primary>duplicate addresses</primary>
4894 </indexterm>
4895 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4896 addresses after routing is complete, so that only one delivery takes place.
4897 This does not happen when testing with <option>-bt</option>; the full results of routing are
4898 always shown.
4899 </para>
4900 <para>
4901 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4902 routers in the configuration makes any tests on the sender address of a
4903 message,
4904 <indexterm role="option">
4905 <primary><option>-f</option></primary>
4906 <secondary>for address testing</secondary>
4907 </indexterm>
4908 you can use the <option>-f</option> option to set an appropriate sender when running
4909 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4910 default qualifying domain. However, if you have set up (for example) routers
4911 whose behaviour depends on the contents of an incoming message, you cannot test
4912 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4913 doing such tests.
4914 </para>
4915 </listitem></varlistentry>
4916 <varlistentry>
4917 <term><option>-bV</option></term>
4918 <listitem>
4919 <para>
4920 <indexterm role="option">
4921 <primary><option>-bV</option></primary>
4922 </indexterm>
4923 <indexterm role="concept">
4924 <primary>version number of Exim</primary>
4925 </indexterm>
4926 This option causes Exim to write the current version number, compilation
4927 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4928 It also lists the DBM library that is being used, the optional modules (such as
4929 specific lookup types), the drivers that are included in the binary, and the
4930 name of the run time configuration file that is in use.
4931 </para>
4932 <para>
4933 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4934 configuration file. However, this is a static check only. It cannot check
4935 values that are to be expanded. For example, although a misspelt ACL verb is
4936 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4937 alone to discover (for example) all the typos in the configuration; some
4938 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4939 dynamic testing facilities.
4940 </para>
4941 </listitem></varlistentry>
4942 <varlistentry>
4943 <term><option>-bv</option></term>
4944 <listitem>
4945 <para>
4946 <indexterm role="option">
4947 <primary><option>-bv</option></primary>
4948 </indexterm>
4949 <indexterm role="concept">
4950 <primary>verifying address</primary>
4951 <secondary>using <option>-bv</option></secondary>
4952 </indexterm>
4953 <indexterm role="concept">
4954 <primary>address</primary>
4955 <secondary>verification</secondary>
4956 </indexterm>
4957 This option runs Exim in address verification mode, in which each argument is
4958 taken as a recipient address to be verified by the routers. (This does
4959 not involve any verification callouts). During normal operation, verification
4960 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4961 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4962 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4963 </para>
4964 <para>
4965 If verification fails, and the caller is not an admin user, no details of the
4966 failure are output, because these might contain sensitive information such as
4967 usernames and passwords for database lookups.
4968 </para>
4969 <para>
4970 If no arguments are given, Exim runs in an interactive manner, prompting with a
4971 right angle bracket for addresses to be verified.
4972 </para>
4973 <para>
4974 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4975 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4976 security issues.
4977 </para>
4978 <para>
4979 Verification differs from address testing (the <option>-bt</option> option) in that routers
4980 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4981 router that has <option>fail_verify</option> set, verification fails. The address is
4982 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4983 address, <option>-bvs</option> should be used.
4984 </para>
4985 <para>
4986 If the <option>-v</option> option is not set, the output consists of a single line for each
4987 address, stating whether it was verified or not, and giving a reason in the
4988 latter case. Without <option>-v</option>, generating more than one address by redirection
4989 causes verification to end successfully, without considering the generated
4990 addresses. However, if just one address is generated, processing continues,
4991 and the generated address must verify successfully for the overall verification
4992 to succeed.
4993 </para>
4994 <para>
4995 When <option>-v</option> is set, more details are given of how the address has been handled,
4996 and in the case of address redirection, all the generated addresses are also
4997 considered. Verification may succeed for some and fail for others.
4998 </para>
4999 <para>
5000 The
5001 <indexterm role="concept">
5002 <primary>return code</primary>
5003 <secondary>for <option>-bv</option></secondary>
5004 </indexterm>
5005 return code is 2 if any address failed outright; it is 1 if no address
5006 failed outright but at least one could not be resolved for some reason. Return
5007 code 0 is given only when all addresses succeed.
5008 </para>
5009 <para>
5010 If any of the routers in the configuration makes any tests on the sender
5011 address of a message, you should use the <option>-f</option> option to set an appropriate
5012 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
5013 calling user at the default qualifying domain.
5014 </para>
5015 </listitem></varlistentry>
5016 <varlistentry>
5017 <term><option>-bvs</option></term>
5018 <listitem>
5019 <para>
5020 <indexterm role="option">
5021 <primary><option>-bvs</option></primary>
5022 </indexterm>
5023 This option acts like <option>-bv</option>, but verifies the address as a sender rather
5024 than a recipient address. This affects any rewriting and qualification that
5025 might happen.
5026 </para>
5027 </listitem></varlistentry>
5028 <varlistentry>
5029 <term><option>-bw</option></term>
5030 <listitem>
5031 <para>
5032 <indexterm role="option">
5033 <primary><option>-bw</option></primary>
5034 </indexterm>
5035 <indexterm role="concept">
5036 <primary>daemon</primary>
5037 </indexterm>
5038 <indexterm role="concept">
5039 <primary>inetd</primary>
5040 </indexterm>
5041 <indexterm role="concept">
5042 <primary>inetd</primary>
5043 <secondary>wait mode</secondary>
5044 </indexterm>
5045 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5046 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5047 and in the configuration file are ignored.  Queue-running may not be specified.
5048 </para>
5049 <para>
5050 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5051 listening for connections.  This permits the system to start up and have
5052 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5053 each port only when the first connection is received.
5054 </para>
5055 <para>
5056 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5057 which the daemon will exit, which should cause inetd to listen once more.
5058 </para>
5059 </listitem></varlistentry>
5060 <varlistentry>
5061 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5062 <listitem>
5063 <para>
5064 <indexterm role="option">
5065 <primary><option>-C</option></primary>
5066 </indexterm>
5067 <indexterm role="concept">
5068 <primary>configuration file</primary>
5069 <secondary>alternate</secondary>
5070 </indexterm>
5071 <indexterm role="concept">
5072 <primary>CONFIGURE_FILE</primary>
5073 </indexterm>
5074 <indexterm role="concept">
5075 <primary>alternate configuration file</primary>
5076 </indexterm>
5077 This option causes Exim to find the run time configuration file from the given
5078 list instead of from the list specified by the CONFIGURE_FILE
5079 compile-time setting. Usually, the list will consist of just a single file
5080 name, but it can be a colon-separated list of names. In this case, the first
5081 file that exists is used. Failure to open an existing file stops Exim from
5082 proceeding any further along the list, and an error is generated.
5083 </para>
5084 <para>
5085 When this option is used by a caller other than root, and the list is different
5086 from the compiled-in list, Exim gives up its root privilege immediately, and
5087 runs with the real and effective uid and gid set to those of the caller.
5088 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5089 file contains a list of full pathnames, one per line, for configuration files
5090 which are trusted. Root privilege is retained for any configuration file so
5091 listed, as long as the caller is the Exim user (or the user specified in the
5092 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5093 not writeable by inappropriate users or groups.
5094 </para>
5095 <para>
5096 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5097 configuration using <option>-C</option> right through message reception and delivery,
5098 even if the caller is root. The reception works, but by that time, Exim is
5099 running as the Exim user, so when it re-executes to regain privilege for the
5100 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5101 test reception and delivery using two separate commands (one to put a message
5102 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5103 </para>
5104 <para>
5105 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5106 prefix string with which any file named in a <option>-C</option> command line option
5107 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5108 However, if the value of the <option>-C</option> option is identical to the value of
5109 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5110 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5111 unset, any file name can be used with <option>-C</option>.
5112 </para>
5113 <para>
5114 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5115 to a directory to which only root has access. This prevents someone who has
5116 broken into the Exim account from running a privileged Exim with an arbitrary
5117 configuration file.
5118 </para>
5119 <para>
5120 The <option>-C</option> facility is useful for ensuring that configuration files are
5121 syntactically correct, but cannot be used for test deliveries, unless the
5122 caller is privileged, or unless it is an exotic configuration that does not
5123 require privilege. No check is made on the owner or group of the files
5124 specified by this option.
5125 </para>
5126 </listitem></varlistentry>
5127 <varlistentry>
5128 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5129 <listitem>
5130 <para>
5131 <indexterm role="option">
5132 <primary><option>-D</option></primary>
5133 </indexterm>
5134 <indexterm role="concept">
5135 <primary>macro</primary>
5136 <secondary>setting on command line</secondary>
5137 </indexterm>
5138 This option can be used to override macro definitions in the configuration file
5139 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5140 unprivileged caller, it causes Exim to give up its root privilege.
5141 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5142 completely disabled, and its use causes an immediate error exit.
5143 </para>
5144 <para>
5145 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5146 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5147 supplies macros from this list, and the values are acceptable, then Exim will
5148 not give up root privilege if the caller is root, the Exim run-time user, or
5149 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5150 to be removed in the future.  Acceptable values for the macros satisfy the
5151 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5152 </para>
5153 <para>
5154 The entire option (including equals sign if present) must all be within one
5155 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5156 string, in which case the equals sign is optional. These two commands are
5157 synonymous:
5158 </para>
5159 <literallayout class="monospaced">
5160 exim -DABC  ...
5161 exim -DABC= ...
5162 </literallayout>
5163 <para>
5164 To include spaces in a macro definition item, quotes must be used. If you use
5165 quotes, spaces are permitted around the macro name and the equals sign. For
5166 example:
5167 </para>
5168 <literallayout class="monospaced">
5169 exim '-D ABC = something' ...
5170 </literallayout>
5171 <para>
5172 <option>-D</option> may be repeated up to 10 times on a command line.
5173 Only macro names up to 22 letters long can be set.
5174 </para>
5175 </listitem></varlistentry>
5176 <varlistentry>
5177 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5178 <listitem>
5179 <para>
5180 <indexterm role="option">
5181 <primary><option>-d</option></primary>
5182 </indexterm>
5183 <indexterm role="concept">
5184 <primary>debugging</primary>
5185 <secondary>list of selectors</secondary>
5186 </indexterm>
5187 <indexterm role="concept">
5188 <primary>debugging</primary>
5189 <secondary><option>-d</option> option</secondary>
5190 </indexterm>
5191 This option causes debugging information to be written to the standard
5192 error stream. It is restricted to admin users because debugging output may show
5193 database queries that contain password information. Also, the details of users&#x2019;
5194 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5195 writes an error message to the standard error stream and exits with a non-zero
5196 return code.
5197 </para>
5198 <para>
5199 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5200 standard debugging data is output. This can be reduced, or increased to include
5201 some more rarely needed information, by directly following <option>-d</option> with a string
5202 made up of names preceded by plus or minus characters. These add or remove sets
5203 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5204 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5205 no spaces are allowed in the debug setting. The available debugging categories
5206 are:
5207 </para>
5208 <literallayout>
5209 <literal>acl            </literal> ACL interpretation
5210 <literal>auth           </literal> authenticators
5211 <literal>deliver        </literal> general delivery logic
5212 <literal>dns            </literal> DNS lookups (see also resolver)
5213 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5214 <literal>exec           </literal> arguments for <function>execv()</function> calls
5215 <literal>expand         </literal> detailed debugging for string expansions
5216 <literal>filter         </literal> filter handling
5217 <literal>hints_lookup   </literal> hints data lookups
5218 <literal>host_lookup    </literal> all types of name-to-IP address handling
5219 <literal>ident          </literal> ident lookup
5220 <literal>interface      </literal> lists of local interfaces
5221 <literal>lists          </literal> matching things in lists
5222 <literal>load           </literal> system load checks
5223 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5224 <literal>lookup         </literal> general lookup code and all lookups
5225 <literal>memory         </literal> memory handling
5226 <literal>pid            </literal> add pid to debug output lines
5227 <literal>process_info   </literal> setting info for the process log
5228 <literal>queue_run      </literal> queue runs
5229 <literal>receive        </literal> general message reception logic
5230 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5231 <literal>retry          </literal> retry handling
5232 <literal>rewrite        </literal> address rewriting
5233 <literal>route          </literal> address routing
5234 <literal>timestamp      </literal> add timestamp to debug output lines
5235 <literal>tls            </literal> TLS logic
5236 <literal>transport      </literal> transports
5237 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5238 <literal>verify         </literal> address verification logic
5239 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5240 </literallayout>
5241 <para>
5242 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5243 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5244 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5245 is included, an awful lot of output that is very rarely of interest is
5246 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5247 turn everything off.
5248 </para>
5249 <para>
5250 <indexterm role="concept">
5251 <primary>resolver, debugging output</primary>
5252 </indexterm>
5253 <indexterm role="concept">
5254 <primary>DNS resolver, debugging output</primary>
5255 </indexterm>
5256 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5257 with DEBUG enabled. This is not the case in some operating systems. Also,
5258 unfortunately, debugging output from the DNS resolver is written to stdout
5259 rather than stderr.
5260 </para>
5261 <para>
5262 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5263 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5264 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5265 daemon, which then passes it on to any re-executed Exims. Exim also
5266 automatically adds the pid to debug lines when several remote deliveries are
5267 run in parallel.
5268 </para>
5269 <para>
5270 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5271 of all debug output lines. This can be useful when trying to track down delays
5272 in processing.
5273 </para>
5274 <para>
5275 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5276 any debugging is selected, or if <option>-v</option> is used.
5277 </para>
5278 </listitem></varlistentry>
5279 <varlistentry>
5280 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5281 <listitem>
5282 <para>
5283 <indexterm role="option">
5284 <primary><option>-dd</option></primary>
5285 </indexterm>
5286 This option behaves exactly like <option>-d</option> except when used on a command that
5287 starts a daemon process. In that case, debugging is turned off for the
5288 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5289 behaviour of the daemon without creating as much output as full debugging does.
5290 </para>
5291 </listitem></varlistentry>
5292 <varlistentry>
5293 <term><option>-dropcr</option></term>
5294 <listitem>
5295 <para>
5296 <indexterm role="option">
5297 <primary><option>-dropcr</option></primary>
5298 </indexterm>
5299 This is an obsolete option that is now a no-op. It used to affect the way Exim
5300 handled CR and LF characters in incoming messages. What happens now is
5301 described in section <xref linkend="SECTlineendings"/>.
5302 </para>
5303 </listitem></varlistentry>
5304 <varlistentry>
5305 <term><option>-E</option></term>
5306 <listitem>
5307 <para>
5308 <indexterm role="option">
5309 <primary><option>-E</option></primary>
5310 </indexterm>
5311 <indexterm role="concept">
5312 <primary>bounce message</primary>
5313 <secondary>generating</secondary>
5314 </indexterm>
5315 This option specifies that an incoming message is a locally-generated delivery
5316 failure report. It is used internally by Exim when handling delivery failures
5317 and is not intended for external use. Its only effect is to stop Exim
5318 generating certain messages to the postmaster, as otherwise message cascades
5319 could occur in some situations. As part of the same option, a message id may
5320 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5321 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5322 </para>
5323 </listitem></varlistentry>
5324 <varlistentry>
5325 <term><option>-e</option><emphasis>x</emphasis></term>
5326 <listitem>
5327 <para>
5328 <indexterm role="option">
5329 <primary><option>-e</option><emphasis>x</emphasis></primary>
5330 </indexterm>
5331 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5332 called by various programs without the leading <option>o</option> in the option. For
5333 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5334 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5335 </para>
5336 </listitem></varlistentry>
5337 <varlistentry>
5338 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5339 <listitem>
5340 <para>
5341 <indexterm role="option">
5342 <primary><option>-F</option></primary>
5343 </indexterm>
5344 <indexterm role="concept">
5345 <primary>sender</primary>
5346 <secondary>name</secondary>
5347 </indexterm>
5348 <indexterm role="concept">
5349 <primary>name</primary>
5350 <secondary>of sender</secondary>
5351 </indexterm>
5352 This option sets the sender&#x2019;s full name for use when a locally-generated
5353 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5354 entry from the password data is used. As users are generally permitted to alter
5355 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5356 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5357 </para>
5358 </listitem></varlistentry>
5359 <varlistentry>
5360 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5361 <listitem>
5362 <para>
5363 <indexterm role="option">
5364 <primary><option>-f</option></primary>
5365 </indexterm>
5366 <indexterm role="concept">
5367 <primary>sender</primary>
5368 <secondary>address</secondary>
5369 </indexterm>
5370 <indexterm role="concept">
5371 <primary>address</primary>
5372 <secondary>sender</secondary>
5373 </indexterm>
5374 <indexterm role="concept">
5375 <primary>trusted users</primary>
5376 </indexterm>
5377 <indexterm role="concept">
5378 <primary>envelope sender</primary>
5379 </indexterm>
5380 <indexterm role="concept">
5381 <primary>user</primary>
5382 <secondary>trusted</secondary>
5383 </indexterm>
5384 This option sets the address of the envelope sender of a locally-generated
5385 message (also known as the return path). The option can normally be used only
5386 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5387 users to use it.
5388 </para>
5389 <para>
5390 Processes running as root or the Exim user are always trusted. Other
5391 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5392 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5393 of a local message is set to the caller&#x2019;s login name at the default qualify
5394 domain.
5395 </para>
5396 <para>
5397 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5398 can be specified by any user, trusted or not, to create a message that can
5399 never provoke a bounce. An empty sender can be specified either as an empty
5400 string, or as a pair of angle brackets with nothing between them, as in these
5401 examples of shell commands:
5402 </para>
5403 <literallayout class="monospaced">
5404 exim -f '&lt;&gt;' user@domain
5405 exim -f "" user@domain
5406 </literallayout>
5407 <para>
5408 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5409 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5410 <option>-bv</option> options.
5411 </para>
5412 <para>
5413 Allowing untrusted users to change the sender address does not of itself make
5414 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5415 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5416 though this can be overridden by setting <option>no_local_from_check</option>.
5417 </para>
5418 <para>
5419 White
5420 <indexterm role="concept">
5421 <primary><quote>From</quote> line</primary>
5422 </indexterm>
5423 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5424 given as two arguments or one combined argument). The sender of a
5425 locally-generated message can also be set (when permitted) by an initial
5426 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5427 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5428 </para>
5429 </listitem></varlistentry>
5430 <varlistentry>
5431 <term><option>-G</option></term>
5432 <listitem>
5433 <para>
5434 <indexterm role="option">
5435 <primary><option>-G</option></primary>
5436 </indexterm>
5437 <indexterm role="concept">
5438 <primary>submission fixups, suppressing (command-line)</primary>
5439 </indexterm>
5440 This option is equivalent to an ACL applying:
5441 </para>
5442 <literallayout class="monospaced">
5443 control = suppress_local_fixups
5444 </literallayout>
5445 <para>
5446 for every message received.  Note that Sendmail will complain about such
5447 bad formatting, where Exim silently just does not fix it up.  This may change
5448 in future.
5449 </para>
5450 <para>
5451 As this affects audit information, the caller must be a trusted user to use
5452 this option.
5453 </para>
5454 </listitem></varlistentry>
5455 <varlistentry>
5456 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5457 <listitem>
5458 <para>
5459 <indexterm role="option">
5460 <primary><option>-h</option></primary>
5461 </indexterm>
5462 <indexterm role="concept">
5463 <primary>Sendmail compatibility</primary>
5464 <secondary><option>-h</option> option ignored</secondary>
5465 </indexterm>
5466 This option is accepted for compatibility with Sendmail, but has no effect. (In
5467 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5468 headers.)
5469 </para>
5470 </listitem></varlistentry>
5471 <varlistentry>
5472 <term><option>-i</option></term>
5473 <listitem>
5474 <para>
5475 <indexterm role="option">
5476 <primary><option>-i</option></primary>
5477 </indexterm>
5478 <indexterm role="concept">
5479 <primary>Solaris</primary>
5480 <secondary><emphasis>mail</emphasis> command</secondary>
5481 </indexterm>
5482 <indexterm role="concept">
5483 <primary>dot</primary>
5484 <secondary>in incoming non-SMTP message</secondary>
5485 </indexterm>
5486 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5487 line by itself should not terminate an incoming, non-SMTP message. I can find
5488 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5489 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5490 </para>
5491 </listitem></varlistentry>
5492 <varlistentry>
5493 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5494 <listitem>
5495 <para>
5496 <indexterm role="option">
5497 <primary><option>-L</option></primary>
5498 </indexterm>
5499 <indexterm role="concept">
5500 <primary>syslog</primary>
5501 <secondary>process name; set with flag</secondary>
5502 </indexterm>
5503 This option is equivalent to setting <option>syslog_processname</option> in the config
5504 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5505 Its use is restricted to administrators.  The configuration file has to be
5506 read and parsed, to determine access rights, before this is set and takes
5507 effect, so early configuration file errors will not honour this flag.
5508 </para>
5509 <para>
5510 The tag should not be longer than 32 characters.
5511 </para>
5512 </listitem></varlistentry>
5513 <varlistentry>
5514 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5515 <listitem>
5516 <para>
5517 <indexterm role="option">
5518 <primary><option>-M</option></primary>
5519 </indexterm>
5520 <indexterm role="concept">
5521 <primary>forcing delivery</primary>
5522 </indexterm>
5523 <indexterm role="concept">
5524 <primary>delivery</primary>
5525 <secondary>forcing attempt</secondary>
5526 </indexterm>
5527 <indexterm role="concept">
5528 <primary>frozen messages</primary>
5529 <secondary>forcing delivery</secondary>
5530 </indexterm>
5531 This option requests Exim to run a delivery attempt on each message in turn. If
5532 any of the messages are frozen, they are automatically thawed before the
5533 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5534 and <option>hold_domains</option> are ignored.
5535 </para>
5536 <para>
5537 Retry
5538 <indexterm role="concept">
5539 <primary>hints database</primary>
5540 <secondary>overriding retry hints</secondary>
5541 </indexterm>
5542 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5543 the normal retry time has not yet been reached. This option requires the caller
5544 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5545 which can be set false to relax this restriction (and also the same requirement
5546 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5547 </para>
5548 <para>
5549 The deliveries happen synchronously, that is, the original Exim process does
5550 not terminate until all the delivery attempts have finished. No output is
5551 produced unless there is a serious error. If you want to see what is happening,
5552 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5553 </para>
5554 </listitem></varlistentry>
5555 <varlistentry>
5556 <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>
5557 <listitem>
5558 <para>
5559 <indexterm role="option">
5560 <primary><option>-Mar</option></primary>
5561 </indexterm>
5562 <indexterm role="concept">
5563 <primary>message</primary>
5564 <secondary>adding recipients</secondary>
5565 </indexterm>
5566 <indexterm role="concept">
5567 <primary>recipient</primary>
5568 <secondary>adding</secondary>
5569 </indexterm>
5570 This option requests Exim to add the addresses to the list of recipients of the
5571 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5572 id, and the remaining ones must be email addresses. However, if the message is
5573 active (in the middle of a delivery attempt), it is not altered. This option
5574 can be used only by an admin user.
5575 </para>
5576 </listitem></varlistentry>
5577 <varlistentry>
5578 <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>
5579 <listitem>
5580 <para>
5581 <indexterm role="option">
5582 <primary><option>-MC</option></primary>
5583 </indexterm>
5584 <indexterm role="concept">
5585 <primary>SMTP</primary>
5586 <secondary>passed connection</secondary>
5587 </indexterm>
5588 <indexterm role="concept">
5589 <primary>SMTP</primary>
5590 <secondary>multiple deliveries</secondary>
5591 </indexterm>
5592 <indexterm role="concept">
5593 <primary>multiple SMTP deliveries</primary>
5594 </indexterm>
5595 This option is not intended for use by external callers. It is used internally
5596 by Exim to invoke another instance of itself to deliver a waiting message using
5597 an existing SMTP connection, which is passed as the standard input. Details are
5598 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5599 must be root or the Exim user in order to use it.
5600 </para>
5601 </listitem></varlistentry>
5602 <varlistentry>
5603 <term><option>-MCA</option></term>
5604 <listitem>
5605 <para>
5606 <indexterm role="option">
5607 <primary><option>-MCA</option></primary>
5608 </indexterm>
5609 This option is not intended for use by external callers. It is used internally
5610 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5611 connection to the remote host has been authenticated.
5612 </para>
5613 </listitem></varlistentry>
5614 <varlistentry>
5615 <term><option>-MCD</option></term>
5616 <listitem>
5617 <para>
5618 <indexterm role="option">
5619 <primary><option>-MCD</option></primary>
5620 </indexterm>
5621 This option is not intended for use by external callers. It is used internally
5622 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5623 remote host supports the ESMTP <filename>DSN</filename> extension.
5624 </para>
5625 </listitem></varlistentry>
5626 <varlistentry>
5627 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5628 <listitem>
5629 <para>
5630 <indexterm role="option">
5631 <primary><option>-MCG</option></primary>
5632 </indexterm>
5633 This option is not intended for use by external callers. It is used internally
5634 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5635 alternate queue is used, named by the following argument.
5636 </para>
5637 </listitem></varlistentry>
5638 <varlistentry>
5639 <term><option>-MCK</option></term>
5640 <listitem>
5641 <para>
5642 <indexterm role="option">
5643 <primary><option>-MCK</option></primary>
5644 </indexterm>
5645 This option is not intended for use by external callers. It is used internally
5646 by Exim in conjunction with the <option>-MC</option> option. It signifies that a
5647 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5648 </para>
5649 </listitem></varlistentry>
5650 <varlistentry>
5651 <term><option>-MCP</option></term>
5652 <listitem>
5653 <para>
5654 <indexterm role="option">
5655 <primary><option>-MCP</option></primary>
5656 </indexterm>
5657 This option is not intended for use by external callers. It is used internally
5658 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5659 which Exim is connected supports pipelining.
5660 </para>
5661 </listitem></varlistentry>
5662 <varlistentry>
5663 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5664 <listitem>
5665 <para>
5666 <indexterm role="option">
5667 <primary><option>-MCQ</option></primary>
5668 </indexterm>
5669 This option is not intended for use by external callers. It is used internally
5670 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5671 started by a queue runner. It passes on the process id of the queue runner,
5672 together with the file descriptor number of an open pipe. Closure of the pipe
5673 signals the final completion of the sequence of processes that are passing
5674 messages through the same SMTP connection.
5675 </para>
5676 </listitem></varlistentry>
5677 <varlistentry>
5678 <term><option>-MCS</option></term>
5679 <listitem>
5680 <para>
5681 <indexterm role="option">
5682 <primary><option>-MCS</option></primary>
5683 </indexterm>
5684 This option is not intended for use by external callers. It is used internally
5685 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5686 SMTP SIZE option should be used on messages delivered down the existing
5687 connection.
5688 </para>
5689 </listitem></varlistentry>
5690 <varlistentry>
5691 <term><option>-MCT</option></term>
5692 <listitem>
5693 <para>
5694 <indexterm role="option">
5695 <primary><option>-MCT</option></primary>
5696 </indexterm>
5697 This option is not intended for use by external callers. It is used internally
5698 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5699 host to which Exim is connected supports TLS encryption.
5700 </para>
5701 </listitem></varlistentry>
5702 <varlistentry>
5703 <term><option>-MCt</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;&nbsp;&lt;<emphasis>port</emphasis>&gt;&nbsp;&lt;<emphasis>cipher</emphasis>&gt;</term>
5704 <listitem>
5705 <para>
5706 <indexterm role="option">
5707 <primary><option>-MCt</option></primary>
5708 </indexterm>
5709 This option is not intended for use by external callers. It is used internally
5710 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5711 connection is being proxied by a parent process for handling TLS encryption.
5712 The arguments give the local address and port being proxied, and the TLS cipher.
5713 </para>
5714 </listitem></varlistentry>
5715 <varlistentry>
5716 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5717 <listitem>
5718 <para>
5719 <indexterm role="option">
5720 <primary><option>-Mc</option></primary>
5721 </indexterm>
5722 <indexterm role="concept">
5723 <primary>hints database</primary>
5724 <secondary>not overridden by <option>-Mc</option></secondary>
5725 </indexterm>
5726 <indexterm role="concept">
5727 <primary>delivery</primary>
5728 <secondary>manually started &ndash; not forced</secondary>
5729 </indexterm>
5730 This option requests Exim to run a delivery attempt on each message in turn,
5731 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5732 that are found. This option is not very useful to external callers. It is
5733 provided mainly for internal use by Exim when it needs to re-invoke itself in
5734 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5735 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5736 respects retry times and other options such as <option>hold_domains</option> that are
5737 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5738 If you want to run a specific delivery as if in a queue run, you should use
5739 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5740 and other deliveries is made in one or two places.
5741 </para>
5742 </listitem></varlistentry>
5743 <varlistentry>
5744 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5745 <listitem>
5746 <para>
5747 <indexterm role="option">
5748 <primary><option>-Mes</option></primary>
5749 </indexterm>
5750 <indexterm role="concept">
5751 <primary>message</primary>
5752 <secondary>changing sender</secondary>
5753 </indexterm>
5754 <indexterm role="concept">
5755 <primary>sender</primary>
5756 <secondary>changing</secondary>
5757 </indexterm>
5758 This option requests Exim to change the sender address in the message to the
5759 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5760 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5761 be a message id, and the second one an email address. However, if the message
5762 is active (in the middle of a delivery attempt), its status is not altered.
5763 This option can be used only by an admin user.
5764 </para>
5765 </listitem></varlistentry>
5766 <varlistentry>
5767 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5768 <listitem>
5769 <para>
5770 <indexterm role="option">
5771 <primary><option>-Mf</option></primary>
5772 </indexterm>
5773 <indexterm role="concept">
5774 <primary>freezing messages</primary>
5775 </indexterm>
5776 <indexterm role="concept">
5777 <primary>message</primary>
5778 <secondary>manually freezing</secondary>
5779 </indexterm>
5780 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5781 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5782 either manually or as a result of the <option>auto_thaw</option> configuration option.
5783 However, if any of the messages are active (in the middle of a delivery
5784 attempt), their status is not altered. This option can be used only by an admin
5785 user.
5786 </para>
5787 </listitem></varlistentry>
5788 <varlistentry>
5789 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5790 <listitem>
5791 <para>
5792 <indexterm role="option">
5793 <primary><option>-Mg</option></primary>
5794 </indexterm>
5795 <indexterm role="concept">
5796 <primary>giving up on messages</primary>
5797 </indexterm>
5798 <indexterm role="concept">
5799 <primary>message</primary>
5800 <secondary>abandoning delivery attempts</secondary>
5801 </indexterm>
5802 <indexterm role="concept">
5803 <primary>delivery</primary>
5804 <secondary>abandoning further attempts</secondary>
5805 </indexterm>
5806 This option requests Exim to give up trying to deliver the listed messages,
5807 including any that are frozen. However, if any of the messages are active,
5808 their status is not altered. For non-bounce messages, a delivery error message
5809 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5810 Bounce messages are just discarded. This option can be used only by an admin
5811 user.
5812 </para>
5813 </listitem></varlistentry>
5814 <varlistentry>
5815 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5816 <listitem>
5817 <para>
5818 <indexterm role="option">
5819 <primary><option>-Mmad</option></primary>
5820 </indexterm>
5821 <indexterm role="concept">
5822 <primary>delivery</primary>
5823 <secondary>cancelling all</secondary>
5824 </indexterm>
5825 This option requests Exim to mark all the recipient addresses in the messages
5826 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5827 message is active (in the middle of a delivery attempt), its status is not
5828 altered. This option can be used only by an admin user.
5829 </para>
5830 </listitem></varlistentry>
5831 <varlistentry>
5832 <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>
5833 <listitem>
5834 <para>
5835 <indexterm role="option">
5836 <primary><option>-Mmd</option></primary>
5837 </indexterm>
5838 <indexterm role="concept">
5839 <primary>delivery</primary>
5840 <secondary>cancelling by address</secondary>
5841 </indexterm>
5842 <indexterm role="concept">
5843 <primary>recipient</primary>
5844 <secondary>removing</secondary>
5845 </indexterm>
5846 <indexterm role="concept">
5847 <primary>removing recipients</primary>
5848 </indexterm>
5849 This option requests Exim to mark the given addresses as already delivered
5850 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5851 the remaining ones must be email addresses. These are matched to recipient
5852 addresses in the message in a case-sensitive manner. If the message is active
5853 (in the middle of a delivery attempt), its status is not altered. This option
5854 can be used only by an admin user.
5855 </para>
5856 </listitem></varlistentry>
5857 <varlistentry>
5858 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5859 <listitem>
5860 <para>
5861 <indexterm role="option">
5862 <primary><option>-Mrm</option></primary>
5863 </indexterm>
5864 <indexterm role="concept">
5865 <primary>removing messages</primary>
5866 </indexterm>
5867 <indexterm role="concept">
5868 <primary>abandoning mail</primary>
5869 </indexterm>
5870 <indexterm role="concept">
5871 <primary>message</primary>
5872 <secondary>manually discarding</secondary>
5873 </indexterm>
5874 This option requests Exim to remove the given messages from the queue. No
5875 bounce messages are sent; each message is simply forgotten. However, if any of
5876 the messages are active, their status is not altered. This option can be used
5877 only by an admin user or by the user who originally caused the message to be
5878 placed on the queue.
5879 </para>
5880 </listitem></varlistentry>
5881 <varlistentry>
5882 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5883 <listitem>
5884 <para>
5885 <indexterm role="option">
5886 <primary><option>-Mset</option></primary>
5887 </indexterm>
5888 <indexterm role="concept">
5889 <primary>testing</primary>
5890 <secondary>string expansion</secondary>
5891 </indexterm>
5892 <indexterm role="concept">
5893 <primary>expansion</primary>
5894 <secondary>testing</secondary>
5895 </indexterm>
5896 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5897 string expansions). Exim loads the given message from its spool before doing
5898 the test expansions, thus setting message-specific variables such as
5899 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5900 available. This feature is provided to make it easier to test expansions that
5901 make use of these variables. However, this option can be used only by an admin
5902 user. See also <option>-bem</option>.
5903 </para>
5904 </listitem></varlistentry>
5905 <varlistentry>
5906 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5907 <listitem>
5908 <para>
5909 <indexterm role="option">
5910 <primary><option>-Mt</option></primary>
5911 </indexterm>
5912 <indexterm role="concept">
5913 <primary>thawing messages</primary>
5914 </indexterm>
5915 <indexterm role="concept">
5916 <primary>unfreezing messages</primary>
5917 </indexterm>
5918 <indexterm role="concept">
5919 <primary>frozen messages</primary>
5920 <secondary>thawing</secondary>
5921 </indexterm>
5922 <indexterm role="concept">
5923 <primary>message</primary>
5924 <secondary>thawing frozen</secondary>
5925 </indexterm>
5926 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5927 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5928 messages are active, their status is not altered. This option can be used only
5929 by an admin user.
5930 </para>
5931 </listitem></varlistentry>
5932 <varlistentry>
5933 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5934 <listitem>
5935 <para>
5936 <indexterm role="option">
5937 <primary><option>-Mvb</option></primary>
5938 </indexterm>
5939 <indexterm role="concept">
5940 <primary>listing</primary>
5941 <secondary>message body</secondary>
5942 </indexterm>
5943 <indexterm role="concept">
5944 <primary>message</primary>
5945 <secondary>listing body of</secondary>
5946 </indexterm>
5947 This option causes the contents of the message body (-D) spool file to be
5948 written to the standard output. This option can be used only by an admin user.
5949 </para>
5950 </listitem></varlistentry>
5951 <varlistentry>
5952 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5953 <listitem>
5954 <para>
5955 <indexterm role="option">
5956 <primary><option>-Mvc</option></primary>
5957 </indexterm>
5958 <indexterm role="concept">
5959 <primary>message</primary>
5960 <secondary>listing in RFC 2822 format</secondary>
5961 </indexterm>
5962 <indexterm role="concept">
5963 <primary>listing</primary>
5964 <secondary>message in RFC 2822 format</secondary>
5965 </indexterm>
5966 This option causes a copy of the complete message (header lines plus body) to
5967 be written to the standard output in RFC 2822 format. This option can be used
5968 only by an admin user.
5969 </para>
5970 </listitem></varlistentry>
5971 <varlistentry>
5972 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5973 <listitem>
5974 <para>
5975 <indexterm role="option">
5976 <primary><option>-Mvh</option></primary>
5977 </indexterm>
5978 <indexterm role="concept">
5979 <primary>listing</primary>
5980 <secondary>message headers</secondary>
5981 </indexterm>
5982 <indexterm role="concept">
5983 <primary>header lines</primary>
5984 <secondary>listing</secondary>
5985 </indexterm>
5986 <indexterm role="concept">
5987 <primary>message</primary>
5988 <secondary>listing header lines</secondary>
5989 </indexterm>
5990 This option causes the contents of the message headers (-H) spool file to be
5991 written to the standard output. This option can be used only by an admin user.
5992 </para>
5993 </listitem></varlistentry>
5994 <varlistentry>
5995 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5996 <listitem>
5997 <para>
5998 <indexterm role="option">
5999 <primary><option>-Mvl</option></primary>
6000 </indexterm>
6001 <indexterm role="concept">
6002 <primary>listing</primary>
6003 <secondary>message log</secondary>
6004 </indexterm>
6005 <indexterm role="concept">
6006 <primary>message</primary>
6007 <secondary>listing message log</secondary>
6008 </indexterm>
6009 This option causes the contents of the message log spool file to be written to
6010 the standard output. This option can be used only by an admin user.
6011 </para>
6012 </listitem></varlistentry>
6013 <varlistentry>
6014 <term><option>-m</option></term>
6015 <listitem>
6016 <para>
6017 <indexterm role="option">
6018 <primary><option>-m</option></primary>
6019 </indexterm>
6020 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
6021 treats it that way too.
6022 </para>
6023 </listitem></varlistentry>
6024 <varlistentry>
6025 <term><option>-N</option></term>
6026 <listitem>
6027 <para>
6028 <indexterm role="option">
6029 <primary><option>-N</option></primary>
6030 </indexterm>
6031 <indexterm role="concept">
6032 <primary>debugging</primary>
6033 <secondary><option>-N</option> option</secondary>
6034 </indexterm>
6035 <indexterm role="concept">
6036 <primary>debugging</primary>
6037 <secondary>suppressing delivery</secondary>
6038 </indexterm>
6039 This is a debugging option that inhibits delivery of a message at the transport
6040 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6041 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6042 had successfully done so. However, it does not make any updates to the retry
6043 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6044 than <quote>=&gt;</quote>.
6045 </para>
6046 <para>
6047 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6048 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6049 words, an ordinary user can use it only when supplying an incoming message to
6050 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6051 address may be deferred because of a configuration problem on a transport, or a
6052 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6053 the message, and applies to any subsequent delivery attempts that may happen
6054 for that message.
6055 </para>
6056 </listitem></varlistentry>
6057 <varlistentry>
6058 <term><option>-n</option></term>
6059 <listitem>
6060 <para>
6061 <indexterm role="option">
6062 <primary><option>-n</option></primary>
6063 </indexterm>
6064 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6065 For normal modes of operation, it is ignored by Exim.
6066 When combined with <option>-bP</option> it makes the output more terse (suppresses
6067 option names, environment values and config pretty printing).
6068 </para>
6069 </listitem></varlistentry>
6070 <varlistentry>
6071 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6072 <listitem>
6073 <para>
6074 <indexterm role="option">
6075 <primary><option>-O</option></primary>
6076 </indexterm>
6077 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6078 Exim.
6079 </para>
6080 </listitem></varlistentry>
6081 <varlistentry>
6082 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6083 <listitem>
6084 <para>
6085 <indexterm role="option">
6086 <primary><option>-oA</option></primary>
6087 </indexterm>
6088 <indexterm role="concept">
6089 <primary>Sendmail compatibility</primary>
6090 <secondary><option>-oA</option> option</secondary>
6091 </indexterm>
6092 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6093 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6094 description above.
6095 </para>
6096 </listitem></varlistentry>
6097 <varlistentry>
6098 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6099 <listitem>
6100 <para>
6101 <indexterm role="option">
6102 <primary><option>-oB</option></primary>
6103 </indexterm>
6104 <indexterm role="concept">
6105 <primary>SMTP</primary>
6106 <secondary>passed connection</secondary>
6107 </indexterm>
6108 <indexterm role="concept">
6109 <primary>SMTP</primary>
6110 <secondary>multiple deliveries</secondary>
6111 </indexterm>
6112 <indexterm role="concept">
6113 <primary>multiple SMTP deliveries</primary>
6114 </indexterm>
6115 This is a debugging option which limits the maximum number of messages that can
6116 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6117 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6118 </para>
6119 </listitem></varlistentry>
6120 <varlistentry>
6121 <term><option>-odb</option></term>
6122 <listitem>
6123 <para>
6124 <indexterm role="option">
6125 <primary><option>-odb</option></primary>
6126 </indexterm>
6127 <indexterm role="concept">
6128 <primary>background delivery</primary>
6129 </indexterm>
6130 <indexterm role="concept">
6131 <primary>delivery</primary>
6132 <secondary>in the background</secondary>
6133 </indexterm>
6134 This option applies to all modes in which Exim accepts incoming messages,
6135 including the listening daemon. It requests <quote>background</quote> delivery of such
6136 messages, which means that the accepting process automatically starts a
6137 delivery process for each message received, but does not wait for the delivery
6138 processes to finish.
6139 </para>
6140 <para>
6141 When all the messages have been received, the reception process exits,
6142 leaving the delivery processes to finish in their own time. The standard output
6143 and error streams are closed at the start of each delivery process.
6144 This is the default action if none of the <option>-od</option> options are present.
6145 </para>
6146 <para>
6147 If one of the queueing options in the configuration file
6148 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6149 overrides it if <option>queue_only_override</option> is set true, which is the default
6150 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6151 </para>
6152 </listitem></varlistentry>
6153 <varlistentry>
6154 <term><option>-odf</option></term>
6155 <listitem>
6156 <para>
6157 <indexterm role="option">
6158 <primary><option>-odf</option></primary>
6159 </indexterm>
6160 <indexterm role="concept">
6161 <primary>foreground delivery</primary>
6162 </indexterm>
6163 <indexterm role="concept">
6164 <primary>delivery</primary>
6165 <secondary>in the foreground</secondary>
6166 </indexterm>
6167 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6168 accepted a locally-generated message. (For the daemon it is exactly the same as
6169 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6170 and Exim waits for it to complete before proceeding.
6171 </para>
6172 <para>
6173 The original Exim reception process does not finish until the delivery
6174 process for the final message has ended. The standard error stream is left open
6175 during deliveries.
6176 </para>
6177 <para>
6178 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6179 false and one of the queueing options in the configuration file is in effect.
6180 </para>
6181 <para>
6182 If there is a temporary delivery error during foreground delivery, the
6183 message is left on the queue for later delivery, and the original reception
6184 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6185 restricted configuration that never queues messages.
6186 </para>
6187 </listitem></varlistentry>
6188 <varlistentry>
6189 <term><option>-odi</option></term>
6190 <listitem>
6191 <para>
6192 <indexterm role="option">
6193 <primary><option>-odi</option></primary>
6194 </indexterm>
6195 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6196 Sendmail.
6197 </para>
6198 </listitem></varlistentry>
6199 <varlistentry>
6200 <term><option>-odq</option></term>
6201 <listitem>
6202 <para>
6203 <indexterm role="option">
6204 <primary><option>-odq</option></primary>
6205 </indexterm>
6206 <indexterm role="concept">
6207 <primary>non-immediate delivery</primary>
6208 </indexterm>
6209 <indexterm role="concept">
6210 <primary>delivery</primary>
6211 <secondary>suppressing immediate</secondary>
6212 </indexterm>
6213 <indexterm role="concept">
6214 <primary>queueing incoming messages</primary>
6215 </indexterm>
6216 This option applies to all modes in which Exim accepts incoming messages,
6217 including the listening daemon. It specifies that the accepting process should
6218 not automatically start a delivery process for each message received. Messages
6219 are placed on the queue, and remain there until a subsequent queue runner
6220 process encounters them. There are several configuration options (such as
6221 <option>queue_only</option>) that can be used to queue incoming messages under certain
6222 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6223 forces queueing.
6224 </para>
6225 </listitem></varlistentry>
6226 <varlistentry>
6227 <term><option>-odqs</option></term>
6228 <listitem>
6229 <para>
6230 <indexterm role="option">
6231 <primary><option>-odqs</option></primary>
6232 </indexterm>
6233 <indexterm role="concept">
6234 <primary>SMTP</primary>
6235 <secondary>delaying delivery</secondary>
6236 </indexterm>
6237 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6238 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6239 <option>queue_only_override</option> is false and one of the queueing options in the
6240 configuration file is in effect.
6241 </para>
6242 <para>
6243 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6244 message, in the background by default, but in the foreground if <option>-odi</option> is
6245 also present. The recipient addresses are routed, and local deliveries are done
6246 in the normal way. However, if any SMTP deliveries are required, they are not
6247 done at this time, so the message remains on the queue until a subsequent queue
6248 runner process encounters it. Because routing was done, Exim knows which
6249 messages are waiting for which hosts, and so a number of messages for the same
6250 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6251 configuration option has the same effect for specific domains. See also the
6252 <option>-qq</option> option.
6253 </para>
6254 </listitem></varlistentry>
6255 <varlistentry>
6256 <term><option>-oee</option></term>
6257 <listitem>
6258 <para>
6259 <indexterm role="option">
6260 <primary><option>-oee</option></primary>
6261 </indexterm>
6262 <indexterm role="concept">
6263 <primary>error</primary>
6264 <secondary>reporting</secondary>
6265 </indexterm>
6266 If an error is detected while a non-SMTP message is being received (for
6267 example, a malformed address), the error is reported to the sender in a mail
6268 message.
6269 </para>
6270 <para>
6271 <indexterm role="concept">
6272 <primary>return code</primary>
6273 <secondary>for <option>-oee</option></secondary>
6274 </indexterm>
6275 Provided
6276 this error message is successfully sent, the Exim receiving process
6277 exits with a return code of zero. If not, the return code is 2 if the problem
6278 is that the original message has no recipients, or 1 for any other error.
6279 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6280 </para>
6281 </listitem></varlistentry>
6282 <varlistentry>
6283 <term><option>-oem</option></term>
6284 <listitem>
6285 <para>
6286 <indexterm role="option">
6287 <primary><option>-oem</option></primary>
6288 </indexterm>
6289 <indexterm role="concept">
6290 <primary>error</primary>
6291 <secondary>reporting</secondary>
6292 </indexterm>
6293 <indexterm role="concept">
6294 <primary>return code</primary>
6295 <secondary>for <option>-oem</option></secondary>
6296 </indexterm>
6297 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6298 return code, whether or not the error message was successfully sent.
6299 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6300 </para>
6301 </listitem></varlistentry>
6302 <varlistentry>
6303 <term><option>-oep</option></term>
6304 <listitem>
6305 <para>
6306 <indexterm role="option">
6307 <primary><option>-oep</option></primary>
6308 </indexterm>
6309 <indexterm role="concept">
6310 <primary>error</primary>
6311 <secondary>reporting</secondary>
6312 </indexterm>
6313 If an error is detected while a non-SMTP message is being received, the
6314 error is reported by writing a message to the standard error file (stderr).
6315 <indexterm role="concept">
6316 <primary>return code</primary>
6317 <secondary>for <option>-oep</option></secondary>
6318 </indexterm>
6319 The return code is 1 for all errors.
6320 </para>
6321 </listitem></varlistentry>
6322 <varlistentry>
6323 <term><option>-oeq</option></term>
6324 <listitem>
6325 <para>
6326 <indexterm role="option">
6327 <primary><option>-oeq</option></primary>
6328 </indexterm>
6329 <indexterm role="concept">
6330 <primary>error</primary>
6331 <secondary>reporting</secondary>
6332 </indexterm>
6333 This option is supported for compatibility with Sendmail, but has the same
6334 effect as <option>-oep</option>.
6335 </para>
6336 </listitem></varlistentry>
6337 <varlistentry>
6338 <term><option>-oew</option></term>
6339 <listitem>
6340 <para>
6341 <indexterm role="option">
6342 <primary><option>-oew</option></primary>
6343 </indexterm>
6344 <indexterm role="concept">
6345 <primary>error</primary>
6346 <secondary>reporting</secondary>
6347 </indexterm>
6348 This option is supported for compatibility with Sendmail, but has the same
6349 effect as <option>-oem</option>.
6350 </para>
6351 </listitem></varlistentry>
6352 <varlistentry>
6353 <term><option>-oi</option></term>
6354 <listitem>
6355 <para>
6356 <indexterm role="option">
6357 <primary><option>-oi</option></primary>
6358 </indexterm>
6359 <indexterm role="concept">
6360 <primary>dot</primary>
6361 <secondary>in incoming non-SMTP message</secondary>
6362 </indexterm>
6363 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6364 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6365 single dot does terminate, though Exim does no special processing for other
6366 lines that start with a dot. This option is set by default if Exim is called as
6367 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6368 </para>
6369 </listitem></varlistentry>
6370 <varlistentry>
6371 <term><option>-oitrue</option></term>
6372 <listitem>
6373 <para>
6374 <indexterm role="option">
6375 <primary><option>-oitrue</option></primary>
6376 </indexterm>
6377 This option is treated as synonymous with <option>-oi</option>.
6378 </para>
6379 </listitem></varlistentry>
6380 <varlistentry>
6381 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6382 <listitem>
6383 <para>
6384 <indexterm role="option">
6385 <primary><option>-oMa</option></primary>
6386 </indexterm>
6387 <indexterm role="concept">
6388 <primary>sender</primary>
6389 <secondary>host address, specifying for local message</secondary>
6390 </indexterm>
6391 A number of options starting with <option>-oM</option> can be used to set values associated
6392 with remote hosts on locally-submitted messages (that is, messages not received
6393 over TCP/IP). These options can be used by any caller in conjunction with the
6394 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6395 other circumstances, they are ignored unless the caller is trusted.
6396 </para>
6397 <para>
6398 The <option>-oMa</option> option sets the sender host address. This may include a port
6399 number at the end, after a full stop (period). For example:
6400 </para>
6401 <literallayout class="monospaced">
6402 exim -bs -oMa 10.9.8.7.1234
6403 </literallayout>
6404 <para>
6405 An alternative syntax is to enclose the IP address in square brackets,
6406 followed by a colon and the port number:
6407 </para>
6408 <literallayout class="monospaced">
6409 exim -bs -oMa [10.9.8.7]:1234
6410 </literallayout>
6411 <para>
6412 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6413 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6414 are present on the command line, the sender host IP address is taken from
6415 whichever one is last.
6416 </para>
6417 </listitem></varlistentry>
6418 <varlistentry>
6419 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6420 <listitem>
6421 <para>
6422 <indexterm role="option">
6423 <primary><option>-oMaa</option></primary>
6424 </indexterm>
6425 <indexterm role="concept">
6426 <primary>authentication</primary>
6427 <secondary>name, specifying for local message</secondary>
6428 </indexterm>
6429 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6430 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6431 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6432 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6433 authenticated SMTP session without actually using the SMTP AUTH command.
6434 </para>
6435 </listitem></varlistentry>
6436 <varlistentry>
6437 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6438 <listitem>
6439 <para>
6440 <indexterm role="option">
6441 <primary><option>-oMai</option></primary>
6442 </indexterm>
6443 <indexterm role="concept">
6444 <primary>authentication</primary>
6445 <secondary>id, specifying for local message</secondary>
6446 </indexterm>
6447 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6448 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6449 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6450 where there is no default) for messages from local sources. See chapter
6451 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6452 </para>
6453 </listitem></varlistentry>
6454 <varlistentry>
6455 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6456 <listitem>
6457 <para>
6458 <indexterm role="option">
6459 <primary><option>-oMas</option></primary>
6460 </indexterm>
6461 <indexterm role="concept">
6462 <primary>authentication</primary>
6463 <secondary>sender, specifying for local message</secondary>
6464 </indexterm>
6465 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6466 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6467 overrides the sender address that is created from the caller&#x2019;s login id for
6468 messages from local sources, except when <option>-bh</option> is used, when there is no
6469 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6470 specified on a MAIL command overrides this value. See chapter
6471 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6472 </para>
6473 </listitem></varlistentry>
6474 <varlistentry>
6475 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6476 <listitem>
6477 <para>
6478 <indexterm role="option">
6479 <primary><option>-oMi</option></primary>
6480 </indexterm>
6481 <indexterm role="concept">
6482 <primary>interface</primary>
6483 <secondary>address, specifying for local message</secondary>
6484 </indexterm>
6485 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6486 option sets the IP interface address value. A port number may be included,
6487 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6488 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6489 </para>
6490 </listitem></varlistentry>
6491 <varlistentry>
6492 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6493 <listitem>
6494 <para>
6495 <indexterm role="option">
6496 <primary><option>-oMm</option></primary>
6497 </indexterm>
6498 <indexterm role="concept">
6499 <primary>message reference</primary>
6500 <secondary>message reference, specifying for local message</secondary>
6501 </indexterm>
6502 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6503 option sets the message reference, e.g. message-id, and is logged during
6504 delivery. This is useful when some kind of audit trail is required to tie
6505 messages together. The format of the message reference is checked and will
6506 abort if the format is invalid. The option will only be accepted if exim is
6507 running in trusted mode, not as any regular user.
6508 </para>
6509 <para>
6510 The best example of a message reference is when Exim sends a bounce message.
6511 The message reference is the message-id of the original message for which Exim
6512 is sending the bounce.
6513 </para>
6514 </listitem></varlistentry>
6515 <varlistentry>
6516 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6517 <listitem>
6518 <para>
6519 <indexterm role="option">
6520 <primary><option>-oMr</option></primary>
6521 </indexterm>
6522 <indexterm role="concept">
6523 <primary>protocol, specifying for local message</primary>
6524 </indexterm>
6525 <indexterm role="variable">
6526 <primary><varname>$received_protocol</varname></primary>
6527 </indexterm>
6528 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6529 option sets the received protocol value that is stored in
6530 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6531 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6532 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6533 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6534 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6535 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6536 </para>
6537 </listitem></varlistentry>
6538 <varlistentry>
6539 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6540 <listitem>
6541 <para>
6542 <indexterm role="option">
6543 <primary><option>-oMs</option></primary>
6544 </indexterm>
6545 <indexterm role="concept">
6546 <primary>sender</primary>
6547 <secondary>host name, specifying for local message</secondary>
6548 </indexterm>
6549 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6550 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6551 present, Exim does not attempt to look up a host name from an IP address; it
6552 uses the name it is given.
6553 </para>
6554 </listitem></varlistentry>
6555 <varlistentry>
6556 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6557 <listitem>
6558 <para>
6559 <indexterm role="option">
6560 <primary><option>-oMt</option></primary>
6561 </indexterm>
6562 <indexterm role="concept">
6563 <primary>sender</primary>
6564 <secondary>ident string, specifying for local message</secondary>
6565 </indexterm>
6566 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6567 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6568 local callers is the login id of the calling process, except when <option>-bh</option> is
6569 used, when there is no default.
6570 </para>
6571 </listitem></varlistentry>
6572 <varlistentry>
6573 <term><option>-om</option></term>
6574 <listitem>
6575 <para>
6576 <indexterm role="option">
6577 <primary><option>-om</option></primary>
6578 </indexterm>
6579 <indexterm role="concept">
6580 <primary>Sendmail compatibility</primary>
6581 <secondary><option>-om</option> option ignored</secondary>
6582 </indexterm>
6583 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6584 message should receive a copy of the message if the sender appears in an alias
6585 expansion. Exim always does this, so the option does nothing.
6586 </para>
6587 </listitem></varlistentry>
6588 <varlistentry>
6589 <term><option>-oo</option></term>
6590 <listitem>
6591 <para>
6592 <indexterm role="option">
6593 <primary><option>-oo</option></primary>
6594 </indexterm>
6595 <indexterm role="concept">
6596 <primary>Sendmail compatibility</primary>
6597 <secondary><option>-oo</option> option ignored</secondary>
6598 </indexterm>
6599 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6600 whatever that means.
6601 </para>
6602 </listitem></varlistentry>
6603 <varlistentry>
6604 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6605 <listitem>
6606 <para>
6607 <indexterm role="option">
6608 <primary><option>-oP</option></primary>
6609 </indexterm>
6610 <indexterm role="concept">
6611 <primary>pid (process id)</primary>
6612 <secondary>of daemon</secondary>
6613 </indexterm>
6614 <indexterm role="concept">
6615 <primary>daemon</primary>
6616 <secondary>process id (pid)</secondary>
6617 </indexterm>
6618 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6619 value. The option specifies the file to which the process id of the daemon is
6620 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6621 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6622 because in those cases, the normal pid file is not used.
6623 </para>
6624 </listitem></varlistentry>
6625 <varlistentry>
6626 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6627 <listitem>
6628 <para>
6629 <indexterm role="option">
6630 <primary><option>-or</option></primary>
6631 </indexterm>
6632 <indexterm role="concept">
6633 <primary>timeout</primary>
6634 <secondary>for non-SMTP input</secondary>
6635 </indexterm>
6636 This option sets a timeout value for incoming non-SMTP messages. If it is not
6637 set, Exim will wait forever for the standard input. The value can also be set
6638 by the <option>receive_timeout</option> option. The format used for specifying times is
6639 described in section <xref linkend="SECTtimeformat"/>.
6640 </para>
6641 </listitem></varlistentry>
6642 <varlistentry>
6643 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6644 <listitem>
6645 <para>
6646 <indexterm role="option">
6647 <primary><option>-os</option></primary>
6648 </indexterm>
6649 <indexterm role="concept">
6650 <primary>timeout</primary>
6651 <secondary>for SMTP input</secondary>
6652 </indexterm>
6653 <indexterm role="concept">
6654 <primary>SMTP</primary>
6655 <secondary>input timeout</secondary>
6656 </indexterm>
6657 This option sets a timeout value for incoming SMTP messages. The timeout
6658 applies to each SMTP command and block of data. The value can also be set by
6659 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6660 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6661 </para>
6662 </listitem></varlistentry>
6663 <varlistentry>
6664 <term><option>-ov</option></term>
6665 <listitem>
6666 <para>
6667 <indexterm role="option">
6668 <primary><option>-ov</option></primary>
6669 </indexterm>
6670 This option has exactly the same effect as <option>-v</option>.
6671 </para>
6672 </listitem></varlistentry>
6673 <varlistentry>
6674 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6675 <listitem>
6676 <para>
6677 <indexterm role="option">
6678 <primary><option>-oX</option></primary>
6679 </indexterm>
6680 <indexterm role="concept">
6681 <primary>TCP/IP</primary>
6682 <secondary>setting listening ports</secondary>
6683 </indexterm>
6684 <indexterm role="concept">
6685 <primary>TCP/IP</primary>
6686 <secondary>setting listening interfaces</secondary>
6687 </indexterm>
6688 <indexterm role="concept">
6689 <primary>port</primary>
6690 <secondary>receiving TCP/IP</secondary>
6691 </indexterm>
6692 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6693 is also given. It controls which ports and interfaces the daemon uses. Details
6694 of the syntax, and how it interacts with configuration file options, are given
6695 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6696 file is written unless <option>-oP</option> is also present to specify a pid file name.
6697 </para>
6698 </listitem></varlistentry>
6699 <varlistentry>
6700 <term><option>-pd</option></term>
6701 <listitem>
6702 <para>
6703 <indexterm role="option">
6704 <primary><option>-pd</option></primary>
6705 </indexterm>
6706 <indexterm role="concept">
6707 <primary>Perl</primary>
6708 <secondary>starting the interpreter</secondary>
6709 </indexterm>
6710 This option applies when an embedded Perl interpreter is linked with Exim (see
6711 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6712 option, forcing the starting of the interpreter to be delayed until it is
6713 needed.
6714 </para>
6715 </listitem></varlistentry>
6716 <varlistentry>
6717 <term><option>-ps</option></term>
6718 <listitem>
6719 <para>
6720 <indexterm role="option">
6721 <primary><option>-ps</option></primary>
6722 </indexterm>
6723 <indexterm role="concept">
6724 <primary>Perl</primary>
6725 <secondary>starting the interpreter</secondary>
6726 </indexterm>
6727 This option applies when an embedded Perl interpreter is linked with Exim (see
6728 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6729 option, forcing the starting of the interpreter to occur as soon as Exim is
6730 started.
6731 </para>
6732 </listitem></varlistentry>
6733 <varlistentry>
6734 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6735 <listitem>
6736 <para>
6737 <indexterm role="option">
6738 <primary><option>-p</option></primary>
6739 </indexterm>
6740 For compatibility with Sendmail, this option is equivalent to
6741 </para>
6742 <literallayout>
6743 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6744 </literallayout>
6745 <para>
6746 It sets the incoming protocol and host name (for trusted callers). The
6747 host name and its colon can be omitted when only the protocol is to be set.
6748 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6749 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6750 or <literal>s</literal> using this option (but that does not seem a real limitation).
6751 Repeated use of this option is not supported.
6752 </para>
6753 </listitem></varlistentry>
6754 <varlistentry>
6755 <term><option>-q</option></term>
6756 <listitem>
6757 <para>
6758 <indexterm role="option">
6759 <primary><option>-q</option></primary>
6760 </indexterm>
6761 <indexterm role="concept">
6762 <primary>queue runner</primary>
6763 <secondary>starting manually</secondary>
6764 </indexterm>
6765 This option is normally restricted to admin users. However, there is a
6766 configuration option called <option>prod_requires_admin</option> which can be set false to
6767 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6768 and <option>-S</option> options).
6769 </para>
6770 <para>
6771 <indexterm role="concept">
6772 <primary>queue runner</primary>
6773 <secondary>description of operation</secondary>
6774 </indexterm>
6775 If other commandline options do not specify an action,
6776 the <option>-q</option> option starts one queue runner process. This scans the queue of
6777 waiting messages, and runs a delivery process for each one in turn. It waits
6778 for each delivery process to finish before starting the next one. A delivery
6779 process may not actually do any deliveries if the retry times for the addresses
6780 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6781 </para>
6782 <para>
6783 If
6784 <indexterm role="concept">
6785 <primary>SMTP</primary>
6786 <secondary>passed connection</secondary>
6787 </indexterm>
6788 <indexterm role="concept">
6789 <primary>SMTP</primary>
6790 <secondary>multiple deliveries</secondary>
6791 </indexterm>
6792 <indexterm role="concept">
6793 <primary>multiple SMTP deliveries</primary>
6794 </indexterm>
6795 the delivery process spawns other processes to deliver other messages down
6796 passed SMTP connections, the queue runner waits for these to finish before
6797 proceeding.
6798 </para>
6799 <para>
6800 When all the queued messages have been considered, the original queue runner
6801 process terminates. In other words, a single pass is made over the waiting
6802 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6803 this to be repeated periodically.
6804 </para>
6805 <para>
6806 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6807 random, but it is likely to be different each time, which is all that matters.
6808 If one particular message screws up a remote MTA, other messages to the same
6809 MTA have a chance of getting through if they get tried first.
6810 </para>
6811 <para>
6812 It is possible to cause the messages to be processed in lexical message id
6813 order, which is essentially the order in which they arrived, by setting the
6814 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6815 </para>
6816 </listitem></varlistentry>
6817 <varlistentry>
6818 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6819 <listitem>
6820 <para>
6821 The <option>-q</option> option may be followed by one or more flag letters that change its
6822 behaviour. They are all optional, but if more than one is present, they must
6823 appear in the correct order. Each flag is described in a separate item below.
6824 </para>
6825 </listitem></varlistentry>
6826 <varlistentry>
6827 <term><option>-qq...</option></term>
6828 <listitem>
6829 <para>
6830 <indexterm role="option">
6831 <primary><option>-qq</option></primary>
6832 </indexterm>
6833 <indexterm role="concept">
6834 <primary>queue</primary>
6835 <secondary>double scanning</secondary>
6836 </indexterm>
6837 <indexterm role="concept">
6838 <primary>queue</primary>
6839 <secondary>routing</secondary>
6840 </indexterm>
6841 <indexterm role="concept">
6842 <primary>routing</primary>
6843 <secondary>whole queue before delivery</secondary>
6844 </indexterm>
6845 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6846 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6847 every domain. Addresses are routed, local deliveries happen, but no remote
6848 transports are run.
6849 </para>
6850 <para>
6851 <indexterm role="concept">
6852 <primary>hints database</primary>
6853 <secondary>remembering routing</secondary>
6854 </indexterm>
6855 The hints database that remembers which messages are waiting for specific hosts
6856 is updated, as if delivery to those hosts had been deferred. After this is
6857 complete, a second, normal queue scan happens, with routing and delivery taking
6858 place as normal. Messages that are routed to the same host should mostly be
6859 delivered down a single SMTP
6860 <indexterm role="concept">
6861 <primary>SMTP</primary>
6862 <secondary>passed connection</secondary>
6863 </indexterm>
6864 <indexterm role="concept">
6865 <primary>SMTP</primary>
6866 <secondary>multiple deliveries</secondary>
6867 </indexterm>
6868 <indexterm role="concept">
6869 <primary>multiple SMTP deliveries</primary>
6870 </indexterm>
6871 connection because of the hints that were set up during the first queue scan.
6872 This option may be useful for hosts that are connected to the Internet
6873 intermittently.
6874 </para>
6875 </listitem></varlistentry>
6876 <varlistentry>
6877 <term><option>-q[q]i...</option></term>
6878 <listitem>
6879 <para>
6880 <indexterm role="option">
6881 <primary><option>-qi</option></primary>
6882 </indexterm>
6883 <indexterm role="concept">
6884 <primary>queue</primary>
6885 <secondary>initial delivery</secondary>
6886 </indexterm>
6887 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6888 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6889 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6890 <option>-odq</option> and want a queue runner just to process the new messages.
6891 </para>
6892 </listitem></varlistentry>
6893 <varlistentry>
6894 <term><option>-q[q][i]f...</option></term>
6895 <listitem>
6896 <para>
6897 <indexterm role="option">
6898 <primary><option>-qf</option></primary>
6899 </indexterm>
6900 <indexterm role="concept">
6901 <primary>queue</primary>
6902 <secondary>forcing delivery</secondary>
6903 </indexterm>
6904 <indexterm role="concept">
6905 <primary>delivery</primary>
6906 <secondary>forcing in queue run</secondary>
6907 </indexterm>
6908 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6909 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6910 their retry times are tried.
6911 </para>
6912 </listitem></varlistentry>
6913 <varlistentry>
6914 <term><option>-q[q][i]ff...</option></term>
6915 <listitem>
6916 <para>
6917 <indexterm role="option">
6918 <primary><option>-qff</option></primary>
6919 </indexterm>
6920 <indexterm role="concept">
6921 <primary>frozen messages</primary>
6922 <secondary>forcing delivery</secondary>
6923 </indexterm>
6924 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6925 frozen or not.
6926 </para>
6927 </listitem></varlistentry>
6928 <varlistentry>
6929 <term><option>-q[q][i][f[f]]l</option></term>
6930 <listitem>
6931 <para>
6932 <indexterm role="option">
6933 <primary><option>-ql</option></primary>
6934 </indexterm>
6935 <indexterm role="concept">
6936 <primary>queue</primary>
6937 <secondary>local deliveries only</secondary>
6938 </indexterm>
6939 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6940 be done. If a message requires any remote deliveries, it remains on the queue
6941 for later delivery.
6942 </para>
6943 </listitem></varlistentry>
6944 <varlistentry>
6945 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
6946 <listitem>
6947 <para>
6948 <indexterm role="option">
6949 <primary><option>-qG</option></primary>
6950 </indexterm>
6951 <indexterm role="concept">
6952 <primary>queue</primary>
6953 <secondary>named</secondary>
6954 </indexterm>
6955 <indexterm role="concept">
6956 <primary>named queues</primary>
6957 </indexterm>
6958 <indexterm role="concept">
6959 <primary>queue</primary>
6960 <secondary>delivering specific messages</secondary>
6961 </indexterm>
6962 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
6963 queue with the given name rather than the default queue.
6964 The name should not contain a <emphasis>/</emphasis> character.
6965 For a periodic queue run (see below)
6966 append to the name a slash and a time value.
6967 </para>
6968 <para>
6969 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
6970 will specify a queue to operate on.
6971 For example:
6972 </para>
6973 <literallayout class="monospaced">
6974 exim -bp -qGquarantine
6975 mailq -qGquarantine
6976 exim -qGoffpeak -Rf @special.domain.example
6977 </literallayout>
6978 </listitem></varlistentry>
6979 <varlistentry>
6980 <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>
6981 <listitem>
6982 <para>
6983 When scanning the queue, Exim can be made to skip over messages whose ids are
6984 lexically less than a given value by following the <option>-q</option> option with a
6985 starting message id. For example:
6986 </para>
6987 <literallayout class="monospaced">
6988 exim -q 0t5C6f-0000c8-00
6989 </literallayout>
6990 <para>
6991 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6992 second message id is given, messages whose ids are lexically greater than it
6993 are also skipped. If the same id is given twice, for example,
6994 </para>
6995 <literallayout class="monospaced">
6996 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6997 </literallayout>
6998 <para>
6999 just one delivery process is started, for that message. This differs from
7000 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7001 that it counts as a delivery from a queue run. Note that the selection
7002 mechanism does not affect the order in which the messages are scanned. There
7003 are also other ways of selecting specific sets of messages for delivery in a
7004 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7005 </para>
7006 </listitem></varlistentry>
7007 <varlistentry>
7008 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7009 <listitem>
7010 <para>
7011 <indexterm role="concept">
7012 <primary>queue runner</primary>
7013 <secondary>starting periodically</secondary>
7014 </indexterm>
7015 <indexterm role="concept">
7016 <primary>periodic queue running</primary>
7017 </indexterm>
7018 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7019 starting a queue runner process at intervals specified by the given time value
7020 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7021 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7022 single daemon process handles both functions. A common way of starting up a
7023 combined daemon at system boot time is to use a command such as
7024 </para>
7025 <literallayout class="monospaced">
7026 /usr/exim/bin/exim -bd -q30m
7027 </literallayout>
7028 <para>
7029 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7030 process every 30 minutes.
7031 </para>
7032 <para>
7033 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7034 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7035 </para>
7036 </listitem></varlistentry>
7037 <varlistentry>
7038 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7039 <listitem>
7040 <para>
7041 <indexterm role="option">
7042 <primary><option>-qR</option></primary>
7043 </indexterm>
7044 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7045 compatibility.
7046 </para>
7047 </listitem></varlistentry>
7048 <varlistentry>
7049 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7050 <listitem>
7051 <para>
7052 <indexterm role="option">
7053 <primary><option>-qS</option></primary>
7054 </indexterm>
7055 This option is synonymous with <option>-S</option>.
7056 </para>
7057 </listitem></varlistentry>
7058 <varlistentry>
7059 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7060 <listitem>
7061 <para>
7062 <indexterm role="option">
7063 <primary><option>-R</option></primary>
7064 </indexterm>
7065 <indexterm role="concept">
7066 <primary>queue runner</primary>
7067 <secondary>for specific recipients</secondary>
7068 </indexterm>
7069 <indexterm role="concept">
7070 <primary>delivery</primary>
7071 <secondary>to given domain</secondary>
7072 </indexterm>
7073 <indexterm role="concept">
7074 <primary>domain</primary>
7075 <secondary>delivery to</secondary>
7076 </indexterm>
7077 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7078 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7079 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7080 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7081 </para>
7082 <para>
7083 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7084 perform a single queue run, except that, when scanning the messages on the
7085 queue, Exim processes only those that have at least one undelivered recipient
7086 address containing the given string, which is checked in a case-independent
7087 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7088 regular expression; otherwise it is a literal string.
7089 </para>
7090 <para>
7091 If you want to do periodic queue runs for messages with specific recipients,
7092 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7093 </para>
7094 <literallayout class="monospaced">
7095 exim -q25m -R @special.domain.example
7096 </literallayout>
7097 <para>
7098 This example does a queue run for messages with recipients in the given domain
7099 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7100 applied to each queue run.
7101 </para>
7102 <para>
7103 Once a message is selected for delivery by this mechanism, all its addresses
7104 are processed. For the first selected message, Exim overrides any retry
7105 information and forces a delivery attempt for each undelivered address. This
7106 means that if delivery of any address in the first message is successful, any
7107 existing retry information is deleted, and so delivery attempts for that
7108 address in subsequently selected messages (which are processed without forcing)
7109 will run. However, if delivery of any address does not succeed, the retry
7110 information is updated, and in subsequently selected messages, the failing
7111 address will be skipped.
7112 </para>
7113 <para>
7114 <indexterm role="concept">
7115 <primary>frozen messages</primary>
7116 <secondary>forcing delivery</secondary>
7117 </indexterm>
7118 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7119 all selected messages, not just the first; frozen messages are included when
7120 <emphasis>ff</emphasis> is present.
7121 </para>
7122 <para>
7123 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7124 to a given domain after a host has been down for some time. When the SMTP
7125 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7126 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7127 an arbitrary command instead.
7128 </para>
7129 </listitem></varlistentry>
7130 <varlistentry>
7131 <term><option>-r</option></term>
7132 <listitem>
7133 <para>
7134 <indexterm role="option">
7135 <primary><option>-r</option></primary>
7136 </indexterm>
7137 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7138 </para>
7139 </listitem></varlistentry>
7140 <varlistentry>
7141 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7142 <listitem>
7143 <para>
7144 <indexterm role="option">
7145 <primary><option>-S</option></primary>
7146 </indexterm>
7147 <indexterm role="concept">
7148 <primary>delivery</primary>
7149 <secondary>from given sender</secondary>
7150 </indexterm>
7151 <indexterm role="concept">
7152 <primary>queue runner</primary>
7153 <secondary>for specific senders</secondary>
7154 </indexterm>
7155 This option acts like <option>-R</option> except that it checks the string against each
7156 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7157 conditions must be met for a message to be selected. If either of the options
7158 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7159 </para>
7160 </listitem></varlistentry>
7161 <varlistentry>
7162 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7163 <listitem>
7164 <para>
7165 <indexterm role="option">
7166 <primary><option>-Tqt</option></primary>
7167 </indexterm>
7168 This is an option that is exclusively for use by the Exim testing suite. It is not
7169 recognized when Exim is run normally. It allows for the setting up of explicit
7170 <quote>queue times</quote> so that various warning/retry features can be tested.
7171 </para>
7172 </listitem></varlistentry>
7173 <varlistentry>
7174 <term><option>-t</option></term>
7175 <listitem>
7176 <para>
7177 <indexterm role="option">
7178 <primary><option>-t</option></primary>
7179 </indexterm>
7180 <indexterm role="concept">
7181 <primary>recipient</primary>
7182 <secondary>extracting from header lines</secondary>
7183 </indexterm>
7184 <indexterm role="concept">
7185 <primary><emphasis>Bcc:</emphasis> header line</primary>
7186 </indexterm>
7187 <indexterm role="concept">
7188 <primary><emphasis>Cc:</emphasis> header line</primary>
7189 </indexterm>
7190 <indexterm role="concept">
7191 <primary><emphasis>To:</emphasis> header line</primary>
7192 </indexterm>
7193 When Exim is receiving a locally-generated, non-SMTP message on its standard
7194 input, the <option>-t</option> option causes the recipients of the message to be obtained
7195 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7196 from the command arguments. The addresses are extracted before any rewriting
7197 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7198 </para>
7199 <para>
7200 <indexterm role="concept">
7201 <primary>Sendmail compatibility</primary>
7202 <secondary><option>-t</option> option</secondary>
7203 </indexterm>
7204 If the command has any arguments, they specify addresses to which the message
7205 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7206 the recipients list obtained from the headers. This is compatible with Smail 3
7207 and in accordance with the documented behaviour of several versions of
7208 Sendmail, as described in man pages on a number of operating systems (e.g.
7209 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7210 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7211 Sendmail book documents it that way. Exim can be made to add argument addresses
7212 instead of subtracting them by setting the option
7213 <option>extract_addresses_remove_arguments</option> false.
7214 </para>
7215 <para>
7216 <indexterm role="concept">
7217 <primary><option>Resent-</option> header lines</primary>
7218 <secondary>with <option>-t</option></secondary>
7219 </indexterm>
7220 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7221 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7222 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7223 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7224 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7225 </para>
7226 <para>
7227 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7228 message is resent several times). The RFC also specifies that they should be
7229 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7230 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7231 nor indeed exactly what constitutes a <quote>set</quote>.
7232 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7233 are often added at the end of the header, and if a message is resent more than
7234 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7235 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7236 </para>
7237 </listitem></varlistentry>
7238 <varlistentry>
7239 <term><option>-ti</option></term>
7240 <listitem>
7241 <para>
7242 <indexterm role="option">
7243 <primary><option>-ti</option></primary>
7244 </indexterm>
7245 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7246 compatibility with Sendmail.
7247 </para>
7248 </listitem></varlistentry>
7249 <varlistentry>
7250 <term><option>-tls-on-connect</option></term>
7251 <listitem>
7252 <para>
7253 <indexterm role="option">
7254 <primary><option>-tls-on-connect</option></primary>
7255 </indexterm>
7256 <indexterm role="concept">
7257 <primary>TLS</primary>
7258 <secondary>use without STARTTLS</secondary>
7259 </indexterm>
7260 <indexterm role="concept">
7261 <primary>TLS</primary>
7262 <secondary>automatic start</secondary>
7263 </indexterm>
7264 This option is available when Exim is compiled with TLS support. It forces all
7265 incoming SMTP connections to behave as if the incoming port is listed in the
7266 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7267 <xref linkend="CHAPTLS"/> for further details.
7268 </para>
7269 </listitem></varlistentry>
7270 <varlistentry>
7271 <term><option>-U</option></term>
7272 <listitem>
7273 <para>
7274 <indexterm role="option">
7275 <primary><option>-U</option></primary>
7276 </indexterm>
7277 <indexterm role="concept">
7278 <primary>Sendmail compatibility</primary>
7279 <secondary><option>-U</option> option ignored</secondary>
7280 </indexterm>
7281 Sendmail uses this option for <quote>initial message submission</quote>, and its
7282 documentation states that in future releases, it may complain about
7283 syntactically invalid messages rather than fixing them when this flag is not
7284 set. Exim ignores this option.
7285 </para>
7286 </listitem></varlistentry>
7287 <varlistentry>
7288 <term><option>-v</option></term>
7289 <listitem>
7290 <para>
7291 <indexterm role="option">
7292 <primary><option>-v</option></primary>
7293 </indexterm>
7294 This option causes Exim to write information to the standard error stream,
7295 describing what it is doing. In particular, it shows the log lines for
7296 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7297 dialogue is shown. Some of the log lines shown may not actually be written to
7298 the log if the setting of <option>log_selector</option> discards them. Any relevant
7299 selectors are shown with each log line. If none are shown, the logging is
7300 unconditional.
7301 </para>
7302 </listitem></varlistentry>
7303 <varlistentry>
7304 <term><option>-x</option></term>
7305 <listitem>
7306 <para>
7307 <indexterm role="option">
7308 <primary><option>-x</option></primary>
7309 </indexterm>
7310 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7311 National Language Support extended characters in the body of the mail item</quote>).
7312 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7313 this option.
7314 </para>
7315 </listitem></varlistentry>
7316 <varlistentry>
7317 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7318 <listitem>
7319 <para>
7320 <indexterm role="option">
7321 <primary><option>-X</option></primary>
7322 </indexterm>
7323 This option is interpreted by Sendmail to cause debug information to be sent
7324 to the named file.  It is ignored by Exim.
7325 </para>
7326 </listitem></varlistentry>
7327 <varlistentry>
7328 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7329 <listitem>
7330 <para>
7331 <indexterm role="option">
7332 <primary><option>-z</option></primary>
7333 </indexterm>
7334 This option writes its argument to Exim&#x2019;s logfile.
7335 Use is restricted to administrators; the intent is for operational notes.
7336 Quotes should be used to maintain a multi-word item as a single argument,
7337 under most shells.
7338 </para>
7339 </listitem></varlistentry>
7340 </variablelist>
7341 <para>
7342 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7343 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7344 </para>
7345 <!-- === End of command line options === -->
7346 </section>
7347 </chapter>
7348
7349 <chapter id="CHAPconf">
7350 <title>The Exim run time configuration file</title>
7351 <titleabbrev>The runtime configuration file</titleabbrev>
7352 <para>
7353 <indexterm role="concept">
7354 <primary>run time configuration</primary>
7355 </indexterm>
7356 <indexterm role="concept">
7357 <primary>configuration file</primary>
7358 <secondary>general description</secondary>
7359 </indexterm>
7360 <indexterm role="concept">
7361 <primary>CONFIGURE_FILE</primary>
7362 </indexterm>
7363 <indexterm role="concept">
7364 <primary>configuration file</primary>
7365 <secondary>errors in</secondary>
7366 </indexterm>
7367 <indexterm role="concept">
7368 <primary>error</primary>
7369 <secondary>in configuration file</secondary>
7370 </indexterm>
7371 <indexterm role="concept">
7372 <primary>return code</primary>
7373 <secondary>for bad configuration</secondary>
7374 </indexterm>
7375 Exim uses a single run time configuration file that is read whenever an Exim
7376 binary is executed. Note that in normal operation, this happens frequently,
7377 because Exim is designed to operate in a distributed manner, without central
7378 control.
7379 </para>
7380 <para>
7381 If a syntax error is detected while reading the configuration file, Exim
7382 writes a message on the standard error, and exits with a non-zero return code.
7383 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7384 errors can be detected at this time. The values of any expanded options are
7385 not checked until the expansion happens, even when the expansion does not
7386 actually alter the string.
7387 </para>
7388 <para>
7389 The name of the configuration file is compiled into the binary for security
7390 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7391 most configurations, this specifies a single file. However, it is permitted to
7392 give a colon-separated list of file names, in which case Exim uses the first
7393 existing file in the list.
7394 </para>
7395 <para>
7396 <indexterm role="concept">
7397 <primary>EXIM_USER</primary>
7398 </indexterm>
7399 <indexterm role="concept">
7400 <primary>EXIM_GROUP</primary>
7401 </indexterm>
7402 <indexterm role="concept">
7403 <primary>CONFIGURE_OWNER</primary>
7404 </indexterm>
7405 <indexterm role="concept">
7406 <primary>CONFIGURE_GROUP</primary>
7407 </indexterm>
7408 <indexterm role="concept">
7409 <primary>configuration file</primary>
7410 <secondary>ownership</secondary>
7411 </indexterm>
7412 <indexterm role="concept">
7413 <primary>ownership</primary>
7414 <secondary>configuration file</secondary>
7415 </indexterm>
7416 The run time configuration file must be owned by root or by the user that is
7417 specified at compile time by the CONFIGURE_OWNER option (if set). The
7418 configuration file must not be world-writeable, or group-writeable unless its
7419 group is the root group or the one specified at compile time by the
7420 CONFIGURE_GROUP option.
7421 </para>
7422 <para>
7423 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7424 to root, anybody who is able to edit the run time configuration file has an
7425 easy way to run commands as root. If you specify a user or group in the
7426 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7427 who are members of that group will trivially be able to obtain root privileges.
7428 </para>
7429 <para>
7430 Up to Exim version 4.72, the run time configuration file was also permitted to
7431 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7432 since it offered a simple privilege escalation for any attacker who managed to
7433 compromise the Exim user account.
7434 </para>
7435 <para>
7436 A default configuration file, which will work correctly in simple situations,
7437 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7438 defines just one file name, the installation process copies the default
7439 configuration to a new file of that name if it did not previously exist. If
7440 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7441 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7442 configuration.
7443 </para>
7444 <section id="SECID40">
7445 <title>Using a different configuration file</title>
7446 <para>
7447 <indexterm role="concept">
7448 <primary>configuration file</primary>
7449 <secondary>alternate</secondary>
7450 </indexterm>
7451 A one-off alternate configuration can be specified by the <option>-C</option> command line
7452 option, which may specify a single file or a list of files. However, when
7453 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7454 unless the argument for <option>-C</option> is identical to the built-in value from
7455 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7456 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7457 is useful mainly for checking the syntax of configuration files before
7458 installing them. No owner or group checks are done on a configuration file
7459 specified by <option>-C</option>, if root privilege has been dropped.
7460 </para>
7461 <para>
7462 Even the Exim user is not trusted to specify an arbitrary configuration file
7463 with the <option>-C</option> option to be used with root privileges, unless that file is
7464 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7465 testing a configuration using <option>-C</option> right through message reception and
7466 delivery, even if the caller is root. The reception works, but by that time,
7467 Exim is running as the Exim user, so when it re-execs to regain privilege for
7468 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7469 can test reception and delivery using two separate commands (one to put a
7470 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7471 <option>-M</option>).
7472 </para>
7473 <para>
7474 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7475 prefix string with which any file named in a <option>-C</option> command line option must
7476 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7477 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7478 name can be used with <option>-C</option>.
7479 </para>
7480 <para>
7481 One-off changes to a configuration can be specified by the <option>-D</option> command line
7482 option, which defines and overrides values for macros used inside the
7483 configuration file. However, like <option>-C</option>, the use of this option by a
7484 non-privileged user causes Exim to discard its root privilege.
7485 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7486 completely disabled, and its use causes an immediate error exit.
7487 </para>
7488 <para>
7489 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7490 to declare certain macro names trusted, such that root privilege will not
7491 necessarily be discarded.
7492 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7493 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7494 values are acceptable, then Exim will not give up root privilege if the caller
7495 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7496 transition mechanism and is expected to be removed in the future.  Acceptable
7497 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7498 </para>
7499 <para>
7500 Some sites may wish to use the same Exim binary on different machines that
7501 share a file system, but to use different configuration files on each machine.
7502 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7503 looks for a file whose name is the configuration file name followed by a dot
7504 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7505 file does not exist, the standard name is tried. This processing occurs for
7506 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7507 </para>
7508 <para>
7509 In some esoteric situations different versions of Exim may be run under
7510 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7511 help with this. See the comments in <filename>src/EDITME</filename> for details.
7512 </para>
7513 </section>
7514 <section id="SECTconffilfor">
7515 <title>Configuration file format</title>
7516 <para>
7517 <indexterm role="concept">
7518 <primary>configuration file</primary>
7519 <secondary>format of</secondary>
7520 </indexterm>
7521 <indexterm role="concept">
7522 <primary>format</primary>
7523 <secondary>configuration file</secondary>
7524 </indexterm>
7525 Exim&#x2019;s configuration file is divided into a number of different parts. General
7526 option settings must always appear at the start of the file. The other parts
7527 are all optional, and may appear in any order. Each part other than the first
7528 is introduced by the word <quote>begin</quote> followed by at least one literal
7529 space, and the name of the part. The optional parts are:
7530 </para>
7531 <itemizedlist>
7532 <listitem>
7533 <para>
7534 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7535 <xref linkend="CHAPACL"/>).
7536 </para>
7537 </listitem>
7538 <listitem>
7539 <para>
7540 <indexterm role="concept">
7541 <primary>AUTH</primary>
7542 <secondary>configuration</secondary>
7543 </indexterm>
7544 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7545 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7546 </para>
7547 </listitem>
7548 <listitem>
7549 <para>
7550 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7551 addresses and determine how the message is to be delivered (see chapters
7552 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7553 </para>
7554 </listitem>
7555 <listitem>
7556 <para>
7557 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7558 define mechanisms for copying messages to destinations (see chapters
7559 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7560 </para>
7561 </listitem>
7562 <listitem>
7563 <para>
7564 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7565 If there is no retry section, or if it is empty (that is, no retry rules are
7566 defined), Exim will not retry deliveries. In this situation, temporary errors
7567 are treated the same as permanent errors. Retry rules are discussed in chapter
7568 <xref linkend="CHAPretry"/>.
7569 </para>
7570 </listitem>
7571 <listitem>
7572 <para>
7573 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7574 when new addresses are generated during delivery. Rewriting is discussed in
7575 chapter <xref linkend="CHAPrewrite"/>.
7576 </para>
7577 </listitem>
7578 <listitem>
7579 <para>
7580 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7581 want to use this feature, you must set
7582 </para>
7583 <literallayout class="monospaced">
7584 LOCAL_SCAN_HAS_OPTIONS=yes
7585 </literallayout>
7586 <para>
7587 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7588 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7589 </para>
7590 </listitem>
7591 </itemizedlist>
7592 <para>
7593 <indexterm role="concept">
7594 <primary>configuration file</primary>
7595 <secondary>leading white space in</secondary>
7596 </indexterm>
7597 <indexterm role="concept">
7598 <primary>configuration file</primary>
7599 <secondary>trailing white space in</secondary>
7600 </indexterm>
7601 <indexterm role="concept">
7602 <primary>white space</primary>
7603 <secondary>in configuration file</secondary>
7604 </indexterm>
7605 Leading and trailing white space in configuration lines is always ignored.
7606 </para>
7607 <para>
7608 Blank lines in the file, and lines starting with a # character (ignoring
7609 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7610 # character other than at the beginning of a line is not treated specially,
7611 and does not introduce a comment.
7612 </para>
7613 <para>
7614 Any non-comment line can be continued by ending it with a backslash. Note that
7615 the general rule for white space means that trailing white space after the
7616 backslash and leading white space at the start of continuation
7617 lines is ignored. Comment lines beginning with # (but not empty lines) may
7618 appear in the middle of a sequence of continuation lines.
7619 </para>
7620 <para>
7621 A convenient way to create a configuration file is to start from the
7622 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7623 change settings as required.
7624 </para>
7625 <para>
7626 The ACLs, retry rules, and rewriting rules have their own syntax which is
7627 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7628 respectively. The other parts of the configuration file have some syntactic
7629 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7630 onwards. Before that, the inclusion, macro, and conditional facilities are
7631 described.
7632 </para>
7633 </section>
7634 <section id="SECID41">
7635 <title>File inclusions in the configuration file</title>
7636 <para>
7637 <indexterm role="concept">
7638 <primary>inclusions in configuration file</primary>
7639 </indexterm>
7640 <indexterm role="concept">
7641 <primary>configuration file</primary>
7642 <secondary>including other files</secondary>
7643 </indexterm>
7644 <indexterm role="concept">
7645 <primary><literal>.include</literal> in configuration file</primary>
7646 </indexterm>
7647 <indexterm role="concept">
7648 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7649 </indexterm>
7650 You can include other files inside Exim&#x2019;s run time configuration file by
7651 using this syntax:
7652 </para>
7653 <literallayout>
7654 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7655 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7656 </literallayout>
7657 <para>
7658 on a line by itself. Double quotes round the file name are optional. If you use
7659 the first form, a configuration error occurs if the file does not exist; the
7660 second form does nothing for non-existent files.
7661 The first form allows a relative name. It is resolved relative to
7662 the directory of the including file. For the second form an absolute file
7663 name is required.
7664 </para>
7665 <para>
7666 Includes may be nested to any depth, but remember that Exim reads its
7667 configuration file often, so it is a good idea to keep them to a minimum.
7668 If you change the contents of an included file, you must HUP the daemon,
7669 because an included file is read only when the configuration itself is read.
7670 </para>
7671 <para>
7672 The processing of inclusions happens early, at a physical line level, so, like
7673 comment lines, an inclusion can be used in the middle of an option setting,
7674 for example:
7675 </para>
7676 <literallayout class="monospaced">
7677 hosts_lookup = a.b.c \
7678                .include /some/file
7679 </literallayout>
7680 <para>
7681 Include processing happens after macro processing (see below). Its effect is to
7682 process the lines of the included file as if they occurred inline where the
7683 inclusion appears.
7684 </para>
7685 </section>
7686 <section id="SECTmacrodefs">
7687 <title>Macros in the configuration file</title>
7688 <para>
7689 <indexterm role="concept">
7690 <primary>macro</primary>
7691 <secondary>description of</secondary>
7692 </indexterm>
7693 <indexterm role="concept">
7694 <primary>configuration file</primary>
7695 <secondary>macros</secondary>
7696 </indexterm>
7697 If a line in the main part of the configuration (that is, before the first
7698 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7699 definition, and must be of the form
7700 </para>
7701 <literallayout>
7702 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7703 </literallayout>
7704 <para>
7705 The name must consist of letters, digits, and underscores, and need not all be
7706 in upper case, though that is recommended. The rest of the line, including any
7707 continuations, is the replacement text, and has leading and trailing white
7708 space removed. Quotes are not removed. The replacement text can never end with
7709 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7710 </para>
7711 <para>
7712 Macros may also be defined between router, transport, authenticator, or ACL
7713 definitions. They may not, however, be defined within an individual driver or
7714 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7715 </para>
7716 </section>
7717 <section id="SECID42">
7718 <title>Macro substitution</title>
7719 <para>
7720 Once a macro is defined, all subsequent lines in the file (and any included
7721 files) are scanned for the macro name; if there are several macros, the line is
7722 scanned for each in turn, in the order in which the macros are defined. The
7723 replacement text is not re-scanned for the current macro, though it is scanned
7724 for subsequently defined macros. For this reason, a macro name may not contain
7725 the name of a previously defined macro as a substring. You could, for example,
7726 define
7727 </para>
7728 <literallayout>
7729 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7730 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7731 </literallayout>
7732 <para>
7733 but putting the definitions in the opposite order would provoke a configuration
7734 error. Macro expansion is applied to individual physical lines from the file,
7735 before checking for line continuation or file inclusion (see above). If a line
7736 consists solely of a macro name, and the expansion of the macro is empty, the
7737 line is ignored. A macro at the start of a line may turn the line into a
7738 comment line or a <literal>.include</literal> line.
7739 </para>
7740 </section>
7741 <section id="SECID43">
7742 <title>Redefining macros</title>
7743 <para>
7744 Once defined, the value of a macro can be redefined later in the configuration
7745 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7746 <emphasis>=</emphasis>. For example:
7747 </para>
7748 <literallayout class="monospaced">
7749 MAC =  initial value
7750 ...
7751 MAC == updated value
7752 </literallayout>
7753 <para>
7754 Redefinition does not alter the order in which the macros are applied to the
7755 subsequent lines of the configuration file. It is still the same order in which
7756 the macros were originally defined. All that changes is the macro&#x2019;s value.
7757 Redefinition makes it possible to accumulate values. For example:
7758 </para>
7759 <literallayout class="monospaced">
7760 MAC =  initial value
7761 ...
7762 MAC == MAC and something added
7763 </literallayout>
7764 <para>
7765 This can be helpful in situations where the configuration file is built
7766 from a number of other files.
7767 </para>
7768 </section>
7769 <section id="SECID44">
7770 <title>Overriding macro values</title>
7771 <para>
7772 The values set for macros in the configuration file can be overridden by the
7773 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7774 used, unless called by root or the Exim user. A definition on the command line
7775 using the <option>-D</option> option causes all definitions and redefinitions within the
7776 file to be ignored.
7777 </para>
7778 </section>
7779 <section id="SECID45">
7780 <title>Example of macro usage</title>
7781 <para>
7782 As an example of macro usage, consider a configuration where aliases are looked
7783 up in a MySQL database. It helps to keep the file less cluttered if long
7784 strings such as SQL statements are defined separately as macros, for example:
7785 </para>
7786 <literallayout class="monospaced">
7787 ALIAS_QUERY = select mailbox from user where \
7788               login='${quote_mysql:$local_part}';
7789 </literallayout>
7790 <para>
7791 This can then be used in a <command>redirect</command> router setting like this:
7792 </para>
7793 <literallayout class="monospaced">
7794 data = ${lookup mysql{ALIAS_QUERY}}
7795 </literallayout>
7796 <para>
7797 In earlier versions of Exim macros were sometimes used for domain, host, or
7798 address lists. In Exim 4 these are handled better by named lists &ndash; see
7799 section <xref linkend="SECTnamedlists"/>.
7800 </para>
7801 </section>
7802 <section id="SECTbuiltinmacros">
7803 <title>Builtin macros</title>
7804 <para>
7805 Exim defines some macros depending on facilities available, which may
7806 differ due to build-time definitions and from one release to another.
7807 All of these macros start with an underscore.
7808 They can be used to conditionally include parts of a configuration
7809 (see below).
7810 </para>
7811 <para>
7812 The following classes of macros are defined:
7813 </para>
7814 <literallayout>
7815 <literal> _HAVE_*                    </literal>  build-time defines
7816 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7817 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7818 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7819 <literal> _OPT_MAIN_*                </literal>  main config options
7820 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7821 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7822 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7823 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7824 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7825 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7826 </literallayout>
7827 <para>
7828 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7829 </para>
7830 </section>
7831 <section id="SECID46">
7832 <title>Conditional skips in the configuration file</title>
7833 <para>
7834 <indexterm role="concept">
7835 <primary>configuration file</primary>
7836 <secondary>conditional skips</secondary>
7837 </indexterm>
7838 <indexterm role="concept">
7839 <primary><literal>.ifdef</literal></primary>
7840 </indexterm>
7841 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7842 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7843 portions of the configuration file. The processing happens whenever the file is
7844 read (that is, when an Exim binary starts to run).
7845 </para>
7846 <para>
7847 The implementation is very simple. Instances of the first four directives must
7848 be followed by text that includes the names of one or macros. The condition
7849 that is tested is whether or not any macro substitution has taken place in the
7850 line. Thus:
7851 </para>
7852 <literallayout class="monospaced">
7853 .ifdef AAA
7854 message_size_limit = 50M
7855 .else
7856 message_size_limit = 100M
7857 .endif
7858 </literallayout>
7859 <para>
7860 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7861 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7862 otherwise. If there is more than one macro named on the line, the condition
7863 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7864 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7865 </para>
7866 <para>
7867 Although you can use a macro expansion to generate one of these directives,
7868 it is not very useful, because the condition <quote>there was a macro substitution
7869 in this line</quote> will always be true.
7870 </para>
7871 <para>
7872 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7873 to clarify complicated nestings.
7874 </para>
7875 </section>
7876 <section id="SECTcos">
7877 <title>Common option syntax</title>
7878 <para>
7879 <indexterm role="concept">
7880 <primary>common option syntax</primary>
7881 </indexterm>
7882 <indexterm role="concept">
7883 <primary>syntax of common options</primary>
7884 </indexterm>
7885 <indexterm role="concept">
7886 <primary>configuration file</primary>
7887 <secondary>common option syntax</secondary>
7888 </indexterm>
7889 For the main set of options, driver options, and <function>local_scan()</function> options,
7890 each setting is on a line by itself, and starts with a name consisting of
7891 lower-case letters and underscores. Many options require a data value, and in
7892 these cases the name must be followed by an equals sign (with optional white
7893 space) and then the value. For example:
7894 </para>
7895 <literallayout class="monospaced">
7896 qualify_domain = mydomain.example.com
7897 </literallayout>
7898 <para>
7899 <indexterm role="concept">
7900 <primary>hiding configuration option values</primary>
7901 </indexterm>
7902 <indexterm role="concept">
7903 <primary>configuration options</primary>
7904 <secondary>hiding value of</secondary>
7905 </indexterm>
7906 <indexterm role="concept">
7907 <primary>options</primary>
7908 <secondary>hiding value of</secondary>
7909 </indexterm>
7910 Some option settings may contain sensitive data, for example, passwords for
7911 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7912 line option to read these values, you can precede the option settings with the
7913 word <quote>hide</quote>. For example:
7914 </para>
7915 <literallayout class="monospaced">
7916 hide mysql_servers = localhost/users/admin/secret-password
7917 </literallayout>
7918 <para>
7919 For non-admin users, such options are displayed like this:
7920 </para>
7921 <literallayout class="monospaced">
7922 mysql_servers = &lt;value not displayable&gt;
7923 </literallayout>
7924 <para>
7925 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7926 all instances of the same driver.
7927 </para>
7928 <para>
7929 The following sections describe the syntax used for the different data types
7930 that are found in option settings.
7931 </para>
7932 </section>
7933 <section id="SECID47">
7934 <title>Boolean options</title>
7935 <para>
7936 <indexterm role="concept">
7937 <primary>format</primary>
7938 <secondary>boolean</secondary>
7939 </indexterm>
7940 <indexterm role="concept">
7941 <primary>boolean configuration values</primary>
7942 </indexterm>
7943 <indexterm role="option">
7944 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7945 </indexterm>
7946 <indexterm role="option">
7947 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7948 </indexterm>
7949 Options whose type is given as boolean are on/off switches. There are two
7950 different ways of specifying such options: with and without a data value. If
7951 the option name is specified on its own without data, the switch is turned on;
7952 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7953 boolean options may be followed by an equals sign and one of the words
7954 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7955 the following two settings have exactly the same effect:
7956 </para>
7957 <literallayout class="monospaced">
7958 queue_only
7959 queue_only = true
7960 </literallayout>
7961 <para>
7962 The following two lines also have the same (opposite) effect:
7963 </para>
7964 <literallayout class="monospaced">
7965 no_queue_only
7966 queue_only = false
7967 </literallayout>
7968 <para>
7969 You can use whichever syntax you prefer.
7970 </para>
7971 </section>
7972 <section id="SECID48">
7973 <title>Integer values</title>
7974 <para>
7975 <indexterm role="concept">
7976 <primary>integer configuration values</primary>
7977 </indexterm>
7978 <indexterm role="concept">
7979 <primary>format</primary>
7980 <secondary>integer</secondary>
7981 </indexterm>
7982 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7983 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7984 number is assumed. Otherwise, it is treated as an octal number unless it starts
7985 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7986 hexadecimal number.
7987 </para>
7988 <para>
7989 If an integer value is followed by the letter K, it is multiplied by 1024; if
7990 it is followed by the letter M, it is multiplied by 1024x1024;
7991 if by the letter G, 1024x1024x1024.
7992 When the values
7993 of integer option settings are output, values which are an exact multiple of
7994 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7995 and M. The printing style is independent of the actual input format that was
7996 used.
7997 </para>
7998 </section>
7999 <section id="SECID49">
8000 <title>Octal integer values</title>
8001 <para>
8002 <indexterm role="concept">
8003 <primary>integer format</primary>
8004 </indexterm>
8005 <indexterm role="concept">
8006 <primary>format</primary>
8007 <secondary>octal integer</secondary>
8008 </indexterm>
8009 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8010 interpreted as an octal number, whether or not it starts with the digit zero.
8011 Such options are always output in octal.
8012 </para>
8013 </section>
8014 <section id="SECID50">
8015 <title>Fixed point numbers</title>
8016 <para>
8017 <indexterm role="concept">
8018 <primary>fixed point configuration values</primary>
8019 </indexterm>
8020 <indexterm role="concept">
8021 <primary>format</primary>
8022 <secondary>fixed point</secondary>
8023 </indexterm>
8024 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8025 integer, optionally followed by a decimal point and up to three further digits.
8026 </para>
8027 </section>
8028 <section id="SECTtimeformat">
8029 <title>Time intervals</title>
8030 <para>
8031 <indexterm role="concept">
8032 <primary>time interval</primary>
8033 <secondary>specifying in configuration</secondary>
8034 </indexterm>
8035 <indexterm role="concept">
8036 <primary>format</primary>
8037 <secondary>time interval</secondary>
8038 </indexterm>
8039 A time interval is specified as a sequence of numbers, each followed by one of
8040 the following letters, with no intervening white space:
8041 </para>
8042 <informaltable frame="none">
8043 <tgroup cols="2" colsep="0" rowsep="0">
8044 <colspec colwidth="30pt" align="left"/>
8045 <colspec colwidth="254pt" align="left"/>
8046 <tbody>
8047 <row>
8048 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8049 <entry>seconds</entry>
8050 </row>
8051 <row>
8052 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8053 <entry>minutes</entry>
8054 </row>
8055 <row>
8056 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8057 <entry>hours</entry>
8058 </row>
8059 <row>
8060 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8061 <entry>days</entry>
8062 </row>
8063 <row>
8064 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8065 <entry>weeks</entry>
8066 </row>
8067 </tbody>
8068 </tgroup>
8069 </informaltable>
8070 <para>
8071 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8072 intervals are output in the same format. Exim does not restrict the values; it
8073 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8074 </para>
8075 </section>
8076 <section id="SECTstrings">
8077 <title>String values</title>
8078 <para>
8079 <indexterm role="concept">
8080 <primary>string</primary>
8081 <secondary>format of configuration values</secondary>
8082 </indexterm>
8083 <indexterm role="concept">
8084 <primary>format</primary>
8085 <secondary>string</secondary>
8086 </indexterm>
8087 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8088 or without double-quotes. If it does not start with a double-quote, the value
8089 consists of the remainder of the line plus any continuation lines, starting at
8090 the first character after any leading white space, with trailing white space
8091 removed, and with no interpretation of the characters in the string. Because
8092 Exim removes comment lines (those beginning with #) at an early stage, they can
8093 appear in the middle of a multi-line string. The following two settings are
8094 therefore equivalent:
8095 </para>
8096 <literallayout class="monospaced">
8097 trusted_users = uucp:mail
8098 trusted_users = uucp:\
8099                 # This comment line is ignored
8100                 mail
8101 </literallayout>
8102 <para>
8103 <indexterm role="concept">
8104 <primary>string</primary>
8105 <secondary>quoted</secondary>
8106 </indexterm>
8107 <indexterm role="concept">
8108 <primary>escape characters in quoted strings</primary>
8109 </indexterm>
8110 If a string does start with a double-quote, it must end with a closing
8111 double-quote, and any backslash characters other than those used for line
8112 continuation are interpreted as escape characters, as follows:
8113 </para>
8114 <informaltable frame="none">
8115 <tgroup cols="2" colsep="0" rowsep="0">
8116 <colspec colwidth="100pt" align="left"/>
8117 <colspec colwidth="254pt" align="left"/>
8118 <tbody>
8119 <row>
8120 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8121 <entry>single backslash</entry>
8122 </row>
8123 <row>
8124 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8125 <entry>newline</entry>
8126 </row>
8127 <row>
8128 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8129 <entry>carriage return</entry>
8130 </row>
8131 <row>
8132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8133 <entry>tab</entry>
8134 </row>
8135 <row>
8136 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8137 <entry>up to 3 octal digits specify one character</entry>
8138 </row>
8139 <row>
8140 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8141 <entry>up to 2 hexadecimal digits specify one character</entry>
8142 </row>
8143 </tbody>
8144 </tgroup>
8145 </informaltable>
8146 <para>
8147 If a backslash is followed by some other character, including a double-quote
8148 character, that character replaces the pair.
8149 </para>
8150 <para>
8151 Quoting is necessary only if you want to make use of the backslash escapes to
8152 insert special characters, or if you need to specify a value with leading or
8153 trailing spaces. These cases are rare, so quoting is almost never needed in
8154 current versions of Exim. In versions of Exim before 3.14, quoting was required
8155 in order to continue lines, so you may come across older configuration files
8156 and examples that apparently quote unnecessarily.
8157 </para>
8158 </section>
8159 <section id="SECID51">
8160 <title>Expanded strings</title>
8161 <para>
8162 <indexterm role="concept">
8163 <primary>expansion</primary>
8164 <secondary>definition of</secondary>
8165 </indexterm>
8166 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8167 by which means various parts of the string may be changed according to the
8168 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8169 is as just described; in particular, the handling of backslashes in quoted
8170 strings is done as part of the input process, before expansion takes place.
8171 However, backslash is also an escape character for the expander, so any
8172 backslashes that are required for that reason must be doubled if they are
8173 within a quoted configuration string.
8174 </para>
8175 </section>
8176 <section id="SECID52">
8177 <title>User and group names</title>
8178 <para>
8179 <indexterm role="concept">
8180 <primary>user name</primary>
8181 <secondary>format of</secondary>
8182 </indexterm>
8183 <indexterm role="concept">
8184 <primary>format</primary>
8185 <secondary>user name</secondary>
8186 </indexterm>
8187 <indexterm role="concept">
8188 <primary>groups</primary>
8189 <secondary>name format</secondary>
8190 </indexterm>
8191 <indexterm role="concept">
8192 <primary>format</primary>
8193 <secondary>group name</secondary>
8194 </indexterm>
8195 User and group names are specified as strings, using the syntax described
8196 above, but the strings are interpreted specially. A user or group name must
8197 either consist entirely of digits, or be a name that can be looked up using the
8198 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8199 </para>
8200 </section>
8201 <section id="SECTlistconstruct">
8202 <title>List construction</title>
8203 <para>
8204 <indexterm role="concept">
8205 <primary>list</primary>
8206 <secondary>syntax of in configuration</secondary>
8207 </indexterm>
8208 <indexterm role="concept">
8209 <primary>format</primary>
8210 <secondary>list item in configuration</secondary>
8211 </indexterm>
8212 <indexterm role="concept">
8213 <primary>string</primary>
8214 <secondary>list, definition of</secondary>
8215 </indexterm>
8216 The data for some configuration options is a list of items, with colon as the
8217 default separator. Many of these options are shown with type <quote>string list</quote> in
8218 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8219 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8220 are all the same; however, those other than <quote>string list</quote> are subject to
8221 particular kinds of interpretation, as described in chapter
8222 <xref linkend="CHAPdomhosaddlists"/>.
8223 </para>
8224 <para>
8225 In all these cases, the entire list is treated as a single string as far as the
8226 input syntax is concerned. The <option>trusted_users</option> setting in section
8227 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8228 in a list, it must be entered as two colons. Leading and trailing white space
8229 on each item in a list is ignored. This makes it possible to include items that
8230 start with a colon, and in particular, certain forms of IPv6 address. For
8231 example, the list
8232 </para>
8233 <literallayout class="monospaced">
8234 local_interfaces = 127.0.0.1 : ::::1
8235 </literallayout>
8236 <para>
8237 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8238 </para>
8239 <para>
8240 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8241 list items, it is not ignored when parsing the list. The space after the first
8242 colon in the example above is necessary. If it were not there, the list would
8243 be interpreted as the two items 127.0.0.1:: and 1.
8244 </para>
8245 </section>
8246 <section id="SECTlistsepchange">
8247 <title>Changing list separators</title>
8248 <para>
8249 <indexterm role="concept">
8250 <primary>list separator</primary>
8251 <secondary>changing</secondary>
8252 </indexterm>
8253 <indexterm role="concept">
8254 <primary>IPv6</primary>
8255 <secondary>addresses in lists</secondary>
8256 </indexterm>
8257 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8258 introduced to allow the separator character to be changed. If a list begins
8259 with a left angle bracket, followed by any punctuation character, that
8260 character is used instead of colon as the list separator. For example, the list
8261 above can be rewritten to use a semicolon separator like this:
8262 </para>
8263 <literallayout class="monospaced">
8264 local_interfaces = &lt;; 127.0.0.1 ; ::1
8265 </literallayout>
8266 <para>
8267 This facility applies to all lists, with the exception of the list in
8268 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8269 confined to circumstances where they really are needed.
8270 </para>
8271 <para>
8272 <indexterm role="concept">
8273 <primary>list separator</primary>
8274 <secondary>newline as</secondary>
8275 </indexterm>
8276 <indexterm role="concept">
8277 <primary>newline</primary>
8278 <secondary>as list separator</secondary>
8279 </indexterm>
8280 It is also possible to use newline and other control characters (those with
8281 code values less than 32, plus DEL) as separators in lists. Such separators
8282 must be provided literally at the time the list is processed. For options that
8283 are string-expanded, you can write the separator using a normal escape
8284 sequence. This will be processed by the expander before the string is
8285 interpreted as a list. For example, if a newline-separated list of domains is
8286 generated by a lookup, you can process it directly by a line such as this:
8287 </para>
8288 <literallayout class="monospaced">
8289 domains = &lt;\n ${lookup mysql{.....}}
8290 </literallayout>
8291 <para>
8292 This avoids having to change the list separator in such data. You are unlikely
8293 to want to use a control character as a separator in an option that is not
8294 expanded, because the value is literal text. However, it can be done by giving
8295 the value in quotes. For example:
8296 </para>
8297 <literallayout class="monospaced">
8298 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8299 </literallayout>
8300 <para>
8301 Unlike printing character separators, which can be included in list items by
8302 doubling, it is not possible to include a control character as data when it is
8303 set as the separator. Two such characters in succession are interpreted as
8304 enclosing an empty list item.
8305 </para>
8306 </section>
8307 <section id="SECTempitelis">
8308 <title>Empty items in lists</title>
8309 <para>
8310 <indexterm role="concept">
8311 <primary>list</primary>
8312 <secondary>empty item in</secondary>
8313 </indexterm>
8314 An empty item at the end of a list is always ignored. In other words, trailing
8315 separator characters are ignored. Thus, the list in
8316 </para>
8317 <literallayout class="monospaced">
8318 senders = user@domain :
8319 </literallayout>
8320 <para>
8321 contains only a single item. If you want to include an empty string as one item
8322 in a list, it must not be the last item. For example, this list contains three
8323 items, the second of which is empty:
8324 </para>
8325 <literallayout class="monospaced">
8326 senders = user1@domain : : user2@domain
8327 </literallayout>
8328 <para>
8329 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8330 are interpreted as representing a single colon data character (and the list
8331 would then contain just one item). If you want to specify a list that contains
8332 just one, empty item, you can do it as in this example:
8333 </para>
8334 <literallayout class="monospaced">
8335 senders = :
8336 </literallayout>
8337 <para>
8338 In this case, the first item is empty, and the second is discarded because it
8339 is at the end of the list.
8340 </para>
8341 </section>
8342 <section id="SECTfordricon">
8343 <title>Format of driver configurations</title>
8344 <para>
8345 <indexterm role="concept">
8346 <primary>drivers</primary>
8347 <secondary>configuration format</secondary>
8348 </indexterm>
8349 There are separate parts in the configuration for defining routers, transports,
8350 and authenticators. In each part, you are defining a number of driver
8351 instances, each with its own set of options. Each driver instance is defined by
8352 a sequence of lines like this:
8353 </para>
8354 <literallayout>
8355 &lt;<emphasis>instance name</emphasis>&gt;:
8356   &lt;<emphasis>option</emphasis>&gt;
8357   ...
8358   &lt;<emphasis>option</emphasis>&gt;
8359 </literallayout>
8360 <para>
8361 In the following example, the instance name is <command>localuser</command>, and it is
8362 followed by three options settings:
8363 </para>
8364 <literallayout class="monospaced">
8365 localuser:
8366   driver = accept
8367   check_local_user
8368   transport = local_delivery
8369 </literallayout>
8370 <para>
8371 For each driver instance, you specify which Exim code module it uses &ndash; by the
8372 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8373 settings. For example, in the case of transports, if you want a transport to
8374 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8375 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8376 described in detail in its own separate chapter later in this manual.
8377 </para>
8378 <para>
8379 You can have several routers, transports, or authenticators that are based on
8380 the same underlying driver (each must have a different instance name).
8381 </para>
8382 <para>
8383 The order in which routers are defined is important, because addresses are
8384 passed to individual routers one by one, in order. The order in which
8385 transports are defined does not matter at all. The order in which
8386 authenticators are defined is used only when Exim, as a client, is searching
8387 them to find one that matches an authentication mechanism offered by the
8388 server.
8389 </para>
8390 <para>
8391 <indexterm role="concept">
8392 <primary>generic options</primary>
8393 </indexterm>
8394 <indexterm role="concept">
8395 <primary>options</primary>
8396 <secondary>generic &ndash; definition of</secondary>
8397 </indexterm>
8398 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8399 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8400 same type (that is, all routers, all transports or all authenticators). The
8401 <option>driver</option> option is a generic option that must appear in every definition.
8402 <indexterm role="concept">
8403 <primary>private options</primary>
8404 </indexterm>
8405 The private options are special for each driver, and none need appear, because
8406 they all have default values.
8407 </para>
8408 <para>
8409 The options may appear in any order, except that the <option>driver</option> option must
8410 precede any private options, since these depend on the particular driver. For
8411 this reason, it is recommended that <option>driver</option> always be the first option.
8412 </para>
8413 <para>
8414 Driver instance names, which are used for reference in log entries and
8415 elsewhere, can be any sequence of letters, digits, and underscores (starting
8416 with a letter) and must be unique among drivers of the same type. A router and
8417 a transport (for example) can each have the same name, but no two router
8418 instances can have the same name. The name of a driver instance should not be
8419 confused with the name of the underlying driver module. For example, the
8420 configuration lines:
8421 </para>
8422 <literallayout class="monospaced">
8423 remote_smtp:
8424   driver = smtp
8425 </literallayout>
8426 <para>
8427 create an instance of the <command>smtp</command> transport driver whose name is
8428 <command>remote_smtp</command>. The same driver code can be used more than once, with
8429 different instance names and different option settings each time. A second
8430 instance of the <command>smtp</command> transport, with different options, might be defined
8431 thus:
8432 </para>
8433 <literallayout class="monospaced">
8434 special_smtp:
8435   driver = smtp
8436   port = 1234
8437   command_timeout = 10s
8438 </literallayout>
8439 <para>
8440 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8441 these transport instances from routers, and these names would appear in log
8442 lines.
8443 </para>
8444 <para>
8445 Comment lines may be present in the middle of driver specifications. The full
8446 list of option settings for any particular driver instance, including all the
8447 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8448 option.
8449 </para>
8450 </section>
8451 </chapter>
8452
8453 <chapter id="CHAPdefconfil">
8454 <title>The default configuration file</title>
8455 <para>
8456 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8457 <primary>configuration file</primary>
8458 <secondary>default <quote>walk through</quote></secondary>
8459 </indexterm>
8460 <indexterm role="concept">
8461 <primary>default</primary>
8462 <secondary>configuration file <quote>walk through</quote></secondary>
8463 </indexterm>
8464 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8465 is sufficient for a host with simple mail requirements. As an introduction to
8466 the way Exim is configured, this chapter <quote>walks through</quote> the default
8467 configuration, giving brief explanations of the settings. Detailed descriptions
8468 of the options are given in subsequent chapters. The default configuration file
8469 itself contains extensive comments about ways you might want to modify the
8470 initial settings. However, note that there are many options that are not
8471 mentioned at all in the default configuration.
8472 </para>
8473 <section id="SECTdefconfmain">
8474 <title>Main configuration settings</title>
8475 <para>
8476 The main (global) configuration option settings must always come first in the
8477 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8478 the line
8479 </para>
8480 <literallayout class="monospaced">
8481 # primary_hostname =
8482 </literallayout>
8483 <para>
8484 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8485 to know the official, fully qualified name of your host, and this is where you
8486 can specify it. However, in most cases you do not need to set this option. When
8487 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8488 </para>
8489 <para>
8490 The first three non-comment configuration lines are as follows:
8491 </para>
8492 <literallayout class="monospaced">
8493 domainlist local_domains    = @
8494 domainlist relay_to_domains =
8495 hostlist   relay_from_hosts = 127.0.0.1
8496 </literallayout>
8497 <para>
8498 These are not, in fact, option settings. They are definitions of two named
8499 domain lists and one named host list. Exim allows you to give names to lists of
8500 domains, hosts, and email addresses, in order to make it easier to manage the
8501 configuration file (see section <xref linkend="SECTnamedlists"/>).
8502 </para>
8503 <para>
8504 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8505 later in the configuration to identify domains that are to be delivered
8506 on the local host.
8507 </para>
8508 <para>
8509 <indexterm role="concept">
8510 <primary>@ in a domain list</primary>
8511 </indexterm>
8512 There is just one item in this list, the string <quote>@</quote>. This is a special form
8513 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8514 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8515 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8516 the same configuration file can be used on different hosts.
8517 </para>
8518 <para>
8519 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8520 list itself is empty. Later in the configuration we will come to the part that
8521 controls mail relaying through the local host; it allows relaying to any
8522 domains in this list. By default, therefore, no relaying on the basis of a mail
8523 domain is permitted.
8524 </para>
8525 <para>
8526 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8527 used later in the configuration to permit relaying from any host or IP address
8528 that matches the list. The default contains just the IP address of the IPv4
8529 loopback interface, which means that processes on the local host are able to
8530 submit mail for relaying by sending it over TCP/IP to that interface. No other
8531 hosts are permitted to submit messages for relaying.
8532 </para>
8533 <para>
8534 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8535 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8536 and hosts that will be used in the controls that are specified later.
8537 </para>
8538 <para>
8539 The next two configuration lines are genuine option settings:
8540 </para>
8541 <literallayout class="monospaced">
8542 acl_smtp_rcpt = acl_check_rcpt
8543 acl_smtp_data = acl_check_data
8544 </literallayout>
8545 <para>
8546 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8547 during an incoming SMTP session for every recipient of a message (every RCPT
8548 command), and after the contents of the message have been received,
8549 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8550 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8551 section of the configuration. The RCPT ACL controls which recipients are
8552 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8553 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8554 contents of a message to be checked.
8555 </para>
8556 <para>
8557 Two commented-out option settings are next:
8558 </para>
8559 <literallayout class="monospaced">
8560 # av_scanner = clamd:/tmp/clamd
8561 # spamd_address = 127.0.0.1 783
8562 </literallayout>
8563 <para>
8564 These are example settings that can be used when Exim is compiled with the
8565 content-scanning extension. The first specifies the interface to the virus
8566 scanner, and the second specifies the interface to SpamAssassin. Further
8567 details are given in chapter <xref linkend="CHAPexiscan"/>.
8568 </para>
8569 <para>
8570 Three more commented-out option settings follow:
8571 </para>
8572 <literallayout class="monospaced">
8573 # tls_advertise_hosts = *
8574 # tls_certificate = /etc/ssl/exim.crt
8575 # tls_privatekey = /etc/ssl/exim.pem
8576 </literallayout>
8577 <para>
8578 These are example settings that can be used when Exim is compiled with
8579 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8580 first one specifies the list of clients that are allowed to use TLS when
8581 connecting to this server; in this case the wildcard means all clients. The
8582 other options specify where Exim should find its TLS certificate and private
8583 key, which together prove the server&#x2019;s identity to any clients that connect.
8584 More details are given in chapter <xref linkend="CHAPTLS"/>.
8585 </para>
8586 <para>
8587 Another two commented-out option settings follow:
8588 </para>
8589 <literallayout class="monospaced">
8590 # daemon_smtp_ports = 25 : 465 : 587
8591 # tls_on_connect_ports = 465
8592 </literallayout>
8593 <para>
8594 <indexterm role="concept">
8595 <primary>port</primary>
8596 <secondary>465 and 587</secondary>
8597 </indexterm>
8598 <indexterm role="concept">
8599 <primary>port</primary>
8600 <secondary>for message submission</secondary>
8601 </indexterm>
8602 <indexterm role="concept">
8603 <primary>message</primary>
8604 <secondary>submission, ports for</secondary>
8605 </indexterm>
8606 <indexterm role="concept">
8607 <primary>submissions protocol</primary>
8608 </indexterm>
8609 <indexterm role="concept">
8610 <primary>smtps protocol</primary>
8611 </indexterm>
8612 <indexterm role="concept">
8613 <primary>ssmtp protocol</primary>
8614 </indexterm>
8615 <indexterm role="concept">
8616 <primary>SMTP</primary>
8617 <secondary>submissions protocol</secondary>
8618 </indexterm>
8619 <indexterm role="concept">
8620 <primary>SMTP</primary>
8621 <secondary>ssmtp protocol</secondary>
8622 </indexterm>
8623 <indexterm role="concept">
8624 <primary>SMTP</primary>
8625 <secondary>smtps protocol</secondary>
8626 </indexterm>
8627 These options provide better support for roaming users who wish to use this
8628 server for message submission. They are not much use unless you have turned on
8629 TLS (as described in the previous paragraph) and authentication (about which
8630 more in section <xref linkend="SECTdefconfauth"/>).
8631 Mail submission from mail clients (MUAs) should be separate from inbound mail
8632 to your domain (MX delivery) for various good reasons (eg, ability to impose
8633 much saner TLS protocol and ciphersuite requirements without unintended
8634 consequences).
8635 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
8636 which uses STARTTLS, so this is the <quote>submission</quote> port.
8637 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
8638 which should be used in preference to 587.
8639 You should also consider deploying SRV records to help clients find
8640 these ports.
8641 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
8642 </para>
8643 <para>
8644 Two more commented-out options settings follow:
8645 </para>
8646 <literallayout class="monospaced">
8647 # qualify_domain =
8648 # qualify_recipient =
8649 </literallayout>
8650 <para>
8651 The first of these specifies a domain that Exim uses when it constructs a
8652 complete email address from a local login name. This is often needed when Exim
8653 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8654 the value of <option>primary_hostname</option> is used. If you set both of these options,
8655 you can have different qualification domains for sender and recipient
8656 addresses. If you set only the first one, its value is used in both cases.
8657 </para>
8658 <para>
8659 <indexterm role="concept">
8660 <primary>domain literal</primary>
8661 <secondary>recognizing format</secondary>
8662 </indexterm>
8663 The following line must be uncommented if you want Exim to recognize
8664 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8665 (an IP address within square brackets) instead of a named domain.
8666 </para>
8667 <literallayout class="monospaced">
8668 # allow_domain_literals
8669 </literallayout>
8670 <para>
8671 The RFCs still require this form, but many people think that in the modern
8672 Internet it makes little sense to permit mail to be sent to specific hosts by
8673 quoting their IP addresses. This ancient format has been used by people who
8674 try to abuse hosts by using them for unwanted relaying. However, some
8675 people believe there are circumstances (for example, messages addressed to
8676 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8677 </para>
8678 <para>
8679 The next configuration line is a kind of trigger guard:
8680 </para>
8681 <literallayout class="monospaced">
8682 never_users = root
8683 </literallayout>
8684 <para>
8685 It specifies that no delivery must ever be run as the root user. The normal
8686 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8687 setting is a guard against slips in the configuration.
8688 The list of users specified by <option>never_users</option> is not, however, the complete
8689 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8690 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8691 contents of <option>never_users</option> are added to this list. By default
8692 FIXED_NEVER_USERS also specifies root.
8693 </para>
8694 <para>
8695 When a remote host connects to Exim in order to send mail, the only information
8696 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8697 line,
8698 </para>
8699 <literallayout class="monospaced">
8700 host_lookup = *
8701 </literallayout>
8702 <para>
8703 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8704 in order to get a host name. This improves the quality of the logging
8705 information, but if you feel it is too expensive, you can remove it entirely,
8706 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8707 Note that it is not always possible to find a host name from an IP address,
8708 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8709 unreachable.
8710 </para>
8711 <para>
8712 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8713 1413 (hence their names):
8714 </para>
8715 <literallayout class="monospaced">
8716 rfc1413_hosts = *
8717 rfc1413_query_timeout = 0s
8718 </literallayout>
8719 <para>
8720 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8721 Few hosts offer RFC1413 service these days; calls have to be
8722 terminated by a timeout and this needlessly delays the startup
8723 of an incoming SMTP connection.
8724 If you have hosts for which you trust RFC1413 and need this
8725 information, you can change this.
8726 </para>
8727 <para>
8728 This line enables an efficiency SMTP option.  It is negotiated by clients
8729 and not expected to cause problems but can be disabled if needed.
8730 </para>
8731 <literallayout class="monospaced">
8732 prdr_enable = true
8733 </literallayout>
8734 <para>
8735 When Exim receives messages over SMTP connections, it expects all addresses to
8736 be fully qualified with a domain, as required by the SMTP definition. However,
8737 if you are running a server to which simple clients submit messages, you may
8738 find that they send unqualified addresses. The two commented-out options:
8739 </para>
8740 <literallayout class="monospaced">
8741 # sender_unqualified_hosts =
8742 # recipient_unqualified_hosts =
8743 </literallayout>
8744 <para>
8745 show how you can specify hosts that are permitted to send unqualified sender
8746 and recipient addresses, respectively.
8747 </para>
8748 <para>
8749 The <option>log_selector</option> option is used to increase the detail of logging
8750 over the default:
8751 </para>
8752 <literallayout class="monospaced">
8753 log_selector = +smtp_protocol_error +smtp_syntax_error \
8754                +tls_certificate_verified
8755 </literallayout>
8756 <para>
8757 The <option>percent_hack_domains</option> option is also commented out:
8758 </para>
8759 <literallayout class="monospaced">
8760 # percent_hack_domains =
8761 </literallayout>
8762 <para>
8763 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8764 This is an almost obsolete form of explicit email routing. If you do not know
8765 anything about it, you can safely ignore this topic.
8766 </para>
8767 <para>
8768 The next two settings in the main part of the default configuration are
8769 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8770 message is frozen, Exim no longer continues to try to deliver it. Freezing
8771 occurs when a bounce message encounters a permanent failure because the sender
8772 address of the original message that caused the bounce is invalid, so the
8773 bounce cannot be delivered. This is probably the most common case, but there
8774 are also other conditions that cause freezing, and frozen messages are not
8775 always bounce messages.
8776 </para>
8777 <literallayout class="monospaced">
8778 ignore_bounce_errors_after = 2d
8779 timeout_frozen_after = 7d
8780 </literallayout>
8781 <para>
8782 The first of these options specifies that failing bounce messages are to be
8783 discarded after 2 days on the queue. The second specifies that any frozen
8784 message (whether a bounce message or not) is to be timed out (and discarded)
8785 after a week. In this configuration, the first setting ensures that no failing
8786 bounce message ever lasts a week.
8787 </para>
8788 <para>
8789 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8790 large queues, you may consider using this option. It splits the spool
8791 directory into subdirectories to avoid file system degradation from
8792 many files in a single directory, resulting in better performance.
8793 Manual manipulation of queued messages becomes more complex (though fortunately
8794 not often needed).
8795 </para>
8796 <literallayout class="monospaced">
8797 # split_spool_directory = true
8798 </literallayout>
8799 <para>
8800 In an ideal world everybody follows the standards. For non-ASCII
8801 messages RFC 2047 is a standard, allowing a maximum line length of 76
8802 characters. Exim adheres that standard and won&#x2019;t process messages which
8803 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8804 In particular, the Exim maintainers have had multiple reports of
8805 problems from Russian administrators of issues until they disable this
8806 check, because of some popular, yet buggy, mail composition software.
8807 </para>
8808 <literallayout class="monospaced">
8809 # check_rfc2047_length = false
8810 </literallayout>
8811 <para>
8812 If you need to be strictly RFC compliant you may wish to disable the
8813 8BITMIME advertisement. Use this, if you exchange mails with systems
8814 that are not 8-bit clean.
8815 </para>
8816 <literallayout class="monospaced">
8817 # accept_8bitmime = false
8818 </literallayout>
8819 <para>
8820 Libraries you use may depend on specific environment settings.  This
8821 imposes a security risk (e.g. PATH). There are two lists:
8822 <option>keep_environment</option> for the variables to import as they are, and
8823 <option>add_environment</option> for variables we want to set to a fixed value.
8824 Note that TZ is handled separately, by the $%timezone%$ runtime
8825 option and by the TIMEZONE_DEFAULT buildtime option.
8826 </para>
8827 <literallayout class="monospaced">
8828 # keep_environment = ^LDAP
8829 # add_environment = PATH=/usr/bin::/bin
8830 </literallayout>
8831 </section>
8832 <section id="SECID54">
8833 <title>ACL configuration</title>
8834 <para>
8835 <indexterm role="concept">
8836 <primary>default</primary>
8837 <secondary>ACLs</secondary>
8838 </indexterm>
8839 <indexterm role="concept">
8840 <primary>access control lists (ACLs)</primary>
8841 <secondary>default configuration</secondary>
8842 </indexterm>
8843 In the default configuration, the ACL section follows the main configuration.
8844 It starts with the line
8845 </para>
8846 <literallayout class="monospaced">
8847 begin acl
8848 </literallayout>
8849 <para>
8850 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8851 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8852 and <option>acl_smtp_data</option> above.
8853 </para>
8854 <para>
8855 <indexterm role="concept">
8856 <primary>RCPT</primary>
8857 <secondary>ACL for</secondary>
8858 </indexterm>
8859 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8860 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8861 are considered in order, until the recipient address is either accepted or
8862 rejected. The RCPT command is then accepted or rejected, according to the
8863 result of the ACL processing.
8864 </para>
8865 <literallayout class="monospaced">
8866 acl_check_rcpt:
8867 </literallayout>
8868 <para>
8869 This line, consisting of a name terminated by a colon, marks the start of the
8870 ACL, and names it.
8871 </para>
8872 <literallayout class="monospaced">
8873 accept  hosts = :
8874 </literallayout>
8875 <para>
8876 This ACL statement accepts the recipient if the sending host matches the list.
8877 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8878 names or IP addresses. The presence of the colon puts an empty item in the
8879 list; Exim matches this only if the incoming message did not come from a remote
8880 host, because in that case, the remote hostname is empty. The colon is
8881 important. Without it, the list itself is empty, and can never match anything.
8882 </para>
8883 <para>
8884 What this statement is doing is to accept unconditionally all recipients in
8885 messages that are submitted by SMTP from local processes using the standard
8886 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8887 manner.
8888 </para>
8889 <literallayout class="monospaced">
8890 deny    message       = Restricted characters in address
8891         domains       = +local_domains
8892         local_parts   = ^[.] : ^.*[@%!/|]
8893
8894 deny    message       = Restricted characters in address
8895         domains       = !+local_domains
8896         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8897 </literallayout>
8898 <para>
8899 These statements are concerned with local parts that contain any of the
8900 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8901 Although these characters are entirely legal in local parts (in the case of
8902 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8903 in Internet mail addresses.
8904 </para>
8905 <para>
8906 The first three have in the past been associated with explicitly routed
8907 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8908 option). Addresses containing these characters are regularly tried by spammers
8909 in an attempt to bypass relaying restrictions, and also by open relay testing
8910 programs. Unless you really need them it is safest to reject these characters
8911 at this early stage. This configuration is heavy-handed in rejecting these
8912 characters for all messages it accepts from remote hosts. This is a deliberate
8913 policy of being as safe as possible.
8914 </para>
8915 <para>
8916 The first rule above is stricter, and is applied to messages that are addressed
8917 to one of the local domains handled by this host. This is implemented by the
8918 first condition, which restricts it to domains that are listed in the
8919 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8920 reference to a named list. In this configuration, there is just one domain in
8921 <emphasis>local_domains</emphasis>, but in general there may be many.
8922 </para>
8923 <para>
8924 The second condition on the first statement uses two regular expressions to
8925 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8926 or <quote>|</quote>. If you have local accounts that include these characters, you will
8927 have to modify this rule.
8928 </para>
8929 <para>
8930 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8931 allows them because they have been encountered in practice. (Consider the
8932 common convention of local parts constructed as
8933 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8934 the author of Exim, who has no second initial.) However, a local part starting
8935 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8936 file name (for example, for a mailing list). This is also true for local parts
8937 that contain slashes. A pipe symbol can also be troublesome if the local part
8938 is incorporated unthinkingly into a shell command line.
8939 </para>
8940 <para>
8941 The second rule above applies to all other domains, and is less strict. This
8942 allows your own users to send outgoing messages to sites that use slashes
8943 and vertical bars in their local parts. It blocks local parts that begin
8944 with a dot, slash, or vertical bar, but allows these characters within the
8945 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8946 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8947 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8948 </para>
8949 <literallayout class="monospaced">
8950 accept  local_parts   = postmaster
8951         domains       = +local_domains
8952 </literallayout>
8953 <para>
8954 This statement, which has two conditions, accepts an incoming address if the
8955 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8956 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8957 reference to a named list. In this configuration, there is just one domain in
8958 <emphasis>local_domains</emphasis>, but in general there may be many.
8959 </para>
8960 <para>
8961 The presence of this statement means that mail to postmaster is never blocked
8962 by any of the subsequent tests. This can be helpful while sorting out problems
8963 in cases where the subsequent tests are incorrectly denying access.
8964 </para>
8965 <literallayout class="monospaced">
8966 require verify        = sender
8967 </literallayout>
8968 <para>
8969 This statement requires the sender address to be verified before any subsequent
8970 ACL statement can be used. If verification fails, the incoming recipient
8971 address is refused. Verification consists of trying to route the address, to
8972 see if a bounce message could be delivered to it. In the case of remote
8973 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8974 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8975 discusses the details of address verification.
8976 </para>
8977 <literallayout class="monospaced">
8978 accept  hosts         = +relay_from_hosts
8979         control       = submission
8980 </literallayout>
8981 <para>
8982 This statement accepts the address if the message is coming from one of the
8983 hosts that are defined as being allowed to relay through this host. Recipient
8984 verification is omitted here, because in many cases the clients are dumb MUAs
8985 that do not cope well with SMTP error responses. For the same reason, the
8986 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8987 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8988 messages that are deficient in some way, for example, because they lack a
8989 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8990 probably add recipient verification here, and disable submission mode.
8991 </para>
8992 <literallayout class="monospaced">
8993 accept  authenticated = *
8994         control       = submission
8995 </literallayout>
8996 <para>
8997 This statement accepts the address if the client host has authenticated itself.
8998 Submission mode is again specified, on the grounds that such messages are most
8999 likely to come from MUAs. The default configuration does not define any
9000 authenticators, though it does include some nearly complete commented-out
9001 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9002 fact authenticate until you complete the authenticator definitions.
9003 </para>
9004 <literallayout class="monospaced">
9005 require message = relay not permitted
9006         domains = +local_domains : +relay_to_domains
9007 </literallayout>
9008 <para>
9009 This statement rejects the address if its domain is neither a local domain nor
9010 one of the domains for which this host is a relay.
9011 </para>
9012 <literallayout class="monospaced">
9013 require verify = recipient
9014 </literallayout>
9015 <para>
9016 This statement requires the recipient address to be verified; if verification
9017 fails, the address is rejected.
9018 </para>
9019 <literallayout class="monospaced">
9020 # deny    message     = rejected because $sender_host_address \
9021 #                       is in a black list at $dnslist_domain\n\
9022 #                       $dnslist_text
9023 #         dnslists    = black.list.example
9024 #
9025 # warn    dnslists    = black.list.example
9026 #         add_header  = X-Warning: $sender_host_address is in \
9027 #                       a black list at $dnslist_domain
9028 #         log_message = found in $dnslist_domain
9029 </literallayout>
9030 <para>
9031 These commented-out lines are examples of how you could configure Exim to check
9032 sending hosts against a DNS black list. The first statement rejects messages
9033 from blacklisted hosts, whereas the second just inserts a warning header
9034 line.
9035 </para>
9036 <literallayout class="monospaced">
9037 # require verify = csa
9038 </literallayout>
9039 <para>
9040 This commented-out line is an example of how you could turn on client SMTP
9041 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9042 records.
9043 </para>
9044 <literallayout class="monospaced">
9045 accept
9046 </literallayout>
9047 <para>
9048 The final statement in the first ACL unconditionally accepts any recipient
9049 address that has successfully passed all the previous tests.
9050 </para>
9051 <literallayout class="monospaced">
9052 acl_check_data:
9053 </literallayout>
9054 <para>
9055 This line marks the start of the second ACL, and names it. Most of the contents
9056 of this ACL are commented out:
9057 </para>
9058 <literallayout class="monospaced">
9059 # deny    malware   = *
9060 #         message   = This message contains a virus \
9061 #                     ($malware_name).
9062 </literallayout>
9063 <para>
9064 These lines are examples of how to arrange for messages to be scanned for
9065 viruses when Exim has been compiled with the content-scanning extension, and a
9066 suitable virus scanner is installed. If the message is found to contain a
9067 virus, it is rejected with the given custom error message.
9068 </para>
9069 <literallayout class="monospaced">
9070 # warn    spam      = nobody
9071 #         message   = X-Spam_score: $spam_score\n\
9072 #                     X-Spam_score_int: $spam_score_int\n\
9073 #                     X-Spam_bar: $spam_bar\n\
9074 #                     X-Spam_report: $spam_report
9075 </literallayout>
9076 <para>
9077 These lines are an example of how to arrange for messages to be scanned by
9078 SpamAssassin when Exim has been compiled with the content-scanning extension,
9079 and SpamAssassin has been installed. The SpamAssassin check is run with
9080 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9081 series of extra header line. In this case, the message is not rejected,
9082 whatever the spam score.
9083 </para>
9084 <literallayout class="monospaced">
9085 accept
9086 </literallayout>
9087 <para>
9088 This final line in the DATA ACL accepts the message unconditionally.
9089 </para>
9090 </section>
9091 <section id="SECID55">
9092 <title>Router configuration</title>
9093 <para>
9094 <indexterm role="concept">
9095 <primary>default</primary>
9096 <secondary>routers</secondary>
9097 </indexterm>
9098 <indexterm role="concept">
9099 <primary>routers</primary>
9100 <secondary>default</secondary>
9101 </indexterm>
9102 The router configuration comes next in the default configuration, introduced
9103 by the line
9104 </para>
9105 <literallayout class="monospaced">
9106 begin routers
9107 </literallayout>
9108 <para>
9109 Routers are the modules in Exim that make decisions about where to send
9110 messages. An address is passed to each router in turn, until it is either
9111 accepted, or failed. This means that the order in which you define the routers
9112 matters. Each router is fully described in its own chapter later in this
9113 manual. Here we give only brief overviews.
9114 </para>
9115 <literallayout class="monospaced">
9116 # domain_literal:
9117 #   driver = ipliteral
9118 #   domains = !+local_domains
9119 #   transport = remote_smtp
9120 </literallayout>
9121 <para>
9122 <indexterm role="concept">
9123 <primary>domain literal</primary>
9124 <secondary>default router</secondary>
9125 </indexterm>
9126 This router is commented out because the majority of sites do not want to
9127 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9128 you uncomment this router, you also need to uncomment the setting of
9129 <option>allow_domain_literals</option> in the main part of the configuration.
9130 </para>
9131 <literallayout class="monospaced">
9132 dnslookup:
9133   driver = dnslookup
9134   domains = ! +local_domains
9135   transport = remote_smtp
9136   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9137   no_more
9138 </literallayout>
9139 <para>
9140 The first uncommented router handles addresses that do not involve any local
9141 domains. This is specified by the line
9142 </para>
9143 <literallayout class="monospaced">
9144 domains = ! +local_domains
9145 </literallayout>
9146 <para>
9147 The <option>domains</option> option lists the domains to which this router applies, but the
9148 exclamation mark is a negation sign, so the router is used only for domains
9149 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9150 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9151 indicates that it is referring to a named list. Addresses in other domains are
9152 passed on to the following routers.
9153 </para>
9154 <para>
9155 The name of the router driver is <command>dnslookup</command>,
9156 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9157 the name of this router instance is the same as the name of the driver. The
9158 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9159 one of the driver modules that is in the Exim binary.
9160 </para>
9161 <para>
9162 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9163 DNS in order to obtain a list of hosts to which the address is routed. If the
9164 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9165 specified by the <option>transport</option> option. If the router does not find the domain
9166 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9167 the address fails and is bounced.
9168 </para>
9169 <para>
9170 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9171 be entirely ignored. This option is present because a number of cases have been
9172 encountered where MX records in the DNS point to host names
9173 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9174 Completely ignoring these IP addresses causes Exim to fail to route the
9175 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9176 continue to try to deliver the message periodically until the address timed
9177 out.
9178 </para>
9179 <literallayout class="monospaced">
9180 system_aliases:
9181   driver = redirect
9182   allow_fail
9183   allow_defer
9184   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9185 # user = exim
9186   file_transport = address_file
9187   pipe_transport = address_pipe
9188 </literallayout>
9189 <para>
9190 Control reaches this and subsequent routers only for addresses in the local
9191 domains. This router checks to see whether the local part is defined as an
9192 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9193 data that it looks up from that file. If no data is found for the local part,
9194 the value of the <option>data</option> option is empty, causing the address to be passed to
9195 the next router.
9196 </para>
9197 <para>
9198 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9199 often used. That is why it is referenced by from the default configuration
9200 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9201 <filename>Local/Makefile</filename> before building Exim.
9202 </para>
9203 <literallayout class="monospaced">
9204 userforward:
9205   driver = redirect
9206   check_local_user
9207 # local_part_suffix = +* : -*
9208 # local_part_suffix_optional
9209   file = $home/.forward
9210 # allow_filter
9211   no_verify
9212   no_expn
9213   check_ancestor
9214   file_transport = address_file
9215   pipe_transport = address_pipe
9216   reply_transport = address_reply
9217 </literallayout>
9218 <para>
9219 This is the most complicated router in the default configuration. It is another
9220 redirection router, but this time it is looking for forwarding data set up by
9221 individual users. The <option>check_local_user</option> setting specifies a check that the
9222 local part of the address is the login name of a local user. If it is not, the
9223 router is skipped. The two commented options that follow <option>check_local_user</option>,
9224 namely:
9225 </para>
9226 <literallayout class="monospaced">
9227 # local_part_suffix = +* : -*
9228 # local_part_suffix_optional
9229 </literallayout>
9230 <para>
9231 <indexterm role="variable">
9232 <primary><varname>$local_part_suffix</varname></primary>
9233 </indexterm>
9234 show how you can specify the recognition of local part suffixes. If the first
9235 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9236 by any sequence of characters, is removed from the local part and placed in the
9237 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9238 presence of a suffix in the local part is optional. When a suffix is present,
9239 the check for a local login uses the local part with the suffix removed.
9240 </para>
9241 <para>
9242 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9243 home directory is consulted. If it does not exist, or is empty, the router
9244 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9245 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9246 </para>
9247 <para>
9248 <indexterm role="concept">
9249 <primary>Sieve filter</primary>
9250 <secondary>enabling in default router</secondary>
9251 </indexterm>
9252 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9253 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9254 is commented out by default), the contents of the file are interpreted as a set
9255 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9256 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9257 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9258 </para>
9259 <para>
9260 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9261 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9262 There are two reasons for doing this:
9263 </para>
9264 <orderedlist numeration="arabic">
9265 <listitem>
9266 <para>
9267 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9268 checking an address for validity; it makes sense not to waste resources doing
9269 unnecessary work.
9270 </para>
9271 </listitem>
9272 <listitem>
9273 <para>
9274 More importantly, when Exim is verifying addresses or handling an EXPN
9275 command during an SMTP session, it is running as the Exim user, not as root.
9276 The group is the Exim group, and no additional groups are set up.
9277 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9278 this time.
9279 </para>
9280 </listitem>
9281 </orderedlist>
9282 <para>
9283 The setting of <option>check_ancestor</option> prevents the router from generating a new
9284 address that is the same as any previous address that was redirected. (This
9285 works round a problem concerning a bad interaction between aliasing and
9286 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9287 </para>
9288 <para>
9289 The final three option settings specify the transports that are to be used when
9290 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9291 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9292 </para>
9293 <literallayout class="monospaced">
9294 a.nother@elsewhere.example, /home/spqr/archive
9295 </literallayout>
9296 <para>
9297 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9298 transport.
9299 </para>
9300 <literallayout class="monospaced">
9301 localuser:
9302   driver = accept
9303   check_local_user
9304 # local_part_suffix = +* : -*
9305 # local_part_suffix_optional
9306   transport = local_delivery
9307 </literallayout>
9308 <para>
9309 The final router sets up delivery into local mailboxes, provided that the local
9310 part is the name of a local login, by accepting the address and assigning it to
9311 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9312 routers, so the address is bounced. The commented suffix settings fulfil the
9313 same purpose as they do for the <command>userforward</command> router.
9314 </para>
9315 </section>
9316 <section id="SECID56">
9317 <title>Transport configuration</title>
9318 <para>
9319 <indexterm role="concept">
9320 <primary>default</primary>
9321 <secondary>transports</secondary>
9322 </indexterm>
9323 <indexterm role="concept">
9324 <primary>transports</primary>
9325 <secondary>default</secondary>
9326 </indexterm>
9327 Transports define mechanisms for actually delivering messages. They operate
9328 only when referenced from routers, so the order in which they are defined does
9329 not matter. The transports section of the configuration starts with
9330 </para>
9331 <literallayout class="monospaced">
9332 begin transports
9333 </literallayout>
9334 <para>
9335 One remote transport and four local transports are defined.
9336 </para>
9337 <literallayout class="monospaced">
9338 remote_smtp:
9339   driver = smtp
9340   hosts_try_prdr = *
9341 </literallayout>
9342 <para>
9343 This transport is used for delivering messages over SMTP connections.
9344 The list of remote hosts comes from the router.
9345 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9346 It is negotiated between client and server
9347 and not expected to cause problems but can be disabled if needed.
9348 All other options are defaulted.
9349 </para>
9350 <literallayout class="monospaced">
9351 local_delivery:
9352   driver = appendfile
9353   file = /var/mail/$local_part
9354   delivery_date_add
9355   envelope_to_add
9356   return_path_add
9357 # group = mail
9358 # mode = 0660
9359 </literallayout>
9360 <para>
9361 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9362 traditional BSD mailbox format. By default it runs under the uid and gid of the
9363 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9364 directory. Some systems use the alternative approach of running mail deliveries
9365 under a particular group instead of using the sticky bit. The commented options
9366 show how this can be done.
9367 </para>
9368 <para>
9369 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9370 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9371 similarly-named options above.
9372 </para>
9373 <literallayout class="monospaced">
9374 address_pipe:
9375   driver = pipe
9376   return_output
9377 </literallayout>
9378 <para>
9379 This transport is used for handling deliveries to pipes that are generated by
9380 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9381 option specifies that any output on stdout or stderr generated by the pipe is to
9382 be returned to the sender.
9383 </para>
9384 <literallayout class="monospaced">
9385 address_file:
9386   driver = appendfile
9387   delivery_date_add
9388   envelope_to_add
9389   return_path_add
9390 </literallayout>
9391 <para>
9392 This transport is used for handling deliveries to files that are generated by
9393 redirection. The name of the file is not specified in this instance of
9394 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9395 </para>
9396 <literallayout class="monospaced">
9397 address_reply:
9398   driver = autoreply
9399 </literallayout>
9400 <para>
9401 This transport is used for handling automatic replies generated by users&#x2019;
9402 filter files.
9403 </para>
9404 </section>
9405 <section id="SECID57">
9406 <title>Default retry rule</title>
9407 <para>
9408 <indexterm role="concept">
9409 <primary>retry</primary>
9410 <secondary>default rule</secondary>
9411 </indexterm>
9412 <indexterm role="concept">
9413 <primary>default</primary>
9414 <secondary>retry rule</secondary>
9415 </indexterm>
9416 The retry section of the configuration file contains rules which affect the way
9417 Exim retries deliveries that cannot be completed at the first attempt. It is
9418 introduced by the line
9419 </para>
9420 <literallayout class="monospaced">
9421 begin retry
9422 </literallayout>
9423 <para>
9424 In the default configuration, there is just one rule, which applies to all
9425 errors:
9426 </para>
9427 <literallayout class="monospaced">
9428 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9429 </literallayout>
9430 <para>
9431 This causes any temporarily failing address to be retried every 15 minutes for
9432 2 hours, then at intervals starting at one hour and increasing by a factor of
9433 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9434 is not delivered after 4 days of temporary failure, it is bounced. The time is
9435 measured from first failure, not from the time the message was received.
9436 </para>
9437 <para>
9438 If the retry section is removed from the configuration, or is empty (that is,
9439 if no retry rules are defined), Exim will not retry deliveries. This turns
9440 temporary errors into permanent errors.
9441 </para>
9442 </section>
9443 <section id="SECID58">
9444 <title>Rewriting configuration</title>
9445 <para>
9446 The rewriting section of the configuration, introduced by
9447 </para>
9448 <literallayout class="monospaced">
9449 begin rewrite
9450 </literallayout>
9451 <para>
9452 contains rules for rewriting addresses in messages as they arrive. There are no
9453 rewriting rules in the default configuration file.
9454 </para>
9455 </section>
9456 <section id="SECTdefconfauth">
9457 <title>Authenticators configuration</title>
9458 <para>
9459 <indexterm role="concept">
9460 <primary>AUTH</primary>
9461 <secondary>configuration</secondary>
9462 </indexterm>
9463 The authenticators section of the configuration, introduced by
9464 </para>
9465 <literallayout class="monospaced">
9466 begin authenticators
9467 </literallayout>
9468 <para>
9469 defines mechanisms for the use of the SMTP AUTH command. The default
9470 configuration file contains two commented-out example authenticators
9471 which support plaintext username/password authentication using the
9472 standard PLAIN mechanism and the traditional but non-standard LOGIN
9473 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9474 to support most MUA software.
9475 </para>
9476 <para>
9477 The example PLAIN authenticator looks like this:
9478 </para>
9479 <literallayout class="monospaced">
9480 #PLAIN:
9481 #  driver                  = plaintext
9482 #  server_set_id           = $auth2
9483 #  server_prompts          = :
9484 #  server_condition        = Authentication is not yet configured
9485 #  server_advertise_condition = ${if def:tls_in_cipher }
9486 </literallayout>
9487 <para>
9488 And the example LOGIN authenticator looks like this:
9489 </para>
9490 <literallayout class="monospaced">
9491 #LOGIN:
9492 #  driver                  = plaintext
9493 #  server_set_id           = $auth1
9494 #  server_prompts          = &lt;| Username: | Password:
9495 #  server_condition        = Authentication is not yet configured
9496 #  server_advertise_condition = ${if def:tls_in_cipher }
9497 </literallayout>
9498 <para>
9499 The <option>server_set_id</option> option makes Exim remember the authenticated username
9500 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9501 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9502 that it implements the details of the specific authentication mechanism,
9503 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9504 when Exim offers authentication to clients; in the examples, this is only
9505 when TLS or SSL has been started, so to enable the authenticators you also
9506 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9507 </para>
9508 <para>
9509 The <option>server_condition</option> setting defines how to verify that the username and
9510 password are correct. In the examples it just produces an error message.
9511 To make the authenticators work, you can use a string expansion
9512 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9513 </para>
9514 <para>
9515 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9516 usercode and password are in different positions.
9517 Chapter <xref linkend="CHAPplaintext"/> covers both.
9518 </para>
9519 <para>
9520 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9521 </para>
9522 </section>
9523 </chapter>
9524
9525 <chapter id="CHAPregexp">
9526 <title>Regular expressions</title>
9527 <para>
9528 <indexterm role="concept">
9529 <primary>regular expressions</primary>
9530 <secondary>library</secondary>
9531 </indexterm>
9532 <indexterm role="concept">
9533 <primary>PCRE</primary>
9534 </indexterm>
9535 Exim supports the use of regular expressions in many of its options. It
9536 uses the PCRE regular expression library; this provides regular expression
9537 matching that is compatible with Perl 5. The syntax and semantics of
9538 regular expressions is discussed in
9539 online Perl manpages, in
9540 many Perl reference books, and also in
9541 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9542 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9543 </para>
9544 <para>
9545 The documentation for the syntax and semantics of the regular expressions that
9546 are supported by PCRE is included in the PCRE distribution, and no further
9547 description is included here. The PCRE functions are called from Exim using
9548 the default option settings (that is, with no PCRE options set), except that
9549 the PCRE_CASELESS option is set when the matching is required to be
9550 case-insensitive.
9551 </para>
9552 <para>
9553 In most cases, when a regular expression is required in an Exim configuration,
9554 it has to start with a circumflex, in order to distinguish it from plain text
9555 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9556 second item in the colon-separated list is a regular expression.
9557 </para>
9558 <literallayout class="monospaced">
9559 domains = a.b.c : ^\\d{3} : *.y.z : ...
9560 </literallayout>
9561 <para>
9562 The doubling of the backslash is required because of string expansion that
9563 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9564 of this issue, and a way of avoiding the need for doubling backslashes. The
9565 regular expression that is eventually used in this example contains just one
9566 backslash. The circumflex is included in the regular expression, and has the
9567 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9568 matched.
9569 </para>
9570 <para>
9571 There are, however, two cases where a circumflex is not required for the
9572 recognition of a regular expression: these are the <option>match</option> condition in a
9573 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9574 these cases, the relevant string is always treated as a regular expression; if
9575 it does not start with a circumflex, the expression is not anchored, and can
9576 match anywhere in the subject string.
9577 </para>
9578 <para>
9579 In all cases, if you want a regular expression to match at the end of a string,
9580 you must code the $ metacharacter to indicate this. For example:
9581 </para>
9582 <literallayout class="monospaced">
9583 domains = ^\\d{3}\\.example
9584 </literallayout>
9585 <para>
9586 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9587 You need to use:
9588 </para>
9589 <literallayout class="monospaced">
9590 domains = ^\\d{3}\\.example\$
9591 </literallayout>
9592 <para>
9593 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9594 $ is needed because string expansion also interprets dollar characters.
9595 </para>
9596 </chapter>
9597
9598 <chapter id="CHAPfdlookup">
9599 <title>File and database lookups</title>
9600 <para>
9601 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9602 <primary>file</primary>
9603 <secondary>lookups</secondary>
9604 </indexterm>
9605 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9606 <primary>database</primary>
9607 <secondary>lookups</secondary>
9608 </indexterm>
9609 <indexterm role="concept">
9610 <primary>lookup</primary>
9611 <secondary>description of</secondary>
9612 </indexterm>
9613 Exim can be configured to look up data in files or databases as it processes
9614 messages. Two different kinds of syntax are used:
9615 </para>
9616 <orderedlist numeration="arabic">
9617 <listitem>
9618 <para>
9619 A string that is to be expanded may contain explicit lookup requests. These
9620 cause parts of the string to be replaced by data that is obtained from the
9621 lookup. Lookups of this type are conditional expansion items. Different results
9622 can be defined for the cases of lookup success and failure. See chapter
9623 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9624 The key for the lookup is specified as part of the string expansion.
9625 </para>
9626 </listitem>
9627 <listitem>
9628 <para>
9629 Lists of domains, hosts, and email addresses can contain lookup requests as a
9630 way of avoiding excessively long linear lists. In this case, the data that is
9631 returned by the lookup is often (but not always) discarded; whether the lookup
9632 succeeds or fails is what really counts. These kinds of list are described in
9633 chapter <xref linkend="CHAPdomhosaddlists"/>.
9634 The key for the lookup is given by the context in which the list is expanded.
9635 </para>
9636 </listitem>
9637 </orderedlist>
9638 <para>
9639 String expansions, lists, and lookups interact with each other in such a way
9640 that there is no order in which to describe any one of them that does not
9641 involve references to the others. Each of these three chapters makes more sense
9642 if you have read the other two first. If you are reading this for the first
9643 time, be aware that some of it will make a lot more sense after you have read
9644 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9645 </para>
9646 <section id="SECID60">
9647 <title>Examples of different lookup syntax</title>
9648 <para>
9649 It is easy to confuse the two different kinds of lookup, especially as the
9650 lists that may contain the second kind are always expanded before being
9651 processed as lists. Therefore, they may also contain lookups of the first kind.
9652 Be careful to distinguish between the following two examples:
9653 </para>
9654 <literallayout class="monospaced">
9655 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9656 domains = lsearch;/some/file
9657 </literallayout>
9658 <para>
9659 The first uses a string expansion, the result of which must be a domain list.
9660 No strings have been specified for a successful or a failing lookup; the
9661 defaults in this case are the looked-up data and an empty string, respectively.
9662 The expansion takes place before the string is processed as a list, and the
9663 file that is searched could contain lines like this:
9664 </para>
9665 <literallayout class="monospaced">
9666 192.168.3.4: domain1:domain2:...
9667 192.168.1.9: domain3:domain4:...
9668 </literallayout>
9669 <para>
9670 When the lookup succeeds, the result of the expansion is a list of domains (and
9671 possibly other types of item that are allowed in domain lists).
9672 </para>
9673 <para>
9674 In the second example, the lookup is a single item in a domain list. It causes
9675 Exim to use a lookup to see if the domain that is being processed can be found
9676 in the file. The file could contains lines like this:
9677 </para>
9678 <literallayout class="monospaced">
9679 domain1:
9680 domain2:
9681 </literallayout>
9682 <para>
9683 Any data that follows the keys is not relevant when checking that the domain
9684 matches the list item.
9685 </para>
9686 <para>
9687 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9688 Consider a file containing lines like this:
9689 </para>
9690 <literallayout class="monospaced">
9691 192.168.5.6: lsearch;/another/file
9692 </literallayout>
9693 <para>
9694 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9695 first <option>domains</option> setting above generates the second setting, which therefore
9696 causes a second lookup to occur.
9697 </para>
9698 <para>
9699 The rest of this chapter describes the different lookup types that are
9700 available. Any of them can be used in any part of the configuration where a
9701 lookup is permitted.
9702 </para>
9703 </section>
9704 <section id="SECID61">
9705 <title>Lookup types</title>
9706 <para>
9707 <indexterm role="concept">
9708 <primary>lookup</primary>
9709 <secondary>types of</secondary>
9710 </indexterm>
9711 <indexterm role="concept">
9712 <primary>single-key lookup</primary>
9713 <secondary>definition of</secondary>
9714 </indexterm>
9715 Two different types of data lookup are implemented:
9716 </para>
9717 <itemizedlist>
9718 <listitem>
9719 <para>
9720 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9721 and a single key to search for. The key must be a non-empty string for the
9722 lookup to succeed. The lookup type determines how the file is searched.
9723 </para>
9724 </listitem>
9725 <listitem>
9726 <para>
9727 <indexterm role="concept">
9728 <primary>query-style lookup</primary>
9729 <secondary>definition of</secondary>
9730 </indexterm>
9731 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9732 key value is assumed by Exim for query-style lookups. You can use whichever
9733 Exim variables you need to construct the database query.
9734 </para>
9735 </listitem>
9736 </itemizedlist>
9737 <para>
9738 The code for each lookup type is in a separate source file that is included in
9739 the binary of Exim only if the corresponding compile-time option is set. The
9740 default settings in <filename>src/EDITME</filename> are:
9741 </para>
9742 <literallayout class="monospaced">
9743 LOOKUP_DBM=yes
9744 LOOKUP_LSEARCH=yes
9745 </literallayout>
9746 <para>
9747 which means that only linear searching and DBM lookups are included by default.
9748 For some types of lookup (e.g. SQL databases), you need to install appropriate
9749 libraries and header files before building Exim.
9750 </para>
9751 </section>
9752 <section id="SECTsinglekeylookups">
9753 <title>Single-key lookup types</title>
9754 <para>
9755 <indexterm role="concept">
9756 <primary>lookup</primary>
9757 <secondary>single-key types</secondary>
9758 </indexterm>
9759 <indexterm role="concept">
9760 <primary>single-key lookup</primary>
9761 <secondary>list of types</secondary>
9762 </indexterm>
9763 The following single-key lookup types are implemented:
9764 </para>
9765 <itemizedlist>
9766 <listitem>
9767 <para>
9768 <indexterm role="concept">
9769 <primary>cdb</primary>
9770 <secondary>description of</secondary>
9771 </indexterm>
9772 <indexterm role="concept">
9773 <primary>lookup</primary>
9774 <secondary>cdb</secondary>
9775 </indexterm>
9776 <indexterm role="concept">
9777 <primary>binary zero</primary>
9778 <secondary>in lookup key</secondary>
9779 </indexterm>
9780 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9781 string without a terminating binary zero. The cdb format is designed for
9782 indexed files that are read frequently and never updated, except by total
9783 re-creation. As such, it is particularly suitable for large files containing
9784 aliases or other indexed data referenced by an MTA. Information about cdb can
9785 be found in several places:
9786 </para>
9787 <literallayout>
9788 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9789 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9790 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9791 </literallayout>
9792 <para>
9793 A cdb distribution is not needed in order to build Exim with cdb support,
9794 because the code for reading cdb files is included directly in Exim itself.
9795 However, no means of building or testing cdb files is provided with Exim, so
9796 you need to obtain a cdb distribution in order to do this.
9797 </para>
9798 </listitem>
9799 <listitem>
9800 <para>
9801 <indexterm role="concept">
9802 <primary>DBM</primary>
9803 <secondary>lookup type</secondary>
9804 </indexterm>
9805 <indexterm role="concept">
9806 <primary>lookup</primary>
9807 <secondary>dbm</secondary>
9808 </indexterm>
9809 <indexterm role="concept">
9810 <primary>binary zero</primary>
9811 <secondary>in lookup key</secondary>
9812 </indexterm>
9813 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9814 DBM file by looking up the record with the given key. A terminating binary
9815 zero is included in the key that is passed to the DBM library. See section
9816 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9817 </para>
9818 <para>
9819 <indexterm role="concept">
9820 <primary>Berkeley DB library</primary>
9821 <secondary>file format</secondary>
9822 </indexterm>
9823 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9824 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9825 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9826 the DB_UNKNOWN option. This enables it to handle any of the types of database
9827 that the library supports, and can be useful for accessing DBM files created by
9828 other applications. (For earlier DB versions, DB_HASH is always used.)
9829 </para>
9830 </listitem>
9831 <listitem>
9832 <para>
9833 <indexterm role="concept">
9834 <primary>lookup</primary>
9835 <secondary>dbmjz</secondary>
9836 </indexterm>
9837 <indexterm role="concept">
9838 <primary>lookup</primary>
9839 <secondary>dbm &ndash; embedded NULs</secondary>
9840 </indexterm>
9841 <indexterm role="concept">
9842 <primary>sasldb2</primary>
9843 </indexterm>
9844 <indexterm role="concept">
9845 <primary>dbmjz lookup type</primary>
9846 </indexterm>
9847 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9848 interpreted as an Exim list; the elements of the list are joined together with
9849 ASCII NUL characters to form the lookup key.  An example usage would be to
9850 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9851 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9852 <command>cram_md5</command> authenticator.
9853 </para>
9854 </listitem>
9855 <listitem>
9856 <para>
9857 <indexterm role="concept">
9858 <primary>lookup</primary>
9859 <secondary>dbmnz</secondary>
9860 </indexterm>
9861 <indexterm role="concept">
9862 <primary>lookup</primary>
9863 <secondary>dbm &ndash; terminating zero</secondary>
9864 </indexterm>
9865 <indexterm role="concept">
9866 <primary>binary zero</primary>
9867 <secondary>in lookup key</secondary>
9868 </indexterm>
9869 <indexterm role="concept">
9870 <primary>Courier</primary>
9871 </indexterm>
9872 <indexterm role="concept">
9873 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9874 </indexterm>
9875 <indexterm role="concept">
9876 <primary>dbmnz lookup type</primary>
9877 </indexterm>
9878 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9879 is not included in the key that is passed to the DBM library. You may need this
9880 if you want to look up data in files that are created by or shared with some
9881 other application that does not use terminating zeros. For example, you need to
9882 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9883 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9884 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9885 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9886 </para>
9887 </listitem>
9888 <listitem>
9889 <para>
9890 <indexterm role="concept">
9891 <primary>lookup</primary>
9892 <secondary>dsearch</secondary>
9893 </indexterm>
9894 <indexterm role="concept">
9895 <primary>dsearch lookup type</primary>
9896 </indexterm>
9897 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9898 whose name is the key by calling the <function>lstat()</function> function. The key may not
9899 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9900 the lookup is the name of the entry, which may be a file, directory,
9901 symbolic link, or any other kind of directory entry. An example of how this
9902 lookup can be used to support virtual domains is given in section
9903 <xref linkend="SECTvirtualdomains"/>.
9904 </para>
9905 </listitem>
9906 <listitem>
9907 <para>
9908 <indexterm role="concept">
9909 <primary>lookup</primary>
9910 <secondary>iplsearch</secondary>
9911 </indexterm>
9912 <indexterm role="concept">
9913 <primary>iplsearch lookup type</primary>
9914 </indexterm>
9915 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9916 terminated by a colon or white space or the end of the line. The keys in the
9917 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9918 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9919 being interpreted as a key terminator. For example:
9920 </para>
9921 <literallayout class="monospaced">
9922 1.2.3.4:           data for 1.2.3.4
9923 192.168.0.0/16:    data for 192.168.0.0/16
9924 "abcd::cdab":      data for abcd::cdab
9925 "abcd:abcd::/32"   data for abcd:abcd::/32
9926 </literallayout>
9927 <para>
9928 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9929 file is searched linearly, using the CIDR masks where present, until a matching
9930 key is found. The first key that matches is used; there is no attempt to find a
9931 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9932 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9933 </para>
9934 <para>
9935 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9936 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9937 lookup types support only literal keys.
9938 </para>
9939 <para>
9940 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9941 the implicit key is the host&#x2019;s IP address rather than its name (see section
9942 <xref linkend="SECThoslispatsikey"/>).
9943 </para>
9944 </listitem>
9945 <listitem>
9946 <para>
9947 <indexterm role="concept">
9948 <primary>linear search</primary>
9949 </indexterm>
9950 <indexterm role="concept">
9951 <primary>lookup</primary>
9952 <secondary>lsearch</secondary>
9953 </indexterm>
9954 <indexterm role="concept">
9955 <primary>lsearch lookup type</primary>
9956 </indexterm>
9957 <indexterm role="concept">
9958 <primary>case sensitivity</primary>
9959 <secondary>in lsearch lookup</secondary>
9960 </indexterm>
9961 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9962 line beginning with the search key, terminated by a colon or white space or the
9963 end of the line. The search is case-insensitive; that is, upper and lower case
9964 letters are treated as the same. The first occurrence of the key that is found
9965 in the file is used.
9966 </para>
9967 <para>
9968 White space between the key and the colon is permitted. The remainder of the
9969 line, with leading and trailing white space removed, is the data. This can be
9970 continued onto subsequent lines by starting them with any amount of white
9971 space, but only a single space character is included in the data at such a
9972 junction. If the data begins with a colon, the key must be terminated by a
9973 colon, for example:
9974 </para>
9975 <literallayout class="monospaced">
9976 baduser:  :fail:
9977 </literallayout>
9978 <para>
9979 Empty lines and lines beginning with # are ignored, even if they occur in the
9980 middle of an item. This is the traditional textual format of alias files. Note
9981 that the keys in an <command>lsearch</command> file are literal strings. There is no
9982 wildcarding of any kind.
9983 </para>
9984 <para>
9985 <indexterm role="concept">
9986 <primary>lookup</primary>
9987 <secondary>lsearch &ndash; colons in keys</secondary>
9988 </indexterm>
9989 <indexterm role="concept">
9990 <primary>white space</primary>
9991 <secondary>in lsearch key</secondary>
9992 </indexterm>
9993 In most <command>lsearch</command> files, keys are not required to contain colons or #
9994 characters, or white space. However, if you need this feature, it is available.
9995 If a key begins with a doublequote character, it is terminated only by a
9996 matching quote (or end of line), and the normal escaping rules apply to its
9997 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9998 quoted keys (exactly as for unquoted keys). There is no special handling of
9999 quotes for the data part of an <command>lsearch</command> line.
10000 </para>
10001 </listitem>
10002 <listitem>
10003 <para>
10004 <indexterm role="concept">
10005 <primary>NIS lookup type</primary>
10006 </indexterm>
10007 <indexterm role="concept">
10008 <primary>lookup</primary>
10009 <secondary>NIS</secondary>
10010 </indexterm>
10011 <indexterm role="concept">
10012 <primary>binary zero</primary>
10013 <secondary>in lookup key</secondary>
10014 </indexterm>
10015 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
10016 the given key, without a terminating binary zero. There is a variant called
10017 <command>nis0</command> which does include the terminating binary zero in the key. This is
10018 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10019 aliases; the full map names must be used.
10020 </para>
10021 </listitem>
10022 <listitem>
10023 <para>
10024 <indexterm role="concept">
10025 <primary>wildlsearch lookup type</primary>
10026 </indexterm>
10027 <indexterm role="concept">
10028 <primary>lookup</primary>
10029 <secondary>wildlsearch</secondary>
10030 </indexterm>
10031 <indexterm role="concept">
10032 <primary>nwildlsearch lookup type</primary>
10033 </indexterm>
10034 <indexterm role="concept">
10035 <primary>lookup</primary>
10036 <secondary>nwildlsearch</secondary>
10037 </indexterm>
10038 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10039 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10040 the file may be wildcarded. The difference between these two lookup types is
10041 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10042 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10043 </para>
10044 <para>
10045 <indexterm role="concept">
10046 <primary>case sensitivity</primary>
10047 <secondary>in (n)wildlsearch lookup</secondary>
10048 </indexterm>
10049 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10050 file that are regular expressions can be made case-sensitive by the use of
10051 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10052 </para>
10053 <orderedlist numeration="arabic">
10054 <listitem>
10055 <para>
10056 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10057 </para>
10058 <literallayout class="monospaced">
10059     *.a.b.c       data for anything.a.b.c
10060     *fish         data for anythingfish
10061 </literallayout>
10062 </listitem>
10063 <listitem>
10064 <para>
10065 The string may begin with a circumflex to indicate a regular expression. For
10066 example, for <command>wildlsearch</command>:
10067 </para>
10068 <literallayout class="monospaced">
10069     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10070 </literallayout>
10071 <para>
10072 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10073 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10074 string-expanded, the equivalent entry is:
10075 </para>
10076 <literallayout class="monospaced">
10077     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10078 </literallayout>
10079 <para>
10080 The case-insensitive flag is set at the start of compiling the regular
10081 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10082 For example, to make the entire pattern case-sensitive:
10083 </para>
10084 <literallayout class="monospaced">
10085     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10086 </literallayout>
10087 <para>
10088 If the regular expression contains white space or colon characters, you must
10089 either quote it (see <command>lsearch</command> above), or represent these characters in other
10090 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10091 colon. This may be easier than quoting, because if you quote, you have to
10092 escape all the backslashes inside the quotes.
10093 </para>
10094 <para>
10095 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10096 match for later use, because the results of all lookups are cached. If a lookup
10097 is repeated, the result is taken from the cache, and no actual pattern matching
10098 takes place. The values of all the numeric variables are unset after a
10099 <command>(n)wildlsearch</command> match.
10100 </para>
10101 </listitem>
10102 <listitem>
10103 <para>
10104 Although I cannot see it being of much use, the general matching function that
10105 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10106 lookup name terminated by a semicolon, and followed by lookup data. For
10107 example:
10108 </para>
10109 <literallayout class="monospaced">
10110     cdb;/some/file  data for keys that match the file
10111 </literallayout>
10112 <para>
10113 The data that is obtained from the nested lookup is discarded.
10114 </para>
10115 </listitem>
10116 </orderedlist>
10117 <para>
10118 Keys that do not match any of these patterns are interpreted literally. The
10119 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10120 be followed by optional colons.
10121 </para>
10122 <para>
10123 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10124 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10125 lookup types support only literal keys.
10126 </para>
10127 </listitem>
10128 </itemizedlist>
10129 </section>
10130 <section id="SECTquerystylelookups">
10131 <title>Query-style lookup types</title>
10132 <para>
10133 <indexterm role="concept">
10134 <primary>lookup</primary>
10135 <secondary>query-style types</secondary>
10136 </indexterm>
10137 <indexterm role="concept">
10138 <primary>query-style lookup</primary>
10139 <secondary>list of types</secondary>
10140 </indexterm>
10141 The supported query-style lookup types are listed below. Further details about
10142 many of them are given in later sections.
10143 </para>
10144 <itemizedlist>
10145 <listitem>
10146 <para>
10147 <indexterm role="concept">
10148 <primary>DNS</primary>
10149 <secondary>as a lookup type</secondary>
10150 </indexterm>
10151 <indexterm role="concept">
10152 <primary>lookup</primary>
10153 <secondary>DNS</secondary>
10154 </indexterm>
10155 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10156 are given in the supplied query. The resulting data is the contents of the
10157 records. See section <xref linkend="SECTdnsdb"/>.
10158 </para>
10159 </listitem>
10160 <listitem>
10161 <para>
10162 <indexterm role="concept">
10163 <primary>InterBase lookup type</primary>
10164 </indexterm>
10165 <indexterm role="concept">
10166 <primary>lookup</primary>
10167 <secondary>InterBase</secondary>
10168 </indexterm>
10169 <command>ibase</command>: This does a lookup in an InterBase database.
10170 </para>
10171 </listitem>
10172 <listitem>
10173 <para>
10174 <indexterm role="concept">
10175 <primary>LDAP</primary>
10176 <secondary>lookup type</secondary>
10177 </indexterm>
10178 <indexterm role="concept">
10179 <primary>lookup</primary>
10180 <secondary>LDAP</secondary>
10181 </indexterm>
10182 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10183 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10184 that permits values from multiple entries to be returned. A third variant
10185 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10186 any attribute values. See section <xref linkend="SECTldap"/>.
10187 </para>
10188 </listitem>
10189 <listitem>
10190 <para>
10191 <indexterm role="concept">
10192 <primary>MySQL</primary>
10193 <secondary>lookup type</secondary>
10194 </indexterm>
10195 <indexterm role="concept">
10196 <primary>lookup</primary>
10197 <secondary>MySQL</secondary>
10198 </indexterm>
10199 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10200 MySQL database. See section <xref linkend="SECTsql"/>.
10201 </para>
10202 </listitem>
10203 <listitem>
10204 <para>
10205 <indexterm role="concept">
10206 <primary>NIS+ lookup type</primary>
10207 </indexterm>
10208 <indexterm role="concept">
10209 <primary>lookup</primary>
10210 <secondary>NIS+</secondary>
10211 </indexterm>
10212 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10213 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10214 </para>
10215 </listitem>
10216 <listitem>
10217 <para>
10218 <indexterm role="concept">
10219 <primary>Oracle</primary>
10220 <secondary>lookup type</secondary>
10221 </indexterm>
10222 <indexterm role="concept">
10223 <primary>lookup</primary>
10224 <secondary>Oracle</secondary>
10225 </indexterm>
10226 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10227 Oracle database. See section <xref linkend="SECTsql"/>.
10228 </para>
10229 </listitem>
10230 <listitem>
10231 <para>
10232 <indexterm role="concept">
10233 <primary>lookup</primary>
10234 <secondary>passwd</secondary>
10235 </indexterm>
10236 <indexterm role="concept">
10237 <primary>passwd lookup type</primary>
10238 </indexterm>
10239 <indexterm role="concept">
10240 <primary><filename>/etc/passwd</filename></primary>
10241 </indexterm>
10242 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10243 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10244 success, the result string is the same as you would get from an <command>lsearch</command>
10245 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10246 password value. For example:
10247 </para>
10248 <literallayout class="monospaced">
10249 *:42:42:King Rat:/home/kr:/bin/bash
10250 </literallayout>
10251 </listitem>
10252 <listitem>
10253 <para>
10254 <indexterm role="concept">
10255 <primary>PostgreSQL lookup type</primary>
10256 </indexterm>
10257 <indexterm role="concept">
10258 <primary>lookup</primary>
10259 <secondary>PostgreSQL</secondary>
10260 </indexterm>
10261 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10262 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10263 </para>
10264 </listitem>
10265 <listitem>
10266 <para>
10267 <indexterm role="concept">
10268 <primary>Redis lookup type</primary>
10269 </indexterm>
10270 <indexterm role="concept">
10271 <primary>lookup</primary>
10272 <secondary>Redis</secondary>
10273 </indexterm>
10274 <command>redis</command>: The format of the query is either a simple get or simple set,
10275 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10276 </para>
10277 </listitem>
10278 <listitem>
10279 <para>
10280 <indexterm role="concept">
10281 <primary>sqlite lookup type</primary>
10282 </indexterm>
10283 <indexterm role="concept">
10284 <primary>lookup</primary>
10285 <secondary>sqlite</secondary>
10286 </indexterm>
10287 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10288 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10289 </para>
10290 </listitem>
10291 <listitem>
10292 <para>
10293 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10294 not likely to be useful in normal operation.
10295 </para>
10296 </listitem>
10297 <listitem>
10298 <para>
10299 <indexterm role="concept">
10300 <primary>whoson lookup type</primary>
10301 </indexterm>
10302 <indexterm role="concept">
10303 <primary>lookup</primary>
10304 <secondary>whoson</secondary>
10305 </indexterm>
10306 <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
10307 allows a server to check whether a particular (dynamically allocated) IP
10308 address is currently allocated to a known (trusted) user and, optionally, to
10309 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10310 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10311 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10312 <quote>POP before SMTP</quote> checking using ACL statements such as
10313 </para>
10314 <literallayout class="monospaced">
10315 require condition = \
10316   ${lookup whoson {$sender_host_address}{yes}{no}}
10317 </literallayout>
10318 <para>
10319 The query consists of a single IP address. The value returned is the name of
10320 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10321 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10322 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10323 </para>
10324 </listitem>
10325 </itemizedlist>
10326 </section>
10327 <section id="SECID63">
10328 <title>Temporary errors in lookups</title>
10329 <para>
10330 <indexterm role="concept">
10331 <primary>lookup</primary>
10332 <secondary>temporary error in</secondary>
10333 </indexterm>
10334 Lookup functions can return temporary error codes if the lookup cannot be
10335 completed. For example, an SQL or LDAP database might be unavailable. For this
10336 reason, it is not advisable to use a lookup that might do this for critical
10337 options such as a list of local domains.
10338 </para>
10339 <para>
10340 When a lookup cannot be completed in a router or transport, delivery
10341 of the message (to the relevant address) is deferred, as for any other
10342 temporary error. In other circumstances Exim may assume the lookup has failed,
10343 or may give up altogether.
10344 </para>
10345 </section>
10346 <section id="SECTdefaultvaluelookups">
10347 <title>Default values in single-key lookups</title>
10348 <para>
10349 <indexterm role="concept">
10350 <primary>wildcard lookups</primary>
10351 </indexterm>
10352 <indexterm role="concept">
10353 <primary>lookup</primary>
10354 <secondary>default values</secondary>
10355 </indexterm>
10356 <indexterm role="concept">
10357 <primary>lookup</primary>
10358 <secondary>wildcard</secondary>
10359 </indexterm>
10360 <indexterm role="concept">
10361 <primary>lookup</primary>
10362 <secondary>* added to type</secondary>
10363 </indexterm>
10364 <indexterm role="concept">
10365 <primary>default</primary>
10366 <secondary>in single-key lookups</secondary>
10367 </indexterm>
10368 In this context, a <quote>default value</quote> is a value specified by the administrator
10369 that is to be used if a lookup fails.
10370 </para>
10371 <para>
10372 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10373 lookups, the facilities of the query language must be used. An attempt to
10374 specify a default for a query-style lookup provokes an error.
10375 </para>
10376 <para>
10377 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10378 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10379 provide a default value. See also the section on partial matching below.
10380 </para>
10381 <para>
10382 <indexterm role="concept">
10383 <primary>*@ with single-key lookup</primary>
10384 </indexterm>
10385 <indexterm role="concept">
10386 <primary>lookup</primary>
10387 <secondary>*@ added to type</secondary>
10388 </indexterm>
10389 <indexterm role="concept">
10390 <primary>alias file</primary>
10391 <secondary>per-domain default</secondary>
10392 </indexterm>
10393 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10394 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10395 character, a second lookup is done with everything before the last @ replaced
10396 by *. This makes it possible to provide per-domain defaults in alias files
10397 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10398 take place because there is no @ in the key), <quote>*</quote> is looked up.
10399 For example, a <command>redirect</command> router might contain:
10400 </para>
10401 <literallayout class="monospaced">
10402 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10403 </literallayout>
10404 <para>
10405 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10406 looks up these keys, in this order:
10407 </para>
10408 <literallayout class="monospaced">
10409 jane@eyre.example
10410 *@eyre.example
10411 *
10412 </literallayout>
10413 <para>
10414 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10415 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10416 complete scan is done for each key, and only if it is not found at all does
10417 Exim move on to try the next key.
10418 </para>
10419 </section>
10420 <section id="SECTpartiallookup">
10421 <title>Partial matching in single-key lookups</title>
10422 <para>
10423 <indexterm role="concept">
10424 <primary>partial matching</primary>
10425 </indexterm>
10426 <indexterm role="concept">
10427 <primary>wildcard lookups</primary>
10428 </indexterm>
10429 <indexterm role="concept">
10430 <primary>lookup</primary>
10431 <secondary>partial matching</secondary>
10432 </indexterm>
10433 <indexterm role="concept">
10434 <primary>lookup</primary>
10435 <secondary>wildcard</secondary>
10436 </indexterm>
10437 <indexterm role="concept">
10438 <primary>asterisk</primary>
10439 <secondary>in search type</secondary>
10440 </indexterm>
10441 The normal operation of a single-key lookup is to search the file for an exact
10442 match with the given key. However, in a number of situations where domains are
10443 being looked up, it is useful to be able to do partial matching. In this case,
10444 information in the file that has a key starting with <quote>*.</quote> is matched by any
10445 domain that ends with the components that follow the full stop. For example, if
10446 a key in a DBM file is
10447 </para>
10448 <literallayout class="monospaced">
10449 *.dates.fict.example
10450 </literallayout>
10451 <para>
10452 then when partial matching is enabled this is matched by (amongst others)
10453 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10454 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10455 file.
10456 </para>
10457 <para>
10458 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10459 also not available for any lookup items in address lists (see section
10460 <xref linkend="SECTaddresslist"/>).
10461 </para>
10462 <para>
10463 Partial matching is implemented by doing a series of separate lookups using
10464 keys constructed by modifying the original subject key. This means that it can
10465 be used with any of the single-key lookup types, provided that
10466 partial matching keys
10467 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10468 Keys in the file that do not begin with the prefix are matched only by
10469 unmodified subject keys when partial matching is in use.
10470 </para>
10471 <para>
10472 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10473 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10474 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10475 is added at the start of the subject key, and it is looked up again. If that
10476 fails, further lookups are tried with dot-separated components removed from the
10477 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10478 remains.
10479 </para>
10480 <para>
10481 A minimum number of two non-* components are required. This can be adjusted
10482 by including a number before the hyphen in the search type. For example,
10483 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10484 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10485 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10486 up when the minimum number of non-* components is two:
10487 </para>
10488 <literallayout class="monospaced">
10489 2250.dates.fict.example
10490 *.2250.dates.fict.example
10491 *.dates.fict.example
10492 *.fict.example
10493 </literallayout>
10494 <para>
10495 As soon as one key in the sequence is successfully looked up, the lookup
10496 finishes.
10497 </para>
10498 <para>
10499 <indexterm role="concept">
10500 <primary>lookup</primary>
10501 <secondary>partial matching &ndash; changing prefix</secondary>
10502 </indexterm>
10503 <indexterm role="concept">
10504 <primary>prefix</primary>
10505 <secondary>for partial matching</secondary>
10506 </indexterm>
10507 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10508 changed. The motivation for this feature is to allow Exim to operate with file
10509 formats that are used by other MTAs. A different prefix can be supplied in
10510 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10511 </para>
10512 <literallayout class="monospaced">
10513 domains = partial(.)lsearch;/some/file
10514 </literallayout>
10515 <para>
10516 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10517 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10518 components is unchanged). The prefix may consist of any punctuation characters
10519 other than a closing parenthesis. It may be empty, for example:
10520 </para>
10521 <literallayout class="monospaced">
10522 domains = partial1()cdb;/some/file
10523 </literallayout>
10524 <para>
10525 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10526 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10527 </para>
10528 <para>
10529 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10530 just one non-wild component has failed, and the original key is shortened right
10531 down to the null string) depends on the prefix:
10532 </para>
10533 <itemizedlist>
10534 <listitem>
10535 <para>
10536 If the prefix has zero length, the whole lookup fails.
10537 </para>
10538 </listitem>
10539 <listitem>
10540 <para>
10541 If the prefix has length 1, a lookup for just the prefix is done. For
10542 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10543 </para>
10544 </listitem>
10545 <listitem>
10546 <para>
10547 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10548 remainder is looked up. With the default prefix, therefore, the final lookup is
10549 for <quote>*</quote> on its own.
10550 </para>
10551 </listitem>
10552 <listitem>
10553 <para>
10554 Otherwise, the whole prefix is looked up.
10555 </para>
10556 </listitem>
10557 </itemizedlist>
10558 <para>
10559 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10560 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10561 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10562 specified, adding <quote>*</quote> to the search type has no effect with the default
10563 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10564 lookups. However, there might be a use for lookup types such as
10565 <quote>partial0(.)lsearch*</quote>.
10566 </para>
10567 <para>
10568 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10569 in domain lists and the like. Partial matching works only in terms of
10570 dot-separated components; a key such as <literal>*fict.example</literal>
10571 in a database file is useless, because the asterisk in a partial matching
10572 subject key is always followed by a dot.
10573 </para>
10574 </section>
10575 <section id="SECID64">
10576 <title>Lookup caching</title>
10577 <para>
10578 <indexterm role="concept">
10579 <primary>lookup</primary>
10580 <secondary>caching</secondary>
10581 </indexterm>
10582 <indexterm role="concept">
10583 <primary>caching</primary>
10584 <secondary>lookup data</secondary>
10585 </indexterm>
10586 Exim caches all lookup results in order to avoid needless repetition of
10587 lookups. However, because (apart from the daemon) Exim operates as a collection
10588 of independent, short-lived processes, this caching applies only within a
10589 single Exim process. There is no inter-process lookup caching facility.
10590 </para>
10591 <para>
10592 For single-key lookups, Exim keeps the relevant files open in case there is
10593 another lookup that needs them. In some types of configuration this can lead to
10594 many files being kept open for messages with many recipients. To avoid hitting
10595 the operating system limit on the number of simultaneously open files, Exim
10596 closes the least recently used file when it needs to open more files than its
10597 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10598 </para>
10599 <para>
10600 The single-key lookup files are closed and the lookup caches are flushed at
10601 strategic points during delivery &ndash; for example, after all routing is
10602 complete.
10603 </para>
10604 </section>
10605 <section id="SECID65">
10606 <title>Quoting lookup data</title>
10607 <para>
10608 <indexterm role="concept">
10609 <primary>lookup</primary>
10610 <secondary>quoting</secondary>
10611 </indexterm>
10612 <indexterm role="concept">
10613 <primary>quoting</primary>
10614 <secondary>in lookups</secondary>
10615 </indexterm>
10616 When data from an incoming message is included in a query-style lookup, there
10617 is the possibility of special characters in the data messing up the syntax of
10618 the query. For example, a NIS+ query that contains
10619 </para>
10620 <literallayout class="monospaced">
10621 [name=$local_part]
10622 </literallayout>
10623 <para>
10624 will be broken if the local part happens to contain a closing square bracket.
10625 For NIS+, data can be enclosed in double quotes like this:
10626 </para>
10627 <literallayout class="monospaced">
10628 [name="$local_part"]
10629 </literallayout>
10630 <para>
10631 but this still leaves the problem of a double quote in the data. The rule for
10632 NIS+ is that double quotes must be doubled. Other lookup types have different
10633 rules, and to cope with the differing requirements, an expansion operator
10634 of the following form is provided:
10635 </para>
10636 <literallayout class="monospaced">
10637 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10638 </literallayout>
10639 <para>
10640 For example, the safest way to write the NIS+ query is
10641 </para>
10642 <literallayout class="monospaced">
10643 [name="${quote_nisplus:$local_part}"]
10644 </literallayout>
10645 <para>
10646 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10647 operator can be used for all lookup types, but has no effect for single-key
10648 lookups, since no quoting is ever needed in their key strings.
10649 </para>
10650 </section>
10651 <section id="SECTdnsdb">
10652 <title>More about dnsdb</title>
10653 <para>
10654 <indexterm role="concept">
10655 <primary>dnsdb lookup</primary>
10656 </indexterm>
10657 <indexterm role="concept">
10658 <primary>lookup</primary>
10659 <secondary>dnsdb</secondary>
10660 </indexterm>
10661 <indexterm role="concept">
10662 <primary>DNS</primary>
10663 <secondary>as a lookup type</secondary>
10664 </indexterm>
10665 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10666 of a record type and a domain name, separated by an equals sign. For example,
10667 an expansion string could contain:
10668 </para>
10669 <literallayout class="monospaced">
10670 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10671 </literallayout>
10672 <para>
10673 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10674 is used on its own as the result. If the lookup does not succeed, the
10675 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10676 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10677 </para>
10678 <para>
10679 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10680 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10681 If no type is given, TXT is assumed.
10682 </para>
10683 <para>
10684 For any record type, if multiple records are found, the data is returned as a
10685 concatenation, with newline as the default separator. The order, of course,
10686 depends on the DNS resolver. You can specify a different separator character
10687 between multiple records by putting a right angle-bracket followed immediately
10688 by the new separator at the start of the query. For example:
10689 </para>
10690 <literallayout class="monospaced">
10691 ${lookup dnsdb{&gt;: a=host1.example}}
10692 </literallayout>
10693 <para>
10694 It is permitted to specify a space as the separator character. Further
10695 white space is ignored.
10696 For lookup types that return multiple fields per record,
10697 an alternate field separator can be specified using a comma after the main
10698 separator character, followed immediately by the field separator.
10699 </para>
10700 <para>
10701 <indexterm role="concept">
10702 <primary>PTR record</primary>
10703 <secondary>in <command>dnsdb</command> lookup</secondary>
10704 </indexterm>
10705 When the type is PTR,
10706 the data can be an IP address, written as normal; inversion and the addition of
10707 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10708 </para>
10709 <literallayout class="monospaced">
10710 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10711 </literallayout>
10712 <para>
10713 If the data for a PTR record is not a syntactically valid IP address, it is not
10714 altered and nothing is added.
10715 </para>
10716 <para>
10717 <indexterm role="concept">
10718 <primary>MX record</primary>
10719 <secondary>in <command>dnsdb</command> lookup</secondary>
10720 </indexterm>
10721 <indexterm role="concept">
10722 <primary>SRV record</primary>
10723 <secondary>in <command>dnsdb</command> lookup</secondary>
10724 </indexterm>
10725 For an MX lookup, both the preference value and the host name are returned for
10726 each record, separated by a space. For an SRV lookup, the priority, weight,
10727 port, and host name are returned for each record, separated by spaces.
10728 The field separator can be modified as above.
10729 </para>
10730 <para>
10731 <indexterm role="concept">
10732 <primary>TXT record</primary>
10733 <secondary>in <command>dnsdb</command> lookup</secondary>
10734 </indexterm>
10735 <indexterm role="concept">
10736 <primary>SPF record</primary>
10737 <secondary>in <command>dnsdb</command> lookup</secondary>
10738 </indexterm>
10739 For TXT records with multiple items of data, only the first item is returned,
10740 unless a field separator is specified.
10741 To concatenate items without a separator, use a semicolon instead.
10742 For SPF records the
10743 default behaviour is to concatenate multiple items without using a separator.
10744 </para>
10745 <literallayout class="monospaced">
10746 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10747 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10748 ${lookup dnsdb{spf=example.org}}
10749 </literallayout>
10750 <para>
10751 It is permitted to specify a space as the separator character. Further
10752 white space is ignored.
10753 </para>
10754 <para>
10755 <indexterm role="concept">
10756 <primary>SOA record</primary>
10757 <secondary>in <command>dnsdb</command> lookup</secondary>
10758 </indexterm>
10759 For an SOA lookup, while no result is obtained the lookup is redone with
10760 successively more leading components dropped from the given domain.
10761 Only the primary-nameserver field is returned unless a field separator is
10762 specified.
10763 </para>
10764 <literallayout class="monospaced">
10765 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10766 </literallayout>
10767 </section>
10768 <section id="SECTdnsdb_mod">
10769 <title>Dnsdb lookup modifiers</title>
10770 <para>
10771 <indexterm role="concept">
10772 <primary>dnsdb modifiers</primary>
10773 </indexterm>
10774 <indexterm role="concept">
10775 <primary>modifiers</primary>
10776 <secondary>dnsdb</secondary>
10777 </indexterm>
10778 <indexterm role="concept">
10779 <primary>options</primary>
10780 <secondary>dnsdb</secondary>
10781 </indexterm>
10782 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10783 each followed by a comma,
10784 that may appear before the record type.
10785 </para>
10786 <para>
10787 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10788 temporary DNS error for any of them, the behaviour is controlled by
10789 a defer-option modifier.
10790 The possible keywords are
10791 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10792 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10793 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10794 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10795 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10796 error causes the whole lookup to defer only if none of the other lookups
10797 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10798 </para>
10799 <literallayout class="monospaced">
10800 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10801 ${lookup dnsdb{a=one.host.com:two.host.com}}
10802 </literallayout>
10803 <para>
10804 Thus, in the default case, as long as at least one of the DNS lookups
10805 yields some data, the lookup succeeds.
10806 </para>
10807 <para>
10808 <indexterm role="concept">
10809 <primary>DNSSEC</primary>
10810 <secondary>dns lookup</secondary>
10811 </indexterm>
10812 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10813 The possible keywords are
10814 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10815 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10816 with the lookup.
10817 With <quote>strict</quote> a response from the DNS resolver that
10818 is not labelled as authenticated data
10819 is treated as equivalent to a temporary DNS error.
10820 The default is <quote>never</quote>.
10821 </para>
10822 <para>
10823 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10824 </para>
10825 <para>
10826 <indexterm role="concept">
10827 <primary>timeout</primary>
10828 <secondary>dns lookup</secondary>
10829 </indexterm>
10830 <indexterm role="concept">
10831 <primary>DNS</primary>
10832 <secondary>timeout</secondary>
10833 </indexterm>
10834 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10835 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10836 (e.g. <quote>5s</quote>).
10837 The default value is set by the main configuration option <option>dns_retrans</option>.
10838 </para>
10839 <para>
10840 Retries for the dnsdb lookup can be controlled by a retry modifier.
10841 The form if <quote>retry_VAL</quote> where VAL is an integer.
10842 The default count is set by the main configuration option <option>dns_retry</option>.
10843 </para>
10844 <para>
10845 <indexterm role="concept">
10846 <primary>caching</primary>
10847 <secondary>of dns lookup</secondary>
10848 </indexterm>
10849 <indexterm role="concept">
10850 <primary>TTL</primary>
10851 <secondary>of dns lookup</secondary>
10852 </indexterm>
10853 <indexterm role="concept">
10854 <primary>DNS</primary>
10855 <secondary>TTL</secondary>
10856 </indexterm>
10857 Dnsdb lookup results are cached within a single process (and its children).
10858 The cache entry lifetime is limited to the smallest time-to-live (TTL)
10859 value of the set of returned DNS records.
10860 </para>
10861 </section>
10862 <section id="SECID66">
10863 <title>Pseudo dnsdb record types</title>
10864 <para>
10865 <indexterm role="concept">
10866 <primary>MX record</primary>
10867 <secondary>in <command>dnsdb</command> lookup</secondary>
10868 </indexterm>
10869 By default, both the preference value and the host name are returned for
10870 each MX record, separated by a space. If you want only host names, you can use
10871 the pseudo-type MXH:
10872 </para>
10873 <literallayout class="monospaced">
10874 ${lookup dnsdb{mxh=a.b.example}}
10875 </literallayout>
10876 <para>
10877 In this case, the preference values are omitted, and just the host names are
10878 returned.
10879 </para>
10880 <para>
10881 <indexterm role="concept">
10882 <primary>name server for enclosing domain</primary>
10883 </indexterm>
10884 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10885 records on the given domain, but if none are found, it removes the first
10886 component of the domain name, and tries again. This process continues until NS
10887 records are found or there are no more components left (or there is a DNS
10888 error). In other words, it may return the name servers for a top-level domain,
10889 but it never returns the root name servers. If there are no NS records for the
10890 top-level domain, the lookup fails. Consider these examples:
10891 </para>
10892 <literallayout class="monospaced">
10893 ${lookup dnsdb{zns=xxx.quercite.com}}
10894 ${lookup dnsdb{zns=xxx.edu}}
10895 </literallayout>
10896 <para>
10897 Assuming that in each case there are no NS records for the full domain name,
10898 the first returns the name servers for <option>quercite.com</option>, and the second returns
10899 the name servers for <option>edu</option>.
10900 </para>
10901 <para>
10902 You should be careful about how you use this lookup because, unless the
10903 top-level domain does not exist, the lookup always returns some host names. The
10904 sort of use to which this might be put is for seeing if the name servers for a
10905 given domain are on a blacklist. You can probably assume that the name servers
10906 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10907 such a list.
10908 </para>
10909 <para>
10910 <indexterm role="concept">
10911 <primary>CSA</primary>
10912 <secondary>in <command>dnsdb</command> lookup</secondary>
10913 </indexterm>
10914 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10915 records according to the CSA rules, which are described in section
10916 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10917 not sufficient because of the extra parent domain search behaviour of CSA. The
10918 result of a successful lookup such as:
10919 </para>
10920 <literallayout class="monospaced">
10921 ${lookup dnsdb {csa=$sender_helo_name}}
10922 </literallayout>
10923 <para>
10924 has two space-separated fields: an authorization code and a target host name.
10925 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10926 authorization required but absent, or <quote>?</quote> for unknown.
10927 </para>
10928 <para>
10929 <indexterm role="concept">
10930 <primary>A+</primary>
10931 <secondary>in <command>dnsdb</command> lookup</secondary>
10932 </indexterm>
10933 The pseudo-type A+ performs an AAAA
10934 and then an A lookup.  All results are returned; defer processing
10935 (see below) is handled separately for each lookup.  Example:
10936 </para>
10937 <literallayout class="monospaced">
10938 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10939 </literallayout>
10940 </section>
10941 <section id="SECID67">
10942 <title>Multiple dnsdb lookups</title>
10943 <para>
10944 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10945 However, you can specify a list of domains or IP addresses in a single
10946 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10947 the default separator, but with the ability to change this. For example:
10948 </para>
10949 <literallayout class="monospaced">
10950 ${lookup dnsdb{one.domain.com:two.domain.com}}
10951 ${lookup dnsdb{a=one.host.com:two.host.com}}
10952 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10953 </literallayout>
10954 <para>
10955 In order to retain backwards compatibility, there is one special case: if
10956 the lookup type is PTR and no change of separator is specified, Exim looks
10957 to see if the rest of the string is precisely one IPv6 address. In this
10958 case, it does not treat it as a list.
10959 </para>
10960 <para>
10961 The data from each lookup is concatenated, with newline separators by default,
10962 in the same way that multiple DNS records for a single item are handled. A
10963 different separator can be specified, as described above.
10964 </para>
10965 </section>
10966 <section id="SECTldap">
10967 <title>More about LDAP</title>
10968 <para>
10969 <indexterm role="concept">
10970 <primary>LDAP</primary>
10971 <secondary>lookup, more about</secondary>
10972 </indexterm>
10973 <indexterm role="concept">
10974 <primary>lookup</primary>
10975 <secondary>LDAP</secondary>
10976 </indexterm>
10977 <indexterm role="concept">
10978 <primary>Solaris</primary>
10979 <secondary>LDAP</secondary>
10980 </indexterm>
10981 The original LDAP implementation came from the University of Michigan; this has
10982 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10983 implementation comes from Netscape, and Solaris 7 and subsequent releases
10984 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10985 the lookup function level, their error handling is different. For this reason
10986 it is necessary to set a compile-time variable when building Exim with LDAP, to
10987 indicate which LDAP library is in use. One of the following should appear in
10988 your <filename>Local/Makefile</filename>:
10989 </para>
10990 <literallayout class="monospaced">
10991 LDAP_LIB_TYPE=UMICHIGAN
10992 LDAP_LIB_TYPE=OPENLDAP1
10993 LDAP_LIB_TYPE=OPENLDAP2
10994 LDAP_LIB_TYPE=NETSCAPE
10995 LDAP_LIB_TYPE=SOLARIS
10996 </literallayout>
10997 <para>
10998 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10999 same interface as the University of Michigan version.
11000 </para>
11001 <para>
11002 There are three LDAP lookup types in Exim. These behave slightly differently in
11003 the way they handle the results of a query:
11004 </para>
11005 <itemizedlist>
11006 <listitem>
11007 <para>
11008 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11009 gives an error.
11010 </para>
11011 </listitem>
11012 <listitem>
11013 <para>
11014 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11015 Distinguished Name that is returned rather than any attribute values.
11016 </para>
11017 </listitem>
11018 <listitem>
11019 <para>
11020 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11021 from all of them are returned.
11022 </para>
11023 </listitem>
11024 </itemizedlist>
11025 <para>
11026 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11027 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11028 the data returned by a successful lookup is described in the next section.
11029 First we explain how LDAP queries are coded.
11030 </para>
11031 </section>
11032 <section id="SECTforldaque">
11033 <title>Format of LDAP queries</title>
11034 <para>
11035 <indexterm role="concept">
11036 <primary>LDAP</primary>
11037 <secondary>query format</secondary>
11038 </indexterm>
11039 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11040 the configuration of a <command>redirect</command> router one might have this setting:
11041 </para>
11042 <literallayout class="monospaced">
11043 data = ${lookup ldap \
11044   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11045   c=UK?mailbox?base?}}
11046 </literallayout>
11047 <para>
11048 <indexterm role="concept">
11049 <primary>LDAP</primary>
11050 <secondary>with TLS</secondary>
11051 </indexterm>
11052 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11053 secure (encrypted) LDAP connections. The second of these ensures that an
11054 encrypted TLS connection is used.
11055 </para>
11056 <para>
11057 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11058 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11059 See the <option>ldap_start_tls</option> option.
11060 </para>
11061 <para>
11062 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11063 controlled. Every part of the TLS configuration can be configured by settings in
11064 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11065 your system, some of the initialization may have required setting options in
11066 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11067 certificates. This revealed a nuance where the current UID that exim was
11068 running as could affect which config files it read. With Exim 4.83, these
11069 methods become optional, only taking effect if not specifically set in
11070 <filename>exim.conf</filename>.
11071 </para>
11072 </section>
11073 <section id="SECID68">
11074 <title>LDAP quoting</title>
11075 <para>
11076 <indexterm role="concept">
11077 <primary>LDAP</primary>
11078 <secondary>quoting</secondary>
11079 </indexterm>
11080 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11081 and the second because the LDAP query is represented as a URL. Furthermore,
11082 within an LDAP query, two different kinds of quoting are required. For this
11083 reason, there are two different LDAP-specific quoting operators.
11084 </para>
11085 <para>
11086 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11087 filter specifications. Conceptually, it first does the following conversions on
11088 the string:
11089 </para>
11090 <literallayout class="monospaced">
11091 *   =&gt;   \2A
11092 (   =&gt;   \28
11093 )   =&gt;   \29
11094 \   =&gt;   \5C
11095 </literallayout>
11096 <para>
11097 in accordance with RFC 2254. The resulting string is then quoted according
11098 to the rules for URLs, that is, all non-alphanumeric characters except
11099 </para>
11100 <literallayout class="monospaced">
11101 ! $ ' - . _ ( ) * +
11102 </literallayout>
11103 <para>
11104 are converted to their hex values, preceded by a percent sign. For example:
11105 </para>
11106 <literallayout class="monospaced">
11107 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11108 </literallayout>
11109 <para>
11110 yields
11111 </para>
11112 <literallayout class="monospaced">
11113 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11114 </literallayout>
11115 <para>
11116 Removing the URL quoting, this is (with a leading and a trailing space):
11117 </para>
11118 <literallayout class="monospaced">
11119 a\28bc\29\2A, a&lt;yz&gt;;
11120 </literallayout>
11121 <para>
11122 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11123 base DN specifications in queries. Conceptually, it first converts the string
11124 by inserting a backslash in front of any of the following characters:
11125 </para>
11126 <literallayout class="monospaced">
11127 , + " \ &lt; &gt; ;
11128 </literallayout>
11129 <para>
11130 It also inserts a backslash before any leading spaces or # characters, and
11131 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11132 is then quoted according to the rules for URLs. For example:
11133 </para>
11134 <literallayout class="monospaced">
11135 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11136 </literallayout>
11137 <para>
11138 yields
11139 </para>
11140 <literallayout class="monospaced">
11141 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11142 </literallayout>
11143 <para>
11144 Removing the URL quoting, this is (with a trailing space):
11145 </para>
11146 <literallayout class="monospaced">
11147 \ a(bc)*\, a\&lt;yz\&gt;\;\
11148 </literallayout>
11149 <para>
11150 There are some further comments about quoting in the section on LDAP
11151 authentication below.
11152 </para>
11153 </section>
11154 <section id="SECID69">
11155 <title>LDAP connections</title>
11156 <para>
11157 <indexterm role="concept">
11158 <primary>LDAP</primary>
11159 <secondary>connections</secondary>
11160 </indexterm>
11161 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11162 is in use, via a Unix domain socket. The example given above does not specify
11163 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11164 by starting it with
11165 </para>
11166 <literallayout class="monospaced">
11167 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11168 </literallayout>
11169 <para>
11170 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11171 used. When no server is specified in a query, a list of default servers is
11172 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11173 colon-separated list of servers which are tried in turn until one successfully
11174 handles a query, or there is a serious error. Successful handling either
11175 returns the requested data, or indicates that it does not exist. Serious errors
11176 are syntactical, or multiple values when only a single value is expected.
11177 Errors which cause the next server to be tried are connection failures, bind
11178 failures, and timeouts.
11179 </para>
11180 <para>
11181 For each server name in the list, a port number can be given. The standard way
11182 of specifying a host and port is to use a colon separator (RFC 1738). Because
11183 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11184 doubled. For example
11185 </para>
11186 <literallayout class="monospaced">
11187 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11188 </literallayout>
11189 <para>
11190 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11191 to the LDAP library with no server name, and the library&#x2019;s default (normally
11192 the local host) is used.
11193 </para>
11194 <para>
11195 If you are using the OpenLDAP library, you can connect to an LDAP server using
11196 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11197 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11198 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11199 not available.
11200 </para>
11201 <para>
11202 For this type of connection, instead of a host name for the server, a pathname
11203 for the socket is required, and the port number is not relevant. The pathname
11204 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11205 the query. In the former case, you can have settings such as
11206 </para>
11207 <literallayout class="monospaced">
11208 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11209 </literallayout>
11210 <para>
11211 When the pathname is given in the query, you have to escape the slashes as
11212 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11213 </para>
11214 <literallayout class="monospaced">
11215 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11216 </literallayout>
11217 <para>
11218 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11219 a pathname, it uses the Unix domain socket code, even if the query actually
11220 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11221 socket connection. This behaviour means that you can use a setting of
11222 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11223 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11224 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11225 backup host.
11226 </para>
11227 <para>
11228 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11229 specified, an error is diagnosed. However, if there are more items in
11230 <option>ldap_default_servers</option>, they are tried. In other words:
11231 </para>
11232 <itemizedlist>
11233 <listitem>
11234 <para>
11235 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11236 interface.
11237 </para>
11238 </listitem>
11239 <listitem>
11240 <para>
11241 Using <literal>ldapi</literal> with a host name causes an error.
11242 </para>
11243 </listitem>
11244 </itemizedlist>
11245 <para>
11246 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11247 <option>ldap_default_servers</option>, does whatever the library does by default.
11248 </para>
11249 </section>
11250 <section id="SECID70">
11251 <title>LDAP authentication and control information</title>
11252 <para>
11253 <indexterm role="concept">
11254 <primary>LDAP</primary>
11255 <secondary>authentication</secondary>
11256 </indexterm>
11257 The LDAP URL syntax provides no way of passing authentication and other control
11258 information to the server. To make this possible, the URL in an LDAP query may
11259 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11260 spaces. If a value contains spaces it must be enclosed in double quotes, and
11261 when double quotes are used, backslash is interpreted in the usual way inside
11262 them. The following names are recognized:
11263 </para>
11264 <literallayout>
11265 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11266 <literal>NETTIME    </literal>  set a timeout for a network operation
11267 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11268 <literal>PASS       </literal>  set the password, likewise
11269 <literal>REFERRALS  </literal>  set the referrals parameter
11270 <literal>SERVERS    </literal>  set alternate server list for this query only
11271 <literal>SIZE       </literal>  set the limit for the number of entries returned
11272 <literal>TIME       </literal>  set the maximum waiting time for a query
11273 </literallayout>
11274 <para>
11275 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11276 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11277 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11278 library from trying to follow referrals issued by the LDAP server.
11279 </para>
11280 <para>
11281 <indexterm role="concept">
11282 <primary>LDAP</primary>
11283 <secondary>timeout</secondary>
11284 </indexterm>
11285 <indexterm role="concept">
11286 <primary>timeout</primary>
11287 <secondary>LDAP lookup</secondary>
11288 </indexterm>
11289 The name CONNECT is an obsolete name for NETTIME, retained for
11290 backwards compatibility. This timeout (specified as a number of seconds) is
11291 enforced from the client end for operations that can be carried out over a
11292 network. Specifically, it applies to network connections and calls to the
11293 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11294 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11295 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11296 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11297 Netscape SDK; for OpenLDAP no action is taken.
11298 </para>
11299 <para>
11300 The TIME parameter (also a number of seconds) is passed to the server to
11301 set a server-side limit on the time taken to complete a search.
11302 </para>
11303 <para>
11304 The SERVERS parameter allows you to specify an alternate list of ldap servers
11305 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11306 default list of ldap servers, and a single lookup can specify a single ldap
11307 server to use.  But when you need to do a lookup with a list of servers that is
11308 different than the default list (maybe different order, maybe a completely
11309 different set of servers), the SERVERS parameter allows you to specify this
11310 alternate list (colon-separated).
11311 </para>
11312 <para>
11313 Here is an example of an LDAP query in an Exim lookup that uses some of these
11314 values. This is a single line, folded to fit on the page:
11315 </para>
11316 <literallayout class="monospaced">
11317 ${lookup ldap
11318   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11319   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11320   {$value}fail}
11321 </literallayout>
11322 <para>
11323 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11324 any of the auxiliary data. Exim configuration settings that include lookups
11325 which contain password information should be preceded by <quote>hide</quote> to prevent
11326 non-admin users from using the <option>-bP</option> option to see their values.
11327 </para>
11328 <para>
11329 The auxiliary data items may be given in any order. The default is no
11330 connection timeout (the system timeout is used), no user or password, no limit
11331 on the number of entries returned, and no time limit on queries.
11332 </para>
11333 <para>
11334 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11335 removes any URL quoting that it may contain before passing it LDAP. Apparently
11336 some libraries do this for themselves, but some do not. Removing the URL
11337 quoting has two advantages:
11338 </para>
11339 <itemizedlist>
11340 <listitem>
11341 <para>
11342 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11343 DNs as with DNs inside actual queries.
11344 </para>
11345 </listitem>
11346 <listitem>
11347 <para>
11348 It permits spaces inside USER= DNs.
11349 </para>
11350 </listitem>
11351 </itemizedlist>
11352 <para>
11353 For example, a setting such as
11354 </para>
11355 <literallayout class="monospaced">
11356 USER=cn=${quote_ldap_dn:$1}
11357 </literallayout>
11358 <para>
11359 should work even if <varname>$1</varname> contains spaces.
11360 </para>
11361 <para>
11362 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11363 expansion operator, rather than the LDAP quote operators. The only reason this
11364 field needs quoting is to ensure that it conforms to the Exim syntax, which
11365 does not allow unquoted spaces. For example:
11366 </para>
11367 <literallayout class="monospaced">
11368 PASS=${quote:$3}
11369 </literallayout>
11370 <para>
11371 The LDAP authentication mechanism can be used to check passwords as part of
11372 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11373 <xref linkend="CHAPexpand"/>.
11374 </para>
11375 </section>
11376 <section id="SECID71">
11377 <title>Format of data returned by LDAP</title>
11378 <para>
11379 <indexterm role="concept">
11380 <primary>LDAP</primary>
11381 <secondary>returned data formats</secondary>
11382 </indexterm>
11383 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11384 as a sequence of values, for example
11385 </para>
11386 <literallayout class="monospaced">
11387 cn=manager,o=University of Cambridge,c=UK
11388 </literallayout>
11389 <para>
11390 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11391 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11392 the result between the data from different entries. It is possible for multiple
11393 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11394 you know that whatever values are returned all came from a single entry in the
11395 directory.
11396 </para>
11397 <para>
11398 In the common case where you specify a single attribute in your LDAP query, the
11399 result is not quoted, and does not contain the attribute name. If the attribute
11400 has multiple values, they are separated by commas. Any comma that is
11401 part of an attribute&#x2019;s value is doubled.
11402 </para>
11403 <para>
11404 If you specify multiple attributes, the result contains space-separated, quoted
11405 strings, each preceded by the attribute name and an equals sign. Within the
11406 quotes, the quote character, backslash, and newline are escaped with
11407 backslashes, and commas are used to separate multiple values for the attribute.
11408 Any commas in attribute values are doubled
11409 (permitting treatment of the values as a comma-separated list).
11410 Apart from the escaping, the string within quotes takes the same form as the
11411 output when a single attribute is requested. Specifying no attributes is the
11412 same as specifying all of an entry&#x2019;s attributes.
11413 </para>
11414 <para>
11415 Here are some examples of the output format. The first line of each pair is an
11416 LDAP query, and the second is the data that is returned. The attribute called
11417 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11418 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11419 (they have SUP <option>attr</option> in their schema definitions).
11420 </para>
11421 <literallayout class="monospaced">
11422 ldap:///o=base?attr1?sub?(uid=fred)
11423 value1.1,value1,,2
11424
11425 ldap:///o=base?attr2?sub?(uid=fred)
11426 value two
11427
11428 ldap:///o=base?attr?sub?(uid=fred)
11429 value1.1,value1,,2,value two
11430
11431 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11432 attr1="value1.1,value1,,2" attr2="value two"
11433
11434 ldap:///o=base??sub?(uid=fred)
11435 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11436 </literallayout>
11437 <para>
11438 You can
11439 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11440 results of LDAP lookups.
11441 The <option>extract</option> operator in string expansions can be used to pick out
11442 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11443 The <option>listextract</option> operator should be used to pick out individual values
11444 of attributes, even when only a single value is expected.
11445 The doubling of embedded commas allows you to use the returned data as a
11446 comma separated list (using the "&lt;," syntax for changing the input list separator).
11447 </para>
11448 </section>
11449 <section id="SECTnisplus">
11450 <title>More about NIS+</title>
11451 <para>
11452 <indexterm role="concept">
11453 <primary>NIS+ lookup type</primary>
11454 </indexterm>
11455 <indexterm role="concept">
11456 <primary>lookup</primary>
11457 <secondary>NIS+</secondary>
11458 </indexterm>
11459 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11460 and field name. If this is given, the result of a successful query is the
11461 contents of the named field; otherwise the result consists of a concatenation
11462 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11463 values containing spaces are quoted. For example, the query
11464 </para>
11465 <literallayout class="monospaced">
11466 [name=mg1456],passwd.org_dir
11467 </literallayout>
11468 <para>
11469 might return the string
11470 </para>
11471 <literallayout class="monospaced">
11472 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11473 home=/home/mg1456 shell=/bin/bash shadow=""
11474 </literallayout>
11475 <para>
11476 (split over two lines here to fit on the page), whereas
11477 </para>
11478 <literallayout class="monospaced">
11479 [name=mg1456],passwd.org_dir:gcos
11480 </literallayout>
11481 <para>
11482 would just return
11483 </para>
11484 <literallayout class="monospaced">
11485 Martin Guerre
11486 </literallayout>
11487 <para>
11488 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11489 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11490 operator is to double any quote characters within the text.
11491 </para>
11492 </section>
11493 <section id="SECTsql">
11494 <title>SQL lookups</title>
11495 <para>
11496 <indexterm role="concept">
11497 <primary>SQL lookup types</primary>
11498 </indexterm>
11499 <indexterm role="concept">
11500 <primary>MySQL</primary>
11501 <secondary>lookup type</secondary>
11502 </indexterm>
11503 <indexterm role="concept">
11504 <primary>PostgreSQL lookup type</primary>
11505 </indexterm>
11506 <indexterm role="concept">
11507 <primary>lookup</primary>
11508 <secondary>MySQL</secondary>
11509 </indexterm>
11510 <indexterm role="concept">
11511 <primary>lookup</primary>
11512 <secondary>PostgreSQL</secondary>
11513 </indexterm>
11514 <indexterm role="concept">
11515 <primary>Oracle</primary>
11516 <secondary>lookup type</secondary>
11517 </indexterm>
11518 <indexterm role="concept">
11519 <primary>lookup</primary>
11520 <secondary>Oracle</secondary>
11521 </indexterm>
11522 <indexterm role="concept">
11523 <primary>InterBase lookup type</primary>
11524 </indexterm>
11525 <indexterm role="concept">
11526 <primary>lookup</primary>
11527 <secondary>InterBase</secondary>
11528 </indexterm>
11529 <indexterm role="concept">
11530 <primary>Redis lookup type</primary>
11531 </indexterm>
11532 <indexterm role="concept">
11533 <primary>lookup</primary>
11534 <secondary>Redis</secondary>
11535 </indexterm>
11536 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11537 and SQLite
11538 databases. Queries for these databases contain SQL statements, so an example
11539 might be
11540 </para>
11541 <literallayout class="monospaced">
11542 ${lookup mysql{select mailbox from users where id='userx'}\
11543   {$value}fail}
11544 </literallayout>
11545 <para>
11546 If the result of the query contains more than one field, the data for each
11547 field in the row is returned, preceded by its name, so the result of
11548 </para>
11549 <literallayout class="monospaced">
11550 ${lookup pgsql{select home,name from users where id='userx'}\
11551   {$value}}
11552 </literallayout>
11553 <para>
11554 might be
11555 </para>
11556 <literallayout class="monospaced">
11557 home=/home/userx name="Mister X"
11558 </literallayout>
11559 <para>
11560 Empty values and values containing spaces are double quoted, with embedded
11561 quotes escaped by a backslash. If the result of the query contains just one
11562 field, the value is passed back verbatim, without a field name, for example:
11563 </para>
11564 <literallayout class="monospaced">
11565 Mister X
11566 </literallayout>
11567 <para>
11568 If the result of the query yields more than one row, it is all concatenated,
11569 with a newline between the data for each row.
11570 </para>
11571 </section>
11572 <section id="SECID72">
11573 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11574 <para>
11575 <indexterm role="concept">
11576 <primary>MySQL</primary>
11577 <secondary>lookup type</secondary>
11578 </indexterm>
11579 <indexterm role="concept">
11580 <primary>PostgreSQL lookup type</primary>
11581 </indexterm>
11582 <indexterm role="concept">
11583 <primary>lookup</primary>
11584 <secondary>MySQL</secondary>
11585 </indexterm>
11586 <indexterm role="concept">
11587 <primary>lookup</primary>
11588 <secondary>PostgreSQL</secondary>
11589 </indexterm>
11590 <indexterm role="concept">
11591 <primary>Oracle</primary>
11592 <secondary>lookup type</secondary>
11593 </indexterm>
11594 <indexterm role="concept">
11595 <primary>lookup</primary>
11596 <secondary>Oracle</secondary>
11597 </indexterm>
11598 <indexterm role="concept">
11599 <primary>InterBase lookup type</primary>
11600 </indexterm>
11601 <indexterm role="concept">
11602 <primary>lookup</primary>
11603 <secondary>InterBase</secondary>
11604 </indexterm>
11605 <indexterm role="concept">
11606 <primary>Redis lookup type</primary>
11607 </indexterm>
11608 <indexterm role="concept">
11609 <primary>lookup</primary>
11610 <secondary>Redis</secondary>
11611 </indexterm>
11612 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11613 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11614 or <option>redis_servers</option>
11615 option (as appropriate) must be set to a colon-separated list of server
11616 information.
11617 (For MySQL and PostgreSQL, the global option need not be set if all
11618 queries contain their own server information &ndash; see section
11619 <xref linkend="SECTspeserque"/>.)
11620 For all but Redis
11621 each item in the list is a slash-separated list of four
11622 items: host name, database name, user name, and password. In the case of
11623 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11624 name field is not used and should be empty. For example:
11625 </para>
11626 <literallayout class="monospaced">
11627 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11628 </literallayout>
11629 <para>
11630 Because password data is sensitive, you should always precede the setting with
11631 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11632 option. Here is an example where two MySQL servers are listed:
11633 </para>
11634 <literallayout class="monospaced">
11635 hide mysql_servers = localhost/users/root/secret:\
11636                      otherhost/users/root/othersecret
11637 </literallayout>
11638 <para>
11639 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11640 because this is a colon-separated list, the colon has to be doubled. For each
11641 query, these parameter groups are tried in order until a connection is made and
11642 a query is successfully processed. The result of a query may be that no data is
11643 found, but that is still a successful query. In other words, the list of
11644 servers provides a backup facility, not a list of different places to look.
11645 </para>
11646 <para>
11647 For Redis the global option need not be specified if all queries contain their
11648 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11649 If specified, the option must be set to a colon-separated list of server
11650 information.
11651 Each item in the list is a slash-separated list of three items:
11652 host, database number, and password.
11653 </para>
11654 <orderedlist numeration="arabic">
11655 <listitem>
11656 <para>
11657 The host is required and may be either an IPv4 address and optional
11658 port number (separated by a colon, which needs doubling due to the
11659 higher-level list), or a Unix socket pathname enclosed in parentheses
11660 </para>
11661 </listitem>
11662 <listitem>
11663 <para>
11664 The database number is optional; if present that number is selected in the backend
11665 </para>
11666 </listitem>
11667 <listitem>
11668 <para>
11669 The password is optional; if present it is used to authenticate to the backend
11670 </para>
11671 </listitem>
11672 </orderedlist>
11673 <para>
11674 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11675 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11676 respectively, and the characters single-quote, double-quote, and backslash
11677 itself are escaped with backslashes.
11678 </para>
11679 <para>
11680 The <option>quote_redis</option> expansion operator
11681 escapes whitespace and backslash characters with a backslash.
11682 </para>
11683 </section>
11684 <section id="SECTspeserque">
11685 <title>Specifying the server in the query</title>
11686 <para>
11687 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11688 it is possible to specify a list of servers with an individual query. This is
11689 done by starting the query with
11690 </para>
11691 <literallayout>
11692 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11693 </literallayout>
11694 <para>
11695 Each item in the list may take one of two forms:
11696 </para>
11697 <orderedlist numeration="arabic">
11698 <listitem>
11699 <para>
11700 If it contains no slashes it is assumed to be just a host name. The appropriate
11701 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11702 of the same name, and the remaining parameters (database, user, password) are
11703 taken from there.
11704 </para>
11705 </listitem>
11706 <listitem>
11707 <para>
11708 If it contains any slashes, it is taken as a complete parameter set.
11709 </para>
11710 </listitem>
11711 </orderedlist>
11712 <para>
11713 The list of servers is used in exactly the same way as the global list.
11714 Once a connection to a server has happened and a query has been
11715 successfully executed, processing of the lookup ceases.
11716 </para>
11717 <para>
11718 This feature is intended for use in master/slave situations where updates
11719 are occurring and you want to update the master rather than a slave. If the
11720 master is in the list as a backup for reading, you might have a global setting
11721 like this:
11722 </para>
11723 <literallayout class="monospaced">
11724 mysql_servers = slave1/db/name/pw:\
11725                 slave2/db/name/pw:\
11726                 master/db/name/pw
11727 </literallayout>
11728 <para>
11729 In an updating lookup, you could then write:
11730 </para>
11731 <literallayout class="monospaced">
11732 ${lookup mysql{servers=master; UPDATE ...} }
11733 </literallayout>
11734 <para>
11735 That query would then be sent only to the master server. If, on the other hand,
11736 the master is not to be used for reading, and so is not present in the global
11737 option, you can still update it by a query of this form:
11738 </para>
11739 <literallayout class="monospaced">
11740 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11741 </literallayout>
11742 </section>
11743 <section id="SECID73">
11744 <title>Special MySQL features</title>
11745 <para>
11746 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11747 causes a connection to the server on the local host by means of a Unix domain
11748 socket. An alternate socket can be specified in parentheses.
11749 An option group name for MySQL option files can be specified in square brackets;
11750 the default value is <quote>exim</quote>.
11751 The full syntax of each item in <option>mysql_servers</option> is:
11752 </para>
11753 <literallayout>
11754 &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;
11755 </literallayout>
11756 <para>
11757 Any of the four sub-parts of the first field can be omitted. For normal use on
11758 the local host it can be left blank or set to just <quote>localhost</quote>.
11759 </para>
11760 <para>
11761 No database need be supplied &ndash; but if it is absent here, it must be given in
11762 the queries.
11763 </para>
11764 <para>
11765 If a MySQL query is issued that does not request any data (an insert, update,
11766 or delete command), the result of the lookup is the number of rows affected.
11767 </para>
11768 <para>
11769 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11770 anything (for example, setting a field to the value it already has), the result
11771 is zero because no rows are affected.
11772 </para>
11773 </section>
11774 <section id="SECID74">
11775 <title>Special PostgreSQL features</title>
11776 <para>
11777 PostgreSQL lookups can also use Unix domain socket connections to the database.
11778 This is usually faster and costs less CPU time than a TCP/IP connection.
11779 However it can be used only if the mail server runs on the same machine as the
11780 database server. A configuration line for PostgreSQL via Unix domain sockets
11781 looks like this:
11782 </para>
11783 <literallayout class="monospaced">
11784 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11785 </literallayout>
11786 <para>
11787 In other words, instead of supplying a host name, a path to the socket is
11788 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11789 visually confused with the delimiters for the other server parameters.
11790 </para>
11791 <para>
11792 If a PostgreSQL query is issued that does not request any data (an insert,
11793 update, or delete command), the result of the lookup is the number of rows
11794 affected.
11795 </para>
11796 </section>
11797 <section id="SECTsqlite">
11798 <title>More about SQLite</title>
11799 <para>
11800 <indexterm role="concept">
11801 <primary>lookup</primary>
11802 <secondary>SQLite</secondary>
11803 </indexterm>
11804 <indexterm role="concept">
11805 <primary>sqlite lookup type</primary>
11806 </indexterm>
11807 SQLite is different to the other SQL lookups because a file name is required in
11808 addition to the SQL query. An SQLite database is a single file, and there is no
11809 daemon as in the other SQL databases. The interface to Exim requires the name
11810 of the file, as an absolute path, to be given at the start of the query. It is
11811 separated from the query by white space. This means that the path name cannot
11812 contain white space. Here is a lookup expansion example:
11813 </para>
11814 <literallayout class="monospaced">
11815 ${lookup sqlite {/some/thing/sqlitedb \
11816   select name from aliases where id='userx';}}
11817 </literallayout>
11818 <para>
11819 In a list, the syntax is similar. For example:
11820 </para>
11821 <literallayout class="monospaced">
11822 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11823    select * from relays where ip='$sender_host_address';
11824 </literallayout>
11825 <para>
11826 The only character affected by the <option>quote_sqlite</option> operator is a single
11827 quote, which it doubles.
11828 </para>
11829 <para>
11830 <indexterm role="concept">
11831 <primary>timeout</primary>
11832 <secondary>SQLite</secondary>
11833 </indexterm>
11834 <indexterm role="concept">
11835 <primary>sqlite</primary>
11836 <secondary>lookup timeout</secondary>
11837 </indexterm>
11838 The SQLite library handles multiple simultaneous accesses to the database
11839 internally. Multiple readers are permitted, but only one process can
11840 update at once. Attempts to access the database while it is being updated
11841 are rejected after a timeout period, during which the SQLite library
11842 waits for the lock to be released. In Exim, the default timeout is set
11843 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11844 option.
11845 </para>
11846 </section>
11847 <section id="SECTredis">
11848 <title>More about Redis</title>
11849 <para>
11850 <indexterm role="concept">
11851 <primary>lookup</primary>
11852 <secondary>Redis</secondary>
11853 </indexterm>
11854 <indexterm role="concept">
11855 <primary>redis lookup type</primary>
11856 </indexterm>
11857 Redis is a non-SQL database. Commands are simple get and set.
11858 Examples:
11859 </para>
11860 <literallayout class="monospaced">
11861 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
11862 ${lookup redis{get keyname}}
11863 </literallayout>
11864 <para revisionflag="changed">
11865 As of release 4.91, "lightweight" support for Redis Cluster is available.
11866 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
11867 of which must be reachable from the running exim instance. If the cluster has
11868 master/slave replication, the list must contain all the master and slave
11869 servers.
11870 </para>
11871 <para revisionflag="changed">
11872 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
11873 immediately follow the redirection but treats the response as a DEFER, moving on
11874 to the next server in the <option>redis_servers</option> list until the correct server is
11875 reached.
11876 </para>
11877 <para>
11878 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11879 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11880 </para>
11881 </section>
11882 </chapter>
11883
11884 <chapter id="CHAPdomhosaddlists">
11885 <title>Domain, host, address, and local part lists</title>
11886 <titleabbrev>Domain, host, and address lists</titleabbrev>
11887 <para>
11888 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11889 <primary>lists of domains; hosts; etc.</primary>
11890 </indexterm>
11891 A number of Exim configuration options contain lists of domains, hosts,
11892 email addresses, or local parts. For example, the <option>hold_domains</option> option
11893 contains a list of domains whose delivery is currently suspended. These lists
11894 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11895 arguments to expansion conditions such as <option>match_domain</option>.
11896 </para>
11897 <para>
11898 Each item in one of these lists is a pattern to be matched against a domain,
11899 host, email address, or local part, respectively. In the sections below, the
11900 different types of pattern for each case are described, but first we cover some
11901 general facilities that apply to all four kinds of list.
11902 </para>
11903 <para>
11904 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11905 support all the complexity available in
11906 domain, host, address and local part lists.
11907 </para>
11908 <section id="SECTlistexpand">
11909 <title>Expansion of lists</title>
11910 <para>
11911 <indexterm role="concept">
11912 <primary>expansion</primary>
11913 <secondary>of lists</secondary>
11914 </indexterm>
11915 Each list is expanded as a single string before it is used.
11916 </para>
11917 <para>
11918 <emphasis>Exception: the router headers_remove option, where list-item
11919 splitting is done before string-expansion.</emphasis>
11920 </para>
11921 <para>
11922 The result of
11923 expansion must be a list, possibly containing empty items, which is split up
11924 into separate items for matching. By default, colon is the separator character,
11925 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11926 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11927 discusses the way to specify empty list items.
11928 </para>
11929 <para>
11930 If the string expansion is forced to fail, Exim behaves as if the item it is
11931 testing (domain, host, address, or local part) is not in the list. Other
11932 expansion failures cause temporary errors.
11933 </para>
11934 <para>
11935 If an item in a list is a regular expression, backslashes, dollars and possibly
11936 other special characters in the expression must be protected against
11937 misinterpretation by the string expander. The easiest way to do this is to use
11938 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11939 expression should not be expanded. For example, in an ACL you might have:
11940 </para>
11941 <literallayout class="monospaced">
11942 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11943                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11944 </literallayout>
11945 <para>
11946 The first item is a regular expression that is protected from expansion by
11947 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11948 senders based on the receiving domain.
11949 </para>
11950 </section>
11951 <section id="SECID76">
11952 <title>Negated items in lists</title>
11953 <para>
11954 <indexterm role="concept">
11955 <primary>list</primary>
11956 <secondary>negation</secondary>
11957 </indexterm>
11958 <indexterm role="concept">
11959 <primary>negation</primary>
11960 <secondary>in lists</secondary>
11961 </indexterm>
11962 Items in a list may be positive or negative. Negative items are indicated by a
11963 leading exclamation mark, which may be followed by optional white space. A list
11964 defines a set of items (domains, etc). When Exim processes one of these lists,
11965 it is trying to find out whether a domain, host, address, or local part
11966 (respectively) is in the set that is defined by the list. It works like this:
11967 </para>
11968 <para>
11969 The list is scanned from left to right. If a positive item is matched, the
11970 subject that is being checked is in the set; if a negative item is matched, the
11971 subject is not in the set. If the end of the list is reached without the
11972 subject having matched any of the patterns, it is in the set if the last item
11973 was a negative one, but not if it was a positive one. For example, the list in
11974 </para>
11975 <literallayout class="monospaced">
11976 domainlist relay_to_domains = !a.b.c : *.b.c
11977 </literallayout>
11978 <para>
11979 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11980 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11981 list is positive. However, if the setting were
11982 </para>
11983 <literallayout class="monospaced">
11984 domainlist relay_to_domains = !a.b.c
11985 </literallayout>
11986 <para>
11987 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11988 list is negative. In other words, a list that ends with a negative item behaves
11989 as if it had an extra item <literal>:*</literal> on the end.
11990 </para>
11991 <para>
11992 Another way of thinking about positive and negative items in lists is to read
11993 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11994 item.
11995 </para>
11996 </section>
11997 <section id="SECTfilnamlis">
11998 <title>File names in lists</title>
11999 <para>
12000 <indexterm role="concept">
12001 <primary>list</primary>
12002 <secondary>file name in</secondary>
12003 </indexterm>
12004 If an item in a domain, host, address, or local part list is an absolute file
12005 name (beginning with a slash character), each line of the file is read and
12006 processed as if it were an independent item in the list, except that further
12007 file names are not allowed,
12008 and no expansion of the data from the file takes place.
12009 Empty lines in the file are ignored, and the file may also contain comment
12010 lines:
12011 </para>
12012 <itemizedlist>
12013 <listitem>
12014 <para>
12015 For domain and host lists, if a # character appears anywhere in a line of the
12016 file, it and all following characters are ignored.
12017 </para>
12018 </listitem>
12019 <listitem>
12020 <para>
12021 Because local parts may legitimately contain # characters, a comment in an
12022 address list or local part list file is recognized only if # is preceded by
12023 white space or the start of the line. For example:
12024 </para>
12025 <literallayout class="monospaced">
12026 not#comment@x.y.z   # but this is a comment
12027 </literallayout>
12028 </listitem>
12029 </itemizedlist>
12030 <para>
12031 Putting a file name in a list has the same effect as inserting each line of the
12032 file as an item in the list (blank lines and comments excepted). However, there
12033 is one important difference: the file is read each time the list is processed,
12034 so if its contents vary over time, Exim&#x2019;s behaviour changes.
12035 </para>
12036 <para>
12037 If a file name is preceded by an exclamation mark, the sense of any match
12038 within the file is inverted. For example, if
12039 </para>
12040 <literallayout class="monospaced">
12041 hold_domains = !/etc/nohold-domains
12042 </literallayout>
12043 <para>
12044 and the file contains the lines
12045 </para>
12046 <literallayout class="monospaced">
12047 !a.b.c
12048 *.b.c
12049 </literallayout>
12050 <para>
12051 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
12052 any domain matching <literal>*.b.c</literal> is not.
12053 </para>
12054 </section>
12055 <section id="SECID77">
12056 <title>An lsearch file is not an out-of-line list</title>
12057 <para>
12058 As will be described in the sections that follow, lookups can be used in lists
12059 to provide indexed methods of checking list membership. There has been some
12060 confusion about the way <command>lsearch</command> lookups work in lists. Because
12061 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12062 sometimes thought that it is allowed to contain wild cards and other kinds of
12063 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12064 always fixed strings, just as for any other single-key lookup type.
12065 </para>
12066 <para>
12067 If you want to use a file to contain wild-card patterns that form part of a
12068 list, just give the file name on its own, without a search type, as described
12069 in the previous section. You could also use the <command>wildlsearch</command> or
12070 <command>nwildlsearch</command>, but there is no advantage in doing this.
12071 </para>
12072 </section>
12073 <section id="SECTnamedlists">
12074 <title>Named lists</title>
12075 <para>
12076 <indexterm role="concept">
12077 <primary>named lists</primary>
12078 </indexterm>
12079 <indexterm role="concept">
12080 <primary>list</primary>
12081 <secondary>named</secondary>
12082 </indexterm>
12083 A list of domains, hosts, email addresses, or local parts can be given a name
12084 which is then used to refer to the list elsewhere in the configuration. This is
12085 particularly convenient if the same list is required in several different
12086 places. It also allows lists to be given meaningful names, which can improve
12087 the readability of the configuration. For example, it is conventional to define
12088 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12089 locally on a host, using a configuration line such as
12090 </para>
12091 <literallayout class="monospaced">
12092 domainlist local_domains = localhost:my.dom.example
12093 </literallayout>
12094 <para>
12095 Named lists are referenced by giving their name preceded by a plus sign, so,
12096 for example, a router that is intended to handle local domains would be
12097 configured with the line
12098 </para>
12099 <literallayout class="monospaced">
12100 domains = +local_domains
12101 </literallayout>
12102 <para>
12103 The first router in a configuration is often one that handles all domains
12104 except the local ones, using a configuration with a negated item like this:
12105 </para>
12106 <literallayout class="monospaced">
12107 dnslookup:
12108   driver = dnslookup
12109   domains = ! +local_domains
12110   transport = remote_smtp
12111   no_more
12112 </literallayout>
12113 <para>
12114 The four kinds of named list are created by configuration lines starting with
12115 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12116 respectively. Then there follows the name that you are defining, followed by an
12117 equals sign and the list itself. For example:
12118 </para>
12119 <literallayout class="monospaced">
12120 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12121 addresslist bad_senders = cdb;/etc/badsenders
12122 </literallayout>
12123 <para>
12124 A named list may refer to other named lists:
12125 </para>
12126 <literallayout class="monospaced">
12127 domainlist  dom1 = first.example : second.example
12128 domainlist  dom2 = +dom1 : third.example
12129 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12130 </literallayout>
12131 <para>
12132 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12133 effect may not be what you intended, because the negation does not propagate
12134 out to the higher level. For example, consider:
12135 </para>
12136 <literallayout class="monospaced">
12137 domainlist  dom1 = !a.b
12138 domainlist  dom2 = +dom1 : *.b
12139 </literallayout>
12140 <para>
12141 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12142 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12143 means it matches the second list as well. The effect is not the same as
12144 </para>
12145 <literallayout class="monospaced">
12146 domainlist  dom2 = !a.b : *.b
12147 </literallayout>
12148 <para>
12149 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12150 referenced lists if you can.
12151 </para>
12152 <para>
12153 Named lists may have a performance advantage. When Exim is routing an
12154 address or checking an incoming message, it caches the result of tests on named
12155 lists. So, if you have a setting such as
12156 </para>
12157 <literallayout class="monospaced">
12158 domains = +local_domains
12159 </literallayout>
12160 <para>
12161 on several of your routers
12162 or in several ACL statements,
12163 the actual test is done only for the first one. However, the caching works only
12164 if there are no expansions within the list itself or any sublists that it
12165 references. In other words, caching happens only for lists that are known to be
12166 the same each time they are referenced.
12167 </para>
12168 <para>
12169 By default, there may be up to 16 named lists of each type. This limit can be
12170 extended by changing a compile-time variable. The use of domain and host lists
12171 is recommended for concepts such as local domains, relay domains, and relay
12172 hosts. The default configuration is set up like this.
12173 </para>
12174 </section>
12175 <section id="SECID78">
12176 <title>Named lists compared with macros</title>
12177 <para>
12178 <indexterm role="concept">
12179 <primary>list</primary>
12180 <secondary>named compared with macro</secondary>
12181 </indexterm>
12182 <indexterm role="concept">
12183 <primary>macro</primary>
12184 <secondary>compared with named list</secondary>
12185 </indexterm>
12186 At first sight, named lists might seem to be no different from macros in the
12187 configuration file. However, macros are just textual substitutions. If you
12188 write
12189 </para>
12190 <literallayout class="monospaced">
12191 ALIST = host1 : host2
12192 auth_advertise_hosts = !ALIST
12193 </literallayout>
12194 <para>
12195 it probably won&#x2019;t do what you want, because that is exactly the same as
12196 </para>
12197 <literallayout class="monospaced">
12198 auth_advertise_hosts = !host1 : host2
12199 </literallayout>
12200 <para>
12201 Notice that the second host name is not negated. However, if you use a host
12202 list, and write
12203 </para>
12204 <literallayout class="monospaced">
12205 hostlist alist = host1 : host2
12206 auth_advertise_hosts = ! +alist
12207 </literallayout>
12208 <para>
12209 the negation applies to the whole list, and so that is equivalent to
12210 </para>
12211 <literallayout class="monospaced">
12212 auth_advertise_hosts = !host1 : !host2
12213 </literallayout>
12214 </section>
12215 <section id="SECID79">
12216 <title>Named list caching</title>
12217 <para>
12218 <indexterm role="concept">
12219 <primary>list</primary>
12220 <secondary>caching of named</secondary>
12221 </indexterm>
12222 <indexterm role="concept">
12223 <primary>caching</primary>
12224 <secondary>named lists</secondary>
12225 </indexterm>
12226 While processing a message, Exim caches the result of checking a named list if
12227 it is sure that the list is the same each time. In practice, this means that
12228 the cache operates only if the list contains no $ characters, which guarantees
12229 that it will not change when it is expanded. Sometimes, however, you may have
12230 an expanded list that you know will be the same each time within a given
12231 message. For example:
12232 </para>
12233 <literallayout class="monospaced">
12234 domainlist special_domains = \
12235            ${lookup{$sender_host_address}cdb{/some/file}}
12236 </literallayout>
12237 <para>
12238 This provides a list of domains that depends only on the sending host&#x2019;s IP
12239 address. If this domain list is referenced a number of times (for example,
12240 in several ACL lines, or in several routers) the result of the check is not
12241 cached by default, because Exim does not know that it is going to be the
12242 same list each time.
12243 </para>
12244 <para>
12245 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12246 cache the result anyway. For example:
12247 </para>
12248 <literallayout class="monospaced">
12249 domainlist_cache special_domains = ${lookup{...
12250 </literallayout>
12251 <para>
12252 If you do this, you should be absolutely sure that caching is going to do
12253 the right thing in all cases. When in doubt, leave it out.
12254 </para>
12255 </section>
12256 <section id="SECTdomainlist">
12257 <title>Domain lists</title>
12258 <para>
12259 <indexterm role="concept">
12260 <primary>domain list</primary>
12261 <secondary>patterns for</secondary>
12262 </indexterm>
12263 <indexterm role="concept">
12264 <primary>list</primary>
12265 <secondary>domain list</secondary>
12266 </indexterm>
12267 Domain lists contain patterns that are to be matched against a mail domain.
12268 The following types of item may appear in domain lists:
12269 </para>
12270 <itemizedlist>
12271 <listitem>
12272 <para>
12273 <indexterm role="concept">
12274 <primary>primary host name</primary>
12275 </indexterm>
12276 <indexterm role="concept">
12277 <primary>host name</primary>
12278 <secondary>matched in domain list</secondary>
12279 </indexterm>
12280 <indexterm role="option">
12281 <primary><option>primary_hostname</option></primary>
12282 </indexterm>
12283 <indexterm role="concept">
12284 <primary>domain list</primary>
12285 <secondary>matching primary host name</secondary>
12286 </indexterm>
12287 <indexterm role="concept">
12288 <primary>@ in a domain list</primary>
12289 </indexterm>
12290 If a pattern consists of a single @ character, it matches the local host name,
12291 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12292 possible to use the same configuration file on several different hosts that
12293 differ only in their names.
12294 </para>
12295 </listitem>
12296 <listitem>
12297 <para>
12298 <indexterm role="concept">
12299 <primary>@[] in a domain list</primary>
12300 </indexterm>
12301 <indexterm role="concept">
12302 <primary>domain list</primary>
12303 <secondary>matching local IP interfaces</secondary>
12304 </indexterm>
12305 <indexterm role="concept">
12306 <primary>domain literal</primary>
12307 </indexterm>
12308 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12309 in square brackets (as in an email address that contains a domain literal), but
12310 only if that IP address is recognized as local for email routing purposes. The
12311 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12312 control which of a host&#x2019;s several IP addresses are treated as local.
12313 In today&#x2019;s Internet, the use of domain literals is controversial.
12314 </para>
12315 </listitem>
12316 <listitem>
12317 <para>
12318 <indexterm role="concept">
12319 <primary>@mx_any</primary>
12320 </indexterm>
12321 <indexterm role="concept">
12322 <primary>@mx_primary</primary>
12323 </indexterm>
12324 <indexterm role="concept">
12325 <primary>@mx_secondary</primary>
12326 </indexterm>
12327 <indexterm role="concept">
12328 <primary>domain list</primary>
12329 <secondary>matching MX pointers to local host</secondary>
12330 </indexterm>
12331 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12332 has an MX record pointing to the local host or to any host that is listed in
12333 <indexterm role="option">
12334 <primary><option>hosts_treat_as_local</option></primary>
12335 </indexterm>
12336 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12337 are similar, except that the first matches only when a primary MX target is the
12338 local host, and the second only when no primary MX target is the local host,
12339 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12340 preference value &ndash; there may of course be more than one of them.
12341 </para>
12342 <para>
12343 The MX lookup that takes place when matching a pattern of this type is
12344 performed with the resolver options for widening names turned off. Thus, for
12345 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12346 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12347 options of the <command>dnslookup</command> router for a discussion of domain widening.
12348 </para>
12349 <para>
12350 Sometimes you may want to ignore certain IP addresses when using one of these
12351 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12352 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12353 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12354 on a router). For example:
12355 </para>
12356 <literallayout class="monospaced">
12357 domains = @mx_any/ignore=127.0.0.1
12358 </literallayout>
12359 <para>
12360 This example matches any domain that has an MX record pointing to one of
12361 the local host&#x2019;s IP addresses other than 127.0.0.1.
12362 </para>
12363 <para>
12364 The list of IP addresses is in fact processed by the same code that processes
12365 host lists, so it may contain CIDR-coded network specifications and it may also
12366 contain negative items.
12367 </para>
12368 <para>
12369 Because the list of IP addresses is a sublist within a domain list, you have to
12370 be careful about delimiters if there is more than one address. Like any other
12371 list, the default delimiter can be changed. Thus, you might have:
12372 </para>
12373 <literallayout class="monospaced">
12374 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12375           an.other.domain : ...
12376 </literallayout>
12377 <para>
12378 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12379 involved, it is easiest to change the delimiter for the main list as well:
12380 </para>
12381 <literallayout class="monospaced">
12382 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12383           an.other.domain ? ...
12384 </literallayout>
12385 </listitem>
12386 <listitem>
12387 <para>
12388 <indexterm role="concept">
12389 <primary>asterisk</primary>
12390 <secondary>in domain list</secondary>
12391 </indexterm>
12392 <indexterm role="concept">
12393 <primary>domain list</primary>
12394 <secondary>asterisk in</secondary>
12395 </indexterm>
12396 <indexterm role="concept">
12397 <primary>domain list</primary>
12398 <secondary>matching <quote>ends with</quote></secondary>
12399 </indexterm>
12400 If a pattern starts with an asterisk, the remaining characters of the pattern
12401 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12402 domain lists differs from its use in partial matching lookups. In a domain
12403 list, the character following the asterisk need not be a dot, whereas partial
12404 matching works only in terms of dot-separated components. For example, a domain
12405 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12406 <emphasis>cipher.key.ex</emphasis>.
12407 </para>
12408 </listitem>
12409 <listitem>
12410 <para>
12411 <indexterm role="concept">
12412 <primary>regular expressions</primary>
12413 <secondary>in domain list</secondary>
12414 </indexterm>
12415 <indexterm role="concept">
12416 <primary>domain list</primary>
12417 <secondary>matching regular expression</secondary>
12418 </indexterm>
12419 If a pattern starts with a circumflex character, it is treated as a regular
12420 expression, and matched against the domain using a regular expression matching
12421 function. The circumflex is treated as part of the regular expression.
12422 Email domains are case-independent, so this regular expression match is by
12423 default case-independent, but you can make it case-dependent by starting it
12424 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12425 are given in chapter <xref linkend="CHAPregexp"/>.
12426 </para>
12427 <para>
12428 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12429 must escape any backslash and dollar characters in the regular expression, or
12430 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12431 it is not to be expanded (unless you really do want to build a regular
12432 expression by expansion, of course).
12433 </para>
12434 </listitem>
12435 <listitem>
12436 <para>
12437 <indexterm role="concept">
12438 <primary>lookup</primary>
12439 <secondary>in domain list</secondary>
12440 </indexterm>
12441 <indexterm role="concept">
12442 <primary>domain list</primary>
12443 <secondary>matching by lookup</secondary>
12444 </indexterm>
12445 If a pattern starts with the name of a single-key lookup type followed by a
12446 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12447 must be a file name in a suitable format for the lookup type. For example, for
12448 <quote>cdb;</quote> it must be an absolute path:
12449 </para>
12450 <literallayout class="monospaced">
12451 domains = cdb;/etc/mail/local_domains.cdb
12452 </literallayout>
12453 <para>
12454 The appropriate type of lookup is done on the file using the domain name as the
12455 key. In most cases, the data that is looked up is not used; Exim is interested
12456 only in whether or not the key is present in the file. However, when a lookup
12457 is used for the <option>domains</option> option on a router
12458 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12459 <varname>$domain_data</varname> variable and can be referred to in other router options or
12460 other statements in the same ACL.
12461 </para>
12462 </listitem>
12463 <listitem>
12464 <para>
12465 Any of the single-key lookup type names may be preceded by
12466 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12467 </para>
12468 <literallayout class="monospaced">
12469 domains = partial-dbm;/partial/domains
12470 </literallayout>
12471 <para>
12472 This causes partial matching logic to be invoked; a description of how this
12473 works is given in section <xref linkend="SECTpartiallookup"/>.
12474 </para>
12475 </listitem>
12476 <listitem>
12477 <para>
12478 <indexterm role="concept">
12479 <primary>asterisk</primary>
12480 <secondary>in lookup type</secondary>
12481 </indexterm>
12482 Any of the single-key lookup types may be followed by an asterisk. This causes
12483 a default lookup for a key consisting of a single asterisk to be done if the
12484 original lookup fails. This is not a useful feature when using a domain list to
12485 select particular domains (because any domain would match), but it might have
12486 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12487 expansion variable.
12488 </para>
12489 </listitem>
12490 <listitem>
12491 <para>
12492 If the pattern starts with the name of a query-style lookup type followed by a
12493 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12494 pattern must be an appropriate query for the lookup type, as described in
12495 chapter <xref linkend="CHAPfdlookup"/>. For example:
12496 </para>
12497 <literallayout class="monospaced">
12498 hold_domains = mysql;select domain from holdlist \
12499   where domain = '${quote_mysql:$domain}';
12500 </literallayout>
12501 <para>
12502 In most cases, the data that is looked up is not used (so for an SQL query, for
12503 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12504 whether or not the query succeeds. However, when a lookup is used for the
12505 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12506 variable and can be referred to in other options.
12507 </para>
12508 </listitem>
12509 <listitem>
12510 <para>
12511 <indexterm role="concept">
12512 <primary>domain list</primary>
12513 <secondary>matching literal domain name</secondary>
12514 </indexterm>
12515 If none of the above cases apply, a caseless textual comparison is made
12516 between the pattern and the domain.
12517 </para>
12518 </listitem>
12519 </itemizedlist>
12520 <para>
12521 Here is an example that uses several different kinds of pattern:
12522 </para>
12523 <literallayout class="monospaced">
12524 domainlist funny_domains = \
12525   @ : \
12526   lib.unseen.edu : \
12527   *.foundation.fict.example : \
12528   \N^[1-2]\d{3}\.fict\.example$\N : \
12529   partial-dbm;/opt/data/penguin/book : \
12530   nis;domains.byname : \
12531   nisplus;[name=$domain,status=local],domains.org_dir
12532 </literallayout>
12533 <para>
12534 There are obvious processing trade-offs among the various matching modes. Using
12535 an asterisk is faster than a regular expression, and listing a few names
12536 explicitly probably is too. The use of a file or database lookup is expensive,
12537 but may be the only option if hundreds of names are required. Because the
12538 patterns are tested in order, it makes sense to put the most commonly matched
12539 patterns earlier.
12540 </para>
12541 </section>
12542 <section id="SECThostlist">
12543 <title>Host lists</title>
12544 <para>
12545 <indexterm role="concept">
12546 <primary>host list</primary>
12547 <secondary>patterns in</secondary>
12548 </indexterm>
12549 <indexterm role="concept">
12550 <primary>list</primary>
12551 <secondary>host list</secondary>
12552 </indexterm>
12553 Host lists are used to control what remote hosts are allowed to do. For
12554 example, some hosts may be allowed to use the local host as a relay, and some
12555 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12556 two different ways, by name or by IP address. In a host list, some types of
12557 pattern are matched to a host name, and some are matched to an IP address.
12558 You need to be particularly careful with this when single-key lookups are
12559 involved, to ensure that the right value is being used as the key.
12560 </para>
12561 </section>
12562 <section id="SECID80">
12563 <title>Special host list patterns</title>
12564 <para>
12565 <indexterm role="concept">
12566 <primary>empty item in hosts list</primary>
12567 </indexterm>
12568 <indexterm role="concept">
12569 <primary>host list</primary>
12570 <secondary>empty string in</secondary>
12571 </indexterm>
12572 If a host list item is the empty string, it matches only when no remote host is
12573 involved. This is the case when a message is being received from a local
12574 process using SMTP on the standard input, that is, when a TCP/IP connection is
12575 not used.
12576 </para>
12577 <para>
12578 <indexterm role="concept">
12579 <primary>asterisk</primary>
12580 <secondary>in host list</secondary>
12581 </indexterm>
12582 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12583 the IP address nor the name is actually inspected.
12584 </para>
12585 </section>
12586 <section id="SECThoslispatip">
12587 <title>Host list patterns that match by IP address</title>
12588 <para>
12589 <indexterm role="concept">
12590 <primary>host list</primary>
12591 <secondary>matching IP addresses</secondary>
12592 </indexterm>
12593 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12594 the incoming address actually appears in the IPv6 host as
12595 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12596 list, it is converted into a traditional IPv4 address first. (Not all operating
12597 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12598 concerns.)
12599 </para>
12600 <para>
12601 The following types of pattern in a host list check the remote host by
12602 inspecting its IP address:
12603 </para>
12604 <itemizedlist>
12605 <listitem>
12606 <para>
12607 If the pattern is a plain domain name (not a regular expression, not starting
12608 with *, not a lookup of any kind), Exim calls the operating system function
12609 to find the associated IP address(es). Exim uses the newer
12610 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12611 This typically causes a forward DNS lookup of the name. The result is compared
12612 with the IP address of the subject host.
12613 </para>
12614 <para>
12615 If there is a temporary problem (such as a DNS timeout) with the host name
12616 lookup, a temporary error occurs. For example, if the list is being used in an
12617 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12618 temporary SMTP error code. If no IP address can be found for the host name,
12619 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12620 </para>
12621 </listitem>
12622 <listitem>
12623 <para>
12624 <indexterm role="concept">
12625 <primary>@ in a host list</primary>
12626 </indexterm>
12627 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12628 domain name, as just described.
12629 </para>
12630 </listitem>
12631 <listitem>
12632 <para>
12633 If the pattern is an IP address, it is matched against the IP address of the
12634 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12635 IPv6 addresses can be given in colon-separated format, but the colons have to
12636 be doubled so as not to be taken as item separators when the default list
12637 separator is used. IPv6 addresses are recognized even when Exim is compiled
12638 without IPv6 support. This means that if they appear in a host list on an
12639 IPv4-only host, Exim will not treat them as host names. They are just addresses
12640 that can never match a client host.
12641 </para>
12642 </listitem>
12643 <listitem>
12644 <para>
12645 <indexterm role="concept">
12646 <primary>@[] in a host list</primary>
12647 </indexterm>
12648 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12649 the local host. For example, if the local host is an IPv4 host with one
12650 interface address 10.45.23.56, these two ACL statements have the same effect:
12651 </para>
12652 <literallayout class="monospaced">
12653 accept hosts = 127.0.0.1 : 10.45.23.56
12654 accept hosts = @[]
12655 </literallayout>
12656 </listitem>
12657 <listitem>
12658 <para>
12659 <indexterm role="concept">
12660 <primary>CIDR notation</primary>
12661 </indexterm>
12662 If the pattern is an IP address followed by a slash and a mask length (for
12663 example 10.11.42.0/24), it is matched against the IP address of the subject
12664 host under the given mask. This allows, an entire network of hosts to be
12665 included (or excluded) by a single item. The mask uses CIDR notation; it
12666 specifies the number of address bits that must match, starting from the most
12667 significant end of the address.
12668 </para>
12669 <para>
12670 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12671 of a range of addresses. It is the number of bits in the network portion of the
12672 address. The above example specifies a 24-bit netmask, so it matches all 256
12673 addresses in the 10.11.42.0 network. An item such as
12674 </para>
12675 <literallayout class="monospaced">
12676 192.168.23.236/31
12677 </literallayout>
12678 <para>
12679 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12680 32 for an IPv4 address is the same as no mask at all; just a single address
12681 matches.
12682 </para>
12683 <para>
12684 Here is another example which shows an IPv4 and an IPv6 network:
12685 </para>
12686 <literallayout class="monospaced">
12687 recipient_unqualified_hosts = 192.168.0.0/16: \
12688                               3ffe::ffff::836f::::/48
12689 </literallayout>
12690 <para>
12691 The doubling of list separator characters applies only when these items
12692 appear inline in a host list. It is not required when indirecting via a file.
12693 For example:
12694 </para>
12695 <literallayout class="monospaced">
12696 recipient_unqualified_hosts = /opt/exim/unqualnets
12697 </literallayout>
12698 <para>
12699 could make use of a file containing
12700 </para>
12701 <literallayout class="monospaced">
12702 172.16.0.0/12
12703 3ffe:ffff:836f::/48
12704 </literallayout>
12705 <para>
12706 to have exactly the same effect as the previous example. When listing IPv6
12707 addresses inline, it is usually more convenient to use the facility for
12708 changing separator characters. This list contains the same two networks:
12709 </para>
12710 <literallayout class="monospaced">
12711 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12712                                  3ffe:ffff:836f::/48
12713 </literallayout>
12714 <para>
12715 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12716 list.
12717 </para>
12718 </listitem>
12719 </itemizedlist>
12720 </section>
12721 <section id="SECThoslispatsikey">
12722 <title>Host list patterns for single-key lookups by host address</title>
12723 <para>
12724 <indexterm role="concept">
12725 <primary>host list</primary>
12726 <secondary>lookup of IP address</secondary>
12727 </indexterm>
12728 When a host is to be identified by a single-key lookup of its complete IP
12729 address, the pattern takes this form:
12730 </para>
12731 <literallayout>
12732 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12733 </literallayout>
12734 <para>
12735 For example:
12736 </para>
12737 <literallayout class="monospaced">
12738 hosts_lookup = net-cdb;/hosts-by-ip.db
12739 </literallayout>
12740 <para>
12741 The text form of the IP address of the subject host is used as the lookup key.
12742 IPv6 addresses are converted to an unabbreviated form, using lower case
12743 letters, with dots as separators because colon is the key terminator in
12744 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12745 quoting the keys, but this is a facility that was added later.] The data
12746 returned by the lookup is not used.
12747 </para>
12748 <para>
12749 <indexterm role="concept">
12750 <primary>IP address</primary>
12751 <secondary>masking</secondary>
12752 </indexterm>
12753 <indexterm role="concept">
12754 <primary>host list</primary>
12755 <secondary>masked IP address</secondary>
12756 </indexterm>
12757 Single-key lookups can also be performed using masked IP addresses, using
12758 patterns of this form:
12759 </para>
12760 <literallayout>
12761 <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>
12762 </literallayout>
12763 <para>
12764 For example:
12765 </para>
12766 <literallayout class="monospaced">
12767 net24-dbm;/networks.db
12768 </literallayout>
12769 <para>
12770 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12771 length. A textual string is constructed from the masked value, followed by the
12772 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12773 is 192.168.34.6, the key that is looked up for the above example is
12774 <quote>192.168.34.0/24</quote>.
12775 </para>
12776 <para>
12777 When an IPv6 address is converted to a string, dots are normally used instead
12778 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12779 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12780 to quote keys was made available in <command>lsearch</command> files. However, the more
12781 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12782 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12783 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12784 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12785 addresses are always used.
12786 </para>
12787 <para>
12788 Ideally, it would be nice to tidy up this anomalous situation by changing to
12789 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12790 However, this would be an incompatible change that might break some existing
12791 configurations.
12792 </para>
12793 <para>
12794 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12795 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12796 the former case the key strings include the mask value, whereas in the latter
12797 case the IP address is used on its own.
12798 </para>
12799 </section>
12800 <section id="SECThoslispatnam">
12801 <title>Host list patterns that match by host name</title>
12802 <para>
12803 <indexterm role="concept">
12804 <primary>host</primary>
12805 <secondary>lookup failures</secondary>
12806 </indexterm>
12807 <indexterm role="concept">
12808 <primary>unknown host name</primary>
12809 </indexterm>
12810 <indexterm role="concept">
12811 <primary>host list</primary>
12812 <secondary>matching host name</secondary>
12813 </indexterm>
12814 There are several types of pattern that require Exim to know the name of the
12815 remote host. These are either wildcard patterns or lookups by name. (If a
12816 complete hostname is given without any wildcarding, it is used to find an IP
12817 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12818 above.)
12819 </para>
12820 <para>
12821 If the remote host name is not already known when Exim encounters one of these
12822 patterns, it has to be found from the IP address.
12823 Although many sites on the Internet are conscientious about maintaining reverse
12824 DNS data for their hosts, there are also many that do not do this.
12825 Consequently, a name cannot always be found, and this may lead to unwanted
12826 effects. Take care when configuring host lists with wildcarded name patterns.
12827 Consider what will happen if a name cannot be found.
12828 </para>
12829 <para>
12830 Because of the problems of determining host names from IP addresses, matching
12831 against host names is not as common as matching against IP addresses.
12832 </para>
12833 <para>
12834 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12835 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12836 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12837 are done can be changed by setting the <option>host_lookup_order</option> option. For
12838 security, once Exim has found one or more names, it looks up the IP addresses
12839 for these names and compares them with the IP address that it started with.
12840 Only those names whose IP addresses match are accepted. Any other names are
12841 discarded. If no names are left, Exim behaves as if the host name cannot be
12842 found. In the most common case there is only one name and one IP address.
12843 </para>
12844 <para>
12845 There are some options that control what happens if a host name cannot be
12846 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12847 </para>
12848 <para>
12849 <indexterm role="concept">
12850 <primary>host</primary>
12851 <secondary>alias for</secondary>
12852 </indexterm>
12853 <indexterm role="concept">
12854 <primary>alias for host</primary>
12855 </indexterm>
12856 As a result of aliasing, hosts may have more than one name. When processing any
12857 of the following types of pattern, all the host&#x2019;s names are checked:
12858 </para>
12859 <itemizedlist>
12860 <listitem>
12861 <para>
12862 <indexterm role="concept">
12863 <primary>asterisk</primary>
12864 <secondary>in host list</secondary>
12865 </indexterm>
12866 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12867 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12868 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12869 requirement. Other kinds of wildcarding require the use of a regular
12870 expression.
12871 </para>
12872 </listitem>
12873 <listitem>
12874 <para>
12875 <indexterm role="concept">
12876 <primary>regular expressions</primary>
12877 <secondary>in host list</secondary>
12878 </indexterm>
12879 <indexterm role="concept">
12880 <primary>host list</primary>
12881 <secondary>regular expression in</secondary>
12882 </indexterm>
12883 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12884 matched against the host name. Host names are case-independent, so this regular
12885 expression match is by default case-independent, but you can make it
12886 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12887 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12888 example,
12889 </para>
12890 <literallayout class="monospaced">
12891 ^(a|b)\.c\.d$
12892 </literallayout>
12893 <para>
12894 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12895 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12896 that backslash and dollar characters are not misinterpreted as part of the
12897 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12898 part of the string as non-expandable. For example:
12899 </para>
12900 <literallayout class="monospaced">
12901 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12902 </literallayout>
12903 <para>
12904 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12905 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12906 example. Without it, a match at the start of the host name is all that is
12907 required.
12908 </para>
12909 </listitem>
12910 </itemizedlist>
12911 </section>
12912 <section id="SECTbehipnot">
12913 <title>Behaviour when an IP address or name cannot be found</title>
12914 <para>
12915 <indexterm role="concept">
12916 <primary>host</primary>
12917 <secondary>lookup failures, permanent</secondary>
12918 </indexterm>
12919 While processing a host list, Exim may need to look up an IP address from a
12920 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12921 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12922 behaviour when it fails to find the information it is seeking is the same.
12923 </para>
12924 <para>
12925 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12926 apply to temporary DNS errors, whose handling is described in the next section.
12927 </para>
12928 <para>
12929 <indexterm role="concept">
12930 <primary><literal>+include_unknown</literal></primary>
12931 </indexterm>
12932 <indexterm role="concept">
12933 <primary><literal>+ignore_unknown</literal></primary>
12934 </indexterm>
12935 Exim parses a host list from left to right. If it encounters a permanent
12936 lookup failure in any item in the host list before it has found a match,
12937 Exim treats it as a failure and the default behavior is as if the host
12938 does not match the list. This may not always be what you want to happen.
12939 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12940 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12941 not recognized in an indirected file).
12942 </para>
12943 <itemizedlist>
12944 <listitem>
12945 <para>
12946 If any item that follows <literal>+include_unknown</literal> requires information that
12947 cannot found, Exim behaves as if the host does match the list. For example,
12948 </para>
12949 <literallayout class="monospaced">
12950 host_reject_connection = +include_unknown:*.enemy.ex
12951 </literallayout>
12952 <para>
12953 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12954 any hosts whose name it cannot find.
12955 </para>
12956 </listitem>
12957 <listitem>
12958 <para>
12959 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12960 be found, Exim ignores that item and proceeds to the rest of the list. For
12961 example:
12962 </para>
12963 <literallayout class="monospaced">
12964 accept hosts = +ignore_unknown : friend.example : \
12965                192.168.4.5
12966 </literallayout>
12967 <para>
12968 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12969 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12970 name can be found for 192.168.4.5, it is rejected.
12971 </para>
12972 </listitem>
12973 </itemizedlist>
12974 <para>
12975 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12976 list. The effect of each one lasts until the next, or until the end of the
12977 list.
12978 </para>
12979 </section>
12980 <section id="SECTmixwilhos">
12981 <title>Mixing wildcarded host names and addresses in host lists</title>
12982 <para>
12983 <indexterm role="concept">
12984 <primary>host list</primary>
12985 <secondary>mixing names and addresses in</secondary>
12986 </indexterm>
12987 </para>
12988 <para>
12989 This section explains the host/ip processing logic with the same concepts
12990 as the previous section, but specifically addresses what happens when a
12991 wildcarded hostname is one of the items in the hostlist.
12992 </para>
12993 <itemizedlist>
12994 <listitem>
12995 <para>
12996 If you have name lookups or wildcarded host names and
12997 IP addresses in the same host list, you should normally put the IP
12998 addresses first. For example, in an ACL you could have:
12999 </para>
13000 <literallayout class="monospaced">
13001 accept hosts = 10.9.8.7 : *.friend.example
13002 </literallayout>
13003 <para>
13004 The reason you normally would order it this way lies in the
13005 left-to-right way that Exim processes lists.  It can test IP addresses
13006 without doing any DNS lookups, but when it reaches an item that requires
13007 a host name, it fails if it cannot find a host name to compare with the
13008 pattern. If the above list is given in the opposite order, the
13009 <option>accept</option> statement fails for a host whose name cannot be found, even
13010 if its IP address is 10.9.8.7.
13011 </para>
13012 </listitem>
13013 <listitem>
13014 <para>
13015 If you really do want to do the name check first, and still recognize the IP
13016 address, you can rewrite the ACL like this:
13017 </para>
13018 <literallayout class="monospaced">
13019 accept hosts = *.friend.example
13020 accept hosts = 10.9.8.7
13021 </literallayout>
13022 <para>
13023 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
13024 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
13025 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
13026 this section.
13027 </para>
13028 </listitem>
13029 </itemizedlist>
13030 </section>
13031 <section id="SECTtemdnserr">
13032 <title>Temporary DNS errors when looking up host information</title>
13033 <para>
13034 <indexterm role="concept">
13035 <primary>host</primary>
13036 <secondary>lookup failures, temporary</secondary>
13037 </indexterm>
13038 <indexterm role="concept">
13039 <primary><literal>+include_defer</literal></primary>
13040 </indexterm>
13041 <indexterm role="concept">
13042 <primary><literal>+ignore_defer</literal></primary>
13043 </indexterm>
13044 A temporary DNS lookup failure normally causes a defer action (except when
13045 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
13046 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
13047 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
13048 section. These options should be used with care, probably only in non-critical
13049 host lists such as whitelists.
13050 </para>
13051 </section>
13052 <section id="SECThoslispatnamsk">
13053 <title>Host list patterns for single-key lookups by host name</title>
13054 <para>
13055 <indexterm role="concept">
13056 <primary>unknown host name</primary>
13057 </indexterm>
13058 <indexterm role="concept">
13059 <primary>host list</primary>
13060 <secondary>matching host name</secondary>
13061 </indexterm>
13062 If a pattern is of the form
13063 </para>
13064 <literallayout>
13065 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
13066 </literallayout>
13067 <para>
13068 for example
13069 </para>
13070 <literallayout class="monospaced">
13071 dbm;/host/accept/list
13072 </literallayout>
13073 <para>
13074 a single-key lookup is performed, using the host name as its key. If the
13075 lookup succeeds, the host matches the item. The actual data that is looked up
13076 is not used.
13077 </para>
13078 <para>
13079 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13080 keys in the file, not IP addresses. If you want to do lookups based on IP
13081 addresses, you must precede the search type with <quote>net-</quote> (see section
13082 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13083 two items in the same list, one doing an address lookup and one doing a name
13084 lookup, both using the same file.
13085 </para>
13086 </section>
13087 <section id="SECID81">
13088 <title>Host list patterns for query-style lookups</title>
13089 <para>
13090 If a pattern is of the form
13091 </para>
13092 <literallayout>
13093 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13094 </literallayout>
13095 <para>
13096 the query is obeyed, and if it succeeds, the host matches the item. The actual
13097 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13098 <varname>$sender_host_name</varname> can be used in the query. For example:
13099 </para>
13100 <literallayout class="monospaced">
13101 hosts_lookup = pgsql;\
13102   select ip from hostlist where ip='$sender_host_address'
13103 </literallayout>
13104 <para>
13105 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13106 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13107 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13108 operator.
13109 </para>
13110 <para>
13111 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13112 looks up the host name if it has not already done so. (See section
13113 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13114 </para>
13115 <para>
13116 Historical note: prior to release 4.30, Exim would always attempt to find a
13117 host name before running the query, unless the search type was preceded by
13118 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13119 still recognized for query-style lookups, but its presence or absence has no
13120 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13121 See section <xref linkend="SECThoslispatsikey"/>.)
13122 </para>
13123 </section>
13124 <section id="SECTaddresslist">
13125 <title>Address lists</title>
13126 <para>
13127 <indexterm role="concept">
13128 <primary>list</primary>
13129 <secondary>address list</secondary>
13130 </indexterm>
13131 <indexterm role="concept">
13132 <primary>address list</primary>
13133 <secondary>empty item</secondary>
13134 </indexterm>
13135 <indexterm role="concept">
13136 <primary>address list</primary>
13137 <secondary>patterns</secondary>
13138 </indexterm>
13139 Address lists contain patterns that are matched against mail addresses. There
13140 is one special case to be considered: the sender address of a bounce message is
13141 always empty. You can test for this by providing an empty item in an address
13142 list. For example, you can set up a router to process bounce messages by
13143 using this option setting:
13144 </para>
13145 <literallayout class="monospaced">
13146 senders = :
13147 </literallayout>
13148 <para>
13149 The presence of the colon creates an empty item. If you do not provide any
13150 data, the list is empty and matches nothing. The empty sender can also be
13151 detected by a regular expression that matches an empty string,
13152 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13153 </para>
13154 <para>
13155 Non-empty items in an address list can be straightforward email addresses. For
13156 example:
13157 </para>
13158 <literallayout class="monospaced">
13159 senders = jbc@askone.example : hs@anacreon.example
13160 </literallayout>
13161 <para>
13162 A certain amount of wildcarding is permitted. If a pattern contains an @
13163 character, but is not a regular expression and does not begin with a
13164 semicolon-terminated lookup type (described below), the local part of the
13165 subject address is compared with the local part of the pattern, which may start
13166 with an asterisk. If the local parts match, the domain is checked in exactly
13167 the same way as for a pattern in a domain list. For example, the domain can be
13168 wildcarded, refer to a named list, or be a lookup:
13169 </para>
13170 <literallayout class="monospaced">
13171 deny senders = *@*.spamming.site:\
13172                *@+hostile_domains:\
13173                bozo@partial-lsearch;/list/of/dodgy/sites:\
13174                *@dbm;/bad/domains.db
13175 </literallayout>
13176 <para>
13177 <indexterm role="concept">
13178 <primary>local part</primary>
13179 <secondary>starting with !</secondary>
13180 </indexterm>
13181 <indexterm role="concept">
13182 <primary>address list</primary>
13183 <secondary>local part starting with !</secondary>
13184 </indexterm>
13185 If a local part that begins with an exclamation mark is required, it has to be
13186 specified using a regular expression, because otherwise the exclamation mark is
13187 treated as a sign of negation, as is standard in lists.
13188 </para>
13189 <para>
13190 If a non-empty pattern that is not a regular expression or a lookup does not
13191 contain an @ character, it is matched against the domain part of the subject
13192 address. The only two formats that are recognized this way are a literal
13193 domain, or a domain pattern that starts with *. In both these cases, the effect
13194 is the same as if <literal>*@</literal> preceded the pattern. For example:
13195 </para>
13196 <literallayout class="monospaced">
13197 deny senders = enemy.domain : *.enemy.domain
13198 </literallayout>
13199 <para>
13200 The following kinds of more complicated address list pattern can match any
13201 address, including the empty address that is characteristic of bounce message
13202 senders:
13203 </para>
13204 <itemizedlist>
13205 <listitem>
13206 <para>
13207 <indexterm role="concept">
13208 <primary>regular expressions</primary>
13209 <secondary>in address list</secondary>
13210 </indexterm>
13211 <indexterm role="concept">
13212 <primary>address list</primary>
13213 <secondary>regular expression in</secondary>
13214 </indexterm>
13215 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13216 done against the complete address, with the pattern as the regular expression.
13217 You must take care that backslash and dollar characters are not misinterpreted
13218 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13219 to mark that part of the string as non-expandable. For example:
13220 </para>
13221 <literallayout class="monospaced">
13222 deny senders = \N^.*this.*@example\.com$\N : \
13223                \N^\d{8}.+@spamhaus.example$\N : ...
13224 </literallayout>
13225 <para>
13226 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13227 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13228 </para>
13229 </listitem>
13230 <listitem>
13231 <para>
13232 <indexterm role="concept">
13233 <primary>address list</primary>
13234 <secondary>lookup for complete address</secondary>
13235 </indexterm>
13236 Complete addresses can be looked up by using a pattern that starts with a
13237 lookup type terminated by a semicolon, followed by the data for the lookup. For
13238 example:
13239 </para>
13240 <literallayout class="monospaced">
13241 deny senders = cdb;/etc/blocked.senders : \
13242   mysql;select address from blocked where \
13243   address='${quote_mysql:$sender_address}'
13244 </literallayout>
13245 <para>
13246 Both query-style and single-key lookup types can be used. For a single-key
13247 lookup type, Exim uses the complete address as the key. However, empty keys are
13248 not supported for single-key lookups, so a match against the empty address
13249 always fails. This restriction does not apply to query-style lookups.
13250 </para>
13251 <para>
13252 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13253 cannot be used, and is ignored if specified, with an entry being written to the
13254 panic log.
13255 <indexterm role="concept">
13256 <primary>*@ with single-key lookup</primary>
13257 </indexterm>
13258 However, you can configure lookup defaults, as described in section
13259 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13260 default. For example, with this lookup:
13261 </para>
13262 <literallayout class="monospaced">
13263 accept senders = lsearch*@;/some/file
13264 </literallayout>
13265 <para>
13266 the file could contains lines like this:
13267 </para>
13268 <literallayout class="monospaced">
13269 user1@domain1.example
13270 *@domain2.example
13271 </literallayout>
13272 <para>
13273 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13274 that are tried is:
13275 </para>
13276 <literallayout class="monospaced">
13277 nimrod@jaeger.example
13278 *@jaeger.example
13279 *
13280 </literallayout>
13281 <para>
13282 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13283 would mean that every address matches, thus rendering the test useless.
13284 </para>
13285 <para>
13286 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13287 </para>
13288 <literallayout class="monospaced">
13289 deny recipients = dbm*@;/some/file
13290 deny recipients = *@dbm;/some/file
13291 </literallayout>
13292 <para>
13293 The first does a whole address lookup, with defaulting, as just described,
13294 because it starts with a lookup type. The second matches the local part and
13295 domain independently, as described in a bullet point below.
13296 </para>
13297 </listitem>
13298 </itemizedlist>
13299 <para>
13300 The following kinds of address list pattern can match only non-empty addresses.
13301 If the subject address is empty, a match against any of these pattern types
13302 always fails.
13303 </para>
13304 <itemizedlist>
13305 <listitem>
13306 <para>
13307 <indexterm role="concept">
13308 <primary>@@ with single-key lookup</primary>
13309 </indexterm>
13310 <indexterm role="concept">
13311 <primary>address list</primary>
13312 <secondary>@@ lookup type</secondary>
13313 </indexterm>
13314 <indexterm role="concept">
13315 <primary>address list</primary>
13316 <secondary>split local part and domain</secondary>
13317 </indexterm>
13318 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13319 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13320 split into a local part and a domain. The domain is looked up in the file. If
13321 it is not found, there is no match. If it is found, the data that is looked up
13322 from the file is treated as a colon-separated list of local part patterns, each
13323 of which is matched against the subject local part in turn.
13324 </para>
13325 <para>
13326 <indexterm role="concept">
13327 <primary>asterisk</primary>
13328 <secondary>in address list</secondary>
13329 </indexterm>
13330 The lookup may be a partial one, and/or one involving a search for a default
13331 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13332 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13333 even be further lookups. They may also be independently negated. For example,
13334 with
13335 </para>
13336 <literallayout class="monospaced">
13337 deny senders = @@dbm;/etc/reject-by-domain
13338 </literallayout>
13339 <para>
13340 the data from which the DBM file is built could contain lines like
13341 </para>
13342 <literallayout class="monospaced">
13343 baddomain.com:  !postmaster : *
13344 </literallayout>
13345 <para>
13346 to reject all senders except <option>postmaster</option> from that domain.
13347 </para>
13348 <para>
13349 <indexterm role="concept">
13350 <primary>local part</primary>
13351 <secondary>starting with !</secondary>
13352 </indexterm>
13353 If a local part that actually begins with an exclamation mark is required, it
13354 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13355 may be split over several lines by indenting the second and subsequent lines,
13356 but the separating colon must still be included at line breaks. White space
13357 surrounding the colons is ignored. For example:
13358 </para>
13359 <literallayout class="monospaced">
13360 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13361   spammer3 : spammer4
13362 </literallayout>
13363 <para>
13364 As in all colon-separated lists in Exim, a colon can be included in an item by
13365 doubling.
13366 </para>
13367 <para>
13368 If the last item in the list starts with a right angle-bracket, the remainder
13369 of the item is taken as a new key to look up in order to obtain a continuation
13370 list of local parts. The new key can be any sequence of characters. Thus one
13371 might have entries like
13372 </para>
13373 <literallayout class="monospaced">
13374 aol.com: spammer1 : spammer 2 : &gt;*
13375 xyz.com: spammer3 : &gt;*
13376 *:       ^\d{8}$
13377 </literallayout>
13378 <para>
13379 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13380 local parts for all domains, in addition to the specific local parts listed for
13381 each domain. Of course, using this feature costs another lookup each time a
13382 chain is followed, but the effort needed to maintain the data is reduced.
13383 </para>
13384 <para>
13385 <indexterm role="concept">
13386 <primary>loop</primary>
13387 <secondary>in lookups</secondary>
13388 </indexterm>
13389 It is possible to construct loops using this facility, and in order to catch
13390 them, the chains may be no more than fifty items long.
13391 </para>
13392 </listitem>
13393 <listitem>
13394 <para>
13395 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13396 lookup, but in this case, the chaining facility is not available. The lookup
13397 can only return a single list of local parts.
13398 </para>
13399 </listitem>
13400 </itemizedlist>
13401 <para>
13402 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13403 in these two examples:
13404 </para>
13405 <literallayout class="monospaced">
13406 senders = +my_list
13407 senders = *@+my_list
13408 </literallayout>
13409 <para>
13410 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13411 example it is a named domain list.
13412 </para>
13413 </section>
13414 <section id="SECTcasletadd">
13415 <title>Case of letters in address lists</title>
13416 <para>
13417 <indexterm role="concept">
13418 <primary>case of local parts</primary>
13419 </indexterm>
13420 <indexterm role="concept">
13421 <primary>address list</primary>
13422 <secondary>case forcing</secondary>
13423 </indexterm>
13424 <indexterm role="concept">
13425 <primary>case forcing in address lists</primary>
13426 </indexterm>
13427 Domains in email addresses are always handled caselessly, but for local parts
13428 case may be significant on some systems (see <option>caseful_local_part</option> for how
13429 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13430 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13431 blocking lists should be done in a case-independent manner. Since most address
13432 lists in Exim are used for this kind of control, Exim attempts to do this by
13433 default.
13434 </para>
13435 <para>
13436 The domain portion of an address is always lowercased before matching it to an
13437 address list. The local part is lowercased by default, and any string
13438 comparisons that take place are done caselessly. This means that the data in
13439 the address list itself, in files included as plain file names, and in any file
13440 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13441 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13442 works caselessly) must be in lower case, because these lookups are not
13443 case-independent.
13444 </para>
13445 <para>
13446 <indexterm role="concept">
13447 <primary><literal>+caseful</literal></primary>
13448 </indexterm>
13449 To allow for the possibility of caseful address list matching, if an item in
13450 an address list is the string <quote>+caseful</quote>, the original case of the local
13451 part is restored for any comparisons that follow, and string comparisons are no
13452 longer case-independent. This does not affect the domain, which remains in
13453 lower case. However, although independent matches on the domain alone are still
13454 performed caselessly, regular expressions that match against an entire address
13455 become case-sensitive after <quote>+caseful</quote> has been seen.
13456 </para>
13457 </section>
13458 <section id="SECTlocparlis">
13459 <title>Local part lists</title>
13460 <para>
13461 <indexterm role="concept">
13462 <primary>list</primary>
13463 <secondary>local part list</secondary>
13464 </indexterm>
13465 <indexterm role="concept">
13466 <primary>local part</primary>
13467 <secondary>list</secondary>
13468 </indexterm>
13469 Case-sensitivity in local part lists is handled in the same way as for address
13470 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13471 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13472 set false, the subject is lowercased and the matching is initially
13473 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13474 matching in the local part list, but not elsewhere in the router. If
13475 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13476 option is case-sensitive from the start.
13477 </para>
13478 <para>
13479 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13480 comments are handled in the same way as address lists &ndash; they are recognized
13481 only if the # is preceded by white space or the start of the line.
13482 Otherwise, local part lists are matched in the same way as domain lists, except
13483 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13484 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13485 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13486 types.
13487 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13488 </para>
13489 </section>
13490 </chapter>
13491
13492 <chapter id="CHAPexpand">
13493 <title>String expansions</title>
13494 <para>
13495 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13496 <primary>expansion</primary>
13497 <secondary>of strings</secondary>
13498 </indexterm>
13499 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13500 them are expanded every time they are used; others are expanded only once.
13501 </para>
13502 <para>
13503 When a string is being expanded it is copied verbatim from left to right except
13504 when a dollar or backslash character is encountered. A dollar specifies the
13505 start of a portion of the string that is interpreted and replaced as described
13506 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13507 escape character, as described in the following section.
13508 </para>
13509 <para>
13510 Whether a string is expanded depends upon the context.  Usually this is solely
13511 dependent upon the option for which a value is sought; in this documentation,
13512 options for which string expansion is performed are marked with &dagger; after
13513 the data type.  ACL rules always expand strings.  A couple of expansion
13514 conditions do not expand some of the brace-delimited branches, for security
13515 reasons.
13516 </para>
13517 <section id="SECTlittext">
13518 <title>Literal text in expanded strings</title>
13519 <para>
13520 <indexterm role="concept">
13521 <primary>expansion</primary>
13522 <secondary>including literal text</secondary>
13523 </indexterm>
13524 An uninterpreted dollar can be included in an expanded string by putting a
13525 backslash in front of it. A backslash can be used to prevent any special
13526 character being treated specially in an expansion, including backslash itself.
13527 If the string appears in quotes in the configuration file, two backslashes are
13528 required because the quotes themselves cause interpretation of backslashes when
13529 the string is read in (see section <xref linkend="SECTstrings"/>).
13530 </para>
13531 <para>
13532 <indexterm role="concept">
13533 <primary>expansion</primary>
13534 <secondary>non-expandable substrings</secondary>
13535 </indexterm>
13536 A portion of the string can specified as non-expandable by placing it between
13537 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13538 expressions, which often contain backslashes and dollar signs. For example:
13539 </para>
13540 <literallayout class="monospaced">
13541 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13542 </literallayout>
13543 <para>
13544 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13545 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13546 string.
13547 </para>
13548 </section>
13549 <section id="SECID82">
13550 <title>Character escape sequences in expanded strings</title>
13551 <para>
13552 <indexterm role="concept">
13553 <primary>expansion</primary>
13554 <secondary>escape sequences</secondary>
13555 </indexterm>
13556 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13557 expanded string is recognized as an escape sequence for the character newline,
13558 carriage return, or tab, respectively. A backslash followed by up to three
13559 octal digits is recognized as an octal encoding for a single character, and a
13560 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13561 encoding.
13562 </para>
13563 <para>
13564 These escape sequences are also recognized in quoted strings when they are read
13565 in. Their interpretation in expansions as well is useful for unquoted strings,
13566 and for other cases such as looked-up strings that are then expanded.
13567 </para>
13568 </section>
13569 <section id="SECID83">
13570 <title>Testing string expansions</title>
13571 <para>
13572 <indexterm role="concept">
13573 <primary>expansion</primary>
13574 <secondary>testing</secondary>
13575 </indexterm>
13576 <indexterm role="concept">
13577 <primary>testing</primary>
13578 <secondary>string expansion</secondary>
13579 </indexterm>
13580 <indexterm role="option">
13581 <primary><option>-be</option></primary>
13582 </indexterm>
13583 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13584 takes the command arguments, or lines from the standard input if there are no
13585 arguments, runs them through the string expansion code, and writes the results
13586 to the standard output. Variables based on configuration values are set up, but
13587 since no message is being processed, variables such as <varname>$local_part</varname> have no
13588 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13589 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13590 and <option>nhash</option>.
13591 </para>
13592 <para>
13593 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13594 instead runs under the uid and gid it was called with, to prevent users from
13595 using <option>-be</option> for reading files to which they do not have access.
13596 </para>
13597 <para>
13598 <indexterm role="option">
13599 <primary><option>-bem</option></primary>
13600 </indexterm>
13601 If you want to test expansions that include variables whose values are taken
13602 from a message, there are two other options that can be used. The <option>-bem</option>
13603 option is like <option>-be</option> except that it is followed by a file name. The file is
13604 read as a message before doing the test expansions. For example:
13605 </para>
13606 <literallayout class="monospaced">
13607 exim -bem /tmp/test.message '$h_subject:'
13608 </literallayout>
13609 <para>
13610 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13611 Exim message identifier. For example:
13612 </para>
13613 <literallayout class="monospaced">
13614 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13615 </literallayout>
13616 <para>
13617 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13618 is therefore restricted to admin users.
13619 </para>
13620 </section>
13621 <section id="SECTforexpfai">
13622 <title>Forced expansion failure</title>
13623 <para>
13624 <indexterm role="concept">
13625 <primary>expansion</primary>
13626 <secondary>forced failure</secondary>
13627 </indexterm>
13628 A number of expansions that are described in the following section have
13629 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13630 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13631 used depends on some condition that is evaluated as part of the expansion. If,
13632 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13633 the entire string expansion fails in a way that can be detected by the code
13634 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13635 its consequences depend on the circumstances. In some cases it is no different
13636 from any other expansion failure, but in others a different action may be
13637 taken. Such variations are mentioned in the documentation of the option that is
13638 being expanded.
13639 </para>
13640 </section>
13641 <section id="SECTexpansionitems">
13642 <title>Expansion items</title>
13643 <para>
13644 The following items are recognized in expanded strings. White space may be used
13645 between sub-items that are keywords or substrings enclosed in braces inside an
13646 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13647 white space is significant.
13648 </para>
13649 <variablelist>
13650 <varlistentry>
13651 <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>
13652 <listitem>
13653 <para>
13654 <indexterm role="concept">
13655 <primary>expansion</primary>
13656 <secondary>variables</secondary>
13657 </indexterm>
13658 Substitute the contents of the named variable, for example:
13659 </para>
13660 <literallayout class="monospaced">
13661 $local_part
13662 ${domain}
13663 </literallayout>
13664 <para>
13665 The second form can be used to separate the name from subsequent alphanumeric
13666 characters. This form (using braces) is available only for variables; it does
13667 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13668 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13669 given, the expansion fails.
13670 </para>
13671 </listitem></varlistentry>
13672 <varlistentry>
13673 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13674 <listitem>
13675 <para>
13676 <indexterm role="concept">
13677 <primary>expansion</primary>
13678 <secondary>operators</secondary>
13679 </indexterm>
13680 The string is first itself expanded, and then the operation specified by
13681 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13682 </para>
13683 <literallayout class="monospaced">
13684 ${lc:$local_part}
13685 </literallayout>
13686 <para>
13687 The string starts with the first character after the colon, which may be
13688 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13689 below. The operator notation is used for simple expansion items that have just
13690 one argument, because it reduces the number of braces and therefore makes the
13691 string easier to understand.
13692 </para>
13693 </listitem></varlistentry>
13694 <varlistentry>
13695 <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>
13696 <listitem>
13697 <para>
13698 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13699 expansion item below.
13700 </para>
13701 </listitem></varlistentry>
13702 <varlistentry>
13703 <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>
13704 <listitem>
13705 <para>
13706 <indexterm role="concept">
13707 <primary>expansion</primary>
13708 <secondary>calling an acl</secondary>
13709 </indexterm>
13710 <indexterm role="concept">
13711 <primary><option>acl</option></primary>
13712 <secondary>call from expansion</secondary>
13713 </indexterm>
13714 The name and zero to nine argument strings are first expanded separately.  The expanded
13715 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13716 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13717 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13718 and may use the variables; if another acl expansion is used the values
13719 are restored after it returns.  If the ACL sets
13720 a value using a "message =" modifier and returns accept or deny, the value becomes
13721 the result of the expansion.
13722 If no message is set and the ACL returns accept or deny
13723 the expansion result is an empty string.
13724 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13725 </para>
13726 </listitem></varlistentry>
13727 <varlistentry revisionflag="changed">
13728 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13729 <listitem>
13730 <para revisionflag="changed">
13731 <indexterm role="concept">
13732 <primary>authentication</primary>
13733 <secondary>results header</secondary>
13734 </indexterm>
13735 <indexterm role="concept">
13736 <primary>headers</primary>
13737 <secondary>authentication-results:</secondary>
13738 </indexterm>
13739 <indexterm role="concept">
13740 <primary>authentication</primary>
13741 <secondary>expansion item</secondary>
13742 </indexterm>
13743 This item returns a string suitable for insertion as an
13744 <emphasis>Authentication-Results"</emphasis>
13745 header line.
13746 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
13747 will be a domain name identifying the system performing the authentications.
13748 Methods that might be present in the result include:
13749 </para>
13750 <literallayout class="monospaced" revisionflag="changed">
13751 none
13752 iprev
13753 auth
13754 spf
13755 dkim
13756 </literallayout>
13757 <para revisionflag="changed">
13758 Example use (as an ACL modifier):
13759 </para>
13760 <literallayout class="monospaced" revisionflag="changed">
13761       add_header = :at_start:${authresults {$primary_hostname}}
13762 </literallayout>
13763 <para revisionflag="changed">
13764 This is safe even if no authentication results are available.
13765 </para>
13766 </listitem></varlistentry>
13767 <varlistentry>
13768 <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>
13769 <listitem>
13770 <para>
13771 <indexterm role="concept">
13772 <primary>expansion</primary>
13773 <secondary>extracting certificate fields</secondary>
13774 </indexterm>
13775 <indexterm role="concept">
13776 <primary><option>certextract</option></primary>
13777 <secondary>certificate fields</secondary>
13778 </indexterm>
13779 <indexterm role="concept">
13780 <primary>certificate</primary>
13781 <secondary>extracting fields</secondary>
13782 </indexterm>
13783 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13784 The field name is expanded and used to retrieve the relevant field from
13785 the certificate.  Supported fields are:
13786 </para>
13787 <literallayout>
13788 <literal>version        </literal>
13789 <literal>serial_number  </literal>
13790 <literal>subject        </literal> RFC4514 DN
13791 <literal>issuer         </literal> RFC4514 DN
13792 <literal>notbefore      </literal> time
13793 <literal>notafter       </literal> time
13794 <literal>sig_algorithm  </literal>
13795 <literal>signature      </literal>
13796 <literal>subj_altname   </literal> tagged list
13797 <literal>ocsp_uri       </literal> list
13798 <literal>crl_uri        </literal> list
13799 </literallayout>
13800 <para>
13801 If the field is found,
13802 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13803 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13804 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13805 is restored to any previous value it might have had.
13806 </para>
13807 <para>
13808 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13809 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13810 extracted is used.
13811 </para>
13812 <para>
13813 Some field names take optional modifiers, appended and separated by commas.
13814 </para>
13815 <para>
13816 The field selectors marked as "RFC4514" above
13817 output a Distinguished Name string which is
13818 not quite
13819 parseable by Exim as a comma-separated tagged list
13820 (the exceptions being elements containing commas).
13821 RDN elements of a single type may be selected by
13822 a modifier of the type label; if so the expansion
13823 result is a list (newline-separated by default).
13824 The separator may be changed by another modifier of
13825 a right angle-bracket followed immediately by the new separator.
13826 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13827 </para>
13828 <para>
13829 The field selectors marked as "time" above
13830 take an optional modifier of "int"
13831 for which the result is the number of seconds since epoch.
13832 Otherwise the result is a human-readable string
13833 in the timezone selected by the main "timezone" option.
13834 </para>
13835 <para>
13836 The field selectors marked as "list" above return a list,
13837 newline-separated by default,
13838 (embedded separator characters in elements are doubled).
13839 The separator may be changed by a modifier of
13840 a right angle-bracket followed immediately by the new separator.
13841 </para>
13842 <para>
13843 The field selectors marked as "tagged" above
13844 prefix each list element with a type string and an equals sign.
13845 Elements of only one type may be selected by a modifier
13846 which is one of "dns", "uri" or "mail";
13847 if so the element tags are omitted.
13848 </para>
13849 <para>
13850 If not otherwise noted field values are presented in human-readable form.
13851 </para>
13852 </listitem></varlistentry>
13853 <varlistentry>
13854 <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>
13855 <listitem>
13856 <para>
13857 <indexterm role="concept">
13858 <primary><option>dlfunc</option></primary>
13859 </indexterm>
13860 This expansion dynamically loads and then calls a locally-written C function.
13861 This functionality is available only if Exim is compiled with
13862 </para>
13863 <literallayout class="monospaced">
13864 EXPAND_DLFUNC=yes
13865 </literallayout>
13866 <para>
13867 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13868 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13869 (but of course Exim does start new processes frequently).
13870 </para>
13871 <para>
13872 There may be from zero to eight arguments to the function. When compiling
13873 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13874 included. The Exim variables and functions that are defined by that API
13875 are also available for dynamically loaded functions. The function itself
13876 must have the following type:
13877 </para>
13878 <literallayout class="monospaced">
13879 int dlfunction(uschar **yield, int argc, uschar *argv[])
13880 </literallayout>
13881 <para>
13882 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13883 function should return one of the following values:
13884 </para>
13885 <para>
13886 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13887 into the expanded string that is being built.
13888 </para>
13889 <para>
13890 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13891 from <emphasis>yield</emphasis>, if it is set.
13892 </para>
13893 <para>
13894 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13895 taken from <emphasis>yield</emphasis> if it is set.
13896 </para>
13897 <para>
13898 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13899 </para>
13900 <para>
13901 When compiling a function that is to be used in this way with gcc,
13902 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13903 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13904 </para>
13905 </listitem></varlistentry>
13906 <varlistentry>
13907 <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>
13908 <listitem>
13909 <para>
13910 <indexterm role="concept">
13911 <primary>expansion</primary>
13912 <secondary>extracting value from environment</secondary>
13913 </indexterm>
13914 <indexterm role="concept">
13915 <primary>environment</primary>
13916 <secondary>values from</secondary>
13917 </indexterm>
13918 The key is first expanded separately, and leading and trailing white space
13919 removed.
13920 This is then searched for as a name in the environment.
13921 If a variable is found then its value is placed in <varname>$value</varname>
13922 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13923 </para>
13924 <para>
13925 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13926 appear, for example:
13927 </para>
13928 <literallayout class="monospaced">
13929 ${env{USER}{$value} fail }
13930 </literallayout>
13931 <para>
13932 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13933 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13934 </para>
13935 <para>
13936 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13937 search failure.
13938 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13939 search success.
13940 </para>
13941 <para>
13942 The environment is adjusted by the <option>keep_environment</option> and
13943 <option>add_environment</option> main section options.
13944 </para>
13945 </listitem></varlistentry>
13946 <varlistentry>
13947 <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>
13948 <listitem>
13949 <para>
13950 <indexterm role="concept">
13951 <primary>expansion</primary>
13952 <secondary>extracting substrings by key</secondary>
13953 </indexterm>
13954 <indexterm role="concept">
13955 <primary><option>extract</option></primary>
13956 <secondary>substrings by key</secondary>
13957 </indexterm>
13958 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13959 white space is removed from the key (but not from any of the strings). The key
13960 must not be empty and must not consist entirely of digits.
13961 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
13962 </para>
13963 <literallayout>
13964 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13965 </literallayout>
13966 <para>
13967 <indexterm role="variable">
13968 <primary><varname>$value</varname></primary>
13969 </indexterm>
13970 where the equals signs and spaces (but not both) are optional. If any of the
13971 values contain white space, they must be enclosed in double quotes, and any
13972 values that are enclosed in double quotes are subject to escape processing as
13973 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13974 for the value that corresponds to the key. The search is case-insensitive. If
13975 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13976 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13977 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13978 is restored to any previous value it might have had.
13979 </para>
13980 <para>
13981 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13982 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13983 extracted is used. Thus, for example, these two expansions are identical, and
13984 yield <quote>2001</quote>:
13985 </para>
13986 <literallayout class="monospaced">
13987 ${extract{gid}{uid=1984 gid=2001}}
13988 ${extract{gid}{uid=1984 gid=2001}{$value}}
13989 </literallayout>
13990 <para>
13991 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13992 appear, for example:
13993 </para>
13994 <literallayout class="monospaced">
13995 ${extract{Z}{A=... B=...}{$value} fail }
13996 </literallayout>
13997 <para>
13998 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13999 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14000 </para>
14001 </listitem></varlistentry>
14002 <varlistentry>
14003 <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>
14004 <listitem>
14005 <para>
14006 <indexterm role="concept">
14007 <primary>expansion</primary>
14008 <secondary>extracting substrings by number</secondary>
14009 </indexterm>
14010 <indexterm role="concept">
14011 <primary><option>extract</option></primary>
14012 <secondary>substrings by number</secondary>
14013 </indexterm>
14014 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14015 apart from leading and trailing white space, which is ignored.
14016 This is what distinguishes this form of <option>extract</option> from the previous kind. It
14017 behaves in the same way, except that, instead of extracting a named field, it
14018 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
14019 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
14020 &lt;<emphasis>string3</emphasis>&gt; as before.
14021 </para>
14022 <para>
14023 The fields in the string are separated by any one of the characters in the
14024 separator string. These may include space or tab characters.
14025 The first field is numbered one. If the number is negative, the fields are
14026 counted from the end of the string, with the rightmost one numbered -1. If the
14027 number given is zero, the entire string is returned. If the modulus of the
14028 number is greater than the number of fields in the string, the result is the
14029 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
14030 provided. For example:
14031 </para>
14032 <literallayout class="monospaced">
14033 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14034 </literallayout>
14035 <para>
14036 yields <quote>42</quote>, and
14037 </para>
14038 <literallayout class="monospaced">
14039 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14040 </literallayout>
14041 <para>
14042 yields <quote>99</quote>. Two successive separators mean that the field between them is
14043 empty (for example, the fifth field above).
14044 </para>
14045 </listitem></varlistentry>
14046 <varlistentry>
14047 <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>
14048 <listitem>
14049 <para>
14050 <indexterm role="concept">
14051 <primary>list</primary>
14052 <secondary>selecting by condition</secondary>
14053 </indexterm>
14054 <indexterm role="concept">
14055 <primary>expansion</primary>
14056 <secondary>selecting from list by condition</secondary>
14057 </indexterm>
14058 <indexterm role="variable">
14059 <primary><varname>$item</varname></primary>
14060 </indexterm>
14061 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14062 default, but the separator can be changed in the usual way. For each item
14063 in this list, its value is place in <varname>$item</varname>, and then the condition is
14064 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
14065 item in a new list; if the condition is false, the item is discarded. The
14066 separator used for the output list is the same as the one used for the
14067 input, but a separator setting is not included in the output. For example:
14068 </para>
14069 <literallayout class="monospaced">
14070 ${filter{a:b:c}{!eq{$item}{b}}}
14071 </literallayout>
14072 <para>
14073 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
14074 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
14075 </para>
14076 </listitem></varlistentry>
14077 <varlistentry>
14078 <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>
14079 <listitem>
14080 <para>
14081 <indexterm role="concept">
14082 <primary>hash function</primary>
14083 <secondary>textual</secondary>
14084 </indexterm>
14085 <indexterm role="concept">
14086 <primary>expansion</primary>
14087 <secondary>textual hash</secondary>
14088 </indexterm>
14089 This is a textual hashing function, and was the first to be implemented in
14090 early versions of Exim. In current releases, there are other hashing functions
14091 (numeric, MD5, and SHA-1), which are described below.
14092 </para>
14093 <para>
14094 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
14095 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
14096 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
14097 use the simpler operator notation that avoids some of the braces:
14098 </para>
14099 <literallayout class="monospaced">
14100 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14101 </literallayout>
14102 <para>
14103 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
14104 or equal to the length of the string, the expansion item returns the string.
14105 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
14106 function to the string. The new string consists of characters taken from the
14107 first &lt;<emphasis>m</emphasis>&gt; characters of the string
14108 </para>
14109 <literallayout class="monospaced">
14110 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
14111 </literallayout>
14112 <para>
14113 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
14114 letters appear. For example:
14115 </para>
14116 <literallayout>
14117 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
14118 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14119 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14120 </literallayout>
14121 </listitem></varlistentry>
14122 <varlistentry>
14123 <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>
14124 <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>
14125 <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>
14126 <listitem>
14127 <para>
14128 <indexterm role="concept">
14129 <primary>expansion</primary>
14130 <secondary>header insertion</secondary>
14131 </indexterm>
14132 <indexterm role="variable">
14133 <primary><varname>$header_</varname></primary>
14134 </indexterm>
14135 <indexterm role="variable">
14136 <primary><varname>$bheader_</varname></primary>
14137 </indexterm>
14138 <indexterm role="variable">
14139 <primary><varname>$rheader_</varname></primary>
14140 </indexterm>
14141 <indexterm role="concept">
14142 <primary>header lines</primary>
14143 <secondary>in expansion strings</secondary>
14144 </indexterm>
14145 <indexterm role="concept">
14146 <primary>header lines</primary>
14147 <secondary>character sets</secondary>
14148 </indexterm>
14149 <indexterm role="concept">
14150 <primary>header lines</primary>
14151 <secondary>decoding</secondary>
14152 </indexterm>
14153 Substitute the contents of the named message header line, for example
14154 </para>
14155 <literallayout class="monospaced">
14156 $header_reply-to:
14157 </literallayout>
14158 <para>
14159 The newline that terminates a header line is not included in the expansion, but
14160 internal newlines (caused by splitting the header line over several physical
14161 lines) may be present.
14162 </para>
14163 <para>
14164 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
14165 the data in the header line is interpreted.
14166 </para>
14167 <itemizedlist>
14168 <listitem>
14169 <para>
14170 <indexterm role="concept">
14171 <primary>white space</primary>
14172 <secondary>in header lines</secondary>
14173 </indexterm>
14174 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14175 processing at all, and without the removal of leading and trailing white space.
14176 </para>
14177 </listitem>
14178 <listitem>
14179 <para>
14180 <indexterm role="concept">
14181 <primary>base64 encoding</primary>
14182 <secondary>in header lines</secondary>
14183 </indexterm>
14184 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14185 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14186 character set translation. If decoding of what looks superficially like a MIME
14187 <quote>word</quote> fails, the raw string is returned. If decoding
14188 <indexterm role="concept">
14189 <primary>binary zero</primary>
14190 <secondary>in header line</secondary>
14191 </indexterm>
14192 produces a binary zero character, it is replaced by a question mark &ndash; this is
14193 what Exim does for binary zeros that are actually received in header lines.
14194 </para>
14195 </listitem>
14196 <listitem>
14197 <para>
14198 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14199 standard character set. This is an attempt to produce the same string as would
14200 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14201 returned. Translation is attempted only on operating systems that support the
14202 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14203 a system Makefile or in <filename>Local/Makefile</filename>.
14204 </para>
14205 </listitem>
14206 </itemizedlist>
14207 <para>
14208 In a filter file, the target character set for <option>header</option> can be specified by a
14209 command of the following form:
14210 </para>
14211 <literallayout class="monospaced">
14212 headers charset "UTF-8"
14213 </literallayout>
14214 <para>
14215 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14216 subsequently obeyed filter commands. In the absence of this command, the target
14217 character set in a filter is taken from the setting of the <option>headers_charset</option>
14218 option in the runtime configuration. The value of this option defaults to the
14219 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14220 ISO-8859-1.
14221 </para>
14222 <para>
14223 Header names follow the syntax of RFC 2822, which states that they may contain
14224 any printing characters except space and colon. Consequently, curly brackets
14225 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14226 if they were variables. Attempting to do so causes a syntax error.
14227 </para>
14228 <para>
14229 Only header lines that are common to all copies of a message are visible to
14230 this mechanism. These are the original header lines that are received with the
14231 message, and any that are added by an ACL statement or by a system
14232 filter. Header lines that are added to a particular copy of a message by a
14233 router or transport are not accessible.
14234 </para>
14235 <para>
14236 For incoming SMTP messages, no header lines are visible in
14237 ACLs that are obeyed before the data phase completes,
14238 because the header structure is not set up until the message is received.
14239 They are visible in DKIM, PRDR and DATA ACLs.
14240 Header lines that are added in a RCPT ACL (for example)
14241 are saved until the message&#x2019;s incoming header lines are available, at which
14242 point they are added.
14243 When any of the above ACLs ar
14244 running, however, header lines added by earlier ACLs are visible.
14245 </para>
14246 <para>
14247 Upper case and lower case letters are synonymous in header names. If the
14248 following character is white space, the terminating colon may be omitted, but
14249 this is not recommended, because you may then forget it when it is needed. When
14250 white space terminates the header name, this white space is included in the
14251 expanded string.  If the message does not contain the given header, the
14252 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14253 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14254 header.)
14255 </para>
14256 <para>
14257 If there is more than one header with the same name, they are all concatenated
14258 to form the substitution string, up to a maximum length of 64K. Unless
14259 <option>rheader</option> is being used, leading and trailing white space is removed from
14260 each header before concatenation, and a completely empty header is ignored. A
14261 newline character is then inserted between non-empty headers, but there is no
14262 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14263 those headers that contain lists of addresses, a comma is also inserted at the
14264 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14265 </para>
14266 </listitem></varlistentry>
14267 <varlistentry>
14268 <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>
14269 <listitem>
14270 <para>
14271 <indexterm role="concept">
14272 <primary>expansion</primary>
14273 <secondary>hmac hashing</secondary>
14274 </indexterm>
14275 <indexterm role="concept">
14276 <primary><option>hmac</option></primary>
14277 </indexterm>
14278 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14279 shared secret and some text into a message authentication code, as specified in
14280 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14281 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14282 cryptographic hash, allowing for authentication that is not possible with MD5
14283 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14284 present. For example:
14285 </para>
14286 <literallayout class="monospaced">
14287 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14288 </literallayout>
14289 <para>
14290 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14291 produces:
14292 </para>
14293 <literallayout class="monospaced">
14294 dd97e3ba5d1a61b5006108f8c8252953
14295 </literallayout>
14296 <para>
14297 As an example of how this might be used, you might put in the main part of
14298 an Exim configuration:
14299 </para>
14300 <literallayout class="monospaced">
14301 SPAMSCAN_SECRET=cohgheeLei2thahw
14302 </literallayout>
14303 <para>
14304 In a router or a transport you could then have:
14305 </para>
14306 <literallayout class="monospaced">
14307 headers_add = \
14308   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14309   ${hmac{md5}{SPAMSCAN_SECRET}\
14310   {${primary_hostname},${message_exim_id},$h_message-id:}}
14311 </literallayout>
14312 <para>
14313 Then given a message, you can check where it was scanned by looking at the
14314 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14315 this header line is authentic by recomputing the authentication code from the
14316 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14317 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
14318 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14319 </para>
14320 </listitem></varlistentry>
14321 <varlistentry>
14322 <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>
14323 <listitem>
14324 <para>
14325 <indexterm role="concept">
14326 <primary>expansion</primary>
14327 <secondary>conditional</secondary>
14328 </indexterm>
14329 <indexterm role="concept">
14330 <primary><option>if</option>, expansion item</primary>
14331 </indexterm>
14332 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14333 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14334 in section <xref linkend="SECTexpcond"/> below. For example:
14335 </para>
14336 <literallayout class="monospaced">
14337 ${if eq {$local_part}{postmaster} {yes}{no} }
14338 </literallayout>
14339 <para>
14340 The second string need not be present; if it is not and the condition is not
14341 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14342 be present instead of the second string (without any curly brackets). In this
14343 case, the expansion is forced to fail if the condition is not true (see section
14344 <xref linkend="SECTforexpfai"/>).
14345 </para>
14346 <para>
14347 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14348 is true, and the empty string if the condition is false. This makes it less
14349 cumbersome to write custom ACL and router conditions. For example, instead of
14350 </para>
14351 <literallayout class="monospaced">
14352 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14353 </literallayout>
14354 <para>
14355 you can use
14356 </para>
14357 <literallayout class="monospaced">
14358 condition = ${if &gt;{$acl_m4}{3}}
14359 </literallayout>
14360 </listitem></varlistentry>
14361 <varlistentry>
14362 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14363 <listitem>
14364 <para>
14365 <indexterm role="concept">
14366 <primary>expansion</primary>
14367 <secondary>imap folder</secondary>
14368 </indexterm>
14369 <indexterm role="concept">
14370 <primary><option>imapfolder</option> expansion item</primary>
14371 </indexterm>
14372 This item converts a (possibly multilevel, or with non-ASCII characters)
14373 folder specification to a Maildir name for filesystem use.
14374 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14375 </para>
14376 </listitem></varlistentry>
14377 <varlistentry>
14378 <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>
14379 <listitem>
14380 <para>
14381 <indexterm role="concept">
14382 <primary>expansion</primary>
14383 <secondary>string truncation</secondary>
14384 </indexterm>
14385 <indexterm role="concept">
14386 <primary><option>length</option> expansion item</primary>
14387 </indexterm>
14388 The <option>length</option> item is used to extract the initial portion of a string. Both
14389 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14390 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14391 change when expanded, you can use the simpler operator notation that avoids
14392 some of the braces:
14393 </para>
14394 <literallayout class="monospaced">
14395 ${length_&lt;n&gt;:&lt;string&gt;}
14396 </literallayout>
14397 <para>
14398 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
14399 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14400 <option>strlen</option>, which gives the length of a string.
14401 </para>
14402 </listitem></varlistentry>
14403 <varlistentry>
14404 <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>
14405 <listitem>
14406 <para>
14407 <indexterm role="concept">
14408 <primary>expansion</primary>
14409 <secondary>extracting list elements by number</secondary>
14410 </indexterm>
14411 <indexterm role="concept">
14412 <primary><option>listextract</option></primary>
14413 <secondary>extract list elements by number</secondary>
14414 </indexterm>
14415 <indexterm role="concept">
14416 <primary>list</primary>
14417 <secondary>extracting elements by number</secondary>
14418 </indexterm>
14419 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14420 apart from an optional leading minus,
14421 and leading and trailing white space (which is ignored).
14422 </para>
14423 <para>
14424 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14425 default, but the separator can be changed in the usual way.
14426 </para>
14427 <para>
14428 The first field of the list is numbered one.
14429 If the number is negative, the fields are
14430 counted from the end of the list, with the rightmost one numbered -1.
14431 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14432 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14433 </para>
14434 <para>
14435 If the modulus of the
14436 number is zero or greater than the number of fields in the string,
14437 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14438 </para>
14439 <para>
14440 For example:
14441 </para>
14442 <literallayout class="monospaced">
14443 ${listextract{2}{x:42:99}}
14444 </literallayout>
14445 <para>
14446 yields <quote>42</quote>, and
14447 </para>
14448 <literallayout class="monospaced">
14449 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14450 </literallayout>
14451 <para>
14452 yields <quote>result: 42</quote>.
14453 </para>
14454 <para>
14455 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14456 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14457 extracted is used.
14458 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14459 </para>
14460 </listitem></varlistentry>
14461 <varlistentry>
14462 <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>
14463 <listitem>
14464 <para>
14465 This is the first of one of two different types of lookup item, which are both
14466 described in the next item.
14467 </para>
14468 </listitem></varlistentry>
14469 <varlistentry>
14470 <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>
14471 <listitem>
14472 <para>
14473 <indexterm role="concept">
14474 <primary>expansion</primary>
14475 <secondary>lookup in</secondary>
14476 </indexterm>
14477 <indexterm role="concept">
14478 <primary>file</primary>
14479 <secondary>lookups</secondary>
14480 </indexterm>
14481 <indexterm role="concept">
14482 <primary>lookup</primary>
14483 <secondary>in expanded string</secondary>
14484 </indexterm>
14485 The two forms of lookup item specify data lookups in files and databases, as
14486 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14487 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14488 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14489 </para>
14490 <para>
14491 If there is any white space in a lookup item which is part of a filter command,
14492 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14493 other place where white space is significant, the lookup item must be enclosed
14494 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14495 out by the system administrator.
14496 </para>
14497 <para>
14498 <indexterm role="variable">
14499 <primary><varname>$value</varname></primary>
14500 </indexterm>
14501 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14502 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14503 lookup. Afterwards it reverts to the value it had previously (at the outer
14504 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14505 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14506 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14507 lookup, thus providing a mechanism for looking up a default value when the
14508 original lookup fails.
14509 </para>
14510 <para>
14511 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14512 data for the outer lookup while the parameters of the second lookup are
14513 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14514 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14515 appear, and in this case, if the lookup fails, the entire expansion is forced
14516 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14517 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14518 successful lookup, and nothing in the case of failure.
14519 </para>
14520 <para>
14521 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14522 search type in order to do partial matching, and * or *@ may follow a search
14523 type to request default lookups if the key does not match (see sections
14524 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14525 </para>
14526 <para>
14527 <indexterm role="concept">
14528 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14529 <secondary>in lookup expansion</secondary>
14530 </indexterm>
14531 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14532 and non-wild parts of the key during the expansion of the replacement text.
14533 They return to their previous values at the end of the lookup item.
14534 </para>
14535 <para>
14536 This example looks up the postmaster alias in the conventional alias file:
14537 </para>
14538 <literallayout class="monospaced">
14539 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14540 </literallayout>
14541 <para>
14542 This example uses NIS+ to look up the full name of the user corresponding to
14543 the local part of an address, forcing the expansion to fail if it is not found:
14544 </para>
14545 <literallayout class="monospaced">
14546 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14547   {$value}fail}
14548 </literallayout>
14549 </listitem></varlistentry>
14550 <varlistentry>
14551 <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>
14552 <listitem>
14553 <para>
14554 <indexterm role="concept">
14555 <primary>expansion</primary>
14556 <secondary>list creation</secondary>
14557 </indexterm>
14558 <indexterm role="variable">
14559 <primary><varname>$item</varname></primary>
14560 </indexterm>
14561 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14562 default, but the separator can be changed in the usual way. For each item
14563 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14564 expanded and added to the output as an item in a new list. The separator used
14565 for the output list is the same as the one used for the input, but a separator
14566 setting is not included in the output. For example:
14567 </para>
14568 <literallayout class="monospaced">
14569 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14570 </literallayout>
14571 <para>
14572 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14573 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14574 and <emphasis role="bold">reduce</emphasis> expansion items.
14575 </para>
14576 </listitem></varlistentry>
14577 <varlistentry>
14578 <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>
14579 <listitem>
14580 <para>
14581 <indexterm role="concept">
14582 <primary>expansion</primary>
14583 <secondary>numeric hash</secondary>
14584 </indexterm>
14585 <indexterm role="concept">
14586 <primary>hash function</primary>
14587 <secondary>numeric</secondary>
14588 </indexterm>
14589 The three strings are expanded; the first two must yield numbers. Call them
14590 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14591 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14592 can use the simpler operator notation that avoids some of the braces:
14593 </para>
14594 <literallayout class="monospaced">
14595 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14596 </literallayout>
14597 <para>
14598 The second number is optional (in both notations). If there is only one number,
14599 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14600 processed by a div/mod hash function that returns two numbers, separated by a
14601 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14602 example,
14603 </para>
14604 <literallayout class="monospaced">
14605 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14606 </literallayout>
14607 <para>
14608 returns the string <quote>6/33</quote>.
14609 </para>
14610 </listitem></varlistentry>
14611 <varlistentry>
14612 <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>
14613 <listitem>
14614 <para>
14615 <indexterm role="concept">
14616 <primary>Perl</primary>
14617 <secondary>use in expanded string</secondary>
14618 </indexterm>
14619 <indexterm role="concept">
14620 <primary>expansion</primary>
14621 <secondary>calling Perl from</secondary>
14622 </indexterm>
14623 This item is available only if Exim has been built to include an embedded Perl
14624 interpreter. The subroutine name and the arguments are first separately
14625 expanded, and then the Perl subroutine is called with those arguments. No
14626 additional arguments need be given; the maximum number permitted, including the
14627 name of the subroutine, is nine.
14628 </para>
14629 <para>
14630 The return value of the subroutine is inserted into the expanded string, unless
14631 the return value is <option>undef</option>. In that case, the expansion fails in the same
14632 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14633 Whatever you return is evaluated in a scalar context. For example, if you
14634 return the name of a Perl vector, the return value is the size of the vector,
14635 not its contents.
14636 </para>
14637 <para>
14638 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14639 with the error message that was passed to <option>die</option>. More details of the embedded
14640 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14641 </para>
14642 <para>
14643 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14644 out the use of this expansion item in filter files.
14645 </para>
14646 </listitem></varlistentry>
14647 <varlistentry>
14648 <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>
14649 <listitem>
14650 <para>
14651 <indexterm role="concept">
14652 <primary><option>prvs</option> expansion item</primary>
14653 </indexterm>
14654 The first argument is a complete email address and the second is secret
14655 keystring. The third argument, specifying a key number, is optional. If absent,
14656 it defaults to 0. The result of the expansion is a prvs-signed email address,
14657 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14658 as part of a bounce address tag validation (BATV) scheme. For more discussion
14659 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14660 </para>
14661 </listitem></varlistentry>
14662 <varlistentry>
14663 <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>
14664 <listitem>
14665 <para>
14666 <indexterm role="concept">
14667 <primary><option>prvscheck</option> expansion item</primary>
14668 </indexterm>
14669 This expansion item is the complement of the <option>prvs</option> item. It is used for
14670 checking prvs-signed addresses. If the expansion of the first argument does not
14671 yield a syntactically valid prvs-signed address, the whole item expands to the
14672 empty string. When the first argument does expand to a syntactically valid
14673 prvs-signed address, the second argument is expanded, with the prvs-decoded
14674 version of the address and the key number extracted from the address in the
14675 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14676 </para>
14677 <para>
14678 These two variables can be used in the expansion of the second argument to
14679 retrieve the secret. The validity of the prvs-signed address is then checked
14680 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14681 which is empty for failure or <quote>1</quote> for success.
14682 </para>
14683 <para>
14684 The third argument is optional; if it is missing, it defaults to an empty
14685 string. This argument is now expanded. If the result is an empty string, the
14686 result of the expansion is the decoded version of the address. This is the case
14687 whether or not the signature was valid. Otherwise, the result of the expansion
14688 is the expansion of the third argument.
14689 </para>
14690 <para>
14691 All three variables can be used in the expansion of the third argument.
14692 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14693 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14694 </para>
14695 </listitem></varlistentry>
14696 <varlistentry>
14697 <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>
14698 <listitem>
14699 <para>
14700 <indexterm role="concept">
14701 <primary>expansion</primary>
14702 <secondary>inserting an entire file</secondary>
14703 </indexterm>
14704 <indexterm role="concept">
14705 <primary>file</primary>
14706 <secondary>inserting into expansion</secondary>
14707 </indexterm>
14708 <indexterm role="concept">
14709 <primary><option>readfile</option> expansion item</primary>
14710 </indexterm>
14711 The file name and end-of-line string are first expanded separately. The file is
14712 then read, and its contents replace the entire item. All newline characters in
14713 the file are replaced by the end-of-line string if it is present. Otherwise,
14714 newlines are left in the string.
14715 String expansion is not applied to the contents of the file. If you want this,
14716 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14717 the string expansion fails.
14718 </para>
14719 <para>
14720 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14721 locks out the use of this expansion item in filter files.
14722 </para>
14723 </listitem></varlistentry>
14724 <varlistentry>
14725 <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>options</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>
14726 <listitem>
14727 <para>
14728 <indexterm role="concept">
14729 <primary>expansion</primary>
14730 <secondary>inserting from a socket</secondary>
14731 </indexterm>
14732 <indexterm role="concept">
14733 <primary>socket, use of in expansion</primary>
14734 </indexterm>
14735 <indexterm role="concept">
14736 <primary><option>readsocket</option> expansion item</primary>
14737 </indexterm>
14738 This item inserts data from a Unix domain or TCP socket into the expanded
14739 string. The minimal way of using it uses just two arguments, as in these
14740 examples:
14741 </para>
14742 <literallayout class="monospaced">
14743 ${readsocket{/socket/name}{request string}}
14744 ${readsocket{inet:some.host:1234}{request string}}
14745 </literallayout>
14746 <para>
14747 For a Unix domain socket, the first substring must be the path to the socket.
14748 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14749 a host name or IP address, followed by a colon and a port, which can be a
14750 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14751 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14752 example:
14753 </para>
14754 <literallayout class="monospaced">
14755 ${readsocket{inet:[::1]:1234}{request string}}
14756 </literallayout>
14757 <para>
14758 Only a single host name may be given, but if looking it up yields more than
14759 one IP address, they are each tried in turn until a connection is made. For
14760 both kinds of socket, Exim makes a connection, writes the request string
14761 unless it is an empty string; and no terminating NUL is ever sent)
14762 and reads from the socket until an end-of-file
14763 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14764 extend what can be done. Firstly, you can vary the timeout. For example:
14765 </para>
14766 <literallayout class="monospaced">
14767 ${readsocket{/socket/name}{request string}{3s}}
14768 </literallayout>
14769 <para>
14770 The third argument is a list of options, of which the first element is the timeout
14771 and must be present if the argument is given.
14772 Further elements are options of form <emphasis>name=value</emphasis>.
14773 One option type is currently recognised, defining whether (the default)
14774 or not a shutdown is done on the connection after sending the request.
14775 Example, to not do so (preferred, eg. by some webservers):
14776 </para>
14777 <literallayout class="monospaced">
14778 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
14779 </literallayout>
14780 <para>
14781 A fourth argument allows you to change any newlines that are in the data
14782 that is read, in the same way as for <option>readfile</option> (see above). This example
14783 turns them into spaces:
14784 </para>
14785 <literallayout class="monospaced">
14786 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14787 </literallayout>
14788 <para>
14789 As with all expansions, the substrings are expanded before the processing
14790 happens. Errors in these sub-expansions cause the expansion to fail. In
14791 addition, the following errors can occur:
14792 </para>
14793 <itemizedlist>
14794 <listitem>
14795 <para>
14796 Failure to create a socket file descriptor;
14797 </para>
14798 </listitem>
14799 <listitem>
14800 <para>
14801 Failure to connect the socket;
14802 </para>
14803 </listitem>
14804 <listitem>
14805 <para>
14806 Failure to write the request string;
14807 </para>
14808 </listitem>
14809 <listitem>
14810 <para>
14811 Timeout on reading from the socket.
14812 </para>
14813 </listitem>
14814 </itemizedlist>
14815 <para>
14816 By default, any of these errors causes the expansion to fail. However, if
14817 you supply a fifth substring, it is expanded and used when any of the above
14818 errors occurs. For example:
14819 </para>
14820 <literallayout class="monospaced">
14821 ${readsocket{/socket/name}{request string}{3s}{\n}\
14822   {socket failure}}
14823 </literallayout>
14824 <para>
14825 You can test for the existence of a Unix domain socket by wrapping this
14826 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14827 and the actual opening of the socket, so it is safer to use the fifth argument
14828 if you want to be absolutely sure of avoiding an expansion error for a
14829 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14830 </para>
14831 <para>
14832 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14833 locks out the use of this expansion item in filter files.
14834 </para>
14835 </listitem></varlistentry>
14836 <varlistentry>
14837 <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>
14838 <listitem>
14839 <para>
14840 <indexterm role="concept">
14841 <primary>expansion</primary>
14842 <secondary>reducing a list to a scalar</secondary>
14843 </indexterm>
14844 <indexterm role="concept">
14845 <primary>list</primary>
14846 <secondary>reducing to a scalar</secondary>
14847 </indexterm>
14848 <indexterm role="variable">
14849 <primary><varname>$value</varname></primary>
14850 </indexterm>
14851 <indexterm role="variable">
14852 <primary><varname>$item</varname></primary>
14853 </indexterm>
14854 This operation reduces a list to a single, scalar string. After expansion,
14855 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14856 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14857 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14858 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14859 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14860 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14861 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14862 number of ways. For example, to add up a list of numbers:
14863 </para>
14864 <literallayout class="monospaced">
14865 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14866 </literallayout>
14867 <para>
14868 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14869 can be found:
14870 </para>
14871 <literallayout class="monospaced">
14872 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14873 </literallayout>
14874 <para>
14875 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14876 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14877 expansion items.
14878 </para>
14879 </listitem></varlistentry>
14880 <varlistentry>
14881 <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>
14882 <listitem>
14883 <para>
14884 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14885 expansion item above.
14886 </para>
14887 </listitem></varlistentry>
14888 <varlistentry>
14889 <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>
14890 <listitem>
14891 <para>
14892 <indexterm role="concept">
14893 <primary>expansion</primary>
14894 <secondary>running a command</secondary>
14895 </indexterm>
14896 <indexterm role="concept">
14897 <primary><option>run</option> expansion item</primary>
14898 </indexterm>
14899 The command and its arguments are first expanded as one string. The string is
14900 split apart into individual arguments by spaces, and then the command is run
14901 in a separate process, but under the same uid and gid.  As in other command
14902 executions from Exim, a shell is not used by default. If the command requires
14903 a shell, you must explicitly code it.
14904 </para>
14905 <para>
14906 Since the arguments are split by spaces, when there is a variable expansion
14907 which has an empty result, it will cause the situation that the argument will
14908 simply be omitted when the program is actually executed by Exim. If the
14909 script/program requires a specific number of arguments and the expanded
14910 variable could possibly result in this empty expansion, the variable must be
14911 quoted. This is more difficult if the expanded variable itself could result
14912 in a string containing quotes, because it would interfere with the quotes
14913 around the command arguments. A possible guard against this is to wrap the
14914 variable in the <option>sg</option> operator to change any quote marks to some other
14915 character.
14916 </para>
14917 <para>
14918 The standard input for the command exists, but is empty. The standard output
14919 and standard error are set to the same file descriptor.
14920 <indexterm role="concept">
14921 <primary>return code</primary>
14922 <secondary>from <option>run</option> expansion</secondary>
14923 </indexterm>
14924 <indexterm role="variable">
14925 <primary><varname>$value</varname></primary>
14926 </indexterm>
14927 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14928 and replaces the entire item; during this expansion, the standard output/error
14929 from the command is in the variable <varname>$value</varname>. If the command fails,
14930 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14931 expansion, the standard output/error from the command is in the variable
14932 <varname>$value</varname>.
14933 </para>
14934 <para>
14935 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14936 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14937 command does not succeed. If both strings are omitted, the result is contents
14938 of the standard output/error on success, and nothing on failure.
14939 </para>
14940 <para>
14941 <indexterm role="variable">
14942 <primary><varname>$run_in_acl</varname></primary>
14943 </indexterm>
14944 The standard output/error of the command is put in the variable <varname>$value</varname>.
14945 In this ACL example, the output of a command is logged for the admin to
14946 troubleshoot:
14947 </para>
14948 <literallayout class="monospaced">
14949 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14950       log_message  = Output of id: $value
14951 </literallayout>
14952 <para>
14953 If the command requires shell idioms, such as the &gt; redirect operator, the
14954 shell must be invoked directly, such as with:
14955 </para>
14956 <literallayout class="monospaced">
14957 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14958 </literallayout>
14959 <para>
14960 <indexterm role="variable">
14961 <primary><varname>$runrc</varname></primary>
14962 </indexterm>
14963 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14964 remains set afterwards, so in a filter file you can do things like this:
14965 </para>
14966 <literallayout class="monospaced">
14967 if "${run{x y z}{}}$runrc" is 1 then ...
14968   elif $runrc is 2 then ...
14969   ...
14970 endif
14971 </literallayout>
14972 <para>
14973 If execution of the command fails (for example, the command does not exist),
14974 the return code is 127 &ndash; the same code that shells use for non-existent
14975 commands.
14976 </para>
14977 <para>
14978 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14979 option values are expanded, except for those preconditions whose order of
14980 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14981 by the expansion of one option, and use it in another.
14982 </para>
14983 <para>
14984 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14985 out the use of this expansion item in filter files.
14986 </para>
14987 </listitem></varlistentry>
14988 <varlistentry>
14989 <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>
14990 <listitem>
14991 <para>
14992 <indexterm role="concept">
14993 <primary>expansion</primary>
14994 <secondary>string substitution</secondary>
14995 </indexterm>
14996 <indexterm role="concept">
14997 <primary><option>sg</option> expansion item</primary>
14998 </indexterm>
14999 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
15000 option; hence its name. However, unlike the Perl equivalent, Exim does not
15001 modify the subject string; instead it returns the modified string for insertion
15002 into the overall expansion. The item takes three arguments: the subject string,
15003 a regular expression, and a substitution string. For example:
15004 </para>
15005 <literallayout class="monospaced">
15006 ${sg{abcdefabcdef}{abc}{xyz}}
15007 </literallayout>
15008 <para>
15009 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
15010 if any $, } or \ characters are required in the regular expression or in the
15011 substitution string, they have to be escaped. For example:
15012 </para>
15013 <literallayout class="monospaced">
15014 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
15015 </literallayout>
15016 <para>
15017 yields <quote>defabc</quote>, and
15018 </para>
15019 <literallayout class="monospaced">
15020 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
15021 </literallayout>
15022 <para>
15023 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
15024 the regular expression from string expansion.
15025 </para>
15026 </listitem></varlistentry>
15027 <varlistentry>
15028 <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>
15029 <listitem>
15030 <para>
15031 <indexterm role="concept">
15032 <primary>sorting</primary>
15033 <secondary>a list</secondary>
15034 </indexterm>
15035 <indexterm role="concept">
15036 <primary>list</primary>
15037 <secondary>sorting</secondary>
15038 </indexterm>
15039 <indexterm role="concept">
15040 <primary>expansion</primary>
15041 <secondary>list sorting</secondary>
15042 </indexterm>
15043 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15044 default, but the separator can be changed in the usual way.
15045 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
15046 of a two-argument expansion condition.
15047 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
15048 The comparison should return true when applied to two values
15049 if the first value should sort before the second value.
15050 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
15051 the element being placed in <varname>$item</varname>,
15052 to give values for comparison.
15053 </para>
15054 <para>
15055 The item result is a sorted list,
15056 with the original list separator,
15057 of the list elements (in full) of the original.
15058 </para>
15059 <para>
15060 Examples:
15061 </para>
15062 <literallayout class="monospaced">
15063 ${sort{3:2:1:4}{&lt;}{$item}}
15064 </literallayout>
15065 <para>
15066 sorts a list of numbers, and
15067 </para>
15068 <literallayout class="monospaced">
15069 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
15070 </literallayout>
15071 <para>
15072 will sort an MX lookup into priority order.
15073 </para>
15074 </listitem></varlistentry>
15075 <varlistentry>
15076 <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>
15077 <listitem>
15078 <para>
15079 <indexterm role="concept">
15080 <primary><option>substr</option> expansion item</primary>
15081 </indexterm>
15082 <indexterm role="concept">
15083 <primary>substring extraction</primary>
15084 </indexterm>
15085 <indexterm role="concept">
15086 <primary>expansion</primary>
15087 <secondary>substring extraction</secondary>
15088 </indexterm>
15089 The three strings are expanded; the first two must yield numbers. Call them
15090 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15091 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15092 can use the simpler operator notation that avoids some of the braces:
15093 </para>
15094 <literallayout class="monospaced">
15095 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15096 </literallayout>
15097 <para>
15098 The second number is optional (in both notations).
15099 If it is absent in the simpler format, the preceding underscore must also be
15100 omitted.
15101 </para>
15102 <para>
15103 The <option>substr</option> item can be used to extract more general substrings than
15104 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
15105 length required. For example
15106 </para>
15107 <literallayout class="monospaced">
15108 ${substr{3}{2}{$local_part}}
15109 </literallayout>
15110 <para>
15111 If the starting offset is greater than the string length the result is the
15112 null string; if the length plus starting offset is greater than the string
15113 length, the result is the right-hand part of the string, starting from the
15114 given offset. The first character in the string has offset zero.
15115 </para>
15116 <para>
15117 The <option>substr</option> expansion item can take negative offset values to count
15118 from the right-hand end of its operand. The last character is offset -1, the
15119 second-last is offset -2, and so on. Thus, for example,
15120 </para>
15121 <literallayout class="monospaced">
15122 ${substr{-5}{2}{1234567}}
15123 </literallayout>
15124 <para>
15125 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15126 length of the string, the substring starts at the beginning of the string, and
15127 the length is reduced by the amount of overshoot. Thus, for example,
15128 </para>
15129 <literallayout class="monospaced">
15130 ${substr{-5}{2}{12}}
15131 </literallayout>
15132 <para>
15133 yields an empty string, but
15134 </para>
15135 <literallayout class="monospaced">
15136 ${substr{-3}{2}{12}}
15137 </literallayout>
15138 <para>
15139 yields <quote>1</quote>.
15140 </para>
15141 <para>
15142 When the second number is omitted from <option>substr</option>, the remainder of the string
15143 is taken if the offset is positive. If it is negative, all characters in the
15144 string preceding the offset point are taken. For example, an offset of -1 and
15145 no length, as in these semantically identical examples:
15146 </para>
15147 <literallayout class="monospaced">
15148 ${substr_-1:abcde}
15149 ${substr{-1}{abcde}}
15150 </literallayout>
15151 <para>
15152 yields all but the last character of the string, that is, <quote>abcd</quote>.
15153 </para>
15154 </listitem></varlistentry>
15155 <varlistentry>
15156 <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>
15157 <listitem>
15158 <para>
15159 <indexterm role="concept">
15160 <primary>expansion</primary>
15161 <secondary>character translation</secondary>
15162 </indexterm>
15163 <indexterm role="concept">
15164 <primary><option>tr</option> expansion item</primary>
15165 </indexterm>
15166 This item does single-character translation on its subject string. The second
15167 argument is a list of characters to be translated in the subject string. Each
15168 matching character is replaced by the corresponding character from the
15169 replacement list. For example
15170 </para>
15171 <literallayout class="monospaced">
15172 ${tr{abcdea}{ac}{13}}
15173 </literallayout>
15174 <para>
15175 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15176 last occurrence is used. If the third string is shorter than the second, its
15177 last character is replicated. However, if it is empty, no translation takes
15178 place.
15179 </para>
15180 </listitem></varlistentry>
15181 </variablelist>
15182 </section>
15183 <section id="SECTexpop">
15184 <title>Expansion operators</title>
15185 <para>
15186 <indexterm role="concept">
15187 <primary>expansion</primary>
15188 <secondary>operators</secondary>
15189 </indexterm>
15190 For expansion items that perform transformations on a single argument string,
15191 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15192 The substring is first expanded before the operation is applied to it. The
15193 following operations can be performed:
15194 </para>
15195 <variablelist>
15196 <varlistentry>
15197 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15198 <listitem>
15199 <para>
15200 <indexterm role="concept">
15201 <primary>expansion</primary>
15202 <secondary>RFC 2822 address handling</secondary>
15203 </indexterm>
15204 <indexterm role="concept">
15205 <primary><option>address</option> expansion item</primary>
15206 </indexterm>
15207 The string is interpreted as an RFC 2822 address, as it might appear in a
15208 header line, and the effective address is extracted from it. If the string does
15209 not parse successfully, the result is empty.
15210 </para>
15211 </listitem></varlistentry>
15212 <varlistentry>
15213 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15214 <listitem>
15215 <para>
15216 <indexterm role="concept">
15217 <primary>expansion</primary>
15218 <secondary>RFC 2822 address handling</secondary>
15219 </indexterm>
15220 <indexterm role="concept">
15221 <primary><option>addresses</option> expansion item</primary>
15222 </indexterm>
15223 The string (after expansion) is interpreted as a list of addresses in RFC
15224 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15225 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15226 result of the expansion is a colon-separated list, with appropriate
15227 doubling of colons should any happen to be present in the email addresses.
15228 Syntactically invalid RFC2822 address items are omitted from the output.
15229 </para>
15230 <para>
15231 It is possible to specify a character other than colon for the output
15232 separator by starting the string with &gt; followed by the new separator
15233 character. For example:
15234 </para>
15235 <literallayout class="monospaced">
15236 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15237 </literallayout>
15238 <para>
15239 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
15240 first, so if the expanded string starts with &gt;, it may change the output
15241 separator unintentionally. This can be avoided by setting the output
15242 separator explicitly:
15243 </para>
15244 <literallayout class="monospaced">
15245 ${addresses:&gt;:$h_from:}
15246 </literallayout>
15247 <para>
15248 Compare the <emphasis role="bold">address</emphasis> (singular)
15249 expansion item, which extracts the working address from a single RFC2822
15250 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
15251 processing lists.
15252 </para>
15253 <para>
15254 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15255 a strict interpretation of header line formatting.  Exim parses the bare,
15256 unquoted portion of an email address and if it finds a comma, treats it as an
15257 email address separator. For the example header line:
15258 </para>
15259 <literallayout class="monospaced">
15260 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15261 </literallayout>
15262 <para>
15263 The first example below demonstrates that Q-encoded email addresses are parsed
15264 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15265 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15266 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15267 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15268 The third example shows that the presence of a comma is skipped when it is
15269 quoted.
15270 </para>
15271 <literallayout class="monospaced">
15272 # exim -be '${addresses:From: \
15273 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15274 user@example.com
15275 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15276 Last:user@example.com
15277 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15278 user@example.com
15279 </literallayout>
15280 </listitem></varlistentry>
15281 <varlistentry>
15282 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15283 <listitem>
15284 <para>
15285 <indexterm role="concept">
15286 <primary><option>base32</option> expansion item</primary>
15287 </indexterm>
15288 <indexterm role="concept">
15289 <primary>expansion</primary>
15290 <secondary>conversion to base 32</secondary>
15291 </indexterm>
15292 The string must consist entirely of decimal digits. The number is converted to
15293 base 32 and output as a (empty, for zero) string of characters.
15294 Only lowercase letters are used.
15295 </para>
15296 </listitem></varlistentry>
15297 <varlistentry>
15298 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15299 <listitem>
15300 <para>
15301 <indexterm role="concept">
15302 <primary><option>base32d</option> expansion item</primary>
15303 </indexterm>
15304 <indexterm role="concept">
15305 <primary>expansion</primary>
15306 <secondary>conversion to base 32</secondary>
15307 </indexterm>
15308 The string must consist entirely of base-32 digits.
15309 The number is converted to decimal and output as a string.
15310 </para>
15311 </listitem></varlistentry>
15312 <varlistentry>
15313 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15314 <listitem>
15315 <para>
15316 <indexterm role="concept">
15317 <primary><option>base62</option> expansion item</primary>
15318 </indexterm>
15319 <indexterm role="concept">
15320 <primary>expansion</primary>
15321 <secondary>conversion to base 62</secondary>
15322 </indexterm>
15323 The string must consist entirely of decimal digits. The number is converted to
15324 base 62 and output as a string of six characters, including leading zeros. In
15325 the few operating environments where Exim uses base 36 instead of base 62 for
15326 its message identifiers (because those systems do not have case-sensitive file
15327 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
15328 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15329 </para>
15330 </listitem></varlistentry>
15331 <varlistentry>
15332 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15333 <listitem>
15334 <para>
15335 <indexterm role="concept">
15336 <primary><option>base62d</option> expansion item</primary>
15337 </indexterm>
15338 <indexterm role="concept">
15339 <primary>expansion</primary>
15340 <secondary>conversion to base 62</secondary>
15341 </indexterm>
15342 The string must consist entirely of base-62 digits, or, in operating
15343 environments where Exim uses base 36 instead of base 62 for its message
15344 identifiers, base-36 digits. The number is converted to decimal and output as a
15345 string.
15346 </para>
15347 </listitem></varlistentry>
15348 <varlistentry>
15349 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15350 <listitem>
15351 <para>
15352 <indexterm role="concept">
15353 <primary>expansion</primary>
15354 <secondary>base64 encoding</secondary>
15355 </indexterm>
15356 <indexterm role="concept">
15357 <primary>base64 encoding</primary>
15358 <secondary>in string expansion</secondary>
15359 </indexterm>
15360 <indexterm role="concept">
15361 <primary><option>base64</option> expansion item</primary>
15362 </indexterm>
15363 <indexterm role="concept">
15364 <primary>certificate</primary>
15365 <secondary>base64 of DER</secondary>
15366 </indexterm>
15367 This operator converts a string into one that is base64 encoded.
15368 </para>
15369 <para>
15370 If the string is a single variable of type certificate,
15371 returns the base64 encoding of the DER form of the certificate.
15372 </para>
15373 </listitem></varlistentry>
15374 <varlistentry>
15375 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15376 <listitem>
15377 <para>
15378 <indexterm role="concept">
15379 <primary>expansion</primary>
15380 <secondary>base64 decoding</secondary>
15381 </indexterm>
15382 <indexterm role="concept">
15383 <primary>base64 decoding</primary>
15384 <secondary>in string expansion</secondary>
15385 </indexterm>
15386 <indexterm role="concept">
15387 <primary><option>base64d</option> expansion item</primary>
15388 </indexterm>
15389 This operator converts a base64-encoded string into the un-coded form.
15390 </para>
15391 </listitem></varlistentry>
15392 <varlistentry>
15393 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15394 <listitem>
15395 <para>
15396 <indexterm role="concept">
15397 <primary>domain</primary>
15398 <secondary>extraction</secondary>
15399 </indexterm>
15400 <indexterm role="concept">
15401 <primary>expansion</primary>
15402 <secondary>domain extraction</secondary>
15403 </indexterm>
15404 The string is interpreted as an RFC 2822 address and the domain is extracted
15405 from it. If the string does not parse successfully, the result is empty.
15406 </para>
15407 </listitem></varlistentry>
15408 <varlistentry>
15409 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15410 <listitem>
15411 <para>
15412 <indexterm role="concept">
15413 <primary>expansion</primary>
15414 <secondary>escaping non-printing characters</secondary>
15415 </indexterm>
15416 <indexterm role="concept">
15417 <primary><option>escape</option> expansion item</primary>
15418 </indexterm>
15419 If the string contains any non-printing characters, they are converted to
15420 escape sequences starting with a backslash. Whether characters with the most
15421 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15422 is controlled by the <option>print_topbitchars</option> option.
15423 </para>
15424 </listitem></varlistentry>
15425 <varlistentry>
15426 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15427 <listitem>
15428 <para>
15429 <indexterm role="concept">
15430 <primary>expansion</primary>
15431 <secondary>escaping 8-bit characters</secondary>
15432 </indexterm>
15433 <indexterm role="concept">
15434 <primary><option>escape8bit</option> expansion item</primary>
15435 </indexterm>
15436 If the string contains and characters with the most significant bit set,
15437 they are converted to escape sequences starting with a backslash.
15438 Backslashes and DEL characters are also converted.
15439 </para>
15440 </listitem></varlistentry>
15441 <varlistentry>
15442 <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>
15443 <listitem>
15444 <para>
15445 <indexterm role="concept">
15446 <primary>expansion</primary>
15447 <secondary>expression evaluation</secondary>
15448 </indexterm>
15449 <indexterm role="concept">
15450 <primary>expansion</primary>
15451 <secondary>arithmetic expression</secondary>
15452 </indexterm>
15453 <indexterm role="concept">
15454 <primary><option>eval</option> expansion item</primary>
15455 </indexterm>
15456 These items supports simple arithmetic and bitwise logical operations in
15457 expansion strings. The string (after expansion) must be a conventional
15458 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15459 logical operators, and parentheses. All operations are carried out using
15460 integer arithmetic. The operator priorities are as follows (the same as in the
15461 C programming language):
15462 </para>
15463 <informaltable frame="none">
15464 <tgroup cols="2" colsep="0" rowsep="0">
15465 <colspec colwidth="70pt" align="left"/>
15466 <colspec colwidth="300pt" align="left"/>
15467 <tbody>
15468 <row>
15469 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15470 <entry>not (~), negate (-)</entry>
15471 </row>
15472 <row>
15473 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15474 <entry>multiply (*), divide (/), remainder (%)</entry>
15475 </row>
15476 <row>
15477 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15478 <entry>plus (+), minus (-)</entry>
15479 </row>
15480 <row>
15481 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15482 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15483 </row>
15484 <row>
15485 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15486 <entry>and (&amp;)</entry>
15487 </row>
15488 <row>
15489 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15490 <entry>xor (^)</entry>
15491 </row>
15492 <row>
15493 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15494 <entry>or (|)</entry>
15495 </row>
15496 </tbody>
15497 </tgroup>
15498 </informaltable>
15499 <para>
15500 Binary operators with the same priority are evaluated from left to right. White
15501 space is permitted before or after operators.
15502 </para>
15503 <para>
15504 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15505 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15506 decimal, even if they start with a leading zero; hexadecimal numbers are not
15507 permitted. This can be useful when processing numbers extracted from dates or
15508 times, which often do have leading zeros.
15509 </para>
15510 <para>
15511 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15512 or 1024*1024*1024,
15513 respectively. Negative numbers are supported. The result of the computation is
15514 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15515 </para>
15516 <literallayout>
15517 <literal>${eval:1+1}            </literal>  yields 2
15518 <literal>${eval:1+2*3}          </literal>  yields 7
15519 <literal>${eval:(1+2)*3}        </literal>  yields 9
15520 <literal>${eval:2+42%5}         </literal>  yields 4
15521 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15522 <literal>${eval:0xc|5}          </literal>  yields 13
15523 <literal>${eval:0xc^5}          </literal>  yields 9
15524 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15525 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15526 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15527 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15528 </literallayout>
15529 <para>
15530 As a more realistic example, in an ACL you might have
15531 </para>
15532 <literallayout class="monospaced">
15533 deny   message = Too many bad recipients
15534        condition =                    \
15535          ${if and {                   \
15536            {&gt;{$rcpt_count}{10}}       \
15537            {                          \
15538            &lt;                          \
15539              {$recipients_count}      \
15540              {${eval:$rcpt_count/2}}  \
15541            }                          \
15542          }{yes}{no}}
15543 </literallayout>
15544 <para>
15545 The condition is true if there have been more than 10 RCPT commands and
15546 fewer than half of them have resulted in a valid recipient.
15547 </para>
15548 </listitem></varlistentry>
15549 <varlistentry>
15550 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15551 <listitem>
15552 <para>
15553 <indexterm role="concept">
15554 <primary>expansion</primary>
15555 <secondary>re-expansion of substring</secondary>
15556 </indexterm>
15557 The <option>expand</option> operator causes a string to be expanded for a second time. For
15558 example,
15559 </para>
15560 <literallayout class="monospaced">
15561 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15562 </literallayout>
15563 <para>
15564 first looks up a string in a file while expanding the operand for <option>expand</option>,
15565 and then re-expands what it has found.
15566 </para>
15567 </listitem></varlistentry>
15568 <varlistentry>
15569 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15570 <listitem>
15571 <para>
15572 <indexterm role="concept">
15573 <primary>Unicode</primary>
15574 </indexterm>
15575 <indexterm role="concept">
15576 <primary>UTF-8</primary>
15577 <secondary>conversion from</secondary>
15578 </indexterm>
15579 <indexterm role="concept">
15580 <primary>expansion</primary>
15581 <secondary>UTF-8 conversion</secondary>
15582 </indexterm>
15583 <indexterm role="concept">
15584 <primary><option>from_utf8</option> expansion item</primary>
15585 </indexterm>
15586 The world is slowly moving towards Unicode, although there are no standards for
15587 email yet. However, other applications (including some databases) are starting
15588 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15589 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15590 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15591 the result is an undefined sequence of bytes.
15592 </para>
15593 <para>
15594 Unicode code points with values less than 256 are compatible with ASCII and
15595 ISO-8859-1 (also known as Latin-1).
15596 For example, character 169 is the copyright symbol in both cases, though the
15597 way it is encoded is different. In UTF-8, more than one byte is needed for
15598 characters with code values greater than 127, whereas ISO-8859-1 is a
15599 single-byte encoding (but thereby limited to 256 characters). This makes
15600 translation from UTF-8 to ISO-8859-1 straightforward.
15601 </para>
15602 </listitem></varlistentry>
15603 <varlistentry>
15604 <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>
15605 <listitem>
15606 <para>
15607 <indexterm role="concept">
15608 <primary>hash function</primary>
15609 <secondary>textual</secondary>
15610 </indexterm>
15611 <indexterm role="concept">
15612 <primary>expansion</primary>
15613 <secondary>textual hash</secondary>
15614 </indexterm>
15615 The <option>hash</option> operator is a simpler interface to the hashing function that can
15616 be used when the two parameters are fixed numbers (as opposed to strings that
15617 change when expanded). The effect is the same as
15618 </para>
15619 <literallayout class="monospaced">
15620 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15621 </literallayout>
15622 <para>
15623 See the description of the general <option>hash</option> item above for details. The
15624 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15625 </para>
15626 </listitem></varlistentry>
15627 <varlistentry>
15628 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15629 <listitem>
15630 <para>
15631 <indexterm role="concept">
15632 <primary>base64 encoding</primary>
15633 <secondary>conversion from hex</secondary>
15634 </indexterm>
15635 <indexterm role="concept">
15636 <primary>expansion</primary>
15637 <secondary>hex to base64</secondary>
15638 </indexterm>
15639 <indexterm role="concept">
15640 <primary><option>hex2b64</option> expansion item</primary>
15641 </indexterm>
15642 This operator converts a hex string into one that is base64 encoded. This can
15643 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15644 </para>
15645 </listitem></varlistentry>
15646 <varlistentry>
15647 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15648 <listitem>
15649 <para>
15650 <indexterm role="concept">
15651 <primary>quoting</primary>
15652 <secondary>hex-encoded unprintable characters</secondary>
15653 </indexterm>
15654 <indexterm role="concept">
15655 <primary><option>hexquote</option> expansion item</primary>
15656 </indexterm>
15657 This operator converts non-printable characters in a string into a hex
15658 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15659 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15660 byte value 127 is converted to <literal>\x7f</literal>.
15661 </para>
15662 </listitem></varlistentry>
15663 <varlistentry>
15664 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15665 <listitem>
15666 <para>
15667 <indexterm role="concept">
15668 <primary><option>ipv6denorm</option> expansion item</primary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary>IP address</primary>
15672 <secondary>normalisation</secondary>
15673 </indexterm>
15674 This expands an IPv6 address to a full eight-element colon-separated set
15675 of hex digits including leading zeroes.
15676 A trailing ipv4-style dotted-decimal set is converted to hex.
15677 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15678 </para>
15679 </listitem></varlistentry>
15680 <varlistentry>
15681 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15682 <listitem>
15683 <para>
15684 <indexterm role="concept">
15685 <primary><option>ipv6norm</option> expansion item</primary>
15686 </indexterm>
15687 <indexterm role="concept">
15688 <primary>IP address</primary>
15689 <secondary>normalisation</secondary>
15690 </indexterm>
15691 <indexterm role="concept">
15692 <primary>IP address</primary>
15693 <secondary>canonical form</secondary>
15694 </indexterm>
15695 This converts an IPv6 address to canonical form.
15696 Leading zeroes of groups are omitted, and the longest
15697 set of zero-valued groups is replaced with a double colon.
15698 A trailing ipv4-style dotted-decimal set is converted to hex.
15699 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15700 </para>
15701 </listitem></varlistentry>
15702 <varlistentry>
15703 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15704 <listitem>
15705 <para>
15706 <indexterm role="concept">
15707 <primary>case forcing in strings</primary>
15708 </indexterm>
15709 <indexterm role="concept">
15710 <primary>string</primary>
15711 <secondary>case forcing</secondary>
15712 </indexterm>
15713 <indexterm role="concept">
15714 <primary>lower casing</primary>
15715 </indexterm>
15716 <indexterm role="concept">
15717 <primary>expansion</primary>
15718 <secondary>case forcing</secondary>
15719 </indexterm>
15720 <indexterm role="concept">
15721 <primary><option>lc</option> expansion item</primary>
15722 </indexterm>
15723 This forces the letters in the string into lower-case, for example:
15724 </para>
15725 <literallayout class="monospaced">
15726 ${lc:$local_part}
15727 </literallayout>
15728 </listitem></varlistentry>
15729 <varlistentry>
15730 <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>
15731 <listitem>
15732 <para>
15733 <indexterm role="concept">
15734 <primary>expansion</primary>
15735 <secondary>string truncation</secondary>
15736 </indexterm>
15737 <indexterm role="concept">
15738 <primary><option>length</option> expansion item</primary>
15739 </indexterm>
15740 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15741 can be used when the parameter is a fixed number (as opposed to a string that
15742 changes when expanded). The effect is the same as
15743 </para>
15744 <literallayout class="monospaced">
15745 ${length{&lt;number&gt;}{&lt;string&gt;}}
15746 </literallayout>
15747 <para>
15748 See the description of the general <option>length</option> item above for details. Note that
15749 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15750 when <option>length</option> is used as an operator.
15751 </para>
15752 </listitem></varlistentry>
15753 <varlistentry>
15754 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15755 <listitem>
15756 <para>
15757 <indexterm role="concept">
15758 <primary>expansion</primary>
15759 <secondary>list item count</secondary>
15760 </indexterm>
15761 <indexterm role="concept">
15762 <primary>list</primary>
15763 <secondary>item count</secondary>
15764 </indexterm>
15765 <indexterm role="concept">
15766 <primary>list</primary>
15767 <secondary>count of items</secondary>
15768 </indexterm>
15769 <indexterm role="concept">
15770 <primary><option>listcount</option> expansion item</primary>
15771 </indexterm>
15772 The string is interpreted as a list and the number of items is returned.
15773 </para>
15774 </listitem></varlistentry>
15775 <varlistentry>
15776 <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>
15777 <listitem>
15778 <para>
15779 <indexterm role="concept">
15780 <primary>expansion</primary>
15781 <secondary>named list</secondary>
15782 </indexterm>
15783 <indexterm role="concept">
15784 <primary><option>listnamed</option> expansion item</primary>
15785 </indexterm>
15786 The name is interpreted as a named list and the content of the list is returned,
15787 expanding any referenced lists, re-quoting as needed for colon-separation.
15788 If the optional type is given it must be one of "a", "d", "h" or "l"
15789 and selects address-, domain-, host- or localpart- lists to search among respectively.
15790 Otherwise all types are searched in an undefined order and the first
15791 matching list is returned.
15792 </para>
15793 </listitem></varlistentry>
15794 <varlistentry>
15795 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15796 <listitem>
15797 <para>
15798 <indexterm role="concept">
15799 <primary>expansion</primary>
15800 <secondary>local part extraction</secondary>
15801 </indexterm>
15802 <indexterm role="concept">
15803 <primary><option>local_part</option> expansion item</primary>
15804 </indexterm>
15805 The string is interpreted as an RFC 2822 address and the local part is
15806 extracted from it. If the string does not parse successfully, the result is
15807 empty.
15808 </para>
15809 </listitem></varlistentry>
15810 <varlistentry>
15811 <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>
15812 <listitem>
15813 <para>
15814 <indexterm role="concept">
15815 <primary>masked IP address</primary>
15816 </indexterm>
15817 <indexterm role="concept">
15818 <primary>IP address</primary>
15819 <secondary>masking</secondary>
15820 </indexterm>
15821 <indexterm role="concept">
15822 <primary>CIDR notation</primary>
15823 </indexterm>
15824 <indexterm role="concept">
15825 <primary>expansion</primary>
15826 <secondary>IP address masking</secondary>
15827 </indexterm>
15828 <indexterm role="concept">
15829 <primary><option>mask</option> expansion item</primary>
15830 </indexterm>
15831 If the form of the string to be operated on is not an IP address followed by a
15832 slash and an integer (that is, a network address in CIDR notation), the
15833 expansion fails. Otherwise, this operator converts the IP address to binary,
15834 masks off the least significant bits according to the bit count, and converts
15835 the result back to text, with mask appended. For example,
15836 </para>
15837 <literallayout class="monospaced">
15838 ${mask:10.111.131.206/28}
15839 </literallayout>
15840 <para>
15841 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15842 be mostly used for looking up masked addresses in files, the result for an IPv6
15843 address uses dots to separate components instead of colons, because colon
15844 terminates a key string in lsearch files. So, for example,
15845 </para>
15846 <literallayout class="monospaced">
15847 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15848 </literallayout>
15849 <para>
15850 returns the string
15851 </para>
15852 <literallayout class="monospaced">
15853 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15854 </literallayout>
15855 <para>
15856 Letters in IPv6 addresses are always output in lower case.
15857 </para>
15858 </listitem></varlistentry>
15859 <varlistentry>
15860 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15861 <listitem>
15862 <para>
15863 <indexterm role="concept">
15864 <primary>MD5 hash</primary>
15865 </indexterm>
15866 <indexterm role="concept">
15867 <primary>expansion</primary>
15868 <secondary>MD5 hash</secondary>
15869 </indexterm>
15870 <indexterm role="concept">
15871 <primary>certificate</primary>
15872 <secondary>fingerprint</secondary>
15873 </indexterm>
15874 <indexterm role="concept">
15875 <primary><option>md5</option> expansion item</primary>
15876 </indexterm>
15877 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15878 as a 32-digit hexadecimal number, in which any letters are in lower case.
15879 </para>
15880 <para>
15881 If the string is a single variable of type certificate,
15882 returns the MD5 hash fingerprint of the certificate.
15883 </para>
15884 </listitem></varlistentry>
15885 <varlistentry>
15886 <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>
15887 <listitem>
15888 <para>
15889 <indexterm role="concept">
15890 <primary>expansion</primary>
15891 <secondary>numeric hash</secondary>
15892 </indexterm>
15893 <indexterm role="concept">
15894 <primary>hash function</primary>
15895 <secondary>numeric</secondary>
15896 </indexterm>
15897 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15898 that can be used when the two parameters are fixed numbers (as opposed to
15899 strings that change when expanded). The effect is the same as
15900 </para>
15901 <literallayout class="monospaced">
15902 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15903 </literallayout>
15904 <para>
15905 See the description of the general <option>nhash</option> item above for details.
15906 </para>
15907 </listitem></varlistentry>
15908 <varlistentry>
15909 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15910 <listitem>
15911 <para>
15912 <indexterm role="concept">
15913 <primary>quoting</primary>
15914 <secondary>in string expansions</secondary>
15915 </indexterm>
15916 <indexterm role="concept">
15917 <primary>expansion</primary>
15918 <secondary>quoting</secondary>
15919 </indexterm>
15920 <indexterm role="concept">
15921 <primary><option>quote</option> expansion item</primary>
15922 </indexterm>
15923 The <option>quote</option> operator puts its argument into double quotes if it
15924 is an empty string or
15925 contains anything other than letters, digits, underscores, dots, and hyphens.
15926 Any occurrences of double quotes and backslashes are escaped with a backslash.
15927 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15928 respectively For example,
15929 </para>
15930 <literallayout class="monospaced">
15931 ${quote:ab"*"cd}
15932 </literallayout>
15933 <para>
15934 becomes
15935 </para>
15936 <literallayout class="monospaced">
15937 "ab\"*\"cd"
15938 </literallayout>
15939 <para>
15940 The place where this is useful is when the argument is a substitution from a
15941 variable or a message header.
15942 </para>
15943 </listitem></varlistentry>
15944 <varlistentry>
15945 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15946 <listitem>
15947 <para>
15948 <indexterm role="concept">
15949 <primary><option>quote_local_part</option> expansion item</primary>
15950 </indexterm>
15951 This operator is like <option>quote</option>, except that it quotes the string only if
15952 required to do so by the rules of RFC 2822 for quoting local parts. For
15953 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15954 If you are creating a new email address from the contents of <varname>$local_part</varname>
15955 (or any other unknown data), you should always use this operator.
15956 </para>
15957 </listitem></varlistentry>
15958 <varlistentry>
15959 <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>
15960 <listitem>
15961 <para>
15962 <indexterm role="concept">
15963 <primary>quoting</primary>
15964 <secondary>lookup-specific</secondary>
15965 </indexterm>
15966 This operator applies lookup-specific quoting rules to the string. Each
15967 query-style lookup type has its own quoting rules which are described with
15968 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15969 </para>
15970 <literallayout class="monospaced">
15971 ${quote_ldap:two * two}
15972 </literallayout>
15973 <para>
15974 returns
15975 </para>
15976 <literallayout class="monospaced">
15977 two%20%5C2A%20two
15978 </literallayout>
15979 <para>
15980 For single-key lookup types, no quoting is ever necessary and this operator
15981 yields an unchanged string.
15982 </para>
15983 </listitem></varlistentry>
15984 <varlistentry>
15985 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15986 <listitem>
15987 <para>
15988 <indexterm role="concept">
15989 <primary>random number</primary>
15990 </indexterm>
15991 This operator returns a somewhat random number which is less than the
15992 supplied number and is at least 0.  The quality of this randomness depends
15993 on how Exim was built; the values are not suitable for keying material.
15994 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15995 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15996 for versions of GnuTLS with that function.
15997 Otherwise, the implementation may be arc4random(), random() seeded by
15998 srandomdev() or srandom(), or a custom implementation even weaker than
15999 random().
16000 </para>
16001 </listitem></varlistentry>
16002 <varlistentry>
16003 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16004 <listitem>
16005 <para>
16006 <indexterm role="concept">
16007 <primary>expansion</primary>
16008 <secondary>IP address</secondary>
16009 </indexterm>
16010 This operator reverses an IP address; for IPv4 addresses, the result is in
16011 dotted-quad decimal form, while for IPv6 addresses the result is in
16012 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
16013 for DNS.  For example,
16014 </para>
16015 <literallayout class="monospaced">
16016 ${reverse_ip:192.0.2.4}
16017 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
16018 </literallayout>
16019 <para>
16020 returns
16021 </para>
16022 <literallayout class="monospaced">
16023 4.2.0.192
16024 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
16025 </literallayout>
16026 </listitem></varlistentry>
16027 <varlistentry>
16028 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16029 <listitem>
16030 <para>
16031 <indexterm role="concept">
16032 <primary>expansion</primary>
16033 <secondary>RFC 2047</secondary>
16034 </indexterm>
16035 <indexterm role="concept">
16036 <primary>RFC 2047</primary>
16037 <secondary>expansion operator</secondary>
16038 </indexterm>
16039 <indexterm role="concept">
16040 <primary><option>rfc2047</option> expansion item</primary>
16041 </indexterm>
16042 This operator encodes text according to the rules of RFC 2047. This is an
16043 encoding that is used in header lines to encode non-ASCII characters. It is
16044 assumed that the input string is in the encoding specified by the
16045 <option>headers_charset</option> option, which gets its default at build time. If the string
16046 contains only characters in the range 33&ndash;126, and no instances of the
16047 characters
16048 </para>
16049 <literallayout class="monospaced">
16050 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
16051 </literallayout>
16052 <para>
16053 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
16054 string, using as many <quote>encoded words</quote> as necessary to encode all the
16055 characters.
16056 </para>
16057 </listitem></varlistentry>
16058 <varlistentry>
16059 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16060 <listitem>
16061 <para>
16062 <indexterm role="concept">
16063 <primary>expansion</primary>
16064 <secondary>RFC 2047</secondary>
16065 </indexterm>
16066 <indexterm role="concept">
16067 <primary>RFC 2047</primary>
16068 <secondary>decoding</secondary>
16069 </indexterm>
16070 <indexterm role="concept">
16071 <primary><option>rfc2047d</option> expansion item</primary>
16072 </indexterm>
16073 This operator decodes strings that are encoded as per RFC 2047. Binary zero
16074 bytes are replaced by question marks. Characters are converted into the
16075 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
16076 not recognized unless <option>check_rfc2047_length</option> is set false.
16077 </para>
16078 <para>
16079 <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
16080 access a header line, RFC 2047 decoding is done automatically. You do not need
16081 to use this operator as well.
16082 </para>
16083 </listitem></varlistentry>
16084 <varlistentry>
16085 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16086 <listitem>
16087 <para>
16088 <indexterm role="concept">
16089 <primary>quoting</primary>
16090 <secondary>in regular expressions</secondary>
16091 </indexterm>
16092 <indexterm role="concept">
16093 <primary>regular expressions</primary>
16094 <secondary>quoting</secondary>
16095 </indexterm>
16096 <indexterm role="concept">
16097 <primary><option>rxquote</option> expansion item</primary>
16098 </indexterm>
16099 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
16100 characters in its argument. This is useful when substituting the values of
16101 variables or headers inside regular expressions.
16102 </para>
16103 </listitem></varlistentry>
16104 <varlistentry>
16105 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16106 <listitem>
16107 <para>
16108 <indexterm role="concept">
16109 <primary>SHA-1 hash</primary>
16110 </indexterm>
16111 <indexterm role="concept">
16112 <primary>expansion</primary>
16113 <secondary>SHA-1 hashing</secondary>
16114 </indexterm>
16115 <indexterm role="concept">
16116 <primary>certificate</primary>
16117 <secondary>fingerprint</secondary>
16118 </indexterm>
16119 <indexterm role="concept">
16120 <primary><option>sha1</option> expansion item</primary>
16121 </indexterm>
16122 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
16123 it as a 40-digit hexadecimal number, in which any letters are in upper case.
16124 </para>
16125 <para>
16126 If the string is a single variable of type certificate,
16127 returns the SHA-1 hash fingerprint of the certificate.
16128 </para>
16129 </listitem></varlistentry>
16130 <varlistentry>
16131 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16132 <listitem>
16133 <para>
16134 <indexterm role="concept">
16135 <primary>SHA-256 hash</primary>
16136 </indexterm>
16137 <indexterm role="concept">
16138 <primary>certificate</primary>
16139 <secondary>fingerprint</secondary>
16140 </indexterm>
16141 <indexterm role="concept">
16142 <primary>expansion</primary>
16143 <secondary>SHA-256 hashing</secondary>
16144 </indexterm>
16145 <indexterm role="concept">
16146 <primary><option>sha256</option> expansion item</primary>
16147 </indexterm>
16148 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16149 and returns
16150 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16151 </para>
16152 <para>
16153 If the string is a single variable of type certificate,
16154 returns the SHA-256 hash fingerprint of the certificate.
16155 </para>
16156 </listitem></varlistentry>
16157 <varlistentry>
16158 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16159 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16160 <listitem>
16161 <para>
16162 <indexterm role="concept">
16163 <primary>SHA3 hash</primary>
16164 </indexterm>
16165 <indexterm role="concept">
16166 <primary>expansion</primary>
16167 <secondary>SHA3 hashing</secondary>
16168 </indexterm>
16169 <indexterm role="concept">
16170 <primary><option>sha3</option> expansion item</primary>
16171 </indexterm>
16172 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16173 and returns
16174 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16175 </para>
16176 <para>
16177 If a number is appended, separated by an underbar, it specifies
16178 the output length.  Values of 224, 256, 384 and 512 are accepted;
16179 with 256 being the default.
16180 </para>
16181 <para>
16182 The <option>sha3</option> expansion item is only supported if Exim has been
16183 compiled with GnuTLS 3.5.0 or later,
16184 </para>
16185 <para revisionflag="changed">
16186 or OpenSSL 1.1.1 or later.
16187 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
16188 </para>
16189 </listitem></varlistentry>
16190 <varlistentry>
16191 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16192 <listitem>
16193 <para>
16194 <indexterm role="concept">
16195 <primary>expansion</primary>
16196 <secondary>statting a file</secondary>
16197 </indexterm>
16198 <indexterm role="concept">
16199 <primary>file</primary>
16200 <secondary>extracting characteristics</secondary>
16201 </indexterm>
16202 <indexterm role="concept">
16203 <primary><option>stat</option> expansion item</primary>
16204 </indexterm>
16205 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16206 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16207 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16208 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16209 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16210 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16211 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16212 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16213 can extract individual fields using the <option>extract</option> expansion item.
16214 </para>
16215 <para>
16216 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16217 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16218 systems for files larger than 2GB.
16219 </para>
16220 </listitem></varlistentry>
16221 <varlistentry>
16222 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16223 <listitem>
16224 <para>
16225 <indexterm role="concept">
16226 <primary><option>str2b64</option> expansion item</primary>
16227 </indexterm>
16228 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16229 </para>
16230 </listitem></varlistentry>
16231 <varlistentry>
16232 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16233 <listitem>
16234 <para>
16235 <indexterm role="concept">
16236 <primary>expansion</primary>
16237 <secondary>string length</secondary>
16238 </indexterm>
16239 <indexterm role="concept">
16240 <primary>string</primary>
16241 <secondary>length in expansion</secondary>
16242 </indexterm>
16243 <indexterm role="concept">
16244 <primary><option>strlen</option> expansion item</primary>
16245 </indexterm>
16246 The item is replace by the length of the expanded string, expressed as a
16247 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
16248 </para>
16249 </listitem></varlistentry>
16250 <varlistentry>
16251 <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>
16252 <listitem>
16253 <para>
16254 <indexterm role="concept">
16255 <primary><option>substr</option> expansion item</primary>
16256 </indexterm>
16257 <indexterm role="concept">
16258 <primary>substring extraction</primary>
16259 </indexterm>
16260 <indexterm role="concept">
16261 <primary>expansion</primary>
16262 <secondary>substring expansion</secondary>
16263 </indexterm>
16264 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
16265 can be used when the two parameters are fixed numbers (as opposed to strings
16266 that change when expanded). The effect is the same as
16267 </para>
16268 <literallayout class="monospaced">
16269 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
16270 </literallayout>
16271 <para>
16272 See the description of the general <option>substr</option> item above for details. The
16273 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
16274 </para>
16275 </listitem></varlistentry>
16276 <varlistentry>
16277 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16278 <listitem>
16279 <para>
16280 <indexterm role="concept">
16281 <primary><option>time_eval</option> expansion item</primary>
16282 </indexterm>
16283 <indexterm role="concept">
16284 <primary>time interval</primary>
16285 <secondary>decoding</secondary>
16286 </indexterm>
16287 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
16288 seconds.
16289 </para>
16290 </listitem></varlistentry>
16291 <varlistentry>
16292 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16293 <listitem>
16294 <para>
16295 <indexterm role="concept">
16296 <primary><option>time_interval</option> expansion item</primary>
16297 </indexterm>
16298 <indexterm role="concept">
16299 <primary>time interval</primary>
16300 <secondary>formatting</secondary>
16301 </indexterm>
16302 The argument (after sub-expansion) must be a sequence of decimal digits that
16303 represents an interval of time as a number of seconds. It is converted into a
16304 number of larger units and output in Exim&#x2019;s normal time format, for example,
16305 <literal>1w3d4h2m6s</literal>.
16306 </para>
16307 </listitem></varlistentry>
16308 <varlistentry>
16309 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16310 <listitem>
16311 <para>
16312 <indexterm role="concept">
16313 <primary>case forcing in strings</primary>
16314 </indexterm>
16315 <indexterm role="concept">
16316 <primary>string</primary>
16317 <secondary>case forcing</secondary>
16318 </indexterm>
16319 <indexterm role="concept">
16320 <primary>upper casing</primary>
16321 </indexterm>
16322 <indexterm role="concept">
16323 <primary>expansion</primary>
16324 <secondary>case forcing</secondary>
16325 </indexterm>
16326 <indexterm role="concept">
16327 <primary><option>uc</option> expansion item</primary>
16328 </indexterm>
16329 This forces the letters in the string into upper-case.
16330 </para>
16331 </listitem></varlistentry>
16332 <varlistentry>
16333 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16334 <listitem>
16335 <para>
16336 <indexterm role="concept">
16337 <primary>correction of invalid utf-8 sequences in strings</primary>
16338 </indexterm>
16339 <indexterm role="concept">
16340 <primary>utf-8</primary>
16341 <secondary>utf-8 sequences</secondary>
16342 </indexterm>
16343 <indexterm role="concept">
16344 <primary>incorrect utf-8</primary>
16345 </indexterm>
16346 <indexterm role="concept">
16347 <primary>expansion</primary>
16348 <secondary>utf-8 forcing</secondary>
16349 </indexterm>
16350 <indexterm role="concept">
16351 <primary><option>utf8clean</option> expansion item</primary>
16352 </indexterm>
16353 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16354 </para>
16355 </listitem></varlistentry>
16356 <varlistentry>
16357 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16358 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16359 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16360 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16361 <listitem>
16362 <para>
16363 <indexterm role="concept">
16364 <primary>expansion</primary>
16365 <secondary>UTF-8</secondary>
16366 </indexterm>
16367 <indexterm role="concept">
16368 <primary>UTF-8</primary>
16369 <secondary>expansion</secondary>
16370 </indexterm>
16371 <indexterm role="concept">
16372 <primary>EAI</primary>
16373 </indexterm>
16374 <indexterm role="concept">
16375 <primary>internationalisation</primary>
16376 </indexterm>
16377 <indexterm role="concept">
16378 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16379 </indexterm>
16380 <indexterm role="concept">
16381 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16382 </indexterm>
16383 <indexterm role="concept">
16384 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16385 </indexterm>
16386 <indexterm role="concept">
16387 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16388 </indexterm>
16389 These convert EAI mail name components between UTF-8 and a-label forms.
16390 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16391 </para>
16392 </listitem></varlistentry>
16393 </variablelist>
16394 </section>
16395 <section id="SECTexpcond">
16396 <title>Expansion conditions</title>
16397 <para>
16398 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16399 <primary>expansion</primary>
16400 <secondary>conditions</secondary>
16401 </indexterm>
16402 The following conditions are available for testing by the <option>${if</option> construct
16403 while expanding strings:
16404 </para>
16405 <variablelist>
16406 <varlistentry>
16407 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16408 <listitem>
16409 <para>
16410 <indexterm role="concept">
16411 <primary>expansion</primary>
16412 <secondary>negating a condition</secondary>
16413 </indexterm>
16414 <indexterm role="concept">
16415 <primary>negation</primary>
16416 <secondary>in expansion condition</secondary>
16417 </indexterm>
16418 Preceding any condition with an exclamation mark negates the result of the
16419 condition.
16420 </para>
16421 </listitem></varlistentry>
16422 <varlistentry>
16423 <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>
16424 <listitem>
16425 <para>
16426 <indexterm role="concept">
16427 <primary>numeric comparison</primary>
16428 </indexterm>
16429 <indexterm role="concept">
16430 <primary>expansion</primary>
16431 <secondary>numeric comparison</secondary>
16432 </indexterm>
16433 There are a number of symbolic operators for doing numeric comparisons. They
16434 are:
16435 </para>
16436 <literallayout>
16437 <literal>=   </literal>   equal
16438 <literal>==  </literal>   equal
16439 <literal>&gt;   </literal>   greater
16440 <literal>&gt;=  </literal>   greater or equal
16441 <literal>&lt;   </literal>   less
16442 <literal>&lt;=  </literal>   less or equal
16443 </literallayout>
16444 <para>
16445 For example:
16446 </para>
16447 <literallayout class="monospaced">
16448 ${if &gt;{$message_size}{10M} ...
16449 </literallayout>
16450 <para>
16451 Note that the general negation operator provides for inequality testing. The
16452 two strings must take the form of optionally signed decimal integers,
16453 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16454 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16455 As a special case, the numerical value of an empty string is taken as
16456 zero.
16457 </para>
16458 <para>
16459 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16460 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16461 10M, not if 10M is larger than <varname>$message_size</varname>.
16462 </para>
16463 </listitem></varlistentry>
16464 <varlistentry>
16465 <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>
16466 <listitem>
16467 <para>
16468 <indexterm role="concept">
16469 <primary>expansion</primary>
16470 <secondary>calling an acl</secondary>
16471 </indexterm>
16472 <indexterm role="concept">
16473 <primary><option>acl</option></primary>
16474 <secondary>expansion condition</secondary>
16475 </indexterm>
16476 The name and zero to nine argument strings are first expanded separately.  The expanded
16477 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16478 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16479 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16480 and may use the variables; if another acl expansion is used the values
16481 are restored after it returns.  If the ACL sets
16482 a value using a "message =" modifier the variable $value becomes
16483 the result of the expansion, otherwise it is empty.
16484 If the ACL returns accept the condition is true; if deny, false.
16485 If the ACL returns defer the result is a forced-fail.
16486 </para>
16487 </listitem></varlistentry>
16488 <varlistentry>
16489 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16490 <listitem>
16491 <para>
16492 <indexterm role="concept">
16493 <primary>expansion</primary>
16494 <secondary>boolean parsing</secondary>
16495 </indexterm>
16496 <indexterm role="concept">
16497 <primary><option>bool</option> expansion condition</primary>
16498 </indexterm>
16499 This condition turns a string holding a true or false representation into
16500 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16501 (case-insensitively); also integer numbers map to true if non-zero,
16502 false if zero.
16503 An empty string is treated as false.
16504 Leading and trailing whitespace is ignored;
16505 thus a string consisting only of whitespace is false.
16506 All other string values will result in expansion failure.
16507 </para>
16508 <para>
16509 When combined with ACL variables, this expansion condition will let you
16510 make decisions in one place and act on those decisions in another place.
16511 For example:
16512 </para>
16513 <literallayout class="monospaced">
16514 ${if bool{$acl_m_privileged_sender} ...
16515 </literallayout>
16516 </listitem></varlistentry>
16517 <varlistentry>
16518 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16519 <listitem>
16520 <para>
16521 <indexterm role="concept">
16522 <primary>expansion</primary>
16523 <secondary>boolean parsing</secondary>
16524 </indexterm>
16525 <indexterm role="concept">
16526 <primary><option>bool_lax</option> expansion condition</primary>
16527 </indexterm>
16528 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16529 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16530 loose definition that the Router <option>condition</option> option uses.  The empty string
16531 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16532 true.  Leading and trailing whitespace is ignored.
16533 </para>
16534 <para>
16535 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16536 </para>
16537 </listitem></varlistentry>
16538 <varlistentry>
16539 <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>
16540 <listitem>
16541 <para>
16542 <indexterm role="concept">
16543 <primary>expansion</primary>
16544 <secondary>encrypted comparison</secondary>
16545 </indexterm>
16546 <indexterm role="concept">
16547 <primary>encrypted strings, comparing</primary>
16548 </indexterm>
16549 <indexterm role="concept">
16550 <primary><option>crypteq</option> expansion condition</primary>
16551 </indexterm>
16552 This condition is included in the Exim binary if it is built to support any
16553 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16554 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16555 included in the binary.
16556 </para>
16557 <para>
16558 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16559 compared against the second, which is already encrypted. The second string may
16560 be in the LDAP form for storing encrypted strings, which starts with the
16561 encryption type in curly brackets, followed by the data. If the second string
16562 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16563 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16564 Typically this will be a field from a password file. An example of an encrypted
16565 string in LDAP form is:
16566 </para>
16567 <literallayout class="monospaced">
16568 {md5}CY9rzUYh03PK3k6DJie09g==
16569 </literallayout>
16570 <para>
16571 If such a string appears directly in an expansion, the curly brackets have to
16572 be quoted, because they are part of the expansion syntax. For example:
16573 </para>
16574 <literallayout class="monospaced">
16575 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16576 </literallayout>
16577 <para>
16578 The following encryption types (whose names are matched case-independently) are
16579 supported:
16580 </para>
16581 <itemizedlist>
16582 <listitem>
16583 <para>
16584 <indexterm role="concept">
16585 <primary>MD5 hash</primary>
16586 </indexterm>
16587 <indexterm role="concept">
16588 <primary>base64 encoding</primary>
16589 <secondary>in encrypted password</secondary>
16590 </indexterm>
16591 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16592 printable characters to compare with the remainder of the second string. If the
16593 length of the comparison string is 24, Exim assumes that it is base64 encoded
16594 (as in the above example). If the length is 32, Exim assumes that it is a
16595 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16596 comparison fails.
16597 </para>
16598 </listitem>
16599 <listitem>
16600 <para>
16601 <indexterm role="concept">
16602 <primary>SHA-1 hash</primary>
16603 </indexterm>
16604 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16605 printable characters to compare with the remainder of the second string. If the
16606 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16607 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16608 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16609 </para>
16610 </listitem>
16611 <listitem>
16612 <para>
16613 <indexterm role="concept">
16614 <primary><function>crypt()</function></primary>
16615 </indexterm>
16616 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16617 only the first eight characters of the password. However, in modern operating
16618 systems this is no longer true, and in many cases the entire password is used,
16619 whatever its length.
16620 </para>
16621 </listitem>
16622 <listitem>
16623 <para>
16624 <indexterm role="concept">
16625 <primary><function>crypt16()</function></primary>
16626 </indexterm>
16627 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16628 use up to 16 characters of the password in some operating systems. Again, in
16629 modern operating systems, more characters may be used.
16630 </para>
16631 </listitem>
16632 </itemizedlist>
16633 <para>
16634 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16635 <function>crypt()</function>. For operating systems that have their own version, setting
16636 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16637 operating system version instead of its own. This option is set by default in
16638 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16639 support <function>crypt16()</function>.
16640 </para>
16641 <para>
16642 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16643 it was not using the same algorithm as some operating systems&#x2019; versions. It
16644 turns out that as well as <function>crypt16()</function> there is a function called
16645 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16646 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16647 </para>
16648 <para>
16649 However, since there is now a move away from the traditional <function>crypt()</function>
16650 functions towards using SHA1 and other algorithms, tidying up this area of
16651 Exim is seen as very low priority.
16652 </para>
16653 <para>
16654 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16655 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16656 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16657 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16658 function by specifying it explicitly in curly brackets.
16659 </para>
16660 </listitem></varlistentry>
16661 <varlistentry>
16662 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16663 <listitem>
16664 <para>
16665 <indexterm role="concept">
16666 <primary>expansion</primary>
16667 <secondary>checking for empty variable</secondary>
16668 </indexterm>
16669 <indexterm role="concept">
16670 <primary><option>def</option> expansion condition</primary>
16671 </indexterm>
16672 The <option>def</option> condition must be followed by the name of one of the expansion
16673 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16674 variable does not contain the empty string. For example:
16675 </para>
16676 <literallayout class="monospaced">
16677 ${if def:sender_ident {from $sender_ident}}
16678 </literallayout>
16679 <para>
16680 Note that the variable name is given without a leading <option>$</option> character. If the
16681 variable does not exist, the expansion fails.
16682 </para>
16683 </listitem></varlistentry>
16684 <varlistentry>
16685 <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>
16686 <listitem>
16687 <para>
16688 <indexterm role="concept">
16689 <primary>expansion</primary>
16690 <secondary>checking header line existence</secondary>
16691 </indexterm>
16692 This condition is true if a message is being processed and the named header
16693 exists in the message. For example,
16694 </para>
16695 <literallayout class="monospaced">
16696 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16697 </literallayout>
16698 <para>
16699 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16700 the header name must be terminated by a colon if white space does not follow.
16701 </para>
16702 </listitem></varlistentry>
16703 <varlistentry>
16704 <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>
16705 <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>
16706 <listitem>
16707 <para>
16708 <indexterm role="concept">
16709 <primary>string</primary>
16710 <secondary>comparison</secondary>
16711 </indexterm>
16712 <indexterm role="concept">
16713 <primary>expansion</primary>
16714 <secondary>string comparison</secondary>
16715 </indexterm>
16716 <indexterm role="concept">
16717 <primary><option>eq</option> expansion condition</primary>
16718 </indexterm>
16719 <indexterm role="concept">
16720 <primary><option>eqi</option> expansion condition</primary>
16721 </indexterm>
16722 The two substrings are first expanded. The condition is true if the two
16723 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16724 letters, whereas for <option>eqi</option> the comparison is case-independent.
16725 </para>
16726 </listitem></varlistentry>
16727 <varlistentry>
16728 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16729 <listitem>
16730 <para>
16731 <indexterm role="concept">
16732 <primary>expansion</primary>
16733 <secondary>file existence test</secondary>
16734 </indexterm>
16735 <indexterm role="concept">
16736 <primary>file</primary>
16737 <secondary>existence test</secondary>
16738 </indexterm>
16739 <indexterm role="concept">
16740 <primary><option>exists</option>, expansion condition</primary>
16741 </indexterm>
16742 The substring is first expanded and then interpreted as an absolute path. The
16743 condition is true if the named file (or directory) exists. The existence test
16744 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16745 users&#x2019; filter files may be locked out by the system administrator.
16746 </para>
16747 </listitem></varlistentry>
16748 <varlistentry>
16749 <term><emphasis role="bold">first_delivery</emphasis></term>
16750 <listitem>
16751 <para>
16752 <indexterm role="concept">
16753 <primary>delivery</primary>
16754 <secondary>first</secondary>
16755 </indexterm>
16756 <indexterm role="concept">
16757 <primary>first delivery</primary>
16758 </indexterm>
16759 <indexterm role="concept">
16760 <primary>expansion</primary>
16761 <secondary>first delivery test</secondary>
16762 </indexterm>
16763 <indexterm role="concept">
16764 <primary><option>first_delivery</option> expansion condition</primary>
16765 </indexterm>
16766 This condition, which has no data, is true during a message&#x2019;s first delivery
16767 attempt. It is false during any subsequent delivery attempts.
16768 </para>
16769 </listitem></varlistentry>
16770 <varlistentry>
16771 <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>
16772 <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>
16773 <listitem>
16774 <para>
16775 <indexterm role="concept">
16776 <primary>list</primary>
16777 <secondary>iterative conditions</secondary>
16778 </indexterm>
16779 <indexterm role="concept">
16780 <primary>expansion</primary>
16781 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16782 </indexterm>
16783 <indexterm role="concept">
16784 <primary>expansion</primary>
16785 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16786 </indexterm>
16787 <indexterm role="variable">
16788 <primary><varname>$item</varname></primary>
16789 </indexterm>
16790 These conditions iterate over a list. The first argument is expanded to form
16791 the list. By default, the list separator is a colon, but it can be changed by
16792 the normal method. The second argument is interpreted as a condition that is to
16793 be applied to each item in the list in turn. During the interpretation of the
16794 condition, the current list item is placed in a variable called <varname>$item</varname>.
16795 </para>
16796 <itemizedlist>
16797 <listitem>
16798 <para>
16799 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16800 the result of the whole condition is true. If the condition is false for all
16801 items in the list, the overall condition is false.
16802 </para>
16803 </listitem>
16804 <listitem>
16805 <para>
16806 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16807 and the result of the whole condition is false. If the condition is true for
16808 all items in the list, the overall condition is true.
16809 </para>
16810 </listitem>
16811 </itemizedlist>
16812 <para>
16813 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16814 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16815 that the condition must be false for at least one item. In this example, the
16816 list separator is changed to a comma:
16817 </para>
16818 <literallayout class="monospaced">
16819 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16820 </literallayout>
16821 <para>
16822 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16823 being processed, to enable these expansion items to be nested.
16824 </para>
16825 <para>
16826 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16827 </para>
16828 </listitem></varlistentry>
16829 <varlistentry>
16830 <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>
16831 <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>
16832 <listitem>
16833 <para>
16834 <indexterm role="concept">
16835 <primary>string</primary>
16836 <secondary>comparison</secondary>
16837 </indexterm>
16838 <indexterm role="concept">
16839 <primary>expansion</primary>
16840 <secondary>string comparison</secondary>
16841 </indexterm>
16842 <indexterm role="concept">
16843 <primary><option>ge</option> expansion condition</primary>
16844 </indexterm>
16845 <indexterm role="concept">
16846 <primary><option>gei</option> expansion condition</primary>
16847 </indexterm>
16848 The two substrings are first expanded. The condition is true if the first
16849 string is lexically greater than or equal to the second string. For <option>ge</option> the
16850 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16851 case-independent.
16852 </para>
16853 </listitem></varlistentry>
16854 <varlistentry>
16855 <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>
16856 <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>
16857 <listitem>
16858 <para>
16859 <indexterm role="concept">
16860 <primary>string</primary>
16861 <secondary>comparison</secondary>
16862 </indexterm>
16863 <indexterm role="concept">
16864 <primary>expansion</primary>
16865 <secondary>string comparison</secondary>
16866 </indexterm>
16867 <indexterm role="concept">
16868 <primary><option>gt</option> expansion condition</primary>
16869 </indexterm>
16870 <indexterm role="concept">
16871 <primary><option>gti</option> expansion condition</primary>
16872 </indexterm>
16873 The two substrings are first expanded. The condition is true if the first
16874 string is lexically greater than the second string. For <option>gt</option> the comparison
16875 includes the case of letters, whereas for <option>gti</option> the comparison is
16876 case-independent.
16877 </para>
16878 </listitem></varlistentry>
16879 <varlistentry>
16880 <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>
16881 <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>
16882 <listitem>
16883 <para>
16884 <indexterm role="concept">
16885 <primary>string</primary>
16886 <secondary>comparison</secondary>
16887 </indexterm>
16888 <indexterm role="concept">
16889 <primary>list</primary>
16890 <secondary>iterative conditions</secondary>
16891 </indexterm>
16892 Both strings are expanded; the second string is treated as a list of simple
16893 strings; if the first string is a member of the second, then the condition
16894 is true.
16895 </para>
16896 <para>
16897 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16898 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16899 </para>
16900 <literallayout class="monospaced">
16901 ${if inlist{needle}{foo:needle:bar}}
16902   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16903 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16904   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16905 </literallayout>
16906 </listitem></varlistentry>
16907 <varlistentry>
16908 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16909 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16910 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16911 <listitem>
16912 <para>
16913 <indexterm role="concept">
16914 <primary>IP address</primary>
16915 <secondary>testing string format</secondary>
16916 </indexterm>
16917 <indexterm role="concept">
16918 <primary>string</primary>
16919 <secondary>testing for IP address</secondary>
16920 </indexterm>
16921 <indexterm role="concept">
16922 <primary><option>isip</option> expansion condition</primary>
16923 </indexterm>
16924 <indexterm role="concept">
16925 <primary><option>isip4</option> expansion condition</primary>
16926 </indexterm>
16927 <indexterm role="concept">
16928 <primary><option>isip6</option> expansion condition</primary>
16929 </indexterm>
16930 The substring is first expanded, and then tested to see if it has the form of
16931 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16932 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16933 </para>
16934 <para>
16935 For an IPv4 address, the test is for four dot-separated components, each of
16936 which consists of from one to three digits. For an IPv6 address, up to eight
16937 colon-separated components are permitted, each containing from one to four
16938 hexadecimal digits. There may be fewer than eight components if an empty
16939 component (adjacent colons) is present. Only one empty component is permitted.
16940 </para>
16941 <para>
16942 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
16943 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
16944 check.
16945 This is no longer the case.
16946 </para>
16947 <para>
16948 The main use of these tests is to distinguish between IP addresses and
16949 host names, or between IPv4 and IPv6 addresses. For example, you could use
16950 </para>
16951 <literallayout class="monospaced">
16952 ${if isip4{$sender_host_address}...
16953 </literallayout>
16954 <para>
16955 to test which IP version an incoming SMTP connection is using.
16956 </para>
16957 </listitem></varlistentry>
16958 <varlistentry>
16959 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16960 <listitem>
16961 <para>
16962 <indexterm role="concept">
16963 <primary>LDAP</primary>
16964 <secondary>use for authentication</secondary>
16965 </indexterm>
16966 <indexterm role="concept">
16967 <primary>expansion</primary>
16968 <secondary>LDAP authentication test</secondary>
16969 </indexterm>
16970 <indexterm role="concept">
16971 <primary><option>ldapauth</option> expansion condition</primary>
16972 </indexterm>
16973 This condition supports user authentication using LDAP. See section
16974 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16975 queries. For this use, the query must contain a user name and password. The
16976 query itself is not used, and can be empty. The condition is true if the
16977 password is not empty, and the user name and password are accepted by the LDAP
16978 server. An empty password is rejected without calling LDAP because LDAP binds
16979 with an empty password are considered anonymous regardless of the username, and
16980 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16981 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16982 this can be used.
16983 </para>
16984 </listitem></varlistentry>
16985 <varlistentry>
16986 <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>
16987 <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>
16988 <listitem>
16989 <para>
16990 <indexterm role="concept">
16991 <primary>string</primary>
16992 <secondary>comparison</secondary>
16993 </indexterm>
16994 <indexterm role="concept">
16995 <primary>expansion</primary>
16996 <secondary>string comparison</secondary>
16997 </indexterm>
16998 <indexterm role="concept">
16999 <primary><option>le</option> expansion condition</primary>
17000 </indexterm>
17001 <indexterm role="concept">
17002 <primary><option>lei</option> expansion condition</primary>
17003 </indexterm>
17004 The two substrings are first expanded. The condition is true if the first
17005 string is lexically less than or equal to the second string. For <option>le</option> the
17006 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
17007 case-independent.
17008 </para>
17009 </listitem></varlistentry>
17010 <varlistentry>
17011 <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>
17012 <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>
17013 <listitem>
17014 <para>
17015 <indexterm role="concept">
17016 <primary>string</primary>
17017 <secondary>comparison</secondary>
17018 </indexterm>
17019 <indexterm role="concept">
17020 <primary>expansion</primary>
17021 <secondary>string comparison</secondary>
17022 </indexterm>
17023 <indexterm role="concept">
17024 <primary><option>lt</option> expansion condition</primary>
17025 </indexterm>
17026 <indexterm role="concept">
17027 <primary><option>lti</option> expansion condition</primary>
17028 </indexterm>
17029 The two substrings are first expanded. The condition is true if the first
17030 string is lexically less than the second string. For <option>lt</option> the comparison
17031 includes the case of letters, whereas for <option>lti</option> the comparison is
17032 case-independent.
17033 </para>
17034 </listitem></varlistentry>
17035 <varlistentry>
17036 <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>
17037 <listitem>
17038 <para>
17039 <indexterm role="concept">
17040 <primary>expansion</primary>
17041 <secondary>regular expression comparison</secondary>
17042 </indexterm>
17043 <indexterm role="concept">
17044 <primary>regular expressions</primary>
17045 <secondary>match in expanded string</secondary>
17046 </indexterm>
17047 <indexterm role="concept">
17048 <primary><option>match</option> expansion condition</primary>
17049 </indexterm>
17050 The two substrings are first expanded. The second is then treated as a regular
17051 expression and applied to the first. Because of the pre-expansion, if the
17052 regular expression contains dollar, or backslash characters, they must be
17053 escaped. Care must also be taken if the regular expression contains braces
17054 (curly brackets). A closing brace must be escaped so that it is not taken as a
17055 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
17056 <literal>\N</literal> feature to disable expansion of the regular expression.
17057 For example,
17058 </para>
17059 <literallayout class="monospaced">
17060 ${if match {$local_part}{\N^\d{3}\N} ...
17061 </literallayout>
17062 <para>
17063 If the whole expansion string is in double quotes, further escaping of
17064 backslashes is also required.
17065 </para>
17066 <para>
17067 The condition is true if the regular expression match succeeds.
17068 The regular expression is not required to begin with a circumflex
17069 metacharacter, but if there is no circumflex, the expression is not anchored,
17070 and it may match anywhere in the subject, not just at the start. If you want
17071 the pattern to match at the end of the subject, you must include the <literal>$</literal>
17072 metacharacter at an appropriate point.
17073 </para>
17074 <para>
17075 <indexterm role="concept">
17076 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17077 <secondary>in <option>if</option> expansion</secondary>
17078 </indexterm>
17079 At the start of an <option>if</option> expansion the values of the numeric variable
17080 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
17081 succeeds causes them to be reset to the substrings of that condition and they
17082 will have these values during the expansion of the success string. At the end
17083 of the <option>if</option> expansion, the previous values are restored. After testing a
17084 combination of conditions using <option>or</option>, the subsequent values of the numeric
17085 variables are those of the condition that succeeded.
17086 </para>
17087 </listitem></varlistentry>
17088 <varlistentry>
17089 <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>
17090 <listitem>
17091 <para>
17092 <indexterm role="concept">
17093 <primary><option>match_address</option> expansion condition</primary>
17094 </indexterm>
17095 See <emphasis role="bold">match_local_part</emphasis>.
17096 </para>
17097 </listitem></varlistentry>
17098 <varlistentry>
17099 <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>
17100 <listitem>
17101 <para>
17102 <indexterm role="concept">
17103 <primary><option>match_domain</option> expansion condition</primary>
17104 </indexterm>
17105 See <emphasis role="bold">match_local_part</emphasis>.
17106 </para>
17107 </listitem></varlistentry>
17108 <varlistentry>
17109 <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>
17110 <listitem>
17111 <para>
17112 <indexterm role="concept">
17113 <primary><option>match_ip</option> expansion condition</primary>
17114 </indexterm>
17115 This condition matches an IP address to a list of IP address patterns. It must
17116 be followed by two argument strings. The first (after expansion) must be an IP
17117 address or an empty string. The second (not expanded) is a restricted host
17118 list that can match only an IP address, not a host name. For example:
17119 </para>
17120 <literallayout class="monospaced">
17121 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
17122 </literallayout>
17123 <para>
17124 The specific types of host list item that are permitted in the list are:
17125 </para>
17126 <itemizedlist>
17127 <listitem>
17128 <para>
17129 An IP address, optionally with a CIDR mask.
17130 </para>
17131 </listitem>
17132 <listitem>
17133 <para>
17134 A single asterisk, which matches any IP address.
17135 </para>
17136 </listitem>
17137 <listitem>
17138 <para>
17139 An empty item, which matches only if the IP address is empty. This could be
17140 useful for testing for a locally submitted message or one from specific hosts
17141 in a single test such as
17142 </para>
17143 <literallayout class="monospaced">
17144   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17145 </literallayout>
17146 <para>
17147 where the first item in the list is the empty string.
17148 </para>
17149 </listitem>
17150 <listitem>
17151 <para>
17152 The item @[] matches any of the local host&#x2019;s interface addresses.
17153 </para>
17154 </listitem>
17155 <listitem>
17156 <para>
17157 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17158 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17159 address into a host name. The most common type of linear search for
17160 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17161 masks. For example:
17162 </para>
17163 <literallayout class="monospaced">
17164   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17165 </literallayout>
17166 <para>
17167 It is of course possible to use other kinds of lookup, and in such a case, you
17168 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
17169 address mask, for example:
17170 </para>
17171 <literallayout class="monospaced">
17172   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
17173 </literallayout>
17174 <para>
17175 However, unless you are combining a <option>match_ip</option> condition with others, it is
17176 just as easy to use the fact that a lookup is itself a condition, and write:
17177 </para>
17178 <literallayout class="monospaced">
17179   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
17180 </literallayout>
17181 </listitem>
17182 </itemizedlist>
17183 <para>
17184 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17185 Exim was built with the EXPAND_LISTMATCH_RHS option.
17186 </para>
17187 <para>
17188 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
17189 </para>
17190 </listitem></varlistentry>
17191 <varlistentry>
17192 <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>
17193 <listitem>
17194 <para>
17195 <indexterm role="concept">
17196 <primary>domain list</primary>
17197 <secondary>in expansion condition</secondary>
17198 </indexterm>
17199 <indexterm role="concept">
17200 <primary>address list</primary>
17201 <secondary>in expansion condition</secondary>
17202 </indexterm>
17203 <indexterm role="concept">
17204 <primary>local part</primary>
17205 <secondary>list, in expansion condition</secondary>
17206 </indexterm>
17207 <indexterm role="concept">
17208 <primary><option>match_local_part</option> expansion condition</primary>
17209 </indexterm>
17210 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
17211 possible to test domain, address, and local part lists within expansions. Each
17212 condition requires two arguments: an item and a list to match. A trivial
17213 example is:
17214 </para>
17215 <literallayout class="monospaced">
17216 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
17217 </literallayout>
17218 <para>
17219 In each case, the second argument may contain any of the allowable items for a
17220 list of the appropriate type. Also, because the second argument
17221 is a standard form of list, it is possible to refer to a named list.
17222 Thus, you can use conditions like this:
17223 </para>
17224 <literallayout class="monospaced">
17225 ${if match_domain{$domain}{+local_domains}{...
17226 </literallayout>
17227 <para>
17228 <indexterm role="concept">
17229 <primary><literal>+caseful</literal></primary>
17230 </indexterm>
17231 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
17232 item can be used, as in all address lists, to cause subsequent items to
17233 have their local parts matched casefully. Domains are always matched
17234 caselessly.
17235 </para>
17236 <para>
17237 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17238 Exim was built with the EXPAND_LISTMATCH_RHS option.
17239 </para>
17240 <para>
17241 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
17242 hosts have two identities: a name and an IP address, and it is not clear
17243 how to specify cleanly how such a test would work. However, IP addresses can be
17244 matched using <option>match_ip</option>.
17245 </para>
17246 </listitem></varlistentry>
17247 <varlistentry>
17248 <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>
17249 <listitem>
17250 <para>
17251 <indexterm role="concept">
17252 <primary>PAM authentication</primary>
17253 </indexterm>
17254 <indexterm role="concept">
17255 <primary>AUTH</primary>
17256 <secondary>with PAM</secondary>
17257 </indexterm>
17258 <indexterm role="concept">
17259 <primary>Solaris</primary>
17260 <secondary>PAM support</secondary>
17261 </indexterm>
17262 <indexterm role="concept">
17263 <primary>expansion</primary>
17264 <secondary>PAM authentication test</secondary>
17265 </indexterm>
17266 <indexterm role="concept">
17267 <primary><option>pam</option> expansion condition</primary>
17268 </indexterm>
17269 <emphasis>Pluggable Authentication Modules</emphasis>
17270 (<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
17271 available in the latest releases of Solaris and in some GNU/Linux
17272 distributions. The Exim support, which is intended for use in conjunction with
17273 the SMTP AUTH command, is available only if Exim is compiled with
17274 </para>
17275 <literallayout class="monospaced">
17276 SUPPORT_PAM=yes
17277 </literallayout>
17278 <para>
17279 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
17280 in some releases of GNU/Linux <option>-ldl</option> is also needed.
17281 </para>
17282 <para>
17283 The argument string is first expanded, and the result must be a
17284 colon-separated list of strings. Leading and trailing white space is ignored.
17285 The PAM module is initialized with the service name <quote>exim</quote> and the user name
17286 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
17287 The remaining items in the data string are passed over in response to requests
17288 from the authentication function. In the simple case there will only be one
17289 request, for a password, so the data consists of just two strings.
17290 </para>
17291 <para>
17292 There can be problems if any of the strings are permitted to contain colon
17293 characters. In the usual way, these have to be doubled to avoid being taken as
17294 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
17295 item can be used to double any existing colons. For example, the configuration
17296 of a LOGIN authenticator might contain this setting:
17297 </para>
17298 <literallayout class="monospaced">
17299 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
17300 </literallayout>
17301 <para>
17302 For a PLAIN authenticator you could use:
17303 </para>
17304 <literallayout class="monospaced">
17305 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
17306 </literallayout>
17307 <para>
17308 In some operating systems, PAM authentication can be done only from a process
17309 running as root. Since Exim is running as the Exim user when receiving
17310 messages, this means that PAM cannot be used directly in those systems.
17311 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
17312 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>.
17313 The patched module allows one special uid/gid combination, in addition to root,
17314 to authenticate. If you build the patched module to allow the Exim user and
17315 group, PAM can then be used from an Exim authenticator.
17316 </para>
17317 </listitem></varlistentry>
17318 <varlistentry>
17319 <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>
17320 <listitem>
17321 <para>
17322 <indexterm role="concept">
17323 <primary><emphasis>pwcheck</emphasis> daemon</primary>
17324 </indexterm>
17325 <indexterm role="concept">
17326 <primary>Cyrus</primary>
17327 </indexterm>
17328 <indexterm role="concept">
17329 <primary>expansion</primary>
17330 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
17331 </indexterm>
17332 <indexterm role="concept">
17333 <primary><option>pwcheck</option> expansion condition</primary>
17334 </indexterm>
17335 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
17336 This is one way of making it possible for passwords to be checked by a process
17337 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
17338 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
17339 </para>
17340 <para>
17341 The pwcheck support is not included in Exim by default. You need to specify
17342 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17343 building Exim. For example:
17344 </para>
17345 <literallayout class="monospaced">
17346 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17347 </literallayout>
17348 <para>
17349 You do not need to install the full Cyrus software suite in order to use
17350 the pwcheck daemon. You can compile and install just the daemon alone
17351 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17352 access to the <filename>/var/pwcheck</filename> directory.
17353 </para>
17354 <para>
17355 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17356 password, separated by a colon. For example, in a LOGIN authenticator
17357 configuration, you might have this:
17358 </para>
17359 <literallayout class="monospaced">
17360 server_condition = ${if pwcheck{$auth1:$auth2}}
17361 </literallayout>
17362 <para>
17363 Again, for a PLAIN authenticator configuration, this would be:
17364 </para>
17365 <literallayout class="monospaced">
17366 server_condition = ${if pwcheck{$auth2:$auth3}}
17367 </literallayout>
17368 </listitem></varlistentry>
17369 <varlistentry>
17370 <term><emphasis role="bold">queue_running</emphasis></term>
17371 <listitem>
17372 <para>
17373 <indexterm role="concept">
17374 <primary>queue runner</primary>
17375 <secondary>detecting when delivering from</secondary>
17376 </indexterm>
17377 <indexterm role="concept">
17378 <primary>expansion</primary>
17379 <secondary>queue runner test</secondary>
17380 </indexterm>
17381 <indexterm role="concept">
17382 <primary><option>queue_running</option> expansion condition</primary>
17383 </indexterm>
17384 This condition, which has no data, is true during delivery attempts that are
17385 initiated by queue runner processes, and false otherwise.
17386 </para>
17387 </listitem></varlistentry>
17388 <varlistentry>
17389 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17390 <listitem>
17391 <para>
17392 <indexterm role="concept">
17393 <primary>Radius</primary>
17394 </indexterm>
17395 <indexterm role="concept">
17396 <primary>expansion</primary>
17397 <secondary>Radius authentication</secondary>
17398 </indexterm>
17399 <indexterm role="concept">
17400 <primary><option>radius</option> expansion condition</primary>
17401 </indexterm>
17402 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17403 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17404 the Radius client configuration file in order to build Exim with Radius
17405 support.
17406 </para>
17407 <para>
17408 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17409 library, using the original API. If you are using release 0.4.0 or later of
17410 this library, you need to set
17411 </para>
17412 <literallayout class="monospaced">
17413 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17414 </literallayout>
17415 <para>
17416 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17417 <option>libradius</option> library that comes with FreeBSD. To do this, set
17418 </para>
17419 <literallayout class="monospaced">
17420 RADIUS_LIB_TYPE=RADLIB
17421 </literallayout>
17422 <para>
17423 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17424 You may also have to supply a suitable setting in EXTRALIBS so that the
17425 Radius library can be found when Exim is linked.
17426 </para>
17427 <para>
17428 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17429 Radius client library, which calls the Radius server. The condition is true if
17430 the authentication is successful. For example:
17431 </para>
17432 <literallayout class="monospaced">
17433 server_condition = ${if radius{&lt;arguments&gt;}}
17434 </literallayout>
17435 </listitem></varlistentry>
17436 <varlistentry>
17437 <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>
17438 <listitem>
17439 <para>
17440 <indexterm role="concept">
17441 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17442 </indexterm>
17443 <indexterm role="concept">
17444 <primary>Cyrus</primary>
17445 </indexterm>
17446 <indexterm role="concept">
17447 <primary>expansion</primary>
17448 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17449 </indexterm>
17450 <indexterm role="concept">
17451 <primary><option>saslauthd</option> expansion condition</primary>
17452 </indexterm>
17453 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17454 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17455 Using this daemon is one way of making it possible for passwords to be checked
17456 by a process that is not running as root.
17457 </para>
17458 <para>
17459 The saslauthd support is not included in Exim by default. You need to specify
17460 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17461 building Exim. For example:
17462 </para>
17463 <literallayout class="monospaced">
17464 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17465 </literallayout>
17466 <para>
17467 You do not need to install the full Cyrus software suite in order to use
17468 the saslauthd daemon. You can compile and install just the daemon alone
17469 from the Cyrus SASL library.
17470 </para>
17471 <para>
17472 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17473 two are mandatory. For example:
17474 </para>
17475 <literallayout class="monospaced">
17476 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17477 </literallayout>
17478 <para>
17479 The service and the realm are optional (which is why the arguments are enclosed
17480 in their own set of braces). For details of the meaning of the service and
17481 realm, and how to run the daemon, consult the Cyrus documentation.
17482 </para>
17483 </listitem></varlistentry>
17484 </variablelist>
17485 </section>
17486 <section id="SECID84">
17487 <title>Combining expansion conditions</title>
17488 <para>
17489 <indexterm role="concept">
17490 <primary>expansion</primary>
17491 <secondary>combining conditions</secondary>
17492 </indexterm>
17493 Several conditions can be tested at once by combining them using the <option>and</option>
17494 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17495 conditions on their own, and precede their lists of sub-conditions. Each
17496 sub-condition must be enclosed in braces within the overall braces that contain
17497 the list. No repetition of <option>if</option> is used.
17498 </para>
17499 <variablelist>
17500 <varlistentry>
17501 <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>
17502 <listitem>
17503 <para>
17504 <indexterm role="concept">
17505 <primary><quote>or</quote> expansion condition</primary>
17506 </indexterm>
17507 <indexterm role="concept">
17508 <primary>expansion</primary>
17509 <secondary><quote>or</quote> of conditions</secondary>
17510 </indexterm>
17511 The sub-conditions are evaluated from left to right. The condition is true if
17512 any one of the sub-conditions is true.
17513 For example,
17514 </para>
17515 <literallayout class="monospaced">
17516 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17517 </literallayout>
17518 <para>
17519 When a true sub-condition is found, the following ones are parsed but not
17520 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17521 numeric variables afterwards are taken from the first one that succeeds.
17522 </para>
17523 </listitem></varlistentry>
17524 <varlistentry>
17525 <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>
17526 <listitem>
17527 <para>
17528 <indexterm role="concept">
17529 <primary><quote>and</quote> expansion condition</primary>
17530 </indexterm>
17531 <indexterm role="concept">
17532 <primary>expansion</primary>
17533 <secondary><quote>and</quote> of conditions</secondary>
17534 </indexterm>
17535 The sub-conditions are evaluated from left to right. The condition is true if
17536 all of the sub-conditions are true. If there are several <quote>match</quote>
17537 sub-conditions, the values of the numeric variables afterwards are taken from
17538 the last one. When a false sub-condition is found, the following ones are
17539 parsed but not evaluated.
17540 </para>
17541 </listitem></varlistentry>
17542 </variablelist>
17543 <para>
17544 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17545 </para>
17546 </section>
17547 <section id="SECTexpvar">
17548 <title>Expansion variables</title>
17549 <para>
17550 <indexterm role="concept">
17551 <primary>expansion</primary>
17552 <secondary>variables, list of</secondary>
17553 </indexterm>
17554 This section contains an alphabetical list of all the expansion variables. Some
17555 of them are available only when Exim is compiled with specific options such as
17556 support for TLS or the content scanning extension.
17557 </para>
17558 <variablelist>
17559 <varlistentry>
17560 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17561 <listitem>
17562 <para>
17563 <indexterm role="concept">
17564 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17565 </indexterm>
17566 When a <option>match</option> expansion condition succeeds, these variables contain the
17567 captured substrings identified by the regular expression during subsequent
17568 processing of the success string of the containing <option>if</option> expansion item.
17569 In the expansion condition case
17570 they do not retain their values afterwards; in fact, their previous
17571 values are restored at the end of processing an <option>if</option> item. The numerical
17572 variables may also be set externally by some other matching process which
17573 precedes the expansion of the string. For example, the commands available in
17574 Exim filter files include an <option>if</option> command with its own regular expression
17575 matching condition.
17576 </para>
17577 </listitem></varlistentry>
17578 <varlistentry>
17579 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17580 <listitem>
17581 <para>
17582 Within an acl condition, expansion condition or expansion item
17583 any arguments are copied to these variables,
17584 any unused variables being made empty.
17585 </para>
17586 </listitem></varlistentry>
17587 <varlistentry>
17588 <term><varname>$acl_c...</varname></term>
17589 <listitem>
17590 <para>
17591 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17592 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17593 long, but the sixth character must be either a digit or an underscore. For
17594 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17595 variables persist throughout the lifetime of an SMTP connection. They can be
17596 used to pass information between ACLs and between different invocations of the
17597 same ACL. When a message is received, the values of these variables are saved
17598 with the message, and can be accessed by filters, routers, and transports
17599 during subsequent delivery.
17600 </para>
17601 </listitem></varlistentry>
17602 <varlistentry>
17603 <term><varname>$acl_m...</varname></term>
17604 <listitem>
17605 <para>
17606 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17607 are reset after a message has been received. Thus, if several messages are
17608 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17609 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17610 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17611 message is received, the values of these variables are saved with the message,
17612 and can be accessed by filters, routers, and transports during subsequent
17613 delivery.
17614 </para>
17615 </listitem></varlistentry>
17616 <varlistentry>
17617 <term><varname>$acl_narg</varname></term>
17618 <listitem>
17619 <para>
17620 Within an acl condition, expansion condition or expansion item
17621 this variable has the number of arguments.
17622 </para>
17623 </listitem></varlistentry>
17624 <varlistentry>
17625 <term><varname>$acl_verify_message</varname></term>
17626 <listitem>
17627 <para>
17628 <indexterm role="variable">
17629 <primary><varname>$acl_verify_message</varname></primary>
17630 </indexterm>
17631 After an address verification has failed, this variable contains the failure
17632 message. It retains its value for use in subsequent modifiers. The message can
17633 be preserved by coding like this:
17634 </para>
17635 <literallayout class="monospaced">
17636 warn !verify = sender
17637      set acl_m0 = $acl_verify_message
17638 </literallayout>
17639 <para>
17640 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17641 <option>log_message</option> modifiers, to include information about the verification
17642 failure.
17643 </para>
17644 </listitem></varlistentry>
17645 <varlistentry>
17646 <term><varname>$address_data</varname></term>
17647 <listitem>
17648 <para>
17649 <indexterm role="variable">
17650 <primary><varname>$address_data</varname></primary>
17651 </indexterm>
17652 This variable is set by means of the <option>address_data</option> option in routers. The
17653 value then remains with the address while it is processed by subsequent routers
17654 and eventually a transport. If the transport is handling multiple addresses,
17655 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17656 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17657 user filter files.
17658 </para>
17659 <para>
17660 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17661 a recipient address, the final value is still in the variable for subsequent
17662 conditions and modifiers of the ACL statement. If routing the address caused it
17663 to be redirected to just one address, the child address is also routed as part
17664 of the verification, and in this case the final value of <varname>$address_data</varname> is
17665 from the child&#x2019;s routing.
17666 </para>
17667 <para>
17668 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17669 sender address, the final value is also preserved, but this time in
17670 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17671 address.
17672 </para>
17673 <para>
17674 In both cases (recipient and sender verification), the value does not persist
17675 after the end of the current ACL statement. If you want to preserve
17676 these values for longer, you can save them in ACL variables.
17677 </para>
17678 </listitem></varlistentry>
17679 <varlistentry>
17680 <term><varname>$address_file</varname></term>
17681 <listitem>
17682 <para>
17683 <indexterm role="variable">
17684 <primary><varname>$address_file</varname></primary>
17685 </indexterm>
17686 When, as a result of aliasing, forwarding, or filtering, a message is directed
17687 to a specific file, this variable holds the name of the file when the transport
17688 is running. At other times, the variable is empty. For example, using the
17689 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17690 </para>
17691 <literallayout class="monospaced">
17692 /home/r2d2/savemail
17693 </literallayout>
17694 <para>
17695 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17696 contains the text string <literal>/home/r2d2/savemail</literal>.
17697 <indexterm role="concept">
17698 <primary>Sieve filter</primary>
17699 <secondary>value of <varname>$address_file</varname></secondary>
17700 </indexterm>
17701 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17702 then up to the transport configuration to generate an appropriate absolute path
17703 to the relevant file.
17704 </para>
17705 </listitem></varlistentry>
17706 <varlistentry>
17707 <term><varname>$address_pipe</varname></term>
17708 <listitem>
17709 <para>
17710 <indexterm role="variable">
17711 <primary><varname>$address_pipe</varname></primary>
17712 </indexterm>
17713 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17714 this variable holds the pipe command when the transport is running.
17715 </para>
17716 </listitem></varlistentry>
17717 <varlistentry>
17718 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17719 <listitem>
17720 <para>
17721 <indexterm role="variable">
17722 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17723 </indexterm>
17724 These variables are used in SMTP authenticators (see chapters
17725 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
17726 </para>
17727 </listitem></varlistentry>
17728 <varlistentry>
17729 <term><varname>$authenticated_id</varname></term>
17730 <listitem>
17731 <para>
17732 <indexterm role="concept">
17733 <primary>authentication</primary>
17734 <secondary>id</secondary>
17735 </indexterm>
17736 <indexterm role="variable">
17737 <primary><varname>$authenticated_id</varname></primary>
17738 </indexterm>
17739 When a server successfully authenticates a client it may be configured to
17740 preserve some of the authentication information in the variable
17741 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17742 user/password authenticator configuration might preserve the user name for use
17743 in the routers. Note that this is not the same information that is saved in
17744 <varname>$sender_host_authenticated</varname>.
17745 </para>
17746 <para>
17747 When a message is submitted locally (that is, not over a TCP connection)
17748 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17749 process. However, a trusted user can override this by means of the <option>-oMai</option>
17750 command line option.
17751 </para>
17752 <para revisionflag="changed">
17753 This second case also sets up inforamtion used by the
17754 <varname>$authresults</varname> expansion item.
17755 </para>
17756 </listitem></varlistentry>
17757 <varlistentry>
17758 <term><varname>$authenticated_fail_id</varname></term>
17759 <listitem>
17760 <para>
17761 <indexterm role="concept">
17762 <primary>authentication</primary>
17763 <secondary>fail</secondary>
17764 </indexterm>
17765 <indexterm role="variable">
17766 <primary><varname>$authenticated_fail_id</varname></primary>
17767 </indexterm>
17768 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17769 will contain the failed authentication id. If more than one authentication
17770 id is attempted, it will contain only the last one. The variable is
17771 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17772 A message to a local recipient could still be accepted without requiring
17773 authentication, which means this variable could also be visible in all of
17774 the ACL&#x2019;s as well.
17775 </para>
17776 </listitem></varlistentry>
17777 <varlistentry>
17778 <term><varname>$authenticated_sender</varname></term>
17779 <listitem>
17780 <para>
17781 <indexterm role="concept">
17782 <primary>sender</primary>
17783 <secondary>authenticated</secondary>
17784 </indexterm>
17785 <indexterm role="concept">
17786 <primary>authentication</primary>
17787 <secondary>sender</secondary>
17788 </indexterm>
17789 <indexterm role="concept">
17790 <primary>AUTH</primary>
17791 <secondary>on MAIL command</secondary>
17792 </indexterm>
17793 <indexterm role="variable">
17794 <primary><varname>$authenticated_sender</varname></primary>
17795 </indexterm>
17796 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17797 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17798 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17799 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17800 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17801 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17802 </para>
17803 <para>
17804 <indexterm role="variable">
17805 <primary><varname>$qualify_domain</varname></primary>
17806 </indexterm>
17807 When a message is submitted locally (that is, not over a TCP connection), the
17808 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17809 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17810 can override this by means of the <option>-oMas</option> command line option.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$authentication_failed</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="concept">
17818 <primary>authentication</primary>
17819 <secondary>failure</secondary>
17820 </indexterm>
17821 <indexterm role="variable">
17822 <primary><varname>$authentication_failed</varname></primary>
17823 </indexterm>
17824 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17825 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17826 possible to distinguish between <quote>did not try to authenticate</quote>
17827 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17828 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17829 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17830 negative response to an AUTH command, including (for example) an attempt to use
17831 an undefined mechanism.
17832 </para>
17833 </listitem></varlistentry>
17834 <varlistentry>
17835 <term><varname>$av_failed</varname></term>
17836 <listitem>
17837 <para>
17838 <indexterm role="concept">
17839 <primary>content scanning</primary>
17840 <secondary>AV scanner failure</secondary>
17841 </indexterm>
17842 This variable is available when Exim is compiled with the content-scanning
17843 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17844 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17845 the ACL malware condition.
17846 </para>
17847 </listitem></varlistentry>
17848 <varlistentry>
17849 <term><varname>$body_linecount</varname></term>
17850 <listitem>
17851 <para>
17852 <indexterm role="concept">
17853 <primary>message body</primary>
17854 <secondary>line count</secondary>
17855 </indexterm>
17856 <indexterm role="concept">
17857 <primary>body of message</primary>
17858 <secondary>line count</secondary>
17859 </indexterm>
17860 <indexterm role="variable">
17861 <primary><varname>$body_linecount</varname></primary>
17862 </indexterm>
17863 When a message is being received or delivered, this variable contains the
17864 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17865 </para>
17866 </listitem></varlistentry>
17867 <varlistentry>
17868 <term><varname>$body_zerocount</varname></term>
17869 <listitem>
17870 <para>
17871 <indexterm role="concept">
17872 <primary>message body</primary>
17873 <secondary>binary zero count</secondary>
17874 </indexterm>
17875 <indexterm role="concept">
17876 <primary>body of message</primary>
17877 <secondary>binary zero count</secondary>
17878 </indexterm>
17879 <indexterm role="concept">
17880 <primary>binary zero</primary>
17881 <secondary>in message body</secondary>
17882 </indexterm>
17883 <indexterm role="variable">
17884 <primary><varname>$body_zerocount</varname></primary>
17885 </indexterm>
17886 When a message is being received or delivered, this variable contains the
17887 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17888 </para>
17889 </listitem></varlistentry>
17890 <varlistentry>
17891 <term><varname>$bounce_recipient</varname></term>
17892 <listitem>
17893 <para>
17894 <indexterm role="variable">
17895 <primary><varname>$bounce_recipient</varname></primary>
17896 </indexterm>
17897 This is set to the recipient address of a bounce message while Exim is creating
17898 it. It is useful if a customized bounce message text file is in use (see
17899 chapter <xref linkend="CHAPemsgcust"/>).
17900 </para>
17901 </listitem></varlistentry>
17902 <varlistentry>
17903 <term><varname>$bounce_return_size_limit</varname></term>
17904 <listitem>
17905 <para>
17906 <indexterm role="variable">
17907 <primary><varname>$bounce_return_size_limit</varname></primary>
17908 </indexterm>
17909 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17910 up to a multiple of 1000. It is useful when a customized error message text
17911 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17912 </para>
17913 </listitem></varlistentry>
17914 <varlistentry>
17915 <term><varname>$caller_gid</varname></term>
17916 <listitem>
17917 <para>
17918 <indexterm role="concept">
17919 <primary>gid (group id)</primary>
17920 <secondary>caller</secondary>
17921 </indexterm>
17922 <indexterm role="variable">
17923 <primary><varname>$caller_gid</varname></primary>
17924 </indexterm>
17925 The real group id under which the process that called Exim was running. This is
17926 not the same as the group id of the originator of a message (see
17927 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17928 incarnation normally contains the Exim gid.
17929 </para>
17930 </listitem></varlistentry>
17931 <varlistentry>
17932 <term><varname>$caller_uid</varname></term>
17933 <listitem>
17934 <para>
17935 <indexterm role="concept">
17936 <primary>uid (user id)</primary>
17937 <secondary>caller</secondary>
17938 </indexterm>
17939 <indexterm role="variable">
17940 <primary><varname>$caller_uid</varname></primary>
17941 </indexterm>
17942 The real user id under which the process that called Exim was running. This is
17943 not the same as the user id of the originator of a message (see
17944 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17945 incarnation normally contains the Exim uid.
17946 </para>
17947 </listitem></varlistentry>
17948 <varlistentry>
17949 <term><varname>$callout_address</varname></term>
17950 <listitem>
17951 <para>
17952 <indexterm role="variable">
17953 <primary><varname>$callout_address</varname></primary>
17954 </indexterm>
17955 After a callout for verification, spamd or malware daemon service, the
17956 address that was connected to.
17957 </para>
17958 </listitem></varlistentry>
17959 <varlistentry>
17960 <term><varname>$compile_number</varname></term>
17961 <listitem>
17962 <para>
17963 <indexterm role="variable">
17964 <primary><varname>$compile_number</varname></primary>
17965 </indexterm>
17966 The building process for Exim keeps a count of the number
17967 of times it has been compiled. This serves to distinguish different
17968 compilations of the same version of the program.
17969 </para>
17970 </listitem></varlistentry>
17971 <varlistentry>
17972 <term><varname>$config_dir</varname></term>
17973 <listitem>
17974 <para>
17975 <indexterm role="variable">
17976 <primary><varname>$config_dir</varname></primary>
17977 </indexterm>
17978 The directory name of the main configuration file. That is, the content of
17979 <varname>$config_file</varname> with the last component stripped. The value does not
17980 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17981 <varname>$config_dir</varname> is ".".
17982 </para>
17983 </listitem></varlistentry>
17984 <varlistentry>
17985 <term><varname>$config_file</varname></term>
17986 <listitem>
17987 <para>
17988 <indexterm role="variable">
17989 <primary><varname>$config_file</varname></primary>
17990 </indexterm>
17991 The name of the main configuration file Exim is using.
17992 </para>
17993 </listitem></varlistentry>
17994 <varlistentry>
17995 <term><varname>$dkim_verify_status</varname></term>
17996 <listitem>
17997 <para>
17998 Results of DKIM verification.
17999 For details see section <xref linkend="SECDKIMVFY"/>.
18000 </para>
18001 </listitem></varlistentry>
18002 <varlistentry>
18003 <term><varname>$dkim_cur_signer</varname></term>
18004 <term><varname>$dkim_verify_reason</varname></term>
18005 <term><varname>$dkim_domain</varname></term>
18006 <term><varname>$dkim_identity</varname></term>
18007 <term><varname>$dkim_selector</varname></term>
18008 <term><varname>$dkim_algo</varname></term>
18009 <term><varname>$dkim_canon_body</varname></term>
18010 <term><varname>$dkim_canon_headers</varname></term>
18011 <term><varname>$dkim_copiedheaders</varname></term>
18012 <term><varname>$dkim_bodylength</varname></term>
18013 <term><varname>$dkim_created</varname></term>
18014 <term><varname>$dkim_expires</varname></term>
18015 <term><varname>$dkim_headernames</varname></term>
18016 <term><varname>$dkim_key_testing</varname></term>
18017 <term><varname>$dkim_key_nosubdomains</varname></term>
18018 <term><varname>$dkim_key_srvtype</varname></term>
18019 <term><varname>$dkim_key_granularity</varname></term>
18020 <term><varname>$dkim_key_notes</varname></term>
18021 <term><varname>$dkim_key_length</varname></term>
18022 <listitem>
18023 <para>
18024 These variables are only available within the DKIM ACL.
18025 For details see section <xref linkend="SECDKIMVFY"/>.
18026 </para>
18027 </listitem></varlistentry>
18028 <varlistentry>
18029 <term><varname>$dkim_signers</varname></term>
18030 <listitem>
18031 <para>
18032 <indexterm role="variable">
18033 <primary><varname>$dkim_signers</varname></primary>
18034 </indexterm>
18035 When a message has been received this variable contains
18036 a colon-separated list of signer domains and identities for the message.
18037 For details see section <xref linkend="SECDKIMVFY"/>.
18038 </para>
18039 </listitem></varlistentry>
18040 <varlistentry>
18041 <term><varname>$dnslist_domain</varname></term>
18042 <term><varname>$dnslist_matched</varname></term>
18043 <term><varname>$dnslist_text</varname></term>
18044 <term><varname>$dnslist_value</varname></term>
18045 <listitem>
18046 <para>
18047 <indexterm role="variable">
18048 <primary><varname>$dnslist_domain</varname></primary>
18049 </indexterm>
18050 <indexterm role="variable">
18051 <primary><varname>$dnslist_matched</varname></primary>
18052 </indexterm>
18053 <indexterm role="variable">
18054 <primary><varname>$dnslist_text</varname></primary>
18055 </indexterm>
18056 <indexterm role="variable">
18057 <primary><varname>$dnslist_value</varname></primary>
18058 </indexterm>
18059 <indexterm role="concept">
18060 <primary>black list (DNS)</primary>
18061 </indexterm>
18062 When a DNS (black) list lookup succeeds, these variables are set to contain
18063 the following data from the lookup: the list&#x2019;s domain name, the key that was
18064 looked up, the contents of any associated TXT record, and the value from the
18065 main A record. See section <xref linkend="SECID204"/> for more details.
18066 </para>
18067 </listitem></varlistentry>
18068 <varlistentry>
18069 <term><varname>$domain</varname></term>
18070 <listitem>
18071 <para>
18072 <indexterm role="variable">
18073 <primary><varname>$domain</varname></primary>
18074 </indexterm>
18075 When an address is being routed, or delivered on its own, this variable
18076 contains the domain. Uppercase letters in the domain are converted into lower
18077 case for <varname>$domain</varname>.
18078 </para>
18079 <para>
18080 Global address rewriting happens when a message is received, so the value of
18081 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
18082 is set during user filtering, but not during system filtering, because a
18083 message may have many recipients and the system filter is called just once.
18084 </para>
18085 <para>
18086 When more than one address is being delivered at once (for example, several
18087 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
18088 have the same domain. Transports can be restricted to handling only one domain
18089 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
18090 the default for local transports. For further details of the environment in
18091 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
18092 </para>
18093 <para>
18094 <indexterm role="option">
18095 <primary><option>delay_warning_condition</option></primary>
18096 </indexterm>
18097 At the end of a delivery, if all deferred addresses have the same domain, it is
18098 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
18099 </para>
18100 <para>
18101 The <varname>$domain</varname> variable is also used in some other circumstances:
18102 </para>
18103 <itemizedlist>
18104 <listitem>
18105 <para>
18106 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
18107 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
18108 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
18109 normally set during the running of the MAIL ACL. However, if the sender address
18110 is verified with a callout during the MAIL ACL, the sender domain is placed in
18111 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
18112 the <command>smtp</command> transport.
18113 </para>
18114 </listitem>
18115 <listitem>
18116 <para>
18117 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18118 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
18119 it can be used in the expansion of the replacement address, for example, to
18120 rewrite domains by file lookup.
18121 </para>
18122 </listitem>
18123 <listitem>
18124 <para>
18125 With one important exception, whenever a domain list is being scanned,
18126 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
18127 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
18128 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
18129 that, in a RCPT ACL, the sender domain list can be dependent on the
18130 recipient domain (which is what is in <varname>$domain</varname> at this time).
18131 </para>
18132 </listitem>
18133 <listitem>
18134 <para>
18135 <indexterm role="concept">
18136 <primary>ETRN</primary>
18137 <secondary>value of <varname>$domain</varname></secondary>
18138 </indexterm>
18139 <indexterm role="option">
18140 <primary><option>smtp_etrn_command</option></primary>
18141 </indexterm>
18142 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
18143 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
18144 </para>
18145 </listitem>
18146 </itemizedlist>
18147 </listitem></varlistentry>
18148 <varlistentry>
18149 <term><varname>$domain_data</varname></term>
18150 <listitem>
18151 <para>
18152 <indexterm role="variable">
18153 <primary><varname>$domain_data</varname></primary>
18154 </indexterm>
18155 When the <option>domains</option> option on a router matches a domain by
18156 means of a lookup, the data read by the lookup is available during the running
18157 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
18158 address to a transport, the value is available in that transport. If the
18159 transport is handling multiple addresses, the value from the first address is
18160 used.
18161 </para>
18162 <para>
18163 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
18164 domain by means of a lookup. The data read by the lookup is available during
18165 the rest of the ACL statement. In all other situations, this variable expands
18166 to nothing.
18167 </para>
18168 </listitem></varlistentry>
18169 <varlistentry>
18170 <term><varname>$exim_gid</varname></term>
18171 <listitem>
18172 <para>
18173 <indexterm role="variable">
18174 <primary><varname>$exim_gid</varname></primary>
18175 </indexterm>
18176 This variable contains the numerical value of the Exim group id.
18177 </para>
18178 </listitem></varlistentry>
18179 <varlistentry>
18180 <term><varname>$exim_path</varname></term>
18181 <listitem>
18182 <para>
18183 <indexterm role="variable">
18184 <primary><varname>$exim_path</varname></primary>
18185 </indexterm>
18186 This variable contains the path to the Exim binary.
18187 </para>
18188 </listitem></varlistentry>
18189 <varlistentry>
18190 <term><varname>$exim_uid</varname></term>
18191 <listitem>
18192 <para>
18193 <indexterm role="variable">
18194 <primary><varname>$exim_uid</varname></primary>
18195 </indexterm>
18196 This variable contains the numerical value of the Exim user id.
18197 </para>
18198 </listitem></varlistentry>
18199 <varlistentry>
18200 <term><varname>$exim_version</varname></term>
18201 <listitem>
18202 <para>
18203 <indexterm role="variable">
18204 <primary><varname>$exim_version</varname></primary>
18205 </indexterm>
18206 This variable contains the version string of the Exim build.
18207 The first character is a major version number, currently 4.
18208 Then after a dot, the next group of digits is a minor version number.
18209 There may be other characters following the minor version.
18210 </para>
18211 </listitem></varlistentry>
18212 <varlistentry>
18213 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
18214 <listitem>
18215 <para>
18216 This is not strictly an expansion variable. It is expansion syntax for
18217 inserting the message header line with the given name. Note that the name must
18218 be terminated by colon or white space, because it may contain a wide variety of
18219 characters. Note also that braces must <emphasis>not</emphasis> be used.
18220 </para>
18221 </listitem></varlistentry>
18222 <varlistentry>
18223 <term><varname>$headers_added</varname></term>
18224 <listitem>
18225 <para>
18226 <indexterm role="variable">
18227 <primary><varname>$headers_added</varname></primary>
18228 </indexterm>
18229 Within an ACL this variable contains the headers added so far by
18230 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
18231 The headers are a newline-separated list.
18232 </para>
18233 </listitem></varlistentry>
18234 <varlistentry>
18235 <term><varname>$home</varname></term>
18236 <listitem>
18237 <para>
18238 <indexterm role="variable">
18239 <primary><varname>$home</varname></primary>
18240 </indexterm>
18241 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
18242 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
18243 means it is set during the running of users&#x2019; filter files. A router may also
18244 explicitly set a home directory for use by a transport; this can be overridden
18245 by a setting on the transport itself.
18246 </para>
18247 <para>
18248 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
18249 of the environment variable HOME, which is subject to the
18250 <option>keep_environment</option> and <option>add_environment</option> main config options.
18251 </para>
18252 </listitem></varlistentry>
18253 <varlistentry>
18254 <term><varname>$host</varname></term>
18255 <listitem>
18256 <para>
18257 <indexterm role="variable">
18258 <primary><varname>$host</varname></primary>
18259 </indexterm>
18260 If a router assigns an address to a transport (any transport), and passes a
18261 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
18262 to run is the name of the first host on the list. Note that this applies both
18263 to local and remote transports.
18264 </para>
18265 <para>
18266 <indexterm role="concept">
18267 <primary>transport</primary>
18268 <secondary>filter</secondary>
18269 </indexterm>
18270 <indexterm role="concept">
18271 <primary>filter</primary>
18272 <secondary>transport filter</secondary>
18273 </indexterm>
18274 For the <command>smtp</command> transport, if there is more than one host, the value of
18275 <varname>$host</varname> changes as the transport works its way through the list. In
18276 particular, when the <command>smtp</command> transport is expanding its options for encryption
18277 using TLS, or for specifying a transport filter (see chapter
18278 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
18279 is connected.
18280 </para>
18281 <para>
18282 When used in the client part of an authenticator configuration (see chapter
18283 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
18284 client is connected.
18285 </para>
18286 </listitem></varlistentry>
18287 <varlistentry>
18288 <term><varname>$host_address</varname></term>
18289 <listitem>
18290 <para>
18291 <indexterm role="variable">
18292 <primary><varname>$host_address</varname></primary>
18293 </indexterm>
18294 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
18295 for a remote connection. It is also set to the IP address that is being checked
18296 when the <option>ignore_target_hosts</option> option is being processed.
18297 </para>
18298 </listitem></varlistentry>
18299 <varlistentry>
18300 <term><varname>$host_data</varname></term>
18301 <listitem>
18302 <para>
18303 <indexterm role="variable">
18304 <primary><varname>$host_data</varname></primary>
18305 </indexterm>
18306 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
18307 result of the lookup is made available in the <varname>$host_data</varname> variable. This
18308 allows you, for example, to do things like this:
18309 </para>
18310 <literallayout class="monospaced">
18311 deny  hosts = net-lsearch;/some/file
18312 message = $host_data
18313 </literallayout>
18314 </listitem></varlistentry>
18315 <varlistentry>
18316 <term><varname>$host_lookup_deferred</varname></term>
18317 <listitem>
18318 <para>
18319 <indexterm role="concept">
18320 <primary>host name</primary>
18321 <secondary>lookup, failure of</secondary>
18322 </indexterm>
18323 <indexterm role="variable">
18324 <primary><varname>$host_lookup_deferred</varname></primary>
18325 </indexterm>
18326 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18327 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18328 name from its IP address, and the attempt is not successful, one of these
18329 variables is set to <quote>1</quote>.
18330 </para>
18331 <itemizedlist>
18332 <listitem>
18333 <para>
18334 If the lookup receives a definite negative response (for example, a DNS lookup
18335 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18336 </para>
18337 </listitem>
18338 <listitem>
18339 <para>
18340 If there is any kind of problem during the lookup, such that Exim cannot
18341 tell whether or not the host name is defined (for example, a timeout for a DNS
18342 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18343 </para>
18344 </listitem>
18345 </itemizedlist>
18346 <para>
18347 Looking up a host&#x2019;s name from its IP address consists of more than just a
18348 single reverse lookup. Exim checks that a forward lookup of at least one of the
18349 names it receives from a reverse lookup yields the original IP address. If this
18350 is not the case, Exim does not accept the looked up name(s), and
18351 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18352 IP address (for example, the existence of a PTR record in the DNS) is not
18353 sufficient on its own for the success of a host name lookup. If the reverse
18354 lookup succeeds, but there is a lookup problem such as a timeout when checking
18355 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18356 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18357 </para>
18358 <para revisionflag="changed">
18359 <indexterm role="concept">
18360 <primary>authentication</primary>
18361 <secondary>expansion item</secondary>
18362 </indexterm>
18363 Performing these checks sets up information used by the
18364 <varname>$authresults</varname> expansion item.
18365 </para>
18366 </listitem></varlistentry>
18367 <varlistentry>
18368 <term><varname>$host_lookup_failed</varname></term>
18369 <listitem>
18370 <para>
18371 <indexterm role="variable">
18372 <primary><varname>$host_lookup_failed</varname></primary>
18373 </indexterm>
18374 See <varname>$host_lookup_deferred</varname>.
18375 </para>
18376 </listitem></varlistentry>
18377 <varlistentry>
18378 <term><varname>$host_port</varname></term>
18379 <listitem>
18380 <para>
18381 <indexterm role="variable">
18382 <primary><varname>$host_port</varname></primary>
18383 </indexterm>
18384 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18385 for an outbound connection.
18386 </para>
18387 </listitem></varlistentry>
18388 <varlistentry>
18389 <term><varname>$initial_cwd</varname></term>
18390 <listitem>
18391 <para>
18392 <indexterm role="variable">
18393 <primary><varname>$initial_cwd</varname></primary>
18394 </indexterm>
18395 This variable contains the full path name of the initial working
18396 directory of the current Exim process. This may differ from the current
18397 working directory, as Exim changes this to "/" during early startup, and
18398 to <varname>$spool_directory</varname> later.
18399 </para>
18400 </listitem></varlistentry>
18401 <varlistentry>
18402 <term><varname>$inode</varname></term>
18403 <listitem>
18404 <para>
18405 <indexterm role="variable">
18406 <primary><varname>$inode</varname></primary>
18407 </indexterm>
18408 The only time this variable is set is while expanding the <option>directory_file</option>
18409 option in the <command>appendfile</command> transport. The variable contains the inode number
18410 of the temporary file which is about to be renamed. It can be used to construct
18411 a unique name for the file.
18412 </para>
18413 </listitem></varlistentry>
18414 <varlistentry>
18415 <term><varname>$interface_address</varname></term>
18416 <listitem>
18417 <para>
18418 <indexterm role="variable">
18419 <primary><varname>$interface_address</varname></primary>
18420 </indexterm>
18421 This is an obsolete name for <varname>$received_ip_address</varname>.
18422 </para>
18423 </listitem></varlistentry>
18424 <varlistentry>
18425 <term><varname>$interface_port</varname></term>
18426 <listitem>
18427 <para>
18428 <indexterm role="variable">
18429 <primary><varname>$interface_port</varname></primary>
18430 </indexterm>
18431 This is an obsolete name for <varname>$received_port</varname>.
18432 </para>
18433 </listitem></varlistentry>
18434 <varlistentry>
18435 <term><varname>$item</varname></term>
18436 <listitem>
18437 <para>
18438 <indexterm role="variable">
18439 <primary><varname>$item</varname></primary>
18440 </indexterm>
18441 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18442 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18443 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18444 empty.
18445 </para>
18446 </listitem></varlistentry>
18447 <varlistentry>
18448 <term><varname>$ldap_dn</varname></term>
18449 <listitem>
18450 <para>
18451 <indexterm role="variable">
18452 <primary><varname>$ldap_dn</varname></primary>
18453 </indexterm>
18454 This variable, which is available only when Exim is compiled with LDAP support,
18455 contains the DN from the last entry in the most recently successful LDAP
18456 lookup.
18457 </para>
18458 </listitem></varlistentry>
18459 <varlistentry>
18460 <term><varname>$load_average</varname></term>
18461 <listitem>
18462 <para>
18463 <indexterm role="variable">
18464 <primary><varname>$load_average</varname></primary>
18465 </indexterm>
18466 This variable contains the system load average, multiplied by 1000 so that it
18467 is an integer. For example, if the load average is 0.21, the value of the
18468 variable is 210. The value is recomputed every time the variable is referenced.
18469 </para>
18470 </listitem></varlistentry>
18471 <varlistentry>
18472 <term><varname>$local_part</varname></term>
18473 <listitem>
18474 <para>
18475 <indexterm role="variable">
18476 <primary><varname>$local_part</varname></primary>
18477 </indexterm>
18478 When an address is being routed, or delivered on its own, this
18479 variable contains the local part. When a number of addresses are being
18480 delivered together (for example, multiple RCPT commands in an SMTP
18481 session), <varname>$local_part</varname> is not set.
18482 </para>
18483 <para>
18484 Global address rewriting happens when a message is received, so the value of
18485 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18486 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18487 because a message may have many recipients and the system filter is called just
18488 once.
18489 </para>
18490 <para>
18491 <indexterm role="variable">
18492 <primary><varname>$local_part_prefix</varname></primary>
18493 </indexterm>
18494 <indexterm role="variable">
18495 <primary><varname>$local_part_suffix</varname></primary>
18496 </indexterm>
18497 If a local part prefix or suffix has been recognized, it is not included in the
18498 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18499 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18500 <varname>$local_part_suffix</varname>, respectively.
18501 </para>
18502 <para>
18503 When a message is being delivered to a file, pipe, or autoreply transport as a
18504 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18505 the parent address, not to the file name or command (see <varname>$address_file</varname> and
18506 <varname>$address_pipe</varname>).
18507 </para>
18508 <para>
18509 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18510 local part of the recipient address.
18511 </para>
18512 <para>
18513 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18514 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18515 it can be used in the expansion of the replacement address, for example.
18516 </para>
18517 <para>
18518 In all cases, all quoting is removed from the local part. For example, for both
18519 the addresses
18520 </para>
18521 <literallayout class="monospaced">
18522 "abc:xyz"@test.example
18523 abc\:xyz@test.example
18524 </literallayout>
18525 <para>
18526 the value of <varname>$local_part</varname> is
18527 </para>
18528 <literallayout class="monospaced">
18529 abc:xyz
18530 </literallayout>
18531 <para>
18532 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18533 inside a quoting operator. For example, in a <command>redirect</command> router you could
18534 have:
18535 </para>
18536 <literallayout class="monospaced">
18537 data = ${quote_local_part:$local_part}@new.domain.example
18538 </literallayout>
18539 <para>
18540 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18541 to process local parts in a case-dependent manner in a router, you can set the
18542 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18543 </para>
18544 </listitem></varlistentry>
18545 <varlistentry>
18546 <term><varname>$local_part_data</varname></term>
18547 <listitem>
18548 <para>
18549 <indexterm role="variable">
18550 <primary><varname>$local_part_data</varname></primary>
18551 </indexterm>
18552 When the <option>local_parts</option> option on a router matches a local part by means of a
18553 lookup, the data read by the lookup is available during the running of the
18554 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18555 to a transport, the value is available in that transport. If the transport is
18556 handling multiple addresses, the value from the first address is used.
18557 </para>
18558 <para>
18559 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18560 matches a local part by means of a lookup. The data read by the lookup is
18561 available during the rest of the ACL statement. In all other situations, this
18562 variable expands to nothing.
18563 </para>
18564 </listitem></varlistentry>
18565 <varlistentry>
18566 <term><varname>$local_part_prefix</varname></term>
18567 <listitem>
18568 <para>
18569 <indexterm role="variable">
18570 <primary><varname>$local_part_prefix</varname></primary>
18571 </indexterm>
18572 When an address is being routed or delivered, and a
18573 specific prefix for the local part was recognized, it is available in this
18574 variable, having been removed from <varname>$local_part</varname>.
18575 </para>
18576 </listitem></varlistentry>
18577 <varlistentry>
18578 <term><varname>$local_part_suffix</varname></term>
18579 <listitem>
18580 <para>
18581 <indexterm role="variable">
18582 <primary><varname>$local_part_suffix</varname></primary>
18583 </indexterm>
18584 When an address is being routed or delivered, and a
18585 specific suffix for the local part was recognized, it is available in this
18586 variable, having been removed from <varname>$local_part</varname>.
18587 </para>
18588 </listitem></varlistentry>
18589 <varlistentry>
18590 <term><varname>$local_scan_data</varname></term>
18591 <listitem>
18592 <para>
18593 <indexterm role="variable">
18594 <primary><varname>$local_scan_data</varname></primary>
18595 </indexterm>
18596 This variable contains the text returned by the <function>local_scan()</function> function when
18597 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18598 </para>
18599 </listitem></varlistentry>
18600 <varlistentry>
18601 <term><varname>$local_user_gid</varname></term>
18602 <listitem>
18603 <para>
18604 <indexterm role="variable">
18605 <primary><varname>$local_user_gid</varname></primary>
18606 </indexterm>
18607 See <varname>$local_user_uid</varname>.
18608 </para>
18609 </listitem></varlistentry>
18610 <varlistentry>
18611 <term><varname>$local_user_uid</varname></term>
18612 <listitem>
18613 <para>
18614 <indexterm role="variable">
18615 <primary><varname>$local_user_uid</varname></primary>
18616 </indexterm>
18617 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18618 <option>check_local_user</option> router precondition succeeds. This means that their values
18619 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18620 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18621 router-specific expansions. At all other times, the values in these variables
18622 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18623 </para>
18624 </listitem></varlistentry>
18625 <varlistentry>
18626 <term><varname>$localhost_number</varname></term>
18627 <listitem>
18628 <para>
18629 <indexterm role="variable">
18630 <primary><varname>$localhost_number</varname></primary>
18631 </indexterm>
18632 This contains the expanded value of the
18633 <option>localhost_number</option> option. The expansion happens after the main options have
18634 been read.
18635 </para>
18636 </listitem></varlistentry>
18637 <varlistentry>
18638 <term><varname>$log_inodes</varname></term>
18639 <listitem>
18640 <para>
18641 <indexterm role="variable">
18642 <primary><varname>$log_inodes</varname></primary>
18643 </indexterm>
18644 The number of free inodes in the disk partition where Exim&#x2019;s
18645 log files are being written. The value is recalculated whenever the variable is
18646 referenced. If the relevant file system does not have the concept of inodes,
18647 the value of is -1. See also the <option>check_log_inodes</option> option.
18648 </para>
18649 </listitem></varlistentry>
18650 <varlistentry>
18651 <term><varname>$log_space</varname></term>
18652 <listitem>
18653 <para>
18654 <indexterm role="variable">
18655 <primary><varname>$log_space</varname></primary>
18656 </indexterm>
18657 The amount of free space (as a number of kilobytes) in the disk
18658 partition where Exim&#x2019;s log files are being written. The value is recalculated
18659 whenever the variable is referenced. If the operating system does not have the
18660 ability to find the amount of free space (only true for experimental systems),
18661 the space value is -1. See also the <option>check_log_space</option> option.
18662 </para>
18663 </listitem></varlistentry>
18664 <varlistentry>
18665 <term><varname>$lookup_dnssec_authenticated</varname></term>
18666 <listitem>
18667 <para>
18668 <indexterm role="variable">
18669 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18670 </indexterm>
18671 This variable is set after a DNS lookup done by
18672 a dnsdb lookup expansion, dnslookup router or smtp transport.
18673 <indexterm role="concept">
18674 <primary>DNS</primary>
18675 <secondary>DNSSEC</secondary>
18676 </indexterm>
18677 It will be empty if <command>DNSSEC</command> was not requested,
18678 <quote>no</quote> if the result was not labelled as authenticated data
18679 and <quote>yes</quote> if it was.
18680 Results that are labelled as authoritative answer that match
18681 the <option>dns_trust_aa</option> configuration variable count also
18682 as authenticated data.
18683 </para>
18684 </listitem></varlistentry>
18685 <varlistentry>
18686 <term><varname>$mailstore_basename</varname></term>
18687 <listitem>
18688 <para>
18689 <indexterm role="variable">
18690 <primary><varname>$mailstore_basename</varname></primary>
18691 </indexterm>
18692 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18693 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18694 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18695 contains the basename of the files that are being written, that is, the name
18696 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18697 variable is empty.
18698 </para>
18699 </listitem></varlistentry>
18700 <varlistentry>
18701 <term><varname>$malware_name</varname></term>
18702 <listitem>
18703 <para>
18704 <indexterm role="variable">
18705 <primary><varname>$malware_name</varname></primary>
18706 </indexterm>
18707 This variable is available when Exim is compiled with the
18708 content-scanning extension. It is set to the name of the virus that was found
18709 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18710 </para>
18711 </listitem></varlistentry>
18712 <varlistentry>
18713 <term><varname>$max_received_linelength</varname></term>
18714 <listitem>
18715 <para>
18716 <indexterm role="variable">
18717 <primary><varname>$max_received_linelength</varname></primary>
18718 </indexterm>
18719 <indexterm role="concept">
18720 <primary>maximum</primary>
18721 <secondary>line length</secondary>
18722 </indexterm>
18723 <indexterm role="concept">
18724 <primary>line length</primary>
18725 <secondary>maximum</secondary>
18726 </indexterm>
18727 This variable contains the number of bytes in the longest line that was
18728 received as part of the message, not counting the line termination
18729 character(s).
18730 It is not valid if the <option>spool_files_wireformat</option> option is used.
18731 </para>
18732 </listitem></varlistentry>
18733 <varlistentry>
18734 <term><varname>$message_age</varname></term>
18735 <listitem>
18736 <para>
18737 <indexterm role="concept">
18738 <primary>message</primary>
18739 <secondary>age of</secondary>
18740 </indexterm>
18741 <indexterm role="variable">
18742 <primary><varname>$message_age</varname></primary>
18743 </indexterm>
18744 This variable is set at the start of a delivery attempt to contain the number
18745 of seconds since the message was received. It does not change during a single
18746 delivery attempt.
18747 </para>
18748 </listitem></varlistentry>
18749 <varlistentry>
18750 <term><varname>$message_body</varname></term>
18751 <listitem>
18752 <para>
18753 <indexterm role="concept">
18754 <primary>body of message</primary>
18755 <secondary>expansion variable</secondary>
18756 </indexterm>
18757 <indexterm role="concept">
18758 <primary>message body</primary>
18759 <secondary>in expansion</secondary>
18760 </indexterm>
18761 <indexterm role="concept">
18762 <primary>binary zero</primary>
18763 <secondary>in message body</secondary>
18764 </indexterm>
18765 <indexterm role="variable">
18766 <primary><varname>$message_body</varname></primary>
18767 </indexterm>
18768 <indexterm role="option">
18769 <primary><option>message_body_visible</option></primary>
18770 </indexterm>
18771 This variable contains the initial portion of a message&#x2019;s body while it is
18772 being delivered, and is intended mainly for use in filter files. The maximum
18773 number of characters of the body that are put into the variable is set by the
18774 <option>message_body_visible</option> configuration option; the default is 500.
18775 </para>
18776 <para>
18777 <indexterm role="option">
18778 <primary><option>message_body_newlines</option></primary>
18779 </indexterm>
18780 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18781 easier to search for phrases that might be split over a line break. However,
18782 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18783 zeros are always converted into spaces.
18784 </para>
18785 </listitem></varlistentry>
18786 <varlistentry>
18787 <term><varname>$message_body_end</varname></term>
18788 <listitem>
18789 <para>
18790 <indexterm role="concept">
18791 <primary>body of message</primary>
18792 <secondary>expansion variable</secondary>
18793 </indexterm>
18794 <indexterm role="concept">
18795 <primary>message body</primary>
18796 <secondary>in expansion</secondary>
18797 </indexterm>
18798 <indexterm role="variable">
18799 <primary><varname>$message_body_end</varname></primary>
18800 </indexterm>
18801 This variable contains the final portion of a message&#x2019;s
18802 body while it is being delivered. The format and maximum size are as for
18803 <varname>$message_body</varname>.
18804 </para>
18805 </listitem></varlistentry>
18806 <varlistentry>
18807 <term><varname>$message_body_size</varname></term>
18808 <listitem>
18809 <para>
18810 <indexterm role="concept">
18811 <primary>body of message</primary>
18812 <secondary>size</secondary>
18813 </indexterm>
18814 <indexterm role="concept">
18815 <primary>message body</primary>
18816 <secondary>size</secondary>
18817 </indexterm>
18818 <indexterm role="variable">
18819 <primary><varname>$message_body_size</varname></primary>
18820 </indexterm>
18821 When a message is being delivered, this variable contains the size of the body
18822 in bytes. The count starts from the character after the blank line that
18823 separates the body from the header. Newlines are included in the count. See
18824 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18825 </para>
18826 <para>
18827 If the spool file is wireformat
18828 (see the <option>spool_files_wireformat</option> main option)
18829 the CRLF line-terminators are included in the count.
18830 </para>
18831 </listitem></varlistentry>
18832 <varlistentry>
18833 <term><varname>$message_exim_id</varname></term>
18834 <listitem>
18835 <para>
18836 <indexterm role="variable">
18837 <primary><varname>$message_exim_id</varname></primary>
18838 </indexterm>
18839 When a message is being received or delivered, this variable contains the
18840 unique message id that is generated and used by Exim to identify the message.
18841 An id is not created for a message until after its header has been successfully
18842 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18843 line; it is the local id that Exim assigns to the message, for example:
18844 <literal>1BXTIK-0001yO-VA</literal>.
18845 </para>
18846 </listitem></varlistentry>
18847 <varlistentry>
18848 <term><varname>$message_headers</varname></term>
18849 <listitem>
18850 <para>
18851 <indexterm role="variable">
18852 <primary><varname>$message_headers</varname></primary>
18853 </indexterm>
18854 This variable contains a concatenation of all the header lines when a message
18855 is being processed, except for lines added by routers or transports. The header
18856 lines are separated by newline characters. Their contents are decoded in the
18857 same way as a header line that is inserted by <option>bheader</option>.
18858 </para>
18859 </listitem></varlistentry>
18860 <varlistentry>
18861 <term><varname>$message_headers_raw</varname></term>
18862 <listitem>
18863 <para>
18864 <indexterm role="variable">
18865 <primary><varname>$message_headers_raw</varname></primary>
18866 </indexterm>
18867 This variable is like <varname>$message_headers</varname> except that no processing of the
18868 contents of header lines is done.
18869 </para>
18870 </listitem></varlistentry>
18871 <varlistentry>
18872 <term><varname>$message_id</varname></term>
18873 <listitem>
18874 <para>
18875 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18876 </para>
18877 </listitem></varlistentry>
18878 <varlistentry>
18879 <term><varname>$message_linecount</varname></term>
18880 <listitem>
18881 <para>
18882 <indexterm role="variable">
18883 <primary><varname>$message_linecount</varname></primary>
18884 </indexterm>
18885 This variable contains the total number of lines in the header and body of the
18886 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18887 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18888 number of lines received. Before delivery happens (that is, before filters,
18889 routers, and transports run) the count is increased to include the
18890 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18891 lines that are added by ACLs. The blank line that separates the message header
18892 from the body is not counted.
18893 </para>
18894 <para>
18895 As with the special case of <varname>$message_size</varname>, during the expansion of the
18896 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18897 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18898 file that has been written (minus one for the blank line between the
18899 header and the body).
18900 </para>
18901 <para>
18902 Here is an example of the use of this variable in a DATA ACL:
18903 </para>
18904 <literallayout class="monospaced">
18905 deny message   = Too many lines in message header
18906      condition = \
18907       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18908 </literallayout>
18909 <para>
18910 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18911 message has not yet been received.
18912 </para>
18913 <para>
18914 This variable is not valid if the <option>spool_files_wireformat</option> option is used.
18915 </para>
18916 </listitem></varlistentry>
18917 <varlistentry>
18918 <term><varname>$message_size</varname></term>
18919 <listitem>
18920 <para>
18921 <indexterm role="concept">
18922 <primary>size</primary>
18923 <secondary>of message</secondary>
18924 </indexterm>
18925 <indexterm role="concept">
18926 <primary>message</primary>
18927 <secondary>size</secondary>
18928 </indexterm>
18929 <indexterm role="variable">
18930 <primary><varname>$message_size</varname></primary>
18931 </indexterm>
18932 When a message is being processed, this variable contains its size in bytes. In
18933 most cases, the size includes those headers that were received with the
18934 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18935 deliveries as they are written. However, there is one special case: during the
18936 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18937 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18938 precise size of the file that has been written. See also
18939 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18940 </para>
18941 <para>
18942 <indexterm role="concept">
18943 <primary>RCPT</primary>
18944 <secondary>value of <varname>$message_size</varname></secondary>
18945 </indexterm>
18946 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18947 contains the size supplied on the MAIL command, or -1 if no size was given. The
18948 value may not, of course, be truthful.
18949 </para>
18950 </listitem></varlistentry>
18951 <varlistentry>
18952 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18953 <listitem>
18954 <para>
18955 A number of variables whose names start with <varname>$mime</varname> are
18956 available when Exim is compiled with the content-scanning extension. For
18957 details, see section <xref linkend="SECTscanmimepart"/>.
18958 </para>
18959 </listitem></varlistentry>
18960 <varlistentry>
18961 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18962 <listitem>
18963 <para>
18964 These variables are counters that can be incremented by means
18965 of the <option>add</option> command in filter files.
18966 </para>
18967 </listitem></varlistentry>
18968 <varlistentry>
18969 <term><varname>$original_domain</varname></term>
18970 <listitem>
18971 <para>
18972 <indexterm role="variable">
18973 <primary><varname>$domain</varname></primary>
18974 </indexterm>
18975 <indexterm role="variable">
18976 <primary><varname>$original_domain</varname></primary>
18977 </indexterm>
18978 When a top-level address is being processed for delivery, this contains the
18979 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18980 generated by an alias, forward, or filter file) is being processed, this
18981 variable contains the domain of the original address (lower cased). This
18982 differs from <varname>$parent_domain</varname> only when there is more than one level of
18983 aliasing or forwarding. When more than one address is being delivered in a
18984 single transport run, <varname>$original_domain</varname> is not set.
18985 </para>
18986 <para>
18987 If a new address is created by means of a <option>deliver</option> command in a system
18988 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18989 part <emphasis>system-filter</emphasis> and the default qualify domain.
18990 </para>
18991 </listitem></varlistentry>
18992 <varlistentry>
18993 <term><varname>$original_local_part</varname></term>
18994 <listitem>
18995 <para>
18996 <indexterm role="variable">
18997 <primary><varname>$local_part</varname></primary>
18998 </indexterm>
18999 <indexterm role="variable">
19000 <primary><varname>$original_local_part</varname></primary>
19001 </indexterm>
19002 When a top-level address is being processed for delivery, this contains the
19003 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
19004 local part, because <varname>$original_local_part</varname> always contains the full local
19005 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
19006 filter file) is being processed, this variable contains the full local part of
19007 the original address.
19008 </para>
19009 <para>
19010 If the router that did the redirection processed the local part
19011 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
19012 This variable differs from <varname>$parent_local_part</varname> only when there is more than
19013 one level of aliasing or forwarding. When more than one address is being
19014 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
19015 </para>
19016 <para>
19017 If a new address is created by means of a <option>deliver</option> command in a system
19018 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19019 part <emphasis>system-filter</emphasis> and the default qualify domain.
19020 </para>
19021 </listitem></varlistentry>
19022 <varlistentry>
19023 <term><varname>$originator_gid</varname></term>
19024 <listitem>
19025 <para>
19026 <indexterm role="concept">
19027 <primary>gid (group id)</primary>
19028 <secondary>of originating user</secondary>
19029 </indexterm>
19030 <indexterm role="concept">
19031 <primary>sender</primary>
19032 <secondary>gid</secondary>
19033 </indexterm>
19034 <indexterm role="variable">
19035 <primary><varname>$caller_gid</varname></primary>
19036 </indexterm>
19037 <indexterm role="variable">
19038 <primary><varname>$originator_gid</varname></primary>
19039 </indexterm>
19040 This variable contains the value of <varname>$caller_gid</varname> that was set when the
19041 message was received. For messages received via the command line, this is the
19042 gid of the sending user. For messages received by SMTP over TCP/IP, this is
19043 normally the gid of the Exim user.
19044 </para>
19045 </listitem></varlistentry>
19046 <varlistentry>
19047 <term><varname>$originator_uid</varname></term>
19048 <listitem>
19049 <para>
19050 <indexterm role="concept">
19051 <primary>uid (user id)</primary>
19052 <secondary>of originating user</secondary>
19053 </indexterm>
19054 <indexterm role="concept">
19055 <primary>sender</primary>
19056 <secondary>uid</secondary>
19057 </indexterm>
19058 <indexterm role="variable">
19059 <primary><varname>$caller_uid</varname></primary>
19060 </indexterm>
19061 <indexterm role="variable">
19062 <primary><varname>$originator_uid</varname></primary>
19063 </indexterm>
19064 The value of <varname>$caller_uid</varname> that was set when the message was received. For
19065 messages received via the command line, this is the uid of the sending user.
19066 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
19067 user.
19068 </para>
19069 </listitem></varlistentry>
19070 <varlistentry>
19071 <term><varname>$parent_domain</varname></term>
19072 <listitem>
19073 <para>
19074 <indexterm role="variable">
19075 <primary><varname>$parent_domain</varname></primary>
19076 </indexterm>
19077 This variable is similar to <varname>$original_domain</varname> (see
19078 above), except that it refers to the immediately preceding parent address.
19079 </para>
19080 </listitem></varlistentry>
19081 <varlistentry>
19082 <term><varname>$parent_local_part</varname></term>
19083 <listitem>
19084 <para>
19085 <indexterm role="variable">
19086 <primary><varname>$parent_local_part</varname></primary>
19087 </indexterm>
19088 This variable is similar to <varname>$original_local_part</varname>
19089 (see above), except that it refers to the immediately preceding parent address.
19090 </para>
19091 </listitem></varlistentry>
19092 <varlistentry>
19093 <term><varname>$pid</varname></term>
19094 <listitem>
19095 <para>
19096 <indexterm role="concept">
19097 <primary>pid (process id)</primary>
19098 <secondary>of current process</secondary>
19099 </indexterm>
19100 <indexterm role="variable">
19101 <primary><varname>$pid</varname></primary>
19102 </indexterm>
19103 This variable contains the current process id.
19104 </para>
19105 </listitem></varlistentry>
19106 <varlistentry>
19107 <term><varname>$pipe_addresses</varname></term>
19108 <listitem>
19109 <para>
19110 <indexterm role="concept">
19111 <primary>filter</primary>
19112 <secondary>transport filter</secondary>
19113 </indexterm>
19114 <indexterm role="concept">
19115 <primary>transport</primary>
19116 <secondary>filter</secondary>
19117 </indexterm>
19118 <indexterm role="variable">
19119 <primary><varname>$pipe_addresses</varname></primary>
19120 </indexterm>
19121 This is not an expansion variable, but is mentioned here because the string
19122 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
19123 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
19124 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
19125 It cannot be used in general expansion strings, and provokes an <quote>unknown
19126 variable</quote> error if encountered.
19127 </para>
19128 </listitem></varlistentry>
19129 <varlistentry>
19130 <term><varname>$primary_hostname</varname></term>
19131 <listitem>
19132 <para>
19133 <indexterm role="variable">
19134 <primary><varname>$primary_hostname</varname></primary>
19135 </indexterm>
19136 This variable contains the value set by <option>primary_hostname</option> in the
19137 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
19138 a single-component name, Exim calls <function>gethostbyname()</function> (or
19139 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
19140 qualified host name. See also <varname>$smtp_active_hostname</varname>.
19141 </para>
19142 </listitem></varlistentry>
19143 <varlistentry>
19144 <term><varname>$proxy_external_address</varname></term>
19145 <term><varname>$proxy_external_port</varname></term>
19146 <term><varname>$proxy_local_address</varname></term>
19147 <term><varname>$proxy_local_port</varname></term>
19148 <term><varname>$proxy_session</varname></term>
19149 <listitem>
19150 <para>
19151 These variables are only available when built with Proxy Protocol
19152 or SOCKS5 support.
19153 For details see chapter <xref linkend="SECTproxyInbound"/>.
19154 </para>
19155 </listitem></varlistentry>
19156 <varlistentry>
19157 <term><varname>$prdr_requested</varname></term>
19158 <listitem>
19159 <para>
19160 <indexterm role="concept">
19161 <primary>PRDR</primary>
19162 <secondary>variable for</secondary>
19163 </indexterm>
19164 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
19165 current message, otherwise <quote>no</quote>.
19166 </para>
19167 </listitem></varlistentry>
19168 <varlistentry>
19169 <term><varname>$prvscheck_address</varname></term>
19170 <listitem>
19171 <para>
19172 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19173 which is described in sections <xref linkend="SECTexpansionitems"/> and
19174 <xref linkend="SECTverifyPRVS"/>.
19175 </para>
19176 </listitem></varlistentry>
19177 <varlistentry>
19178 <term><varname>$prvscheck_keynum</varname></term>
19179 <listitem>
19180 <para>
19181 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19182 which is described in sections <xref linkend="SECTexpansionitems"/> and
19183 <xref linkend="SECTverifyPRVS"/>.
19184 </para>
19185 </listitem></varlistentry>
19186 <varlistentry>
19187 <term><varname>$prvscheck_result</varname></term>
19188 <listitem>
19189 <para>
19190 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19191 which is described in sections <xref linkend="SECTexpansionitems"/> and
19192 <xref linkend="SECTverifyPRVS"/>.
19193 </para>
19194 </listitem></varlistentry>
19195 <varlistentry>
19196 <term><varname>$qualify_domain</varname></term>
19197 <listitem>
19198 <para>
19199 <indexterm role="variable">
19200 <primary><varname>$qualify_domain</varname></primary>
19201 </indexterm>
19202 The value set for the <option>qualify_domain</option> option in the configuration file.
19203 </para>
19204 </listitem></varlistentry>
19205 <varlistentry>
19206 <term><varname>$qualify_recipient</varname></term>
19207 <listitem>
19208 <para>
19209 <indexterm role="variable">
19210 <primary><varname>$qualify_recipient</varname></primary>
19211 </indexterm>
19212 The value set for the <option>qualify_recipient</option> option in the configuration file,
19213 or if not set, the value of <varname>$qualify_domain</varname>.
19214 </para>
19215 </listitem></varlistentry>
19216 <varlistentry>
19217 <term><varname>$queue_name</varname></term>
19218 <listitem>
19219 <para>
19220 <indexterm role="variable">
19221 <primary><varname>$queue_name</varname></primary>
19222 </indexterm>
19223 <indexterm role="concept">
19224 <primary>named queues</primary>
19225 </indexterm>
19226 <indexterm role="concept">
19227 <primary>queues</primary>
19228 <secondary>named</secondary>
19229 </indexterm>
19230 The name of the spool queue in use; empty for the default queue.
19231 </para>
19232 </listitem></varlistentry>
19233 <varlistentry>
19234 <term><varname>$rcpt_count</varname></term>
19235 <listitem>
19236 <para>
19237 <indexterm role="variable">
19238 <primary><varname>$rcpt_count</varname></primary>
19239 </indexterm>
19240 When a message is being received by SMTP, this variable contains the number of
19241 RCPT commands received for the current message. If this variable is used in a
19242 RCPT ACL, its value includes the current command.
19243 </para>
19244 </listitem></varlistentry>
19245 <varlistentry>
19246 <term><varname>$rcpt_defer_count</varname></term>
19247 <listitem>
19248 <para>
19249 <indexterm role="variable">
19250 <primary><varname>$rcpt_defer_count</varname></primary>
19251 </indexterm>
19252 <indexterm role="concept">
19253 <primary>4<emphasis>xx</emphasis> responses</primary>
19254 <secondary>count of</secondary>
19255 </indexterm>
19256 When a message is being received by SMTP, this variable contains the number of
19257 RCPT commands in the current message that have previously been rejected with a
19258 temporary (4<emphasis>xx</emphasis>) response.
19259 </para>
19260 </listitem></varlistentry>
19261 <varlistentry>
19262 <term><varname>$rcpt_fail_count</varname></term>
19263 <listitem>
19264 <para>
19265 <indexterm role="variable">
19266 <primary><varname>$rcpt_fail_count</varname></primary>
19267 </indexterm>
19268 When a message is being received by SMTP, this variable contains the number of
19269 RCPT commands in the current message that have previously been rejected with a
19270 permanent (5<emphasis>xx</emphasis>) response.
19271 </para>
19272 </listitem></varlistentry>
19273 <varlistentry>
19274 <term><varname>$received_count</varname></term>
19275 <listitem>
19276 <para>
19277 <indexterm role="variable">
19278 <primary><varname>$received_count</varname></primary>
19279 </indexterm>
19280 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
19281 including the one added by Exim (so its value is always greater than zero). It
19282 is available in the DATA ACL, the non-SMTP ACL, and while routing and
19283 delivering.
19284 </para>
19285 </listitem></varlistentry>
19286 <varlistentry>
19287 <term><varname>$received_for</varname></term>
19288 <listitem>
19289 <para>
19290 <indexterm role="variable">
19291 <primary><varname>$received_for</varname></primary>
19292 </indexterm>
19293 If there is only a single recipient address in an incoming message, this
19294 variable contains that address when the <emphasis>Received:</emphasis> header line is being
19295 built. The value is copied after recipient rewriting has happened, but before
19296 the <function>local_scan()</function> function is run.
19297 </para>
19298 </listitem></varlistentry>
19299 <varlistentry>
19300 <term><varname>$received_ip_address</varname></term>
19301 <listitem>
19302 <para>
19303 <indexterm role="variable">
19304 <primary><varname>$received_ip_address</varname></primary>
19305 </indexterm>
19306 As soon as an Exim server starts processing an incoming TCP/IP connection, this
19307 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
19308 is set to the local port number. (The remote IP address and port are in
19309 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
19310 the port value is -1 unless it has been set using the <option>-oMi</option> command line
19311 option.
19312 </para>
19313 <para>
19314 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
19315 could be used, for example, to make the file name for a TLS certificate depend
19316 on which interface and/or port is being used for the incoming connection. The
19317 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
19318 messages that are received, thus making these variables available at delivery
19319 time.
19320 For outbound connections see <varname>$sending_ip_address</varname>.
19321 </para>
19322 </listitem></varlistentry>
19323 <varlistentry>
19324 <term><varname>$received_port</varname></term>
19325 <listitem>
19326 <para>
19327 <indexterm role="variable">
19328 <primary><varname>$received_port</varname></primary>
19329 </indexterm>
19330 See <varname>$received_ip_address</varname>.
19331 </para>
19332 </listitem></varlistentry>
19333 <varlistentry>
19334 <term><varname>$received_protocol</varname></term>
19335 <listitem>
19336 <para>
19337 <indexterm role="variable">
19338 <primary><varname>$received_protocol</varname></primary>
19339 </indexterm>
19340 When a message is being processed, this variable contains the name of the
19341 protocol by which it was received. Most of the names used by Exim are defined
19342 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
19343 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
19344 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
19345 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
19346 connection and the client was successfully authenticated.
19347 </para>
19348 <para>
19349 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
19350 automatically set up on connection without the use of STARTTLS (see
19351 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
19352 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
19353 where the client initially uses EHLO, sets up an encrypted connection using
19354 STARTTLS, and then uses HELO afterwards.
19355 </para>
19356 <para>
19357 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19358 messages that are injected locally by trusted callers. This is commonly used to
19359 identify messages that are being re-injected after some kind of scanning.
19360 </para>
19361 </listitem></varlistentry>
19362 <varlistentry>
19363 <term><varname>$received_time</varname></term>
19364 <listitem>
19365 <para>
19366 <indexterm role="variable">
19367 <primary><varname>$received_time</varname></primary>
19368 </indexterm>
19369 This variable contains the date and time when the current message was received,
19370 as a number of seconds since the start of the Unix epoch.
19371 </para>
19372 </listitem></varlistentry>
19373 <varlistentry>
19374 <term><varname>$recipient_data</varname></term>
19375 <listitem>
19376 <para>
19377 <indexterm role="variable">
19378 <primary><varname>$recipient_data</varname></primary>
19379 </indexterm>
19380 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19381 condition. It contains the data from the lookup, and the value remains set
19382 until the next <option>recipients</option> test. Thus, you can do things like this:
19383 </para>
19384 <literallayout>
19385 <literal>require recipients  = cdb*@;/some/file</literal>
19386 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19387 </literallayout>
19388 <para>
19389 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19390 method in the address list, using the semicolon syntax as in the example above.
19391 The variable is not set for a lookup that is used as part of the string
19392 expansion that all such lists undergo before being interpreted.
19393 </para>
19394 </listitem></varlistentry>
19395 <varlistentry>
19396 <term><varname>$recipient_verify_failure</varname></term>
19397 <listitem>
19398 <para>
19399 <indexterm role="variable">
19400 <primary><varname>$recipient_verify_failure</varname></primary>
19401 </indexterm>
19402 In an ACL, when a recipient verification fails, this variable contains
19403 information about the failure. It is set to one of the following words:
19404 </para>
19405 <itemizedlist>
19406 <listitem>
19407 <para>
19408 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19409 was neither local nor came from an exempted host.
19410 </para>
19411 </listitem>
19412 <listitem>
19413 <para>
19414 <quote>route</quote>: Routing failed.
19415 </para>
19416 </listitem>
19417 <listitem>
19418 <para>
19419 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19420 or before the MAIL command (that is, on initial connection, HELO, or
19421 MAIL).
19422 </para>
19423 </listitem>
19424 <listitem>
19425 <para>
19426 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19427 </para>
19428 </listitem>
19429 <listitem>
19430 <para>
19431 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19432 </para>
19433 </listitem>
19434 </itemizedlist>
19435 <para>
19436 The main use of this variable is expected to be to distinguish between
19437 rejections of MAIL and rejections of RCPT.
19438 </para>
19439 </listitem></varlistentry>
19440 <varlistentry>
19441 <term><varname>$recipients</varname></term>
19442 <listitem>
19443 <para>
19444 <indexterm role="variable">
19445 <primary><varname>$recipients</varname></primary>
19446 </indexterm>
19447 This variable contains a list of envelope recipients for a message. A comma and
19448 a space separate the addresses in the replacement text. However, the variable
19449 is not generally available, to prevent exposure of Bcc recipients in
19450 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19451 cases:
19452 </para>
19453 <orderedlist numeration="arabic">
19454 <listitem>
19455 <para>
19456 In a system filter file.
19457 </para>
19458 </listitem>
19459 <listitem>
19460 <para>
19461 In the ACLs associated with the DATA command and with non-SMTP messages, that
19462 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19463 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19464 <option>acl_not_smtp_mime</option>.
19465 </para>
19466 </listitem>
19467 <listitem>
19468 <para>
19469 From within a <function>local_scan()</function> function.
19470 </para>
19471 </listitem>
19472 </orderedlist>
19473 </listitem></varlistentry>
19474 <varlistentry>
19475 <term><varname>$recipients_count</varname></term>
19476 <listitem>
19477 <para>
19478 <indexterm role="variable">
19479 <primary><varname>$recipients_count</varname></primary>
19480 </indexterm>
19481 When a message is being processed, this variable contains the number of
19482 envelope recipients that came with the message. Duplicates are not excluded
19483 from the count. While a message is being received over SMTP, the number
19484 increases for each accepted recipient. It can be referenced in an ACL.
19485 </para>
19486 </listitem></varlistentry>
19487 <varlistentry>
19488 <term><varname>$regex_match_string</varname></term>
19489 <listitem>
19490 <para>
19491 <indexterm role="variable">
19492 <primary><varname>$regex_match_string</varname></primary>
19493 </indexterm>
19494 This variable is set to contain the matching regular expression after a
19495 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19496 </para>
19497 </listitem></varlistentry>
19498 <varlistentry>
19499 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19500 <listitem>
19501 <para>
19502 <indexterm role="concept">
19503 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19504 </indexterm>
19505 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19506 these variables contain the
19507 captured substrings identified by the regular expression.
19508 </para>
19509 </listitem></varlistentry>
19510 <varlistentry>
19511 <term><varname>$reply_address</varname></term>
19512 <listitem>
19513 <para>
19514 <indexterm role="variable">
19515 <primary><varname>$reply_address</varname></primary>
19516 </indexterm>
19517 When a message is being processed, this variable contains the contents of the
19518 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19519 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19520 white space, the value is not processed in any way. In particular, no RFC 2047
19521 decoding or character code translation takes place.
19522 </para>
19523 </listitem></varlistentry>
19524 <varlistentry>
19525 <term><varname>$return_path</varname></term>
19526 <listitem>
19527 <para>
19528 <indexterm role="variable">
19529 <primary><varname>$return_path</varname></primary>
19530 </indexterm>
19531 When a message is being delivered, this variable contains the return path &ndash;
19532 the sender field that will be sent as part of the envelope. It is not enclosed
19533 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19534 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19535 mailing list has been expanded by a router which specifies a different address
19536 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19537 address, whereas <varname>$sender_address</varname> always contains the original sender address
19538 that was received with the message. In other words, <varname>$sender_address</varname> contains
19539 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19540 envelope sender.
19541 </para>
19542 </listitem></varlistentry>
19543 <varlistentry>
19544 <term><varname>$return_size_limit</varname></term>
19545 <listitem>
19546 <para>
19547 <indexterm role="variable">
19548 <primary><varname>$return_size_limit</varname></primary>
19549 </indexterm>
19550 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19551 </para>
19552 </listitem></varlistentry>
19553 <varlistentry>
19554 <term><varname>$router_name</varname></term>
19555 <listitem>
19556 <para>
19557 <indexterm role="concept">
19558 <primary>router</primary>
19559 <secondary>name</secondary>
19560 </indexterm>
19561 <indexterm role="concept">
19562 <primary>name</primary>
19563 <secondary>of router</secondary>
19564 </indexterm>
19565 <indexterm role="variable">
19566 <primary><varname>$router_name</varname></primary>
19567 </indexterm>
19568 During the running of a router this variable contains its name.
19569 </para>
19570 </listitem></varlistentry>
19571 <varlistentry>
19572 <term><varname>$runrc</varname></term>
19573 <listitem>
19574 <para>
19575 <indexterm role="concept">
19576 <primary>return code</primary>
19577 <secondary>from <option>run</option> expansion</secondary>
19578 </indexterm>
19579 <indexterm role="variable">
19580 <primary><varname>$runrc</varname></primary>
19581 </indexterm>
19582 This variable contains the return code from a command that is run by the
19583 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19584 assume the order in which option values are expanded, except for those
19585 preconditions whose order of testing is documented. Therefore, you cannot
19586 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19587 another.
19588 </para>
19589 </listitem></varlistentry>
19590 <varlistentry>
19591 <term><varname>$self_hostname</varname></term>
19592 <listitem>
19593 <para>
19594 <indexterm role="option">
19595 <primary><option>self</option></primary>
19596 <secondary>value of host name</secondary>
19597 </indexterm>
19598 <indexterm role="variable">
19599 <primary><varname>$self_hostname</varname></primary>
19600 </indexterm>
19601 When an address is routed to a supposedly remote host that turns out to be the
19602 local host, what happens is controlled by the <option>self</option> generic router option.
19603 One of its values causes the address to be passed to another router. When this
19604 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19605 original router encountered. In other circumstances its contents are null.
19606 </para>
19607 </listitem></varlistentry>
19608 <varlistentry>
19609 <term><varname>$sender_address</varname></term>
19610 <listitem>
19611 <para>
19612 <indexterm role="variable">
19613 <primary><varname>$sender_address</varname></primary>
19614 </indexterm>
19615 When a message is being processed, this variable contains the sender&#x2019;s address
19616 that was received in the message&#x2019;s envelope. The case of letters in the address
19617 is retained, in both the local part and the domain. For bounce messages, the
19618 value of this variable is the empty string. See also <varname>$return_path</varname>.
19619 </para>
19620 </listitem></varlistentry>
19621 <varlistentry>
19622 <term><varname>$sender_address_data</varname></term>
19623 <listitem>
19624 <para>
19625 <indexterm role="variable">
19626 <primary><varname>$address_data</varname></primary>
19627 </indexterm>
19628 <indexterm role="variable">
19629 <primary><varname>$sender_address_data</varname></primary>
19630 </indexterm>
19631 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19632 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19633 distinguish it from data from a recipient address. The value does not persist
19634 after the end of the current ACL statement. If you want to preserve it for
19635 longer, you can save it in an ACL variable.
19636 </para>
19637 </listitem></varlistentry>
19638 <varlistentry>
19639 <term><varname>$sender_address_domain</varname></term>
19640 <listitem>
19641 <para>
19642 <indexterm role="variable">
19643 <primary><varname>$sender_address_domain</varname></primary>
19644 </indexterm>
19645 The domain portion of <varname>$sender_address</varname>.
19646 </para>
19647 </listitem></varlistentry>
19648 <varlistentry>
19649 <term><varname>$sender_address_local_part</varname></term>
19650 <listitem>
19651 <para>
19652 <indexterm role="variable">
19653 <primary><varname>$sender_address_local_part</varname></primary>
19654 </indexterm>
19655 The local part portion of <varname>$sender_address</varname>.
19656 </para>
19657 </listitem></varlistentry>
19658 <varlistentry>
19659 <term><varname>$sender_data</varname></term>
19660 <listitem>
19661 <para>
19662 <indexterm role="variable">
19663 <primary><varname>$sender_data</varname></primary>
19664 </indexterm>
19665 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19666 in a router <option>senders</option> option. It contains the data from the lookup, and the
19667 value remains set until the next <option>senders</option> test. Thus, you can do things like
19668 this:
19669 </para>
19670 <literallayout>
19671 <literal>require senders      = cdb*@;/some/file</literal>
19672 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19673 </literallayout>
19674 <para>
19675 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19676 method in the address list, using the semicolon syntax as in the example above.
19677 The variable is not set for a lookup that is used as part of the string
19678 expansion that all such lists undergo before being interpreted.
19679 </para>
19680 </listitem></varlistentry>
19681 <varlistentry>
19682 <term><varname>$sender_fullhost</varname></term>
19683 <listitem>
19684 <para>
19685 <indexterm role="variable">
19686 <primary><varname>$sender_fullhost</varname></primary>
19687 </indexterm>
19688 When a message is received from a remote host, this variable contains the host
19689 name and IP address in a single string. It ends with the IP address in square
19690 brackets, followed by a colon and a port number if the logging of ports is
19691 enabled. The format of the rest of the string depends on whether the host
19692 issued a HELO or EHLO SMTP command, and whether the host name was verified by
19693 looking up its IP address. (Looking up the IP address can be forced by the
19694 <option>host_lookup</option> option, independent of verification.) A plain host name at the
19695 start of the string is a verified host name; if this is not present,
19696 verification either failed or was not requested. A host name in parentheses is
19697 the argument of a HELO or EHLO command. This is omitted if it is identical to
19698 the verified host name or to the host&#x2019;s IP address in square brackets.
19699 </para>
19700 </listitem></varlistentry>
19701 <varlistentry>
19702 <term><varname>$sender_helo_dnssec</varname></term>
19703 <listitem>
19704 <para>
19705 <indexterm role="variable">
19706 <primary><varname>$sender_helo_dnssec</varname></primary>
19707 </indexterm>
19708 This boolean variable is true if a successful HELO verification was
19709 <indexterm role="concept">
19710 <primary>DNS</primary>
19711 <secondary>DNSSEC</secondary>
19712 </indexterm>
19713 done using DNS information the resolver library stated was authenticated data.
19714 </para>
19715 </listitem></varlistentry>
19716 <varlistentry>
19717 <term><varname>$sender_helo_name</varname></term>
19718 <listitem>
19719 <para>
19720 <indexterm role="variable">
19721 <primary><varname>$sender_helo_name</varname></primary>
19722 </indexterm>
19723 When a message is received from a remote host that has issued a HELO or EHLO
19724 command, the argument of that command is placed in this variable. It is also
19725 set if HELO or EHLO is used when a message is received using SMTP locally via
19726 the <option>-bs</option> or <option>-bS</option> options.
19727 </para>
19728 </listitem></varlistentry>
19729 <varlistentry>
19730 <term><varname>$sender_host_address</varname></term>
19731 <listitem>
19732 <para>
19733 <indexterm role="variable">
19734 <primary><varname>$sender_host_address</varname></primary>
19735 </indexterm>
19736 When a message is received from a remote host using SMTP,
19737 this variable contains that
19738 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19739 </para>
19740 </listitem></varlistentry>
19741 <varlistentry>
19742 <term><varname>$sender_host_authenticated</varname></term>
19743 <listitem>
19744 <para>
19745 <indexterm role="variable">
19746 <primary><varname>$sender_host_authenticated</varname></primary>
19747 </indexterm>
19748 This variable contains the name (not the public name) of the authenticator
19749 driver that successfully authenticated the client from which the message was
19750 received. It is empty if there was no successful authentication. See also
19751 <varname>$authenticated_id</varname>.
19752 </para>
19753 </listitem></varlistentry>
19754 <varlistentry>
19755 <term><varname>$sender_host_dnssec</varname></term>
19756 <listitem>
19757 <para>
19758 <indexterm role="variable">
19759 <primary><varname>$sender_host_dnssec</varname></primary>
19760 </indexterm>
19761 If an attempt to populate <varname>$sender_host_name</varname> has been made
19762 (by reference, <option>hosts_lookup</option> or
19763 otherwise) then this boolean will have been set true if, and only if, the
19764 resolver library states that both
19765 the reverse and forward DNS were authenticated data.  At all
19766 other times, this variable is false.
19767 </para>
19768 <para>
19769 <indexterm role="concept">
19770 <primary>DNS</primary>
19771 <secondary>DNSSEC</secondary>
19772 </indexterm>
19773 It is likely that you will need to coerce DNSSEC support on in the resolver
19774 library, by setting:
19775 </para>
19776 <literallayout class="monospaced">
19777 dns_dnssec_ok = 1
19778 </literallayout>
19779 <para>
19780 Exim does not perform DNSSEC validation itself, instead leaving that to a
19781 validating resolver (e.g. unbound, or bind with suitable configuration).
19782 </para>
19783 <para>
19784 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19785 mechanism in the list, then this variable will be false.
19786 </para>
19787 <para>
19788 This requires that your system resolver library support EDNS0 (and that
19789 DNSSEC flags exist in the system headers).  If the resolver silently drops
19790 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
19791 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
19792 </para>
19793 </listitem></varlistentry>
19794 <varlistentry>
19795 <term><varname>$sender_host_name</varname></term>
19796 <listitem>
19797 <para>
19798 <indexterm role="variable">
19799 <primary><varname>$sender_host_name</varname></primary>
19800 </indexterm>
19801 When a message is received from a remote host, this variable contains the
19802 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19803 other means, this variable is empty.
19804 </para>
19805 <para>
19806 <indexterm role="variable">
19807 <primary><varname>$host_lookup_failed</varname></primary>
19808 </indexterm>
19809 If the host name has not previously been looked up, a reference to
19810 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19811 A looked up name is accepted only if it leads back to the original IP address
19812 via a forward lookup. If either the reverse or the forward lookup fails to find
19813 any data, or if the forward lookup does not yield the original IP address,
19814 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19815 </para>
19816 <para>
19817 <indexterm role="variable">
19818 <primary><varname>$host_lookup_deferred</varname></primary>
19819 </indexterm>
19820 However, if either of the lookups cannot be completed (for example, there is a
19821 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19822 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19823 </para>
19824 <para>
19825 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19826 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19827 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19828 is set to <quote>1</quote>.
19829 </para>
19830 <para>
19831 Exim does not automatically look up every calling host&#x2019;s name. If you want
19832 maximum efficiency, you should arrange your configuration so that it avoids
19833 these lookups altogether. The lookup happens only if one or more of the
19834 following are true:
19835 </para>
19836 <itemizedlist>
19837 <listitem>
19838 <para>
19839 A string containing <varname>$sender_host_name</varname> is expanded.
19840 </para>
19841 </listitem>
19842 <listitem>
19843 <para>
19844 The calling host matches the list in <option>host_lookup</option>. In the default
19845 configuration, this option is set to *, so it must be changed if lookups are
19846 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19847 </para>
19848 </listitem>
19849 <listitem>
19850 <para>
19851 Exim needs the host name in order to test an item in a host list. The items
19852 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19853 <xref linkend="SECThoslispatnamsk"/>.
19854 </para>
19855 </listitem>
19856 <listitem>
19857 <para>
19858 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19859 In this case, the host name is required to compare with the name quoted in any
19860 EHLO or HELO commands that the client issues.
19861 </para>
19862 </listitem>
19863 <listitem>
19864 <para>
19865 The remote host issues a EHLO or HELO command that quotes one of the
19866 domains in <option>helo_lookup_domains</option>. The default value of this option is
19867 </para>
19868 <literallayout class="monospaced">
19869   helo_lookup_domains = @ : @[]
19870 </literallayout>
19871 <para>
19872 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19873 IP address in an EHLO or HELO command.
19874 </para>
19875 </listitem>
19876 </itemizedlist>
19877 </listitem></varlistentry>
19878 <varlistentry>
19879 <term><varname>$sender_host_port</varname></term>
19880 <listitem>
19881 <para>
19882 <indexterm role="variable">
19883 <primary><varname>$sender_host_port</varname></primary>
19884 </indexterm>
19885 When a message is received from a remote host, this variable contains the port
19886 number that was used on the remote host.
19887 </para>
19888 </listitem></varlistentry>
19889 <varlistentry>
19890 <term><varname>$sender_ident</varname></term>
19891 <listitem>
19892 <para>
19893 <indexterm role="variable">
19894 <primary><varname>$sender_ident</varname></primary>
19895 </indexterm>
19896 When a message is received from a remote host, this variable contains the
19897 identification received in response to an RFC 1413 request. When a message has
19898 been received locally, this variable contains the login name of the user that
19899 called Exim.
19900 </para>
19901 </listitem></varlistentry>
19902 <varlistentry>
19903 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19904 <listitem>
19905 <para>
19906 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19907 <option>ratelimit</option> ACL condition. Details are given in section
19908 <xref linkend="SECTratelimiting"/>.
19909 </para>
19910 </listitem></varlistentry>
19911 <varlistentry>
19912 <term><varname>$sender_rcvhost</varname></term>
19913 <listitem>
19914 <para>
19915 <indexterm role="concept">
19916 <primary>DNS</primary>
19917 <secondary>reverse lookup</secondary>
19918 </indexterm>
19919 <indexterm role="concept">
19920 <primary>reverse DNS lookup</primary>
19921 </indexterm>
19922 <indexterm role="variable">
19923 <primary><varname>$sender_rcvhost</varname></primary>
19924 </indexterm>
19925 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19926 either the verified host name (as obtained from a reverse DNS lookup) or, if
19927 there is no verified host name, the IP address in square brackets. After that
19928 there may be text in parentheses. When the first item is a verified host name,
19929 the first thing in the parentheses is the IP address in square brackets,
19930 followed by a colon and a port number if port logging is enabled. When the
19931 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19932 the parentheses.
19933 </para>
19934 <para>
19935 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19936 was used and its argument was not identical to the real host name or IP
19937 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19938 all three items are present in the parentheses, a newline and tab are inserted
19939 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19940 </para>
19941 </listitem></varlistentry>
19942 <varlistentry>
19943 <term><varname>$sender_verify_failure</varname></term>
19944 <listitem>
19945 <para>
19946 <indexterm role="variable">
19947 <primary><varname>$sender_verify_failure</varname></primary>
19948 </indexterm>
19949 In an ACL, when a sender verification fails, this variable contains information
19950 about the failure. The details are the same as for
19951 <varname>$recipient_verify_failure</varname>.
19952 </para>
19953 </listitem></varlistentry>
19954 <varlistentry>
19955 <term><varname>$sending_ip_address</varname></term>
19956 <listitem>
19957 <para>
19958 <indexterm role="variable">
19959 <primary><varname>$sending_ip_address</varname></primary>
19960 </indexterm>
19961 This variable is set whenever an outgoing SMTP connection to another host has
19962 been set up. It contains the IP address of the local interface that is being
19963 used. This is useful if a host that has more than one IP address wants to take
19964 on different personalities depending on which one is being used. For incoming
19965 connections, see <varname>$received_ip_address</varname>.
19966 </para>
19967 </listitem></varlistentry>
19968 <varlistentry>
19969 <term><varname>$sending_port</varname></term>
19970 <listitem>
19971 <para>
19972 <indexterm role="variable">
19973 <primary><varname>$sending_port</varname></primary>
19974 </indexterm>
19975 This variable is set whenever an outgoing SMTP connection to another host has
19976 been set up. It contains the local port that is being used. For incoming
19977 connections, see <varname>$received_port</varname>.
19978 </para>
19979 </listitem></varlistentry>
19980 <varlistentry>
19981 <term><varname>$smtp_active_hostname</varname></term>
19982 <listitem>
19983 <para>
19984 <indexterm role="variable">
19985 <primary><varname>$smtp_active_hostname</varname></primary>
19986 </indexterm>
19987 During an incoming SMTP session, this variable contains the value of the active
19988 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19989 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19990 value can be consulted during routing and delivery.
19991 </para>
19992 </listitem></varlistentry>
19993 <varlistentry>
19994 <term><varname>$smtp_command</varname></term>
19995 <listitem>
19996 <para>
19997 <indexterm role="variable">
19998 <primary><varname>$smtp_command</varname></primary>
19999 </indexterm>
20000 During the processing of an incoming SMTP command, this variable contains the
20001 entire command. This makes it possible to distinguish between HELO and EHLO in
20002 the HELO ACL, and also to distinguish between commands such as these:
20003 </para>
20004 <literallayout class="monospaced">
20005 MAIL FROM:&lt;&gt;
20006 MAIL FROM: &lt;&gt;
20007 </literallayout>
20008 <para>
20009 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
20010 command, the address in <varname>$smtp_command</varname> is the original address before any
20011 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
20012 the address after SMTP-time rewriting.
20013 </para>
20014 </listitem></varlistentry>
20015 <varlistentry>
20016 <term><varname>$smtp_command_argument</varname></term>
20017 <listitem>
20018 <para>
20019 <indexterm role="concept">
20020 <primary>SMTP</primary>
20021 <secondary>command, argument for</secondary>
20022 </indexterm>
20023 <indexterm role="variable">
20024 <primary><varname>$smtp_command_argument</varname></primary>
20025 </indexterm>
20026 While an ACL is running to check an SMTP command, this variable contains the
20027 argument, that is, the text that follows the command name, with leading white
20028 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
20029 somewhat redundant, but is retained for backwards compatibility.
20030 </para>
20031 </listitem></varlistentry>
20032 <varlistentry>
20033 <term><varname>$smtp_command_history</varname></term>
20034 <listitem>
20035 <para>
20036 <indexterm role="concept">
20037 <primary>SMTP</primary>
20038 <secondary>command history</secondary>
20039 </indexterm>
20040 <indexterm role="variable">
20041 <primary><varname>$smtp_command_history</varname></primary>
20042 </indexterm>
20043 A comma-separated list (with no whitespace) of the most-recent SMTP commands
20044 received, in time-order left to right.  Only a limited number of commands
20045 are remembered.
20046 </para>
20047 </listitem></varlistentry>
20048 <varlistentry>
20049 <term><varname>$smtp_count_at_connection_start</varname></term>
20050 <listitem>
20051 <para>
20052 <indexterm role="variable">
20053 <primary><varname>$smtp_count_at_connection_start</varname></primary>
20054 </indexterm>
20055 This variable is set greater than zero only in processes spawned by the Exim
20056 daemon for handling incoming SMTP connections. The name is deliberately long,
20057 in order to emphasize what the contents are. When the daemon accepts a new
20058 connection, it increments this variable. A copy of the variable is passed to
20059 the child process that handles the connection, but its value is fixed, and
20060 never changes. It is only an approximation of how many incoming connections
20061 there actually are, because many other connections may come and go while a
20062 single connection is being processed. When a child process terminates, the
20063 daemon decrements its copy of the variable.
20064 </para>
20065 </listitem></varlistentry>
20066 <varlistentry>
20067 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
20068 <listitem>
20069 <para>
20070 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
20071 that were current at the end of the system filter file. This allows a system
20072 filter file to set values that can be tested in users&#x2019; filter files. For
20073 example, a system filter could set a value indicating how likely it is that a
20074 message is junk mail.
20075 </para>
20076 </listitem></varlistentry>
20077 <varlistentry>
20078 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
20079 <listitem>
20080 <para>
20081 A number of variables whose names start with <varname>$spam</varname> are available when Exim
20082 is compiled with the content-scanning extension. For details, see section
20083 <xref linkend="SECTscanspamass"/>.
20084 </para>
20085 </listitem></varlistentry>
20086 <varlistentry revisionflag="changed">
20087 <term><varname>$spf_header_comment</varname></term>
20088 <term><varname>$spf_received</varname></term>
20089 <term><varname>$spf_result</varname></term>
20090 <term><varname>$spf_result_guessed</varname></term>
20091 <term><varname>$spf_smtp_comment</varname></term>
20092 <listitem>
20093 <para revisionflag="changed">
20094 These variables are only available if Exim is built with SPF support.
20095 For details see section <xref linkend="SECSPF"/>.
20096 </para>
20097 </listitem></varlistentry>
20098 <varlistentry>
20099 <term><varname>$spool_directory</varname></term>
20100 <listitem>
20101 <para>
20102 <indexterm role="variable">
20103 <primary><varname>$spool_directory</varname></primary>
20104 </indexterm>
20105 The name of Exim&#x2019;s spool directory.
20106 </para>
20107 </listitem></varlistentry>
20108 <varlistentry>
20109 <term><varname>$spool_inodes</varname></term>
20110 <listitem>
20111 <para>
20112 <indexterm role="variable">
20113 <primary><varname>$spool_inodes</varname></primary>
20114 </indexterm>
20115 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
20116 being written. The value is recalculated whenever the variable is referenced.
20117 If the relevant file system does not have the concept of inodes, the value of
20118 is -1. See also the <option>check_spool_inodes</option> option.
20119 </para>
20120 </listitem></varlistentry>
20121 <varlistentry>
20122 <term><varname>$spool_space</varname></term>
20123 <listitem>
20124 <para>
20125 <indexterm role="variable">
20126 <primary><varname>$spool_space</varname></primary>
20127 </indexterm>
20128 The amount of free space (as a number of kilobytes) in the disk partition where
20129 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
20130 variable is referenced. If the operating system does not have the ability to
20131 find the amount of free space (only true for experimental systems), the space
20132 value is -1. For example, to check in an ACL that there is at least 50
20133 megabytes free on the spool, you could write:
20134 </para>
20135 <literallayout class="monospaced">
20136 condition = ${if &gt; {$spool_space}{50000}}
20137 </literallayout>
20138 <para>
20139 See also the <option>check_spool_space</option> option.
20140 </para>
20141 </listitem></varlistentry>
20142 <varlistentry>
20143 <term><varname>$thisaddress</varname></term>
20144 <listitem>
20145 <para>
20146 <indexterm role="variable">
20147 <primary><varname>$thisaddress</varname></primary>
20148 </indexterm>
20149 This variable is set only during the processing of the <option>foranyaddress</option>
20150 command in a filter file. Its use is explained in the description of that
20151 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
20152 interfaces to mail filtering</emphasis>.
20153 </para>
20154 </listitem></varlistentry>
20155 <varlistentry>
20156 <term><varname>$tls_in_bits</varname></term>
20157 <listitem>
20158 <para>
20159 <indexterm role="variable">
20160 <primary><varname>$tls_in_bits</varname></primary>
20161 </indexterm>
20162 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20163 on the inbound connection; the meaning of
20164 this depends upon the TLS implementation used.
20165 If TLS has not been negotiated, the value will be 0.
20166 The value of this is automatically fed into the Cyrus SASL authenticator
20167 when acting as a server, to specify the "external SSF" (a SASL term).
20168 </para>
20169 <para>
20170 The deprecated <varname>$tls_bits</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_bits</varname></term>
20177 <listitem>
20178 <para>
20179 <indexterm role="variable">
20180 <primary><varname>$tls_out_bits</varname></primary>
20181 </indexterm>
20182 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20183 on an outbound SMTP connection; the meaning of
20184 this depends upon the TLS implementation used.
20185 If TLS has not been negotiated, the value will be 0.
20186 </para>
20187 </listitem></varlistentry>
20188 <varlistentry>
20189 <term><varname>$tls_in_ourcert</varname></term>
20190 <listitem>
20191 <para>
20192 <indexterm role="variable">
20193 <primary><varname>$tls_in_ourcert</varname></primary>
20194 </indexterm>
20195 <indexterm role="concept">
20196 <primary>certificate</primary>
20197 <secondary>variables</secondary>
20198 </indexterm>
20199 This variable refers to the certificate presented to the peer of an
20200 inbound connection when the message was received.
20201 It is only useful as the argument of a
20202 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20203 or a <option>def</option> condition.
20204 </para>
20205 <para>
20206 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
20207 when a list of more than one
20208 file is used for <option>tls_certificate</option>, this variable is not reliable.
20209 </para>
20210 </listitem></varlistentry>
20211 <varlistentry>
20212 <term><varname>$tls_in_peercert</varname></term>
20213 <listitem>
20214 <para>
20215 <indexterm role="variable">
20216 <primary><varname>$tls_in_peercert</varname></primary>
20217 </indexterm>
20218 This variable refers to the certificate presented by the peer of an
20219 inbound connection when the message was received.
20220 It is only useful as the argument of a
20221 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20222 or a <option>def</option> condition.
20223 If certificate verification fails it may refer to a failing chain element
20224 which is not the leaf.
20225 </para>
20226 </listitem></varlistentry>
20227 <varlistentry>
20228 <term><varname>$tls_out_ourcert</varname></term>
20229 <listitem>
20230 <para>
20231 <indexterm role="variable">
20232 <primary><varname>$tls_out_ourcert</varname></primary>
20233 </indexterm>
20234 This variable refers to the certificate presented to the peer of an
20235 outbound connection.  It is only useful as the argument of a
20236 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20237 or a <option>def</option> condition.
20238 </para>
20239 </listitem></varlistentry>
20240 <varlistentry>
20241 <term><varname>$tls_out_peercert</varname></term>
20242 <listitem>
20243 <para>
20244 <indexterm role="variable">
20245 <primary><varname>$tls_out_peercert</varname></primary>
20246 </indexterm>
20247 This variable refers to the certificate presented by the peer of an
20248 outbound connection.  It is only useful as the argument of a
20249 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20250 or a <option>def</option> condition.
20251 If certificate verification fails it may refer to a failing chain element
20252 which is not the leaf.
20253 </para>
20254 </listitem></varlistentry>
20255 <varlistentry>
20256 <term><varname>$tls_in_certificate_verified</varname></term>
20257 <listitem>
20258 <para>
20259 <indexterm role="variable">
20260 <primary><varname>$tls_in_certificate_verified</varname></primary>
20261 </indexterm>
20262 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
20263 message was received, and <quote>0</quote> otherwise.
20264 </para>
20265 <para>
20266 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
20267 except when used in the context of an outbound SMTP delivery, when it refers to
20268 the outbound.
20269 </para>
20270 </listitem></varlistentry>
20271 <varlistentry>
20272 <term><varname>$tls_out_certificate_verified</varname></term>
20273 <listitem>
20274 <para>
20275 <indexterm role="variable">
20276 <primary><varname>$tls_out_certificate_verified</varname></primary>
20277 </indexterm>
20278 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
20279 outbound SMTP connection was made,
20280 and <quote>0</quote> otherwise.
20281 </para>
20282 </listitem></varlistentry>
20283 <varlistentry>
20284 <term><varname>$tls_in_cipher</varname></term>
20285 <listitem>
20286 <para>
20287 <indexterm role="variable">
20288 <primary><varname>$tls_in_cipher</varname></primary>
20289 </indexterm>
20290 <indexterm role="variable">
20291 <primary><varname>$tls_cipher</varname></primary>
20292 </indexterm>
20293 When a message is received from a remote host over an encrypted SMTP
20294 connection, this variable is set to the cipher suite that was negotiated, for
20295 example DES-CBC3-SHA. In other circumstances, in particular, for message
20296 received over unencrypted connections, the variable is empty. Testing
20297 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
20298 non-encrypted connections during ACL processing.
20299 </para>
20300 <para>
20301 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
20302 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
20303 becomes the same as <varname>$tls_out_cipher</varname>.
20304 </para>
20305 </listitem></varlistentry>
20306 <varlistentry>
20307 <term><varname>$tls_out_cipher</varname></term>
20308 <listitem>
20309 <para>
20310 <indexterm role="variable">
20311 <primary><varname>$tls_out_cipher</varname></primary>
20312 </indexterm>
20313 This variable is
20314 cleared before any outgoing SMTP connection is made,
20315 and then set to the outgoing cipher suite if one is negotiated. See chapter
20316 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
20317 details of the <command>smtp</command> transport.
20318 </para>
20319 </listitem></varlistentry>
20320 <varlistentry>
20321 <term><varname>$tls_out_dane</varname></term>
20322 <listitem>
20323 <para>
20324 <indexterm role="variable">
20325 <primary><varname>$tls_out_dane</varname></primary>
20326 </indexterm>
20327 DANE active status.  See section <xref linkend="SECDANE"/>.
20328 </para>
20329 </listitem></varlistentry>
20330 <varlistentry>
20331 <term><varname>$tls_in_ocsp</varname></term>
20332 <listitem>
20333 <para>
20334 <indexterm role="variable">
20335 <primary><varname>$tls_in_ocsp</varname></primary>
20336 </indexterm>
20337 When a message is received from a remote client connection
20338 the result of any OCSP request from the client is encoded in this variable:
20339 </para>
20340 <literallayout class="monospaced">
20341 0 OCSP proof was not requested (default value)
20342 1 No response to request
20343 2 Response not verified
20344 3 Verification failed
20345 4 Verification succeeded
20346 </literallayout>
20347 </listitem></varlistentry>
20348 <varlistentry>
20349 <term><varname>$tls_out_ocsp</varname></term>
20350 <listitem>
20351 <para>
20352 <indexterm role="variable">
20353 <primary><varname>$tls_out_ocsp</varname></primary>
20354 </indexterm>
20355 When a message is sent to a remote host connection
20356 the result of any OCSP request made is encoded in this variable.
20357 See <varname>$tls_in_ocsp</varname> for values.
20358 </para>
20359 </listitem></varlistentry>
20360 <varlistentry>
20361 <term><varname>$tls_in_peerdn</varname></term>
20362 <listitem>
20363 <para>
20364 <indexterm role="variable">
20365 <primary><varname>$tls_in_peerdn</varname></primary>
20366 </indexterm>
20367 <indexterm role="variable">
20368 <primary><varname>$tls_peerdn</varname></primary>
20369 </indexterm>
20370 <indexterm role="concept">
20371 <primary>certificate</primary>
20372 <secondary>extracting fields</secondary>
20373 </indexterm>
20374 When a message is received from a remote host over an encrypted SMTP
20375 connection, and Exim is configured to request a certificate from the client,
20376 the value of the Distinguished Name of the certificate is made available in the
20377 <varname>$tls_in_peerdn</varname> during subsequent processing.
20378 If certificate verification fails it may refer to a failing chain element
20379 which is not the leaf.
20380 </para>
20381 <para>
20382 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
20383 except when used in the context of an outbound SMTP delivery, when it refers to
20384 the outbound.
20385 </para>
20386 </listitem></varlistentry>
20387 <varlistentry>
20388 <term><varname>$tls_out_peerdn</varname></term>
20389 <listitem>
20390 <para>
20391 <indexterm role="variable">
20392 <primary><varname>$tls_out_peerdn</varname></primary>
20393 </indexterm>
20394 When a message is being delivered to a remote host over an encrypted SMTP
20395 connection, and Exim is configured to request a certificate from the server,
20396 the value of the Distinguished Name of the certificate is made available in the
20397 <varname>$tls_out_peerdn</varname> during subsequent processing.
20398 If certificate verification fails it may refer to a failing chain element
20399 which is not the leaf.
20400 </para>
20401 </listitem></varlistentry>
20402 <varlistentry>
20403 <term><varname>$tls_in_sni</varname></term>
20404 <listitem>
20405 <para>
20406 <indexterm role="variable">
20407 <primary><varname>$tls_in_sni</varname></primary>
20408 </indexterm>
20409 <indexterm role="variable">
20410 <primary><varname>$tls_sni</varname></primary>
20411 </indexterm>
20412 <indexterm role="concept">
20413 <primary>TLS</primary>
20414 <secondary>Server Name Indication</secondary>
20415 </indexterm>
20416 When a TLS session is being established, if the client sends the Server
20417 Name Indication extension, the value will be placed in this variable.
20418 If the variable appears in <option>tls_certificate</option> then this option and
20419 some others, described in <xref linkend="SECTtlssni"/>,
20420 will be re-expanded early in the TLS session, to permit
20421 a different certificate to be presented (and optionally a different key to be
20422 used) to the client, based upon the value of the SNI extension.
20423 </para>
20424 <para>
20425 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20426 except when used in the context of an outbound SMTP delivery, when it refers to
20427 the outbound.
20428 </para>
20429 </listitem></varlistentry>
20430 <varlistentry>
20431 <term><varname>$tls_out_sni</varname></term>
20432 <listitem>
20433 <para>
20434 <indexterm role="variable">
20435 <primary><varname>$tls_out_sni</varname></primary>
20436 </indexterm>
20437 <indexterm role="concept">
20438 <primary>TLS</primary>
20439 <secondary>Server Name Indication</secondary>
20440 </indexterm>
20441 During outbound
20442 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20443 the transport.
20444 </para>
20445 </listitem></varlistentry>
20446 <varlistentry>
20447 <term><varname>$tls_out_tlsa_usage</varname></term>
20448 <listitem>
20449 <para>
20450 <indexterm role="variable">
20451 <primary><varname>$tls_out_tlsa_usage</varname></primary>
20452 </indexterm>
20453 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
20454 </para>
20455 </listitem></varlistentry>
20456 <varlistentry>
20457 <term><varname>$tod_bsdinbox</varname></term>
20458 <listitem>
20459 <para>
20460 <indexterm role="variable">
20461 <primary><varname>$tod_bsdinbox</varname></primary>
20462 </indexterm>
20463 The time of day and the date, in the format required for BSD-style mailbox
20464 files, for example: Thu Oct 17 17:14:09 1995.
20465 </para>
20466 </listitem></varlistentry>
20467 <varlistentry>
20468 <term><varname>$tod_epoch</varname></term>
20469 <listitem>
20470 <para>
20471 <indexterm role="variable">
20472 <primary><varname>$tod_epoch</varname></primary>
20473 </indexterm>
20474 The time and date as a number of seconds since the start of the Unix epoch.
20475 </para>
20476 </listitem></varlistentry>
20477 <varlistentry>
20478 <term><varname>$tod_epoch_l</varname></term>
20479 <listitem>
20480 <para>
20481 <indexterm role="variable">
20482 <primary><varname>$tod_epoch_l</varname></primary>
20483 </indexterm>
20484 The time and date as a number of microseconds since the start of the Unix epoch.
20485 </para>
20486 </listitem></varlistentry>
20487 <varlistentry>
20488 <term><varname>$tod_full</varname></term>
20489 <listitem>
20490 <para>
20491 <indexterm role="variable">
20492 <primary><varname>$tod_full</varname></primary>
20493 </indexterm>
20494 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20495 +0100. The timezone is always given as a numerical offset from UTC, with
20496 positive values used for timezones that are ahead (east) of UTC, and negative
20497 values for those that are behind (west).
20498 </para>
20499 </listitem></varlistentry>
20500 <varlistentry>
20501 <term><varname>$tod_log</varname></term>
20502 <listitem>
20503 <para>
20504 <indexterm role="variable">
20505 <primary><varname>$tod_log</varname></primary>
20506 </indexterm>
20507 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20508 1995-10-12 15:32:29, but without a timezone.
20509 </para>
20510 </listitem></varlistentry>
20511 <varlistentry>
20512 <term><varname>$tod_logfile</varname></term>
20513 <listitem>
20514 <para>
20515 <indexterm role="variable">
20516 <primary><varname>$tod_logfile</varname></primary>
20517 </indexterm>
20518 This variable contains the date in the format yyyymmdd. This is the format that
20519 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20520 flag.
20521 </para>
20522 </listitem></varlistentry>
20523 <varlistentry>
20524 <term><varname>$tod_zone</varname></term>
20525 <listitem>
20526 <para>
20527 <indexterm role="variable">
20528 <primary><varname>$tod_zone</varname></primary>
20529 </indexterm>
20530 This variable contains the numerical value of the local timezone, for example:
20531 -0500.
20532 </para>
20533 </listitem></varlistentry>
20534 <varlistentry>
20535 <term><varname>$tod_zulu</varname></term>
20536 <listitem>
20537 <para>
20538 <indexterm role="variable">
20539 <primary><varname>$tod_zulu</varname></primary>
20540 </indexterm>
20541 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20542 by ISO 8601, for example: 20030221154023Z.
20543 </para>
20544 </listitem></varlistentry>
20545 <varlistentry>
20546 <term><varname>$transport_name</varname></term>
20547 <listitem>
20548 <para>
20549 <indexterm role="concept">
20550 <primary>transport</primary>
20551 <secondary>name</secondary>
20552 </indexterm>
20553 <indexterm role="concept">
20554 <primary>name</primary>
20555 <secondary>of transport</secondary>
20556 </indexterm>
20557 <indexterm role="variable">
20558 <primary><varname>$transport_name</varname></primary>
20559 </indexterm>
20560 During the running of a transport, this variable contains its name.
20561 </para>
20562 </listitem></varlistentry>
20563 <varlistentry>
20564 <term><varname>$value</varname></term>
20565 <listitem>
20566 <para>
20567 <indexterm role="variable">
20568 <primary><varname>$value</varname></primary>
20569 </indexterm>
20570 This variable contains the result of an expansion lookup, extraction operation,
20571 or external command, as described above. It is also used during a
20572 <emphasis role="bold">reduce</emphasis> expansion.
20573 </para>
20574 </listitem></varlistentry>
20575 <varlistentry>
20576 <term><varname>$verify_mode</varname></term>
20577 <listitem>
20578 <para>
20579 <indexterm role="variable">
20580 <primary><varname>$verify_mode</varname></primary>
20581 </indexterm>
20582 While a router or transport is being run in verify mode or for cutthrough delivery,
20583 contains "S" for sender-verification or "R" for recipient-verification.
20584 Otherwise, empty.
20585 </para>
20586 </listitem></varlistentry>
20587 <varlistentry>
20588 <term><varname>$version_number</varname></term>
20589 <listitem>
20590 <para>
20591 <indexterm role="variable">
20592 <primary><varname>$version_number</varname></primary>
20593 </indexterm>
20594 The version number of Exim.
20595 </para>
20596 </listitem></varlistentry>
20597 <varlistentry>
20598 <term><varname>$warn_message_delay</varname></term>
20599 <listitem>
20600 <para>
20601 <indexterm role="variable">
20602 <primary><varname>$warn_message_delay</varname></primary>
20603 </indexterm>
20604 This variable is set only during the creation of a message warning about a
20605 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20606 </para>
20607 </listitem></varlistentry>
20608 <varlistentry>
20609 <term><varname>$warn_message_recipients</varname></term>
20610 <listitem>
20611 <para>
20612 <indexterm role="variable">
20613 <primary><varname>$warn_message_recipients</varname></primary>
20614 </indexterm>
20615 This variable is set only during the creation of a message warning about a
20616 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20617 </para>
20618 </listitem></varlistentry>
20619 </variablelist>
20620 <para>
20621 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20622 </para>
20623 </section>
20624 </chapter>
20625
20626 <chapter id="CHAPperl">
20627 <title>Embedded Perl</title>
20628 <para>
20629 <indexterm role="concept" id="IIDperl" class="startofrange">
20630 <primary>Perl</primary>
20631 <secondary>calling from Exim</secondary>
20632 </indexterm>
20633 Exim can be built to include an embedded Perl interpreter. When this is done,
20634 Perl subroutines can be called as part of the string expansion process. To make
20635 use of the Perl support, you need version 5.004 or later of Perl installed on
20636 your system. To include the embedded interpreter in the Exim binary, include
20637 the line
20638 </para>
20639 <literallayout class="monospaced">
20640 EXIM_PERL = perl.o
20641 </literallayout>
20642 <para>
20643 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20644 </para>
20645 <section id="SECID85">
20646 <title>Setting up so Perl can be used</title>
20647 <para>
20648 <indexterm role="option">
20649 <primary><option>perl_startup</option></primary>
20650 </indexterm>
20651 Access to Perl subroutines is via a global configuration option called
20652 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20653 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20654 interpreter is started and there is almost no overhead for Exim (since none of
20655 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20656 option then the associated value is taken to be Perl code which is executed in
20657 a newly created Perl interpreter.
20658 </para>
20659 <para>
20660 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20661 need backslashes before any characters to escape special meanings. The option
20662 should usually be something like
20663 </para>
20664 <literallayout class="monospaced">
20665 perl_startup = do '/etc/exim.pl'
20666 </literallayout>
20667 <para>
20668 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20669 use from Exim. Exim can be configured either to start up a Perl interpreter as
20670 soon as it is entered, or to wait until the first time it is needed. Starting
20671 the interpreter at the beginning ensures that it is done while Exim still has
20672 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20673 fact used in a particular run. Also, note that this does not mean that Exim is
20674 necessarily running as root when Perl is called at a later time. By default,
20675 the interpreter is started only when it is needed, but this can be changed in
20676 two ways:
20677 </para>
20678 <itemizedlist>
20679 <listitem>
20680 <para>
20681 <indexterm role="option">
20682 <primary><option>perl_at_start</option></primary>
20683 </indexterm>
20684 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
20685 a startup when Exim is entered.
20686 </para>
20687 </listitem>
20688 <listitem>
20689 <para>
20690 The command line option <option>-ps</option> also requests a startup when Exim is entered,
20691 overriding the setting of <option>perl_at_start</option>.
20692 </para>
20693 </listitem>
20694 </itemizedlist>
20695 <para>
20696 There is also a command line option <option>-pd</option> (for delay) which suppresses the
20697 initial startup, even if <option>perl_at_start</option> is set.
20698 </para>
20699 <itemizedlist>
20700 <listitem>
20701 <para>
20702 <indexterm role="option">
20703 <primary><option>perl_taintmode</option></primary>
20704 </indexterm>
20705 <indexterm role="concept">
20706 <primary>Perl</primary>
20707 <secondary>taintmode</secondary>
20708 </indexterm>
20709 To provide more security executing Perl code via the embedded Perl
20710 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
20711 taint mode of the Perl interpreter. You are encouraged to set this
20712 option to a true value. To avoid breaking existing installations, it
20713 defaults to false.
20714 </para>
20715 </listitem>
20716 </itemizedlist>
20717 </section>
20718 <section id="SECID86">
20719 <title>Calling Perl subroutines</title>
20720 <para>
20721 When the configuration file includes a <option>perl_startup</option> option you can make use
20722 of the string expansion item to call the Perl subroutines that are defined
20723 by the <option>perl_startup</option> code. The operator is used in any of the following
20724 forms:
20725 </para>
20726 <literallayout class="monospaced">
20727 ${perl{foo}}
20728 ${perl{foo}{argument}}
20729 ${perl{foo}{argument1}{argument2} ... }
20730 </literallayout>
20731 <para>
20732 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
20733 arguments may be passed. Passing more than this results in an expansion failure
20734 with an error message of the form
20735 </para>
20736 <literallayout class="monospaced">
20737 Too many arguments passed to Perl subroutine "foo" (max is 8)
20738 </literallayout>
20739 <para>
20740 The return value of the Perl subroutine is evaluated in a scalar context before
20741 it is passed back to Exim to be inserted into the expanded string. If the
20742 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
20743 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
20744 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
20745 that was passed to <option>die</option>.
20746 </para>
20747 </section>
20748 <section id="SECID87">
20749 <title>Calling Exim functions from Perl</title>
20750 <para>
20751 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
20752 is available to call back into Exim&#x2019;s string expansion function. For example,
20753 the Perl code
20754 </para>
20755 <literallayout class="monospaced">
20756 my $lp = Exim::expand_string('$local_part');
20757 </literallayout>
20758 <para>
20759 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
20760 Note those are single quotes and not double quotes to protect against
20761 <varname>$local_part</varname> being interpolated as a Perl variable.
20762 </para>
20763 <para>
20764 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
20765 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
20766 expansion string, the Perl call from the original expansion string fails with
20767 an appropriate error message, in the same way as if <option>die</option> were used.
20768 </para>
20769 <para>
20770 <indexterm role="concept">
20771 <primary>debugging</primary>
20772 <secondary>from embedded Perl</secondary>
20773 </indexterm>
20774 <indexterm role="concept">
20775 <primary>log</primary>
20776 <secondary>writing from embedded Perl</secondary>
20777 </indexterm>
20778 Two other Exim functions are available for use from within Perl code.
20779 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
20780 debugging is enabled. If you want a newline at the end, you must supply it.
20781 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20782 timestamp. In this case, you should not supply a terminating newline.
20783 </para>
20784 </section>
20785 <section id="SECID88">
20786 <title>Use of standard output and error by Perl</title>
20787 <para>
20788 <indexterm role="concept">
20789 <primary>Perl</primary>
20790 <secondary>standard output and error</secondary>
20791 </indexterm>
20792 You should not write to the standard error or output streams from within your
20793 Perl code, as it is not defined how these are set up. In versions of Exim
20794 before 4.50, it is possible for the standard output or error to refer to the
20795 SMTP connection during message reception via the daemon. Writing to this stream
20796 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20797 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20798 avoided, but the output is lost.
20799 </para>
20800 <para>
20801 <indexterm role="concept">
20802 <primary>Perl</primary>
20803 <secondary>use of <option>warn</option></secondary>
20804 </indexterm>
20805 The Perl <option>warn</option> statement writes to the standard error stream by default.
20806 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20807 you have no control. When Exim starts up the Perl interpreter, it arranges for
20808 output from the <option>warn</option> statement to be written to the Exim main log. You can
20809 change this by including appropriate Perl magic somewhere in your Perl code.
20810 For example, to discard <option>warn</option> output completely, you need this:
20811 </para>
20812 <literallayout class="monospaced">
20813 $SIG{__WARN__} = sub { };
20814 </literallayout>
20815 <para>
20816 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20817 example, the code for the subroutine is empty, so it does nothing, but you can
20818 include any Perl code that you like. The text of the <option>warn</option> message is passed
20819 as the first subroutine argument.
20820 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20821 </para>
20822 </section>
20823 </chapter>
20824
20825 <chapter id="CHAPinterfaces">
20826 <title>Starting the daemon and the use of network interfaces</title>
20827 <titleabbrev>Starting the daemon</titleabbrev>
20828 <para>
20829 <indexterm role="concept">
20830 <primary>daemon</primary>
20831 <secondary>starting</secondary>
20832 </indexterm>
20833 <indexterm role="concept">
20834 <primary>interface</primary>
20835 <secondary>listening</secondary>
20836 </indexterm>
20837 <indexterm role="concept">
20838 <primary>network interface</primary>
20839 </indexterm>
20840 <indexterm role="concept">
20841 <primary>interface</primary>
20842 <secondary>network</secondary>
20843 </indexterm>
20844 <indexterm role="concept">
20845 <primary>IP address</primary>
20846 <secondary>for listening</secondary>
20847 </indexterm>
20848 <indexterm role="concept">
20849 <primary>daemon</primary>
20850 <secondary>listening IP addresses</secondary>
20851 </indexterm>
20852 <indexterm role="concept">
20853 <primary>TCP/IP</primary>
20854 <secondary>setting listening interfaces</secondary>
20855 </indexterm>
20856 <indexterm role="concept">
20857 <primary>TCP/IP</primary>
20858 <secondary>setting listening ports</secondary>
20859 </indexterm>
20860 A host that is connected to a TCP/IP network may have one or more physical
20861 hardware network interfaces. Each of these interfaces may be configured as one
20862 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20863 works with. Each of these logical interfaces is associated with an IP address.
20864 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20865 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20866 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20867 </para>
20868 <orderedlist numeration="arabic">
20869 <listitem>
20870 <para>
20871 When a listening daemon is started, Exim needs to know which interfaces
20872 and ports to listen on.
20873 </para>
20874 </listitem>
20875 <listitem>
20876 <para>
20877 When Exim is routing an address, it needs to know which IP addresses
20878 are associated with local interfaces. This is required for the correct
20879 processing of MX lists by removing the local host and others with the
20880 same or higher priority values. Also, Exim needs to detect cases
20881 when an address is routed to an IP address that in fact belongs to the
20882 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20883 option of the smtp transport is set (as appropriate), this is treated
20884 as an error situation.
20885 </para>
20886 </listitem>
20887 <listitem>
20888 <para>
20889 When Exim connects to a remote host, it may need to know which interface to use
20890 for the outgoing connection.
20891 </para>
20892 </listitem>
20893 </orderedlist>
20894 <para>
20895 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20896 of cases. If your host has only one interface, and you want all its IP
20897 addresses to be treated in the same way, and you are using only the
20898 standard SMTP port, you should not need to take any special action. The
20899 rest of this chapter does not apply to you.
20900 </para>
20901 <para>
20902 In a more complicated situation you may want to listen only on certain
20903 interfaces, or on different ports, and for this reason there are a number of
20904 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20905 chapter describes how they operate.
20906 </para>
20907 <para>
20908 When a message is received over TCP/IP, the interface and port that were
20909 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20910 </para>
20911 <section id="SECID89">
20912 <title>Starting a listening daemon</title>
20913 <para>
20914 When a listening daemon is started (by means of the <option>-bd</option> command line
20915 option), the interfaces and ports on which it listens are controlled by the
20916 following options:
20917 </para>
20918 <itemizedlist>
20919 <listitem>
20920 <para>
20921 <option>daemon_smtp_ports</option> contains a list of default ports
20922 or service names.
20923 (For backward compatibility, this option can also be specified in the singular.)
20924 </para>
20925 </listitem>
20926 <listitem>
20927 <para>
20928 <option>local_interfaces</option> contains list of interface IP addresses on which to
20929 listen. Each item may optionally also specify a port.
20930 </para>
20931 </listitem>
20932 </itemizedlist>
20933 <para>
20934 The default list separator in both cases is a colon, but this can be changed as
20935 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20936 it is usually best to change the separator to avoid having to double all the
20937 colons. For example:
20938 </para>
20939 <literallayout class="monospaced">
20940 local_interfaces = &lt;; 127.0.0.1 ; \
20941                       192.168.23.65 ; \
20942                       ::1 ; \
20943                       3ffe:ffff:836f::fe86:a061
20944 </literallayout>
20945 <para>
20946 There are two different formats for specifying a port along with an IP address
20947 in <option>local_interfaces</option>:
20948 </para>
20949 <orderedlist numeration="arabic">
20950 <listitem>
20951 <para>
20952 The port is added onto the address with a dot separator. For example, to listen
20953 on port 1234 on two different IP addresses:
20954 </para>
20955 <literallayout class="monospaced">
20956 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20957                       3ffe:ffff:836f::fe86:a061.1234
20958 </literallayout>
20959 </listitem>
20960 <listitem>
20961 <para>
20962 The IP address is enclosed in square brackets, and the port is added
20963 with a colon separator, for example:
20964 </para>
20965 <literallayout class="monospaced">
20966 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20967                       [3ffe:ffff:836f::fe86:a061]:1234
20968 </literallayout>
20969 </listitem>
20970 </orderedlist>
20971 <para>
20972 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20973 default setting contains just one port:
20974 </para>
20975 <literallayout class="monospaced">
20976 daemon_smtp_ports = smtp
20977 </literallayout>
20978 <para>
20979 If more than one port is listed, each interface that does not have its own port
20980 specified listens on all of them. Ports that are listed in
20981 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20982 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20983 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20984 </para>
20985 </section>
20986 <section id="SECID90">
20987 <title>Special IP listening addresses</title>
20988 <para>
20989 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20990 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20991 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20992 instead of setting up separate listening sockets for each interface. The
20993 default value of <option>local_interfaces</option> is
20994 </para>
20995 <literallayout class="monospaced">
20996 local_interfaces = 0.0.0.0
20997 </literallayout>
20998 <para>
20999 when Exim is built without IPv6 support; otherwise it is:
21000 </para>
21001 <literallayout class="monospaced">
21002 local_interfaces = &lt;; ::0 ; 0.0.0.0
21003 </literallayout>
21004 <para>
21005 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
21006 </para>
21007 </section>
21008 <section id="SECID91">
21009 <title>Overriding local_interfaces and daemon_smtp_ports</title>
21010 <para>
21011 The <option>-oX</option> command line option can be used to override the values of
21012 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
21013 instance. Another way of doing this would be to use macros and the <option>-D</option>
21014 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
21015 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
21016 exim.
21017 </para>
21018 <para>
21019 The value of <option>-oX</option> is a list of items. The default colon separator can be
21020 changed in the usual way if required. If there are any items that do not
21021 contain dots or colons (that is, are not IP addresses), the value of
21022 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
21023 items that do contain dots or colons, the value of <option>local_interfaces</option> is
21024 replaced by those items. Thus, for example,
21025 </para>
21026 <literallayout class="monospaced">
21027 -oX 1225
21028 </literallayout>
21029 <para>
21030 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
21031 whereas
21032 </para>
21033 <literallayout class="monospaced">
21034 -oX 192.168.34.5.1125
21035 </literallayout>
21036 <para>
21037 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
21038 (However, since <option>local_interfaces</option> now contains no items without ports, the
21039 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
21040 </para>
21041 </section>
21042 <section id="SECTsupobssmt">
21043 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
21044 <para>
21045 <indexterm role="concept">
21046 <primary>submissions protocol</primary>
21047 </indexterm>
21048 <indexterm role="concept">
21049 <primary>ssmtp protocol</primary>
21050 </indexterm>
21051 <indexterm role="concept">
21052 <primary>smtps protocol</primary>
21053 </indexterm>
21054 <indexterm role="concept">
21055 <primary>SMTP</primary>
21056 <secondary>ssmtp protocol</secondary>
21057 </indexterm>
21058 <indexterm role="concept">
21059 <primary>SMTP</primary>
21060 <secondary>smtps protocol</secondary>
21061 </indexterm>
21062 Exim supports the use of TLS-on-connect, used by mail clients in the
21063 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
21064 For some years, IETF Standards Track documents only blessed the
21065 STARTTLS-based Submission service (port 587) while common practice was to support
21066 the same feature set on port 465, but using TLS-on-connect.
21067 If your installation needs to provide service to mail clients
21068 (Mail User Agents, MUAs) then you should provide service on both the 587 and
21069 the 465 TCP ports.
21070 </para>
21071 <para>
21072 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
21073 service names, connections to those ports must first establish TLS, before
21074 proceeding to the application layer use of the SMTP protocol.
21075 </para>
21076 <para>
21077 The common use of this option is expected to be
21078 </para>
21079 <literallayout class="monospaced">
21080 tls_on_connect_ports = 465
21081 </literallayout>
21082 <para>
21083 per RFC 8314.
21084 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
21085 to behave in this way when a daemon is started.
21086 </para>
21087 <para>
21088 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
21089 daemon to listen on those ports. You must still specify them in
21090 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
21091 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
21092 connections via the daemon.)
21093 </para>
21094 </section>
21095 <section id="SECID92">
21096 <title>IPv6 address scopes</title>
21097 <para>
21098 <indexterm role="concept">
21099 <primary>IPv6</primary>
21100 <secondary>address scopes</secondary>
21101 </indexterm>
21102 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
21103 can, in principle, have the same link-local IPv6 address on different
21104 interfaces. Thus, additional information is needed, over and above the IP
21105 address, to distinguish individual interfaces. A convention of using a
21106 percent sign followed by something (often the interface name) has been
21107 adopted in some cases, leading to addresses like this:
21108 </para>
21109 <literallayout class="monospaced">
21110 fe80::202:b3ff:fe03:45c1%eth0
21111 </literallayout>
21112 <para>
21113 To accommodate this usage, a percent sign followed by an arbitrary string is
21114 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
21115 to convert a textual IPv6 address for actual use. This function recognizes the
21116 percent convention in operating systems that support it, and it processes the
21117 address appropriately. Unfortunately, some older libraries have problems with
21118 <function>getaddrinfo()</function>. If
21119 </para>
21120 <literallayout class="monospaced">
21121 IPV6_USE_INET_PTON=yes
21122 </literallayout>
21123 <para>
21124 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
21125 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
21126 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
21127 function.) Of course, this means that the additional functionality of
21128 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
21129 </para>
21130 </section>
21131 <section id="SECID93">
21132 <title>Disabling IPv6</title>
21133 <para>
21134 <indexterm role="concept">
21135 <primary>IPv6</primary>
21136 <secondary>disabling</secondary>
21137 </indexterm>
21138 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
21139 run on a host whose kernel does not support IPv6. The binary will fall back to
21140 using IPv4, but it may waste resources looking up AAAA records, and trying to
21141 connect to IPv6 addresses, causing delays to mail delivery. If you set the
21142 <indexterm role="option">
21143 <primary><option>disable_ipv6</option></primary>
21144 </indexterm>
21145 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
21146 activities take place. AAAA records are never looked up, and any IPv6 addresses
21147 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
21148 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21149 to handle IPv6 literal addresses.
21150 </para>
21151 <para>
21152 On the other hand, when IPv6 is in use, there may be times when you want to
21153 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
21154 option to globally suppress the lookup of AAAA records for specified domains,
21155 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
21156 IPv6 addresses in an individual router.
21157 </para>
21158 </section>
21159 <section id="SECID94">
21160 <title>Examples of starting a listening daemon</title>
21161 <para>
21162 The default case in an IPv6 environment is
21163 </para>
21164 <literallayout class="monospaced">
21165 daemon_smtp_ports = smtp
21166 local_interfaces = &lt;; ::0 ; 0.0.0.0
21167 </literallayout>
21168 <para>
21169 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
21170 Either one or two sockets may be used, depending on the characteristics of
21171 the TCP/IP stack. (This is complicated and messy; for more information,
21172 read the comments in the <filename>daemon.c</filename> source file.)
21173 </para>
21174 <para>
21175 To specify listening on ports 25 and 26 on all interfaces:
21176 </para>
21177 <literallayout class="monospaced">
21178 daemon_smtp_ports = 25 : 26
21179 </literallayout>
21180 <para>
21181 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
21182 </para>
21183 <literallayout class="monospaced">
21184 local_interfaces = &lt;; ::0.25     ; ::0.26 \
21185                       0.0.0.0.25 ; 0.0.0.0.26
21186 </literallayout>
21187 <para>
21188 To listen on the default port on all IPv4 interfaces, and on port 26 on the
21189 IPv4 loopback address only:
21190 </para>
21191 <literallayout class="monospaced">
21192 local_interfaces = 0.0.0.0 : 127.0.0.1.26
21193 </literallayout>
21194 <para>
21195 To specify listening on the default port on specific interfaces only:
21196 </para>
21197 <literallayout class="monospaced">
21198 local_interfaces = 10.0.0.67 : 192.168.34.67
21199 </literallayout>
21200 <para>
21201 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
21202 </para>
21203 </section>
21204 <section id="SECTreclocipadd">
21205 <title>Recognizing the local host</title>
21206 <para>
21207 The <option>local_interfaces</option> option is also used when Exim needs to determine
21208 whether or not an IP address refers to the local host. That is, the IP
21209 addresses of all the interfaces on which a daemon is listening are always
21210 treated as local.
21211 </para>
21212 <para>
21213 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
21214 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
21215 available interfaces from the operating system, and extracts the relevant
21216 (that is, IPv4 or IPv6) addresses to use for checking.
21217 </para>
21218 <para>
21219 Some systems set up large numbers of virtual interfaces in order to provide
21220 many virtual web servers. In this situation, you may want to listen for
21221 email on only a few of the available interfaces, but nevertheless treat all
21222 interfaces as local when routing. You can do this by setting
21223 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
21224 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
21225 used for listening. Consider this example:
21226 </para>
21227 <literallayout class="monospaced">
21228 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
21229                       192.168.53.235 ; \
21230                       3ffe:2101:12:1:a00:20ff:fe86:a061
21231
21232 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
21233 </literallayout>
21234 <para>
21235 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
21236 address, but all available interface addresses are treated as local when
21237 Exim is routing.
21238 </para>
21239 <para>
21240 In some environments the local host name may be in an MX list, but with an IP
21241 address that is not assigned to any local interface. In other cases it may be
21242 desirable to treat other host names as if they referred to the local host. Both
21243 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
21244 This contains host names rather than IP addresses. When a host is referenced
21245 during routing, either via an MX record or directly, it is treated as the local
21246 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
21247 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
21248 </para>
21249 </section>
21250 <section id="SECID95">
21251 <title>Delivering to a remote host</title>
21252 <para>
21253 Delivery to a remote host is handled by the smtp transport. By default, it
21254 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
21255 there is more than one) when connecting to a remote host. However, the
21256 <option>interface</option> option can be set to specify which interface is used. See the
21257 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
21258 details.
21259 </para>
21260 </section>
21261 </chapter>
21262
21263 <chapter id="CHAPmainconfig">
21264 <title>Main configuration</title>
21265 <para>
21266 <indexterm role="concept" id="IIDconfima" class="startofrange">
21267 <primary>configuration file</primary>
21268 <secondary>main section</secondary>
21269 </indexterm>
21270 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
21271 <primary>main configuration</primary>
21272 </indexterm>
21273 The first part of the run time configuration file contains three types of item:
21274 </para>
21275 <itemizedlist>
21276 <listitem>
21277 <para>
21278 Macro definitions: These lines start with an upper case letter. See section
21279 <xref linkend="SECTmacrodefs"/> for details of macro processing.
21280 </para>
21281 </listitem>
21282 <listitem>
21283 <para>
21284 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
21285 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
21286 section <xref linkend="SECTnamedlists"/>.
21287 </para>
21288 </listitem>
21289 <listitem>
21290 <para>
21291 Main configuration settings: Each setting occupies one line of the file
21292 (with possible continuations). If any setting is preceded by the word
21293 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
21294 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
21295 settings.
21296 </para>
21297 </listitem>
21298 </itemizedlist>
21299 <para>
21300 This chapter specifies all the main configuration options, along with their
21301 types and default values. For ease of finding a particular option, they appear
21302 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
21303 are now so many options, they are first listed briefly in functional groups, as
21304 an aid to finding the name of the option you are looking for. Some options are
21305 listed in more than one group.
21306 </para>
21307 <section id="SECID96">
21308 <title>Miscellaneous</title>
21309 <informaltable frame="none">
21310 <tgroup cols="2" colsep="0" rowsep="0">
21311 <colspec colwidth="196pt" align="left"/>
21312 <colspec colwidth="254pt" align="left"/>
21313 <tbody>
21314 <row>
21315 <entry><option>bi_command</option></entry>
21316 <entry>to run for <option>-bi</option> command line option</entry>
21317 </row>
21318 <row>
21319 <entry><option>debug_store</option></entry>
21320 <entry>do extra internal checks</entry>
21321 </row>
21322 <row>
21323 <entry><option>disable_ipv6</option></entry>
21324 <entry>do no IPv6 processing</entry>
21325 </row>
21326 <row>
21327 <entry><option>keep_malformed</option></entry>
21328 <entry>for broken files &ndash; should not happen</entry>
21329 </row>
21330 <row>
21331 <entry><option>localhost_number</option></entry>
21332 <entry>for unique message ids in clusters</entry>
21333 </row>
21334 <row>
21335 <entry><option>message_body_newlines</option></entry>
21336 <entry>retain newlines in <varname>$message_body</varname></entry>
21337 </row>
21338 <row>
21339 <entry><option>message_body_visible</option></entry>
21340 <entry>how much to show in <varname>$message_body</varname></entry>
21341 </row>
21342 <row>
21343 <entry><option>mua_wrapper</option></entry>
21344 <entry>run in <quote>MUA wrapper</quote> mode</entry>
21345 </row>
21346 <row>
21347 <entry><option>print_topbitchars</option></entry>
21348 <entry>top-bit characters are printing</entry>
21349 </row>
21350 <row>
21351 <entry><option>spool_wireformat</option></entry>
21352 <entry>use wire-format spool data files when possible</entry>
21353 </row>
21354 <row>
21355 <entry><option>timezone</option></entry>
21356 <entry>force time zone</entry>
21357 </row>
21358 </tbody>
21359 </tgroup>
21360 </informaltable>
21361 </section>
21362 <section id="SECID97">
21363 <title>Exim parameters</title>
21364 <informaltable frame="none">
21365 <tgroup cols="2" colsep="0" rowsep="0">
21366 <colspec colwidth="196pt" align="left"/>
21367 <colspec colwidth="254pt" align="left"/>
21368 <tbody>
21369 <row>
21370 <entry><option>exim_group</option></entry>
21371 <entry>override compiled-in value</entry>
21372 </row>
21373 <row>
21374 <entry><option>exim_path</option></entry>
21375 <entry>override compiled-in value</entry>
21376 </row>
21377 <row>
21378 <entry><option>exim_user</option></entry>
21379 <entry>override compiled-in value</entry>
21380 </row>
21381 <row>
21382 <entry><option>primary_hostname</option></entry>
21383 <entry>default from <function>uname()</function></entry>
21384 </row>
21385 <row>
21386 <entry><option>split_spool_directory</option></entry>
21387 <entry>use multiple directories</entry>
21388 </row>
21389 <row>
21390 <entry><option>spool_directory</option></entry>
21391 <entry>override compiled-in value</entry>
21392 </row>
21393 </tbody>
21394 </tgroup>
21395 </informaltable>
21396 </section>
21397 <section id="SECID98">
21398 <title>Privilege controls</title>
21399 <informaltable frame="none">
21400 <tgroup cols="2" colsep="0" rowsep="0">
21401 <colspec colwidth="196pt" align="left"/>
21402 <colspec colwidth="254pt" align="left"/>
21403 <tbody>
21404 <row>
21405 <entry><option>admin_groups</option></entry>
21406 <entry>groups that are Exim admin users</entry>
21407 </row>
21408 <row>
21409 <entry><option>commandline_checks_require_admin</option></entry>
21410 <entry>require admin for various checks</entry>
21411 </row>
21412 <row>
21413 <entry><option>deliver_drop_privilege</option></entry>
21414 <entry>drop root for delivery processes</entry>
21415 </row>
21416 <row>
21417 <entry><option>local_from_check</option></entry>
21418 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
21419 </row>
21420 <row>
21421 <entry><option>local_from_prefix</option></entry>
21422 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21423 </row>
21424 <row>
21425 <entry><option>local_from_suffix</option></entry>
21426 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21427 </row>
21428 <row>
21429 <entry><option>local_sender_retain</option></entry>
21430 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
21431 </row>
21432 <row>
21433 <entry><option>never_users</option></entry>
21434 <entry>do not run deliveries as these</entry>
21435 </row>
21436 <row>
21437 <entry><option>prod_requires_admin</option></entry>
21438 <entry>forced delivery requires admin user</entry>
21439 </row>
21440 <row>
21441 <entry><option>queue_list_requires_admin</option></entry>
21442 <entry>queue listing requires admin user</entry>
21443 </row>
21444 <row>
21445 <entry><option>trusted_groups</option></entry>
21446 <entry>groups that are trusted</entry>
21447 </row>
21448 <row>
21449 <entry><option>trusted_users</option></entry>
21450 <entry>users that are trusted</entry>
21451 </row>
21452 </tbody>
21453 </tgroup>
21454 </informaltable>
21455 </section>
21456 <section id="SECID99">
21457 <title>Logging</title>
21458 <informaltable frame="none">
21459 <tgroup cols="2" colsep="0" rowsep="0">
21460 <colspec colwidth="196pt" align="left"/>
21461 <colspec colwidth="254pt" align="left"/>
21462 <tbody>
21463 <row>
21464 <entry><option>event_action</option></entry>
21465 <entry>custom logging</entry>
21466 </row>
21467 <row>
21468 <entry><option>hosts_connection_nolog</option></entry>
21469 <entry>exemption from connect logging</entry>
21470 </row>
21471 <row>
21472 <entry><option>log_file_path</option></entry>
21473 <entry>override compiled-in value</entry>
21474 </row>
21475 <row>
21476 <entry><option>log_selector</option></entry>
21477 <entry>set/unset optional logging</entry>
21478 </row>
21479 <row>
21480 <entry><option>log_timezone</option></entry>
21481 <entry>add timezone to log lines</entry>
21482 </row>
21483 <row>
21484 <entry><option>message_logs</option></entry>
21485 <entry>create per-message logs</entry>
21486 </row>
21487 <row>
21488 <entry><option>preserve_message_logs</option></entry>
21489 <entry>after message completion</entry>
21490 </row>
21491 <row>
21492 <entry><option>process_log_path</option></entry>
21493 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21494 </row>
21495 <row>
21496 <entry><option>slow_lookup_log</option></entry>
21497 <entry>control logging of slow DNS lookups</entry>
21498 </row>
21499 <row>
21500 <entry><option>syslog_duplication</option></entry>
21501 <entry>controls duplicate log lines on syslog</entry>
21502 </row>
21503 <row>
21504 <entry><option>syslog_facility</option></entry>
21505 <entry>set syslog <quote>facility</quote> field</entry>
21506 </row>
21507 <row>
21508 <entry><option>syslog_pid</option></entry>
21509 <entry>pid in syslog lines</entry>
21510 </row>
21511 <row>
21512 <entry><option>syslog_processname</option></entry>
21513 <entry>set syslog <quote>ident</quote> field</entry>
21514 </row>
21515 <row>
21516 <entry><option>syslog_timestamp</option></entry>
21517 <entry>timestamp syslog lines</entry>
21518 </row>
21519 <row>
21520 <entry><option>write_rejectlog</option></entry>
21521 <entry>control use of message log</entry>
21522 </row>
21523 </tbody>
21524 </tgroup>
21525 </informaltable>
21526 </section>
21527 <section id="SECID100">
21528 <title>Frozen messages</title>
21529 <informaltable frame="none">
21530 <tgroup cols="2" colsep="0" rowsep="0">
21531 <colspec colwidth="196pt" align="left"/>
21532 <colspec colwidth="254pt" align="left"/>
21533 <tbody>
21534 <row>
21535 <entry><option>auto_thaw</option></entry>
21536 <entry>sets time for retrying frozen messages</entry>
21537 </row>
21538 <row>
21539 <entry><option>freeze_tell</option></entry>
21540 <entry>send message when freezing</entry>
21541 </row>
21542 <row>
21543 <entry><option>move_frozen_messages</option></entry>
21544 <entry>to another directory</entry>
21545 </row>
21546 <row>
21547 <entry><option>timeout_frozen_after</option></entry>
21548 <entry>keep frozen messages only so long</entry>
21549 </row>
21550 </tbody>
21551 </tgroup>
21552 </informaltable>
21553 </section>
21554 <section id="SECID101">
21555 <title>Data lookups</title>
21556 <informaltable frame="none">
21557 <tgroup cols="2" colsep="0" rowsep="0">
21558 <colspec colwidth="196pt" align="left"/>
21559 <colspec colwidth="254pt" align="left"/>
21560 <tbody>
21561 <row>
21562 <entry><option>ibase_servers</option></entry>
21563 <entry>InterBase servers</entry>
21564 </row>
21565 <row>
21566 <entry><option>ldap_ca_cert_dir</option></entry>
21567 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21568 </row>
21569 <row>
21570 <entry><option>ldap_ca_cert_file</option></entry>
21571 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21572 </row>
21573 <row>
21574 <entry><option>ldap_cert_file</option></entry>
21575 <entry>client cert file for LDAP</entry>
21576 </row>
21577 <row>
21578 <entry><option>ldap_cert_key</option></entry>
21579 <entry>client key file for LDAP</entry>
21580 </row>
21581 <row>
21582 <entry><option>ldap_cipher_suite</option></entry>
21583 <entry>TLS negotiation preference control</entry>
21584 </row>
21585 <row>
21586 <entry><option>ldap_default_servers</option></entry>
21587 <entry>used if no server in query</entry>
21588 </row>
21589 <row>
21590 <entry><option>ldap_require_cert</option></entry>
21591 <entry>action to take without LDAP server cert</entry>
21592 </row>
21593 <row>
21594 <entry><option>ldap_start_tls</option></entry>
21595 <entry>require TLS within LDAP</entry>
21596 </row>
21597 <row>
21598 <entry><option>ldap_version</option></entry>
21599 <entry>set protocol version</entry>
21600 </row>
21601 <row>
21602 <entry><option>lookup_open_max</option></entry>
21603 <entry>lookup files held open</entry>
21604 </row>
21605 <row>
21606 <entry><option>mysql_servers</option></entry>
21607 <entry>default MySQL servers</entry>
21608 </row>
21609 <row>
21610 <entry><option>oracle_servers</option></entry>
21611 <entry>Oracle servers</entry>
21612 </row>
21613 <row>
21614 <entry><option>pgsql_servers</option></entry>
21615 <entry>default PostgreSQL servers</entry>
21616 </row>
21617 <row>
21618 <entry><option>sqlite_lock_timeout</option></entry>
21619 <entry>as it says</entry>
21620 </row>
21621 </tbody>
21622 </tgroup>
21623 </informaltable>
21624 </section>
21625 <section id="SECID102">
21626 <title>Message ids</title>
21627 <informaltable frame="none">
21628 <tgroup cols="2" colsep="0" rowsep="0">
21629 <colspec colwidth="196pt" align="left"/>
21630 <colspec colwidth="254pt" align="left"/>
21631 <tbody>
21632 <row>
21633 <entry><option>message_id_header_domain</option></entry>
21634 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21635 </row>
21636 <row>
21637 <entry><option>message_id_header_text</option></entry>
21638 <entry>ditto</entry>
21639 </row>
21640 </tbody>
21641 </tgroup>
21642 </informaltable>
21643 </section>
21644 <section id="SECID103">
21645 <title>Embedded Perl Startup</title>
21646 <informaltable frame="none">
21647 <tgroup cols="2" colsep="0" rowsep="0">
21648 <colspec colwidth="196pt" align="left"/>
21649 <colspec colwidth="254pt" align="left"/>
21650 <tbody>
21651 <row>
21652 <entry><option>perl_at_start</option></entry>
21653 <entry>always start the interpreter</entry>
21654 </row>
21655 <row>
21656 <entry><option>perl_startup</option></entry>
21657 <entry>code to obey when starting Perl</entry>
21658 </row>
21659 <row>
21660 <entry><option>perl_taintmode</option></entry>
21661 <entry>enable taint mode in Perl</entry>
21662 </row>
21663 </tbody>
21664 </tgroup>
21665 </informaltable>
21666 </section>
21667 <section id="SECID104">
21668 <title>Daemon</title>
21669 <informaltable frame="none">
21670 <tgroup cols="2" colsep="0" rowsep="0">
21671 <colspec colwidth="196pt" align="left"/>
21672 <colspec colwidth="254pt" align="left"/>
21673 <tbody>
21674 <row>
21675 <entry><option>daemon_smtp_ports</option></entry>
21676 <entry>default ports</entry>
21677 </row>
21678 <row>
21679 <entry><option>daemon_startup_retries</option></entry>
21680 <entry>number of times to retry</entry>
21681 </row>
21682 <row>
21683 <entry><option>daemon_startup_sleep</option></entry>
21684 <entry>time to sleep between tries</entry>
21685 </row>
21686 <row>
21687 <entry><option>extra_local_interfaces</option></entry>
21688 <entry>not necessarily listened on</entry>
21689 </row>
21690 <row>
21691 <entry><option>local_interfaces</option></entry>
21692 <entry>on which to listen, with optional ports</entry>
21693 </row>
21694 <row>
21695 <entry><option>pid_file_path</option></entry>
21696 <entry>override compiled-in value</entry>
21697 </row>
21698 <row>
21699 <entry><option>queue_run_max</option></entry>
21700 <entry>maximum simultaneous queue runners</entry>
21701 </row>
21702 </tbody>
21703 </tgroup>
21704 </informaltable>
21705 </section>
21706 <section id="SECID105">
21707 <title>Resource control</title>
21708 <informaltable frame="none">
21709 <tgroup cols="2" colsep="0" rowsep="0">
21710 <colspec colwidth="196pt" align="left"/>
21711 <colspec colwidth="254pt" align="left"/>
21712 <tbody>
21713 <row>
21714 <entry><option>check_log_inodes</option></entry>
21715 <entry>before accepting a message</entry>
21716 </row>
21717 <row>
21718 <entry><option>check_log_space</option></entry>
21719 <entry>before accepting a message</entry>
21720 </row>
21721 <row>
21722 <entry><option>check_spool_inodes</option></entry>
21723 <entry>before accepting a message</entry>
21724 </row>
21725 <row>
21726 <entry><option>check_spool_space</option></entry>
21727 <entry>before accepting a message</entry>
21728 </row>
21729 <row>
21730 <entry><option>deliver_queue_load_max</option></entry>
21731 <entry>no queue deliveries if load high</entry>
21732 </row>
21733 <row>
21734 <entry><option>queue_only_load</option></entry>
21735 <entry>queue incoming if load high</entry>
21736 </row>
21737 <row>
21738 <entry><option>queue_only_load_latch</option></entry>
21739 <entry>don&#x2019;t re-evaluate load for each message</entry>
21740 </row>
21741 <row>
21742 <entry><option>queue_run_max</option></entry>
21743 <entry>maximum simultaneous queue runners</entry>
21744 </row>
21745 <row>
21746 <entry><option>remote_max_parallel</option></entry>
21747 <entry>parallel SMTP delivery per message</entry>
21748 </row>
21749 <row>
21750 <entry><option>smtp_accept_max</option></entry>
21751 <entry>simultaneous incoming connections</entry>
21752 </row>
21753 <row>
21754 <entry><option>smtp_accept_max_nonmail</option></entry>
21755 <entry>non-mail commands</entry>
21756 </row>
21757 <row>
21758 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21759 <entry>hosts to which the limit applies</entry>
21760 </row>
21761 <row>
21762 <entry><option>smtp_accept_max_per_connection</option></entry>
21763 <entry>messages per connection</entry>
21764 </row>
21765 <row>
21766 <entry><option>smtp_accept_max_per_host</option></entry>
21767 <entry>connections from one host</entry>
21768 </row>
21769 <row>
21770 <entry><option>smtp_accept_queue</option></entry>
21771 <entry>queue mail if more connections</entry>
21772 </row>
21773 <row>
21774 <entry><option>smtp_accept_queue_per_connection</option></entry>
21775 <entry>queue if more messages per connection</entry>
21776 </row>
21777 <row>
21778 <entry><option>smtp_accept_reserve</option></entry>
21779 <entry>only reserve hosts if more connections</entry>
21780 </row>
21781 <row>
21782 <entry><option>smtp_check_spool_space</option></entry>
21783 <entry>from SIZE on MAIL command</entry>
21784 </row>
21785 <row>
21786 <entry><option>smtp_connect_backlog</option></entry>
21787 <entry>passed to TCP/IP stack</entry>
21788 </row>
21789 <row>
21790 <entry><option>smtp_load_reserve</option></entry>
21791 <entry>SMTP from reserved hosts if load high</entry>
21792 </row>
21793 <row>
21794 <entry><option>smtp_reserve_hosts</option></entry>
21795 <entry>these are the reserve hosts</entry>
21796 </row>
21797 </tbody>
21798 </tgroup>
21799 </informaltable>
21800 </section>
21801 <section id="SECID106">
21802 <title>Policy controls</title>
21803 <informaltable frame="none">
21804 <tgroup cols="2" colsep="0" rowsep="0">
21805 <colspec colwidth="196pt" align="left"/>
21806 <colspec colwidth="254pt" align="left"/>
21807 <tbody>
21808 <row>
21809 <entry><option>acl_not_smtp</option></entry>
21810 <entry>ACL for non-SMTP messages</entry>
21811 </row>
21812 <row>
21813 <entry><option>acl_not_smtp_mime</option></entry>
21814 <entry>ACL for non-SMTP MIME parts</entry>
21815 </row>
21816 <row>
21817 <entry><option>acl_not_smtp_start</option></entry>
21818 <entry>ACL for start of non-SMTP message</entry>
21819 </row>
21820 <row>
21821 <entry><option>acl_smtp_auth</option></entry>
21822 <entry>ACL for AUTH</entry>
21823 </row>
21824 <row>
21825 <entry><option>acl_smtp_connect</option></entry>
21826 <entry>ACL for connection</entry>
21827 </row>
21828 <row>
21829 <entry><option>acl_smtp_data</option></entry>
21830 <entry>ACL for DATA</entry>
21831 </row>
21832 <row>
21833 <entry><option>acl_smtp_data_prdr</option></entry>
21834 <entry>ACL for DATA, per-recipient</entry>
21835 </row>
21836 <row>
21837 <entry><option>acl_smtp_dkim</option></entry>
21838 <entry>ACL for DKIM verification</entry>
21839 </row>
21840 <row>
21841 <entry><option>acl_smtp_etrn</option></entry>
21842 <entry>ACL for ETRN</entry>
21843 </row>
21844 <row>
21845 <entry><option>acl_smtp_expn</option></entry>
21846 <entry>ACL for EXPN</entry>
21847 </row>
21848 <row>
21849 <entry><option>acl_smtp_helo</option></entry>
21850 <entry>ACL for EHLO or HELO</entry>
21851 </row>
21852 <row>
21853 <entry><option>acl_smtp_mail</option></entry>
21854 <entry>ACL for MAIL</entry>
21855 </row>
21856 <row>
21857 <entry><option>acl_smtp_mailauth</option></entry>
21858 <entry>ACL for AUTH on MAIL command</entry>
21859 </row>
21860 <row>
21861 <entry><option>acl_smtp_mime</option></entry>
21862 <entry>ACL for MIME parts</entry>
21863 </row>
21864 <row>
21865 <entry><option>acl_smtp_notquit</option></entry>
21866 <entry>ACL for non-QUIT terminations</entry>
21867 </row>
21868 <row>
21869 <entry><option>acl_smtp_predata</option></entry>
21870 <entry>ACL for start of data</entry>
21871 </row>
21872 <row>
21873 <entry><option>acl_smtp_quit</option></entry>
21874 <entry>ACL for QUIT</entry>
21875 </row>
21876 <row>
21877 <entry><option>acl_smtp_rcpt</option></entry>
21878 <entry>ACL for RCPT</entry>
21879 </row>
21880 <row>
21881 <entry><option>acl_smtp_starttls</option></entry>
21882 <entry>ACL for STARTTLS</entry>
21883 </row>
21884 <row>
21885 <entry><option>acl_smtp_vrfy</option></entry>
21886 <entry>ACL for VRFY</entry>
21887 </row>
21888 <row>
21889 <entry><option>av_scanner</option></entry>
21890 <entry>specify virus scanner</entry>
21891 </row>
21892 <row>
21893 <entry><option>check_rfc2047_length</option></entry>
21894 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21895 </row>
21896 <row>
21897 <entry><option>dns_csa_search_limit</option></entry>
21898 <entry>control CSA parent search depth</entry>
21899 </row>
21900 <row>
21901 <entry><option>dns_csa_use_reverse</option></entry>
21902 <entry>en/disable CSA IP reverse search</entry>
21903 </row>
21904 <row>
21905 <entry><option>header_maxsize</option></entry>
21906 <entry>total size of message header</entry>
21907 </row>
21908 <row>
21909 <entry><option>header_line_maxsize</option></entry>
21910 <entry>individual header line limit</entry>
21911 </row>
21912 <row>
21913 <entry><option>helo_accept_junk_hosts</option></entry>
21914 <entry>allow syntactic junk from these hosts</entry>
21915 </row>
21916 <row>
21917 <entry><option>helo_allow_chars</option></entry>
21918 <entry>allow illegal chars in HELO names</entry>
21919 </row>
21920 <row>
21921 <entry><option>helo_lookup_domains</option></entry>
21922 <entry>lookup hostname for these HELO names</entry>
21923 </row>
21924 <row>
21925 <entry><option>helo_try_verify_hosts</option></entry>
21926 <entry>HELO soft-checked for these hosts</entry>
21927 </row>
21928 <row>
21929 <entry><option>helo_verify_hosts</option></entry>
21930 <entry>HELO hard-checked for these hosts</entry>
21931 </row>
21932 <row>
21933 <entry><option>host_lookup</option></entry>
21934 <entry>host name looked up for these hosts</entry>
21935 </row>
21936 <row>
21937 <entry><option>host_lookup_order</option></entry>
21938 <entry>order of DNS and local name lookups</entry>
21939 </row>
21940 <row>
21941 <entry><option>hosts_proxy</option></entry>
21942 <entry>use proxy protocol for these hosts</entry>
21943 </row>
21944 <row>
21945 <entry><option>host_reject_connection</option></entry>
21946 <entry>reject connection from these hosts</entry>
21947 </row>
21948 <row>
21949 <entry><option>hosts_treat_as_local</option></entry>
21950 <entry>useful in some cluster configurations</entry>
21951 </row>
21952 <row>
21953 <entry><option>local_scan_timeout</option></entry>
21954 <entry>timeout for <function>local_scan()</function></entry>
21955 </row>
21956 <row>
21957 <entry><option>message_size_limit</option></entry>
21958 <entry>for all messages</entry>
21959 </row>
21960 <row>
21961 <entry><option>percent_hack_domains</option></entry>
21962 <entry>recognize %-hack for these domains</entry>
21963 </row>
21964 <row>
21965 <entry><option>spamd_address</option></entry>
21966 <entry>set interface to SpamAssassin</entry>
21967 </row>
21968 <row>
21969 <entry><option>strict_acl_vars</option></entry>
21970 <entry>object to unset ACL variables</entry>
21971 </row>
21972 </tbody>
21973 </tgroup>
21974 </informaltable>
21975 </section>
21976 <section id="SECID107">
21977 <title>Callout cache</title>
21978 <informaltable frame="none">
21979 <tgroup cols="2" colsep="0" rowsep="0">
21980 <colspec colwidth="196pt" align="left"/>
21981 <colspec colwidth="254pt" align="left"/>
21982 <tbody>
21983 <row>
21984 <entry><option>callout_domain_negative_expire</option></entry>
21985 <entry>timeout for negative domain cache item</entry>
21986 </row>
21987 <row>
21988 <entry><option>callout_domain_positive_expire</option></entry>
21989 <entry>timeout for positive domain cache item</entry>
21990 </row>
21991 <row>
21992 <entry><option>callout_negative_expire</option></entry>
21993 <entry>timeout for negative address cache item</entry>
21994 </row>
21995 <row>
21996 <entry><option>callout_positive_expire</option></entry>
21997 <entry>timeout for positive address cache item</entry>
21998 </row>
21999 <row>
22000 <entry><option>callout_random_local_part</option></entry>
22001 <entry>string to use for <quote>random</quote> testing</entry>
22002 </row>
22003 </tbody>
22004 </tgroup>
22005 </informaltable>
22006 </section>
22007 <section id="SECID108">
22008 <title>TLS</title>
22009 <informaltable frame="none">
22010 <tgroup cols="2" colsep="0" rowsep="0">
22011 <colspec colwidth="196pt" align="left"/>
22012 <colspec colwidth="254pt" align="left"/>
22013 <tbody>
22014 <row>
22015 <entry><option>gnutls_compat_mode</option></entry>
22016 <entry>use GnuTLS compatibility mode</entry>
22017 </row>
22018 <row>
22019 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
22020 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
22021 </row>
22022 <row>
22023 <entry><option>openssl_options</option></entry>
22024 <entry>adjust OpenSSL compatibility options</entry>
22025 </row>
22026 <row>
22027 <entry><option>tls_advertise_hosts</option></entry>
22028 <entry>advertise TLS to these hosts</entry>
22029 </row>
22030 <row>
22031 <entry><option>tls_certificate</option></entry>
22032 <entry>location of server certificate</entry>
22033 </row>
22034 <row>
22035 <entry><option>tls_crl</option></entry>
22036 <entry>certificate revocation list</entry>
22037 </row>
22038 <row>
22039 <entry><option>tls_dh_max_bits</option></entry>
22040 <entry>clamp D-H bit count suggestion</entry>
22041 </row>
22042 <row>
22043 <entry><option>tls_dhparam</option></entry>
22044 <entry>DH parameters for server</entry>
22045 </row>
22046 <row>
22047 <entry><option>tls_eccurve</option></entry>
22048 <entry>EC curve selection for server</entry>
22049 </row>
22050 <row>
22051 <entry><option>tls_ocsp_file</option></entry>
22052 <entry>location of server certificate status proof</entry>
22053 </row>
22054 <row>
22055 <entry><option>tls_on_connect_ports</option></entry>
22056 <entry>specify SSMTP (SMTPS) ports</entry>
22057 </row>
22058 <row>
22059 <entry><option>tls_privatekey</option></entry>
22060 <entry>location of server private key</entry>
22061 </row>
22062 <row>
22063 <entry><option>tls_remember_esmtp</option></entry>
22064 <entry>don&#x2019;t reset after starting TLS</entry>
22065 </row>
22066 <row>
22067 <entry><option>tls_require_ciphers</option></entry>
22068 <entry>specify acceptable ciphers</entry>
22069 </row>
22070 <row>
22071 <entry><option>tls_try_verify_hosts</option></entry>
22072 <entry>try to verify client certificate</entry>
22073 </row>
22074 <row>
22075 <entry><option>tls_verify_certificates</option></entry>
22076 <entry>expected client certificates</entry>
22077 </row>
22078 <row>
22079 <entry><option>tls_verify_hosts</option></entry>
22080 <entry>insist on client certificate verify</entry>
22081 </row>
22082 </tbody>
22083 </tgroup>
22084 </informaltable>
22085 </section>
22086 <section id="SECID109">
22087 <title>Local user handling</title>
22088 <informaltable frame="none">
22089 <tgroup cols="2" colsep="0" rowsep="0">
22090 <colspec colwidth="196pt" align="left"/>
22091 <colspec colwidth="254pt" align="left"/>
22092 <tbody>
22093 <row>
22094 <entry><option>finduser_retries</option></entry>
22095 <entry>useful in NIS environments</entry>
22096 </row>
22097 <row>
22098 <entry><option>gecos_name</option></entry>
22099 <entry>used when creating <emphasis>Sender:</emphasis></entry>
22100 </row>
22101 <row>
22102 <entry><option>gecos_pattern</option></entry>
22103 <entry>ditto</entry>
22104 </row>
22105 <row>
22106 <entry><option>max_username_length</option></entry>
22107 <entry>for systems that truncate</entry>
22108 </row>
22109 <row>
22110 <entry><option>unknown_login</option></entry>
22111 <entry>used when no login name found</entry>
22112 </row>
22113 <row>
22114 <entry><option>unknown_username</option></entry>
22115 <entry>ditto</entry>
22116 </row>
22117 <row>
22118 <entry><option>uucp_from_pattern</option></entry>
22119 <entry>for recognizing <quote>From </quote> lines</entry>
22120 </row>
22121 <row>
22122 <entry><option>uucp_from_sender</option></entry>
22123 <entry>ditto</entry>
22124 </row>
22125 </tbody>
22126 </tgroup>
22127 </informaltable>
22128 </section>
22129 <section id="SECID110">
22130 <title>All incoming messages (SMTP and non-SMTP)</title>
22131 <informaltable frame="none">
22132 <tgroup cols="2" colsep="0" rowsep="0">
22133 <colspec colwidth="196pt" align="left"/>
22134 <colspec colwidth="254pt" align="left"/>
22135 <tbody>
22136 <row>
22137 <entry><option>header_maxsize</option></entry>
22138 <entry>total size of message header</entry>
22139 </row>
22140 <row>
22141 <entry><option>header_line_maxsize</option></entry>
22142 <entry>individual header line limit</entry>
22143 </row>
22144 <row>
22145 <entry><option>message_size_limit</option></entry>
22146 <entry>applies to all messages</entry>
22147 </row>
22148 <row>
22149 <entry><option>percent_hack_domains</option></entry>
22150 <entry>recognize %-hack for these domains</entry>
22151 </row>
22152 <row>
22153 <entry><option>received_header_text</option></entry>
22154 <entry>expanded to make <emphasis>Received:</emphasis></entry>
22155 </row>
22156 <row>
22157 <entry><option>received_headers_max</option></entry>
22158 <entry>for mail loop detection</entry>
22159 </row>
22160 <row>
22161 <entry><option>recipients_max</option></entry>
22162 <entry>limit per message</entry>
22163 </row>
22164 <row>
22165 <entry><option>recipients_max_reject</option></entry>
22166 <entry>permanently reject excess recipients</entry>
22167 </row>
22168 </tbody>
22169 </tgroup>
22170 </informaltable>
22171 </section>
22172 <section id="SECID111">
22173 <title>Non-SMTP incoming messages</title>
22174 <informaltable frame="none">
22175 <tgroup cols="2" colsep="0" rowsep="0">
22176 <colspec colwidth="196pt" align="left"/>
22177 <colspec colwidth="254pt" align="left"/>
22178 <tbody>
22179 <row>
22180 <entry><option>receive_timeout</option></entry>
22181 <entry>for non-SMTP messages</entry>
22182 </row>
22183 </tbody>
22184 </tgroup>
22185 </informaltable>
22186 </section>
22187 <section id="SECID112">
22188 <title>Incoming SMTP messages</title>
22189 <para>
22190 See also the <emphasis>Policy controls</emphasis> section above.
22191 </para>
22192 <informaltable frame="none">
22193 <tgroup cols="2" colsep="0" rowsep="0">
22194 <colspec colwidth="196pt" align="left"/>
22195 <colspec colwidth="254pt" align="left"/>
22196 <tbody>
22197 <row>
22198 <entry><option>dkim_verify_signers</option></entry>
22199 <entry>DKIM domain for which DKIM ACL is run</entry>
22200 </row>
22201 <row>
22202 <entry><option>host_lookup</option></entry>
22203 <entry>host name looked up for these hosts</entry>
22204 </row>
22205 <row>
22206 <entry><option>host_lookup_order</option></entry>
22207 <entry>order of DNS and local name lookups</entry>
22208 </row>
22209 <row>
22210 <entry><option>recipient_unqualified_hosts</option></entry>
22211 <entry>may send unqualified recipients</entry>
22212 </row>
22213 <row>
22214 <entry><option>rfc1413_hosts</option></entry>
22215 <entry>make ident calls to these hosts</entry>
22216 </row>
22217 <row>
22218 <entry><option>rfc1413_query_timeout</option></entry>
22219 <entry>zero disables ident calls</entry>
22220 </row>
22221 <row>
22222 <entry><option>sender_unqualified_hosts</option></entry>
22223 <entry>may send unqualified senders</entry>
22224 </row>
22225 <row>
22226 <entry><option>smtp_accept_keepalive</option></entry>
22227 <entry>some TCP/IP magic</entry>
22228 </row>
22229 <row>
22230 <entry><option>smtp_accept_max</option></entry>
22231 <entry>simultaneous incoming connections</entry>
22232 </row>
22233 <row>
22234 <entry><option>smtp_accept_max_nonmail</option></entry>
22235 <entry>non-mail commands</entry>
22236 </row>
22237 <row>
22238 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22239 <entry>hosts to which the limit applies</entry>
22240 </row>
22241 <row>
22242 <entry><option>smtp_accept_max_per_connection</option></entry>
22243 <entry>messages per connection</entry>
22244 </row>
22245 <row>
22246 <entry><option>smtp_accept_max_per_host</option></entry>
22247 <entry>connections from one host</entry>
22248 </row>
22249 <row>
22250 <entry><option>smtp_accept_queue</option></entry>
22251 <entry>queue mail if more connections</entry>
22252 </row>
22253 <row>
22254 <entry><option>smtp_accept_queue_per_connection</option></entry>
22255 <entry>queue if more messages per connection</entry>
22256 </row>
22257 <row>
22258 <entry><option>smtp_accept_reserve</option></entry>
22259 <entry>only reserve hosts if more connections</entry>
22260 </row>
22261 <row>
22262 <entry><option>smtp_active_hostname</option></entry>
22263 <entry>host name to use in messages</entry>
22264 </row>
22265 <row>
22266 <entry><option>smtp_banner</option></entry>
22267 <entry>text for welcome banner</entry>
22268 </row>
22269 <row>
22270 <entry><option>smtp_check_spool_space</option></entry>
22271 <entry>from SIZE on MAIL command</entry>
22272 </row>
22273 <row>
22274 <entry><option>smtp_connect_backlog</option></entry>
22275 <entry>passed to TCP/IP stack</entry>
22276 </row>
22277 <row>
22278 <entry><option>smtp_enforce_sync</option></entry>
22279 <entry>of SMTP command/responses</entry>
22280 </row>
22281 <row>
22282 <entry><option>smtp_etrn_command</option></entry>
22283 <entry>what to run for ETRN</entry>
22284 </row>
22285 <row>
22286 <entry><option>smtp_etrn_serialize</option></entry>
22287 <entry>only one at once</entry>
22288 </row>
22289 <row>
22290 <entry><option>smtp_load_reserve</option></entry>
22291 <entry>only reserve hosts if this load</entry>
22292 </row>
22293 <row>
22294 <entry><option>smtp_max_unknown_commands</option></entry>
22295 <entry>before dropping connection</entry>
22296 </row>
22297 <row>
22298 <entry><option>smtp_ratelimit_hosts</option></entry>
22299 <entry>apply ratelimiting to these hosts</entry>
22300 </row>
22301 <row>
22302 <entry><option>smtp_ratelimit_mail</option></entry>
22303 <entry>ratelimit for MAIL commands</entry>
22304 </row>
22305 <row>
22306 <entry><option>smtp_ratelimit_rcpt</option></entry>
22307 <entry>ratelimit for RCPT commands</entry>
22308 </row>
22309 <row>
22310 <entry><option>smtp_receive_timeout</option></entry>
22311 <entry>per command or data line</entry>
22312 </row>
22313 <row>
22314 <entry><option>smtp_reserve_hosts</option></entry>
22315 <entry>these are the reserve hosts</entry>
22316 </row>
22317 <row>
22318 <entry><option>smtp_return_error_details</option></entry>
22319 <entry>give detail on rejections</entry>
22320 </row>
22321 </tbody>
22322 </tgroup>
22323 </informaltable>
22324 </section>
22325 <section id="SECID113">
22326 <title>SMTP extensions</title>
22327 <informaltable frame="none">
22328 <tgroup cols="2" colsep="0" rowsep="0">
22329 <colspec colwidth="196pt" align="left"/>
22330 <colspec colwidth="254pt" align="left"/>
22331 <tbody>
22332 <row>
22333 <entry><option>accept_8bitmime</option></entry>
22334 <entry>advertise 8BITMIME</entry>
22335 </row>
22336 <row>
22337 <entry><option>auth_advertise_hosts</option></entry>
22338 <entry>advertise AUTH to these hosts</entry>
22339 </row>
22340 <row>
22341 <entry><option>chunking_advertise_hosts</option></entry>
22342 <entry>advertise CHUNKING to these hosts</entry>
22343 </row>
22344 <row>
22345 <entry><option>dsn_advertise_hosts</option></entry>
22346 <entry>advertise DSN extensions to these hosts</entry>
22347 </row>
22348 <row>
22349 <entry><option>ignore_fromline_hosts</option></entry>
22350 <entry>allow <quote>From </quote> from these hosts</entry>
22351 </row>
22352 <row>
22353 <entry><option>ignore_fromline_local</option></entry>
22354 <entry>allow <quote>From </quote> from local SMTP</entry>
22355 </row>
22356 <row>
22357 <entry><option>pipelining_advertise_hosts</option></entry>
22358 <entry>advertise pipelining to these hosts</entry>
22359 </row>
22360 <row>
22361 <entry><option>prdr_enable</option></entry>
22362 <entry>advertise PRDR to all hosts</entry>
22363 </row>
22364 <row>
22365 <entry><option>smtputf8_advertise_hosts</option></entry>
22366 <entry>advertise SMTPUTF8 to these hosts</entry>
22367 </row>
22368 <row>
22369 <entry><option>tls_advertise_hosts</option></entry>
22370 <entry>advertise TLS to these hosts</entry>
22371 </row>
22372 </tbody>
22373 </tgroup>
22374 </informaltable>
22375 </section>
22376 <section id="SECID114">
22377 <title>Processing messages</title>
22378 <informaltable frame="none">
22379 <tgroup cols="2" colsep="0" rowsep="0">
22380 <colspec colwidth="196pt" align="left"/>
22381 <colspec colwidth="254pt" align="left"/>
22382 <tbody>
22383 <row>
22384 <entry><option>allow_domain_literals</option></entry>
22385 <entry>recognize domain literal syntax</entry>
22386 </row>
22387 <row>
22388 <entry><option>allow_mx_to_ip</option></entry>
22389 <entry>allow MX to point to IP address</entry>
22390 </row>
22391 <row>
22392 <entry><option>allow_utf8_domains</option></entry>
22393 <entry>in addresses</entry>
22394 </row>
22395 <row>
22396 <entry><option>check_rfc2047_length</option></entry>
22397 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22398 </row>
22399 <row>
22400 <entry><option>delivery_date_remove</option></entry>
22401 <entry>from incoming messages</entry>
22402 </row>
22403 <row>
22404 <entry><option>envelope_to_remove</option></entry>
22405 <entry>from incoming messages</entry>
22406 </row>
22407 <row>
22408 <entry><option>extract_addresses_remove_arguments</option></entry>
22409 <entry>affects <option>-t</option> processing</entry>
22410 </row>
22411 <row>
22412 <entry><option>headers_charset</option></entry>
22413 <entry>default for translations</entry>
22414 </row>
22415 <row>
22416 <entry><option>qualify_domain</option></entry>
22417 <entry>default for senders</entry>
22418 </row>
22419 <row>
22420 <entry><option>qualify_recipient</option></entry>
22421 <entry>default for recipients</entry>
22422 </row>
22423 <row>
22424 <entry><option>return_path_remove</option></entry>
22425 <entry>from incoming messages</entry>
22426 </row>
22427 <row>
22428 <entry><option>strip_excess_angle_brackets</option></entry>
22429 <entry>in addresses</entry>
22430 </row>
22431 <row>
22432 <entry><option>strip_trailing_dot</option></entry>
22433 <entry>at end of addresses</entry>
22434 </row>
22435 <row>
22436 <entry><option>untrusted_set_sender</option></entry>
22437 <entry>untrusted can set envelope sender</entry>
22438 </row>
22439 </tbody>
22440 </tgroup>
22441 </informaltable>
22442 </section>
22443 <section id="SECID115">
22444 <title>System filter</title>
22445 <informaltable frame="none">
22446 <tgroup cols="2" colsep="0" rowsep="0">
22447 <colspec colwidth="196pt" align="left"/>
22448 <colspec colwidth="254pt" align="left"/>
22449 <tbody>
22450 <row>
22451 <entry><option>system_filter</option></entry>
22452 <entry>locate system filter</entry>
22453 </row>
22454 <row>
22455 <entry><option>system_filter_directory_transport</option></entry>
22456 <entry>transport for delivery to a directory</entry>
22457 </row>
22458 <row>
22459 <entry><option>system_filter_file_transport</option></entry>
22460 <entry>transport for delivery to a file</entry>
22461 </row>
22462 <row>
22463 <entry><option>system_filter_group</option></entry>
22464 <entry>group for filter running</entry>
22465 </row>
22466 <row>
22467 <entry><option>system_filter_pipe_transport</option></entry>
22468 <entry>transport for delivery to a pipe</entry>
22469 </row>
22470 <row>
22471 <entry><option>system_filter_reply_transport</option></entry>
22472 <entry>transport for autoreply delivery</entry>
22473 </row>
22474 <row>
22475 <entry><option>system_filter_user</option></entry>
22476 <entry>user for filter running</entry>
22477 </row>
22478 </tbody>
22479 </tgroup>
22480 </informaltable>
22481 </section>
22482 <section id="SECID116">
22483 <title>Routing and delivery</title>
22484 <informaltable frame="none">
22485 <tgroup cols="2" colsep="0" rowsep="0">
22486 <colspec colwidth="196pt" align="left"/>
22487 <colspec colwidth="254pt" align="left"/>
22488 <tbody>
22489 <row>
22490 <entry><option>disable_ipv6</option></entry>
22491 <entry>do no IPv6 processing</entry>
22492 </row>
22493 <row>
22494 <entry><option>dns_again_means_nonexist</option></entry>
22495 <entry>for broken domains</entry>
22496 </row>
22497 <row>
22498 <entry><option>dns_check_names_pattern</option></entry>
22499 <entry>pre-DNS syntax check</entry>
22500 </row>
22501 <row>
22502 <entry><option>dns_dnssec_ok</option></entry>
22503 <entry>parameter for resolver</entry>
22504 </row>
22505 <row>
22506 <entry><option>dns_ipv4_lookup</option></entry>
22507 <entry>only v4 lookup for these domains</entry>
22508 </row>
22509 <row>
22510 <entry><option>dns_retrans</option></entry>
22511 <entry>parameter for resolver</entry>
22512 </row>
22513 <row>
22514 <entry><option>dns_retry</option></entry>
22515 <entry>parameter for resolver</entry>
22516 </row>
22517 <row>
22518 <entry><option>dns_trust_aa</option></entry>
22519 <entry>DNS zones trusted as authentic</entry>
22520 </row>
22521 <row>
22522 <entry><option>dns_use_edns0</option></entry>
22523 <entry>parameter for resolver</entry>
22524 </row>
22525 <row>
22526 <entry><option>hold_domains</option></entry>
22527 <entry>hold delivery for these domains</entry>
22528 </row>
22529 <row>
22530 <entry><option>local_interfaces</option></entry>
22531 <entry>for routing checks</entry>
22532 </row>
22533 <row>
22534 <entry><option>queue_domains</option></entry>
22535 <entry>no immediate delivery for these</entry>
22536 </row>
22537 <row>
22538 <entry><option>queue_only</option></entry>
22539 <entry>no immediate delivery at all</entry>
22540 </row>
22541 <row>
22542 <entry><option>queue_only_file</option></entry>
22543 <entry>no immediate delivery if file exists</entry>
22544 </row>
22545 <row>
22546 <entry><option>queue_only_load</option></entry>
22547 <entry>no immediate delivery if load is high</entry>
22548 </row>
22549 <row>
22550 <entry><option>queue_only_load_latch</option></entry>
22551 <entry>don&#x2019;t re-evaluate load for each message</entry>
22552 </row>
22553 <row>
22554 <entry><option>queue_only_override</option></entry>
22555 <entry>allow command line to override</entry>
22556 </row>
22557 <row>
22558 <entry><option>queue_run_in_order</option></entry>
22559 <entry>order of arrival</entry>
22560 </row>
22561 <row>
22562 <entry><option>queue_run_max</option></entry>
22563 <entry>of simultaneous queue runners</entry>
22564 </row>
22565 <row>
22566 <entry><option>queue_smtp_domains</option></entry>
22567 <entry>no immediate SMTP delivery for these</entry>
22568 </row>
22569 <row>
22570 <entry><option>remote_max_parallel</option></entry>
22571 <entry>parallel SMTP delivery per message</entry>
22572 </row>
22573 <row>
22574 <entry><option>remote_sort_domains</option></entry>
22575 <entry>order of remote deliveries</entry>
22576 </row>
22577 <row>
22578 <entry><option>retry_data_expire</option></entry>
22579 <entry>timeout for retry data</entry>
22580 </row>
22581 <row>
22582 <entry><option>retry_interval_max</option></entry>
22583 <entry>safety net for retry rules</entry>
22584 </row>
22585 </tbody>
22586 </tgroup>
22587 </informaltable>
22588 </section>
22589 <section id="SECID117">
22590 <title>Bounce and warning messages</title>
22591 <informaltable frame="none">
22592 <tgroup cols="2" colsep="0" rowsep="0">
22593 <colspec colwidth="196pt" align="left"/>
22594 <colspec colwidth="254pt" align="left"/>
22595 <tbody>
22596 <row>
22597 <entry><option>bounce_message_file</option></entry>
22598 <entry>content of bounce</entry>
22599 </row>
22600 <row>
22601 <entry><option>bounce_message_text</option></entry>
22602 <entry>content of bounce</entry>
22603 </row>
22604 <row>
22605 <entry><option>bounce_return_body</option></entry>
22606 <entry>include body if returning message</entry>
22607 </row>
22608 <row>
22609 <entry><option>bounce_return_linesize_limit</option></entry>
22610 <entry>limit on returned message line length</entry>
22611 </row>
22612 <row>
22613 <entry><option>bounce_return_message</option></entry>
22614 <entry>include original message in bounce</entry>
22615 </row>
22616 <row>
22617 <entry><option>bounce_return_size_limit</option></entry>
22618 <entry>limit on returned message</entry>
22619 </row>
22620 <row>
22621 <entry><option>bounce_sender_authentication</option></entry>
22622 <entry>send authenticated sender with bounce</entry>
22623 </row>
22624 <row>
22625 <entry><option>dsn_from</option></entry>
22626 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22627 </row>
22628 <row>
22629 <entry><option>errors_copy</option></entry>
22630 <entry>copy bounce messages</entry>
22631 </row>
22632 <row>
22633 <entry><option>errors_reply_to</option></entry>
22634 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22635 </row>
22636 <row>
22637 <entry><option>delay_warning</option></entry>
22638 <entry>time schedule</entry>
22639 </row>
22640 <row>
22641 <entry><option>delay_warning_condition</option></entry>
22642 <entry>condition for warning messages</entry>
22643 </row>
22644 <row>
22645 <entry><option>ignore_bounce_errors_after</option></entry>
22646 <entry>discard undeliverable bounces</entry>
22647 </row>
22648 <row>
22649 <entry><option>smtp_return_error_details</option></entry>
22650 <entry>give detail on rejections</entry>
22651 </row>
22652 <row>
22653 <entry><option>warn_message_file</option></entry>
22654 <entry>content of warning message</entry>
22655 </row>
22656 </tbody>
22657 </tgroup>
22658 </informaltable>
22659 </section>
22660 <section id="SECTalomo">
22661 <title>Alphabetical list of main options</title>
22662 <para>
22663 Those options that undergo string expansion before use are marked with
22664 &dagger;.
22665 </para>
22666 <para>
22667 <indexterm role="option">
22668 <primary><option>accept_8bitmime</option></primary>
22669 </indexterm>
22670 </para>
22671 <informaltable frame="all">
22672 <tgroup cols="4" colsep="0" rowsep="0">
22673 <colspec colwidth="8*" align="left"/>
22674 <colspec colwidth="6*" align="center"/>
22675 <colspec colwidth="6*" align="center"/>
22676 <colspec colwidth="6*" align="right"/>
22677 <tbody>
22678 <row>
22679 <entry><option>accept_8bitmime</option></entry>
22680 <entry>Use: <emphasis>main</emphasis></entry>
22681 <entry>Type: <emphasis>boolean</emphasis></entry>
22682 <entry>Default: <emphasis>true</emphasis></entry>
22683 </row>
22684 </tbody>
22685 </tgroup>
22686 </informaltable>
22687 <para>
22688 <indexterm role="concept">
22689 <primary>8BITMIME</primary>
22690 </indexterm>
22691 <indexterm role="concept">
22692 <primary>8-bit characters</primary>
22693 </indexterm>
22694 <indexterm role="concept">
22695 <primary>log</primary>
22696 <secondary>selectors</secondary>
22697 </indexterm>
22698 <indexterm role="concept">
22699 <primary>log</primary>
22700 <secondary>8BITMIME</secondary>
22701 </indexterm>
22702 This option causes Exim to send 8BITMIME in its response to an SMTP
22703 EHLO command, and to accept the BODY= parameter on MAIL commands.
22704 However, though Exim is 8-bit clean, it is not a protocol converter, and it
22705 takes no steps to do anything special with messages received by this route.
22706 </para>
22707 <para>
22708 Historically Exim kept this option off by default, but the maintainers
22709 feel that in today&#x2019;s Internet, this causes more problems than it solves.
22710 It now defaults to true.
22711 A more detailed analysis of the issues is provided by Dan Bernstein:
22712 </para>
22713 <literallayout>
22714 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
22715 </literallayout>
22716 <para>
22717 To log received 8BITMIME status use
22718 </para>
22719 <literallayout class="monospaced">
22720 log_selector = +8bitmime
22721 </literallayout>
22722 <para>
22723 <indexterm role="option">
22724 <primary><option>acl_not_smtp</option></primary>
22725 </indexterm>
22726 </para>
22727 <informaltable frame="all">
22728 <tgroup cols="4" colsep="0" rowsep="0">
22729 <colspec colwidth="8*" align="left"/>
22730 <colspec colwidth="6*" align="center"/>
22731 <colspec colwidth="6*" align="center"/>
22732 <colspec colwidth="6*" align="right"/>
22733 <tbody>
22734 <row>
22735 <entry><option>acl_not_smtp</option></entry>
22736 <entry>Use: <emphasis>main</emphasis></entry>
22737 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22738 <entry>Default: <emphasis>unset</emphasis></entry>
22739 </row>
22740 </tbody>
22741 </tgroup>
22742 </informaltable>
22743 <para>
22744 <indexterm role="concept">
22745 <primary>access control lists (ACLs)</primary>
22746 <secondary>for non-SMTP messages</secondary>
22747 </indexterm>
22748 <indexterm role="concept">
22749 <primary>non-SMTP messages</primary>
22750 <secondary>ACLs for</secondary>
22751 </indexterm>
22752 This option defines the ACL that is run when a non-SMTP message has been
22753 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
22754 further details.
22755 </para>
22756 <para>
22757 <indexterm role="option">
22758 <primary><option>acl_not_smtp_mime</option></primary>
22759 </indexterm>
22760 </para>
22761 <informaltable frame="all">
22762 <tgroup cols="4" colsep="0" rowsep="0">
22763 <colspec colwidth="8*" align="left"/>
22764 <colspec colwidth="6*" align="center"/>
22765 <colspec colwidth="6*" align="center"/>
22766 <colspec colwidth="6*" align="right"/>
22767 <tbody>
22768 <row>
22769 <entry><option>acl_not_smtp_mime</option></entry>
22770 <entry>Use: <emphasis>main</emphasis></entry>
22771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22772 <entry>Default: <emphasis>unset</emphasis></entry>
22773 </row>
22774 </tbody>
22775 </tgroup>
22776 </informaltable>
22777 <para>
22778 This option defines the ACL that is run for individual MIME parts of non-SMTP
22779 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
22780 SMTP messages.
22781 </para>
22782 <para>
22783 <indexterm role="option">
22784 <primary><option>acl_not_smtp_start</option></primary>
22785 </indexterm>
22786 </para>
22787 <informaltable frame="all">
22788 <tgroup cols="4" colsep="0" rowsep="0">
22789 <colspec colwidth="8*" align="left"/>
22790 <colspec colwidth="6*" align="center"/>
22791 <colspec colwidth="6*" align="center"/>
22792 <colspec colwidth="6*" align="right"/>
22793 <tbody>
22794 <row>
22795 <entry><option>acl_not_smtp_start</option></entry>
22796 <entry>Use: <emphasis>main</emphasis></entry>
22797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22798 <entry>Default: <emphasis>unset</emphasis></entry>
22799 </row>
22800 </tbody>
22801 </tgroup>
22802 </informaltable>
22803 <para>
22804 <indexterm role="concept">
22805 <primary>access control lists (ACLs)</primary>
22806 <secondary>at start of non-SMTP message</secondary>
22807 </indexterm>
22808 <indexterm role="concept">
22809 <primary>non-SMTP messages</primary>
22810 <secondary>ACLs for</secondary>
22811 </indexterm>
22812 This option defines the ACL that is run before Exim starts reading a
22813 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
22814 </para>
22815 <para>
22816 <indexterm role="option">
22817 <primary><option>acl_smtp_auth</option></primary>
22818 </indexterm>
22819 </para>
22820 <informaltable frame="all">
22821 <tgroup cols="4" colsep="0" rowsep="0">
22822 <colspec colwidth="8*" align="left"/>
22823 <colspec colwidth="6*" align="center"/>
22824 <colspec colwidth="6*" align="center"/>
22825 <colspec colwidth="6*" align="right"/>
22826 <tbody>
22827 <row>
22828 <entry><option>acl_smtp_auth</option></entry>
22829 <entry>Use: <emphasis>main</emphasis></entry>
22830 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22831 <entry>Default: <emphasis>unset</emphasis></entry>
22832 </row>
22833 </tbody>
22834 </tgroup>
22835 </informaltable>
22836 <para>
22837 <indexterm role="concept">
22838 <primary>access control lists (ACLs)</primary>
22839 <secondary>setting up for SMTP commands</secondary>
22840 </indexterm>
22841 <indexterm role="concept">
22842 <primary>AUTH</primary>
22843 <secondary>ACL for</secondary>
22844 </indexterm>
22845 This option defines the ACL that is run when an SMTP AUTH command is
22846 received. See chapter <xref linkend="CHAPACL"/> for further details.
22847 </para>
22848 <para>
22849 <indexterm role="option">
22850 <primary><option>acl_smtp_connect</option></primary>
22851 </indexterm>
22852 </para>
22853 <informaltable frame="all">
22854 <tgroup cols="4" colsep="0" rowsep="0">
22855 <colspec colwidth="8*" align="left"/>
22856 <colspec colwidth="6*" align="center"/>
22857 <colspec colwidth="6*" align="center"/>
22858 <colspec colwidth="6*" align="right"/>
22859 <tbody>
22860 <row>
22861 <entry><option>acl_smtp_connect</option></entry>
22862 <entry>Use: <emphasis>main</emphasis></entry>
22863 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22864 <entry>Default: <emphasis>unset</emphasis></entry>
22865 </row>
22866 </tbody>
22867 </tgroup>
22868 </informaltable>
22869 <para>
22870 <indexterm role="concept">
22871 <primary>access control lists (ACLs)</primary>
22872 <secondary>on SMTP connection</secondary>
22873 </indexterm>
22874 This option defines the ACL that is run when an SMTP connection is received.
22875 See chapter <xref linkend="CHAPACL"/> for further details.
22876 </para>
22877 <para>
22878 <indexterm role="option">
22879 <primary><option>acl_smtp_data</option></primary>
22880 </indexterm>
22881 </para>
22882 <informaltable frame="all">
22883 <tgroup cols="4" colsep="0" rowsep="0">
22884 <colspec colwidth="8*" align="left"/>
22885 <colspec colwidth="6*" align="center"/>
22886 <colspec colwidth="6*" align="center"/>
22887 <colspec colwidth="6*" align="right"/>
22888 <tbody>
22889 <row>
22890 <entry><option>acl_smtp_data</option></entry>
22891 <entry>Use: <emphasis>main</emphasis></entry>
22892 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22893 <entry>Default: <emphasis>unset</emphasis></entry>
22894 </row>
22895 </tbody>
22896 </tgroup>
22897 </informaltable>
22898 <para>
22899 <indexterm role="concept">
22900 <primary>DATA</primary>
22901 <secondary>ACL for</secondary>
22902 </indexterm>
22903 This option defines the ACL that is run after an SMTP DATA command has been
22904 processed and the message itself has been received, but before the final
22905 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22906 </para>
22907 <para>
22908 <indexterm role="option">
22909 <primary><option>acl_smtp_data_prdr</option></primary>
22910 </indexterm>
22911 </para>
22912 <informaltable frame="all">
22913 <tgroup cols="4" colsep="0" rowsep="0">
22914 <colspec colwidth="8*" align="left"/>
22915 <colspec colwidth="6*" align="center"/>
22916 <colspec colwidth="6*" align="center"/>
22917 <colspec colwidth="6*" align="right"/>
22918 <tbody>
22919 <row>
22920 <entry><option>acl_smtp_data_prdr</option></entry>
22921 <entry>Use: <emphasis>main</emphasis></entry>
22922 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22923 <entry>Default: <emphasis>accept</emphasis></entry>
22924 </row>
22925 </tbody>
22926 </tgroup>
22927 </informaltable>
22928 <para>
22929 <indexterm role="concept">
22930 <primary>PRDR</primary>
22931 <secondary>ACL for</secondary>
22932 </indexterm>
22933 <indexterm role="concept">
22934 <primary>DATA</primary>
22935 <secondary>PRDR ACL for</secondary>
22936 </indexterm>
22937 <indexterm role="concept">
22938 <primary>access control lists (ACLs)</primary>
22939 <secondary>PRDR-related</secondary>
22940 </indexterm>
22941 <indexterm role="concept">
22942 <primary>access control lists (ACLs)</primary>
22943 <secondary>per-user data processing</secondary>
22944 </indexterm>
22945 This option defines the ACL that,
22946 if the PRDR feature has been negotiated,
22947 is run for each recipient after an SMTP DATA command has been
22948 processed and the message itself has been received, but before the
22949 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22950 </para>
22951 <para>
22952 <indexterm role="option">
22953 <primary><option>acl_smtp_dkim</option></primary>
22954 </indexterm>
22955 </para>
22956 <informaltable frame="all">
22957 <tgroup cols="4" colsep="0" rowsep="0">
22958 <colspec colwidth="8*" align="left"/>
22959 <colspec colwidth="6*" align="center"/>
22960 <colspec colwidth="6*" align="center"/>
22961 <colspec colwidth="6*" align="right"/>
22962 <tbody>
22963 <row>
22964 <entry><option>acl_smtp_dkim</option></entry>
22965 <entry>Use: <emphasis>main</emphasis></entry>
22966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22967 <entry>Default: <emphasis>unset</emphasis></entry>
22968 </row>
22969 </tbody>
22970 </tgroup>
22971 </informaltable>
22972 <para>
22973 <indexterm role="concept">
22974 <primary>DKIM</primary>
22975 <secondary>ACL for</secondary>
22976 </indexterm>
22977 This option defines the ACL that is run for each DKIM signature
22978 (by default, or as specified in the dkim_verify_signers option)
22979 of a received message.
22980 See section <xref linkend="SECDKIMVFY"/> for further details.
22981 </para>
22982 <para>
22983 <indexterm role="option">
22984 <primary><option>acl_smtp_etrn</option></primary>
22985 </indexterm>
22986 </para>
22987 <informaltable frame="all">
22988 <tgroup cols="4" colsep="0" rowsep="0">
22989 <colspec colwidth="8*" align="left"/>
22990 <colspec colwidth="6*" align="center"/>
22991 <colspec colwidth="6*" align="center"/>
22992 <colspec colwidth="6*" align="right"/>
22993 <tbody>
22994 <row>
22995 <entry><option>acl_smtp_etrn</option></entry>
22996 <entry>Use: <emphasis>main</emphasis></entry>
22997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22998 <entry>Default: <emphasis>unset</emphasis></entry>
22999 </row>
23000 </tbody>
23001 </tgroup>
23002 </informaltable>
23003 <para>
23004 <indexterm role="concept">
23005 <primary>ETRN</primary>
23006 <secondary>ACL for</secondary>
23007 </indexterm>
23008 This option defines the ACL that is run when an SMTP ETRN command is
23009 received. See chapter <xref linkend="CHAPACL"/> for further details.
23010 </para>
23011 <para>
23012 <indexterm role="option">
23013 <primary><option>acl_smtp_expn</option></primary>
23014 </indexterm>
23015 </para>
23016 <informaltable frame="all">
23017 <tgroup cols="4" colsep="0" rowsep="0">
23018 <colspec colwidth="8*" align="left"/>
23019 <colspec colwidth="6*" align="center"/>
23020 <colspec colwidth="6*" align="center"/>
23021 <colspec colwidth="6*" align="right"/>
23022 <tbody>
23023 <row>
23024 <entry><option>acl_smtp_expn</option></entry>
23025 <entry>Use: <emphasis>main</emphasis></entry>
23026 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23027 <entry>Default: <emphasis>unset</emphasis></entry>
23028 </row>
23029 </tbody>
23030 </tgroup>
23031 </informaltable>
23032 <para>
23033 <indexterm role="concept">
23034 <primary>EXPN</primary>
23035 <secondary>ACL for</secondary>
23036 </indexterm>
23037 This option defines the ACL that is run when an SMTP EXPN command is
23038 received. See chapter <xref linkend="CHAPACL"/> for further details.
23039 </para>
23040 <para>
23041 <indexterm role="option">
23042 <primary><option>acl_smtp_helo</option></primary>
23043 </indexterm>
23044 </para>
23045 <informaltable frame="all">
23046 <tgroup cols="4" colsep="0" rowsep="0">
23047 <colspec colwidth="8*" align="left"/>
23048 <colspec colwidth="6*" align="center"/>
23049 <colspec colwidth="6*" align="center"/>
23050 <colspec colwidth="6*" align="right"/>
23051 <tbody>
23052 <row>
23053 <entry><option>acl_smtp_helo</option></entry>
23054 <entry>Use: <emphasis>main</emphasis></entry>
23055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23056 <entry>Default: <emphasis>unset</emphasis></entry>
23057 </row>
23058 </tbody>
23059 </tgroup>
23060 </informaltable>
23061 <para>
23062 <indexterm role="concept">
23063 <primary>EHLO</primary>
23064 <secondary>ACL for</secondary>
23065 </indexterm>
23066 <indexterm role="concept">
23067 <primary>HELO</primary>
23068 <secondary>ACL for</secondary>
23069 </indexterm>
23070 This option defines the ACL that is run when an SMTP EHLO or HELO
23071 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
23072 </para>
23073 <para>
23074 <indexterm role="option">
23075 <primary><option>acl_smtp_mail</option></primary>
23076 </indexterm>
23077 </para>
23078 <informaltable frame="all">
23079 <tgroup cols="4" colsep="0" rowsep="0">
23080 <colspec colwidth="8*" align="left"/>
23081 <colspec colwidth="6*" align="center"/>
23082 <colspec colwidth="6*" align="center"/>
23083 <colspec colwidth="6*" align="right"/>
23084 <tbody>
23085 <row>
23086 <entry><option>acl_smtp_mail</option></entry>
23087 <entry>Use: <emphasis>main</emphasis></entry>
23088 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23089 <entry>Default: <emphasis>unset</emphasis></entry>
23090 </row>
23091 </tbody>
23092 </tgroup>
23093 </informaltable>
23094 <para>
23095 <indexterm role="concept">
23096 <primary>MAIL</primary>
23097 <secondary>ACL for</secondary>
23098 </indexterm>
23099 This option defines the ACL that is run when an SMTP MAIL command is
23100 received. See chapter <xref linkend="CHAPACL"/> for further details.
23101 </para>
23102 <para>
23103 <indexterm role="option">
23104 <primary><option>acl_smtp_mailauth</option></primary>
23105 </indexterm>
23106 </para>
23107 <informaltable frame="all">
23108 <tgroup cols="4" colsep="0" rowsep="0">
23109 <colspec colwidth="8*" align="left"/>
23110 <colspec colwidth="6*" align="center"/>
23111 <colspec colwidth="6*" align="center"/>
23112 <colspec colwidth="6*" align="right"/>
23113 <tbody>
23114 <row>
23115 <entry><option>acl_smtp_mailauth</option></entry>
23116 <entry>Use: <emphasis>main</emphasis></entry>
23117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23118 <entry>Default: <emphasis>unset</emphasis></entry>
23119 </row>
23120 </tbody>
23121 </tgroup>
23122 </informaltable>
23123 <para>
23124 <indexterm role="concept">
23125 <primary>AUTH</primary>
23126 <secondary>on MAIL command</secondary>
23127 </indexterm>
23128 This option defines the ACL that is run when there is an AUTH parameter on
23129 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
23130 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
23131 </para>
23132 <para>
23133 <indexterm role="option">
23134 <primary><option>acl_smtp_mime</option></primary>
23135 </indexterm>
23136 </para>
23137 <informaltable frame="all">
23138 <tgroup cols="4" colsep="0" rowsep="0">
23139 <colspec colwidth="8*" align="left"/>
23140 <colspec colwidth="6*" align="center"/>
23141 <colspec colwidth="6*" align="center"/>
23142 <colspec colwidth="6*" align="right"/>
23143 <tbody>
23144 <row>
23145 <entry><option>acl_smtp_mime</option></entry>
23146 <entry>Use: <emphasis>main</emphasis></entry>
23147 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23148 <entry>Default: <emphasis>unset</emphasis></entry>
23149 </row>
23150 </tbody>
23151 </tgroup>
23152 </informaltable>
23153 <para>
23154 <indexterm role="concept">
23155 <primary>MIME content scanning</primary>
23156 <secondary>ACL for</secondary>
23157 </indexterm>
23158 This option is available when Exim is built with the content-scanning
23159 extension. It defines the ACL that is run for each MIME part in a message. See
23160 section <xref linkend="SECTscanmimepart"/> for details.
23161 </para>
23162 <para>
23163 <indexterm role="option">
23164 <primary><option>acl_smtp_notquit</option></primary>
23165 </indexterm>
23166 </para>
23167 <informaltable frame="all">
23168 <tgroup cols="4" colsep="0" rowsep="0">
23169 <colspec colwidth="8*" align="left"/>
23170 <colspec colwidth="6*" align="center"/>
23171 <colspec colwidth="6*" align="center"/>
23172 <colspec colwidth="6*" align="right"/>
23173 <tbody>
23174 <row>
23175 <entry><option>acl_smtp_notquit</option></entry>
23176 <entry>Use: <emphasis>main</emphasis></entry>
23177 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23178 <entry>Default: <emphasis>unset</emphasis></entry>
23179 </row>
23180 </tbody>
23181 </tgroup>
23182 </informaltable>
23183 <para>
23184 <indexterm role="concept">
23185 <primary>not-QUIT, ACL for</primary>
23186 </indexterm>
23187 This option defines the ACL that is run when an SMTP session
23188 ends without a QUIT command being received.
23189 See chapter <xref linkend="CHAPACL"/> for further details.
23190 </para>
23191 <para>
23192 <indexterm role="option">
23193 <primary><option>acl_smtp_predata</option></primary>
23194 </indexterm>
23195 </para>
23196 <informaltable frame="all">
23197 <tgroup cols="4" colsep="0" rowsep="0">
23198 <colspec colwidth="8*" align="left"/>
23199 <colspec colwidth="6*" align="center"/>
23200 <colspec colwidth="6*" align="center"/>
23201 <colspec colwidth="6*" align="right"/>
23202 <tbody>
23203 <row>
23204 <entry><option>acl_smtp_predata</option></entry>
23205 <entry>Use: <emphasis>main</emphasis></entry>
23206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23207 <entry>Default: <emphasis>unset</emphasis></entry>
23208 </row>
23209 </tbody>
23210 </tgroup>
23211 </informaltable>
23212 <para>
23213 This option defines the ACL that is run when an SMTP DATA command is
23214 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
23215 further details.
23216 </para>
23217 <para>
23218 <indexterm role="option">
23219 <primary><option>acl_smtp_quit</option></primary>
23220 </indexterm>
23221 </para>
23222 <informaltable frame="all">
23223 <tgroup cols="4" colsep="0" rowsep="0">
23224 <colspec colwidth="8*" align="left"/>
23225 <colspec colwidth="6*" align="center"/>
23226 <colspec colwidth="6*" align="center"/>
23227 <colspec colwidth="6*" align="right"/>
23228 <tbody>
23229 <row>
23230 <entry><option>acl_smtp_quit</option></entry>
23231 <entry>Use: <emphasis>main</emphasis></entry>
23232 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23233 <entry>Default: <emphasis>unset</emphasis></entry>
23234 </row>
23235 </tbody>
23236 </tgroup>
23237 </informaltable>
23238 <para>
23239 <indexterm role="concept">
23240 <primary>QUIT, ACL for</primary>
23241 </indexterm>
23242 This option defines the ACL that is run when an SMTP QUIT command is
23243 received. See chapter <xref linkend="CHAPACL"/> for further details.
23244 </para>
23245 <para>
23246 <indexterm role="option">
23247 <primary><option>acl_smtp_rcpt</option></primary>
23248 </indexterm>
23249 </para>
23250 <informaltable frame="all">
23251 <tgroup cols="4" colsep="0" rowsep="0">
23252 <colspec colwidth="8*" align="left"/>
23253 <colspec colwidth="6*" align="center"/>
23254 <colspec colwidth="6*" align="center"/>
23255 <colspec colwidth="6*" align="right"/>
23256 <tbody>
23257 <row>
23258 <entry><option>acl_smtp_rcpt</option></entry>
23259 <entry>Use: <emphasis>main</emphasis></entry>
23260 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23261 <entry>Default: <emphasis>unset</emphasis></entry>
23262 </row>
23263 </tbody>
23264 </tgroup>
23265 </informaltable>
23266 <para>
23267 <indexterm role="concept">
23268 <primary>RCPT</primary>
23269 <secondary>ACL for</secondary>
23270 </indexterm>
23271 This option defines the ACL that is run when an SMTP RCPT command is
23272 received. See chapter <xref linkend="CHAPACL"/> for further details.
23273 </para>
23274 <para>
23275 <indexterm role="option">
23276 <primary><option>acl_smtp_starttls</option></primary>
23277 </indexterm>
23278 </para>
23279 <informaltable frame="all">
23280 <tgroup cols="4" colsep="0" rowsep="0">
23281 <colspec colwidth="8*" align="left"/>
23282 <colspec colwidth="6*" align="center"/>
23283 <colspec colwidth="6*" align="center"/>
23284 <colspec colwidth="6*" align="right"/>
23285 <tbody>
23286 <row>
23287 <entry><option>acl_smtp_starttls</option></entry>
23288 <entry>Use: <emphasis>main</emphasis></entry>
23289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23290 <entry>Default: <emphasis>unset</emphasis></entry>
23291 </row>
23292 </tbody>
23293 </tgroup>
23294 </informaltable>
23295 <para>
23296 <indexterm role="concept">
23297 <primary>STARTTLS, ACL for</primary>
23298 </indexterm>
23299 This option defines the ACL that is run when an SMTP STARTTLS command is
23300 received. See chapter <xref linkend="CHAPACL"/> for further details.
23301 </para>
23302 <para>
23303 <indexterm role="option">
23304 <primary><option>acl_smtp_vrfy</option></primary>
23305 </indexterm>
23306 </para>
23307 <informaltable frame="all">
23308 <tgroup cols="4" colsep="0" rowsep="0">
23309 <colspec colwidth="8*" align="left"/>
23310 <colspec colwidth="6*" align="center"/>
23311 <colspec colwidth="6*" align="center"/>
23312 <colspec colwidth="6*" align="right"/>
23313 <tbody>
23314 <row>
23315 <entry><option>acl_smtp_vrfy</option></entry>
23316 <entry>Use: <emphasis>main</emphasis></entry>
23317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23318 <entry>Default: <emphasis>unset</emphasis></entry>
23319 </row>
23320 </tbody>
23321 </tgroup>
23322 </informaltable>
23323 <para>
23324 <indexterm role="concept">
23325 <primary>VRFY</primary>
23326 <secondary>ACL for</secondary>
23327 </indexterm>
23328 This option defines the ACL that is run when an SMTP VRFY command is
23329 received. See chapter <xref linkend="CHAPACL"/> for further details.
23330 </para>
23331 <para>
23332 <indexterm role="option">
23333 <primary><option>add_environment</option></primary>
23334 </indexterm>
23335 </para>
23336 <informaltable frame="all">
23337 <tgroup cols="4" colsep="0" rowsep="0">
23338 <colspec colwidth="8*" align="left"/>
23339 <colspec colwidth="6*" align="center"/>
23340 <colspec colwidth="6*" align="center"/>
23341 <colspec colwidth="6*" align="right"/>
23342 <tbody>
23343 <row>
23344 <entry><option>add_environment</option></entry>
23345 <entry>Use: <emphasis>main</emphasis></entry>
23346 <entry>Type: <emphasis>string list</emphasis></entry>
23347 <entry>Default: <emphasis>empty</emphasis></entry>
23348 </row>
23349 </tbody>
23350 </tgroup>
23351 </informaltable>
23352 <para>
23353 <indexterm role="concept">
23354 <primary>environment</primary>
23355 <secondary>set values</secondary>
23356 </indexterm>
23357 This option allows to set individual environment variables that the
23358 currently linked libraries and programs in child processes use.
23359 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
23360 </para>
23361 <para>
23362 <indexterm role="option">
23363 <primary><option>admin_groups</option></primary>
23364 </indexterm>
23365 </para>
23366 <informaltable frame="all">
23367 <tgroup cols="4" colsep="0" rowsep="0">
23368 <colspec colwidth="8*" align="left"/>
23369 <colspec colwidth="6*" align="center"/>
23370 <colspec colwidth="6*" align="center"/>
23371 <colspec colwidth="6*" align="right"/>
23372 <tbody>
23373 <row>
23374 <entry><option>admin_groups</option></entry>
23375 <entry>Use: <emphasis>main</emphasis></entry>
23376 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23377 <entry>Default: <emphasis>unset</emphasis></entry>
23378 </row>
23379 </tbody>
23380 </tgroup>
23381 </informaltable>
23382 <para>
23383 <indexterm role="concept">
23384 <primary>admin user</primary>
23385 </indexterm>
23386 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
23387 current group or any of the supplementary groups of an Exim caller is in this
23388 colon-separated list, the caller has admin privileges. If all your system
23389 programmers are in a specific group, for example, you can give them all Exim
23390 admin privileges by putting that group in <option>admin_groups</option>. However, this does
23391 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
23392 To permit this, you have to add individuals to the Exim group.
23393 </para>
23394 <para>
23395 <indexterm role="option">
23396 <primary><option>allow_domain_literals</option></primary>
23397 </indexterm>
23398 </para>
23399 <informaltable frame="all">
23400 <tgroup cols="4" colsep="0" rowsep="0">
23401 <colspec colwidth="8*" align="left"/>
23402 <colspec colwidth="6*" align="center"/>
23403 <colspec colwidth="6*" align="center"/>
23404 <colspec colwidth="6*" align="right"/>
23405 <tbody>
23406 <row>
23407 <entry><option>allow_domain_literals</option></entry>
23408 <entry>Use: <emphasis>main</emphasis></entry>
23409 <entry>Type: <emphasis>boolean</emphasis></entry>
23410 <entry>Default: <emphasis>false</emphasis></entry>
23411 </row>
23412 </tbody>
23413 </tgroup>
23414 </informaltable>
23415 <para>
23416 <indexterm role="concept">
23417 <primary>domain literal</primary>
23418 </indexterm>
23419 If this option is set, the RFC 2822 domain literal format is permitted in
23420 email addresses. The option is not set by default, because the domain literal
23421 format is not normally required these days, and few people know about it. It
23422 has, however, been exploited by mail abusers.
23423 </para>
23424 <para>
23425 Unfortunately, it seems that some DNS black list maintainers are using this
23426 format to report black listing to postmasters. If you want to accept messages
23427 addressed to your hosts by IP address, you need to set
23428 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
23429 domains (defined in the named domain list <option>local_domains</option> in the default
23430 configuration). This <quote>magic string</quote> matches the domain literal form of all
23431 the local host&#x2019;s IP addresses.
23432 </para>
23433 <para>
23434 <indexterm role="option">
23435 <primary><option>allow_mx_to_ip</option></primary>
23436 </indexterm>
23437 </para>
23438 <informaltable frame="all">
23439 <tgroup cols="4" colsep="0" rowsep="0">
23440 <colspec colwidth="8*" align="left"/>
23441 <colspec colwidth="6*" align="center"/>
23442 <colspec colwidth="6*" align="center"/>
23443 <colspec colwidth="6*" align="right"/>
23444 <tbody>
23445 <row>
23446 <entry><option>allow_mx_to_ip</option></entry>
23447 <entry>Use: <emphasis>main</emphasis></entry>
23448 <entry>Type: <emphasis>boolean</emphasis></entry>
23449 <entry>Default: <emphasis>false</emphasis></entry>
23450 </row>
23451 </tbody>
23452 </tgroup>
23453 </informaltable>
23454 <para>
23455 <indexterm role="concept">
23456 <primary>MX record</primary>
23457 <secondary>pointing to IP address</secondary>
23458 </indexterm>
23459 It appears that more and more DNS zone administrators are breaking the rules
23460 and putting domain names that look like IP addresses on the right hand side of
23461 MX records. Exim follows the rules and rejects this, giving an error message
23462 that explains the misconfiguration. However, some other MTAs support this
23463 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
23464 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
23465 recommended, except when you have no other choice.
23466 </para>
23467 <para>
23468 <indexterm role="option">
23469 <primary><option>allow_utf8_domains</option></primary>
23470 </indexterm>
23471 </para>
23472 <informaltable frame="all">
23473 <tgroup cols="4" colsep="0" rowsep="0">
23474 <colspec colwidth="8*" align="left"/>
23475 <colspec colwidth="6*" align="center"/>
23476 <colspec colwidth="6*" align="center"/>
23477 <colspec colwidth="6*" align="right"/>
23478 <tbody>
23479 <row>
23480 <entry><option>allow_utf8_domains</option></entry>
23481 <entry>Use: <emphasis>main</emphasis></entry>
23482 <entry>Type: <emphasis>boolean</emphasis></entry>
23483 <entry>Default: <emphasis>false</emphasis></entry>
23484 </row>
23485 </tbody>
23486 </tgroup>
23487 </informaltable>
23488 <para>
23489 <indexterm role="concept">
23490 <primary>domain</primary>
23491 <secondary>UTF-8 characters in</secondary>
23492 </indexterm>
23493 <indexterm role="concept">
23494 <primary>UTF-8</primary>
23495 <secondary>in domain name</secondary>
23496 </indexterm>
23497 Lots of discussion is going on about internationalized domain names. One
23498 camp is strongly in favour of just using UTF-8 characters, and it seems
23499 that at least two other MTAs permit this. This option allows Exim users to
23500 experiment if they wish.
23501 </para>
23502 <para>
23503 If it is set true, Exim&#x2019;s domain parsing function allows valid
23504 UTF-8 multicharacters to appear in domain name components, in addition to
23505 letters, digits, and hyphens. However, just setting this option is not
23506 enough; if you want to look up these domain names in the DNS, you must also
23507 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23508 suitable setting is:
23509 </para>
23510 <literallayout class="monospaced">
23511 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23512   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23513 </literallayout>
23514 <para>
23515 Alternatively, you can just disable this feature by setting
23516 </para>
23517 <literallayout class="monospaced">
23518 dns_check_names_pattern =
23519 </literallayout>
23520 <para>
23521 That is, set the option to an empty string so that no check is done.
23522 </para>
23523 <para>
23524 <indexterm role="option">
23525 <primary><option>auth_advertise_hosts</option></primary>
23526 </indexterm>
23527 </para>
23528 <informaltable frame="all">
23529 <tgroup cols="4" colsep="0" rowsep="0">
23530 <colspec colwidth="8*" align="left"/>
23531 <colspec colwidth="6*" align="center"/>
23532 <colspec colwidth="6*" align="center"/>
23533 <colspec colwidth="6*" align="right"/>
23534 <tbody>
23535 <row>
23536 <entry><option>auth_advertise_hosts</option></entry>
23537 <entry>Use: <emphasis>main</emphasis></entry>
23538 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23539 <entry>Default: <emphasis>*</emphasis></entry>
23540 </row>
23541 </tbody>
23542 </tgroup>
23543 </informaltable>
23544 <para>
23545 <indexterm role="concept">
23546 <primary>authentication</primary>
23547 <secondary>advertising</secondary>
23548 </indexterm>
23549 <indexterm role="concept">
23550 <primary>AUTH</primary>
23551 <secondary>advertising</secondary>
23552 </indexterm>
23553 If any server authentication mechanisms are configured, Exim advertises them in
23554 response to an EHLO command only if the calling host matches this list.
23555 Otherwise, Exim does not advertise AUTH.
23556 Exim does not accept AUTH commands from clients to which it has not
23557 advertised the availability of AUTH. The advertising of individual
23558 authentication mechanisms can be controlled by the use of the
23559 <option>server_advertise_condition</option> generic authenticator option on the individual
23560 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23561 </para>
23562 <para>
23563 Certain mail clients (for example, Netscape) require the user to provide a name
23564 and password for authentication if AUTH is advertised, even though it may
23565 not be needed (the host may accept messages from hosts on its local LAN without
23566 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23567 to make these clients more friendly by excluding them from the set of hosts to
23568 which Exim advertises AUTH.
23569 </para>
23570 <para>
23571 <indexterm role="concept">
23572 <primary>AUTH</primary>
23573 <secondary>advertising when encrypted</secondary>
23574 </indexterm>
23575 If you want to advertise the availability of AUTH only when the connection
23576 is encrypted using TLS, you can make use of the fact that the value of this
23577 option is expanded, with a setting like this:
23578 </para>
23579 <literallayout class="monospaced">
23580 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23581 </literallayout>
23582 <para>
23583 <indexterm role="variable">
23584 <primary><varname>$tls_in_cipher</varname></primary>
23585 </indexterm>
23586 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23587 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23588 expansion is *, which matches all hosts.
23589 </para>
23590 <para>
23591 <indexterm role="option">
23592 <primary><option>auto_thaw</option></primary>
23593 </indexterm>
23594 </para>
23595 <informaltable frame="all">
23596 <tgroup cols="4" colsep="0" rowsep="0">
23597 <colspec colwidth="8*" align="left"/>
23598 <colspec colwidth="6*" align="center"/>
23599 <colspec colwidth="6*" align="center"/>
23600 <colspec colwidth="6*" align="right"/>
23601 <tbody>
23602 <row>
23603 <entry><option>auto_thaw</option></entry>
23604 <entry>Use: <emphasis>main</emphasis></entry>
23605 <entry>Type: <emphasis>time</emphasis></entry>
23606 <entry>Default: <emphasis>0s</emphasis></entry>
23607 </row>
23608 </tbody>
23609 </tgroup>
23610 </informaltable>
23611 <para>
23612 <indexterm role="concept">
23613 <primary>thawing messages</primary>
23614 </indexterm>
23615 <indexterm role="concept">
23616 <primary>unfreezing messages</primary>
23617 </indexterm>
23618 If this option is set to a time greater than zero, a queue runner will try a
23619 new delivery attempt on any frozen message, other than a bounce message, if
23620 this much time has passed since it was frozen. This may result in the message
23621 being re-frozen if nothing has changed since the last attempt. It is a way of
23622 saying <quote>keep on trying, even though there are big problems</quote>.
23623 </para>
23624 <para>
23625 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23626 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23627 thought to be very useful any more, and its use should probably be avoided.
23628 </para>
23629 <para>
23630 <indexterm role="option">
23631 <primary><option>av_scanner</option></primary>
23632 </indexterm>
23633 </para>
23634 <informaltable frame="all">
23635 <tgroup cols="4" colsep="0" rowsep="0">
23636 <colspec colwidth="8*" align="left"/>
23637 <colspec colwidth="6*" align="center"/>
23638 <colspec colwidth="6*" align="center"/>
23639 <colspec colwidth="6*" align="right"/>
23640 <tbody>
23641 <row>
23642 <entry><option>av_scanner</option></entry>
23643 <entry>Use: <emphasis>main</emphasis></entry>
23644 <entry>Type: <emphasis>string</emphasis></entry>
23645 <entry>Default: <emphasis>see below</emphasis></entry>
23646 </row>
23647 </tbody>
23648 </tgroup>
23649 </informaltable>
23650 <para>
23651 This option is available if Exim is built with the content-scanning extension.
23652 It specifies which anti-virus scanner to use. The default value is:
23653 </para>
23654 <literallayout class="monospaced">
23655 sophie:/var/run/sophie
23656 </literallayout>
23657 <para>
23658 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23659 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23660 </para>
23661 <para>
23662 <indexterm role="option">
23663 <primary><option>bi_command</option></primary>
23664 </indexterm>
23665 </para>
23666 <informaltable frame="all">
23667 <tgroup cols="4" colsep="0" rowsep="0">
23668 <colspec colwidth="8*" align="left"/>
23669 <colspec colwidth="6*" align="center"/>
23670 <colspec colwidth="6*" align="center"/>
23671 <colspec colwidth="6*" align="right"/>
23672 <tbody>
23673 <row>
23674 <entry><option>bi_command</option></entry>
23675 <entry>Use: <emphasis>main</emphasis></entry>
23676 <entry>Type: <emphasis>string</emphasis></entry>
23677 <entry>Default: <emphasis>unset</emphasis></entry>
23678 </row>
23679 </tbody>
23680 </tgroup>
23681 </informaltable>
23682 <para>
23683 <indexterm role="option">
23684 <primary><option>-bi</option></primary>
23685 </indexterm>
23686 This option supplies the name of a command that is run when Exim is called with
23687 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
23688 just the command name, it is not a complete command line. If an argument is
23689 required, it must come from the <option>-oA</option> command line option.
23690 </para>
23691 <para>
23692 <indexterm role="option">
23693 <primary><option>bounce_message_file</option></primary>
23694 </indexterm>
23695 </para>
23696 <informaltable frame="all">
23697 <tgroup cols="4" colsep="0" rowsep="0">
23698 <colspec colwidth="8*" align="left"/>
23699 <colspec colwidth="6*" align="center"/>
23700 <colspec colwidth="6*" align="center"/>
23701 <colspec colwidth="6*" align="right"/>
23702 <tbody>
23703 <row>
23704 <entry><option>bounce_message_file</option></entry>
23705 <entry>Use: <emphasis>main</emphasis></entry>
23706 <entry>Type: <emphasis>string</emphasis></entry>
23707 <entry>Default: <emphasis>unset</emphasis></entry>
23708 </row>
23709 </tbody>
23710 </tgroup>
23711 </informaltable>
23712 <para>
23713 <indexterm role="concept">
23714 <primary>bounce message</primary>
23715 <secondary>customizing</secondary>
23716 </indexterm>
23717 <indexterm role="concept">
23718 <primary>customizing</primary>
23719 <secondary>bounce message</secondary>
23720 </indexterm>
23721 This option defines a template file containing paragraphs of text to be used
23722 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
23723 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
23724 </para>
23725 <para>
23726 <indexterm role="option">
23727 <primary><option>bounce_message_text</option></primary>
23728 </indexterm>
23729 </para>
23730 <informaltable frame="all">
23731 <tgroup cols="4" colsep="0" rowsep="0">
23732 <colspec colwidth="8*" align="left"/>
23733 <colspec colwidth="6*" align="center"/>
23734 <colspec colwidth="6*" align="center"/>
23735 <colspec colwidth="6*" align="right"/>
23736 <tbody>
23737 <row>
23738 <entry><option>bounce_message_text</option></entry>
23739 <entry>Use: <emphasis>main</emphasis></entry>
23740 <entry>Type: <emphasis>string</emphasis></entry>
23741 <entry>Default: <emphasis>unset</emphasis></entry>
23742 </row>
23743 </tbody>
23744 </tgroup>
23745 </informaltable>
23746 <para>
23747 When this option is set, its contents are included in the default bounce
23748 message immediately after <quote>This message was created automatically by mail
23749 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
23750 </para>
23751 <para>
23752 <indexterm role="option">
23753 <primary><option>bounce_return_body</option></primary>
23754 </indexterm>
23755 </para>
23756 <informaltable frame="all">
23757 <tgroup cols="4" colsep="0" rowsep="0">
23758 <colspec colwidth="8*" align="left"/>
23759 <colspec colwidth="6*" align="center"/>
23760 <colspec colwidth="6*" align="center"/>
23761 <colspec colwidth="6*" align="right"/>
23762 <tbody>
23763 <row>
23764 <entry><option>bounce_return_body</option></entry>
23765 <entry>Use: <emphasis>main</emphasis></entry>
23766 <entry>Type: <emphasis>boolean</emphasis></entry>
23767 <entry>Default: <emphasis>true</emphasis></entry>
23768 </row>
23769 </tbody>
23770 </tgroup>
23771 </informaltable>
23772 <para>
23773 <indexterm role="concept">
23774 <primary>bounce message</primary>
23775 <secondary>including body</secondary>
23776 </indexterm>
23777 This option controls whether the body of an incoming message is included in a
23778 bounce message when <option>bounce_return_message</option> is true. The default setting
23779 causes the entire message, both header and body, to be returned (subject to the
23780 value of <option>bounce_return_size_limit</option>). If this option is false, only the
23781 message header is included. In the case of a non-SMTP message containing an
23782 error that is detected during reception, only those header lines preceding the
23783 point at which the error was detected are returned.
23784 <indexterm role="concept">
23785 <primary>bounce message</primary>
23786 <secondary>including original</secondary>
23787 </indexterm>
23788 </para>
23789 <para>
23790 <indexterm role="option">
23791 <primary><option>bounce_return_linesize_limit</option></primary>
23792 </indexterm>
23793 </para>
23794 <informaltable frame="all">
23795 <tgroup cols="4" colsep="0" rowsep="0">
23796 <colspec colwidth="8*" align="left"/>
23797 <colspec colwidth="6*" align="center"/>
23798 <colspec colwidth="6*" align="center"/>
23799 <colspec colwidth="6*" align="right"/>
23800 <tbody>
23801 <row>
23802 <entry><option>bounce_return_linesize_limit</option></entry>
23803 <entry>Use: <emphasis>main</emphasis></entry>
23804 <entry>Type: <emphasis>integer</emphasis></entry>
23805 <entry>Default: <emphasis>998</emphasis></entry>
23806 </row>
23807 </tbody>
23808 </tgroup>
23809 </informaltable>
23810 <para>
23811 <indexterm role="concept">
23812 <primary>size</primary>
23813 <secondary>of bounce lines, limit</secondary>
23814 </indexterm>
23815 <indexterm role="concept">
23816 <primary>bounce message</primary>
23817 <secondary>line length limit</secondary>
23818 </indexterm>
23819 <indexterm role="concept">
23820 <primary>limit</primary>
23821 <secondary>bounce message line length</secondary>
23822 </indexterm>
23823 This option sets a limit in bytes on the line length of messages
23824 that are returned to senders due to delivery problems,
23825 when <option>bounce_return_message</option> is true.
23826 The default value corresponds to RFC limits.
23827 If the message being returned has lines longer than this value it is
23828 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
23829 </para>
23830 <para>
23831 The option also applies to bounces returned when an error is detected
23832 during reception of a message.
23833 In this case lines from the original are truncated.
23834 </para>
23835 <para>
23836 The option does not apply to messages generated by an <command>autoreply</command> transport.
23837 </para>
23838 <para>
23839 <indexterm role="option">
23840 <primary><option>bounce_return_message</option></primary>
23841 </indexterm>
23842 </para>
23843 <informaltable frame="all">
23844 <tgroup cols="4" colsep="0" rowsep="0">
23845 <colspec colwidth="8*" align="left"/>
23846 <colspec colwidth="6*" align="center"/>
23847 <colspec colwidth="6*" align="center"/>
23848 <colspec colwidth="6*" align="right"/>
23849 <tbody>
23850 <row>
23851 <entry><option>bounce_return_message</option></entry>
23852 <entry>Use: <emphasis>main</emphasis></entry>
23853 <entry>Type: <emphasis>boolean</emphasis></entry>
23854 <entry>Default: <emphasis>true</emphasis></entry>
23855 </row>
23856 </tbody>
23857 </tgroup>
23858 </informaltable>
23859 <para>
23860 If this option is set false, none of the original message is included in
23861 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
23862 <option>bounce_return_body</option>.
23863 </para>
23864 <para>
23865 <indexterm role="option">
23866 <primary><option>bounce_return_size_limit</option></primary>
23867 </indexterm>
23868 </para>
23869 <informaltable frame="all">
23870 <tgroup cols="4" colsep="0" rowsep="0">
23871 <colspec colwidth="8*" align="left"/>
23872 <colspec colwidth="6*" align="center"/>
23873 <colspec colwidth="6*" align="center"/>
23874 <colspec colwidth="6*" align="right"/>
23875 <tbody>
23876 <row>
23877 <entry><option>bounce_return_size_limit</option></entry>
23878 <entry>Use: <emphasis>main</emphasis></entry>
23879 <entry>Type: <emphasis>integer</emphasis></entry>
23880 <entry>Default: <emphasis>100K</emphasis></entry>
23881 </row>
23882 </tbody>
23883 </tgroup>
23884 </informaltable>
23885 <para>
23886 <indexterm role="concept">
23887 <primary>size</primary>
23888 <secondary>of bounce, limit</secondary>
23889 </indexterm>
23890 <indexterm role="concept">
23891 <primary>bounce message</primary>
23892 <secondary>size limit</secondary>
23893 </indexterm>
23894 <indexterm role="concept">
23895 <primary>limit</primary>
23896 <secondary>bounce message size</secondary>
23897 </indexterm>
23898 This option sets a limit in bytes on the size of messages that are returned to
23899 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23900 limit should be less than the value of the global <option>message_size_limit</option> and of
23901 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23902 that Exim generates. If this option is set to zero there is no limit.
23903 </para>
23904 <para>
23905 When the body of any message that is to be included in a bounce message is
23906 greater than the limit, it is truncated, and a comment pointing this out is
23907 added at the top. The actual cutoff may be greater than the value given, owing
23908 to the use of buffering for transferring the message in chunks (typically 8K in
23909 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23910 messages.
23911 </para>
23912 <para>
23913 <indexterm role="option">
23914 <primary><option>bounce_sender_authentication</option></primary>
23915 </indexterm>
23916 </para>
23917 <informaltable frame="all">
23918 <tgroup cols="4" colsep="0" rowsep="0">
23919 <colspec colwidth="8*" align="left"/>
23920 <colspec colwidth="6*" align="center"/>
23921 <colspec colwidth="6*" align="center"/>
23922 <colspec colwidth="6*" align="right"/>
23923 <tbody>
23924 <row>
23925 <entry><option>bounce_sender_authentication</option></entry>
23926 <entry>Use: <emphasis>main</emphasis></entry>
23927 <entry>Type: <emphasis>string</emphasis></entry>
23928 <entry>Default: <emphasis>unset</emphasis></entry>
23929 </row>
23930 </tbody>
23931 </tgroup>
23932 </informaltable>
23933 <para>
23934 <indexterm role="concept">
23935 <primary>bounce message</primary>
23936 <secondary>sender authentication</secondary>
23937 </indexterm>
23938 <indexterm role="concept">
23939 <primary>authentication</primary>
23940 <secondary>bounce message</secondary>
23941 </indexterm>
23942 <indexterm role="concept">
23943 <primary>AUTH</primary>
23944 <secondary>on bounce message</secondary>
23945 </indexterm>
23946 This option provides an authenticated sender address that is sent with any
23947 bounce messages generated by Exim that are sent over an authenticated SMTP
23948 connection. A typical setting might be:
23949 </para>
23950 <literallayout class="monospaced">
23951 bounce_sender_authentication = mailer-daemon@my.domain.example
23952 </literallayout>
23953 <para>
23954 which would cause bounce messages to be sent using the SMTP command:
23955 </para>
23956 <literallayout class="monospaced">
23957 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23958 </literallayout>
23959 <para>
23960 The value of <option>bounce_sender_authentication</option> must always be a complete email
23961 address.
23962 </para>
23963 <para>
23964 <indexterm role="option">
23965 <primary><option>callout_domain_negative_expire</option></primary>
23966 </indexterm>
23967 </para>
23968 <informaltable frame="all">
23969 <tgroup cols="4" colsep="0" rowsep="0">
23970 <colspec colwidth="8*" align="left"/>
23971 <colspec colwidth="6*" align="center"/>
23972 <colspec colwidth="6*" align="center"/>
23973 <colspec colwidth="6*" align="right"/>
23974 <tbody>
23975 <row>
23976 <entry><option>callout_domain_negative_expire</option></entry>
23977 <entry>Use: <emphasis>main</emphasis></entry>
23978 <entry>Type: <emphasis>time</emphasis></entry>
23979 <entry>Default: <emphasis>3h</emphasis></entry>
23980 </row>
23981 </tbody>
23982 </tgroup>
23983 </informaltable>
23984 <para>
23985 <indexterm role="concept">
23986 <primary>caching</primary>
23987 <secondary>callout timeouts</secondary>
23988 </indexterm>
23989 <indexterm role="concept">
23990 <primary>callout</primary>
23991 <secondary>caching timeouts</secondary>
23992 </indexterm>
23993 This option specifies the expiry time for negative callout cache data for a
23994 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23995 section <xref linkend="SECTcallvercache"/> for details of the caching.
23996 </para>
23997 <para>
23998 <indexterm role="option">
23999 <primary><option>callout_domain_positive_expire</option></primary>
24000 </indexterm>
24001 </para>
24002 <informaltable frame="all">
24003 <tgroup cols="4" colsep="0" rowsep="0">
24004 <colspec colwidth="8*" align="left"/>
24005 <colspec colwidth="6*" align="center"/>
24006 <colspec colwidth="6*" align="center"/>
24007 <colspec colwidth="6*" align="right"/>
24008 <tbody>
24009 <row>
24010 <entry><option>callout_domain_positive_expire</option></entry>
24011 <entry>Use: <emphasis>main</emphasis></entry>
24012 <entry>Type: <emphasis>time</emphasis></entry>
24013 <entry>Default: <emphasis>7d</emphasis></entry>
24014 </row>
24015 </tbody>
24016 </tgroup>
24017 </informaltable>
24018 <para>
24019 This option specifies the expiry time for positive callout cache data for a
24020 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24021 section <xref linkend="SECTcallvercache"/> for details of the caching.
24022 </para>
24023 <para>
24024 <indexterm role="option">
24025 <primary><option>callout_negative_expire</option></primary>
24026 </indexterm>
24027 </para>
24028 <informaltable frame="all">
24029 <tgroup cols="4" colsep="0" rowsep="0">
24030 <colspec colwidth="8*" align="left"/>
24031 <colspec colwidth="6*" align="center"/>
24032 <colspec colwidth="6*" align="center"/>
24033 <colspec colwidth="6*" align="right"/>
24034 <tbody>
24035 <row>
24036 <entry><option>callout_negative_expire</option></entry>
24037 <entry>Use: <emphasis>main</emphasis></entry>
24038 <entry>Type: <emphasis>time</emphasis></entry>
24039 <entry>Default: <emphasis>2h</emphasis></entry>
24040 </row>
24041 </tbody>
24042 </tgroup>
24043 </informaltable>
24044 <para>
24045 This option specifies the expiry time for negative callout cache data for an
24046 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24047 section <xref linkend="SECTcallvercache"/> for details of the caching.
24048 </para>
24049 <para>
24050 <indexterm role="option">
24051 <primary><option>callout_positive_expire</option></primary>
24052 </indexterm>
24053 </para>
24054 <informaltable frame="all">
24055 <tgroup cols="4" colsep="0" rowsep="0">
24056 <colspec colwidth="8*" align="left"/>
24057 <colspec colwidth="6*" align="center"/>
24058 <colspec colwidth="6*" align="center"/>
24059 <colspec colwidth="6*" align="right"/>
24060 <tbody>
24061 <row>
24062 <entry><option>callout_positive_expire</option></entry>
24063 <entry>Use: <emphasis>main</emphasis></entry>
24064 <entry>Type: <emphasis>time</emphasis></entry>
24065 <entry>Default: <emphasis>24h</emphasis></entry>
24066 </row>
24067 </tbody>
24068 </tgroup>
24069 </informaltable>
24070 <para>
24071 This option specifies the expiry time for positive callout cache data for an
24072 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24073 section <xref linkend="SECTcallvercache"/> for details of the caching.
24074 </para>
24075 <para>
24076 <indexterm role="option">
24077 <primary><option>callout_random_local_part</option></primary>
24078 </indexterm>
24079 </para>
24080 <informaltable frame="all">
24081 <tgroup cols="4" colsep="0" rowsep="0">
24082 <colspec colwidth="8*" align="left"/>
24083 <colspec colwidth="6*" align="center"/>
24084 <colspec colwidth="6*" align="center"/>
24085 <colspec colwidth="6*" align="right"/>
24086 <tbody>
24087 <row>
24088 <entry><option>callout_random_local_part</option></entry>
24089 <entry>Use: <emphasis>main</emphasis></entry>
24090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24091 <entry>Default: <emphasis>see below</emphasis></entry>
24092 </row>
24093 </tbody>
24094 </tgroup>
24095 </informaltable>
24096 <para>
24097 This option defines the <quote>random</quote> local part that can be used as part of
24098 callout verification. The default value is
24099 </para>
24100 <literallayout class="monospaced">
24101 $primary_hostname-$tod_epoch-testing
24102 </literallayout>
24103 <para>
24104 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
24105 </para>
24106 <para>
24107 <indexterm role="option">
24108 <primary><option>check_log_inodes</option></primary>
24109 </indexterm>
24110 </para>
24111 <informaltable frame="all">
24112 <tgroup cols="4" colsep="0" rowsep="0">
24113 <colspec colwidth="8*" align="left"/>
24114 <colspec colwidth="6*" align="center"/>
24115 <colspec colwidth="6*" align="center"/>
24116 <colspec colwidth="6*" align="right"/>
24117 <tbody>
24118 <row>
24119 <entry><option>check_log_inodes</option></entry>
24120 <entry>Use: <emphasis>main</emphasis></entry>
24121 <entry>Type: <emphasis>integer</emphasis></entry>
24122 <entry>Default: <emphasis>100</emphasis></entry>
24123 </row>
24124 </tbody>
24125 </tgroup>
24126 </informaltable>
24127 <para>
24128 See <option>check_spool_space</option> below.
24129 </para>
24130 <para>
24131 <indexterm role="option">
24132 <primary><option>check_log_space</option></primary>
24133 </indexterm>
24134 </para>
24135 <informaltable frame="all">
24136 <tgroup cols="4" colsep="0" rowsep="0">
24137 <colspec colwidth="8*" align="left"/>
24138 <colspec colwidth="6*" align="center"/>
24139 <colspec colwidth="6*" align="center"/>
24140 <colspec colwidth="6*" align="right"/>
24141 <tbody>
24142 <row>
24143 <entry><option>check_log_space</option></entry>
24144 <entry>Use: <emphasis>main</emphasis></entry>
24145 <entry>Type: <emphasis>integer</emphasis></entry>
24146 <entry>Default: <emphasis>10M</emphasis></entry>
24147 </row>
24148 </tbody>
24149 </tgroup>
24150 </informaltable>
24151 <para>
24152 See <option>check_spool_space</option> below.
24153 </para>
24154 <para>
24155 <indexterm role="option">
24156 <primary><option>check_rfc2047_length</option></primary>
24157 </indexterm>
24158 <indexterm role="concept">
24159 <primary>RFC 2047</primary>
24160 <secondary>disabling length check</secondary>
24161 </indexterm>
24162 <indexterm role="option">
24163 <primary><option>check_rfc2047_length</option></primary>
24164 </indexterm>
24165 </para>
24166 <informaltable frame="all">
24167 <tgroup cols="4" colsep="0" rowsep="0">
24168 <colspec colwidth="8*" align="left"/>
24169 <colspec colwidth="6*" align="center"/>
24170 <colspec colwidth="6*" align="center"/>
24171 <colspec colwidth="6*" align="right"/>
24172 <tbody>
24173 <row>
24174 <entry><option>check_rfc2047_length</option></entry>
24175 <entry>Use: <emphasis>main</emphasis></entry>
24176 <entry>Type: <emphasis>boolean</emphasis></entry>
24177 <entry>Default: <emphasis>true</emphasis></entry>
24178 </row>
24179 </tbody>
24180 </tgroup>
24181 </informaltable>
24182 <para>
24183 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
24184 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
24185 word; strings to be encoded that exceed this length are supposed to use
24186 multiple encoded words. By default, Exim does not recognize encoded words that
24187 exceed the maximum length. However, it seems that some software, in violation
24188 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
24189 set false, Exim recognizes encoded words of any length.
24190 </para>
24191 <para>
24192 <indexterm role="option">
24193 <primary><option>check_spool_inodes</option></primary>
24194 </indexterm>
24195 </para>
24196 <informaltable frame="all">
24197 <tgroup cols="4" colsep="0" rowsep="0">
24198 <colspec colwidth="8*" align="left"/>
24199 <colspec colwidth="6*" align="center"/>
24200 <colspec colwidth="6*" align="center"/>
24201 <colspec colwidth="6*" align="right"/>
24202 <tbody>
24203 <row>
24204 <entry><option>check_spool_inodes</option></entry>
24205 <entry>Use: <emphasis>main</emphasis></entry>
24206 <entry>Type: <emphasis>integer</emphasis></entry>
24207 <entry>Default: <emphasis>100</emphasis></entry>
24208 </row>
24209 </tbody>
24210 </tgroup>
24211 </informaltable>
24212 <para>
24213 See <option>check_spool_space</option> below.
24214 </para>
24215 <para>
24216 <indexterm role="option">
24217 <primary><option>check_spool_space</option></primary>
24218 </indexterm>
24219 </para>
24220 <informaltable frame="all">
24221 <tgroup cols="4" colsep="0" rowsep="0">
24222 <colspec colwidth="8*" align="left"/>
24223 <colspec colwidth="6*" align="center"/>
24224 <colspec colwidth="6*" align="center"/>
24225 <colspec colwidth="6*" align="right"/>
24226 <tbody>
24227 <row>
24228 <entry><option>check_spool_space</option></entry>
24229 <entry>Use: <emphasis>main</emphasis></entry>
24230 <entry>Type: <emphasis>integer</emphasis></entry>
24231 <entry>Default: <emphasis>10M</emphasis></entry>
24232 </row>
24233 </tbody>
24234 </tgroup>
24235 </informaltable>
24236 <para>
24237 <indexterm role="concept">
24238 <primary>checking disk space</primary>
24239 </indexterm>
24240 <indexterm role="concept">
24241 <primary>disk space, checking</primary>
24242 </indexterm>
24243 <indexterm role="concept">
24244 <primary>spool directory</primary>
24245 <secondary>checking space</secondary>
24246 </indexterm>
24247 The four <option>check_...</option> options allow for checking of disk resources before a
24248 message is accepted.
24249 </para>
24250 <para>
24251 <indexterm role="variable">
24252 <primary><varname>$log_inodes</varname></primary>
24253 </indexterm>
24254 <indexterm role="variable">
24255 <primary><varname>$log_space</varname></primary>
24256 </indexterm>
24257 <indexterm role="variable">
24258 <primary><varname>$spool_inodes</varname></primary>
24259 </indexterm>
24260 <indexterm role="variable">
24261 <primary><varname>$spool_space</varname></primary>
24262 </indexterm>
24263 When any of these options are nonzero, they apply to all incoming messages. If you
24264 want to apply different checks to different kinds of message, you can do so by
24265 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
24266 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
24267 </para>
24268 <para>
24269 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
24270 either value is greater than zero, for example:
24271 </para>
24272 <literallayout class="monospaced">
24273 check_spool_space = 100M
24274 check_spool_inodes = 100
24275 </literallayout>
24276 <para>
24277 The spool partition is the one that contains the directory defined by
24278 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
24279 transit.
24280 </para>
24281 <para>
24282 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
24283 files are written if either is greater than zero. These should be set only if
24284 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
24285 </para>
24286 <para>
24287 If there is less space or fewer inodes than requested, Exim refuses to accept
24288 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
24289 error response to the MAIL command. If ESMTP is in use and there was a
24290 SIZE parameter on the MAIL command, its value is added to the
24291 <option>check_spool_space</option> value, and the check is performed even if
24292 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
24293 </para>
24294 <para>
24295 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
24296 number of kilobytes (though specified in bytes).
24297 If a non-multiple of 1024 is specified, it is rounded up.
24298 </para>
24299 <para>
24300 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
24301 failure a message is written to stderr and Exim exits with a non-zero code, as
24302 it obviously cannot send an error message of any kind.
24303 </para>
24304 <para>
24305 There is a slight performance penalty for these checks.
24306 Versions of Exim preceding 4.88 had these disabled by default;
24307 high-rate installations confident they will never run out of resources
24308 may wish to deliberately disable them.
24309 </para>
24310 <para>
24311 <indexterm role="option">
24312 <primary><option>chunking_advertise_hosts</option></primary>
24313 </indexterm>
24314 </para>
24315 <informaltable frame="all">
24316 <tgroup cols="4" colsep="0" rowsep="0">
24317 <colspec colwidth="8*" align="left"/>
24318 <colspec colwidth="6*" align="center"/>
24319 <colspec colwidth="6*" align="center"/>
24320 <colspec colwidth="6*" align="right"/>
24321 <tbody>
24322 <row>
24323 <entry><option>chunking_advertise_hosts</option></entry>
24324 <entry>Use: <emphasis>main</emphasis></entry>
24325 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24326 <entry>Default: <emphasis>*</emphasis></entry>
24327 </row>
24328 </tbody>
24329 </tgroup>
24330 </informaltable>
24331 <para>
24332 <indexterm role="concept">
24333 <primary>CHUNKING</primary>
24334 <secondary>advertisement</secondary>
24335 </indexterm>
24336 <indexterm role="concept">
24337 <primary>RFC 3030</primary>
24338 <secondary>CHUNKING</secondary>
24339 </indexterm>
24340 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
24341 these hosts.
24342 Hosts may use the BDAT command as an alternate to DATA.
24343 </para>
24344 <para>
24345 <indexterm role="option">
24346 <primary><option>commandline_checks_require_admin</option></primary>
24347 </indexterm>
24348 </para>
24349 <informaltable frame="all">
24350 <tgroup cols="4" colsep="0" rowsep="0">
24351 <colspec colwidth="8*" align="left"/>
24352 <colspec colwidth="6*" align="center"/>
24353 <colspec colwidth="6*" align="center"/>
24354 <colspec colwidth="6*" align="right"/>
24355 <tbody>
24356 <row>
24357 <entry><option>commandline_checks_require_admin</option></entry>
24358 <entry>Use: <emphasis>main</emphasis></entry>
24359 <entry>Type: <emphasis>boolean</emphasis></entry>
24360 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24361 </row>
24362 </tbody>
24363 </tgroup>
24364 </informaltable>
24365 <para>
24366 <indexterm role="concept">
24367 <primary>restricting access to features</primary>
24368 </indexterm>
24369 This option restricts various basic checking features to require an
24370 administrative user.
24371 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
24372 </para>
24373 <para>
24374 <indexterm role="option">
24375 <primary><option>debug_store</option></primary>
24376 </indexterm>
24377 </para>
24378 <informaltable frame="all">
24379 <tgroup cols="4" colsep="0" rowsep="0">
24380 <colspec colwidth="8*" align="left"/>
24381 <colspec colwidth="6*" align="center"/>
24382 <colspec colwidth="6*" align="center"/>
24383 <colspec colwidth="6*" align="right"/>
24384 <tbody>
24385 <row>
24386 <entry><option>debug_store</option></entry>
24387 <entry>Use: <emphasis>main</emphasis></entry>
24388 <entry>Type: <emphasis>boolean</emphasis></entry>
24389 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24390 </row>
24391 </tbody>
24392 </tgroup>
24393 </informaltable>
24394 <para>
24395 <indexterm role="concept">
24396 <primary>debugging</primary>
24397 <secondary>memory corruption</secondary>
24398 </indexterm>
24399 <indexterm role="concept">
24400 <primary>memory</primary>
24401 <secondary>debugging</secondary>
24402 </indexterm>
24403 This option, when true, enables extra checking in Exim&#x2019;s internal memory
24404 management.  For use when a memory corruption issue is being investigated,
24405 it should normally be left as default.
24406 </para>
24407 <para>
24408 <indexterm role="option">
24409 <primary><option>daemon_smtp_ports</option></primary>
24410 </indexterm>
24411 </para>
24412 <informaltable frame="all">
24413 <tgroup cols="4" colsep="0" rowsep="0">
24414 <colspec colwidth="8*" align="left"/>
24415 <colspec colwidth="6*" align="center"/>
24416 <colspec colwidth="6*" align="center"/>
24417 <colspec colwidth="6*" align="right"/>
24418 <tbody>
24419 <row>
24420 <entry><option>daemon_smtp_ports</option></entry>
24421 <entry>Use: <emphasis>main</emphasis></entry>
24422 <entry>Type: <emphasis>string</emphasis></entry>
24423 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
24424 </row>
24425 </tbody>
24426 </tgroup>
24427 </informaltable>
24428 <para>
24429 <indexterm role="concept">
24430 <primary>port</primary>
24431 <secondary>for daemon</secondary>
24432 </indexterm>
24433 <indexterm role="concept">
24434 <primary>TCP/IP</primary>
24435 <secondary>setting listening ports</secondary>
24436 </indexterm>
24437 This option specifies one or more default SMTP ports on which the Exim daemon
24438 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
24439 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
24440 </para>
24441 <para>
24442 <indexterm role="option">
24443 <primary><option>daemon_startup_retries</option></primary>
24444 </indexterm>
24445 </para>
24446 <informaltable frame="all">
24447 <tgroup cols="4" colsep="0" rowsep="0">
24448 <colspec colwidth="8*" align="left"/>
24449 <colspec colwidth="6*" align="center"/>
24450 <colspec colwidth="6*" align="center"/>
24451 <colspec colwidth="6*" align="right"/>
24452 <tbody>
24453 <row>
24454 <entry><option>daemon_startup_retries</option></entry>
24455 <entry>Use: <emphasis>main</emphasis></entry>
24456 <entry>Type: <emphasis>integer</emphasis></entry>
24457 <entry>Default: <emphasis>9</emphasis></entry>
24458 </row>
24459 </tbody>
24460 </tgroup>
24461 </informaltable>
24462 <para>
24463 <indexterm role="concept">
24464 <primary>daemon startup, retrying</primary>
24465 </indexterm>
24466 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
24467 the daemon at startup when it cannot immediately bind a listening socket
24468 (typically because the socket is already in use): <option>daemon_startup_retries</option>
24469 defines the number of retries after the first failure, and
24470 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
24471 </para>
24472 <para>
24473 <indexterm role="option">
24474 <primary><option>daemon_startup_sleep</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>daemon_startup_sleep</option></entry>
24486 <entry>Use: <emphasis>main</emphasis></entry>
24487 <entry>Type: <emphasis>time</emphasis></entry>
24488 <entry>Default: <emphasis>30s</emphasis></entry>
24489 </row>
24490 </tbody>
24491 </tgroup>
24492 </informaltable>
24493 <para>
24494 See <option>daemon_startup_retries</option>.
24495 </para>
24496 <para>
24497 <indexterm role="option">
24498 <primary><option>delay_warning</option></primary>
24499 </indexterm>
24500 </para>
24501 <informaltable frame="all">
24502 <tgroup cols="4" colsep="0" rowsep="0">
24503 <colspec colwidth="8*" align="left"/>
24504 <colspec colwidth="6*" align="center"/>
24505 <colspec colwidth="6*" align="center"/>
24506 <colspec colwidth="6*" align="right"/>
24507 <tbody>
24508 <row>
24509 <entry><option>delay_warning</option></entry>
24510 <entry>Use: <emphasis>main</emphasis></entry>
24511 <entry>Type: <emphasis>time list</emphasis></entry>
24512 <entry>Default: <emphasis>24h</emphasis></entry>
24513 </row>
24514 </tbody>
24515 </tgroup>
24516 </informaltable>
24517 <para>
24518 <indexterm role="concept">
24519 <primary>warning of delay</primary>
24520 </indexterm>
24521 <indexterm role="concept">
24522 <primary>delay warning, specifying</primary>
24523 </indexterm>
24524 <indexterm role="concept">
24525 <primary>queue</primary>
24526 <secondary>delay warning</secondary>
24527 </indexterm>
24528 When a message is delayed, Exim sends a warning message to the sender at
24529 intervals specified by this option. The data is a colon-separated list of times
24530 after which to send warning messages. If the value of the option is an empty
24531 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
24532 message has been on the queue for longer than the last time, the last interval
24533 between the times is used to compute subsequent warning times. For example,
24534 with
24535 </para>
24536 <literallayout class="monospaced">
24537 delay_warning = 4h:8h:24h
24538 </literallayout>
24539 <para>
24540 the first message is sent after 4 hours, the second after 8 hours, and
24541 the third one after 24 hours. After that, messages are sent every 16 hours,
24542 because that is the interval between the last two times on the list. If you set
24543 just one time, it specifies the repeat interval. For example, with:
24544 </para>
24545 <literallayout class="monospaced">
24546 delay_warning = 6h
24547 </literallayout>
24548 <para>
24549 messages are repeated every six hours. To stop warnings after a given time, set
24550 a very large time at the end of the list. For example:
24551 </para>
24552 <literallayout class="monospaced">
24553 delay_warning = 2h:12h:99d
24554 </literallayout>
24555 <para>
24556 Note that the option is only evaluated at the time a delivery attempt fails,
24557 which depends on retry and queue-runner configuration.
24558 Typically retries will be configured more frequently than warning messages.
24559 </para>
24560 <para>
24561 <indexterm role="option">
24562 <primary><option>delay_warning_condition</option></primary>
24563 </indexterm>
24564 </para>
24565 <informaltable frame="all">
24566 <tgroup cols="4" colsep="0" rowsep="0">
24567 <colspec colwidth="8*" align="left"/>
24568 <colspec colwidth="6*" align="center"/>
24569 <colspec colwidth="6*" align="center"/>
24570 <colspec colwidth="6*" align="right"/>
24571 <tbody>
24572 <row>
24573 <entry><option>delay_warning_condition</option></entry>
24574 <entry>Use: <emphasis>main</emphasis></entry>
24575 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24576 <entry>Default: <emphasis>see below</emphasis></entry>
24577 </row>
24578 </tbody>
24579 </tgroup>
24580 </informaltable>
24581 <para>
24582 <indexterm role="variable">
24583 <primary><varname>$domain</varname></primary>
24584 </indexterm>
24585 The string is expanded at the time a warning message might be sent. If all the
24586 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24587 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24588 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24589 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24590 not sent. The default is:
24591 </para>
24592 <literallayout class="monospaced">
24593 delay_warning_condition = ${if or {\
24594   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24595   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24596   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24597   } {no}{yes}}
24598 </literallayout>
24599 <para>
24600 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24601 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24602 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24603 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24604 </para>
24605 <para>
24606 <indexterm role="option">
24607 <primary><option>deliver_drop_privilege</option></primary>
24608 </indexterm>
24609 </para>
24610 <informaltable frame="all">
24611 <tgroup cols="4" colsep="0" rowsep="0">
24612 <colspec colwidth="8*" align="left"/>
24613 <colspec colwidth="6*" align="center"/>
24614 <colspec colwidth="6*" align="center"/>
24615 <colspec colwidth="6*" align="right"/>
24616 <tbody>
24617 <row>
24618 <entry><option>deliver_drop_privilege</option></entry>
24619 <entry>Use: <emphasis>main</emphasis></entry>
24620 <entry>Type: <emphasis>boolean</emphasis></entry>
24621 <entry>Default: <emphasis>false</emphasis></entry>
24622 </row>
24623 </tbody>
24624 </tgroup>
24625 </informaltable>
24626 <para>
24627 <indexterm role="concept">
24628 <primary>unprivileged delivery</primary>
24629 </indexterm>
24630 <indexterm role="concept">
24631 <primary>delivery</primary>
24632 <secondary>unprivileged</secondary>
24633 </indexterm>
24634 If this option is set true, Exim drops its root privilege at the start of a
24635 delivery process, and runs as the Exim user throughout. This severely restricts
24636 the kinds of local delivery that are possible, but is viable in certain types
24637 of configuration. There is a discussion about the use of root privilege in
24638 chapter <xref linkend="CHAPsecurity"/>.
24639 </para>
24640 <para>
24641 <indexterm role="option">
24642 <primary><option>deliver_queue_load_max</option></primary>
24643 </indexterm>
24644 </para>
24645 <informaltable frame="all">
24646 <tgroup cols="4" colsep="0" rowsep="0">
24647 <colspec colwidth="8*" align="left"/>
24648 <colspec colwidth="6*" align="center"/>
24649 <colspec colwidth="6*" align="center"/>
24650 <colspec colwidth="6*" align="right"/>
24651 <tbody>
24652 <row>
24653 <entry><option>deliver_queue_load_max</option></entry>
24654 <entry>Use: <emphasis>main</emphasis></entry>
24655 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24656 <entry>Default: <emphasis>unset</emphasis></entry>
24657 </row>
24658 </tbody>
24659 </tgroup>
24660 </informaltable>
24661 <para>
24662 <indexterm role="concept">
24663 <primary>load average</primary>
24664 </indexterm>
24665 <indexterm role="concept">
24666 <primary>queue runner</primary>
24667 <secondary>abandoning</secondary>
24668 </indexterm>
24669 When this option is set, a queue run is abandoned if the system load average
24670 becomes greater than the value of the option. The option has no effect on
24671 ancient operating systems on which Exim cannot determine the load average.
24672 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24673 </para>
24674 <para>
24675 <indexterm role="option">
24676 <primary><option>delivery_date_remove</option></primary>
24677 </indexterm>
24678 </para>
24679 <informaltable frame="all">
24680 <tgroup cols="4" colsep="0" rowsep="0">
24681 <colspec colwidth="8*" align="left"/>
24682 <colspec colwidth="6*" align="center"/>
24683 <colspec colwidth="6*" align="center"/>
24684 <colspec colwidth="6*" align="right"/>
24685 <tbody>
24686 <row>
24687 <entry><option>delivery_date_remove</option></entry>
24688 <entry>Use: <emphasis>main</emphasis></entry>
24689 <entry>Type: <emphasis>boolean</emphasis></entry>
24690 <entry>Default: <emphasis>true</emphasis></entry>
24691 </row>
24692 </tbody>
24693 </tgroup>
24694 </informaltable>
24695 <para>
24696 <indexterm role="concept">
24697 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
24698 </indexterm>
24699 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
24700 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24701 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
24702 should not be present in incoming messages, and this option causes them to be
24703 removed at the time the message is received, to avoid any problems that might
24704 occur when a delivered message is subsequently sent on to some other recipient.
24705 </para>
24706 <para>
24707 <indexterm role="option">
24708 <primary><option>disable_fsync</option></primary>
24709 </indexterm>
24710 </para>
24711 <informaltable frame="all">
24712 <tgroup cols="4" colsep="0" rowsep="0">
24713 <colspec colwidth="8*" align="left"/>
24714 <colspec colwidth="6*" align="center"/>
24715 <colspec colwidth="6*" align="center"/>
24716 <colspec colwidth="6*" align="right"/>
24717 <tbody>
24718 <row>
24719 <entry><option>disable_fsync</option></entry>
24720 <entry>Use: <emphasis>main</emphasis></entry>
24721 <entry>Type: <emphasis>boolean</emphasis></entry>
24722 <entry>Default: <emphasis>false</emphasis></entry>
24723 </row>
24724 </tbody>
24725 </tgroup>
24726 </informaltable>
24727 <para>
24728 <indexterm role="concept">
24729 <primary><function>fsync()</function>, disabling</primary>
24730 </indexterm>
24731 This option is available only if Exim was built with the compile-time option
24732 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
24733 a runtime configuration generates an <quote>unknown option</quote> error. You should not
24734 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
24735 really, really, really understand what you are doing. <emphasis>No pre-compiled
24736 distributions of Exim should ever make this option available.</emphasis>
24737 </para>
24738 <para>
24739 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
24740 updated files&#x2019; data to be written to disc before continuing. Unexpected events
24741 such as crashes and power outages may cause data to be lost or scrambled.
24742 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
24743 </para>
24744 <para>
24745 <indexterm role="option">
24746 <primary><option>disable_ipv6</option></primary>
24747 </indexterm>
24748 </para>
24749 <informaltable frame="all">
24750 <tgroup cols="4" colsep="0" rowsep="0">
24751 <colspec colwidth="8*" align="left"/>
24752 <colspec colwidth="6*" align="center"/>
24753 <colspec colwidth="6*" align="center"/>
24754 <colspec colwidth="6*" align="right"/>
24755 <tbody>
24756 <row>
24757 <entry><option>disable_ipv6</option></entry>
24758 <entry>Use: <emphasis>main</emphasis></entry>
24759 <entry>Type: <emphasis>boolean</emphasis></entry>
24760 <entry>Default: <emphasis>false</emphasis></entry>
24761 </row>
24762 </tbody>
24763 </tgroup>
24764 </informaltable>
24765 <para>
24766 <indexterm role="concept">
24767 <primary>IPv6</primary>
24768 <secondary>disabling</secondary>
24769 </indexterm>
24770 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
24771 activities take place. AAAA records are never looked up, and any IPv6 addresses
24772 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
24773 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
24774 to handle IPv6 literal addresses.
24775 </para>
24776 <para>
24777 <indexterm role="option">
24778 <primary><option>dkim_verify_signers</option></primary>
24779 </indexterm>
24780 </para>
24781 <informaltable frame="all">
24782 <tgroup cols="4" colsep="0" rowsep="0">
24783 <colspec colwidth="8*" align="left"/>
24784 <colspec colwidth="6*" align="center"/>
24785 <colspec colwidth="6*" align="center"/>
24786 <colspec colwidth="6*" align="right"/>
24787 <tbody>
24788 <row>
24789 <entry><option>dkim_verify_signers</option></entry>
24790 <entry>Use: <emphasis>main</emphasis></entry>
24791 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24792 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
24793 </row>
24794 </tbody>
24795 </tgroup>
24796 </informaltable>
24797 <para>
24798 <indexterm role="concept">
24799 <primary>DKIM</primary>
24800 <secondary>controlling calls to the ACL</secondary>
24801 </indexterm>
24802 This option gives a list of DKIM domains for which the DKIM ACL is run.
24803 It is expanded after the message is received; by default it runs
24804 the ACL once for each signature in the message.
24805 See section <xref linkend="SECDKIMVFY"/>.
24806 </para>
24807 <para>
24808 <indexterm role="option">
24809 <primary><option>dns_again_means_nonexist</option></primary>
24810 </indexterm>
24811 </para>
24812 <informaltable frame="all">
24813 <tgroup cols="4" colsep="0" rowsep="0">
24814 <colspec colwidth="8*" align="left"/>
24815 <colspec colwidth="6*" align="center"/>
24816 <colspec colwidth="6*" align="center"/>
24817 <colspec colwidth="6*" align="right"/>
24818 <tbody>
24819 <row>
24820 <entry><option>dns_again_means_nonexist</option></entry>
24821 <entry>Use: <emphasis>main</emphasis></entry>
24822 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24823 <entry>Default: <emphasis>unset</emphasis></entry>
24824 </row>
24825 </tbody>
24826 </tgroup>
24827 </informaltable>
24828 <para>
24829 <indexterm role="concept">
24830 <primary>DNS</primary>
24831 <secondary><quote>try again</quote> response; overriding</secondary>
24832 </indexterm>
24833 DNS lookups give a <quote>try again</quote> response for the DNS errors
24834 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
24835 keep trying to deliver a message, or to give repeated temporary errors to
24836 incoming mail. Sometimes the effect is caused by a badly set up name server and
24837 may persist for a long time. If a domain which exhibits this problem matches
24838 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
24839 This option should be used with care. You can make it apply to reverse lookups
24840 by a setting such as this:
24841 </para>
24842 <literallayout class="monospaced">
24843 dns_again_means_nonexist = *.in-addr.arpa
24844 </literallayout>
24845 <para>
24846 This option applies to all DNS lookups that Exim does. It also applies when the
24847 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
24848 since these are most likely to be caused by DNS lookup problems. The
24849 <command>dnslookup</command> router has some options of its own for controlling what happens
24850 when lookups for MX or SRV records give temporary errors. These more specific
24851 options are applied after this global option.
24852 </para>
24853 <para>
24854 <indexterm role="option">
24855 <primary><option>dns_check_names_pattern</option></primary>
24856 </indexterm>
24857 </para>
24858 <informaltable frame="all">
24859 <tgroup cols="4" colsep="0" rowsep="0">
24860 <colspec colwidth="8*" align="left"/>
24861 <colspec colwidth="6*" align="center"/>
24862 <colspec colwidth="6*" align="center"/>
24863 <colspec colwidth="6*" align="right"/>
24864 <tbody>
24865 <row>
24866 <entry><option>dns_check_names_pattern</option></entry>
24867 <entry>Use: <emphasis>main</emphasis></entry>
24868 <entry>Type: <emphasis>string</emphasis></entry>
24869 <entry>Default: <emphasis>see below</emphasis></entry>
24870 </row>
24871 </tbody>
24872 </tgroup>
24873 </informaltable>
24874 <para>
24875 <indexterm role="concept">
24876 <primary>DNS</primary>
24877 <secondary>pre-check of name syntax</secondary>
24878 </indexterm>
24879 When this option is set to a non-empty string, it causes Exim to check domain
24880 names for characters that are not allowed in host names before handing them to
24881 the DNS resolver, because some resolvers give temporary errors for names that
24882 contain unusual characters. If a domain name contains any unwanted characters,
24883 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
24884 done by matching the domain name against a regular expression, which is the
24885 value of this option. The default pattern is
24886 </para>
24887 <literallayout class="monospaced">
24888 dns_check_names_pattern = \
24889   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
24890 </literallayout>
24891 <para>
24892 which permits only letters, digits, slashes, and hyphens in components, but
24893 they must start and end with a letter or digit. Slashes are not, in fact,
24894 permitted in host names, but they are found in certain NS records (which can be
24895 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
24896 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
24897 empty string.
24898 </para>
24899 <para>
24900 <indexterm role="option">
24901 <primary><option>dns_csa_search_limit</option></primary>
24902 </indexterm>
24903 </para>
24904 <informaltable frame="all">
24905 <tgroup cols="4" colsep="0" rowsep="0">
24906 <colspec colwidth="8*" align="left"/>
24907 <colspec colwidth="6*" align="center"/>
24908 <colspec colwidth="6*" align="center"/>
24909 <colspec colwidth="6*" align="right"/>
24910 <tbody>
24911 <row>
24912 <entry><option>dns_csa_search_limit</option></entry>
24913 <entry>Use: <emphasis>main</emphasis></entry>
24914 <entry>Type: <emphasis>integer</emphasis></entry>
24915 <entry>Default: <emphasis>5</emphasis></entry>
24916 </row>
24917 </tbody>
24918 </tgroup>
24919 </informaltable>
24920 <para>
24921 This option controls the depth of parental searching for CSA SRV records in the
24922 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
24923 </para>
24924 <para>
24925 <indexterm role="option">
24926 <primary><option>dns_csa_use_reverse</option></primary>
24927 </indexterm>
24928 </para>
24929 <informaltable frame="all">
24930 <tgroup cols="4" colsep="0" rowsep="0">
24931 <colspec colwidth="8*" align="left"/>
24932 <colspec colwidth="6*" align="center"/>
24933 <colspec colwidth="6*" align="center"/>
24934 <colspec colwidth="6*" align="right"/>
24935 <tbody>
24936 <row>
24937 <entry><option>dns_csa_use_reverse</option></entry>
24938 <entry>Use: <emphasis>main</emphasis></entry>
24939 <entry>Type: <emphasis>boolean</emphasis></entry>
24940 <entry>Default: <emphasis>true</emphasis></entry>
24941 </row>
24942 </tbody>
24943 </tgroup>
24944 </informaltable>
24945 <para>
24946 This option controls whether or not an IP address, given as a CSA domain, is
24947 reversed and looked up in the reverse DNS, as described in more detail in
24948 section <xref linkend="SECTverifyCSA"/>.
24949 </para>
24950 <para>
24951 <indexterm role="option">
24952 <primary><option>dns_dnssec_ok</option></primary>
24953 </indexterm>
24954 </para>
24955 <informaltable frame="all">
24956 <tgroup cols="4" colsep="0" rowsep="0">
24957 <colspec colwidth="8*" align="left"/>
24958 <colspec colwidth="6*" align="center"/>
24959 <colspec colwidth="6*" align="center"/>
24960 <colspec colwidth="6*" align="right"/>
24961 <tbody>
24962 <row>
24963 <entry><option>dns_dnssec_ok</option></entry>
24964 <entry>Use: <emphasis>main</emphasis></entry>
24965 <entry>Type: <emphasis>integer</emphasis></entry>
24966 <entry>Default: <emphasis>-1</emphasis></entry>
24967 </row>
24968 </tbody>
24969 </tgroup>
24970 </informaltable>
24971 <para>
24972 <indexterm role="concept">
24973 <primary>DNS</primary>
24974 <secondary>resolver options</secondary>
24975 </indexterm>
24976 <indexterm role="concept">
24977 <primary>DNS</primary>
24978 <secondary>DNSSEC</secondary>
24979 </indexterm>
24980 If this option is set to a non-negative number then Exim will initialise the
24981 DNS resolver library to either use or not use DNSSEC, overriding the system
24982 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
24983 </para>
24984 <para>
24985 If the resolver library does not support DNSSEC then this option has no effect.
24986 </para>
24987 <para>
24988 <indexterm role="option">
24989 <primary><option>dns_ipv4_lookup</option></primary>
24990 </indexterm>
24991 </para>
24992 <informaltable frame="all">
24993 <tgroup cols="4" colsep="0" rowsep="0">
24994 <colspec colwidth="8*" align="left"/>
24995 <colspec colwidth="6*" align="center"/>
24996 <colspec colwidth="6*" align="center"/>
24997 <colspec colwidth="6*" align="right"/>
24998 <tbody>
24999 <row>
25000 <entry><option>dns_ipv4_lookup</option></entry>
25001 <entry>Use: <emphasis>main</emphasis></entry>
25002 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25003 <entry>Default: <emphasis>unset</emphasis></entry>
25004 </row>
25005 </tbody>
25006 </tgroup>
25007 </informaltable>
25008 <para>
25009 <indexterm role="concept">
25010 <primary>IPv6</primary>
25011 <secondary>DNS lookup for AAAA records</secondary>
25012 </indexterm>
25013 <indexterm role="concept">
25014 <primary>DNS</primary>
25015 <secondary>IPv6 lookup for AAAA records</secondary>
25016 </indexterm>
25017 <indexterm role="concept">
25018 <primary>DNS</primary>
25019 <secondary>IPv6 disabling</secondary>
25020 </indexterm>
25021 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
25022 looks for IPv6 address records (AAAA records) as well as IPv4 address records
25023 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
25024 domain matches this list.
25025 </para>
25026 <para>
25027 This is a fudge to help with name servers that give big delays or otherwise do
25028 not work for the AAAA record type. In due course, when the world&#x2019;s name
25029 servers have all been upgraded, there should be no need for this option.
25030 </para>
25031 <para>
25032 <indexterm role="option">
25033 <primary><option>dns_retrans</option></primary>
25034 </indexterm>
25035 </para>
25036 <informaltable frame="all">
25037 <tgroup cols="4" colsep="0" rowsep="0">
25038 <colspec colwidth="8*" align="left"/>
25039 <colspec colwidth="6*" align="center"/>
25040 <colspec colwidth="6*" align="center"/>
25041 <colspec colwidth="6*" align="right"/>
25042 <tbody>
25043 <row>
25044 <entry><option>dns_retrans</option></entry>
25045 <entry>Use: <emphasis>main</emphasis></entry>
25046 <entry>Type: <emphasis>time</emphasis></entry>
25047 <entry>Default: <emphasis>0s</emphasis></entry>
25048 </row>
25049 </tbody>
25050 </tgroup>
25051 </informaltable>
25052 <para>
25053 <indexterm role="concept">
25054 <primary>DNS</primary>
25055 <secondary>resolver options</secondary>
25056 </indexterm>
25057 <indexterm role="concept">
25058 <primary>timeout</primary>
25059 <secondary>dns lookup</secondary>
25060 </indexterm>
25061 <indexterm role="concept">
25062 <primary>DNS</primary>
25063 <secondary>timeout</secondary>
25064 </indexterm>
25065 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
25066 retransmission and retry parameters for DNS lookups. Values of zero (the
25067 defaults) leave the system default settings unchanged. The first value is the
25068 time between retries, and the second is the number of retries. It isn&#x2019;t
25069 totally clear exactly how these settings affect the total time a DNS lookup may
25070 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
25071 parameter values are available in the external resolver interface structure,
25072 but nowhere does it seem to describe how they are used or what you might want
25073 to set in them.
25074 See also the <option>slow_lookup_log</option> option.
25075 </para>
25076 <para>
25077 <indexterm role="option">
25078 <primary><option>dns_retry</option></primary>
25079 </indexterm>
25080 </para>
25081 <informaltable frame="all">
25082 <tgroup cols="4" colsep="0" rowsep="0">
25083 <colspec colwidth="8*" align="left"/>
25084 <colspec colwidth="6*" align="center"/>
25085 <colspec colwidth="6*" align="center"/>
25086 <colspec colwidth="6*" align="right"/>
25087 <tbody>
25088 <row>
25089 <entry><option>dns_retry</option></entry>
25090 <entry>Use: <emphasis>main</emphasis></entry>
25091 <entry>Type: <emphasis>integer</emphasis></entry>
25092 <entry>Default: <emphasis>0</emphasis></entry>
25093 </row>
25094 </tbody>
25095 </tgroup>
25096 </informaltable>
25097 <para>
25098 See <option>dns_retrans</option> above.
25099 </para>
25100 <para>
25101 <indexterm role="option">
25102 <primary><option>dns_trust_aa</option></primary>
25103 </indexterm>
25104 </para>
25105 <informaltable frame="all">
25106 <tgroup cols="4" colsep="0" rowsep="0">
25107 <colspec colwidth="8*" align="left"/>
25108 <colspec colwidth="6*" align="center"/>
25109 <colspec colwidth="6*" align="center"/>
25110 <colspec colwidth="6*" align="right"/>
25111 <tbody>
25112 <row>
25113 <entry><option>dns_trust_aa</option></entry>
25114 <entry>Use: <emphasis>main</emphasis></entry>
25115 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25116 <entry>Default: <emphasis>unset</emphasis></entry>
25117 </row>
25118 </tbody>
25119 </tgroup>
25120 </informaltable>
25121 <para>
25122 <indexterm role="concept">
25123 <primary>DNS</primary>
25124 <secondary>resolver options</secondary>
25125 </indexterm>
25126 <indexterm role="concept">
25127 <primary>DNS</primary>
25128 <secondary>DNSSEC</secondary>
25129 </indexterm>
25130 If this option is set then lookup results marked with the AA bit
25131 (Authoritative Answer) are trusted the same way as if they were
25132 DNSSEC-verified. The authority section&#x2019;s name of the answer must
25133 match with this expanded domain list.
25134 </para>
25135 <para>
25136 Use this option only if you talk directly to a resolver that is
25137 authoritative for some zones and does not set the AD (Authentic Data)
25138 bit in the answer. Some DNS servers may have an configuration option to
25139 mark the answers from their own zones as verified (they set the AD bit).
25140 Others do not have this option. It is considered as poor practice using
25141 a resolver that is an authoritative server for some zones.
25142 </para>
25143 <para>
25144 Use this option only if you really have to (e.g. if you want
25145 to use DANE for remote delivery to a server that is listed in the DNS
25146 zones that your resolver is authoritative for).
25147 </para>
25148 <para>
25149 If the DNS answer packet has the AA bit set and contains resource record
25150 in the answer section, the name of the first NS record appearing in the
25151 authority section is compared against the list. If the answer packet is
25152 authoritative but the answer section is empty, the name of the first SOA
25153 record in the authoritative section is used instead.
25154 </para>
25155 <para>
25156 <indexterm role="concept">
25157 <primary>DNS</primary>
25158 <secondary>resolver options</secondary>
25159 </indexterm>
25160 <indexterm role="option">
25161 <primary><option>dns_use_edns0</option></primary>
25162 </indexterm>
25163 </para>
25164 <informaltable frame="all">
25165 <tgroup cols="4" colsep="0" rowsep="0">
25166 <colspec colwidth="8*" align="left"/>
25167 <colspec colwidth="6*" align="center"/>
25168 <colspec colwidth="6*" align="center"/>
25169 <colspec colwidth="6*" align="right"/>
25170 <tbody>
25171 <row>
25172 <entry><option>dns_use_edns0</option></entry>
25173 <entry>Use: <emphasis>main</emphasis></entry>
25174 <entry>Type: <emphasis>integer</emphasis></entry>
25175 <entry>Default: <emphasis>-1</emphasis></entry>
25176 </row>
25177 </tbody>
25178 </tgroup>
25179 </informaltable>
25180 <para>
25181 <indexterm role="concept">
25182 <primary>DNS</primary>
25183 <secondary>resolver options</secondary>
25184 </indexterm>
25185 <indexterm role="concept">
25186 <primary>DNS</primary>
25187 <secondary>EDNS0</secondary>
25188 </indexterm>
25189 <indexterm role="concept">
25190 <primary>DNS</primary>
25191 <secondary>OpenBSD</secondary>
25192 </indexterm>
25193 If this option is set to a non-negative number then Exim will initialise the
25194 DNS resolver library to either use or not use EDNS0 extensions, overriding
25195 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
25196 on.
25197 </para>
25198 <para>
25199 If the resolver library does not support EDNS0 then this option has no effect.
25200 </para>
25201 <para>
25202 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
25203 means that DNSSEC will not work with Exim on that platform either, unless Exim
25204 is linked against an alternative DNS client library.
25205 </para>
25206 <para>
25207 <indexterm role="option">
25208 <primary><option>drop_cr</option></primary>
25209 </indexterm>
25210 </para>
25211 <informaltable frame="all">
25212 <tgroup cols="4" colsep="0" rowsep="0">
25213 <colspec colwidth="8*" align="left"/>
25214 <colspec colwidth="6*" align="center"/>
25215 <colspec colwidth="6*" align="center"/>
25216 <colspec colwidth="6*" align="right"/>
25217 <tbody>
25218 <row>
25219 <entry><option>drop_cr</option></entry>
25220 <entry>Use: <emphasis>main</emphasis></entry>
25221 <entry>Type: <emphasis>boolean</emphasis></entry>
25222 <entry>Default: <emphasis>false</emphasis></entry>
25223 </row>
25224 </tbody>
25225 </tgroup>
25226 </informaltable>
25227 <para>
25228 This is an obsolete option that is now a no-op. It used to affect the way Exim
25229 handled CR and LF characters in incoming messages. What happens now is
25230 described in section <xref linkend="SECTlineendings"/>.
25231 </para>
25232 <para>
25233 <indexterm role="option">
25234 <primary><option>dsn_advertise_hosts</option></primary>
25235 </indexterm>
25236 </para>
25237 <informaltable frame="all">
25238 <tgroup cols="4" colsep="0" rowsep="0">
25239 <colspec colwidth="8*" align="left"/>
25240 <colspec colwidth="6*" align="center"/>
25241 <colspec colwidth="6*" align="center"/>
25242 <colspec colwidth="6*" align="right"/>
25243 <tbody>
25244 <row>
25245 <entry><option>dsn_advertise_hosts</option></entry>
25246 <entry>Use: <emphasis>main</emphasis></entry>
25247 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25248 <entry>Default: <emphasis>unset</emphasis></entry>
25249 </row>
25250 </tbody>
25251 </tgroup>
25252 </informaltable>
25253 <para>
25254 <indexterm role="concept">
25255 <primary>bounce messages</primary>
25256 <secondary>success</secondary>
25257 </indexterm>
25258 <indexterm role="concept">
25259 <primary>DSN</primary>
25260 <secondary>success</secondary>
25261 </indexterm>
25262 <indexterm role="concept">
25263 <primary>Delivery Status Notification</primary>
25264 <secondary>success</secondary>
25265 </indexterm>
25266 DSN extensions (RFC3461) will be advertised in the EHLO message to,
25267 and accepted from, these hosts.
25268 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
25269 and RET and ORCPT options on MAIL FROM commands.
25270 A NOTIFY=SUCCESS option requests success-DSN messages.
25271 A NOTIFY= option with no argument requests that no delay or failure DSNs
25272 are sent.
25273 </para>
25274 <para>
25275 <indexterm role="option">
25276 <primary><option>dsn_from</option></primary>
25277 </indexterm>
25278 </para>
25279 <informaltable frame="all">
25280 <tgroup cols="4" colsep="0" rowsep="0">
25281 <colspec colwidth="8*" align="left"/>
25282 <colspec colwidth="6*" align="center"/>
25283 <colspec colwidth="6*" align="center"/>
25284 <colspec colwidth="6*" align="right"/>
25285 <tbody>
25286 <row>
25287 <entry><option>dsn_from</option></entry>
25288 <entry>Use: <emphasis>main</emphasis></entry>
25289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25290 <entry>Default: <emphasis>see below</emphasis></entry>
25291 </row>
25292 </tbody>
25293 </tgroup>
25294 </informaltable>
25295 <para>
25296 <indexterm role="concept">
25297 <primary><emphasis>From:</emphasis> header line</primary>
25298 <secondary>in bounces</secondary>
25299 </indexterm>
25300 <indexterm role="concept">
25301 <primary>bounce messages</primary>
25302 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
25303 </indexterm>
25304 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
25305 bounces and other automatically generated messages (<quote>Delivery Status
25306 Notifications</quote> &ndash; hence the name of the option). The default setting is:
25307 </para>
25308 <literallayout class="monospaced">
25309 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
25310 </literallayout>
25311 <para>
25312 The value is expanded every time it is needed. If the expansion fails, a
25313 panic is logged, and the default value is used.
25314 </para>
25315 <para>
25316 <indexterm role="option">
25317 <primary><option>envelope_to_remove</option></primary>
25318 </indexterm>
25319 </para>
25320 <informaltable frame="all">
25321 <tgroup cols="4" colsep="0" rowsep="0">
25322 <colspec colwidth="8*" align="left"/>
25323 <colspec colwidth="6*" align="center"/>
25324 <colspec colwidth="6*" align="center"/>
25325 <colspec colwidth="6*" align="right"/>
25326 <tbody>
25327 <row>
25328 <entry><option>envelope_to_remove</option></entry>
25329 <entry>Use: <emphasis>main</emphasis></entry>
25330 <entry>Type: <emphasis>boolean</emphasis></entry>
25331 <entry>Default: <emphasis>true</emphasis></entry>
25332 </row>
25333 </tbody>
25334 </tgroup>
25335 </informaltable>
25336 <para>
25337 <indexterm role="concept">
25338 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
25339 </indexterm>
25340 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
25341 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25342 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
25343 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
25344 be present in incoming messages, and this option causes them to be removed at
25345 the time the message is received, to avoid any problems that might occur when a
25346 delivered message is subsequently sent on to some other recipient.
25347 </para>
25348 <para>
25349 <indexterm role="option">
25350 <primary><option>errors_copy</option></primary>
25351 </indexterm>
25352 </para>
25353 <informaltable frame="all">
25354 <tgroup cols="4" colsep="0" rowsep="0">
25355 <colspec colwidth="8*" align="left"/>
25356 <colspec colwidth="6*" align="center"/>
25357 <colspec colwidth="6*" align="center"/>
25358 <colspec colwidth="6*" align="right"/>
25359 <tbody>
25360 <row>
25361 <entry><option>errors_copy</option></entry>
25362 <entry>Use: <emphasis>main</emphasis></entry>
25363 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25364 <entry>Default: <emphasis>unset</emphasis></entry>
25365 </row>
25366 </tbody>
25367 </tgroup>
25368 </informaltable>
25369 <para>
25370 <indexterm role="concept">
25371 <primary>bounce message</primary>
25372 <secondary>copy to other address</secondary>
25373 </indexterm>
25374 <indexterm role="concept">
25375 <primary>copy of bounce message</primary>
25376 </indexterm>
25377 Setting this option causes Exim to send bcc copies of bounce messages that it
25378 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
25379 coming from elsewhere. The value of the option is a colon-separated list of
25380 items. Each item consists of a pattern, terminated by white space, followed by
25381 a comma-separated list of email addresses. If a pattern contains spaces, it
25382 must be enclosed in double quotes.
25383 </para>
25384 <para>
25385 Each pattern is processed in the same way as a single item in an address list
25386 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
25387 the bounce message, the message is copied to the addresses on the list. The
25388 items are scanned in order, and once a matching one is found, no further items
25389 are examined. For example:
25390 </para>
25391 <literallayout class="monospaced">
25392 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
25393               rqps@mydomain   hostmaster@mydomain.example,\
25394                               postmaster@mydomain.example
25395 </literallayout>
25396 <para>
25397 <indexterm role="variable">
25398 <primary><varname>$domain</varname></primary>
25399 </indexterm>
25400 <indexterm role="variable">
25401 <primary><varname>$local_part</varname></primary>
25402 </indexterm>
25403 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
25404 and <varname>$domain</varname> are set from the original recipient of the error message, and if
25405 there was any wildcard matching in the pattern, the expansion
25406 <indexterm role="concept">
25407 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25408 <secondary>in <option>errors_copy</option></secondary>
25409 </indexterm>
25410 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
25411 </para>
25412 <para>
25413 <indexterm role="option">
25414 <primary><option>errors_reply_to</option></primary>
25415 </indexterm>
25416 </para>
25417 <informaltable frame="all">
25418 <tgroup cols="4" colsep="0" rowsep="0">
25419 <colspec colwidth="8*" align="left"/>
25420 <colspec colwidth="6*" align="center"/>
25421 <colspec colwidth="6*" align="center"/>
25422 <colspec colwidth="6*" align="right"/>
25423 <tbody>
25424 <row>
25425 <entry><option>errors_reply_to</option></entry>
25426 <entry>Use: <emphasis>main</emphasis></entry>
25427 <entry>Type: <emphasis>string</emphasis></entry>
25428 <entry>Default: <emphasis>unset</emphasis></entry>
25429 </row>
25430 </tbody>
25431 </tgroup>
25432 </informaltable>
25433 <para>
25434 <indexterm role="concept">
25435 <primary>bounce message</primary>
25436 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
25437 </indexterm>
25438 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
25439 </para>
25440 <literallayout>
25441 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
25442 </literallayout>
25443 <para>
25444 <indexterm role="option">
25445 <primary><option>quota_warn_message</option></primary>
25446 </indexterm>
25447 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
25448 A warning message that is generated by the <option>quota_warn_message</option> option in an
25449 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
25450 overrides the default.
25451 </para>
25452 <para>
25453 Experience shows that people reply to bounce messages. If the
25454 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
25455 and warning messages. For example:
25456 </para>
25457 <literallayout class="monospaced">
25458 errors_reply_to = postmaster@my.domain.example
25459 </literallayout>
25460 <para>
25461 The value of the option is not expanded. It must specify a valid RFC 2822
25462 address. However, if a warning message that is generated by the
25463 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
25464 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
25465 not used.
25466 </para>
25467 <para>
25468 <indexterm role="option">
25469 <primary><option>event_action</option></primary>
25470 </indexterm>
25471 </para>
25472 <informaltable frame="all">
25473 <tgroup cols="4" colsep="0" rowsep="0">
25474 <colspec colwidth="8*" align="left"/>
25475 <colspec colwidth="6*" align="center"/>
25476 <colspec colwidth="6*" align="center"/>
25477 <colspec colwidth="6*" align="right"/>
25478 <tbody>
25479 <row>
25480 <entry><option>event_action</option></entry>
25481 <entry>Use: <emphasis>main</emphasis></entry>
25482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25483 <entry>Default: <emphasis>unset</emphasis></entry>
25484 </row>
25485 </tbody>
25486 </tgroup>
25487 </informaltable>
25488 <para>
25489 <indexterm role="concept">
25490 <primary>events</primary>
25491 </indexterm>
25492 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
25493 For details see chapter <xref linkend="CHAPevents"/>.
25494 </para>
25495 <para>
25496 <indexterm role="option">
25497 <primary><option>exim_group</option></primary>
25498 </indexterm>
25499 </para>
25500 <informaltable frame="all">
25501 <tgroup cols="4" colsep="0" rowsep="0">
25502 <colspec colwidth="8*" align="left"/>
25503 <colspec colwidth="6*" align="center"/>
25504 <colspec colwidth="6*" align="center"/>
25505 <colspec colwidth="6*" align="right"/>
25506 <tbody>
25507 <row>
25508 <entry><option>exim_group</option></entry>
25509 <entry>Use: <emphasis>main</emphasis></entry>
25510 <entry>Type: <emphasis>string</emphasis></entry>
25511 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25512 </row>
25513 </tbody>
25514 </tgroup>
25515 </informaltable>
25516 <para>
25517 <indexterm role="concept">
25518 <primary>gid (group id)</primary>
25519 <secondary>Exim&#x2019;s own</secondary>
25520 </indexterm>
25521 <indexterm role="concept">
25522 <primary>Exim group</primary>
25523 </indexterm>
25524 This option changes the gid under which Exim runs when it gives up root
25525 privilege. The default value is compiled into the binary. The value of this
25526 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
25527 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
25528 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
25529 security issues.
25530 </para>
25531 <para>
25532 <indexterm role="option">
25533 <primary><option>exim_path</option></primary>
25534 </indexterm>
25535 </para>
25536 <informaltable frame="all">
25537 <tgroup cols="4" colsep="0" rowsep="0">
25538 <colspec colwidth="8*" align="left"/>
25539 <colspec colwidth="6*" align="center"/>
25540 <colspec colwidth="6*" align="center"/>
25541 <colspec colwidth="6*" align="right"/>
25542 <tbody>
25543 <row>
25544 <entry><option>exim_path</option></entry>
25545 <entry>Use: <emphasis>main</emphasis></entry>
25546 <entry>Type: <emphasis>string</emphasis></entry>
25547 <entry>Default: <emphasis>see below</emphasis></entry>
25548 </row>
25549 </tbody>
25550 </tgroup>
25551 </informaltable>
25552 <para>
25553 <indexterm role="concept">
25554 <primary>Exim binary, path name</primary>
25555 </indexterm>
25556 This option specifies the path name of the Exim binary, which is used when Exim
25557 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
25558 the directory configured at compile time by the BIN_DIRECTORY setting. It
25559 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
25560 other place.
25561 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
25562 you will break those Exim utilities that scan the configuration file to find
25563 where the binary is. (They then use the <option>-bP</option> option to extract option
25564 settings such as the value of <option>spool_directory</option>.)
25565 </para>
25566 <para>
25567 <indexterm role="option">
25568 <primary><option>exim_user</option></primary>
25569 </indexterm>
25570 </para>
25571 <informaltable frame="all">
25572 <tgroup cols="4" colsep="0" rowsep="0">
25573 <colspec colwidth="8*" align="left"/>
25574 <colspec colwidth="6*" align="center"/>
25575 <colspec colwidth="6*" align="center"/>
25576 <colspec colwidth="6*" align="right"/>
25577 <tbody>
25578 <row>
25579 <entry><option>exim_user</option></entry>
25580 <entry>Use: <emphasis>main</emphasis></entry>
25581 <entry>Type: <emphasis>string</emphasis></entry>
25582 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25583 </row>
25584 </tbody>
25585 </tgroup>
25586 </informaltable>
25587 <para>
25588 <indexterm role="concept">
25589 <primary>uid (user id)</primary>
25590 <secondary>Exim&#x2019;s own</secondary>
25591 </indexterm>
25592 <indexterm role="concept">
25593 <primary>Exim user</primary>
25594 </indexterm>
25595 This option changes the uid under which Exim runs when it gives up root
25596 privilege. The default value is compiled into the binary. Ownership of the run
25597 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25598 options is checked against the values in the binary, not what is set here.
25599 </para>
25600 <para>
25601 Unless it consists entirely of digits, the string is looked up using
25602 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25603 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25604 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25605 </para>
25606 <para>
25607 <indexterm role="option">
25608 <primary><option>extra_local_interfaces</option></primary>
25609 </indexterm>
25610 </para>
25611 <informaltable frame="all">
25612 <tgroup cols="4" colsep="0" rowsep="0">
25613 <colspec colwidth="8*" align="left"/>
25614 <colspec colwidth="6*" align="center"/>
25615 <colspec colwidth="6*" align="center"/>
25616 <colspec colwidth="6*" align="right"/>
25617 <tbody>
25618 <row>
25619 <entry><option>extra_local_interfaces</option></entry>
25620 <entry>Use: <emphasis>main</emphasis></entry>
25621 <entry>Type: <emphasis>string list</emphasis></entry>
25622 <entry>Default: <emphasis>unset</emphasis></entry>
25623 </row>
25624 </tbody>
25625 </tgroup>
25626 </informaltable>
25627 <para>
25628 This option defines network interfaces that are to be considered local when
25629 routing, but which are not used for listening by the daemon. See section
25630 <xref linkend="SECTreclocipadd"/> for details.
25631 </para>
25632 <para>
25633 <indexterm role="option">
25634 <primary><option>extract_addresses_remove_arguments</option></primary>
25635 </indexterm>
25636 </para>
25637 <informaltable frame="all">
25638 <tgroup cols="4" colsep="0" rowsep="0">
25639 <colspec colwidth="8*" align="left"/>
25640 <colspec colwidth="6*" align="center"/>
25641 <colspec colwidth="6*" align="center"/>
25642 <colspec colwidth="6*" align="right"/>
25643 <tbody>
25644 <row>
25645 <entry><option>extract_addresses_remove_arguments</option></entry>
25646 <entry>Use: <emphasis>main</emphasis></entry>
25647 <entry>Type: <emphasis>boolean</emphasis></entry>
25648 <entry>Default: <emphasis>true</emphasis></entry>
25649 </row>
25650 </tbody>
25651 </tgroup>
25652 </informaltable>
25653 <para>
25654 <indexterm role="option">
25655 <primary><option>-t</option></primary>
25656 </indexterm>
25657 <indexterm role="concept">
25658 <primary>command line</primary>
25659 <secondary>addresses with <option>-t</option></secondary>
25660 </indexterm>
25661 <indexterm role="concept">
25662 <primary>Sendmail compatibility</primary>
25663 <secondary><option>-t</option> option</secondary>
25664 </indexterm>
25665 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
25666 are present on the command line when the <option>-t</option> option is used to build an
25667 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
25668 line addresses are removed from the recipients list. This is also how Smail
25669 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
25670 command line addresses are added to those obtained from the header lines. When
25671 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
25672 argument headers. If it is set false, Exim adds rather than removes argument
25673 addresses.
25674 </para>
25675 <para>
25676 <indexterm role="option">
25677 <primary><option>finduser_retries</option></primary>
25678 </indexterm>
25679 </para>
25680 <informaltable frame="all">
25681 <tgroup cols="4" colsep="0" rowsep="0">
25682 <colspec colwidth="8*" align="left"/>
25683 <colspec colwidth="6*" align="center"/>
25684 <colspec colwidth="6*" align="center"/>
25685 <colspec colwidth="6*" align="right"/>
25686 <tbody>
25687 <row>
25688 <entry><option>finduser_retries</option></entry>
25689 <entry>Use: <emphasis>main</emphasis></entry>
25690 <entry>Type: <emphasis>integer</emphasis></entry>
25691 <entry>Default: <emphasis>0</emphasis></entry>
25692 </row>
25693 </tbody>
25694 </tgroup>
25695 </informaltable>
25696 <para>
25697 <indexterm role="concept">
25698 <primary>NIS, retrying user lookups</primary>
25699 </indexterm>
25700 On systems running NIS or other schemes in which user and group information is
25701 distributed from a remote system, there can be times when <function>getpwnam()</function> and
25702 related functions fail, even when given valid data, because things time out.
25703 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
25704 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
25705 many extra times to find a user or a group, waiting for one second between
25706 retries.
25707 </para>
25708 <para>
25709 <indexterm role="concept">
25710 <primary><filename>/etc/passwd</filename></primary>
25711 <secondary>multiple reading of</secondary>
25712 </indexterm>
25713 You should not set this option greater than zero if your user information is in
25714 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
25715 search the file multiple times for non-existent users, and also cause delay.
25716 </para>
25717 <para>
25718 <indexterm role="option">
25719 <primary><option>freeze_tell</option></primary>
25720 </indexterm>
25721 </para>
25722 <informaltable frame="all">
25723 <tgroup cols="4" colsep="0" rowsep="0">
25724 <colspec colwidth="8*" align="left"/>
25725 <colspec colwidth="6*" align="center"/>
25726 <colspec colwidth="6*" align="center"/>
25727 <colspec colwidth="6*" align="right"/>
25728 <tbody>
25729 <row>
25730 <entry><option>freeze_tell</option></entry>
25731 <entry>Use: <emphasis>main</emphasis></entry>
25732 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
25733 <entry>Default: <emphasis>unset</emphasis></entry>
25734 </row>
25735 </tbody>
25736 </tgroup>
25737 </informaltable>
25738 <para>
25739 <indexterm role="concept">
25740 <primary>freezing messages</primary>
25741 <secondary>sending a message when freezing</secondary>
25742 </indexterm>
25743 On encountering certain errors, or when configured to do so in a system filter,
25744 ACL, or special router, Exim freezes a message. This means that no further
25745 delivery attempts take place until an administrator thaws the message, or the
25746 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
25747 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
25748 warning message whenever it freezes something, unless the message it is
25749 freezing is a locally-generated bounce message. (Without this exception there
25750 is the possibility of looping.) The warning message is sent to the addresses
25751 supplied as the comma-separated value of this option. If several of the
25752 message&#x2019;s addresses cause freezing, only a single message is sent. If the
25753 freezing was automatic, the reason(s) for freezing can be found in the message
25754 log. If you configure freezing in a filter or ACL, you must arrange for any
25755 logging that you require.
25756 </para>
25757 <para>
25758 <indexterm role="option">
25759 <primary><option>gecos_name</option></primary>
25760 </indexterm>
25761 </para>
25762 <informaltable frame="all">
25763 <tgroup cols="4" colsep="0" rowsep="0">
25764 <colspec colwidth="8*" align="left"/>
25765 <colspec colwidth="6*" align="center"/>
25766 <colspec colwidth="6*" align="center"/>
25767 <colspec colwidth="6*" align="right"/>
25768 <tbody>
25769 <row>
25770 <entry><option>gecos_name</option></entry>
25771 <entry>Use: <emphasis>main</emphasis></entry>
25772 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25773 <entry>Default: <emphasis>unset</emphasis></entry>
25774 </row>
25775 </tbody>
25776 </tgroup>
25777 </informaltable>
25778 <para>
25779 <indexterm role="concept">
25780 <primary>HP-UX</primary>
25781 </indexterm>
25782 <indexterm role="concept">
25783 <primary><quote>gecos</quote> field, parsing</primary>
25784 </indexterm>
25785 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
25786 password file to hold other information in addition to users&#x2019; real names. Exim
25787 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
25788 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
25789 of the field are used unchanged, except that, if an ampersand is encountered,
25790 it is replaced by the user&#x2019;s login name with the first character forced to
25791 upper case, since this is a convention that is observed on many systems.
25792 </para>
25793 <para>
25794 When these options are set, <option>gecos_pattern</option> is treated as a regular
25795 expression that is to be applied to the field (again with &amp; replaced by the
25796 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
25797 user&#x2019;s name.
25798 </para>
25799 <para>
25800 <indexterm role="concept">
25801 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25802 <secondary>in <option>gecos_name</option></secondary>
25803 </indexterm>
25804 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
25805 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
25806 name terminates at the first comma, the following can be used:
25807 </para>
25808 <literallayout class="monospaced">
25809 gecos_pattern = ([^,]*)
25810 gecos_name = $1
25811 </literallayout>
25812 <para>
25813 <indexterm role="option">
25814 <primary><option>gecos_pattern</option></primary>
25815 </indexterm>
25816 </para>
25817 <informaltable frame="all">
25818 <tgroup cols="4" colsep="0" rowsep="0">
25819 <colspec colwidth="8*" align="left"/>
25820 <colspec colwidth="6*" align="center"/>
25821 <colspec colwidth="6*" align="center"/>
25822 <colspec colwidth="6*" align="right"/>
25823 <tbody>
25824 <row>
25825 <entry><option>gecos_pattern</option></entry>
25826 <entry>Use: <emphasis>main</emphasis></entry>
25827 <entry>Type: <emphasis>string</emphasis></entry>
25828 <entry>Default: <emphasis>unset</emphasis></entry>
25829 </row>
25830 </tbody>
25831 </tgroup>
25832 </informaltable>
25833 <para>
25834 See <option>gecos_name</option> above.
25835 </para>
25836 <para>
25837 <indexterm role="option">
25838 <primary><option>gnutls_compat_mode</option></primary>
25839 </indexterm>
25840 </para>
25841 <informaltable frame="all">
25842 <tgroup cols="4" colsep="0" rowsep="0">
25843 <colspec colwidth="8*" align="left"/>
25844 <colspec colwidth="6*" align="center"/>
25845 <colspec colwidth="6*" align="center"/>
25846 <colspec colwidth="6*" align="right"/>
25847 <tbody>
25848 <row>
25849 <entry><option>gnutls_compat_mode</option></entry>
25850 <entry>Use: <emphasis>main</emphasis></entry>
25851 <entry>Type: <emphasis>boolean</emphasis></entry>
25852 <entry>Default: <emphasis>unset</emphasis></entry>
25853 </row>
25854 </tbody>
25855 </tgroup>
25856 </informaltable>
25857 <para>
25858 This option controls whether GnuTLS is used in compatibility mode in an Exim
25859 server. This reduces security slightly, but improves interworking with older
25860 implementations of TLS.
25861 </para>
25862 <para>
25863 option gnutls_allow_auto_pkcs11 main boolean unset
25864 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
25865 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
25866 </para>
25867 <para>
25868 See
25869 <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>
25870 for documentation.
25871 </para>
25872 <para>
25873 <indexterm role="option">
25874 <primary><option>headers_charset</option></primary>
25875 </indexterm>
25876 </para>
25877 <informaltable frame="all">
25878 <tgroup cols="4" colsep="0" rowsep="0">
25879 <colspec colwidth="8*" align="left"/>
25880 <colspec colwidth="6*" align="center"/>
25881 <colspec colwidth="6*" align="center"/>
25882 <colspec colwidth="6*" align="right"/>
25883 <tbody>
25884 <row>
25885 <entry><option>headers_charset</option></entry>
25886 <entry>Use: <emphasis>main</emphasis></entry>
25887 <entry>Type: <emphasis>string</emphasis></entry>
25888 <entry>Default: <emphasis>see below</emphasis></entry>
25889 </row>
25890 </tbody>
25891 </tgroup>
25892 </informaltable>
25893 <para>
25894 This option sets a default character set for translating from encoded MIME
25895 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
25896 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
25897 ultimate default is ISO-8859-1. For more details see the description of header
25898 insertions in section <xref linkend="SECTexpansionitems"/>.
25899 </para>
25900 <para>
25901 <indexterm role="option">
25902 <primary><option>header_maxsize</option></primary>
25903 </indexterm>
25904 </para>
25905 <informaltable frame="all">
25906 <tgroup cols="4" colsep="0" rowsep="0">
25907 <colspec colwidth="8*" align="left"/>
25908 <colspec colwidth="6*" align="center"/>
25909 <colspec colwidth="6*" align="center"/>
25910 <colspec colwidth="6*" align="right"/>
25911 <tbody>
25912 <row>
25913 <entry><option>header_maxsize</option></entry>
25914 <entry>Use: <emphasis>main</emphasis></entry>
25915 <entry>Type: <emphasis>integer</emphasis></entry>
25916 <entry>Default: <emphasis>see below</emphasis></entry>
25917 </row>
25918 </tbody>
25919 </tgroup>
25920 </informaltable>
25921 <para>
25922 <indexterm role="concept">
25923 <primary>header section</primary>
25924 <secondary>maximum size of</secondary>
25925 </indexterm>
25926 <indexterm role="concept">
25927 <primary>limit</primary>
25928 <secondary>size of message header section</secondary>
25929 </indexterm>
25930 This option controls the overall maximum size of a message&#x2019;s header
25931 section. The default is the value of HEADER_MAXSIZE in
25932 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
25933 sections are rejected.
25934 </para>
25935 <para>
25936 <indexterm role="option">
25937 <primary><option>header_line_maxsize</option></primary>
25938 </indexterm>
25939 </para>
25940 <informaltable frame="all">
25941 <tgroup cols="4" colsep="0" rowsep="0">
25942 <colspec colwidth="8*" align="left"/>
25943 <colspec colwidth="6*" align="center"/>
25944 <colspec colwidth="6*" align="center"/>
25945 <colspec colwidth="6*" align="right"/>
25946 <tbody>
25947 <row>
25948 <entry><option>header_line_maxsize</option></entry>
25949 <entry>Use: <emphasis>main</emphasis></entry>
25950 <entry>Type: <emphasis>integer</emphasis></entry>
25951 <entry>Default: <emphasis>0</emphasis></entry>
25952 </row>
25953 </tbody>
25954 </tgroup>
25955 </informaltable>
25956 <para>
25957 <indexterm role="concept">
25958 <primary>header lines</primary>
25959 <secondary>maximum size of</secondary>
25960 </indexterm>
25961 <indexterm role="concept">
25962 <primary>limit</primary>
25963 <secondary>size of one header line</secondary>
25964 </indexterm>
25965 This option limits the length of any individual header line in a message, after
25966 all the continuations have been joined together. Messages with individual
25967 header lines that are longer than the limit are rejected. The default value of
25968 zero means <quote>no limit</quote>.
25969 </para>
25970 <para>
25971 <indexterm role="option">
25972 <primary><option>helo_accept_junk_hosts</option></primary>
25973 </indexterm>
25974 </para>
25975 <informaltable frame="all">
25976 <tgroup cols="4" colsep="0" rowsep="0">
25977 <colspec colwidth="8*" align="left"/>
25978 <colspec colwidth="6*" align="center"/>
25979 <colspec colwidth="6*" align="center"/>
25980 <colspec colwidth="6*" align="right"/>
25981 <tbody>
25982 <row>
25983 <entry><option>helo_accept_junk_hosts</option></entry>
25984 <entry>Use: <emphasis>main</emphasis></entry>
25985 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25986 <entry>Default: <emphasis>unset</emphasis></entry>
25987 </row>
25988 </tbody>
25989 </tgroup>
25990 </informaltable>
25991 <para>
25992 <indexterm role="concept">
25993 <primary>HELO</primary>
25994 <secondary>accepting junk data</secondary>
25995 </indexterm>
25996 <indexterm role="concept">
25997 <primary>EHLO</primary>
25998 <secondary>accepting junk data</secondary>
25999 </indexterm>
26000 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
26001 mail, and gives an error response for invalid data. Unfortunately, there are
26002 some SMTP clients that send syntactic junk. They can be accommodated by setting
26003 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
26004 if you want to do semantic checking.
26005 See also <option>helo_allow_chars</option> for a way of extending the permitted character
26006 set.
26007 </para>
26008 <para>
26009 <indexterm role="option">
26010 <primary><option>helo_allow_chars</option></primary>
26011 </indexterm>
26012 </para>
26013 <informaltable frame="all">
26014 <tgroup cols="4" colsep="0" rowsep="0">
26015 <colspec colwidth="8*" align="left"/>
26016 <colspec colwidth="6*" align="center"/>
26017 <colspec colwidth="6*" align="center"/>
26018 <colspec colwidth="6*" align="right"/>
26019 <tbody>
26020 <row>
26021 <entry><option>helo_allow_chars</option></entry>
26022 <entry>Use: <emphasis>main</emphasis></entry>
26023 <entry>Type: <emphasis>string</emphasis></entry>
26024 <entry>Default: <emphasis>unset</emphasis></entry>
26025 </row>
26026 </tbody>
26027 </tgroup>
26028 </informaltable>
26029 <para>
26030 <indexterm role="concept">
26031 <primary>HELO</primary>
26032 <secondary>underscores in</secondary>
26033 </indexterm>
26034 <indexterm role="concept">
26035 <primary>EHLO</primary>
26036 <secondary>underscores in</secondary>
26037 </indexterm>
26038 <indexterm role="concept">
26039 <primary>underscore in EHLO/HELO</primary>
26040 </indexterm>
26041 This option can be set to a string of rogue characters that are permitted in
26042 all EHLO and HELO names in addition to the standard letters, digits,
26043 hyphens, and dots. If you really must allow underscores, you can set
26044 </para>
26045 <literallayout class="monospaced">
26046 helo_allow_chars = _
26047 </literallayout>
26048 <para>
26049 Note that the value is one string, not a list.
26050 </para>
26051 <para>
26052 <indexterm role="option">
26053 <primary><option>helo_lookup_domains</option></primary>
26054 </indexterm>
26055 </para>
26056 <informaltable frame="all">
26057 <tgroup cols="4" colsep="0" rowsep="0">
26058 <colspec colwidth="8*" align="left"/>
26059 <colspec colwidth="6*" align="center"/>
26060 <colspec colwidth="6*" align="center"/>
26061 <colspec colwidth="6*" align="right"/>
26062 <tbody>
26063 <row>
26064 <entry><option>helo_lookup_domains</option></entry>
26065 <entry>Use: <emphasis>main</emphasis></entry>
26066 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26067 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
26068 </row>
26069 </tbody>
26070 </tgroup>
26071 </informaltable>
26072 <para>
26073 <indexterm role="concept">
26074 <primary>HELO</primary>
26075 <secondary>forcing reverse lookup</secondary>
26076 </indexterm>
26077 <indexterm role="concept">
26078 <primary>EHLO</primary>
26079 <secondary>forcing reverse lookup</secondary>
26080 </indexterm>
26081 If the domain given by a client in a HELO or EHLO command matches this
26082 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
26083 default forces a lookup if the client host gives the server&#x2019;s name or any of
26084 its IP addresses (in brackets), something that broken clients have been seen to
26085 do.
26086 </para>
26087 <para>
26088 <indexterm role="option">
26089 <primary><option>helo_try_verify_hosts</option></primary>
26090 </indexterm>
26091 </para>
26092 <informaltable frame="all">
26093 <tgroup cols="4" colsep="0" rowsep="0">
26094 <colspec colwidth="8*" align="left"/>
26095 <colspec colwidth="6*" align="center"/>
26096 <colspec colwidth="6*" align="center"/>
26097 <colspec colwidth="6*" align="right"/>
26098 <tbody>
26099 <row>
26100 <entry><option>helo_try_verify_hosts</option></entry>
26101 <entry>Use: <emphasis>main</emphasis></entry>
26102 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26103 <entry>Default: <emphasis>unset</emphasis></entry>
26104 </row>
26105 </tbody>
26106 </tgroup>
26107 </informaltable>
26108 <para>
26109 <indexterm role="concept">
26110 <primary>HELO verifying</primary>
26111 <secondary>optional</secondary>
26112 </indexterm>
26113 <indexterm role="concept">
26114 <primary>EHLO</primary>
26115 <secondary>verifying, optional</secondary>
26116 </indexterm>
26117 By default, Exim just checks the syntax of HELO and EHLO commands (see
26118 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
26119 to do more extensive checking of the data supplied by these commands. The ACL
26120 condition <literal>verify = helo</literal> is provided to make this possible.
26121 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
26122 to force the check to occur. From release 4.53 onwards, this is no longer
26123 necessary. If the check has not been done before <literal>verify = helo</literal> is
26124 encountered, it is done at that time. Consequently, this option is obsolete.
26125 Its specification is retained here for backwards compatibility.
26126 </para>
26127 <para>
26128 When an EHLO or HELO command is received, if the calling host matches
26129 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
26130 EHLO command either:
26131 </para>
26132 <itemizedlist>
26133 <listitem>
26134 <para>
26135 is an IP literal matching the calling address of the host, or
26136 </para>
26137 </listitem>
26138 <listitem>
26139 <para>
26140 <indexterm role="concept">
26141 <primary>DNS</primary>
26142 <secondary>reverse lookup</secondary>
26143 </indexterm>
26144 <indexterm role="concept">
26145 <primary>reverse DNS lookup</primary>
26146 </indexterm>
26147 matches the host name that Exim obtains by doing a reverse lookup of the
26148 calling host address, or
26149 </para>
26150 </listitem>
26151 <listitem>
26152 <para>
26153 when looked up in DNS yields the calling host address.
26154 </para>
26155 </listitem>
26156 </itemizedlist>
26157 <para>
26158 However, the EHLO or HELO command is not rejected if any of the checks
26159 fail. Processing continues, but the result of the check is remembered, and can
26160 be detected later in an ACL by the <literal>verify = helo</literal> condition.
26161 </para>
26162 <para>
26163 If DNS was used for successful verification, the variable
26164 <indexterm role="concept">
26165 <primary>DNS</primary>
26166 <secondary>DNSSEC</secondary>
26167 </indexterm>
26168 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
26169 </para>
26170 <para>
26171 <indexterm role="option">
26172 <primary><option>helo_verify_hosts</option></primary>
26173 </indexterm>
26174 </para>
26175 <informaltable frame="all">
26176 <tgroup cols="4" colsep="0" rowsep="0">
26177 <colspec colwidth="8*" align="left"/>
26178 <colspec colwidth="6*" align="center"/>
26179 <colspec colwidth="6*" align="center"/>
26180 <colspec colwidth="6*" align="right"/>
26181 <tbody>
26182 <row>
26183 <entry><option>helo_verify_hosts</option></entry>
26184 <entry>Use: <emphasis>main</emphasis></entry>
26185 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26186 <entry>Default: <emphasis>unset</emphasis></entry>
26187 </row>
26188 </tbody>
26189 </tgroup>
26190 </informaltable>
26191 <para>
26192 <indexterm role="concept">
26193 <primary>HELO verifying</primary>
26194 <secondary>mandatory</secondary>
26195 </indexterm>
26196 <indexterm role="concept">
26197 <primary>EHLO</primary>
26198 <secondary>verifying, mandatory</secondary>
26199 </indexterm>
26200 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
26201 backwards compatibility. For hosts that match this option, Exim checks the host
26202 name given in the HELO or EHLO in the same way as for
26203 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
26204 rejected with a 550 error, and entries are written to the main and reject logs.
26205 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
26206 error.
26207 </para>
26208 <para>
26209 <indexterm role="option">
26210 <primary><option>hold_domains</option></primary>
26211 </indexterm>
26212 </para>
26213 <informaltable frame="all">
26214 <tgroup cols="4" colsep="0" rowsep="0">
26215 <colspec colwidth="8*" align="left"/>
26216 <colspec colwidth="6*" align="center"/>
26217 <colspec colwidth="6*" align="center"/>
26218 <colspec colwidth="6*" align="right"/>
26219 <tbody>
26220 <row>
26221 <entry><option>hold_domains</option></entry>
26222 <entry>Use: <emphasis>main</emphasis></entry>
26223 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26224 <entry>Default: <emphasis>unset</emphasis></entry>
26225 </row>
26226 </tbody>
26227 </tgroup>
26228 </informaltable>
26229 <para>
26230 <indexterm role="concept">
26231 <primary>domain</primary>
26232 <secondary>delaying delivery</secondary>
26233 </indexterm>
26234 <indexterm role="concept">
26235 <primary>delivery</primary>
26236 <secondary>delaying certain domains</secondary>
26237 </indexterm>
26238 This option allows mail for particular domains to be held on the queue
26239 manually. The option is overridden if a message delivery is forced with the
26240 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
26241 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
26242 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
26243 it is deferred every time the message is looked at.
26244 </para>
26245 <para>
26246 This option is intended as a temporary operational measure for delaying the
26247 delivery of mail while some problem is being sorted out, or some new
26248 configuration tested. If you just want to delay the processing of some
26249 domains until a queue run occurs, you should use <option>queue_domains</option> or
26250 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
26251 </para>
26252 <para>
26253 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
26254 messages from the queue if they have been there longer than the longest retry
26255 time in any retry rule. If you want to hold messages for longer than the normal
26256 retry times, insert a dummy retry rule with a long retry time.
26257 </para>
26258 <para>
26259 <indexterm role="option">
26260 <primary><option>host_lookup</option></primary>
26261 </indexterm>
26262 </para>
26263 <informaltable frame="all">
26264 <tgroup cols="4" colsep="0" rowsep="0">
26265 <colspec colwidth="8*" align="left"/>
26266 <colspec colwidth="6*" align="center"/>
26267 <colspec colwidth="6*" align="center"/>
26268 <colspec colwidth="6*" align="right"/>
26269 <tbody>
26270 <row>
26271 <entry><option>host_lookup</option></entry>
26272 <entry>Use: <emphasis>main</emphasis></entry>
26273 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26274 <entry>Default: <emphasis>unset</emphasis></entry>
26275 </row>
26276 </tbody>
26277 </tgroup>
26278 </informaltable>
26279 <para>
26280 <indexterm role="concept">
26281 <primary>host name</primary>
26282 <secondary>lookup, forcing</secondary>
26283 </indexterm>
26284 Exim does not look up the name of a calling host from its IP address unless it
26285 is required to compare against some host list, or the host matches
26286 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
26287 option (which normally contains IP addresses rather than host names). The
26288 default configuration file contains
26289 </para>
26290 <literallayout class="monospaced">
26291 host_lookup = *
26292 </literallayout>
26293 <para>
26294 which causes a lookup to happen for all hosts. If the expense of these lookups
26295 is felt to be too great, the setting can be changed or removed.
26296 </para>
26297 <para>
26298 After a successful reverse lookup, Exim does a forward lookup on the name it
26299 has obtained, to verify that it yields the IP address that it started with. If
26300 this check fails, Exim behaves as if the name lookup failed.
26301 </para>
26302 <para>
26303 <indexterm role="variable">
26304 <primary><varname>$host_lookup_failed</varname></primary>
26305 </indexterm>
26306 <indexterm role="variable">
26307 <primary><varname>$sender_host_name</varname></primary>
26308 </indexterm>
26309 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
26310 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
26311 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
26312 <literal>verify = reverse_host_lookup</literal> in ACLs.
26313 </para>
26314 <para>
26315 <indexterm role="option">
26316 <primary><option>host_lookup_order</option></primary>
26317 </indexterm>
26318 </para>
26319 <informaltable frame="all">
26320 <tgroup cols="4" colsep="0" rowsep="0">
26321 <colspec colwidth="8*" align="left"/>
26322 <colspec colwidth="6*" align="center"/>
26323 <colspec colwidth="6*" align="center"/>
26324 <colspec colwidth="6*" align="right"/>
26325 <tbody>
26326 <row>
26327 <entry><option>host_lookup_order</option></entry>
26328 <entry>Use: <emphasis>main</emphasis></entry>
26329 <entry>Type: <emphasis>string list</emphasis></entry>
26330 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
26331 </row>
26332 </tbody>
26333 </tgroup>
26334 </informaltable>
26335 <para>
26336 This option specifies the order of different lookup methods when Exim is trying
26337 to find a host name from an IP address. The default is to do a DNS lookup
26338 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
26339 if that fails. You can change the order of these lookups, or omit one entirely,
26340 if you want.
26341 </para>
26342 <para>
26343 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
26344 multiple PTR records in the DNS and the IP address is not listed in
26345 <filename>/etc/hosts</filename>. Different operating systems give different results in this
26346 case. That is why the default tries a DNS lookup first.
26347 </para>
26348 <para>
26349 <indexterm role="option">
26350 <primary><option>host_reject_connection</option></primary>
26351 </indexterm>
26352 </para>
26353 <informaltable frame="all">
26354 <tgroup cols="4" colsep="0" rowsep="0">
26355 <colspec colwidth="8*" align="left"/>
26356 <colspec colwidth="6*" align="center"/>
26357 <colspec colwidth="6*" align="center"/>
26358 <colspec colwidth="6*" align="right"/>
26359 <tbody>
26360 <row>
26361 <entry><option>host_reject_connection</option></entry>
26362 <entry>Use: <emphasis>main</emphasis></entry>
26363 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26364 <entry>Default: <emphasis>unset</emphasis></entry>
26365 </row>
26366 </tbody>
26367 </tgroup>
26368 </informaltable>
26369 <para>
26370 <indexterm role="concept">
26371 <primary>host</primary>
26372 <secondary>rejecting connections from</secondary>
26373 </indexterm>
26374 If this option is set, incoming SMTP calls from the hosts listed are rejected
26375 as soon as the connection is made.
26376 This option is obsolete, and retained only for backward compatibility, because
26377 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
26378 connections immediately.
26379 </para>
26380 <para>
26381 The ability to give an immediate rejection (either by this option or using an
26382 ACL) is provided for use in unusual cases. Many hosts will just try again,
26383 sometimes without much delay. Normally, it is better to use an ACL to reject
26384 incoming messages at a later stage, such as after RCPT commands. See
26385 chapter <xref linkend="CHAPACL"/>.
26386 </para>
26387 <para>
26388 <indexterm role="option">
26389 <primary><option>hosts_connection_nolog</option></primary>
26390 </indexterm>
26391 </para>
26392 <informaltable frame="all">
26393 <tgroup cols="4" colsep="0" rowsep="0">
26394 <colspec colwidth="8*" align="left"/>
26395 <colspec colwidth="6*" align="center"/>
26396 <colspec colwidth="6*" align="center"/>
26397 <colspec colwidth="6*" align="right"/>
26398 <tbody>
26399 <row>
26400 <entry><option>hosts_connection_nolog</option></entry>
26401 <entry>Use: <emphasis>main</emphasis></entry>
26402 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26403 <entry>Default: <emphasis>unset</emphasis></entry>
26404 </row>
26405 </tbody>
26406 </tgroup>
26407 </informaltable>
26408 <para>
26409 <indexterm role="concept">
26410 <primary>host</primary>
26411 <secondary>not logging connections from</secondary>
26412 </indexterm>
26413 This option defines a list of hosts for which connection logging does not
26414 happen, even though the <option>smtp_connection</option> log selector is set. For example,
26415 you might want not to log SMTP connections from local processes, or from
26416 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
26417 the daemon; you should therefore strive to restrict its value to a short inline
26418 list of IP addresses and networks. To disable logging SMTP connections from
26419 local processes, you must create a host list with an empty item. For example:
26420 </para>
26421 <literallayout class="monospaced">
26422 hosts_connection_nolog = :
26423 </literallayout>
26424 <para>
26425 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
26426 </para>
26427 <para>
26428 <indexterm role="option">
26429 <primary><option>hosts_proxy</option></primary>
26430 </indexterm>
26431 </para>
26432 <informaltable frame="all">
26433 <tgroup cols="4" colsep="0" rowsep="0">
26434 <colspec colwidth="8*" align="left"/>
26435 <colspec colwidth="6*" align="center"/>
26436 <colspec colwidth="6*" align="center"/>
26437 <colspec colwidth="6*" align="right"/>
26438 <tbody>
26439 <row>
26440 <entry><option>hosts_proxy</option></entry>
26441 <entry>Use: <emphasis>main</emphasis></entry>
26442 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26443 <entry>Default: <emphasis>unset</emphasis></entry>
26444 </row>
26445 </tbody>
26446 </tgroup>
26447 </informaltable>
26448 <para>
26449 <indexterm role="concept">
26450 <primary>proxy</primary>
26451 <secondary>proxy protocol</secondary>
26452 </indexterm>
26453 This option enables use of Proxy Protocol proxies for incoming
26454 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
26455 </para>
26456 <para>
26457 <indexterm role="option">
26458 <primary><option>hosts_treat_as_local</option></primary>
26459 </indexterm>
26460 </para>
26461 <informaltable frame="all">
26462 <tgroup cols="4" colsep="0" rowsep="0">
26463 <colspec colwidth="8*" align="left"/>
26464 <colspec colwidth="6*" align="center"/>
26465 <colspec colwidth="6*" align="center"/>
26466 <colspec colwidth="6*" align="right"/>
26467 <tbody>
26468 <row>
26469 <entry><option>hosts_treat_as_local</option></entry>
26470 <entry>Use: <emphasis>main</emphasis></entry>
26471 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26472 <entry>Default: <emphasis>unset</emphasis></entry>
26473 </row>
26474 </tbody>
26475 </tgroup>
26476 </informaltable>
26477 <para>
26478 <indexterm role="concept">
26479 <primary>local host</primary>
26480 <secondary>domains treated as</secondary>
26481 </indexterm>
26482 <indexterm role="concept">
26483 <primary>host</primary>
26484 <secondary>treated as local</secondary>
26485 </indexterm>
26486 If this option is set, any host names that match the domain list are treated as
26487 if they were the local host when Exim is scanning host lists obtained from MX
26488 records
26489 or other sources. Note that the value of this option is a domain list, not a
26490 host list, because it is always used to check host names, not IP addresses.
26491 </para>
26492 <para>
26493 This option also applies when Exim is matching the special items
26494 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
26495 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
26496 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
26497 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
26498 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
26499 interfaces and recognizing the local host.
26500 </para>
26501 <para>
26502 <indexterm role="option">
26503 <primary><option>ibase_servers</option></primary>
26504 </indexterm>
26505 </para>
26506 <informaltable frame="all">
26507 <tgroup cols="4" colsep="0" rowsep="0">
26508 <colspec colwidth="8*" align="left"/>
26509 <colspec colwidth="6*" align="center"/>
26510 <colspec colwidth="6*" align="center"/>
26511 <colspec colwidth="6*" align="right"/>
26512 <tbody>
26513 <row>
26514 <entry><option>ibase_servers</option></entry>
26515 <entry>Use: <emphasis>main</emphasis></entry>
26516 <entry>Type: <emphasis>string list</emphasis></entry>
26517 <entry>Default: <emphasis>unset</emphasis></entry>
26518 </row>
26519 </tbody>
26520 </tgroup>
26521 </informaltable>
26522 <para>
26523 <indexterm role="concept">
26524 <primary>InterBase</primary>
26525 <secondary>server list</secondary>
26526 </indexterm>
26527 This option provides a list of InterBase servers and associated connection data,
26528 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
26529 The option is available only if Exim has been built with InterBase support.
26530 </para>
26531 <para>
26532 <indexterm role="option">
26533 <primary><option>ignore_bounce_errors_after</option></primary>
26534 </indexterm>
26535 </para>
26536 <informaltable frame="all">
26537 <tgroup cols="4" colsep="0" rowsep="0">
26538 <colspec colwidth="8*" align="left"/>
26539 <colspec colwidth="6*" align="center"/>
26540 <colspec colwidth="6*" align="center"/>
26541 <colspec colwidth="6*" align="right"/>
26542 <tbody>
26543 <row>
26544 <entry><option>ignore_bounce_errors_after</option></entry>
26545 <entry>Use: <emphasis>main</emphasis></entry>
26546 <entry>Type: <emphasis>time</emphasis></entry>
26547 <entry>Default: <emphasis>10w</emphasis></entry>
26548 </row>
26549 </tbody>
26550 </tgroup>
26551 </informaltable>
26552 <para>
26553 <indexterm role="concept">
26554 <primary>bounce message</primary>
26555 <secondary>discarding</secondary>
26556 </indexterm>
26557 <indexterm role="concept">
26558 <primary>discarding bounce message</primary>
26559 </indexterm>
26560 This option affects the processing of bounce messages that cannot be delivered,
26561 that is, those that suffer a permanent delivery failure. (Bounce messages that
26562 suffer temporary delivery failures are of course retried in the usual way.)
26563 </para>
26564 <para>
26565 After a permanent delivery failure, bounce messages are frozen,
26566 because there is no sender to whom they can be returned. When a frozen bounce
26567 message has been on the queue for more than the given time, it is unfrozen at
26568 the next queue run, and a further delivery is attempted. If delivery fails
26569 again, the bounce message is discarded. This makes it possible to keep failed
26570 bounce messages around for a shorter time than the normal maximum retry time
26571 for frozen messages. For example,
26572 </para>
26573 <literallayout class="monospaced">
26574 ignore_bounce_errors_after = 12h
26575 </literallayout>
26576 <para>
26577 retries failed bounce message deliveries after 12 hours, discarding any further
26578 failures. If the value of this option is set to a zero time period, bounce
26579 failures are discarded immediately. Setting a very long time (as in the default
26580 value) has the effect of disabling this option. For ways of automatically
26581 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
26582 <option>timeout_frozen_after</option>.
26583 </para>
26584 <para>
26585 <indexterm role="option">
26586 <primary><option>ignore_fromline_hosts</option></primary>
26587 </indexterm>
26588 </para>
26589 <informaltable frame="all">
26590 <tgroup cols="4" colsep="0" rowsep="0">
26591 <colspec colwidth="8*" align="left"/>
26592 <colspec colwidth="6*" align="center"/>
26593 <colspec colwidth="6*" align="center"/>
26594 <colspec colwidth="6*" align="right"/>
26595 <tbody>
26596 <row>
26597 <entry><option>ignore_fromline_hosts</option></entry>
26598 <entry>Use: <emphasis>main</emphasis></entry>
26599 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26600 <entry>Default: <emphasis>unset</emphasis></entry>
26601 </row>
26602 </tbody>
26603 </tgroup>
26604 </informaltable>
26605 <para>
26606 <indexterm role="concept">
26607 <primary><quote>From</quote> line</primary>
26608 </indexterm>
26609 <indexterm role="concept">
26610 <primary>UUCP</primary>
26611 <secondary><quote>From</quote> line</secondary>
26612 </indexterm>
26613 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26614 the headers of a message. By default this is treated as the start of the
26615 message&#x2019;s body, which means that any following headers are not recognized as
26616 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26617 match those hosts that insist on sending it. If the sender is actually a local
26618 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
26619 <option>ignore_fromline_local</option> must be set to achieve this effect.
26620 </para>
26621 <para>
26622 <indexterm role="option">
26623 <primary><option>ignore_fromline_local</option></primary>
26624 </indexterm>
26625 </para>
26626 <informaltable frame="all">
26627 <tgroup cols="4" colsep="0" rowsep="0">
26628 <colspec colwidth="8*" align="left"/>
26629 <colspec colwidth="6*" align="center"/>
26630 <colspec colwidth="6*" align="center"/>
26631 <colspec colwidth="6*" align="right"/>
26632 <tbody>
26633 <row>
26634 <entry><option>ignore_fromline_local</option></entry>
26635 <entry>Use: <emphasis>main</emphasis></entry>
26636 <entry>Type: <emphasis>boolean</emphasis></entry>
26637 <entry>Default: <emphasis>false</emphasis></entry>
26638 </row>
26639 </tbody>
26640 </tgroup>
26641 </informaltable>
26642 <para>
26643 See <option>ignore_fromline_hosts</option> above.
26644 </para>
26645 <para>
26646 <indexterm role="option">
26647 <primary><option>keep_environment</option></primary>
26648 </indexterm>
26649 </para>
26650 <informaltable frame="all">
26651 <tgroup cols="4" colsep="0" rowsep="0">
26652 <colspec colwidth="8*" align="left"/>
26653 <colspec colwidth="6*" align="center"/>
26654 <colspec colwidth="6*" align="center"/>
26655 <colspec colwidth="6*" align="right"/>
26656 <tbody>
26657 <row>
26658 <entry><option>keep_environment</option></entry>
26659 <entry>Use: <emphasis>main</emphasis></entry>
26660 <entry>Type: <emphasis>string list</emphasis></entry>
26661 <entry>Default: <emphasis>unset</emphasis></entry>
26662 </row>
26663 </tbody>
26664 </tgroup>
26665 </informaltable>
26666 <para>
26667 <indexterm role="concept">
26668 <primary>environment</primary>
26669 <secondary>values from</secondary>
26670 </indexterm>
26671 This option contains a string list of environment variables to keep.
26672 You have to trust these variables or you have to be sure that
26673 these variables do not impose any security risk. Keep in mind that
26674 during the startup phase Exim is running with an effective UID 0 in most
26675 installations. As the default value is an empty list, the default
26676 environment for using libraries, running embedded Perl code, or running
26677 external binaries is empty, and does not not even contain PATH or HOME.
26678 </para>
26679 <para>
26680 Actually the list is interpreted as a list of patterns
26681 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
26682 </para>
26683 <para>
26684 WARNING: Macro substitution is still done first, so having a macro
26685 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
26686 unexpected results. You may work around this using a regular expression
26687 that does not match the macro name: ^[F]OO_HOME$.
26688 </para>
26689 <para>
26690 Current versions of Exim issue a warning during startup if you do not mention
26691 <option>keep_environment</option> in your runtime configuration file and if your
26692 current environment is not empty. Future versions may not issue that warning
26693 anymore.
26694 </para>
26695 <para>
26696 See the <option>add_environment</option> main config option for a way to set
26697 environment variables to a fixed value.  The environment for <command>pipe</command>
26698 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
26699 details.
26700 </para>
26701 <para>
26702 <indexterm role="option">
26703 <primary><option>keep_malformed</option></primary>
26704 </indexterm>
26705 </para>
26706 <informaltable frame="all">
26707 <tgroup cols="4" colsep="0" rowsep="0">
26708 <colspec colwidth="8*" align="left"/>
26709 <colspec colwidth="6*" align="center"/>
26710 <colspec colwidth="6*" align="center"/>
26711 <colspec colwidth="6*" align="right"/>
26712 <tbody>
26713 <row>
26714 <entry><option>keep_malformed</option></entry>
26715 <entry>Use: <emphasis>main</emphasis></entry>
26716 <entry>Type: <emphasis>time</emphasis></entry>
26717 <entry>Default: <emphasis>4d</emphasis></entry>
26718 </row>
26719 </tbody>
26720 </tgroup>
26721 </informaltable>
26722 <para>
26723 This option specifies the length of time to keep messages whose spool files
26724 have been corrupted in some way. This should, of course, never happen. At the
26725 next attempt to deliver such a message, it gets removed. The incident is
26726 logged.
26727 </para>
26728 <para>
26729 <indexterm role="option">
26730 <primary><option>ldap_ca_cert_dir</option></primary>
26731 </indexterm>
26732 </para>
26733 <informaltable frame="all">
26734 <tgroup cols="4" colsep="0" rowsep="0">
26735 <colspec colwidth="8*" align="left"/>
26736 <colspec colwidth="6*" align="center"/>
26737 <colspec colwidth="6*" align="center"/>
26738 <colspec colwidth="6*" align="right"/>
26739 <tbody>
26740 <row>
26741 <entry><option>ldap_ca_cert_dir</option></entry>
26742 <entry>Use: <emphasis>main</emphasis></entry>
26743 <entry>Type: <emphasis>string</emphasis></entry>
26744 <entry>Default: <emphasis>unset</emphasis></entry>
26745 </row>
26746 </tbody>
26747 </tgroup>
26748 </informaltable>
26749 <para>
26750 <indexterm role="concept">
26751 <primary>LDAP</primary>
26752 <secondary>,</secondary>
26753 </indexterm>
26754 <indexterm role="concept">
26755 <primary>certificate</primary>
26756 <secondary>directory for LDAP</secondary>
26757 </indexterm>
26758 This option indicates which directory contains CA certificates for verifying
26759 a TLS certificate presented by an LDAP server.
26760 While Exim does not provide a default value, your SSL library may.
26761 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26762 and constrained to be a directory.
26763 </para>
26764 <para>
26765 <indexterm role="option">
26766 <primary><option>ldap_ca_cert_file</option></primary>
26767 </indexterm>
26768 </para>
26769 <informaltable frame="all">
26770 <tgroup cols="4" colsep="0" rowsep="0">
26771 <colspec colwidth="8*" align="left"/>
26772 <colspec colwidth="6*" align="center"/>
26773 <colspec colwidth="6*" align="center"/>
26774 <colspec colwidth="6*" align="right"/>
26775 <tbody>
26776 <row>
26777 <entry><option>ldap_ca_cert_file</option></entry>
26778 <entry>Use: <emphasis>main</emphasis></entry>
26779 <entry>Type: <emphasis>string</emphasis></entry>
26780 <entry>Default: <emphasis>unset</emphasis></entry>
26781 </row>
26782 </tbody>
26783 </tgroup>
26784 </informaltable>
26785 <para>
26786 <indexterm role="concept">
26787 <primary>LDAP</primary>
26788 <secondary>,</secondary>
26789 </indexterm>
26790 <indexterm role="concept">
26791 <primary>certificate</primary>
26792 <secondary>file for LDAP</secondary>
26793 </indexterm>
26794 This option indicates which file contains CA certificates for verifying
26795 a TLS certificate presented by an LDAP server.
26796 While Exim does not provide a default value, your SSL library may.
26797 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26798 and constrained to be a file.
26799 </para>
26800 <para>
26801 <indexterm role="option">
26802 <primary><option>ldap_cert_file</option></primary>
26803 </indexterm>
26804 </para>
26805 <informaltable frame="all">
26806 <tgroup cols="4" colsep="0" rowsep="0">
26807 <colspec colwidth="8*" align="left"/>
26808 <colspec colwidth="6*" align="center"/>
26809 <colspec colwidth="6*" align="center"/>
26810 <colspec colwidth="6*" align="right"/>
26811 <tbody>
26812 <row>
26813 <entry><option>ldap_cert_file</option></entry>
26814 <entry>Use: <emphasis>main</emphasis></entry>
26815 <entry>Type: <emphasis>string</emphasis></entry>
26816 <entry>Default: <emphasis>unset</emphasis></entry>
26817 </row>
26818 </tbody>
26819 </tgroup>
26820 </informaltable>
26821 <para>
26822 <indexterm role="concept">
26823 <primary>LDAP</primary>
26824 <secondary>TLS client certificate file</secondary>
26825 </indexterm>
26826 <indexterm role="concept">
26827 <primary>certificate</primary>
26828 <secondary>file for LDAP</secondary>
26829 </indexterm>
26830 This option indicates which file contains an TLS client certificate which
26831 Exim should present to the LDAP server during TLS negotiation.
26832 Should be used together with <option>ldap_cert_key</option>.
26833 </para>
26834 <para>
26835 <indexterm role="option">
26836 <primary><option>ldap_cert_key</option></primary>
26837 </indexterm>
26838 </para>
26839 <informaltable frame="all">
26840 <tgroup cols="4" colsep="0" rowsep="0">
26841 <colspec colwidth="8*" align="left"/>
26842 <colspec colwidth="6*" align="center"/>
26843 <colspec colwidth="6*" align="center"/>
26844 <colspec colwidth="6*" align="right"/>
26845 <tbody>
26846 <row>
26847 <entry><option>ldap_cert_key</option></entry>
26848 <entry>Use: <emphasis>main</emphasis></entry>
26849 <entry>Type: <emphasis>string</emphasis></entry>
26850 <entry>Default: <emphasis>unset</emphasis></entry>
26851 </row>
26852 </tbody>
26853 </tgroup>
26854 </informaltable>
26855 <para>
26856 <indexterm role="concept">
26857 <primary>LDAP</primary>
26858 <secondary>TLS client key file</secondary>
26859 </indexterm>
26860 <indexterm role="concept">
26861 <primary>certificate</primary>
26862 <secondary>key for LDAP</secondary>
26863 </indexterm>
26864 This option indicates which file contains the secret/private key to use
26865 to prove identity to the LDAP server during TLS negotiation.
26866 Should be used together with <option>ldap_cert_file</option>, which contains the
26867 identity to be proven.
26868 </para>
26869 <para>
26870 <indexterm role="option">
26871 <primary><option>ldap_cipher_suite</option></primary>
26872 </indexterm>
26873 </para>
26874 <informaltable frame="all">
26875 <tgroup cols="4" colsep="0" rowsep="0">
26876 <colspec colwidth="8*" align="left"/>
26877 <colspec colwidth="6*" align="center"/>
26878 <colspec colwidth="6*" align="center"/>
26879 <colspec colwidth="6*" align="right"/>
26880 <tbody>
26881 <row>
26882 <entry><option>ldap_cipher_suite</option></entry>
26883 <entry>Use: <emphasis>main</emphasis></entry>
26884 <entry>Type: <emphasis>string</emphasis></entry>
26885 <entry>Default: <emphasis>unset</emphasis></entry>
26886 </row>
26887 </tbody>
26888 </tgroup>
26889 </informaltable>
26890 <para>
26891 <indexterm role="concept">
26892 <primary>LDAP</primary>
26893 <secondary>TLS cipher suite</secondary>
26894 </indexterm>
26895 This controls the TLS cipher-suite negotiation during TLS negotiation with
26896 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
26897 cipher-suite options with OpenSSL (as used by LDAP client libraries).
26898 </para>
26899 <para>
26900 <indexterm role="option">
26901 <primary><option>ldap_default_servers</option></primary>
26902 </indexterm>
26903 </para>
26904 <informaltable frame="all">
26905 <tgroup cols="4" colsep="0" rowsep="0">
26906 <colspec colwidth="8*" align="left"/>
26907 <colspec colwidth="6*" align="center"/>
26908 <colspec colwidth="6*" align="center"/>
26909 <colspec colwidth="6*" align="right"/>
26910 <tbody>
26911 <row>
26912 <entry><option>ldap_default_servers</option></entry>
26913 <entry>Use: <emphasis>main</emphasis></entry>
26914 <entry>Type: <emphasis>string list</emphasis></entry>
26915 <entry>Default: <emphasis>unset</emphasis></entry>
26916 </row>
26917 </tbody>
26918 </tgroup>
26919 </informaltable>
26920 <para>
26921 <indexterm role="concept">
26922 <primary>LDAP</primary>
26923 <secondary>default servers</secondary>
26924 </indexterm>
26925 This option provides a list of LDAP servers which are tried in turn when an
26926 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
26927 details of LDAP queries. This option is available only when Exim has been built
26928 with LDAP support.
26929 </para>
26930 <para>
26931 <indexterm role="option">
26932 <primary><option>ldap_require_cert</option></primary>
26933 </indexterm>
26934 </para>
26935 <informaltable frame="all">
26936 <tgroup cols="4" colsep="0" rowsep="0">
26937 <colspec colwidth="8*" align="left"/>
26938 <colspec colwidth="6*" align="center"/>
26939 <colspec colwidth="6*" align="center"/>
26940 <colspec colwidth="6*" align="right"/>
26941 <tbody>
26942 <row>
26943 <entry><option>ldap_require_cert</option></entry>
26944 <entry>Use: <emphasis>main</emphasis></entry>
26945 <entry>Type: <emphasis>string</emphasis></entry>
26946 <entry>Default: <emphasis>unset.</emphasis></entry>
26947 </row>
26948 </tbody>
26949 </tgroup>
26950 </informaltable>
26951 <para>
26952 <indexterm role="concept">
26953 <primary>LDAP</primary>
26954 <secondary>policy for LDAP server TLS cert presentation</secondary>
26955 </indexterm>
26956 This should be one of the values "hard", "demand", "allow", "try" or "never".
26957 A value other than one of these is interpreted as "never".
26958 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
26959 Although Exim does not set a default, the LDAP library probably defaults
26960 to hard/demand.
26961 </para>
26962 <para>
26963 <indexterm role="option">
26964 <primary><option>ldap_start_tls</option></primary>
26965 </indexterm>
26966 </para>
26967 <informaltable frame="all">
26968 <tgroup cols="4" colsep="0" rowsep="0">
26969 <colspec colwidth="8*" align="left"/>
26970 <colspec colwidth="6*" align="center"/>
26971 <colspec colwidth="6*" align="center"/>
26972 <colspec colwidth="6*" align="right"/>
26973 <tbody>
26974 <row>
26975 <entry><option>ldap_start_tls</option></entry>
26976 <entry>Use: <emphasis>main</emphasis></entry>
26977 <entry>Type: <emphasis>boolean</emphasis></entry>
26978 <entry>Default: <emphasis>false</emphasis></entry>
26979 </row>
26980 </tbody>
26981 </tgroup>
26982 </informaltable>
26983 <para>
26984 <indexterm role="concept">
26985 <primary>LDAP</primary>
26986 <secondary>whether or not to negotiate TLS</secondary>
26987 </indexterm>
26988 If set, Exim will attempt to negotiate TLS with the LDAP server when
26989 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
26990 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
26991 of SSL-on-connect.
26992 In the event of failure to negotiate TLS, the action taken is controlled
26993 by <option>ldap_require_cert</option>.
26994 This option is ignored for <literal>ldapi</literal> connections.
26995 </para>
26996 <para>
26997 <indexterm role="option">
26998 <primary><option>ldap_version</option></primary>
26999 </indexterm>
27000 </para>
27001 <informaltable frame="all">
27002 <tgroup cols="4" colsep="0" rowsep="0">
27003 <colspec colwidth="8*" align="left"/>
27004 <colspec colwidth="6*" align="center"/>
27005 <colspec colwidth="6*" align="center"/>
27006 <colspec colwidth="6*" align="right"/>
27007 <tbody>
27008 <row>
27009 <entry><option>ldap_version</option></entry>
27010 <entry>Use: <emphasis>main</emphasis></entry>
27011 <entry>Type: <emphasis>integer</emphasis></entry>
27012 <entry>Default: <emphasis>unset</emphasis></entry>
27013 </row>
27014 </tbody>
27015 </tgroup>
27016 </informaltable>
27017 <para>
27018 <indexterm role="concept">
27019 <primary>LDAP</primary>
27020 <secondary>protocol version, forcing</secondary>
27021 </indexterm>
27022 This option can be used to force Exim to set a specific protocol version for
27023 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
27024 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
27025 the LDAP headers; otherwise it is 2. This option is available only when Exim
27026 has been built with LDAP support.
27027 </para>
27028 <para>
27029 <indexterm role="option">
27030 <primary><option>local_from_check</option></primary>
27031 </indexterm>
27032 </para>
27033 <informaltable frame="all">
27034 <tgroup cols="4" colsep="0" rowsep="0">
27035 <colspec colwidth="8*" align="left"/>
27036 <colspec colwidth="6*" align="center"/>
27037 <colspec colwidth="6*" align="center"/>
27038 <colspec colwidth="6*" align="right"/>
27039 <tbody>
27040 <row>
27041 <entry><option>local_from_check</option></entry>
27042 <entry>Use: <emphasis>main</emphasis></entry>
27043 <entry>Type: <emphasis>boolean</emphasis></entry>
27044 <entry>Default: <emphasis>true</emphasis></entry>
27045 </row>
27046 </tbody>
27047 </tgroup>
27048 </informaltable>
27049 <para>
27050 <indexterm role="concept">
27051 <primary><emphasis>Sender:</emphasis> header line</primary>
27052 <secondary>disabling addition of</secondary>
27053 </indexterm>
27054 <indexterm role="concept">
27055 <primary><emphasis>From:</emphasis> header line</primary>
27056 <secondary>disabling checking of</secondary>
27057 </indexterm>
27058 When a message is submitted locally (that is, not over a TCP/IP connection) by
27059 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
27060 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
27061 the domain specified by <option>qualify_domain</option>.
27062 </para>
27063 <para>
27064 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
27065 locally submitted message is automatically qualified by Exim, unless the
27066 <option>-bnq</option> command line option is used.
27067 </para>
27068 <para>
27069 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
27070 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
27071 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
27072 and the default qualify domain.
27073 </para>
27074 <para>
27075 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
27076 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
27077 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
27078 <option>local_sender_retain</option> to be true.
27079 </para>
27080 <para>
27081 <indexterm role="concept">
27082 <primary>envelope sender</primary>
27083 </indexterm>
27084 These options affect only the header lines in the message. The envelope sender
27085 is still forced to be the login id at the qualify domain unless
27086 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
27087 </para>
27088 <para>
27089 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
27090 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
27091 has more details about <emphasis>Sender:</emphasis> processing.
27092 </para>
27093 <para>
27094 <indexterm role="option">
27095 <primary><option>local_from_prefix</option></primary>
27096 </indexterm>
27097 </para>
27098 <informaltable frame="all">
27099 <tgroup cols="4" colsep="0" rowsep="0">
27100 <colspec colwidth="8*" align="left"/>
27101 <colspec colwidth="6*" align="center"/>
27102 <colspec colwidth="6*" align="center"/>
27103 <colspec colwidth="6*" align="right"/>
27104 <tbody>
27105 <row>
27106 <entry><option>local_from_prefix</option></entry>
27107 <entry>Use: <emphasis>main</emphasis></entry>
27108 <entry>Type: <emphasis>string</emphasis></entry>
27109 <entry>Default: <emphasis>unset</emphasis></entry>
27110 </row>
27111 </tbody>
27112 </tgroup>
27113 </informaltable>
27114 <para>
27115 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
27116 matching the login id (see <option>local_from_check</option> above), it can be configured to
27117 ignore certain prefixes and suffixes in the local part of the address. This is
27118 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
27119 appropriate lists, in the same form as the <option>local_part_prefix</option> and
27120 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
27121 example, if
27122 </para>
27123 <literallayout class="monospaced">
27124 local_from_prefix = *-
27125 </literallayout>
27126 <para>
27127 is set, a <emphasis>From:</emphasis> line containing
27128 </para>
27129 <literallayout class="monospaced">
27130 From: anything-user@your.domain.example
27131 </literallayout>
27132 <para>
27133 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
27134 matches the actual sender address that is constructed from the login name and
27135 qualify domain.
27136 </para>
27137 <para>
27138 <indexterm role="option">
27139 <primary><option>local_from_suffix</option></primary>
27140 </indexterm>
27141 </para>
27142 <informaltable frame="all">
27143 <tgroup cols="4" colsep="0" rowsep="0">
27144 <colspec colwidth="8*" align="left"/>
27145 <colspec colwidth="6*" align="center"/>
27146 <colspec colwidth="6*" align="center"/>
27147 <colspec colwidth="6*" align="right"/>
27148 <tbody>
27149 <row>
27150 <entry><option>local_from_suffix</option></entry>
27151 <entry>Use: <emphasis>main</emphasis></entry>
27152 <entry>Type: <emphasis>string</emphasis></entry>
27153 <entry>Default: <emphasis>unset</emphasis></entry>
27154 </row>
27155 </tbody>
27156 </tgroup>
27157 </informaltable>
27158 <para>
27159 See <option>local_from_prefix</option> above.
27160 </para>
27161 <para>
27162 <indexterm role="option">
27163 <primary><option>local_interfaces</option></primary>
27164 </indexterm>
27165 </para>
27166 <informaltable frame="all">
27167 <tgroup cols="4" colsep="0" rowsep="0">
27168 <colspec colwidth="8*" align="left"/>
27169 <colspec colwidth="6*" align="center"/>
27170 <colspec colwidth="6*" align="center"/>
27171 <colspec colwidth="6*" align="right"/>
27172 <tbody>
27173 <row>
27174 <entry><option>local_interfaces</option></entry>
27175 <entry>Use: <emphasis>main</emphasis></entry>
27176 <entry>Type: <emphasis>string list</emphasis></entry>
27177 <entry>Default: <emphasis>see below</emphasis></entry>
27178 </row>
27179 </tbody>
27180 </tgroup>
27181 </informaltable>
27182 <para>
27183 This option controls which network interfaces are used by the daemon for
27184 listening; they are also used to identify the local host when routing. Chapter
27185 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
27186 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
27187 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
27188 <option>local_interfaces</option> is
27189 </para>
27190 <literallayout class="monospaced">
27191 local_interfaces = 0.0.0.0
27192 </literallayout>
27193 <para>
27194 when Exim is built without IPv6 support; otherwise it is
27195 </para>
27196 <literallayout class="monospaced">
27197 local_interfaces = &lt;; ::0 ; 0.0.0.0
27198 </literallayout>
27199 <para>
27200 <indexterm role="option">
27201 <primary><option>local_scan_timeout</option></primary>
27202 </indexterm>
27203 </para>
27204 <informaltable frame="all">
27205 <tgroup cols="4" colsep="0" rowsep="0">
27206 <colspec colwidth="8*" align="left"/>
27207 <colspec colwidth="6*" align="center"/>
27208 <colspec colwidth="6*" align="center"/>
27209 <colspec colwidth="6*" align="right"/>
27210 <tbody>
27211 <row>
27212 <entry><option>local_scan_timeout</option></entry>
27213 <entry>Use: <emphasis>main</emphasis></entry>
27214 <entry>Type: <emphasis>time</emphasis></entry>
27215 <entry>Default: <emphasis>5m</emphasis></entry>
27216 </row>
27217 </tbody>
27218 </tgroup>
27219 </informaltable>
27220 <para>
27221 <indexterm role="concept">
27222 <primary>timeout</primary>
27223 <secondary>for <function>local_scan()</function> function</secondary>
27224 </indexterm>
27225 <indexterm role="concept">
27226 <primary><function>local_scan()</function> function</primary>
27227 <secondary>timeout</secondary>
27228 </indexterm>
27229 This timeout applies to the <function>local_scan()</function> function (see chapter
27230 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
27231 the incoming message is rejected with a temporary error if it is an SMTP
27232 message. For a non-SMTP message, the message is dropped and Exim ends with a
27233 non-zero code. The incident is logged on the main and reject logs.
27234 </para>
27235 <para>
27236 <indexterm role="option">
27237 <primary><option>local_sender_retain</option></primary>
27238 </indexterm>
27239 </para>
27240 <informaltable frame="all">
27241 <tgroup cols="4" colsep="0" rowsep="0">
27242 <colspec colwidth="8*" align="left"/>
27243 <colspec colwidth="6*" align="center"/>
27244 <colspec colwidth="6*" align="center"/>
27245 <colspec colwidth="6*" align="right"/>
27246 <tbody>
27247 <row>
27248 <entry><option>local_sender_retain</option></entry>
27249 <entry>Use: <emphasis>main</emphasis></entry>
27250 <entry>Type: <emphasis>boolean</emphasis></entry>
27251 <entry>Default: <emphasis>false</emphasis></entry>
27252 </row>
27253 </tbody>
27254 </tgroup>
27255 </informaltable>
27256 <para>
27257 <indexterm role="concept">
27258 <primary><emphasis>Sender:</emphasis> header line</primary>
27259 <secondary>retaining from local submission</secondary>
27260 </indexterm>
27261 When a message is submitted locally (that is, not over a TCP/IP connection) by
27262 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
27263 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
27264 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
27265 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
27266 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
27267 </para>
27268 <para>
27269 <indexterm role="option">
27270 <primary><option>localhost_number</option></primary>
27271 </indexterm>
27272 </para>
27273 <informaltable frame="all">
27274 <tgroup cols="4" colsep="0" rowsep="0">
27275 <colspec colwidth="8*" align="left"/>
27276 <colspec colwidth="6*" align="center"/>
27277 <colspec colwidth="6*" align="center"/>
27278 <colspec colwidth="6*" align="right"/>
27279 <tbody>
27280 <row>
27281 <entry><option>localhost_number</option></entry>
27282 <entry>Use: <emphasis>main</emphasis></entry>
27283 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27284 <entry>Default: <emphasis>unset</emphasis></entry>
27285 </row>
27286 </tbody>
27287 </tgroup>
27288 </informaltable>
27289 <para>
27290 <indexterm role="concept">
27291 <primary>host</primary>
27292 <secondary>locally unique number for</secondary>
27293 </indexterm>
27294 <indexterm role="concept">
27295 <primary>message ids</primary>
27296 <secondary>with multiple hosts</secondary>
27297 </indexterm>
27298 <indexterm role="variable">
27299 <primary><varname>$localhost_number</varname></primary>
27300 </indexterm>
27301 Exim&#x2019;s message ids are normally unique only within the local host. If
27302 uniqueness among a set of hosts is required, each host must set a different
27303 value for the <option>localhost_number</option> option. The string is expanded immediately
27304 after reading the configuration file (so that a number can be computed from the
27305 host name, for example) and the result of the expansion must be a number in the
27306 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
27307 systems). This is available in subsequent string expansions via the variable
27308 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
27309 characters of the message id, instead of just being a fractional part of the
27310 time, are computed from the time and the local host number as described in
27311 section <xref linkend="SECTmessiden"/>.
27312 </para>
27313 <para>
27314 <indexterm role="option">
27315 <primary><option>log_file_path</option></primary>
27316 </indexterm>
27317 </para>
27318 <informaltable frame="all">
27319 <tgroup cols="4" colsep="0" rowsep="0">
27320 <colspec colwidth="8*" align="left"/>
27321 <colspec colwidth="6*" align="center"/>
27322 <colspec colwidth="6*" align="center"/>
27323 <colspec colwidth="6*" align="right"/>
27324 <tbody>
27325 <row>
27326 <entry><option>log_file_path</option></entry>
27327 <entry>Use: <emphasis>main</emphasis></entry>
27328 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27329 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27330 </row>
27331 </tbody>
27332 </tgroup>
27333 </informaltable>
27334 <para>
27335 <indexterm role="concept">
27336 <primary>log</primary>
27337 <secondary>file path for</secondary>
27338 </indexterm>
27339 This option sets the path which is used to determine the names of Exim&#x2019;s log
27340 files, or indicates that logging is to be to syslog, or both. It is expanded
27341 when Exim is entered, so it can, for example, contain a reference to the host
27342 name. If no specific path is set for the log files at compile or run time,
27343 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
27344 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
27345 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
27346 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
27347 used. If this string is fixed at your installation (contains no expansion
27348 variables) it is recommended that you do not set this option in the
27349 configuration file, but instead supply the path using LOG_FILE_PATH in
27350 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
27351 early on &ndash; in particular, failure to read the configuration file.
27352 </para>
27353 <para>
27354 <indexterm role="option">
27355 <primary><option>log_selector</option></primary>
27356 </indexterm>
27357 </para>
27358 <informaltable frame="all">
27359 <tgroup cols="4" colsep="0" rowsep="0">
27360 <colspec colwidth="8*" align="left"/>
27361 <colspec colwidth="6*" align="center"/>
27362 <colspec colwidth="6*" align="center"/>
27363 <colspec colwidth="6*" align="right"/>
27364 <tbody>
27365 <row>
27366 <entry><option>log_selector</option></entry>
27367 <entry>Use: <emphasis>main</emphasis></entry>
27368 <entry>Type: <emphasis>string</emphasis></entry>
27369 <entry>Default: <emphasis>unset</emphasis></entry>
27370 </row>
27371 </tbody>
27372 </tgroup>
27373 </informaltable>
27374 <para>
27375 <indexterm role="concept">
27376 <primary>log</primary>
27377 <secondary>selectors</secondary>
27378 </indexterm>
27379 This option can be used to reduce or increase the number of things that Exim
27380 writes to its log files. Its argument is made up of names preceded by plus or
27381 minus characters. For example:
27382 </para>
27383 <literallayout class="monospaced">
27384 log_selector = +arguments -retry_defer
27385 </literallayout>
27386 <para>
27387 A list of possible names and what they control is given in the chapter on
27388 logging, in section <xref linkend="SECTlogselector"/>.
27389 </para>
27390 <para>
27391 <indexterm role="option">
27392 <primary><option>log_timezone</option></primary>
27393 </indexterm>
27394 </para>
27395 <informaltable frame="all">
27396 <tgroup cols="4" colsep="0" rowsep="0">
27397 <colspec colwidth="8*" align="left"/>
27398 <colspec colwidth="6*" align="center"/>
27399 <colspec colwidth="6*" align="center"/>
27400 <colspec colwidth="6*" align="right"/>
27401 <tbody>
27402 <row>
27403 <entry><option>log_timezone</option></entry>
27404 <entry>Use: <emphasis>main</emphasis></entry>
27405 <entry>Type: <emphasis>boolean</emphasis></entry>
27406 <entry>Default: <emphasis>false</emphasis></entry>
27407 </row>
27408 </tbody>
27409 </tgroup>
27410 </informaltable>
27411 <para>
27412 <indexterm role="concept">
27413 <primary>log</primary>
27414 <secondary>timezone for entries</secondary>
27415 </indexterm>
27416 <indexterm role="variable">
27417 <primary><varname>$tod_log</varname></primary>
27418 </indexterm>
27419 <indexterm role="variable">
27420 <primary><varname>$tod_zone</varname></primary>
27421 </indexterm>
27422 By default, the timestamps on log lines are in local time without the
27423 timezone. This means that if your timezone changes twice a year, the timestamps
27424 in log lines are ambiguous for an hour when the clocks go back. One way of
27425 avoiding this problem is to set the timezone to UTC. An alternative is to set
27426 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
27427 timestamps in log lines. Turning on this option can add quite a lot to the size
27428 of log files because each line is extended by 6 characters. Note that the
27429 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
27430 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
27431 </para>
27432 <para>
27433 <indexterm role="option">
27434 <primary><option>lookup_open_max</option></primary>
27435 </indexterm>
27436 </para>
27437 <informaltable frame="all">
27438 <tgroup cols="4" colsep="0" rowsep="0">
27439 <colspec colwidth="8*" align="left"/>
27440 <colspec colwidth="6*" align="center"/>
27441 <colspec colwidth="6*" align="center"/>
27442 <colspec colwidth="6*" align="right"/>
27443 <tbody>
27444 <row>
27445 <entry><option>lookup_open_max</option></entry>
27446 <entry>Use: <emphasis>main</emphasis></entry>
27447 <entry>Type: <emphasis>integer</emphasis></entry>
27448 <entry>Default: <emphasis>25</emphasis></entry>
27449 </row>
27450 </tbody>
27451 </tgroup>
27452 </informaltable>
27453 <para>
27454 <indexterm role="concept">
27455 <primary>too many open files</primary>
27456 </indexterm>
27457 <indexterm role="concept">
27458 <primary>open files, too many</primary>
27459 </indexterm>
27460 <indexterm role="concept">
27461 <primary>file</primary>
27462 <secondary>too many open</secondary>
27463 </indexterm>
27464 <indexterm role="concept">
27465 <primary>lookup</primary>
27466 <secondary>maximum open files</secondary>
27467 </indexterm>
27468 <indexterm role="concept">
27469 <primary>limit</primary>
27470 <secondary>open files for lookups</secondary>
27471 </indexterm>
27472 This option limits the number of simultaneously open files for single-key
27473 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
27474 Exim normally keeps these files open during routing, because often the same
27475 file is required several times. If the limit is reached, Exim closes the least
27476 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
27477 actually opens two files for each logical DBM database, though it still counts
27478 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
27479 open files</quote> errors with NDBM, you need to reduce the value of
27480 <option>lookup_open_max</option>.
27481 </para>
27482 <para>
27483 <indexterm role="option">
27484 <primary><option>max_username_length</option></primary>
27485 </indexterm>
27486 </para>
27487 <informaltable frame="all">
27488 <tgroup cols="4" colsep="0" rowsep="0">
27489 <colspec colwidth="8*" align="left"/>
27490 <colspec colwidth="6*" align="center"/>
27491 <colspec colwidth="6*" align="center"/>
27492 <colspec colwidth="6*" align="right"/>
27493 <tbody>
27494 <row>
27495 <entry><option>max_username_length</option></entry>
27496 <entry>Use: <emphasis>main</emphasis></entry>
27497 <entry>Type: <emphasis>integer</emphasis></entry>
27498 <entry>Default: <emphasis>0</emphasis></entry>
27499 </row>
27500 </tbody>
27501 </tgroup>
27502 </informaltable>
27503 <para>
27504 <indexterm role="concept">
27505 <primary>length of login name</primary>
27506 </indexterm>
27507 <indexterm role="concept">
27508 <primary>user name</primary>
27509 <secondary>maximum length</secondary>
27510 </indexterm>
27511 <indexterm role="concept">
27512 <primary>limit</primary>
27513 <secondary>user name length</secondary>
27514 </indexterm>
27515 Some operating systems are broken in that they truncate long arguments to
27516 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
27517 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
27518 an argument that is longer behaves as if <function>getpwnam()</function> failed.
27519 </para>
27520 <para>
27521 <indexterm role="option">
27522 <primary><option>message_body_newlines</option></primary>
27523 </indexterm>
27524 </para>
27525 <informaltable frame="all">
27526 <tgroup cols="4" colsep="0" rowsep="0">
27527 <colspec colwidth="8*" align="left"/>
27528 <colspec colwidth="6*" align="center"/>
27529 <colspec colwidth="6*" align="center"/>
27530 <colspec colwidth="6*" align="right"/>
27531 <tbody>
27532 <row>
27533 <entry><option>message_body_newlines</option></entry>
27534 <entry>Use: <emphasis>main</emphasis></entry>
27535 <entry>Type: <emphasis>bool</emphasis></entry>
27536 <entry>Default: <emphasis>false</emphasis></entry>
27537 </row>
27538 </tbody>
27539 </tgroup>
27540 </informaltable>
27541 <para>
27542 <indexterm role="concept">
27543 <primary>message body</primary>
27544 <secondary>newlines in variables</secondary>
27545 </indexterm>
27546 <indexterm role="concept">
27547 <primary>newline</primary>
27548 <secondary>in message body variables</secondary>
27549 </indexterm>
27550 <indexterm role="variable">
27551 <primary><varname>$message_body</varname></primary>
27552 </indexterm>
27553 <indexterm role="variable">
27554 <primary><varname>$message_body_end</varname></primary>
27555 </indexterm>
27556 By default, newlines in the message body are replaced by spaces when setting
27557 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
27558 option is set true, this no longer happens.
27559 </para>
27560 <para>
27561 <indexterm role="option">
27562 <primary><option>message_body_visible</option></primary>
27563 </indexterm>
27564 </para>
27565 <informaltable frame="all">
27566 <tgroup cols="4" colsep="0" rowsep="0">
27567 <colspec colwidth="8*" align="left"/>
27568 <colspec colwidth="6*" align="center"/>
27569 <colspec colwidth="6*" align="center"/>
27570 <colspec colwidth="6*" align="right"/>
27571 <tbody>
27572 <row>
27573 <entry><option>message_body_visible</option></entry>
27574 <entry>Use: <emphasis>main</emphasis></entry>
27575 <entry>Type: <emphasis>integer</emphasis></entry>
27576 <entry>Default: <emphasis>500</emphasis></entry>
27577 </row>
27578 </tbody>
27579 </tgroup>
27580 </informaltable>
27581 <para>
27582 <indexterm role="concept">
27583 <primary>body of message</primary>
27584 <secondary>visible size</secondary>
27585 </indexterm>
27586 <indexterm role="concept">
27587 <primary>message body</primary>
27588 <secondary>visible size</secondary>
27589 </indexterm>
27590 <indexterm role="variable">
27591 <primary><varname>$message_body</varname></primary>
27592 </indexterm>
27593 <indexterm role="variable">
27594 <primary><varname>$message_body_end</varname></primary>
27595 </indexterm>
27596 This option specifies how much of a message&#x2019;s body is to be included in the
27597 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27598 </para>
27599 <para>
27600 <indexterm role="option">
27601 <primary><option>message_id_header_domain</option></primary>
27602 </indexterm>
27603 </para>
27604 <informaltable frame="all">
27605 <tgroup cols="4" colsep="0" rowsep="0">
27606 <colspec colwidth="8*" align="left"/>
27607 <colspec colwidth="6*" align="center"/>
27608 <colspec colwidth="6*" align="center"/>
27609 <colspec colwidth="6*" align="right"/>
27610 <tbody>
27611 <row>
27612 <entry><option>message_id_header_domain</option></entry>
27613 <entry>Use: <emphasis>main</emphasis></entry>
27614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27615 <entry>Default: <emphasis>unset</emphasis></entry>
27616 </row>
27617 </tbody>
27618 </tgroup>
27619 </informaltable>
27620 <para>
27621 <indexterm role="concept">
27622 <primary><emphasis>Message-ID:</emphasis> header line</primary>
27623 </indexterm>
27624 If this option is set, the string is expanded and used as the right hand side
27625 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
27626 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
27627 means <quote>not received over TCP/IP.</quote>
27628 Otherwise, the primary host name is used.
27629 Only letters, digits, dot and hyphen are accepted; any other characters are
27630 replaced by hyphens. If the expansion is forced to fail, or if the result is an
27631 empty string, the option is ignored.
27632 </para>
27633 <para>
27634 <indexterm role="option">
27635 <primary><option>message_id_header_text</option></primary>
27636 </indexterm>
27637 </para>
27638 <informaltable frame="all">
27639 <tgroup cols="4" colsep="0" rowsep="0">
27640 <colspec colwidth="8*" align="left"/>
27641 <colspec colwidth="6*" align="center"/>
27642 <colspec colwidth="6*" align="center"/>
27643 <colspec colwidth="6*" align="right"/>
27644 <tbody>
27645 <row>
27646 <entry><option>message_id_header_text</option></entry>
27647 <entry>Use: <emphasis>main</emphasis></entry>
27648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27649 <entry>Default: <emphasis>unset</emphasis></entry>
27650 </row>
27651 </tbody>
27652 </tgroup>
27653 </informaltable>
27654 <para>
27655 If this variable is set, the string is expanded and used to augment the text of
27656 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
27657 message does not have one. The text of this header is required by RFC 2822 to
27658 take the form of an address. By default, Exim uses its internal message id as
27659 the local part, and the primary host name as the domain. If this option is set,
27660 it is expanded, and provided the expansion is not forced to fail, and does not
27661 yield an empty string, the result is inserted into the header immediately
27662 before the @, separated from the internal message id by a dot. Any characters
27663 that are illegal in an address are automatically converted into hyphens. This
27664 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
27665 colons will become hyphens.
27666 </para>
27667 <para>
27668 <indexterm role="option">
27669 <primary><option>message_logs</option></primary>
27670 </indexterm>
27671 </para>
27672 <informaltable frame="all">
27673 <tgroup cols="4" colsep="0" rowsep="0">
27674 <colspec colwidth="8*" align="left"/>
27675 <colspec colwidth="6*" align="center"/>
27676 <colspec colwidth="6*" align="center"/>
27677 <colspec colwidth="6*" align="right"/>
27678 <tbody>
27679 <row>
27680 <entry><option>message_logs</option></entry>
27681 <entry>Use: <emphasis>main</emphasis></entry>
27682 <entry>Type: <emphasis>boolean</emphasis></entry>
27683 <entry>Default: <emphasis>true</emphasis></entry>
27684 </row>
27685 </tbody>
27686 </tgroup>
27687 </informaltable>
27688 <para>
27689 <indexterm role="concept">
27690 <primary>message logs</primary>
27691 <secondary>disabling</secondary>
27692 </indexterm>
27693 <indexterm role="concept">
27694 <primary>log</primary>
27695 <secondary>message log; disabling</secondary>
27696 </indexterm>
27697 If this option is turned off, per-message log files are not created in the
27698 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
27699 Exim, by reducing the number of files involved in handling a message from a
27700 minimum of four (header spool file, body spool file, delivery journal, and
27701 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
27702 which is not affected by this option.
27703 </para>
27704 <para>
27705 <indexterm role="option">
27706 <primary><option>message_size_limit</option></primary>
27707 </indexterm>
27708 </para>
27709 <informaltable frame="all">
27710 <tgroup cols="4" colsep="0" rowsep="0">
27711 <colspec colwidth="8*" align="left"/>
27712 <colspec colwidth="6*" align="center"/>
27713 <colspec colwidth="6*" align="center"/>
27714 <colspec colwidth="6*" align="right"/>
27715 <tbody>
27716 <row>
27717 <entry><option>message_size_limit</option></entry>
27718 <entry>Use: <emphasis>main</emphasis></entry>
27719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27720 <entry>Default: <emphasis>50M</emphasis></entry>
27721 </row>
27722 </tbody>
27723 </tgroup>
27724 </informaltable>
27725 <para>
27726 <indexterm role="concept">
27727 <primary>message</primary>
27728 <secondary>size limit</secondary>
27729 </indexterm>
27730 <indexterm role="concept">
27731 <primary>limit</primary>
27732 <secondary>message size</secondary>
27733 </indexterm>
27734 <indexterm role="concept">
27735 <primary>size</primary>
27736 <secondary>of message, limit</secondary>
27737 </indexterm>
27738 This option limits the maximum size of message that Exim will process. The
27739 value is expanded for each incoming connection so, for example, it can be made
27740 to depend on the IP address of the remote host for messages arriving via
27741 TCP/IP. After expansion, the value must be a sequence of decimal digits,
27742 optionally followed by K or M.
27743 </para>
27744 <para>
27745 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
27746 other properties of an individual message, because it has to be advertised in
27747 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
27748 error. A value of zero means no limit, but its use is not recommended. See also
27749 <option>bounce_return_size_limit</option>.
27750 </para>
27751 <para>
27752 Incoming SMTP messages are failed with a 552 error if the limit is
27753 exceeded; locally-generated messages either get a stderr message or a delivery
27754 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
27755 an oversized message is logged in both the main and the reject logs. See also
27756 the generic transport option <option>message_size_limit</option>, which limits the size of
27757 message that an individual transport can process.
27758 </para>
27759 <para>
27760 If you use a virus-scanner and set this option to to a value larger than the
27761 maximum size that your virus-scanner is configured to support, you may get
27762 failures triggered by large mails.  The right size to configure for the
27763 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
27764 probably safest to just set it to a little larger than this value.  E.g., with a
27765 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
27766 some problems may result.
27767 </para>
27768 <para>
27769 A value of 0 will disable size limit checking; Exim will still advertise the
27770 SIZE extension in an EHLO response, but without a limit, so as to permit
27771 SMTP clients to still indicate the message size along with the MAIL verb.
27772 </para>
27773 <para>
27774 <indexterm role="option">
27775 <primary><option>move_frozen_messages</option></primary>
27776 </indexterm>
27777 </para>
27778 <informaltable frame="all">
27779 <tgroup cols="4" colsep="0" rowsep="0">
27780 <colspec colwidth="8*" align="left"/>
27781 <colspec colwidth="6*" align="center"/>
27782 <colspec colwidth="6*" align="center"/>
27783 <colspec colwidth="6*" align="right"/>
27784 <tbody>
27785 <row>
27786 <entry><option>move_frozen_messages</option></entry>
27787 <entry>Use: <emphasis>main</emphasis></entry>
27788 <entry>Type: <emphasis>boolean</emphasis></entry>
27789 <entry>Default: <emphasis>false</emphasis></entry>
27790 </row>
27791 </tbody>
27792 </tgroup>
27793 </informaltable>
27794 <para>
27795 <indexterm role="concept">
27796 <primary>frozen messages</primary>
27797 <secondary>moving</secondary>
27798 </indexterm>
27799 This option, which is available only if Exim has been built with the setting
27800 </para>
27801 <literallayout class="monospaced">
27802 SUPPORT_MOVE_FROZEN_MESSAGES=yes
27803 </literallayout>
27804 <para>
27805 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
27806 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
27807 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
27808 standard utilities for handling such moved messages, and they do not show up in
27809 lists generated by <option>-bp</option> or by the Exim monitor.
27810 </para>
27811 <para>
27812 <indexterm role="option">
27813 <primary><option>mua_wrapper</option></primary>
27814 </indexterm>
27815 </para>
27816 <informaltable frame="all">
27817 <tgroup cols="4" colsep="0" rowsep="0">
27818 <colspec colwidth="8*" align="left"/>
27819 <colspec colwidth="6*" align="center"/>
27820 <colspec colwidth="6*" align="center"/>
27821 <colspec colwidth="6*" align="right"/>
27822 <tbody>
27823 <row>
27824 <entry><option>mua_wrapper</option></entry>
27825 <entry>Use: <emphasis>main</emphasis></entry>
27826 <entry>Type: <emphasis>boolean</emphasis></entry>
27827 <entry>Default: <emphasis>false</emphasis></entry>
27828 </row>
27829 </tbody>
27830 </tgroup>
27831 </informaltable>
27832 <para>
27833 Setting this option true causes Exim to run in a very restrictive mode in which
27834 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
27835 contains a full description of this facility.
27836 </para>
27837 <para>
27838 <indexterm role="option">
27839 <primary><option>mysql_servers</option></primary>
27840 </indexterm>
27841 </para>
27842 <informaltable frame="all">
27843 <tgroup cols="4" colsep="0" rowsep="0">
27844 <colspec colwidth="8*" align="left"/>
27845 <colspec colwidth="6*" align="center"/>
27846 <colspec colwidth="6*" align="center"/>
27847 <colspec colwidth="6*" align="right"/>
27848 <tbody>
27849 <row>
27850 <entry><option>mysql_servers</option></entry>
27851 <entry>Use: <emphasis>main</emphasis></entry>
27852 <entry>Type: <emphasis>string list</emphasis></entry>
27853 <entry>Default: <emphasis>unset</emphasis></entry>
27854 </row>
27855 </tbody>
27856 </tgroup>
27857 </informaltable>
27858 <para>
27859 <indexterm role="concept">
27860 <primary>MySQL</primary>
27861 <secondary>server list</secondary>
27862 </indexterm>
27863 This option provides a list of MySQL servers and associated connection data, to
27864 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
27865 option is available only if Exim has been built with MySQL support.
27866 </para>
27867 <para>
27868 <indexterm role="option">
27869 <primary><option>never_users</option></primary>
27870 </indexterm>
27871 </para>
27872 <informaltable frame="all">
27873 <tgroup cols="4" colsep="0" rowsep="0">
27874 <colspec colwidth="8*" align="left"/>
27875 <colspec colwidth="6*" align="center"/>
27876 <colspec colwidth="6*" align="center"/>
27877 <colspec colwidth="6*" align="right"/>
27878 <tbody>
27879 <row>
27880 <entry><option>never_users</option></entry>
27881 <entry>Use: <emphasis>main</emphasis></entry>
27882 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27883 <entry>Default: <emphasis>unset</emphasis></entry>
27884 </row>
27885 </tbody>
27886 </tgroup>
27887 </informaltable>
27888 <para>
27889 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
27890 message deliveries are normally run in processes that are setuid to the
27891 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
27892 It is usually desirable to prevent any deliveries from running as root, as a
27893 safety precaution.
27894 </para>
27895 <para>
27896 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
27897 list of users that must not be used for local deliveries. This list is fixed in
27898 the binary and cannot be overridden by the configuration file. By default, it
27899 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
27900 can be used to add more users to the fixed list.
27901 </para>
27902 <para>
27903 If a message is to be delivered as one of the users on the fixed list or the
27904 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
27905 example is
27906 </para>
27907 <literallayout class="monospaced">
27908 never_users = root:daemon:bin
27909 </literallayout>
27910 <para>
27911 Including root is redundant if it is also on the fixed list, but it does no
27912 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
27913 transport driver.
27914 </para>
27915 <para>
27916 <indexterm role="option">
27917 <primary><option>openssl_options</option></primary>
27918 </indexterm>
27919 </para>
27920 <informaltable frame="all">
27921 <tgroup cols="4" colsep="0" rowsep="0">
27922 <colspec colwidth="8*" align="left"/>
27923 <colspec colwidth="6*" align="center"/>
27924 <colspec colwidth="6*" align="center"/>
27925 <colspec colwidth="6*" align="right"/>
27926 <tbody>
27927 <row>
27928 <entry><option>openssl_options</option></entry>
27929 <entry>Use: <emphasis>main</emphasis></entry>
27930 <entry>Type: <emphasis>string list</emphasis></entry>
27931 <entry>Default: <emphasis>+no_sslv2 +single_dh_use +no_ticket</emphasis></entry>
27932 </row>
27933 </tbody>
27934 </tgroup>
27935 </informaltable>
27936 <para>
27937 <indexterm role="concept">
27938 <primary>OpenSSL </primary>
27939 <secondary>compatibility</secondary>
27940 </indexterm>
27941 This option allows an administrator to adjust the SSL options applied
27942 by OpenSSL to connections.  It is given as a space-separated list of items,
27943 each one to be +added or -subtracted from the current value.
27944 </para>
27945 <para>
27946 This option is only available if Exim is built against OpenSSL.  The values
27947 available for this option vary according to the age of your OpenSSL install.
27948 The <quote>all</quote> value controls a subset of flags which are available, typically
27949 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
27950 list the values known on your system and Exim should support all the
27951 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
27952 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
27953 </para>
27954 <para>
27955 Note that adjusting the options can have severe impact upon the security of
27956 SSL as used by Exim.  It is possible to disable safety checks and shoot
27957 yourself in the foot in various unpleasant ways.  This option should not be
27958 adjusted lightly.  An unrecognised item will be detected at startup, by
27959 invoking Exim with the <option>-bV</option> flag.
27960 </para>
27961 <para>
27962 The option affects Exim operating both as a server and as a client.
27963 </para>
27964 <para>
27965 Historical note: prior to release 4.80, Exim defaulted this value to
27966 "+dont_insert_empty_fragments", which may still be needed for compatibility
27967 with some clients, but which lowers security by increasing exposure to
27968 some now infamous attacks.
27969 </para>
27970 <para>
27971 Examples:
27972 </para>
27973 <literallayout class="monospaced">
27974 # Make both old MS and old Eudora happy:
27975 openssl_options = -all +microsoft_big_sslv3_buffer \
27976                        +dont_insert_empty_fragments
27977
27978 # Disable older protocol versions:
27979 openssl_options = +no_sslv2 +no_sslv3
27980 </literallayout>
27981 <para>
27982 Possible options may include:
27983 </para>
27984 <itemizedlist>
27985 <listitem>
27986 <para>
27987 <literal>all</literal>
27988 </para>
27989 </listitem>
27990 <listitem>
27991 <para>
27992 <literal>allow_unsafe_legacy_renegotiation</literal>
27993 </para>
27994 </listitem>
27995 <listitem>
27996 <para>
27997 <literal>cipher_server_preference</literal>
27998 </para>
27999 </listitem>
28000 <listitem>
28001 <para>
28002 <literal>dont_insert_empty_fragments</literal>
28003 </para>
28004 </listitem>
28005 <listitem>
28006 <para>
28007 <literal>ephemeral_rsa</literal>
28008 </para>
28009 </listitem>
28010 <listitem>
28011 <para>
28012 <literal>legacy_server_connect</literal>
28013 </para>
28014 </listitem>
28015 <listitem>
28016 <para>
28017 <literal>microsoft_big_sslv3_buffer</literal>
28018 </para>
28019 </listitem>
28020 <listitem>
28021 <para>
28022 <literal>microsoft_sess_id_bug</literal>
28023 </para>
28024 </listitem>
28025 <listitem>
28026 <para>
28027 <literal>msie_sslv2_rsa_padding</literal>
28028 </para>
28029 </listitem>
28030 <listitem>
28031 <para>
28032 <literal>netscape_challenge_bug</literal>
28033 </para>
28034 </listitem>
28035 <listitem>
28036 <para>
28037 <literal>netscape_reuse_cipher_change_bug</literal>
28038 </para>
28039 </listitem>
28040 <listitem>
28041 <para>
28042 <literal>no_compression</literal>
28043 </para>
28044 </listitem>
28045 <listitem>
28046 <para>
28047 <literal>no_session_resumption_on_renegotiation</literal>
28048 </para>
28049 </listitem>
28050 <listitem>
28051 <para>
28052 <literal>no_sslv2</literal>
28053 </para>
28054 </listitem>
28055 <listitem>
28056 <para>
28057 <literal>no_sslv3</literal>
28058 </para>
28059 </listitem>
28060 <listitem>
28061 <para>
28062 <literal>no_ticket</literal>
28063 </para>
28064 </listitem>
28065 <listitem>
28066 <para>
28067 <literal>no_tlsv1</literal>
28068 </para>
28069 </listitem>
28070 <listitem>
28071 <para>
28072 <literal>no_tlsv1_1</literal>
28073 </para>
28074 </listitem>
28075 <listitem>
28076 <para>
28077 <literal>no_tlsv1_2</literal>
28078 </para>
28079 </listitem>
28080 <listitem>
28081 <para>
28082 <literal>safari_ecdhe_ecdsa_bug</literal>
28083 </para>
28084 </listitem>
28085 <listitem>
28086 <para>
28087 <literal>single_dh_use</literal>
28088 </para>
28089 </listitem>
28090 <listitem>
28091 <para>
28092 <literal>single_ecdh_use</literal>
28093 </para>
28094 </listitem>
28095 <listitem>
28096 <para>
28097 <literal>ssleay_080_client_dh_bug</literal>
28098 </para>
28099 </listitem>
28100 <listitem>
28101 <para>
28102 <literal>sslref2_reuse_cert_type_bug</literal>
28103 </para>
28104 </listitem>
28105 <listitem>
28106 <para>
28107 <literal>tls_block_padding_bug</literal>
28108 </para>
28109 </listitem>
28110 <listitem>
28111 <para>
28112 <literal>tls_d5_bug</literal>
28113 </para>
28114 </listitem>
28115 <listitem>
28116 <para>
28117 <literal>tls_rollback_bug</literal>
28118 </para>
28119 </listitem>
28120 </itemizedlist>
28121 <para>
28122 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
28123 all clients connecting using the MacOS SecureTransport TLS facility prior
28124 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
28125 to negotiate TLS then this option value might help, provided that your OpenSSL
28126 release is new enough to contain this work-around.  This may be a situation
28127 where you have to upgrade OpenSSL to get buggy clients working.
28128 </para>
28129 <para>
28130 <indexterm role="option">
28131 <primary><option>oracle_servers</option></primary>
28132 </indexterm>
28133 </para>
28134 <informaltable frame="all">
28135 <tgroup cols="4" colsep="0" rowsep="0">
28136 <colspec colwidth="8*" align="left"/>
28137 <colspec colwidth="6*" align="center"/>
28138 <colspec colwidth="6*" align="center"/>
28139 <colspec colwidth="6*" align="right"/>
28140 <tbody>
28141 <row>
28142 <entry><option>oracle_servers</option></entry>
28143 <entry>Use: <emphasis>main</emphasis></entry>
28144 <entry>Type: <emphasis>string list</emphasis></entry>
28145 <entry>Default: <emphasis>unset</emphasis></entry>
28146 </row>
28147 </tbody>
28148 </tgroup>
28149 </informaltable>
28150 <para>
28151 <indexterm role="concept">
28152 <primary>Oracle</primary>
28153 <secondary>server list</secondary>
28154 </indexterm>
28155 This option provides a list of Oracle servers and associated connection data,
28156 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
28157 The option is available only if Exim has been built with Oracle support.
28158 </para>
28159 <para>
28160 <indexterm role="option">
28161 <primary><option>percent_hack_domains</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>percent_hack_domains</option></entry>
28173 <entry>Use: <emphasis>main</emphasis></entry>
28174 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28175 <entry>Default: <emphasis>unset</emphasis></entry>
28176 </row>
28177 </tbody>
28178 </tgroup>
28179 </informaltable>
28180 <para>
28181 <indexterm role="concept">
28182 <primary><quote>percent hack</quote></primary>
28183 </indexterm>
28184 <indexterm role="concept">
28185 <primary>source routing</primary>
28186 <secondary>in email address</secondary>
28187 </indexterm>
28188 <indexterm role="concept">
28189 <primary>address</primary>
28190 <secondary>source-routed</secondary>
28191 </indexterm>
28192 The <quote>percent hack</quote> is the convention whereby a local part containing a
28193 percent sign is re-interpreted as a new email address, with the percent
28194 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
28195 also applied to RFC 2822 addresses that begin with an @ character. If this
28196 option is set, Exim implements the percent facility for those domains listed,
28197 but no others. This happens before an incoming SMTP address is tested against
28198 an ACL.
28199 </para>
28200 <para>
28201 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
28202 trying to get round relaying restrictions. For this reason, it is best avoided
28203 if at all possible. Unfortunately, a number of less security-conscious MTAs
28204 implement it unconditionally. If you are running Exim on a gateway host, and
28205 routing mail through to internal MTAs without processing the local parts, it is
28206 a good idea to reject recipient addresses with percent characters in their
28207 local parts. Exim&#x2019;s default configuration does this.
28208 </para>
28209 <para>
28210 <indexterm role="option">
28211 <primary><option>perl_at_start</option></primary>
28212 </indexterm>
28213 </para>
28214 <informaltable frame="all">
28215 <tgroup cols="4" colsep="0" rowsep="0">
28216 <colspec colwidth="8*" align="left"/>
28217 <colspec colwidth="6*" align="center"/>
28218 <colspec colwidth="6*" align="center"/>
28219 <colspec colwidth="6*" align="right"/>
28220 <tbody>
28221 <row>
28222 <entry><option>perl_at_start</option></entry>
28223 <entry>Use: <emphasis>main</emphasis></entry>
28224 <entry>Type: <emphasis>boolean</emphasis></entry>
28225 <entry>Default: <emphasis>false</emphasis></entry>
28226 </row>
28227 </tbody>
28228 </tgroup>
28229 </informaltable>
28230 <para>
28231 <indexterm role="concept">
28232 <primary>Perl</primary>
28233 </indexterm>
28234 This option is available only when Exim is built with an embedded Perl
28235 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28236 </para>
28237 <para>
28238 <indexterm role="option">
28239 <primary><option>perl_startup</option></primary>
28240 </indexterm>
28241 </para>
28242 <informaltable frame="all">
28243 <tgroup cols="4" colsep="0" rowsep="0">
28244 <colspec colwidth="8*" align="left"/>
28245 <colspec colwidth="6*" align="center"/>
28246 <colspec colwidth="6*" align="center"/>
28247 <colspec colwidth="6*" align="right"/>
28248 <tbody>
28249 <row>
28250 <entry><option>perl_startup</option></entry>
28251 <entry>Use: <emphasis>main</emphasis></entry>
28252 <entry>Type: <emphasis>string</emphasis></entry>
28253 <entry>Default: <emphasis>unset</emphasis></entry>
28254 </row>
28255 </tbody>
28256 </tgroup>
28257 </informaltable>
28258 <para>
28259 <indexterm role="concept">
28260 <primary>Perl</primary>
28261 </indexterm>
28262 This option is available only when Exim is built with an embedded Perl
28263 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28264 </para>
28265 <para>
28266 <indexterm role="option">
28267 <primary><option>perl_startup</option></primary>
28268 </indexterm>
28269 </para>
28270 <informaltable frame="all">
28271 <tgroup cols="4" colsep="0" rowsep="0">
28272 <colspec colwidth="8*" align="left"/>
28273 <colspec colwidth="6*" align="center"/>
28274 <colspec colwidth="6*" align="center"/>
28275 <colspec colwidth="6*" align="right"/>
28276 <tbody>
28277 <row>
28278 <entry><option>perl_startup</option></entry>
28279 <entry>Use: <emphasis>main</emphasis></entry>
28280 <entry>Type: <emphasis>boolean</emphasis></entry>
28281 <entry>Default: <emphasis>false</emphasis></entry>
28282 </row>
28283 </tbody>
28284 </tgroup>
28285 </informaltable>
28286 <para>
28287 <indexterm role="concept">
28288 <primary>Perl</primary>
28289 </indexterm>
28290 This Option enables the taint mode of the embedded Perl interpreter.
28291 </para>
28292 <para>
28293 <indexterm role="option">
28294 <primary><option>pgsql_servers</option></primary>
28295 </indexterm>
28296 </para>
28297 <informaltable frame="all">
28298 <tgroup cols="4" colsep="0" rowsep="0">
28299 <colspec colwidth="8*" align="left"/>
28300 <colspec colwidth="6*" align="center"/>
28301 <colspec colwidth="6*" align="center"/>
28302 <colspec colwidth="6*" align="right"/>
28303 <tbody>
28304 <row>
28305 <entry><option>pgsql_servers</option></entry>
28306 <entry>Use: <emphasis>main</emphasis></entry>
28307 <entry>Type: <emphasis>string list</emphasis></entry>
28308 <entry>Default: <emphasis>unset</emphasis></entry>
28309 </row>
28310 </tbody>
28311 </tgroup>
28312 </informaltable>
28313 <para>
28314 <indexterm role="concept">
28315 <primary>PostgreSQL lookup type</primary>
28316 <secondary>server list</secondary>
28317 </indexterm>
28318 This option provides a list of PostgreSQL servers and associated connection
28319 data, to be used in conjunction with <command>pgsql</command> lookups (see section
28320 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
28321 PostgreSQL support.
28322 </para>
28323 <para>
28324 <indexterm role="option">
28325 <primary><option>pid_file_path</option></primary>
28326 </indexterm>
28327 </para>
28328 <informaltable frame="all">
28329 <tgroup cols="4" colsep="0" rowsep="0">
28330 <colspec colwidth="8*" align="left"/>
28331 <colspec colwidth="6*" align="center"/>
28332 <colspec colwidth="6*" align="center"/>
28333 <colspec colwidth="6*" align="right"/>
28334 <tbody>
28335 <row>
28336 <entry><option>pid_file_path</option></entry>
28337 <entry>Use: <emphasis>main</emphasis></entry>
28338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28339 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28340 </row>
28341 </tbody>
28342 </tgroup>
28343 </informaltable>
28344 <para>
28345 <indexterm role="concept">
28346 <primary>daemon</primary>
28347 <secondary>pid file path</secondary>
28348 </indexterm>
28349 <indexterm role="concept">
28350 <primary>pid file, path for</primary>
28351 </indexterm>
28352 This option sets the name of the file to which the Exim daemon writes its
28353 process id. The string is expanded, so it can contain, for example, references
28354 to the host name:
28355 </para>
28356 <literallayout class="monospaced">
28357 pid_file_path = /var/log/$primary_hostname/exim.pid
28358 </literallayout>
28359 <para>
28360 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
28361 spool directory.
28362 The value set by the option can be overridden by the <option>-oP</option> command line
28363 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
28364 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
28365 </para>
28366 <para>
28367 <indexterm role="option">
28368 <primary><option>pipelining_advertise_hosts</option></primary>
28369 </indexterm>
28370 </para>
28371 <informaltable frame="all">
28372 <tgroup cols="4" colsep="0" rowsep="0">
28373 <colspec colwidth="8*" align="left"/>
28374 <colspec colwidth="6*" align="center"/>
28375 <colspec colwidth="6*" align="center"/>
28376 <colspec colwidth="6*" align="right"/>
28377 <tbody>
28378 <row>
28379 <entry><option>pipelining_advertise_hosts</option></entry>
28380 <entry>Use: <emphasis>main</emphasis></entry>
28381 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28382 <entry>Default: <emphasis>*</emphasis></entry>
28383 </row>
28384 </tbody>
28385 </tgroup>
28386 </informaltable>
28387 <para>
28388 <indexterm role="concept">
28389 <primary>PIPELINING</primary>
28390 <secondary>suppressing advertising</secondary>
28391 </indexterm>
28392 This option can be used to suppress the advertisement of the SMTP
28393 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
28394 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
28395 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
28396 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
28397 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
28398 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
28399 </para>
28400 <para>
28401 <indexterm role="option">
28402 <primary><option>prdr_enable</option></primary>
28403 </indexterm>
28404 </para>
28405 <informaltable frame="all">
28406 <tgroup cols="4" colsep="0" rowsep="0">
28407 <colspec colwidth="8*" align="left"/>
28408 <colspec colwidth="6*" align="center"/>
28409 <colspec colwidth="6*" align="center"/>
28410 <colspec colwidth="6*" align="right"/>
28411 <tbody>
28412 <row>
28413 <entry><option>prdr_enable</option></entry>
28414 <entry>Use: <emphasis>main</emphasis></entry>
28415 <entry>Type: <emphasis>boolean</emphasis></entry>
28416 <entry>Default: <emphasis>false</emphasis></entry>
28417 </row>
28418 </tbody>
28419 </tgroup>
28420 </informaltable>
28421 <para>
28422 <indexterm role="concept">
28423 <primary>PRDR</primary>
28424 <secondary>enabling on server</secondary>
28425 </indexterm>
28426 This option can be used to enable the Per-Recipient Data Response extension
28427 to SMTP, defined by Eric Hall.
28428 If the option is set, PRDR is advertised by Exim when operating as a server.
28429 If the client requests PRDR, and more than one recipient, for a message
28430 an additional ACL is called for each recipient after the message content
28431 is received.  See section <xref linkend="SECTPRDRACL"/>.
28432 </para>
28433 <para>
28434 <indexterm role="option">
28435 <primary><option>preserve_message_logs</option></primary>
28436 </indexterm>
28437 </para>
28438 <informaltable frame="all">
28439 <tgroup cols="4" colsep="0" rowsep="0">
28440 <colspec colwidth="8*" align="left"/>
28441 <colspec colwidth="6*" align="center"/>
28442 <colspec colwidth="6*" align="center"/>
28443 <colspec colwidth="6*" align="right"/>
28444 <tbody>
28445 <row>
28446 <entry><option>preserve_message_logs</option></entry>
28447 <entry>Use: <emphasis>main</emphasis></entry>
28448 <entry>Type: <emphasis>boolean</emphasis></entry>
28449 <entry>Default: <emphasis>false</emphasis></entry>
28450 </row>
28451 </tbody>
28452 </tgroup>
28453 </informaltable>
28454 <para>
28455 <indexterm role="concept">
28456 <primary>message logs</primary>
28457 <secondary>preserving</secondary>
28458 </indexterm>
28459 If this option is set, message log files are not deleted when messages are
28460 completed. Instead, they are moved to a sub-directory of the spool directory
28461 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
28462 purposes. This is a dangerous option to set on systems with any appreciable
28463 volume of mail. Use with care!
28464 </para>
28465 <para>
28466 <indexterm role="option">
28467 <primary><option>primary_hostname</option></primary>
28468 </indexterm>
28469 </para>
28470 <informaltable frame="all">
28471 <tgroup cols="4" colsep="0" rowsep="0">
28472 <colspec colwidth="8*" align="left"/>
28473 <colspec colwidth="6*" align="center"/>
28474 <colspec colwidth="6*" align="center"/>
28475 <colspec colwidth="6*" align="right"/>
28476 <tbody>
28477 <row>
28478 <entry><option>primary_hostname</option></entry>
28479 <entry>Use: <emphasis>main</emphasis></entry>
28480 <entry>Type: <emphasis>string</emphasis></entry>
28481 <entry>Default: <emphasis>see below</emphasis></entry>
28482 </row>
28483 </tbody>
28484 </tgroup>
28485 </informaltable>
28486 <para>
28487 <indexterm role="concept">
28488 <primary>name</primary>
28489 <secondary>of local host</secondary>
28490 </indexterm>
28491 <indexterm role="concept">
28492 <primary>host</primary>
28493 <secondary>name of local</secondary>
28494 </indexterm>
28495 <indexterm role="concept">
28496 <primary>local host</primary>
28497 <secondary>name of</secondary>
28498 </indexterm>
28499 <indexterm role="variable">
28500 <primary><varname>$primary_hostname</varname></primary>
28501 </indexterm>
28502 This specifies the name of the current host. It is used in the default EHLO or
28503 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
28504 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
28505 The value is also used by default in some SMTP response messages from an Exim
28506 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
28507 </para>
28508 <para>
28509 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
28510 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
28511 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
28512 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
28513 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
28514 explicitly by this option, or defaulted.
28515 </para>
28516 <para>
28517 <indexterm role="option">
28518 <primary><option>print_topbitchars</option></primary>
28519 </indexterm>
28520 </para>
28521 <informaltable frame="all">
28522 <tgroup cols="4" colsep="0" rowsep="0">
28523 <colspec colwidth="8*" align="left"/>
28524 <colspec colwidth="6*" align="center"/>
28525 <colspec colwidth="6*" align="center"/>
28526 <colspec colwidth="6*" align="right"/>
28527 <tbody>
28528 <row>
28529 <entry><option>print_topbitchars</option></entry>
28530 <entry>Use: <emphasis>main</emphasis></entry>
28531 <entry>Type: <emphasis>boolean</emphasis></entry>
28532 <entry>Default: <emphasis>false</emphasis></entry>
28533 </row>
28534 </tbody>
28535 </tgroup>
28536 </informaltable>
28537 <para>
28538 <indexterm role="concept">
28539 <primary>printing characters</primary>
28540 </indexterm>
28541 <indexterm role="concept">
28542 <primary>8-bit characters</primary>
28543 </indexterm>
28544 By default, Exim considers only those characters whose codes lie in the range
28545 32&ndash;126 to be printing characters. In a number of circumstances (for example,
28546 when writing log entries) non-printing characters are converted into escape
28547 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
28548 is set, code values of 128 and above are also considered to be printing
28549 characters.
28550 </para>
28551 <para>
28552 This option also affects the header syntax checks performed by the
28553 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
28554 the user&#x2019;s full name when constructing From: and Sender: addresses (as
28555 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
28556 Exim to generate eight bit message headers that do not conform to the
28557 standards.
28558 </para>
28559 <para>
28560 <indexterm role="option">
28561 <primary><option>process_log_path</option></primary>
28562 </indexterm>
28563 </para>
28564 <informaltable frame="all">
28565 <tgroup cols="4" colsep="0" rowsep="0">
28566 <colspec colwidth="8*" align="left"/>
28567 <colspec colwidth="6*" align="center"/>
28568 <colspec colwidth="6*" align="center"/>
28569 <colspec colwidth="6*" align="right"/>
28570 <tbody>
28571 <row>
28572 <entry><option>process_log_path</option></entry>
28573 <entry>Use: <emphasis>main</emphasis></entry>
28574 <entry>Type: <emphasis>string</emphasis></entry>
28575 <entry>Default: <emphasis>unset</emphasis></entry>
28576 </row>
28577 </tbody>
28578 </tgroup>
28579 </informaltable>
28580 <para>
28581 <indexterm role="concept">
28582 <primary>process log path</primary>
28583 </indexterm>
28584 <indexterm role="concept">
28585 <primary>log</primary>
28586 <secondary>process log</secondary>
28587 </indexterm>
28588 <indexterm role="concept">
28589 <primary><emphasis>exiwhat</emphasis></primary>
28590 </indexterm>
28591 This option sets the name of the file to which an Exim process writes its
28592 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
28593 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
28594 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
28595 can be useful in environments where two different Exims are running, using
28596 different spool directories.
28597 </para>
28598 <para>
28599 <indexterm role="option">
28600 <primary><option>prod_requires_admin</option></primary>
28601 </indexterm>
28602 </para>
28603 <informaltable frame="all">
28604 <tgroup cols="4" colsep="0" rowsep="0">
28605 <colspec colwidth="8*" align="left"/>
28606 <colspec colwidth="6*" align="center"/>
28607 <colspec colwidth="6*" align="center"/>
28608 <colspec colwidth="6*" align="right"/>
28609 <tbody>
28610 <row>
28611 <entry><option>prod_requires_admin</option></entry>
28612 <entry>Use: <emphasis>main</emphasis></entry>
28613 <entry>Type: <emphasis>boolean</emphasis></entry>
28614 <entry>Default: <emphasis>true</emphasis></entry>
28615 </row>
28616 </tbody>
28617 </tgroup>
28618 </informaltable>
28619 <para>
28620 <indexterm role="concept">
28621 <primary>restricting access to features</primary>
28622 </indexterm>
28623 <indexterm role="option">
28624 <primary><option>-M</option></primary>
28625 </indexterm>
28626 <indexterm role="option">
28627 <primary><option>-R</option></primary>
28628 </indexterm>
28629 <indexterm role="option">
28630 <primary><option>-q</option></primary>
28631 </indexterm>
28632 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
28633 admin user unless <option>prod_requires_admin</option> is set false. See also
28634 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
28635 </para>
28636 <para>
28637 <indexterm role="option">
28638 <primary><option>qualify_domain</option></primary>
28639 </indexterm>
28640 </para>
28641 <informaltable frame="all">
28642 <tgroup cols="4" colsep="0" rowsep="0">
28643 <colspec colwidth="8*" align="left"/>
28644 <colspec colwidth="6*" align="center"/>
28645 <colspec colwidth="6*" align="center"/>
28646 <colspec colwidth="6*" align="right"/>
28647 <tbody>
28648 <row>
28649 <entry><option>qualify_domain</option></entry>
28650 <entry>Use: <emphasis>main</emphasis></entry>
28651 <entry>Type: <emphasis>string</emphasis></entry>
28652 <entry>Default: <emphasis>see below</emphasis></entry>
28653 </row>
28654 </tbody>
28655 </tgroup>
28656 </informaltable>
28657 <para>
28658 <indexterm role="concept">
28659 <primary>domain</primary>
28660 <secondary>for qualifying addresses</secondary>
28661 </indexterm>
28662 <indexterm role="concept">
28663 <primary>address</primary>
28664 <secondary>qualification</secondary>
28665 </indexterm>
28666 This option specifies the domain name that is added to any envelope sender
28667 addresses that do not have a domain qualification. It also applies to
28668 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
28669 are accepted by default only for locally-generated messages. Qualification is
28670 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
28671 locally-generated messages, unless the <option>-bnq</option> command line option is used.
28672 </para>
28673 <para>
28674 Messages from external sources must always contain fully qualified addresses,
28675 unless the sending host matches <option>sender_unqualified_hosts</option> or
28676 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
28677 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
28678 necessary. Internally, Exim always works with fully qualified envelope
28679 addresses. If <option>qualify_domain</option> is not set, it defaults to the
28680 <option>primary_hostname</option> value.
28681 </para>
28682 <para>
28683 <indexterm role="option">
28684 <primary><option>qualify_recipient</option></primary>
28685 </indexterm>
28686 </para>
28687 <informaltable frame="all">
28688 <tgroup cols="4" colsep="0" rowsep="0">
28689 <colspec colwidth="8*" align="left"/>
28690 <colspec colwidth="6*" align="center"/>
28691 <colspec colwidth="6*" align="center"/>
28692 <colspec colwidth="6*" align="right"/>
28693 <tbody>
28694 <row>
28695 <entry><option>qualify_recipient</option></entry>
28696 <entry>Use: <emphasis>main</emphasis></entry>
28697 <entry>Type: <emphasis>string</emphasis></entry>
28698 <entry>Default: <emphasis>see below</emphasis></entry>
28699 </row>
28700 </tbody>
28701 </tgroup>
28702 </informaltable>
28703 <para>
28704 This option allows you to specify a different domain for qualifying recipient
28705 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
28706 </para>
28707 <para>
28708 <indexterm role="option">
28709 <primary><option>queue_domains</option></primary>
28710 </indexterm>
28711 </para>
28712 <informaltable frame="all">
28713 <tgroup cols="4" colsep="0" rowsep="0">
28714 <colspec colwidth="8*" align="left"/>
28715 <colspec colwidth="6*" align="center"/>
28716 <colspec colwidth="6*" align="center"/>
28717 <colspec colwidth="6*" align="right"/>
28718 <tbody>
28719 <row>
28720 <entry><option>queue_domains</option></entry>
28721 <entry>Use: <emphasis>main</emphasis></entry>
28722 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28723 <entry>Default: <emphasis>unset</emphasis></entry>
28724 </row>
28725 </tbody>
28726 </tgroup>
28727 </informaltable>
28728 <para>
28729 <indexterm role="concept">
28730 <primary>domain</primary>
28731 <secondary>specifying non-immediate delivery</secondary>
28732 </indexterm>
28733 <indexterm role="concept">
28734 <primary>queueing incoming messages</primary>
28735 </indexterm>
28736 <indexterm role="concept">
28737 <primary>message</primary>
28738 <secondary>queueing certain domains</secondary>
28739 </indexterm>
28740 This option lists domains for which immediate delivery is not required.
28741 A delivery process is started whenever a message is received, but only those
28742 domains that do not match are processed. All other deliveries wait until the
28743 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
28744 </para>
28745 <para>
28746 <indexterm role="option">
28747 <primary><option>queue_list_requires_admin</option></primary>
28748 </indexterm>
28749 </para>
28750 <informaltable frame="all">
28751 <tgroup cols="4" colsep="0" rowsep="0">
28752 <colspec colwidth="8*" align="left"/>
28753 <colspec colwidth="6*" align="center"/>
28754 <colspec colwidth="6*" align="center"/>
28755 <colspec colwidth="6*" align="right"/>
28756 <tbody>
28757 <row>
28758 <entry><option>queue_list_requires_admin</option></entry>
28759 <entry>Use: <emphasis>main</emphasis></entry>
28760 <entry>Type: <emphasis>boolean</emphasis></entry>
28761 <entry>Default: <emphasis>true</emphasis></entry>
28762 </row>
28763 </tbody>
28764 </tgroup>
28765 </informaltable>
28766 <para>
28767 <indexterm role="concept">
28768 <primary>restricting access to features</primary>
28769 </indexterm>
28770 <indexterm role="option">
28771 <primary><option>-bp</option></primary>
28772 </indexterm>
28773 The <option>-bp</option> command-line option, which lists the messages that are on the
28774 queue, requires the caller to be an admin user unless
28775 <option>queue_list_requires_admin</option> is set false.
28776 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
28777 </para>
28778 <para>
28779 <indexterm role="option">
28780 <primary><option>queue_only</option></primary>
28781 </indexterm>
28782 </para>
28783 <informaltable frame="all">
28784 <tgroup cols="4" colsep="0" rowsep="0">
28785 <colspec colwidth="8*" align="left"/>
28786 <colspec colwidth="6*" align="center"/>
28787 <colspec colwidth="6*" align="center"/>
28788 <colspec colwidth="6*" align="right"/>
28789 <tbody>
28790 <row>
28791 <entry><option>queue_only</option></entry>
28792 <entry>Use: <emphasis>main</emphasis></entry>
28793 <entry>Type: <emphasis>boolean</emphasis></entry>
28794 <entry>Default: <emphasis>false</emphasis></entry>
28795 </row>
28796 </tbody>
28797 </tgroup>
28798 </informaltable>
28799 <para>
28800 <indexterm role="concept">
28801 <primary>queueing incoming messages</primary>
28802 </indexterm>
28803 <indexterm role="concept">
28804 <primary>message</primary>
28805 <secondary>queueing unconditionally</secondary>
28806 </indexterm>
28807 If <option>queue_only</option> is set, a delivery process is not automatically started
28808 whenever a message is received. Instead, the message waits on the queue for the
28809 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
28810 delivered immediately when certain conditions (such as heavy load) occur.
28811 </para>
28812 <para>
28813 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
28814 and <option>-odi</option> command line options override <option>queue_only</option> unless
28815 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
28816 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
28817 </para>
28818 <para>
28819 <indexterm role="option">
28820 <primary><option>queue_only_file</option></primary>
28821 </indexterm>
28822 </para>
28823 <informaltable frame="all">
28824 <tgroup cols="4" colsep="0" rowsep="0">
28825 <colspec colwidth="8*" align="left"/>
28826 <colspec colwidth="6*" align="center"/>
28827 <colspec colwidth="6*" align="center"/>
28828 <colspec colwidth="6*" align="right"/>
28829 <tbody>
28830 <row>
28831 <entry><option>queue_only_file</option></entry>
28832 <entry>Use: <emphasis>main</emphasis></entry>
28833 <entry>Type: <emphasis>string</emphasis></entry>
28834 <entry>Default: <emphasis>unset</emphasis></entry>
28835 </row>
28836 </tbody>
28837 </tgroup>
28838 </informaltable>
28839 <para>
28840 <indexterm role="concept">
28841 <primary>queueing incoming messages</primary>
28842 </indexterm>
28843 <indexterm role="concept">
28844 <primary>message</primary>
28845 <secondary>queueing by file existence</secondary>
28846 </indexterm>
28847 This option can be set to a colon-separated list of absolute path names, each
28848 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
28849 it tests for the existence of each listed path using a call to <function>stat()</function>. For
28850 each path that exists, the corresponding queueing option is set.
28851 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
28852 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
28853 </para>
28854 <literallayout class="monospaced">
28855 queue_only_file = smtp/some/file
28856 </literallayout>
28857 <para>
28858 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
28859 <filename>/some/file</filename> exists.
28860 </para>
28861 <para>
28862 <indexterm role="option">
28863 <primary><option>queue_only_load</option></primary>
28864 </indexterm>
28865 </para>
28866 <informaltable frame="all">
28867 <tgroup cols="4" colsep="0" rowsep="0">
28868 <colspec colwidth="8*" align="left"/>
28869 <colspec colwidth="6*" align="center"/>
28870 <colspec colwidth="6*" align="center"/>
28871 <colspec colwidth="6*" align="right"/>
28872 <tbody>
28873 <row>
28874 <entry><option>queue_only_load</option></entry>
28875 <entry>Use: <emphasis>main</emphasis></entry>
28876 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28877 <entry>Default: <emphasis>unset</emphasis></entry>
28878 </row>
28879 </tbody>
28880 </tgroup>
28881 </informaltable>
28882 <para>
28883 <indexterm role="concept">
28884 <primary>load average</primary>
28885 </indexterm>
28886 <indexterm role="concept">
28887 <primary>queueing incoming messages</primary>
28888 </indexterm>
28889 <indexterm role="concept">
28890 <primary>message</primary>
28891 <secondary>queueing by load</secondary>
28892 </indexterm>
28893 If the system load average is higher than this value, incoming messages from
28894 all sources are queued, and no automatic deliveries are started. If this
28895 happens during local or remote SMTP input, all subsequent messages received on
28896 the same SMTP connection are queued by default, whatever happens to the load in
28897 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
28898 false.
28899 </para>
28900 <para>
28901 Deliveries will subsequently be performed by queue runner processes. This
28902 option has no effect on ancient operating systems on which Exim cannot
28903 determine the load average. See also <option>deliver_queue_load_max</option> and
28904 <option>smtp_load_reserve</option>.
28905 </para>
28906 <para>
28907 <indexterm role="option">
28908 <primary><option>queue_only_load_latch</option></primary>
28909 </indexterm>
28910 </para>
28911 <informaltable frame="all">
28912 <tgroup cols="4" colsep="0" rowsep="0">
28913 <colspec colwidth="8*" align="left"/>
28914 <colspec colwidth="6*" align="center"/>
28915 <colspec colwidth="6*" align="center"/>
28916 <colspec colwidth="6*" align="right"/>
28917 <tbody>
28918 <row>
28919 <entry><option>queue_only_load_latch</option></entry>
28920 <entry>Use: <emphasis>main</emphasis></entry>
28921 <entry>Type: <emphasis>boolean</emphasis></entry>
28922 <entry>Default: <emphasis>true</emphasis></entry>
28923 </row>
28924 </tbody>
28925 </tgroup>
28926 </informaltable>
28927 <para>
28928 <indexterm role="concept">
28929 <primary>load average</primary>
28930 <secondary>re-evaluating per message</secondary>
28931 </indexterm>
28932 When this option is true (the default), once one message has been queued
28933 because the load average is higher than the value set by <option>queue_only_load</option>,
28934 all subsequent messages received on the same SMTP connection are also queued.
28935 This is a deliberate choice; even though the load average may fall below the
28936 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
28937 connection when not delivering earlier ones. However, there are special
28938 circumstances such as very long-lived connections from scanning appliances
28939 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
28940 should be set false. This causes the value of the load average to be
28941 re-evaluated for each message.
28942 </para>
28943 <para>
28944 <indexterm role="option">
28945 <primary><option>queue_only_override</option></primary>
28946 </indexterm>
28947 </para>
28948 <informaltable frame="all">
28949 <tgroup cols="4" colsep="0" rowsep="0">
28950 <colspec colwidth="8*" align="left"/>
28951 <colspec colwidth="6*" align="center"/>
28952 <colspec colwidth="6*" align="center"/>
28953 <colspec colwidth="6*" align="right"/>
28954 <tbody>
28955 <row>
28956 <entry><option>queue_only_override</option></entry>
28957 <entry>Use: <emphasis>main</emphasis></entry>
28958 <entry>Type: <emphasis>boolean</emphasis></entry>
28959 <entry>Default: <emphasis>true</emphasis></entry>
28960 </row>
28961 </tbody>
28962 </tgroup>
28963 </informaltable>
28964 <para>
28965 <indexterm role="concept">
28966 <primary>queueing incoming messages</primary>
28967 </indexterm>
28968 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
28969 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
28970 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
28971 to override; they are accepted, but ignored.
28972 </para>
28973 <para>
28974 <indexterm role="option">
28975 <primary><option>queue_run_in_order</option></primary>
28976 </indexterm>
28977 </para>
28978 <informaltable frame="all">
28979 <tgroup cols="4" colsep="0" rowsep="0">
28980 <colspec colwidth="8*" align="left"/>
28981 <colspec colwidth="6*" align="center"/>
28982 <colspec colwidth="6*" align="center"/>
28983 <colspec colwidth="6*" align="right"/>
28984 <tbody>
28985 <row>
28986 <entry><option>queue_run_in_order</option></entry>
28987 <entry>Use: <emphasis>main</emphasis></entry>
28988 <entry>Type: <emphasis>boolean</emphasis></entry>
28989 <entry>Default: <emphasis>false</emphasis></entry>
28990 </row>
28991 </tbody>
28992 </tgroup>
28993 </informaltable>
28994 <para>
28995 <indexterm role="concept">
28996 <primary>queue runner</primary>
28997 <secondary>processing messages in order</secondary>
28998 </indexterm>
28999 If this option is set, queue runs happen in order of message arrival instead of
29000 in an arbitrary order. For this to happen, a complete list of the entire queue
29001 must be set up before the deliveries start. When the queue is all held in a
29002 single directory (the default), a single list is created for both the ordered
29003 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
29004 single list is not created when <option>queue_run_in_order</option> is false. In this case,
29005 the sub-directories are processed one at a time (in a random order), and this
29006 avoids setting up one huge list for the whole queue. Thus, setting
29007 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
29008 when the queue is large, because of the extra work in setting up the single,
29009 large list. In most situations, <option>queue_run_in_order</option> should not be set.
29010 </para>
29011 <para>
29012 <indexterm role="option">
29013 <primary><option>queue_run_max</option></primary>
29014 </indexterm>
29015 </para>
29016 <informaltable frame="all">
29017 <tgroup cols="4" colsep="0" rowsep="0">
29018 <colspec colwidth="8*" align="left"/>
29019 <colspec colwidth="6*" align="center"/>
29020 <colspec colwidth="6*" align="center"/>
29021 <colspec colwidth="6*" align="right"/>
29022 <tbody>
29023 <row>
29024 <entry><option>queue_run_max</option></entry>
29025 <entry>Use: <emphasis>main</emphasis></entry>
29026 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
29027 <entry>Default: <emphasis>5</emphasis></entry>
29028 </row>
29029 </tbody>
29030 </tgroup>
29031 </informaltable>
29032 <para>
29033 <indexterm role="concept">
29034 <primary>queue runner</primary>
29035 <secondary>maximum number of</secondary>
29036 </indexterm>
29037 This controls the maximum number of queue runner processes that an Exim daemon
29038 can run simultaneously. This does not mean that it starts them all at once,
29039 but rather that if the maximum number are still running when the time comes to
29040 start another one, it refrains from starting another one. This can happen with
29041 very large queues and/or very sluggish deliveries. This option does not,
29042 however, interlock with other processes, so additional queue runners can be
29043 started by other means, or by killing and restarting the daemon.
29044 </para>
29045 <para>
29046 Setting this option to zero does not suppress queue runs; rather, it disables
29047 the limit, allowing any number of simultaneous queue runner processes to be
29048 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
29049 the daemon&#x2019;s command line.
29050 </para>
29051 <para>
29052 <indexterm role="concept">
29053 <primary>queues</primary>
29054 <secondary>named</secondary>
29055 </indexterm>
29056 <indexterm role="concept">
29057 <primary>named queues</primary>
29058 </indexterm>
29059 To set limits for different named queues use
29060 an expansion depending on the <varname>$queue_name</varname> variable.
29061 </para>
29062 <para>
29063 <indexterm role="option">
29064 <primary><option>queue_smtp_domains</option></primary>
29065 </indexterm>
29066 </para>
29067 <informaltable frame="all">
29068 <tgroup cols="4" colsep="0" rowsep="0">
29069 <colspec colwidth="8*" align="left"/>
29070 <colspec colwidth="6*" align="center"/>
29071 <colspec colwidth="6*" align="center"/>
29072 <colspec colwidth="6*" align="right"/>
29073 <tbody>
29074 <row>
29075 <entry><option>queue_smtp_domains</option></entry>
29076 <entry>Use: <emphasis>main</emphasis></entry>
29077 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29078 <entry>Default: <emphasis>unset</emphasis></entry>
29079 </row>
29080 </tbody>
29081 </tgroup>
29082 </informaltable>
29083 <para>
29084 <indexterm role="concept">
29085 <primary>queueing incoming messages</primary>
29086 </indexterm>
29087 <indexterm role="concept">
29088 <primary>message</primary>
29089 <secondary>queueing remote deliveries</secondary>
29090 </indexterm>
29091 When this option is set, a delivery process is started whenever a message is
29092 received, routing is performed, and local deliveries take place.
29093 However, if any SMTP deliveries are required for domains that match
29094 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
29095 message waits on the queue for the next queue run. Since routing of the message
29096 has taken place, Exim knows to which remote hosts it must be delivered, and so
29097 when the queue run happens, multiple messages for the same host are delivered
29098 over a single SMTP connection. The <option>-odqs</option> command line option causes all
29099 SMTP deliveries to be queued in this way, and is equivalent to setting
29100 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
29101 <option>queue_domains</option>.
29102 </para>
29103 <para>
29104 <indexterm role="option">
29105 <primary><option>receive_timeout</option></primary>
29106 </indexterm>
29107 </para>
29108 <informaltable frame="all">
29109 <tgroup cols="4" colsep="0" rowsep="0">
29110 <colspec colwidth="8*" align="left"/>
29111 <colspec colwidth="6*" align="center"/>
29112 <colspec colwidth="6*" align="center"/>
29113 <colspec colwidth="6*" align="right"/>
29114 <tbody>
29115 <row>
29116 <entry><option>receive_timeout</option></entry>
29117 <entry>Use: <emphasis>main</emphasis></entry>
29118 <entry>Type: <emphasis>time</emphasis></entry>
29119 <entry>Default: <emphasis>0s</emphasis></entry>
29120 </row>
29121 </tbody>
29122 </tgroup>
29123 </informaltable>
29124 <para>
29125 <indexterm role="concept">
29126 <primary>timeout</primary>
29127 <secondary>for non-SMTP input</secondary>
29128 </indexterm>
29129 This option sets the timeout for accepting a non-SMTP message, that is, the
29130 maximum time that Exim waits when reading a message on the standard input. If
29131 the value is zero, it will wait for ever. This setting is overridden by the
29132 <option>-or</option> command line option. The timeout for incoming SMTP messages is
29133 controlled by <option>smtp_receive_timeout</option>.
29134 </para>
29135 <para>
29136 <indexterm role="option">
29137 <primary><option>received_header_text</option></primary>
29138 </indexterm>
29139 </para>
29140 <informaltable frame="all">
29141 <tgroup cols="4" colsep="0" rowsep="0">
29142 <colspec colwidth="8*" align="left"/>
29143 <colspec colwidth="6*" align="center"/>
29144 <colspec colwidth="6*" align="center"/>
29145 <colspec colwidth="6*" align="right"/>
29146 <tbody>
29147 <row>
29148 <entry><option>received_header_text</option></entry>
29149 <entry>Use: <emphasis>main</emphasis></entry>
29150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29151 <entry>Default: <emphasis>see below</emphasis></entry>
29152 </row>
29153 </tbody>
29154 </tgroup>
29155 </informaltable>
29156 <para>
29157 <indexterm role="concept">
29158 <primary>customizing</primary>
29159 <secondary><emphasis>Received:</emphasis> header</secondary>
29160 </indexterm>
29161 <indexterm role="concept">
29162 <primary><emphasis>Received:</emphasis> header line</primary>
29163 <secondary>customizing</secondary>
29164 </indexterm>
29165 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
29166 added to each message, except for the timestamp, which is automatically added
29167 on at the end (preceded by a semicolon). The string is expanded each time it is
29168 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
29169 added to the message. Otherwise, the string should start with the text
29170 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
29171 header lines. The default setting is:
29172 </para>
29173 <literallayout class="monospaced">
29174 received_header_text = Received: \
29175   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
29176   {${if def:sender_ident \
29177   {from ${quote_local_part:$sender_ident} }}\
29178   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
29179   by $primary_hostname \
29180   ${if def:received_protocol {with $received_protocol}} \
29181   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
29182   (Exim $version_number)\n\t\
29183   ${if def:sender_address \
29184   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
29185   id $message_exim_id\
29186   ${if def:received_for {\n\tfor $received_for}}
29187 </literallayout>
29188 <para>
29189 The reference to the TLS cipher is omitted when Exim is built without TLS
29190 support. The use of conditional expansions ensures that this works for both
29191 locally generated messages and messages received from remote hosts, giving
29192 header lines such as the following:
29193 </para>
29194 <literallayout class="monospaced">
29195 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
29196 by marley.carol.example with esmtp (Exim 4.00)
29197 (envelope-from &lt;bob@carol.example&gt;)
29198 id 16IOWa-00019l-00
29199 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
29200 Received: by scrooge.carol.example with local (Exim 4.00)
29201 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
29202 </literallayout>
29203 <para>
29204 Until the body of the message has been received, the timestamp is the time when
29205 the message started to be received. Once the body has arrived, and all policy
29206 checks have taken place, the timestamp is updated to the time at which the
29207 message was accepted.
29208 </para>
29209 <para>
29210 <indexterm role="option">
29211 <primary><option>received_headers_max</option></primary>
29212 </indexterm>
29213 </para>
29214 <informaltable frame="all">
29215 <tgroup cols="4" colsep="0" rowsep="0">
29216 <colspec colwidth="8*" align="left"/>
29217 <colspec colwidth="6*" align="center"/>
29218 <colspec colwidth="6*" align="center"/>
29219 <colspec colwidth="6*" align="right"/>
29220 <tbody>
29221 <row>
29222 <entry><option>received_headers_max</option></entry>
29223 <entry>Use: <emphasis>main</emphasis></entry>
29224 <entry>Type: <emphasis>integer</emphasis></entry>
29225 <entry>Default: <emphasis>30</emphasis></entry>
29226 </row>
29227 </tbody>
29228 </tgroup>
29229 </informaltable>
29230 <para>
29231 <indexterm role="concept">
29232 <primary>loop</primary>
29233 <secondary>prevention</secondary>
29234 </indexterm>
29235 <indexterm role="concept">
29236 <primary>mail loop prevention</primary>
29237 </indexterm>
29238 <indexterm role="concept">
29239 <primary><emphasis>Received:</emphasis> header line</primary>
29240 <secondary>counting</secondary>
29241 </indexterm>
29242 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
29243 counted, and if it is greater than this parameter, a mail loop is assumed to
29244 have occurred, the delivery is abandoned, and an error message is generated.
29245 This applies to both local and remote deliveries.
29246 </para>
29247 <para>
29248 <indexterm role="option">
29249 <primary><option>recipient_unqualified_hosts</option></primary>
29250 </indexterm>
29251 </para>
29252 <informaltable frame="all">
29253 <tgroup cols="4" colsep="0" rowsep="0">
29254 <colspec colwidth="8*" align="left"/>
29255 <colspec colwidth="6*" align="center"/>
29256 <colspec colwidth="6*" align="center"/>
29257 <colspec colwidth="6*" align="right"/>
29258 <tbody>
29259 <row>
29260 <entry><option>recipient_unqualified_hosts</option></entry>
29261 <entry>Use: <emphasis>main</emphasis></entry>
29262 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29263 <entry>Default: <emphasis>unset</emphasis></entry>
29264 </row>
29265 </tbody>
29266 </tgroup>
29267 </informaltable>
29268 <para>
29269 <indexterm role="concept">
29270 <primary>unqualified addresses</primary>
29271 </indexterm>
29272 <indexterm role="concept">
29273 <primary>host</primary>
29274 <secondary>unqualified addresses from</secondary>
29275 </indexterm>
29276 This option lists those hosts from which Exim is prepared to accept unqualified
29277 recipient addresses in message envelopes. The addresses are made fully
29278 qualified by the addition of the <option>qualify_recipient</option> value. This option also
29279 affects message header lines. Exim does not reject unqualified recipient
29280 addresses in headers, but it qualifies them only if the message came from a
29281 host that matches <option>recipient_unqualified_hosts</option>,
29282 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
29283 option was not set.
29284 </para>
29285 <para>
29286 <indexterm role="option">
29287 <primary><option>recipients_max</option></primary>
29288 </indexterm>
29289 </para>
29290 <informaltable frame="all">
29291 <tgroup cols="4" colsep="0" rowsep="0">
29292 <colspec colwidth="8*" align="left"/>
29293 <colspec colwidth="6*" align="center"/>
29294 <colspec colwidth="6*" align="center"/>
29295 <colspec colwidth="6*" align="right"/>
29296 <tbody>
29297 <row>
29298 <entry><option>recipients_max</option></entry>
29299 <entry>Use: <emphasis>main</emphasis></entry>
29300 <entry>Type: <emphasis>integer</emphasis></entry>
29301 <entry>Default: <emphasis>0</emphasis></entry>
29302 </row>
29303 </tbody>
29304 </tgroup>
29305 </informaltable>
29306 <para>
29307 <indexterm role="concept">
29308 <primary>limit</primary>
29309 <secondary>number of recipients</secondary>
29310 </indexterm>
29311 <indexterm role="concept">
29312 <primary>recipient</primary>
29313 <secondary>maximum number</secondary>
29314 </indexterm>
29315 If this option is set greater than zero, it specifies the maximum number of
29316 original recipients for any message. Additional recipients that are generated
29317 by aliasing or forwarding do not count. SMTP messages get a 452 response for
29318 all recipients over the limit; earlier recipients are delivered as normal.
29319 Non-SMTP messages with too many recipients are failed, and no deliveries are
29320 done.
29321 </para>
29322 <para>
29323 <indexterm role="concept">
29324 <primary>RCPT</primary>
29325 <secondary>maximum number of incoming</secondary>
29326 </indexterm>
29327 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
29328 RCPT commands in a single message.
29329 </para>
29330 <para>
29331 <indexterm role="option">
29332 <primary><option>recipients_max_reject</option></primary>
29333 </indexterm>
29334 </para>
29335 <informaltable frame="all">
29336 <tgroup cols="4" colsep="0" rowsep="0">
29337 <colspec colwidth="8*" align="left"/>
29338 <colspec colwidth="6*" align="center"/>
29339 <colspec colwidth="6*" align="center"/>
29340 <colspec colwidth="6*" align="right"/>
29341 <tbody>
29342 <row>
29343 <entry><option>recipients_max_reject</option></entry>
29344 <entry>Use: <emphasis>main</emphasis></entry>
29345 <entry>Type: <emphasis>boolean</emphasis></entry>
29346 <entry>Default: <emphasis>false</emphasis></entry>
29347 </row>
29348 </tbody>
29349 </tgroup>
29350 </informaltable>
29351 <para>
29352 If this option is set true, Exim rejects SMTP messages containing too many
29353 recipients by giving 552 errors to the surplus RCPT commands, and a 554
29354 error to the eventual DATA command. Otherwise (the default) it gives a 452
29355 error to the surplus RCPT commands and accepts the message on behalf of the
29356 initial set of recipients. The remote server should then re-send the message
29357 for the remaining recipients at a later time.
29358 </para>
29359 <para>
29360 <indexterm role="option">
29361 <primary><option>remote_max_parallel</option></primary>
29362 </indexterm>
29363 </para>
29364 <informaltable frame="all">
29365 <tgroup cols="4" colsep="0" rowsep="0">
29366 <colspec colwidth="8*" align="left"/>
29367 <colspec colwidth="6*" align="center"/>
29368 <colspec colwidth="6*" align="center"/>
29369 <colspec colwidth="6*" align="right"/>
29370 <tbody>
29371 <row>
29372 <entry><option>remote_max_parallel</option></entry>
29373 <entry>Use: <emphasis>main</emphasis></entry>
29374 <entry>Type: <emphasis>integer</emphasis></entry>
29375 <entry>Default: <emphasis>2</emphasis></entry>
29376 </row>
29377 </tbody>
29378 </tgroup>
29379 </informaltable>
29380 <para>
29381 <indexterm role="concept">
29382 <primary>delivery</primary>
29383 <secondary>parallelism for remote</secondary>
29384 </indexterm>
29385 This option controls parallel delivery of one message to a number of remote
29386 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
29387 does all the remote deliveries for a message one by one. Otherwise, if a single
29388 message has to be delivered to more than one remote host, or if several copies
29389 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
29390 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
29391 deliveries are required, the maximum number of processes are started, and as
29392 each one finishes, another is begun. The order of starting processes is the
29393 same as if sequential delivery were being done, and can be controlled by the
29394 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
29395 with debugging turned on, the debugging output from each delivery process is
29396 tagged with its process id.
29397 </para>
29398 <para>
29399 This option controls only the maximum number of parallel deliveries for one
29400 message in one Exim delivery process. Because Exim has no central queue
29401 manager, there is no way of controlling the total number of simultaneous
29402 deliveries if the configuration allows a delivery attempt as soon as a message
29403 is received.
29404 </para>
29405 <para>
29406 <indexterm role="concept">
29407 <primary>number of deliveries</primary>
29408 </indexterm>
29409 <indexterm role="concept">
29410 <primary>delivery</primary>
29411 <secondary>maximum number of</secondary>
29412 </indexterm>
29413 If you want to control the total number of deliveries on the system, you
29414 need to set the <option>queue_only</option> option. This ensures that all incoming messages
29415 are added to the queue without starting a delivery process. Then set up an Exim
29416 daemon to start queue runner processes at appropriate intervals (probably
29417 fairly often, for example, every minute), and limit the total number of queue
29418 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
29419 delivers only one message at a time, the maximum number of deliveries that can
29420 then take place at once is <option>queue_run_max</option> multiplied by
29421 <option>remote_max_parallel</option>.
29422 </para>
29423 <para>
29424 If it is purely remote deliveries you want to control, use
29425 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
29426 doing the SMTP routing before queueing, so that several messages for the same
29427 host will eventually get delivered down the same connection.
29428 </para>
29429 <para>
29430 <indexterm role="option">
29431 <primary><option>remote_sort_domains</option></primary>
29432 </indexterm>
29433 </para>
29434 <informaltable frame="all">
29435 <tgroup cols="4" colsep="0" rowsep="0">
29436 <colspec colwidth="8*" align="left"/>
29437 <colspec colwidth="6*" align="center"/>
29438 <colspec colwidth="6*" align="center"/>
29439 <colspec colwidth="6*" align="right"/>
29440 <tbody>
29441 <row>
29442 <entry><option>remote_sort_domains</option></entry>
29443 <entry>Use: <emphasis>main</emphasis></entry>
29444 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29445 <entry>Default: <emphasis>unset</emphasis></entry>
29446 </row>
29447 </tbody>
29448 </tgroup>
29449 </informaltable>
29450 <para>
29451 <indexterm role="concept">
29452 <primary>sorting remote deliveries</primary>
29453 </indexterm>
29454 <indexterm role="concept">
29455 <primary>delivery</primary>
29456 <secondary>sorting remote</secondary>
29457 </indexterm>
29458 When there are a number of remote deliveries for a message, they are sorted by
29459 domain into the order given by this list. For example,
29460 </para>
29461 <literallayout class="monospaced">
29462 remote_sort_domains = *.cam.ac.uk:*.uk
29463 </literallayout>
29464 <para>
29465 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
29466 then to those in the <option>uk</option> domain, then to any others.
29467 </para>
29468 <para>
29469 <indexterm role="option">
29470 <primary><option>retry_data_expire</option></primary>
29471 </indexterm>
29472 </para>
29473 <informaltable frame="all">
29474 <tgroup cols="4" colsep="0" rowsep="0">
29475 <colspec colwidth="8*" align="left"/>
29476 <colspec colwidth="6*" align="center"/>
29477 <colspec colwidth="6*" align="center"/>
29478 <colspec colwidth="6*" align="right"/>
29479 <tbody>
29480 <row>
29481 <entry><option>retry_data_expire</option></entry>
29482 <entry>Use: <emphasis>main</emphasis></entry>
29483 <entry>Type: <emphasis>time</emphasis></entry>
29484 <entry>Default: <emphasis>7d</emphasis></entry>
29485 </row>
29486 </tbody>
29487 </tgroup>
29488 </informaltable>
29489 <para>
29490 <indexterm role="concept">
29491 <primary>hints database</primary>
29492 <secondary>data expiry</secondary>
29493 </indexterm>
29494 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
29495 database. Any older retry data is ignored. This means that, for example, once a
29496 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
29497 past failures.
29498 </para>
29499 <para>
29500 <indexterm role="option">
29501 <primary><option>retry_interval_max</option></primary>
29502 </indexterm>
29503 </para>
29504 <informaltable frame="all">
29505 <tgroup cols="4" colsep="0" rowsep="0">
29506 <colspec colwidth="8*" align="left"/>
29507 <colspec colwidth="6*" align="center"/>
29508 <colspec colwidth="6*" align="center"/>
29509 <colspec colwidth="6*" align="right"/>
29510 <tbody>
29511 <row>
29512 <entry><option>retry_interval_max</option></entry>
29513 <entry>Use: <emphasis>main</emphasis></entry>
29514 <entry>Type: <emphasis>time</emphasis></entry>
29515 <entry>Default: <emphasis>24h</emphasis></entry>
29516 </row>
29517 </tbody>
29518 </tgroup>
29519 </informaltable>
29520 <para>
29521 <indexterm role="concept">
29522 <primary>retry</primary>
29523 <secondary>limit on interval</secondary>
29524 </indexterm>
29525 <indexterm role="concept">
29526 <primary>limit</primary>
29527 <secondary>on retry interval</secondary>
29528 </indexterm>
29529 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
29530 intervals between delivery attempts for messages that cannot be delivered
29531 straight away. This option sets an overall limit to the length of time between
29532 retries. It cannot be set greater than 24 hours; any attempt to do so forces
29533 the default value.
29534 </para>
29535 <para>
29536 <indexterm role="option">
29537 <primary><option>return_path_remove</option></primary>
29538 </indexterm>
29539 </para>
29540 <informaltable frame="all">
29541 <tgroup cols="4" colsep="0" rowsep="0">
29542 <colspec colwidth="8*" align="left"/>
29543 <colspec colwidth="6*" align="center"/>
29544 <colspec colwidth="6*" align="center"/>
29545 <colspec colwidth="6*" align="right"/>
29546 <tbody>
29547 <row>
29548 <entry><option>return_path_remove</option></entry>
29549 <entry>Use: <emphasis>main</emphasis></entry>
29550 <entry>Type: <emphasis>boolean</emphasis></entry>
29551 <entry>Default: <emphasis>true</emphasis></entry>
29552 </row>
29553 </tbody>
29554 </tgroup>
29555 </informaltable>
29556 <para>
29557 <indexterm role="concept">
29558 <primary><emphasis>Return-path:</emphasis> header line</primary>
29559 <secondary>removing</secondary>
29560 </indexterm>
29561 RFC 2821, section 4.4, states that an SMTP server must insert a
29562 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
29563 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
29564 MAIL command. This description implies that this header should not be present
29565 in an incoming message. If <option>return_path_remove</option> is true, any existing
29566 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
29567 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
29568 the time of delivery. They are normally used only for final local deliveries.
29569 </para>
29570 <para>
29571 <indexterm role="option">
29572 <primary><option>return_size_limit</option></primary>
29573 </indexterm>
29574 </para>
29575 <informaltable frame="all">
29576 <tgroup cols="4" colsep="0" rowsep="0">
29577 <colspec colwidth="8*" align="left"/>
29578 <colspec colwidth="6*" align="center"/>
29579 <colspec colwidth="6*" align="center"/>
29580 <colspec colwidth="6*" align="right"/>
29581 <tbody>
29582 <row>
29583 <entry><option>return_size_limit</option></entry>
29584 <entry>Use: <emphasis>main</emphasis></entry>
29585 <entry>Type: <emphasis>integer</emphasis></entry>
29586 <entry>Default: <emphasis>100K</emphasis></entry>
29587 </row>
29588 </tbody>
29589 </tgroup>
29590 </informaltable>
29591 <para>
29592 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
29593 </para>
29594 <para>
29595 <indexterm role="option">
29596 <primary><option>rfc1413_hosts</option></primary>
29597 </indexterm>
29598 </para>
29599 <informaltable frame="all">
29600 <tgroup cols="4" colsep="0" rowsep="0">
29601 <colspec colwidth="8*" align="left"/>
29602 <colspec colwidth="6*" align="center"/>
29603 <colspec colwidth="6*" align="center"/>
29604 <colspec colwidth="6*" align="right"/>
29605 <tbody>
29606 <row>
29607 <entry><option>rfc1413_hosts</option></entry>
29608 <entry>Use: <emphasis>main</emphasis></entry>
29609 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29610 <entry>Default: <emphasis>@[]</emphasis></entry>
29611 </row>
29612 </tbody>
29613 </tgroup>
29614 </informaltable>
29615 <para>
29616 <indexterm role="concept">
29617 <primary>RFC 1413</primary>
29618 </indexterm>
29619 <indexterm role="concept">
29620 <primary>host</primary>
29621 <secondary>for RFC 1413 calls</secondary>
29622 </indexterm>
29623 RFC 1413 identification calls are made to any client host which matches
29624 an item in the list.
29625 The default value specifies just this host, being any local interface
29626 for the system.
29627 </para>
29628 <para>
29629 <indexterm role="option">
29630 <primary><option>rfc1413_query_timeout</option></primary>
29631 </indexterm>
29632 </para>
29633 <informaltable frame="all">
29634 <tgroup cols="4" colsep="0" rowsep="0">
29635 <colspec colwidth="8*" align="left"/>
29636 <colspec colwidth="6*" align="center"/>
29637 <colspec colwidth="6*" align="center"/>
29638 <colspec colwidth="6*" align="right"/>
29639 <tbody>
29640 <row>
29641 <entry><option>rfc1413_query_timeout</option></entry>
29642 <entry>Use: <emphasis>main</emphasis></entry>
29643 <entry>Type: <emphasis>time</emphasis></entry>
29644 <entry>Default: <emphasis>0s</emphasis></entry>
29645 </row>
29646 </tbody>
29647 </tgroup>
29648 </informaltable>
29649 <para>
29650 <indexterm role="concept">
29651 <primary>RFC 1413</primary>
29652 <secondary>query timeout</secondary>
29653 </indexterm>
29654 <indexterm role="concept">
29655 <primary>timeout</primary>
29656 <secondary>for RFC 1413 call</secondary>
29657 </indexterm>
29658 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
29659 no RFC 1413 calls are ever made.
29660 </para>
29661 <para>
29662 <indexterm role="option">
29663 <primary><option>sender_unqualified_hosts</option></primary>
29664 </indexterm>
29665 </para>
29666 <informaltable frame="all">
29667 <tgroup cols="4" colsep="0" rowsep="0">
29668 <colspec colwidth="8*" align="left"/>
29669 <colspec colwidth="6*" align="center"/>
29670 <colspec colwidth="6*" align="center"/>
29671 <colspec colwidth="6*" align="right"/>
29672 <tbody>
29673 <row>
29674 <entry><option>sender_unqualified_hosts</option></entry>
29675 <entry>Use: <emphasis>main</emphasis></entry>
29676 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29677 <entry>Default: <emphasis>unset</emphasis></entry>
29678 </row>
29679 </tbody>
29680 </tgroup>
29681 </informaltable>
29682 <para>
29683 <indexterm role="concept">
29684 <primary>unqualified addresses</primary>
29685 </indexterm>
29686 <indexterm role="concept">
29687 <primary>host</primary>
29688 <secondary>unqualified addresses from</secondary>
29689 </indexterm>
29690 This option lists those hosts from which Exim is prepared to accept unqualified
29691 sender addresses. The addresses are made fully qualified by the addition of
29692 <option>qualify_domain</option>. This option also affects message header lines. Exim does
29693 not reject unqualified addresses in headers that contain sender addresses, but
29694 it qualifies them only if the message came from a host that matches
29695 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
29696 using TCP/IP), and the <option>-bnq</option> option was not set.
29697 </para>
29698 <para>
29699 <indexterm role="option">
29700 <primary><option>set_environment</option></primary>
29701 </indexterm>
29702 </para>
29703 <informaltable frame="all">
29704 <tgroup cols="4" colsep="0" rowsep="0">
29705 <colspec colwidth="8*" align="left"/>
29706 <colspec colwidth="6*" align="center"/>
29707 <colspec colwidth="6*" align="center"/>
29708 <colspec colwidth="6*" align="right"/>
29709 <tbody>
29710 <row>
29711 <entry><option>set_environment</option></entry>
29712 <entry>Use: <emphasis>main</emphasis></entry>
29713 <entry>Type: <emphasis>string list</emphasis></entry>
29714 <entry>Default: <emphasis>empty</emphasis></entry>
29715 </row>
29716 </tbody>
29717 </tgroup>
29718 </informaltable>
29719 <para>
29720 <indexterm role="concept">
29721 <primary>environment</primary>
29722 </indexterm>
29723 This option allows to set individual environment variables that the
29724 currently linked libraries and programs in child processes use. The
29725 default list is empty,
29726 </para>
29727 <para>
29728 <indexterm role="option">
29729 <primary><option>slow_lookup_log</option></primary>
29730 </indexterm>
29731 </para>
29732 <informaltable frame="all">
29733 <tgroup cols="4" colsep="0" rowsep="0">
29734 <colspec colwidth="8*" align="left"/>
29735 <colspec colwidth="6*" align="center"/>
29736 <colspec colwidth="6*" align="center"/>
29737 <colspec colwidth="6*" align="right"/>
29738 <tbody>
29739 <row>
29740 <entry><option>slow_lookup_log</option></entry>
29741 <entry>Use: <emphasis>main</emphasis></entry>
29742 <entry>Type: <emphasis>integer</emphasis></entry>
29743 <entry>Default: <emphasis>0</emphasis></entry>
29744 </row>
29745 </tbody>
29746 </tgroup>
29747 </informaltable>
29748 <para>
29749 <indexterm role="concept">
29750 <primary>logging</primary>
29751 <secondary>slow lookups</secondary>
29752 </indexterm>
29753 <indexterm role="concept">
29754 <primary>dns</primary>
29755 <secondary>logging slow lookups</secondary>
29756 </indexterm>
29757 This option controls logging of slow lookups.
29758 If the value is nonzero it is taken as a number of milliseconds
29759 and lookups taking longer than this are logged.
29760 Currently this applies only to DNS lookups.
29761 </para>
29762 <para>
29763 <indexterm role="option">
29764 <primary><option>smtp_accept_keepalive</option></primary>
29765 </indexterm>
29766 </para>
29767 <informaltable frame="all">
29768 <tgroup cols="4" colsep="0" rowsep="0">
29769 <colspec colwidth="8*" align="left"/>
29770 <colspec colwidth="6*" align="center"/>
29771 <colspec colwidth="6*" align="center"/>
29772 <colspec colwidth="6*" align="right"/>
29773 <tbody>
29774 <row>
29775 <entry><option>smtp_accept_keepalive</option></entry>
29776 <entry>Use: <emphasis>main</emphasis></entry>
29777 <entry>Type: <emphasis>boolean</emphasis></entry>
29778 <entry>Default: <emphasis>true</emphasis></entry>
29779 </row>
29780 </tbody>
29781 </tgroup>
29782 </informaltable>
29783 <para>
29784 <indexterm role="concept">
29785 <primary>keepalive</primary>
29786 <secondary>on incoming connection</secondary>
29787 </indexterm>
29788 This option controls the setting of the SO_KEEPALIVE option on incoming
29789 TCP/IP socket connections. When set, it causes the kernel to probe idle
29790 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
29791 other end of the connection should send an acknowledgment if the connection is
29792 still okay or a reset if the connection has been aborted. The reason for doing
29793 this is that it has the beneficial effect of freeing up certain types of
29794 connection that can get stuck when the remote host is disconnected without
29795 tidying up the TCP/IP call properly. The keepalive mechanism takes several
29796 hours to detect unreachable hosts.
29797 </para>
29798 <para>
29799 <indexterm role="option">
29800 <primary><option>smtp_accept_max</option></primary>
29801 </indexterm>
29802 </para>
29803 <informaltable frame="all">
29804 <tgroup cols="4" colsep="0" rowsep="0">
29805 <colspec colwidth="8*" align="left"/>
29806 <colspec colwidth="6*" align="center"/>
29807 <colspec colwidth="6*" align="center"/>
29808 <colspec colwidth="6*" align="right"/>
29809 <tbody>
29810 <row>
29811 <entry><option>smtp_accept_max</option></entry>
29812 <entry>Use: <emphasis>main</emphasis></entry>
29813 <entry>Type: <emphasis>integer</emphasis></entry>
29814 <entry>Default: <emphasis>20</emphasis></entry>
29815 </row>
29816 </tbody>
29817 </tgroup>
29818 </informaltable>
29819 <para>
29820 <indexterm role="concept">
29821 <primary>limit</primary>
29822 <secondary>incoming SMTP connections</secondary>
29823 </indexterm>
29824 <indexterm role="concept">
29825 <primary>SMTP</primary>
29826 <secondary>incoming connection count</secondary>
29827 </indexterm>
29828 <indexterm role="concept">
29829 <primary>inetd</primary>
29830 </indexterm>
29831 This option specifies the maximum number of simultaneous incoming SMTP calls
29832 that Exim will accept. It applies only to the listening daemon; there is no
29833 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
29834 value is set to zero, no limit is applied. However, it is required to be
29835 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
29836 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
29837 </para>
29838 <para>
29839 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
29840 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
29841 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
29842 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
29843 </para>
29844 <para>
29845 <indexterm role="option">
29846 <primary><option>smtp_accept_max_nonmail</option></primary>
29847 </indexterm>
29848 </para>
29849 <informaltable frame="all">
29850 <tgroup cols="4" colsep="0" rowsep="0">
29851 <colspec colwidth="8*" align="left"/>
29852 <colspec colwidth="6*" align="center"/>
29853 <colspec colwidth="6*" align="center"/>
29854 <colspec colwidth="6*" align="right"/>
29855 <tbody>
29856 <row>
29857 <entry><option>smtp_accept_max_nonmail</option></entry>
29858 <entry>Use: <emphasis>main</emphasis></entry>
29859 <entry>Type: <emphasis>integer</emphasis></entry>
29860 <entry>Default: <emphasis>10</emphasis></entry>
29861 </row>
29862 </tbody>
29863 </tgroup>
29864 </informaltable>
29865 <para>
29866 <indexterm role="concept">
29867 <primary>limit</primary>
29868 <secondary>non-mail SMTP commands</secondary>
29869 </indexterm>
29870 <indexterm role="concept">
29871 <primary>SMTP</primary>
29872 <secondary>limiting non-mail commands</secondary>
29873 </indexterm>
29874 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
29875 the connection if there are too many. This option defines <quote>too many</quote>. The
29876 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
29877 client looping sending EHLO, for example. The check is applied only if the
29878 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
29879 </para>
29880 <para>
29881 When a new message is expected, one occurrence of RSET is not counted. This
29882 allows a client to send one RSET between messages (this is not necessary,
29883 but some clients do it). Exim also allows one uncounted occurrence of HELO
29884 or EHLO, and one occurrence of STARTTLS between messages. After
29885 starting up a TLS session, another EHLO is expected, and so it too is not
29886 counted. The first occurrence of AUTH in a connection, or immediately
29887 following STARTTLS is not counted. Otherwise, all commands other than
29888 MAIL, RCPT, DATA, and QUIT are counted.
29889 </para>
29890 <para>
29891 <indexterm role="option">
29892 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
29893 </indexterm>
29894 </para>
29895 <informaltable frame="all">
29896 <tgroup cols="4" colsep="0" rowsep="0">
29897 <colspec colwidth="8*" align="left"/>
29898 <colspec colwidth="6*" align="center"/>
29899 <colspec colwidth="6*" align="center"/>
29900 <colspec colwidth="6*" align="right"/>
29901 <tbody>
29902 <row>
29903 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
29904 <entry>Use: <emphasis>main</emphasis></entry>
29905 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29906 <entry>Default: <emphasis>*</emphasis></entry>
29907 </row>
29908 </tbody>
29909 </tgroup>
29910 </informaltable>
29911 <para>
29912 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
29913 check by setting this option. The default value makes it apply to all hosts. By
29914 changing the value, you can exclude any badly-behaved hosts that you have to
29915 live with.
29916 </para>
29917 <para>
29918 <indexterm role="option">
29919 <primary><option>smtp_accept_max_per_connection</option></primary>
29920 </indexterm>
29921 </para>
29922 <informaltable frame="all">
29923 <tgroup cols="4" colsep="0" rowsep="0">
29924 <colspec colwidth="8*" align="left"/>
29925 <colspec colwidth="6*" align="center"/>
29926 <colspec colwidth="6*" align="center"/>
29927 <colspec colwidth="6*" align="right"/>
29928 <tbody>
29929 <row>
29930 <entry><option>smtp_accept_max_per_connection</option></entry>
29931 <entry>Use: <emphasis>main</emphasis></entry>
29932 <entry>Type: <emphasis>integer</emphasis></entry>
29933 <entry>Default: <emphasis>1000</emphasis></entry>
29934 </row>
29935 </tbody>
29936 </tgroup>
29937 </informaltable>
29938 <para>
29939 <indexterm role="concept">
29940 <primary>SMTP</primary>
29941 <secondary>limiting incoming message count</secondary>
29942 </indexterm>
29943 <indexterm role="concept">
29944 <primary>limit</primary>
29945 <secondary>messages per SMTP connection</secondary>
29946 </indexterm>
29947 The value of this option limits the number of MAIL commands that Exim is
29948 prepared to accept over a single SMTP connection, whether or not each command
29949 results in the transfer of a message. After the limit is reached, a 421
29950 response is given to subsequent MAIL commands. This limit is a safety
29951 precaution against a client that goes mad (incidents of this type have been
29952 seen).
29953 </para>
29954 <para>
29955 <indexterm role="option">
29956 <primary><option>smtp_accept_max_per_host</option></primary>
29957 </indexterm>
29958 </para>
29959 <informaltable frame="all">
29960 <tgroup cols="4" colsep="0" rowsep="0">
29961 <colspec colwidth="8*" align="left"/>
29962 <colspec colwidth="6*" align="center"/>
29963 <colspec colwidth="6*" align="center"/>
29964 <colspec colwidth="6*" align="right"/>
29965 <tbody>
29966 <row>
29967 <entry><option>smtp_accept_max_per_host</option></entry>
29968 <entry>Use: <emphasis>main</emphasis></entry>
29969 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29970 <entry>Default: <emphasis>unset</emphasis></entry>
29971 </row>
29972 </tbody>
29973 </tgroup>
29974 </informaltable>
29975 <para>
29976 <indexterm role="concept">
29977 <primary>limit</primary>
29978 <secondary>SMTP connections from one host</secondary>
29979 </indexterm>
29980 <indexterm role="concept">
29981 <primary>host</primary>
29982 <secondary>limiting SMTP connections from</secondary>
29983 </indexterm>
29984 This option restricts the number of simultaneous IP connections from a single
29985 host (strictly, from a single IP address) to the Exim daemon. The option is
29986 expanded, to enable different limits to be applied to different hosts by
29987 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
29988 connection attempts from the same host are rejected with error code 421. This
29989 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
29990 of zero imposes no limit. If this option is set greater than zero, it is
29991 required that <option>smtp_accept_max</option> be non-zero.
29992 </para>
29993 <para>
29994 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
29995 constructions that take an appreciable amount of time. The expansion and test
29996 happen in the main daemon loop, in order to reject additional connections
29997 without forking additional processes (otherwise a denial-of-service attack
29998 could cause a vast number or processes to be created). While the daemon is
29999 doing this processing, it cannot accept any other incoming connections.
30000 </para>
30001 <para>
30002 <indexterm role="option">
30003 <primary><option>smtp_accept_queue</option></primary>
30004 </indexterm>
30005 </para>
30006 <informaltable frame="all">
30007 <tgroup cols="4" colsep="0" rowsep="0">
30008 <colspec colwidth="8*" align="left"/>
30009 <colspec colwidth="6*" align="center"/>
30010 <colspec colwidth="6*" align="center"/>
30011 <colspec colwidth="6*" align="right"/>
30012 <tbody>
30013 <row>
30014 <entry><option>smtp_accept_queue</option></entry>
30015 <entry>Use: <emphasis>main</emphasis></entry>
30016 <entry>Type: <emphasis>integer</emphasis></entry>
30017 <entry>Default: <emphasis>0</emphasis></entry>
30018 </row>
30019 </tbody>
30020 </tgroup>
30021 </informaltable>
30022 <para>
30023 <indexterm role="concept">
30024 <primary>SMTP</primary>
30025 <secondary>incoming connection count</secondary>
30026 </indexterm>
30027 <indexterm role="concept">
30028 <primary>queueing incoming messages</primary>
30029 </indexterm>
30030 <indexterm role="concept">
30031 <primary>message</primary>
30032 <secondary>queueing by SMTP connection count</secondary>
30033 </indexterm>
30034 If the number of simultaneous incoming SMTP connections being handled via the
30035 listening daemon exceeds this value, messages received by SMTP are just placed
30036 on the queue; no delivery processes are started automatically. The count is
30037 fixed at the start of an SMTP connection. It cannot be updated in the
30038 subprocess that receives messages, and so the queueing or not queueing applies
30039 to all messages received in the same connection.
30040 </para>
30041 <para>
30042 A value of zero implies no limit, and clearly any non-zero value is useful only
30043 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
30044 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
30045 various <option>-od</option><emphasis>x</emphasis> command line options.
30046 </para>
30047 <para>
30048 <indexterm role="option">
30049 <primary><option>smtp_accept_queue_per_connection</option></primary>
30050 </indexterm>
30051 </para>
30052 <informaltable frame="all">
30053 <tgroup cols="4" colsep="0" rowsep="0">
30054 <colspec colwidth="8*" align="left"/>
30055 <colspec colwidth="6*" align="center"/>
30056 <colspec colwidth="6*" align="center"/>
30057 <colspec colwidth="6*" align="right"/>
30058 <tbody>
30059 <row>
30060 <entry><option>smtp_accept_queue_per_connection</option></entry>
30061 <entry>Use: <emphasis>main</emphasis></entry>
30062 <entry>Type: <emphasis>integer</emphasis></entry>
30063 <entry>Default: <emphasis>10</emphasis></entry>
30064 </row>
30065 </tbody>
30066 </tgroup>
30067 </informaltable>
30068 <para>
30069 <indexterm role="concept">
30070 <primary>queueing incoming messages</primary>
30071 </indexterm>
30072 <indexterm role="concept">
30073 <primary>message</primary>
30074 <secondary>queueing by message count</secondary>
30075 </indexterm>
30076 This option limits the number of delivery processes that Exim starts
30077 automatically when receiving messages via SMTP, whether via the daemon or by
30078 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
30079 and the number of messages received in a single SMTP session exceeds this
30080 number, subsequent messages are placed on the queue, but no delivery processes
30081 are started. This helps to limit the number of Exim processes when a server
30082 restarts after downtime and there is a lot of mail waiting for it on other
30083 systems. On large systems, the default should probably be increased, and on
30084 dial-in client systems it should probably be set to zero (that is, disabled).
30085 </para>
30086 <para>
30087 <indexterm role="option">
30088 <primary><option>smtp_accept_reserve</option></primary>
30089 </indexterm>
30090 </para>
30091 <informaltable frame="all">
30092 <tgroup cols="4" colsep="0" rowsep="0">
30093 <colspec colwidth="8*" align="left"/>
30094 <colspec colwidth="6*" align="center"/>
30095 <colspec colwidth="6*" align="center"/>
30096 <colspec colwidth="6*" align="right"/>
30097 <tbody>
30098 <row>
30099 <entry><option>smtp_accept_reserve</option></entry>
30100 <entry>Use: <emphasis>main</emphasis></entry>
30101 <entry>Type: <emphasis>integer</emphasis></entry>
30102 <entry>Default: <emphasis>0</emphasis></entry>
30103 </row>
30104 </tbody>
30105 </tgroup>
30106 </informaltable>
30107 <para>
30108 <indexterm role="concept">
30109 <primary>SMTP</primary>
30110 <secondary>incoming call count</secondary>
30111 </indexterm>
30112 <indexterm role="concept">
30113 <primary>host</primary>
30114 <secondary>reserved</secondary>
30115 </indexterm>
30116 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
30117 number of SMTP connections that are reserved for connections from the hosts
30118 that are specified in <option>smtp_reserve_hosts</option>. The value set in
30119 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
30120 restricted to this number of connections; the option specifies a minimum number
30121 of connection slots for them, not a maximum. It is a guarantee that this group
30122 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
30123 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
30124 individual host.
30125 </para>
30126 <para>
30127 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
30128 set to 5, once there are 45 active connections (from any hosts), new
30129 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
30130 provided the other criteria for acceptance are met.
30131 </para>
30132 <para>
30133 <indexterm role="option">
30134 <primary><option>smtp_active_hostname</option></primary>
30135 </indexterm>
30136 </para>
30137 <informaltable frame="all">
30138 <tgroup cols="4" colsep="0" rowsep="0">
30139 <colspec colwidth="8*" align="left"/>
30140 <colspec colwidth="6*" align="center"/>
30141 <colspec colwidth="6*" align="center"/>
30142 <colspec colwidth="6*" align="right"/>
30143 <tbody>
30144 <row>
30145 <entry><option>smtp_active_hostname</option></entry>
30146 <entry>Use: <emphasis>main</emphasis></entry>
30147 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30148 <entry>Default: <emphasis>unset</emphasis></entry>
30149 </row>
30150 </tbody>
30151 </tgroup>
30152 </informaltable>
30153 <para>
30154 <indexterm role="concept">
30155 <primary>host</primary>
30156 <secondary>name in SMTP responses</secondary>
30157 </indexterm>
30158 <indexterm role="concept">
30159 <primary>SMTP</primary>
30160 <secondary>host name in responses</secondary>
30161 </indexterm>
30162 <indexterm role="variable">
30163 <primary><varname>$primary_hostname</varname></primary>
30164 </indexterm>
30165 This option is provided for multi-homed servers that want to masquerade as
30166 several different hosts. At the start of an incoming SMTP connection, its value
30167 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
30168 responses. For example, it is used as domain name in the response to an
30169 incoming HELO or EHLO command.
30170 </para>
30171 <para>
30172 <indexterm role="variable">
30173 <primary><varname>$smtp_active_hostname</varname></primary>
30174 </indexterm>
30175 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
30176 is saved with any messages that are received. It is therefore available for use
30177 in routers and transports when the message is later delivered.
30178 </para>
30179 <para>
30180 If this option is unset, or if its expansion is forced to fail, or if the
30181 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
30182 used. Other expansion failures cause a message to be written to the main and
30183 panic logs, and the SMTP command receives a temporary error. Typically, the
30184 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
30185 For example:
30186 </para>
30187 <literallayout class="monospaced">
30188 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
30189   {cox.mydomain}{box.mydomain}}
30190 </literallayout>
30191 <para>
30192 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
30193 messages, it is also used as the default for HELO commands in callout
30194 verification if there is no remote transport from which to obtain a
30195 <option>helo_data</option> value.
30196 </para>
30197 <para>
30198 <indexterm role="option">
30199 <primary><option>smtp_banner</option></primary>
30200 </indexterm>
30201 </para>
30202 <informaltable frame="all">
30203 <tgroup cols="4" colsep="0" rowsep="0">
30204 <colspec colwidth="8*" align="left"/>
30205 <colspec colwidth="6*" align="center"/>
30206 <colspec colwidth="6*" align="center"/>
30207 <colspec colwidth="6*" align="right"/>
30208 <tbody>
30209 <row>
30210 <entry><option>smtp_banner</option></entry>
30211 <entry>Use: <emphasis>main</emphasis></entry>
30212 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30213 <entry>Default: <emphasis>see below</emphasis></entry>
30214 </row>
30215 </tbody>
30216 </tgroup>
30217 </informaltable>
30218 <para>
30219 <indexterm role="concept">
30220 <primary>SMTP</primary>
30221 <secondary>welcome banner</secondary>
30222 </indexterm>
30223 <indexterm role="concept">
30224 <primary>banner for SMTP</primary>
30225 </indexterm>
30226 <indexterm role="concept">
30227 <primary>welcome banner for SMTP</primary>
30228 </indexterm>
30229 <indexterm role="concept">
30230 <primary>customizing</primary>
30231 <secondary>SMTP banner</secondary>
30232 </indexterm>
30233 This string, which is expanded every time it is used, is output as the initial
30234 positive response to an SMTP connection. The default setting is:
30235 </para>
30236 <literallayout class="monospaced">
30237 smtp_banner = $smtp_active_hostname ESMTP Exim \
30238   $version_number $tod_full
30239 </literallayout>
30240 <para>
30241 Failure to expand the string causes a panic error. If you want to create a
30242 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
30243 appropriate points, but not at the end. Note that the 220 code is not included
30244 in this string. Exim adds it automatically (several times in the case of a
30245 multiline response).
30246 </para>
30247 <para>
30248 <indexterm role="option">
30249 <primary><option>smtp_check_spool_space</option></primary>
30250 </indexterm>
30251 </para>
30252 <informaltable frame="all">
30253 <tgroup cols="4" colsep="0" rowsep="0">
30254 <colspec colwidth="8*" align="left"/>
30255 <colspec colwidth="6*" align="center"/>
30256 <colspec colwidth="6*" align="center"/>
30257 <colspec colwidth="6*" align="right"/>
30258 <tbody>
30259 <row>
30260 <entry><option>smtp_check_spool_space</option></entry>
30261 <entry>Use: <emphasis>main</emphasis></entry>
30262 <entry>Type: <emphasis>boolean</emphasis></entry>
30263 <entry>Default: <emphasis>true</emphasis></entry>
30264 </row>
30265 </tbody>
30266 </tgroup>
30267 </informaltable>
30268 <para>
30269 <indexterm role="concept">
30270 <primary>checking disk space</primary>
30271 </indexterm>
30272 <indexterm role="concept">
30273 <primary>disk space, checking</primary>
30274 </indexterm>
30275 <indexterm role="concept">
30276 <primary>spool directory</primary>
30277 <secondary>checking space</secondary>
30278 </indexterm>
30279 When this option is set, if an incoming SMTP session encounters the SIZE
30280 option on a MAIL command, it checks that there is enough space in the
30281 spool directory&#x2019;s partition to accept a message of that size, while still
30282 leaving free the amount specified by <option>check_spool_space</option> (even if that value
30283 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
30284 </para>
30285 <para>
30286 <indexterm role="option">
30287 <primary><option>smtp_connect_backlog</option></primary>
30288 </indexterm>
30289 </para>
30290 <informaltable frame="all">
30291 <tgroup cols="4" colsep="0" rowsep="0">
30292 <colspec colwidth="8*" align="left"/>
30293 <colspec colwidth="6*" align="center"/>
30294 <colspec colwidth="6*" align="center"/>
30295 <colspec colwidth="6*" align="right"/>
30296 <tbody>
30297 <row>
30298 <entry><option>smtp_connect_backlog</option></entry>
30299 <entry>Use: <emphasis>main</emphasis></entry>
30300 <entry>Type: <emphasis>integer</emphasis></entry>
30301 <entry>Default: <emphasis>20</emphasis></entry>
30302 </row>
30303 </tbody>
30304 </tgroup>
30305 </informaltable>
30306 <para>
30307 <indexterm role="concept">
30308 <primary>connection backlog</primary>
30309 </indexterm>
30310 <indexterm role="concept">
30311 <primary>SMTP</primary>
30312 <secondary>connection backlog</secondary>
30313 </indexterm>
30314 <indexterm role="concept">
30315 <primary>backlog of connections</primary>
30316 </indexterm>
30317 This option specifies a maximum number of waiting SMTP connections. Exim passes
30318 this value to the TCP/IP system when it sets up its listener. Once this number
30319 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
30320 attempts are refused at the TCP/IP level. At least, that is what the manuals
30321 say; in some circumstances such connection attempts have been observed to time
30322 out instead. For large systems it is probably a good idea to increase the
30323 value (to 50, say). It also gives some protection against denial-of-service
30324 attacks by SYN flooding.
30325 </para>
30326 <para>
30327 <indexterm role="option">
30328 <primary><option>smtp_enforce_sync</option></primary>
30329 </indexterm>
30330 </para>
30331 <informaltable frame="all">
30332 <tgroup cols="4" colsep="0" rowsep="0">
30333 <colspec colwidth="8*" align="left"/>
30334 <colspec colwidth="6*" align="center"/>
30335 <colspec colwidth="6*" align="center"/>
30336 <colspec colwidth="6*" align="right"/>
30337 <tbody>
30338 <row>
30339 <entry><option>smtp_enforce_sync</option></entry>
30340 <entry>Use: <emphasis>main</emphasis></entry>
30341 <entry>Type: <emphasis>boolean</emphasis></entry>
30342 <entry>Default: <emphasis>true</emphasis></entry>
30343 </row>
30344 </tbody>
30345 </tgroup>
30346 </informaltable>
30347 <para>
30348 <indexterm role="concept">
30349 <primary>SMTP</primary>
30350 <secondary>synchronization checking</secondary>
30351 </indexterm>
30352 <indexterm role="concept">
30353 <primary>synchronization checking in SMTP</primary>
30354 </indexterm>
30355 The SMTP protocol specification requires the client to wait for a response from
30356 the server at certain points in the dialogue. Without PIPELINING these
30357 synchronization points are after every command; with PIPELINING they are
30358 fewer, but they still exist.
30359 </para>
30360 <para>
30361 Some spamming sites send out a complete set of SMTP commands without waiting
30362 for any response. Exim protects against this by rejecting a message if the
30363 client has sent further input when it should not have. The error response <quote>554
30364 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
30365 for this error cannot be perfect because of transmission delays (unexpected
30366 input may be on its way but not yet received when Exim checks). However, it
30367 does detect many instances.
30368 </para>
30369 <para>
30370 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
30371 If you want to disable the check selectively (for example, only for certain
30372 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
30373 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
30374 </para>
30375 <para>
30376 <indexterm role="option">
30377 <primary><option>smtp_etrn_command</option></primary>
30378 </indexterm>
30379 </para>
30380 <informaltable frame="all">
30381 <tgroup cols="4" colsep="0" rowsep="0">
30382 <colspec colwidth="8*" align="left"/>
30383 <colspec colwidth="6*" align="center"/>
30384 <colspec colwidth="6*" align="center"/>
30385 <colspec colwidth="6*" align="right"/>
30386 <tbody>
30387 <row>
30388 <entry><option>smtp_etrn_command</option></entry>
30389 <entry>Use: <emphasis>main</emphasis></entry>
30390 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30391 <entry>Default: <emphasis>unset</emphasis></entry>
30392 </row>
30393 </tbody>
30394 </tgroup>
30395 </informaltable>
30396 <para>
30397 <indexterm role="concept">
30398 <primary>ETRN</primary>
30399 <secondary>command to be run</secondary>
30400 </indexterm>
30401 <indexterm role="variable">
30402 <primary><varname>$domain</varname></primary>
30403 </indexterm>
30404 If this option is set, the given command is run whenever an SMTP ETRN
30405 command is received from a host that is permitted to issue such commands (see
30406 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
30407 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
30408 argument of the ETRN command, and no syntax checking is done on it. For
30409 example:
30410 </para>
30411 <literallayout class="monospaced">
30412 smtp_etrn_command = /etc/etrn_command $domain \
30413                     $sender_host_address
30414 </literallayout>
30415 <para>
30416 A new process is created to run the command, but Exim does not wait for it to
30417 complete. Consequently, its status cannot be checked. If the command cannot be
30418 run, a line is written to the panic log, but the ETRN caller still receives
30419 a 250 success response. Exim is normally running under its own uid when
30420 receiving SMTP, so it is not possible for it to change the uid before running
30421 the command.
30422 </para>
30423 <para>
30424 <indexterm role="option">
30425 <primary><option>smtp_etrn_serialize</option></primary>
30426 </indexterm>
30427 </para>
30428 <informaltable frame="all">
30429 <tgroup cols="4" colsep="0" rowsep="0">
30430 <colspec colwidth="8*" align="left"/>
30431 <colspec colwidth="6*" align="center"/>
30432 <colspec colwidth="6*" align="center"/>
30433 <colspec colwidth="6*" align="right"/>
30434 <tbody>
30435 <row>
30436 <entry><option>smtp_etrn_serialize</option></entry>
30437 <entry>Use: <emphasis>main</emphasis></entry>
30438 <entry>Type: <emphasis>boolean</emphasis></entry>
30439 <entry>Default: <emphasis>true</emphasis></entry>
30440 </row>
30441 </tbody>
30442 </tgroup>
30443 </informaltable>
30444 <para>
30445 <indexterm role="concept">
30446 <primary>ETRN</primary>
30447 <secondary>serializing</secondary>
30448 </indexterm>
30449 When this option is set, it prevents the simultaneous execution of more than
30450 one identical command as a result of ETRN in an SMTP connection. See
30451 section <xref linkend="SECTETRN"/> for details.
30452 </para>
30453 <para>
30454 <indexterm role="option">
30455 <primary><option>smtp_load_reserve</option></primary>
30456 </indexterm>
30457 </para>
30458 <informaltable frame="all">
30459 <tgroup cols="4" colsep="0" rowsep="0">
30460 <colspec colwidth="8*" align="left"/>
30461 <colspec colwidth="6*" align="center"/>
30462 <colspec colwidth="6*" align="center"/>
30463 <colspec colwidth="6*" align="right"/>
30464 <tbody>
30465 <row>
30466 <entry><option>smtp_load_reserve</option></entry>
30467 <entry>Use: <emphasis>main</emphasis></entry>
30468 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30469 <entry>Default: <emphasis>unset</emphasis></entry>
30470 </row>
30471 </tbody>
30472 </tgroup>
30473 </informaltable>
30474 <para>
30475 <indexterm role="concept">
30476 <primary>load average</primary>
30477 </indexterm>
30478 If the system load average ever gets higher than this, incoming SMTP calls are
30479 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
30480 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
30481 the load is over the limit. The option has no effect on ancient operating
30482 systems on which Exim cannot determine the load average. See also
30483 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
30484 </para>
30485 <para>
30486 <indexterm role="option">
30487 <primary><option>smtp_max_synprot_errors</option></primary>
30488 </indexterm>
30489 </para>
30490 <informaltable frame="all">
30491 <tgroup cols="4" colsep="0" rowsep="0">
30492 <colspec colwidth="8*" align="left"/>
30493 <colspec colwidth="6*" align="center"/>
30494 <colspec colwidth="6*" align="center"/>
30495 <colspec colwidth="6*" align="right"/>
30496 <tbody>
30497 <row>
30498 <entry><option>smtp_max_synprot_errors</option></entry>
30499 <entry>Use: <emphasis>main</emphasis></entry>
30500 <entry>Type: <emphasis>integer</emphasis></entry>
30501 <entry>Default: <emphasis>3</emphasis></entry>
30502 </row>
30503 </tbody>
30504 </tgroup>
30505 </informaltable>
30506 <para>
30507 <indexterm role="concept">
30508 <primary>SMTP</primary>
30509 <secondary>limiting syntax and protocol errors</secondary>
30510 </indexterm>
30511 <indexterm role="concept">
30512 <primary>limit</primary>
30513 <secondary>SMTP syntax and protocol errors</secondary>
30514 </indexterm>
30515 Exim rejects SMTP commands that contain syntax or protocol errors. In
30516 particular, a syntactically invalid email address, as in this command:
30517 </para>
30518 <literallayout class="monospaced">
30519 RCPT TO:&lt;abc xyz@a.b.c&gt;
30520 </literallayout>
30521 <para>
30522 causes immediate rejection of the command, before any other tests are done.
30523 (The ACL cannot be run if there is no valid address to set up for it.) An
30524 example of a protocol error is receiving RCPT before MAIL. If there are
30525 too many syntax or protocol errors in one SMTP session, the connection is
30526 dropped. The limit is set by this option.
30527 </para>
30528 <para>
30529 <indexterm role="concept">
30530 <primary>PIPELINING</primary>
30531 <secondary>expected errors</secondary>
30532 </indexterm>
30533 When the PIPELINING extension to SMTP is in use, some protocol errors are
30534 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
30535 Exim assumes that PIPELINING will be used if it advertises it (see
30536 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
30537 not count towards the limit.
30538 </para>
30539 <para>
30540 <indexterm role="option">
30541 <primary><option>smtp_max_unknown_commands</option></primary>
30542 </indexterm>
30543 </para>
30544 <informaltable frame="all">
30545 <tgroup cols="4" colsep="0" rowsep="0">
30546 <colspec colwidth="8*" align="left"/>
30547 <colspec colwidth="6*" align="center"/>
30548 <colspec colwidth="6*" align="center"/>
30549 <colspec colwidth="6*" align="right"/>
30550 <tbody>
30551 <row>
30552 <entry><option>smtp_max_unknown_commands</option></entry>
30553 <entry>Use: <emphasis>main</emphasis></entry>
30554 <entry>Type: <emphasis>integer</emphasis></entry>
30555 <entry>Default: <emphasis>3</emphasis></entry>
30556 </row>
30557 </tbody>
30558 </tgroup>
30559 </informaltable>
30560 <para>
30561 <indexterm role="concept">
30562 <primary>SMTP</primary>
30563 <secondary>limiting unknown commands</secondary>
30564 </indexterm>
30565 <indexterm role="concept">
30566 <primary>limit</primary>
30567 <secondary>unknown SMTP commands</secondary>
30568 </indexterm>
30569 If there are too many unrecognized commands in an incoming SMTP session, an
30570 Exim server drops the connection. This is a defence against some kinds of abuse
30571 that subvert web
30572 clients
30573 into making connections to SMTP ports; in these circumstances, a number of
30574 non-SMTP command lines are sent first.
30575 </para>
30576 <para>
30577 <indexterm role="option">
30578 <primary><option>smtp_ratelimit_hosts</option></primary>
30579 </indexterm>
30580 </para>
30581 <informaltable frame="all">
30582 <tgroup cols="4" colsep="0" rowsep="0">
30583 <colspec colwidth="8*" align="left"/>
30584 <colspec colwidth="6*" align="center"/>
30585 <colspec colwidth="6*" align="center"/>
30586 <colspec colwidth="6*" align="right"/>
30587 <tbody>
30588 <row>
30589 <entry><option>smtp_ratelimit_hosts</option></entry>
30590 <entry>Use: <emphasis>main</emphasis></entry>
30591 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30592 <entry>Default: <emphasis>unset</emphasis></entry>
30593 </row>
30594 </tbody>
30595 </tgroup>
30596 </informaltable>
30597 <para>
30598 <indexterm role="concept">
30599 <primary>SMTP</primary>
30600 <secondary>rate limiting</secondary>
30601 </indexterm>
30602 <indexterm role="concept">
30603 <primary>limit</primary>
30604 <secondary>rate of message arrival</secondary>
30605 </indexterm>
30606 <indexterm role="concept">
30607 <primary>RCPT</primary>
30608 <secondary>rate limiting</secondary>
30609 </indexterm>
30610 Some sites find it helpful to be able to limit the rate at which certain hosts
30611 can send them messages, and the rate at which an individual message can specify
30612 recipients.
30613 </para>
30614 <para>
30615 Exim has two rate-limiting facilities. This section describes the older
30616 facility, which can limit rates within a single connection. The newer
30617 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
30618 <xref linkend="SECTratelimiting"/> for details of the newer facility.
30619 </para>
30620 <para>
30621 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
30622 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
30623 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
30624 respectively. Each option, if set, must contain a set of four comma-separated
30625 values:
30626 </para>
30627 <itemizedlist>
30628 <listitem>
30629 <para>
30630 A threshold, before which there is no rate limiting.
30631 </para>
30632 </listitem>
30633 <listitem>
30634 <para>
30635 An initial time delay. Unlike other times in Exim, numbers with decimal
30636 fractional parts are allowed here.
30637 </para>
30638 </listitem>
30639 <listitem>
30640 <para>
30641 A factor by which to increase the delay each time.
30642 </para>
30643 </listitem>
30644 <listitem>
30645 <para>
30646 A maximum value for the delay. This should normally be less than 5 minutes,
30647 because after that time, the client is liable to timeout the SMTP command.
30648 </para>
30649 </listitem>
30650 </itemizedlist>
30651 <para>
30652 For example, these settings have been used successfully at the site which
30653 first suggested this feature, for controlling mail from their customers:
30654 </para>
30655 <literallayout class="monospaced">
30656 smtp_ratelimit_mail = 2,0.5s,1.05,4m
30657 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
30658 </literallayout>
30659 <para>
30660 The first setting specifies delays that are applied to MAIL commands after
30661 two have been received over a single connection. The initial delay is 0.5
30662 seconds, increasing by a factor of 1.05 each time. The second setting applies
30663 delays to RCPT commands when more than four occur in a single message.
30664 </para>
30665 <para>
30666 <indexterm role="option">
30667 <primary><option>smtp_ratelimit_mail</option></primary>
30668 </indexterm>
30669 </para>
30670 <informaltable frame="all">
30671 <tgroup cols="4" colsep="0" rowsep="0">
30672 <colspec colwidth="8*" align="left"/>
30673 <colspec colwidth="6*" align="center"/>
30674 <colspec colwidth="6*" align="center"/>
30675 <colspec colwidth="6*" align="right"/>
30676 <tbody>
30677 <row>
30678 <entry><option>smtp_ratelimit_mail</option></entry>
30679 <entry>Use: <emphasis>main</emphasis></entry>
30680 <entry>Type: <emphasis>string</emphasis></entry>
30681 <entry>Default: <emphasis>unset</emphasis></entry>
30682 </row>
30683 </tbody>
30684 </tgroup>
30685 </informaltable>
30686 <para>
30687 See <option>smtp_ratelimit_hosts</option> above.
30688 </para>
30689 <para>
30690 <indexterm role="option">
30691 <primary><option>smtp_ratelimit_rcpt</option></primary>
30692 </indexterm>
30693 </para>
30694 <informaltable frame="all">
30695 <tgroup cols="4" colsep="0" rowsep="0">
30696 <colspec colwidth="8*" align="left"/>
30697 <colspec colwidth="6*" align="center"/>
30698 <colspec colwidth="6*" align="center"/>
30699 <colspec colwidth="6*" align="right"/>
30700 <tbody>
30701 <row>
30702 <entry><option>smtp_ratelimit_rcpt</option></entry>
30703 <entry>Use: <emphasis>main</emphasis></entry>
30704 <entry>Type: <emphasis>string</emphasis></entry>
30705 <entry>Default: <emphasis>unset</emphasis></entry>
30706 </row>
30707 </tbody>
30708 </tgroup>
30709 </informaltable>
30710 <para>
30711 See <option>smtp_ratelimit_hosts</option> above.
30712 </para>
30713 <para>
30714 <indexterm role="option">
30715 <primary><option>smtp_receive_timeout</option></primary>
30716 </indexterm>
30717 </para>
30718 <informaltable frame="all">
30719 <tgroup cols="4" colsep="0" rowsep="0">
30720 <colspec colwidth="8*" align="left"/>
30721 <colspec colwidth="6*" align="center"/>
30722 <colspec colwidth="6*" align="center"/>
30723 <colspec colwidth="6*" align="right"/>
30724 <tbody>
30725 <row>
30726 <entry><option>smtp_receive_timeout</option></entry>
30727 <entry>Use: <emphasis>main</emphasis></entry>
30728 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
30729 <entry>Default: <emphasis>5m</emphasis></entry>
30730 </row>
30731 </tbody>
30732 </tgroup>
30733 </informaltable>
30734 <para>
30735 <indexterm role="concept">
30736 <primary>timeout</primary>
30737 <secondary>for SMTP input</secondary>
30738 </indexterm>
30739 <indexterm role="concept">
30740 <primary>SMTP</primary>
30741 <secondary>input timeout</secondary>
30742 </indexterm>
30743 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
30744 input, including batch SMTP. If a line of input (either an SMTP command or a
30745 data line) is not received within this time, the SMTP connection is dropped and
30746 the message is abandoned.
30747 A line is written to the log containing one of the following messages:
30748 </para>
30749 <literallayout class="monospaced">
30750 SMTP command timeout on connection from...
30751 SMTP data timeout on connection from...
30752 </literallayout>
30753 <para>
30754 The former means that Exim was expecting to read an SMTP command; the latter
30755 means that it was in the DATA phase, reading the contents of a message.
30756 </para>
30757 <para>
30758 If the first character of the option is a <quote>$</quote> the option is
30759 expanded before use and may depend on
30760 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
30761 </para>
30762 <para>
30763 <indexterm role="option">
30764 <primary><option>-os</option></primary>
30765 </indexterm>
30766 The value set by this option can be overridden by the
30767 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
30768 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
30769 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
30770 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
30771 </para>
30772 <para>
30773 <indexterm role="option">
30774 <primary><option>smtp_reserve_hosts</option></primary>
30775 </indexterm>
30776 </para>
30777 <informaltable frame="all">
30778 <tgroup cols="4" colsep="0" rowsep="0">
30779 <colspec colwidth="8*" align="left"/>
30780 <colspec colwidth="6*" align="center"/>
30781 <colspec colwidth="6*" align="center"/>
30782 <colspec colwidth="6*" align="right"/>
30783 <tbody>
30784 <row>
30785 <entry><option>smtp_reserve_hosts</option></entry>
30786 <entry>Use: <emphasis>main</emphasis></entry>
30787 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30788 <entry>Default: <emphasis>unset</emphasis></entry>
30789 </row>
30790 </tbody>
30791 </tgroup>
30792 </informaltable>
30793 <para>
30794 This option defines hosts for which SMTP connections are reserved; see
30795 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
30796 </para>
30797 <para>
30798 <indexterm role="option">
30799 <primary><option>smtp_return_error_details</option></primary>
30800 </indexterm>
30801 </para>
30802 <informaltable frame="all">
30803 <tgroup cols="4" colsep="0" rowsep="0">
30804 <colspec colwidth="8*" align="left"/>
30805 <colspec colwidth="6*" align="center"/>
30806 <colspec colwidth="6*" align="center"/>
30807 <colspec colwidth="6*" align="right"/>
30808 <tbody>
30809 <row>
30810 <entry><option>smtp_return_error_details</option></entry>
30811 <entry>Use: <emphasis>main</emphasis></entry>
30812 <entry>Type: <emphasis>boolean</emphasis></entry>
30813 <entry>Default: <emphasis>false</emphasis></entry>
30814 </row>
30815 </tbody>
30816 </tgroup>
30817 </informaltable>
30818 <para>
30819 <indexterm role="concept">
30820 <primary>SMTP</primary>
30821 <secondary>details policy failures</secondary>
30822 </indexterm>
30823 <indexterm role="concept">
30824 <primary>policy control</primary>
30825 <secondary>rejection, returning details</secondary>
30826 </indexterm>
30827 In the default state, Exim uses bland messages such as
30828 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
30829 reasons. Many sysadmins like this because it gives away little information
30830 to spammers. However, some other sysadmins who are applying strict checking
30831 policies want to give out much fuller information about failures. Setting
30832 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
30833 example, instead of <quote>Administrative prohibition</quote>, it might give:
30834 </para>
30835 <literallayout class="monospaced">
30836 550-Rejected after DATA: '&gt;' missing at end of address:
30837 550 failing address in "From" header is: &lt;user@dom.ain
30838 </literallayout>
30839 <para>
30840 <indexterm role="option">
30841 <primary><option>smtputf8_advertise_hosts</option></primary>
30842 </indexterm>
30843 </para>
30844 <informaltable frame="all">
30845 <tgroup cols="4" colsep="0" rowsep="0">
30846 <colspec colwidth="8*" align="left"/>
30847 <colspec colwidth="6*" align="center"/>
30848 <colspec colwidth="6*" align="center"/>
30849 <colspec colwidth="6*" align="right"/>
30850 <tbody>
30851 <row>
30852 <entry><option>smtputf8_advertise_hosts</option></entry>
30853 <entry>Use: <emphasis>main</emphasis></entry>
30854 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30855 <entry>Default: <emphasis>*</emphasis></entry>
30856 </row>
30857 </tbody>
30858 </tgroup>
30859 </informaltable>
30860 <para>
30861 <indexterm role="concept">
30862 <primary>SMTPUTF8</primary>
30863 <secondary>advertising</secondary>
30864 </indexterm>
30865 When Exim is built with support for internationalised mail names,
30866 the availability thereof is advertised in
30867 response to EHLO only to those client hosts that match this option. See
30868 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
30869 </para>
30870 <para>
30871 <indexterm role="option">
30872 <primary><option>spamd_address</option></primary>
30873 </indexterm>
30874 </para>
30875 <informaltable frame="all">
30876 <tgroup cols="4" colsep="0" rowsep="0">
30877 <colspec colwidth="8*" align="left"/>
30878 <colspec colwidth="6*" align="center"/>
30879 <colspec colwidth="6*" align="center"/>
30880 <colspec colwidth="6*" align="right"/>
30881 <tbody>
30882 <row>
30883 <entry><option>spamd_address</option></entry>
30884 <entry>Use: <emphasis>main</emphasis></entry>
30885 <entry>Type: <emphasis>string</emphasis></entry>
30886 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
30887 </row>
30888 </tbody>
30889 </tgroup>
30890 </informaltable>
30891 <para>
30892 This option is available when Exim is compiled with the content-scanning
30893 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
30894 See section <xref linkend="SECTscanspamass"/> for more details.
30895 </para>
30896 <para revisionflag="changed">
30897 <indexterm role="option">
30898 <primary><option>spf_guess</option></primary>
30899 </indexterm>
30900 </para>
30901 <informaltable frame="all" revisionflag="changed">
30902 <tgroup cols="4" colsep="0" rowsep="0">
30903 <colspec colwidth="8*" align="left"/>
30904 <colspec colwidth="6*" align="center"/>
30905 <colspec colwidth="6*" align="center"/>
30906 <colspec colwidth="6*" align="right"/>
30907 <tbody>
30908 <row>
30909 <entry><option>spf_guess</option></entry>
30910 <entry>Use: <emphasis>main</emphasis></entry>
30911 <entry>Type: <emphasis>string</emphasis></entry>
30912 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
30913 </row>
30914 </tbody>
30915 </tgroup>
30916 </informaltable>
30917 <para revisionflag="changed">
30918 This option is available when Exim is compiled with SPF support.
30919 See section <xref linkend="SECSPF"/> for more details.
30920 </para>
30921 <para>
30922 <indexterm role="option">
30923 <primary><option>split_spool_directory</option></primary>
30924 </indexterm>
30925 </para>
30926 <informaltable frame="all">
30927 <tgroup cols="4" colsep="0" rowsep="0">
30928 <colspec colwidth="8*" align="left"/>
30929 <colspec colwidth="6*" align="center"/>
30930 <colspec colwidth="6*" align="center"/>
30931 <colspec colwidth="6*" align="right"/>
30932 <tbody>
30933 <row>
30934 <entry><option>split_spool_directory</option></entry>
30935 <entry>Use: <emphasis>main</emphasis></entry>
30936 <entry>Type: <emphasis>boolean</emphasis></entry>
30937 <entry>Default: <emphasis>false</emphasis></entry>
30938 </row>
30939 </tbody>
30940 </tgroup>
30941 </informaltable>
30942 <para>
30943 <indexterm role="concept">
30944 <primary>multiple spool directories</primary>
30945 </indexterm>
30946 <indexterm role="concept">
30947 <primary>spool directory</primary>
30948 <secondary>split</secondary>
30949 </indexterm>
30950 <indexterm role="concept">
30951 <primary>directories, multiple</primary>
30952 </indexterm>
30953 If this option is set, it causes Exim to split its input directory into 62
30954 subdirectories, each with a single alphanumeric character as its name. The
30955 sixth character of the message id is used to allocate messages to
30956 subdirectories; this is the least significant base-62 digit of the time of
30957 arrival of the message.
30958 </para>
30959 <para>
30960 Splitting up the spool in this way may provide better performance on systems
30961 where there are long mail queues, by reducing the number of files in any one
30962 directory. The msglog directory is also split up in a similar way to the input
30963 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
30964 are still placed in the single directory <filename>msglog.OLD</filename>.
30965 </para>
30966 <para>
30967 It is not necessary to take any special action for existing messages when
30968 changing <option>split_spool_directory</option>. Exim notices messages that are in the
30969 <quote>wrong</quote> place, and continues to process them. If the option is turned off
30970 after a period of being on, the subdirectories will eventually empty and be
30971 automatically deleted.
30972 </para>
30973 <para>
30974 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
30975 changes. Instead of creating a list of all messages in the queue, and then
30976 trying to deliver each one in turn, it constructs a list of those in one
30977 sub-directory and tries to deliver them, before moving on to the next
30978 sub-directory. The sub-directories are processed in a random order. This
30979 spreads out the scanning of the input directories, and uses less memory. It is
30980 particularly beneficial when there are lots of messages on the queue. However,
30981 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
30982 entire queue has to be scanned and sorted before any deliveries can start.
30983 </para>
30984 <para>
30985 <indexterm role="option">
30986 <primary><option>spool_directory</option></primary>
30987 </indexterm>
30988 </para>
30989 <informaltable frame="all">
30990 <tgroup cols="4" colsep="0" rowsep="0">
30991 <colspec colwidth="8*" align="left"/>
30992 <colspec colwidth="6*" align="center"/>
30993 <colspec colwidth="6*" align="center"/>
30994 <colspec colwidth="6*" align="right"/>
30995 <tbody>
30996 <row>
30997 <entry><option>spool_directory</option></entry>
30998 <entry>Use: <emphasis>main</emphasis></entry>
30999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31000 <entry>Default: <emphasis>set at compile time</emphasis></entry>
31001 </row>
31002 </tbody>
31003 </tgroup>
31004 </informaltable>
31005 <para>
31006 <indexterm role="concept">
31007 <primary>spool directory</primary>
31008 <secondary>path to</secondary>
31009 </indexterm>
31010 This defines the directory in which Exim keeps its spool, that is, the messages
31011 it is waiting to deliver. The default value is taken from the compile-time
31012 configuration setting, if there is one. If not, this option must be set. The
31013 string is expanded, so it can contain, for example, a reference to
31014 <varname>$primary_hostname</varname>.
31015 </para>
31016 <para>
31017 If the spool directory name is fixed on your installation, it is recommended
31018 that you set it at build time rather than from this option, particularly if the
31019 log files are being written to the spool directory (see <option>log_file_path</option>).
31020 Otherwise log files cannot be used for errors that are detected early on, such
31021 as failures in the configuration file.
31022 </para>
31023 <para>
31024 By using this option to override the compiled-in path, it is possible to run
31025 tests of Exim without using the standard spool.
31026 </para>
31027 <para>
31028 <indexterm role="option">
31029 <primary><option>spool_wireformat</option></primary>
31030 </indexterm>
31031 </para>
31032 <informaltable frame="all">
31033 <tgroup cols="4" colsep="0" rowsep="0">
31034 <colspec colwidth="8*" align="left"/>
31035 <colspec colwidth="6*" align="center"/>
31036 <colspec colwidth="6*" align="center"/>
31037 <colspec colwidth="6*" align="right"/>
31038 <tbody>
31039 <row>
31040 <entry><option>spool_wireformat</option></entry>
31041 <entry>Use: <emphasis>main</emphasis></entry>
31042 <entry>Type: <emphasis>boolean</emphasis></entry>
31043 <entry>Default: <emphasis>false</emphasis></entry>
31044 </row>
31045 </tbody>
31046 </tgroup>
31047 </informaltable>
31048 <para>
31049 <indexterm role="concept">
31050 <primary>spool directory</primary>
31051 <secondary>file formats</secondary>
31052 </indexterm>
31053 If this option is set, Exim may for some messages use an alternative format
31054 for data-files in the spool which matches the wire format.
31055 Doing this permits more efficient message reception and transmission.
31056 Currently it is only done for messages received using the ESMTP CHUNKING
31057 option.
31058 </para>
31059 <para>
31060 The following variables will not have useful values:
31061 </para>
31062 <literallayout class="monospaced">
31063 $max_received_linelength
31064 $body_linecount
31065 $body_zerocount
31066 </literallayout>
31067 <para>
31068 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
31069 and any external programs which are passed a reference to a message data file
31070 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
31071 will need to be aware of the different formats potentially available.
31072 </para>
31073 <para>
31074 Using any of the ACL conditions noted will negate the reception benefit
31075 (as a Unix-mbox-format file is constructed for them).
31076 The transmission benefit is maintained.
31077 </para>
31078 <para>
31079 <indexterm role="option">
31080 <primary><option>sqlite_lock_timeout</option></primary>
31081 </indexterm>
31082 </para>
31083 <informaltable frame="all">
31084 <tgroup cols="4" colsep="0" rowsep="0">
31085 <colspec colwidth="8*" align="left"/>
31086 <colspec colwidth="6*" align="center"/>
31087 <colspec colwidth="6*" align="center"/>
31088 <colspec colwidth="6*" align="right"/>
31089 <tbody>
31090 <row>
31091 <entry><option>sqlite_lock_timeout</option></entry>
31092 <entry>Use: <emphasis>main</emphasis></entry>
31093 <entry>Type: <emphasis>time</emphasis></entry>
31094 <entry>Default: <emphasis>5s</emphasis></entry>
31095 </row>
31096 </tbody>
31097 </tgroup>
31098 </informaltable>
31099 <para>
31100 <indexterm role="concept">
31101 <primary>sqlite lookup type</primary>
31102 <secondary>lock timeout</secondary>
31103 </indexterm>
31104 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
31105 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
31106 </para>
31107 <para>
31108 <indexterm role="option">
31109 <primary><option>strict_acl_vars</option></primary>
31110 </indexterm>
31111 </para>
31112 <informaltable frame="all">
31113 <tgroup cols="4" colsep="0" rowsep="0">
31114 <colspec colwidth="8*" align="left"/>
31115 <colspec colwidth="6*" align="center"/>
31116 <colspec colwidth="6*" align="center"/>
31117 <colspec colwidth="6*" align="right"/>
31118 <tbody>
31119 <row>
31120 <entry><option>strict_acl_vars</option></entry>
31121 <entry>Use: <emphasis>main</emphasis></entry>
31122 <entry>Type: <emphasis>boolean</emphasis></entry>
31123 <entry>Default: <emphasis>false</emphasis></entry>
31124 </row>
31125 </tbody>
31126 </tgroup>
31127 </informaltable>
31128 <para>
31129 <indexterm role="concept">
31130 <primary>access control lists (ACLs)</primary>
31131 <secondary>variables, handling unset</secondary>
31132 </indexterm>
31133 This option controls what happens if a syntactically valid but undefined ACL
31134 variable is referenced. If it is false (the default), an empty string
31135 is substituted; if it is true, an error is generated. See section
31136 <xref linkend="SECTaclvariables"/> for details of ACL variables.
31137 </para>
31138 <para>
31139 <indexterm role="option">
31140 <primary><option>strip_excess_angle_brackets</option></primary>
31141 </indexterm>
31142 </para>
31143 <informaltable frame="all">
31144 <tgroup cols="4" colsep="0" rowsep="0">
31145 <colspec colwidth="8*" align="left"/>
31146 <colspec colwidth="6*" align="center"/>
31147 <colspec colwidth="6*" align="center"/>
31148 <colspec colwidth="6*" align="right"/>
31149 <tbody>
31150 <row>
31151 <entry><option>strip_excess_angle_brackets</option></entry>
31152 <entry>Use: <emphasis>main</emphasis></entry>
31153 <entry>Type: <emphasis>boolean</emphasis></entry>
31154 <entry>Default: <emphasis>false</emphasis></entry>
31155 </row>
31156 </tbody>
31157 </tgroup>
31158 </informaltable>
31159 <para>
31160 <indexterm role="concept">
31161 <primary>angle brackets, excess</primary>
31162 </indexterm>
31163 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
31164 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
31165 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
31166 passed on to another MTA, the excess angle brackets are not passed on. If this
31167 option is not set, multiple pairs of angle brackets cause a syntax error.
31168 </para>
31169 <para>
31170 <indexterm role="option">
31171 <primary><option>strip_trailing_dot</option></primary>
31172 </indexterm>
31173 </para>
31174 <informaltable frame="all">
31175 <tgroup cols="4" colsep="0" rowsep="0">
31176 <colspec colwidth="8*" align="left"/>
31177 <colspec colwidth="6*" align="center"/>
31178 <colspec colwidth="6*" align="center"/>
31179 <colspec colwidth="6*" align="right"/>
31180 <tbody>
31181 <row>
31182 <entry><option>strip_trailing_dot</option></entry>
31183 <entry>Use: <emphasis>main</emphasis></entry>
31184 <entry>Type: <emphasis>boolean</emphasis></entry>
31185 <entry>Default: <emphasis>false</emphasis></entry>
31186 </row>
31187 </tbody>
31188 </tgroup>
31189 </informaltable>
31190 <para>
31191 <indexterm role="concept">
31192 <primary>trailing dot on domain</primary>
31193 </indexterm>
31194 <indexterm role="concept">
31195 <primary>dot</primary>
31196 <secondary>trailing on domain</secondary>
31197 </indexterm>
31198 If this option is set, a trailing dot at the end of a domain in an address is
31199 ignored. If this is in the envelope and the message is passed on to another
31200 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
31201 domain causes a syntax error.
31202 However, addresses in header lines are checked only when an ACL requests header
31203 syntax checking.
31204 </para>
31205 <para>
31206 <indexterm role="option">
31207 <primary><option>syslog_duplication</option></primary>
31208 </indexterm>
31209 </para>
31210 <informaltable frame="all">
31211 <tgroup cols="4" colsep="0" rowsep="0">
31212 <colspec colwidth="8*" align="left"/>
31213 <colspec colwidth="6*" align="center"/>
31214 <colspec colwidth="6*" align="center"/>
31215 <colspec colwidth="6*" align="right"/>
31216 <tbody>
31217 <row>
31218 <entry><option>syslog_duplication</option></entry>
31219 <entry>Use: <emphasis>main</emphasis></entry>
31220 <entry>Type: <emphasis>boolean</emphasis></entry>
31221 <entry>Default: <emphasis>true</emphasis></entry>
31222 </row>
31223 </tbody>
31224 </tgroup>
31225 </informaltable>
31226 <para>
31227 <indexterm role="concept">
31228 <primary>syslog</primary>
31229 <secondary>duplicate log lines; suppressing</secondary>
31230 </indexterm>
31231 When Exim is logging to syslog, it writes the log lines for its three
31232 separate logs at different syslog priorities so that they can in principle
31233 be separated on the logging hosts. Some installations do not require this
31234 separation, and in those cases, the duplication of certain log lines is a
31235 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
31236 particular log line is written to syslog. For lines that normally go to
31237 both the main log and the reject log, the reject log version (possibly
31238 containing message header lines) is written, at LOG_NOTICE priority.
31239 Lines that normally go to both the main and the panic log are written at
31240 the LOG_ALERT priority.
31241 </para>
31242 <para>
31243 <indexterm role="option">
31244 <primary><option>syslog_facility</option></primary>
31245 </indexterm>
31246 </para>
31247 <informaltable frame="all">
31248 <tgroup cols="4" colsep="0" rowsep="0">
31249 <colspec colwidth="8*" align="left"/>
31250 <colspec colwidth="6*" align="center"/>
31251 <colspec colwidth="6*" align="center"/>
31252 <colspec colwidth="6*" align="right"/>
31253 <tbody>
31254 <row>
31255 <entry><option>syslog_facility</option></entry>
31256 <entry>Use: <emphasis>main</emphasis></entry>
31257 <entry>Type: <emphasis>string</emphasis></entry>
31258 <entry>Default: <emphasis>unset</emphasis></entry>
31259 </row>
31260 </tbody>
31261 </tgroup>
31262 </informaltable>
31263 <para>
31264 <indexterm role="concept">
31265 <primary>syslog</primary>
31266 <secondary>facility; setting</secondary>
31267 </indexterm>
31268 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
31269 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
31270 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
31271 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
31272 details of Exim&#x2019;s logging.
31273 </para>
31274 <para>
31275 <indexterm role="option">
31276 <primary><option>syslog_pid</option></primary>
31277 </indexterm>
31278 </para>
31279 <informaltable frame="all">
31280 <tgroup cols="4" colsep="0" rowsep="0">
31281 <colspec colwidth="8*" align="left"/>
31282 <colspec colwidth="6*" align="center"/>
31283 <colspec colwidth="6*" align="center"/>
31284 <colspec colwidth="6*" align="right"/>
31285 <tbody>
31286 <row>
31287 <entry><option>syslog_pid</option></entry>
31288 <entry>Use: <emphasis>main</emphasis></entry>
31289 <entry>Type: <emphasis>boolean</emphasis></entry>
31290 <entry>Default: <emphasis>true</emphasis></entry>
31291 </row>
31292 </tbody>
31293 </tgroup>
31294 </informaltable>
31295 <para>
31296 <indexterm role="concept">
31297 <primary>syslog</primary>
31298 <secondary>pid</secondary>
31299 </indexterm>
31300 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
31301 omitted when these lines are sent to syslog. (Syslog normally prefixes
31302 the log lines with the PID of the logging process automatically.) You need
31303 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
31304 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31305 </para>
31306 <para>
31307 <indexterm role="option">
31308 <primary><option>syslog_processname</option></primary>
31309 </indexterm>
31310 </para>
31311 <informaltable frame="all">
31312 <tgroup cols="4" colsep="0" rowsep="0">
31313 <colspec colwidth="8*" align="left"/>
31314 <colspec colwidth="6*" align="center"/>
31315 <colspec colwidth="6*" align="center"/>
31316 <colspec colwidth="6*" align="right"/>
31317 <tbody>
31318 <row>
31319 <entry><option>syslog_processname</option></entry>
31320 <entry>Use: <emphasis>main</emphasis></entry>
31321 <entry>Type: <emphasis>string</emphasis></entry>
31322 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
31323 </row>
31324 </tbody>
31325 </tgroup>
31326 </informaltable>
31327 <para>
31328 <indexterm role="concept">
31329 <primary>syslog</primary>
31330 <secondary>process name; setting</secondary>
31331 </indexterm>
31332 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
31333 syslog. The value must be no longer than 32 characters. See chapter
31334 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31335 </para>
31336 <para>
31337 <indexterm role="option">
31338 <primary><option>syslog_timestamp</option></primary>
31339 </indexterm>
31340 </para>
31341 <informaltable frame="all">
31342 <tgroup cols="4" colsep="0" rowsep="0">
31343 <colspec colwidth="8*" align="left"/>
31344 <colspec colwidth="6*" align="center"/>
31345 <colspec colwidth="6*" align="center"/>
31346 <colspec colwidth="6*" align="right"/>
31347 <tbody>
31348 <row>
31349 <entry><option>syslog_timestamp</option></entry>
31350 <entry>Use: <emphasis>main</emphasis></entry>
31351 <entry>Type: <emphasis>boolean</emphasis></entry>
31352 <entry>Default: <emphasis>true</emphasis></entry>
31353 </row>
31354 </tbody>
31355 </tgroup>
31356 </informaltable>
31357 <para>
31358 <indexterm role="concept">
31359 <primary>syslog</primary>
31360 <secondary>timestamps</secondary>
31361 </indexterm>
31362 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
31363 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
31364 details of Exim&#x2019;s logging.
31365 </para>
31366 <para>
31367 <indexterm role="option">
31368 <primary><option>system_filter</option></primary>
31369 </indexterm>
31370 </para>
31371 <informaltable frame="all">
31372 <tgroup cols="4" colsep="0" rowsep="0">
31373 <colspec colwidth="8*" align="left"/>
31374 <colspec colwidth="6*" align="center"/>
31375 <colspec colwidth="6*" align="center"/>
31376 <colspec colwidth="6*" align="right"/>
31377 <tbody>
31378 <row>
31379 <entry><option>system_filter</option></entry>
31380 <entry>Use: <emphasis>main</emphasis></entry>
31381 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31382 <entry>Default: <emphasis>unset</emphasis></entry>
31383 </row>
31384 </tbody>
31385 </tgroup>
31386 </informaltable>
31387 <para>
31388 <indexterm role="concept">
31389 <primary>filter</primary>
31390 <secondary>system filter</secondary>
31391 </indexterm>
31392 <indexterm role="concept">
31393 <primary>system filter</primary>
31394 <secondary>specifying</secondary>
31395 </indexterm>
31396 <indexterm role="concept">
31397 <primary>Sieve filter</primary>
31398 <secondary>not available for system filter</secondary>
31399 </indexterm>
31400 This option specifies an Exim filter file that is applied to all messages at
31401 the start of each delivery attempt, before any routing is done. System filters
31402 must be Exim filters; they cannot be Sieve filters. If the system filter
31403 generates any deliveries to files or pipes, or any new mail messages, the
31404 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
31405 which transports are to be used. Details of this facility are given in chapter
31406 <xref linkend="CHAPsystemfilter"/>.
31407 A forced expansion failure results in no filter operation.
31408 </para>
31409 <para>
31410 <indexterm role="option">
31411 <primary><option>system_filter_directory_transport</option></primary>
31412 </indexterm>
31413 </para>
31414 <informaltable frame="all">
31415 <tgroup cols="4" colsep="0" rowsep="0">
31416 <colspec colwidth="8*" align="left"/>
31417 <colspec colwidth="6*" align="center"/>
31418 <colspec colwidth="6*" align="center"/>
31419 <colspec colwidth="6*" align="right"/>
31420 <tbody>
31421 <row>
31422 <entry><option>system_filter_directory_transport</option></entry>
31423 <entry>Use: <emphasis>main</emphasis></entry>
31424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31425 <entry>Default: <emphasis>unset</emphasis></entry>
31426 </row>
31427 </tbody>
31428 </tgroup>
31429 </informaltable>
31430 <para>
31431 <indexterm role="variable">
31432 <primary><varname>$address_file</varname></primary>
31433 </indexterm>
31434 This sets the name of the transport driver that is to be used when the
31435 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
31436 implying delivery of each message into a separate file in some directory.
31437 During the delivery, the variable <varname>$address_file</varname> contains the path name.
31438 </para>
31439 <para>
31440 <indexterm role="option">
31441 <primary><option>system_filter_file_transport</option></primary>
31442 </indexterm>
31443 </para>
31444 <informaltable frame="all">
31445 <tgroup cols="4" colsep="0" rowsep="0">
31446 <colspec colwidth="8*" align="left"/>
31447 <colspec colwidth="6*" align="center"/>
31448 <colspec colwidth="6*" align="center"/>
31449 <colspec colwidth="6*" align="right"/>
31450 <tbody>
31451 <row>
31452 <entry><option>system_filter_file_transport</option></entry>
31453 <entry>Use: <emphasis>main</emphasis></entry>
31454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31455 <entry>Default: <emphasis>unset</emphasis></entry>
31456 </row>
31457 </tbody>
31458 </tgroup>
31459 </informaltable>
31460 <para>
31461 <indexterm role="concept">
31462 <primary>file</primary>
31463 <secondary>transport for system filter</secondary>
31464 </indexterm>
31465 This sets the name of the transport driver that is to be used when the <option>save</option>
31466 command in a system message filter specifies a path not ending in <quote>/</quote>. During
31467 the delivery, the variable <varname>$address_file</varname> contains the path name.
31468 </para>
31469 <para>
31470 <indexterm role="option">
31471 <primary><option>system_filter_group</option></primary>
31472 </indexterm>
31473 </para>
31474 <informaltable frame="all">
31475 <tgroup cols="4" colsep="0" rowsep="0">
31476 <colspec colwidth="8*" align="left"/>
31477 <colspec colwidth="6*" align="center"/>
31478 <colspec colwidth="6*" align="center"/>
31479 <colspec colwidth="6*" align="right"/>
31480 <tbody>
31481 <row>
31482 <entry><option>system_filter_group</option></entry>
31483 <entry>Use: <emphasis>main</emphasis></entry>
31484 <entry>Type: <emphasis>string</emphasis></entry>
31485 <entry>Default: <emphasis>unset</emphasis></entry>
31486 </row>
31487 </tbody>
31488 </tgroup>
31489 </informaltable>
31490 <para>
31491 <indexterm role="concept">
31492 <primary>gid (group id)</primary>
31493 <secondary>system filter</secondary>
31494 </indexterm>
31495 This option is used only when <option>system_filter_user</option> is also set. It sets the
31496 gid under which the system filter is run, overriding any gid that is associated
31497 with the user. The value may be numerical or symbolic.
31498 </para>
31499 <para>
31500 <indexterm role="option">
31501 <primary><option>system_filter_pipe_transport</option></primary>
31502 </indexterm>
31503 </para>
31504 <informaltable frame="all">
31505 <tgroup cols="4" colsep="0" rowsep="0">
31506 <colspec colwidth="8*" align="left"/>
31507 <colspec colwidth="6*" align="center"/>
31508 <colspec colwidth="6*" align="center"/>
31509 <colspec colwidth="6*" align="right"/>
31510 <tbody>
31511 <row>
31512 <entry><option>system_filter_pipe_transport</option></entry>
31513 <entry>Use: <emphasis>main</emphasis></entry>
31514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31515 <entry>Default: <emphasis>unset</emphasis></entry>
31516 </row>
31517 </tbody>
31518 </tgroup>
31519 </informaltable>
31520 <para>
31521 <indexterm role="concept">
31522 <primary><command>pipe</command> transport</primary>
31523 <secondary>for system filter</secondary>
31524 </indexterm>
31525 <indexterm role="variable">
31526 <primary><varname>$address_pipe</varname></primary>
31527 </indexterm>
31528 This specifies the transport driver that is to be used when a <option>pipe</option> command
31529 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
31530 contains the pipe command.
31531 </para>
31532 <para>
31533 <indexterm role="option">
31534 <primary><option>system_filter_reply_transport</option></primary>
31535 </indexterm>
31536 </para>
31537 <informaltable frame="all">
31538 <tgroup cols="4" colsep="0" rowsep="0">
31539 <colspec colwidth="8*" align="left"/>
31540 <colspec colwidth="6*" align="center"/>
31541 <colspec colwidth="6*" align="center"/>
31542 <colspec colwidth="6*" align="right"/>
31543 <tbody>
31544 <row>
31545 <entry><option>system_filter_reply_transport</option></entry>
31546 <entry>Use: <emphasis>main</emphasis></entry>
31547 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31548 <entry>Default: <emphasis>unset</emphasis></entry>
31549 </row>
31550 </tbody>
31551 </tgroup>
31552 </informaltable>
31553 <para>
31554 <indexterm role="concept">
31555 <primary><command>autoreply</command> transport</primary>
31556 <secondary>for system filter</secondary>
31557 </indexterm>
31558 This specifies the transport driver that is to be used when a <option>mail</option> command
31559 is used in a system filter.
31560 </para>
31561 <para>
31562 <indexterm role="option">
31563 <primary><option>system_filter_user</option></primary>
31564 </indexterm>
31565 </para>
31566 <informaltable frame="all">
31567 <tgroup cols="4" colsep="0" rowsep="0">
31568 <colspec colwidth="8*" align="left"/>
31569 <colspec colwidth="6*" align="center"/>
31570 <colspec colwidth="6*" align="center"/>
31571 <colspec colwidth="6*" align="right"/>
31572 <tbody>
31573 <row>
31574 <entry><option>system_filter_user</option></entry>
31575 <entry>Use: <emphasis>main</emphasis></entry>
31576 <entry>Type: <emphasis>string</emphasis></entry>
31577 <entry>Default: <emphasis>unset</emphasis></entry>
31578 </row>
31579 </tbody>
31580 </tgroup>
31581 </informaltable>
31582 <para>
31583 <indexterm role="concept">
31584 <primary>uid (user id)</primary>
31585 <secondary>system filter</secondary>
31586 </indexterm>
31587 If this option is set to root, the system filter is run in the main Exim
31588 delivery process, as root.  Otherwise, the system filter runs in a separate
31589 process, as the given user, defaulting to the Exim run-time user.
31590 Unless the string consists entirely of digits, it
31591 is looked up in the password data. Failure to find the named user causes a
31592 configuration error. The gid is either taken from the password data, or
31593 specified by <option>system_filter_group</option>. When the uid is specified numerically,
31594 <option>system_filter_group</option> is required to be set.
31595 </para>
31596 <para>
31597 If the system filter generates any pipe, file, or reply deliveries, the uid
31598 under which the filter is run is used when transporting them, unless a
31599 transport option overrides.
31600 </para>
31601 <para>
31602 <indexterm role="option">
31603 <primary><option>tcp_nodelay</option></primary>
31604 </indexterm>
31605 </para>
31606 <informaltable frame="all">
31607 <tgroup cols="4" colsep="0" rowsep="0">
31608 <colspec colwidth="8*" align="left"/>
31609 <colspec colwidth="6*" align="center"/>
31610 <colspec colwidth="6*" align="center"/>
31611 <colspec colwidth="6*" align="right"/>
31612 <tbody>
31613 <row>
31614 <entry><option>tcp_nodelay</option></entry>
31615 <entry>Use: <emphasis>main</emphasis></entry>
31616 <entry>Type: <emphasis>boolean</emphasis></entry>
31617 <entry>Default: <emphasis>true</emphasis></entry>
31618 </row>
31619 </tbody>
31620 </tgroup>
31621 </informaltable>
31622 <para>
31623 <indexterm role="concept">
31624 <primary>daemon</primary>
31625 <secondary>TCP_NODELAY on sockets</secondary>
31626 </indexterm>
31627 <indexterm role="concept">
31628 <primary>Nagle algorithm</primary>
31629 </indexterm>
31630 <indexterm role="concept">
31631 <primary>TCP_NODELAY on listening sockets</primary>
31632 </indexterm>
31633 If this option is set false, it stops the Exim daemon setting the
31634 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
31635 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
31636 performance in interactive (character-by-character) situations. Turning it off
31637 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
31638 However, it appears that some broken clients cannot cope, and time out. Hence
31639 this option. It affects only those sockets that are set up for listening by the
31640 daemon. Sockets created by the smtp transport for delivering mail always set
31641 TCP_NODELAY.
31642 </para>
31643 <para>
31644 <indexterm role="option">
31645 <primary><option>timeout_frozen_after</option></primary>
31646 </indexterm>
31647 </para>
31648 <informaltable frame="all">
31649 <tgroup cols="4" colsep="0" rowsep="0">
31650 <colspec colwidth="8*" align="left"/>
31651 <colspec colwidth="6*" align="center"/>
31652 <colspec colwidth="6*" align="center"/>
31653 <colspec colwidth="6*" align="right"/>
31654 <tbody>
31655 <row>
31656 <entry><option>timeout_frozen_after</option></entry>
31657 <entry>Use: <emphasis>main</emphasis></entry>
31658 <entry>Type: <emphasis>time</emphasis></entry>
31659 <entry>Default: <emphasis>0s</emphasis></entry>
31660 </row>
31661 </tbody>
31662 </tgroup>
31663 </informaltable>
31664 <para>
31665 <indexterm role="concept">
31666 <primary>frozen messages</primary>
31667 <secondary>timing out</secondary>
31668 </indexterm>
31669 <indexterm role="concept">
31670 <primary>timeout</primary>
31671 <secondary>frozen messages</secondary>
31672 </indexterm>
31673 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
31674 message of any kind that has been on the queue for longer than the given time
31675 is automatically cancelled at the next queue run. If the frozen message is a
31676 bounce message, it is just discarded; otherwise, a bounce is sent to the
31677 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
31678 If you want to timeout frozen bounce messages earlier than other kinds of
31679 frozen message, see <option>ignore_bounce_errors_after</option>.
31680 </para>
31681 <para>
31682 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
31683 frozen messages remain on the queue forever (except for any frozen bounce
31684 messages that are released by <option>ignore_bounce_errors_after</option>).
31685 </para>
31686 <para>
31687 <indexterm role="option">
31688 <primary><option>timezone</option></primary>
31689 </indexterm>
31690 </para>
31691 <informaltable frame="all">
31692 <tgroup cols="4" colsep="0" rowsep="0">
31693 <colspec colwidth="8*" align="left"/>
31694 <colspec colwidth="6*" align="center"/>
31695 <colspec colwidth="6*" align="center"/>
31696 <colspec colwidth="6*" align="right"/>
31697 <tbody>
31698 <row>
31699 <entry><option>timezone</option></entry>
31700 <entry>Use: <emphasis>main</emphasis></entry>
31701 <entry>Type: <emphasis>string</emphasis></entry>
31702 <entry>Default: <emphasis>unset</emphasis></entry>
31703 </row>
31704 </tbody>
31705 </tgroup>
31706 </informaltable>
31707 <para>
31708 <indexterm role="concept">
31709 <primary>timezone, setting</primary>
31710 </indexterm>
31711 <indexterm role="concept">
31712 <primary>environment</primary>
31713 <secondary>values from</secondary>
31714 </indexterm>
31715 The value of <option>timezone</option> is used to set the environment variable TZ while
31716 running Exim (if it is different on entry). This ensures that all timestamps
31717 created by Exim are in the required timezone. If you want all your timestamps
31718 to be in UTC (aka GMT) you should set
31719 </para>
31720 <literallayout class="monospaced">
31721 timezone = UTC
31722 </literallayout>
31723 <para>
31724 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
31725 or, if that is not set, from the value of the TZ environment variable when Exim
31726 is built. If <option>timezone</option> is set to the empty string, either at build or run
31727 time, any existing TZ variable is removed from the environment when Exim
31728 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
31729 unfortunately not all, operating systems.
31730 </para>
31731 <para>
31732 <indexterm role="option">
31733 <primary><option>tls_advertise_hosts</option></primary>
31734 </indexterm>
31735 </para>
31736 <informaltable frame="all">
31737 <tgroup cols="4" colsep="0" rowsep="0">
31738 <colspec colwidth="8*" align="left"/>
31739 <colspec colwidth="6*" align="center"/>
31740 <colspec colwidth="6*" align="center"/>
31741 <colspec colwidth="6*" align="right"/>
31742 <tbody>
31743 <row>
31744 <entry><option>tls_advertise_hosts</option></entry>
31745 <entry>Use: <emphasis>main</emphasis></entry>
31746 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31747 <entry>Default: <emphasis>*</emphasis></entry>
31748 </row>
31749 </tbody>
31750 </tgroup>
31751 </informaltable>
31752 <para>
31753 <indexterm role="concept">
31754 <primary>TLS</primary>
31755 <secondary>advertising</secondary>
31756 </indexterm>
31757 <indexterm role="concept">
31758 <primary>encryption</primary>
31759 <secondary>on SMTP connection</secondary>
31760 </indexterm>
31761 <indexterm role="concept">
31762 <primary>SMTP</primary>
31763 <secondary>encrypted connection</secondary>
31764 </indexterm>
31765 When Exim is built with support for TLS encrypted connections, the availability
31766 of the STARTTLS command to set up an encrypted session is advertised in
31767 response to EHLO only to those client hosts that match this option. See
31768 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
31769 Note that the default value requires that a certificate be supplied
31770 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
31771 is not required the <option>tls_advertise_hosts</option> option should be set empty.
31772 </para>
31773 <para>
31774 <indexterm role="option">
31775 <primary><option>unset</option></primary>
31776 </indexterm>
31777 </para>
31778 <informaltable frame="all">
31779 <tgroup cols="4" colsep="0" rowsep="0">
31780 <colspec colwidth="8*" align="left"/>
31781 <colspec colwidth="6*" align="center"/>
31782 <colspec colwidth="6*" align="center"/>
31783 <colspec colwidth="6*" align="right"/>
31784 <tbody>
31785 <row>
31786 <entry><option>tls_certificate</option></entry>
31787 <entry>Use: <emphasis>main</emphasis></entry>
31788 <entry>Type: <emphasis>string</emphasis></entry>
31789 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31790 </row>
31791 </tbody>
31792 </tgroup>
31793 </informaltable>
31794 <para>
31795 <indexterm role="concept">
31796 <primary>TLS</primary>
31797 <secondary>server certificate; location of</secondary>
31798 </indexterm>
31799 <indexterm role="concept">
31800 <primary>certificate</primary>
31801 <secondary>server, location of</secondary>
31802 </indexterm>
31803 The value of this option is expanded, and must then be a list of absolute paths to
31804 files which contains the server&#x2019;s certificates.  Commonly only one file is
31805 needed.
31806 The server&#x2019;s private key is also
31807 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
31808 <xref linkend="CHAPTLS"/> for further details.
31809 </para>
31810 <para>
31811 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
31812 receiving incoming messages as a server. If you want to supply certificates for
31813 use when sending messages as a client, you must set the <option>tls_certificate</option>
31814 option in the relevant <command>smtp</command> transport.
31815 </para>
31816 <para>
31817 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
31818 separator in the usual way to avoid confusion under IPv6.
31819 </para>
31820 <para>
31821 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
31822 when a list of more than one
31823 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
31824 </para>
31825 <para>
31826 <emphasis role="bold">Note</emphasis>: OCSP stapling is not usable under OpenSSL
31827 when a list of more than one file is used.
31828 </para>
31829 <para>
31830 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
31831 if the OpenSSL build supports TLS extensions and the TLS client sends the
31832 Server Name Indication extension, then this option and others documented in
31833 <xref linkend="SECTtlssni"/> will be re-expanded.
31834 </para>
31835 <para>
31836 If this option is unset or empty a fresh self-signed certificate will be
31837 generated for every connection.
31838 </para>
31839 <para>
31840 <indexterm role="option">
31841 <primary><option>tls_crl</option></primary>
31842 </indexterm>
31843 </para>
31844 <informaltable frame="all">
31845 <tgroup cols="4" colsep="0" rowsep="0">
31846 <colspec colwidth="8*" align="left"/>
31847 <colspec colwidth="6*" align="center"/>
31848 <colspec colwidth="6*" align="center"/>
31849 <colspec colwidth="6*" align="right"/>
31850 <tbody>
31851 <row>
31852 <entry><option>tls_crl</option></entry>
31853 <entry>Use: <emphasis>main</emphasis></entry>
31854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31855 <entry>Default: <emphasis>unset</emphasis></entry>
31856 </row>
31857 </tbody>
31858 </tgroup>
31859 </informaltable>
31860 <para>
31861 <indexterm role="concept">
31862 <primary>TLS</primary>
31863 <secondary>server certificate revocation list</secondary>
31864 </indexterm>
31865 <indexterm role="concept">
31866 <primary>certificate</primary>
31867 <secondary>revocation list for server</secondary>
31868 </indexterm>
31869 This option specifies a certificate revocation list. The expanded value must
31870 be the name of a file that contains CRLs in PEM format.
31871 </para>
31872 <para revisionflag="changed">
31873 Under OpenSSL the option can specify a directory with CRL files.
31874 </para>
31875 <para revisionflag="changed">
31876 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
31877 for each signing element of the certificate chain (i.e. all but the leaf).
31878 For the file variant this can be multiple PEM blocks in the one file.
31879 </para>
31880 <para>
31881 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31882 </para>
31883 <para>
31884 <indexterm role="option">
31885 <primary><option>tls_dh_max_bits</option></primary>
31886 </indexterm>
31887 </para>
31888 <informaltable frame="all">
31889 <tgroup cols="4" colsep="0" rowsep="0">
31890 <colspec colwidth="8*" align="left"/>
31891 <colspec colwidth="6*" align="center"/>
31892 <colspec colwidth="6*" align="center"/>
31893 <colspec colwidth="6*" align="right"/>
31894 <tbody>
31895 <row>
31896 <entry><option>tls_dh_max_bits</option></entry>
31897 <entry>Use: <emphasis>main</emphasis></entry>
31898 <entry>Type: <emphasis>integer</emphasis></entry>
31899 <entry>Default: <emphasis>2236</emphasis></entry>
31900 </row>
31901 </tbody>
31902 </tgroup>
31903 </informaltable>
31904 <para>
31905 <indexterm role="concept">
31906 <primary>TLS</primary>
31907 <secondary>D-H bit count</secondary>
31908 </indexterm>
31909 The number of bits used for Diffie-Hellman key-exchange may be suggested by
31910 the chosen TLS library.  That value might prove to be too high for
31911 interoperability.  This option provides a maximum clamp on the value
31912 suggested, trading off security for interoperability.
31913 </para>
31914 <para>
31915 The value must be at least 1024.
31916 </para>
31917 <para>
31918 The value 2236 was chosen because, at time of adding the option, it was the
31919 hard-coded maximum value supported by the NSS cryptographic library, as used
31920 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
31921 </para>
31922 <para>
31923 If you prefer more security and are willing to break some clients, raise this
31924 number.
31925 </para>
31926 <para>
31927 Note that the value passed to GnuTLS for *generating* a new prime may be a
31928 little less than this figure, because GnuTLS is inexact and may produce a
31929 larger prime than requested.
31930 </para>
31931 <para>
31932 <indexterm role="option">
31933 <primary><option>tls_dhparam</option></primary>
31934 </indexterm>
31935 </para>
31936 <informaltable frame="all">
31937 <tgroup cols="4" colsep="0" rowsep="0">
31938 <colspec colwidth="8*" align="left"/>
31939 <colspec colwidth="6*" align="center"/>
31940 <colspec colwidth="6*" align="center"/>
31941 <colspec colwidth="6*" align="right"/>
31942 <tbody>
31943 <row>
31944 <entry><option>tls_dhparam</option></entry>
31945 <entry>Use: <emphasis>main</emphasis></entry>
31946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31947 <entry>Default: <emphasis>unset</emphasis></entry>
31948 </row>
31949 </tbody>
31950 </tgroup>
31951 </informaltable>
31952 <para>
31953 <indexterm role="concept">
31954 <primary>TLS</primary>
31955 <secondary>D-H parameters for server</secondary>
31956 </indexterm>
31957 The value of this option is expanded and indicates the source of DH parameters
31958 to be used by Exim.
31959 </para>
31960 <para>
31961 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
31962 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
31963 other specific constants available are a fallback so that even when
31964 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
31965 </para>
31966 <para>
31967 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
31968 then it names a file from which DH
31969 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
31970 PKCS#3 representation of the DH prime.  If the file does not exist, for
31971 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
31972 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
31973 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
31974 and treated as though the <option>tls_dhparam</option> were set to "none".
31975 </para>
31976 <para>
31977 If this option expands to the string "none", then no DH parameters will be
31978 loaded by Exim.
31979 </para>
31980 <para>
31981 If this option expands to the string "historic" and Exim is using GnuTLS, then
31982 Exim will attempt to load a file from inside the spool directory.  If the file
31983 does not exist, Exim will attempt to create it.
31984 See section <xref linkend="SECTgnutlsparam"/> for further details.
31985 </para>
31986 <para>
31987 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
31988 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
31989 </para>
31990 <para>
31991 In older versions of Exim the default was the 2048 bit prime described in section
31992 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
31993 in IKE is assigned number 23.
31994 </para>
31995 <para>
31996 Otherwise, the option must expand to the name used by Exim for any of a number
31997 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
31998 sources.  As names, Exim uses a standard specified name, else "ike" followed by
31999 the number used by IKE, or "default" which corresponds to
32000 <literal>exim.dev.20160529.3</literal>.
32001 </para>
32002 <para>
32003 The available standard primes are:
32004 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
32005 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
32006 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
32007 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
32008 </para>
32009 <para>
32010 The available additional primes are:
32011 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
32012 </para>
32013 <para>
32014 Some of these will be too small to be accepted by clients.
32015 Some may be too large to be accepted by clients.
32016 The open cryptographic community has suspicions about the integrity of some
32017 of the later IKE values, which led into RFC7919 providing new fixed constants
32018 (the "ffdhe" identifiers).
32019 </para>
32020 <para>
32021 At this point, all of the "ike" values should be considered obsolete;
32022 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
32023 candidates for removal the next time we have backwards-incompatible changes.
32024 </para>
32025 <para>
32026 The TLS protocol does not negotiate an acceptable size for this; clients tend
32027 to hard-drop connections if what is offered by the server is unacceptable,
32028 whether too large or too small, and there&#x2019;s no provision for the client to
32029 tell the server what these constraints are.  Thus, as a server operator, you
32030 need to make an educated guess as to what is most likely to work for your
32031 userbase.
32032 </para>
32033 <para>
32034 Some known size constraints suggest that a bit-size in the range 2048 to 2236
32035 is most likely to maximise interoperability.  The upper bound comes from
32036 applications using the Mozilla Network Security Services (NSS) library, which
32037 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
32038 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
32039 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
32040 acceptable bound from 1024 to 2048.
32041 </para>
32042 <para>
32043 <indexterm role="option">
32044 <primary><option>tls_eccurve</option></primary>
32045 </indexterm>
32046 </para>
32047 <informaltable frame="all">
32048 <tgroup cols="4" colsep="0" rowsep="0">
32049 <colspec colwidth="8*" align="left"/>
32050 <colspec colwidth="6*" align="center"/>
32051 <colspec colwidth="6*" align="center"/>
32052 <colspec colwidth="6*" align="right"/>
32053 <tbody>
32054 <row>
32055 <entry><option>tls_eccurve</option></entry>
32056 <entry>Use: <emphasis>main</emphasis></entry>
32057 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32058 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
32059 </row>
32060 </tbody>
32061 </tgroup>
32062 </informaltable>
32063 <para>
32064 <indexterm role="concept">
32065 <primary>TLS</primary>
32066 <secondary>EC cryptography</secondary>
32067 </indexterm>
32068 This option selects a EC curve for use by Exim when used with OpenSSL.
32069 It has no effect when Exim is used with GnuTLS.
32070 </para>
32071 <para>
32072 After expansion it must contain a valid EC curve parameter, such as
32073 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
32074 for valid selections.
32075 </para>
32076 <para>
32077 For OpenSSL versions before (and not including) 1.0.2, the string
32078 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
32079 <literal>auto</literal> tells the library to choose.
32080 </para>
32081 <para>
32082 If the option expands to an empty string, no EC curves will be enabled.
32083 </para>
32084 <para>
32085 <indexterm role="option">
32086 <primary><option>tls_ocsp_file</option></primary>
32087 </indexterm>
32088 </para>
32089 <informaltable frame="all">
32090 <tgroup cols="4" colsep="0" rowsep="0">
32091 <colspec colwidth="8*" align="left"/>
32092 <colspec colwidth="6*" align="center"/>
32093 <colspec colwidth="6*" align="center"/>
32094 <colspec colwidth="6*" align="right"/>
32095 <tbody>
32096 <row>
32097 <entry><option>tls_ocsp_file</option></entry>
32098 <entry>Use: <emphasis>main</emphasis></entry>
32099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32100 <entry>Default: <emphasis>unset</emphasis></entry>
32101 </row>
32102 </tbody>
32103 </tgroup>
32104 </informaltable>
32105 <para>
32106 <indexterm role="concept">
32107 <primary>TLS</primary>
32108 <secondary>certificate status</secondary>
32109 </indexterm>
32110 <indexterm role="concept">
32111 <primary>TLS</primary>
32112 <secondary>OCSP proof file</secondary>
32113 </indexterm>
32114 This option
32115 must if set expand to the absolute path to a file which contains a current
32116 status proof for the server&#x2019;s certificate, as obtained from the
32117 Certificate Authority.
32118 </para>
32119 <para>
32120 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
32121 </para>
32122 <para revisionflag="changed">
32123 For GnuTLS 3.5.6 or later the expanded value of this option can be a list
32124 of files, to match a list given for the <option>tls_certificate</option> option.
32125 The ordering of the two lists must match.
32126 </para>
32127 <para>
32128 <indexterm role="option">
32129 <primary><option>tls_on_connect_ports</option></primary>
32130 </indexterm>
32131 </para>
32132 <informaltable frame="all">
32133 <tgroup cols="4" colsep="0" rowsep="0">
32134 <colspec colwidth="8*" align="left"/>
32135 <colspec colwidth="6*" align="center"/>
32136 <colspec colwidth="6*" align="center"/>
32137 <colspec colwidth="6*" align="right"/>
32138 <tbody>
32139 <row>
32140 <entry><option>tls_on_connect_ports</option></entry>
32141 <entry>Use: <emphasis>main</emphasis></entry>
32142 <entry>Type: <emphasis>string list</emphasis></entry>
32143 <entry>Default: <emphasis>unset</emphasis></entry>
32144 </row>
32145 </tbody>
32146 </tgroup>
32147 </informaltable>
32148 <para>
32149 <indexterm role="concept">
32150 <primary>SSMTP</primary>
32151 </indexterm>
32152 <indexterm role="concept">
32153 <primary>SMTPS</primary>
32154 </indexterm>
32155 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
32156 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
32157 set up without waiting for the client to issue a STARTTLS command. For
32158 further details, see section <xref linkend="SECTsupobssmt"/>.
32159 </para>
32160 <para>
32161 <indexterm role="option">
32162 <primary><option>unset</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>tls_privatekey</option></entry>
32174 <entry>Use: <emphasis>main</emphasis></entry>
32175 <entry>Type: <emphasis>string</emphasis></entry>
32176 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32177 </row>
32178 </tbody>
32179 </tgroup>
32180 </informaltable>
32181 <para>
32182 <indexterm role="concept">
32183 <primary>TLS</primary>
32184 <secondary>server private key; location of</secondary>
32185 </indexterm>
32186 The value of this option is expanded, and must then be a list of absolute paths to
32187 files which contains the server&#x2019;s private keys.
32188 If this option is unset, or if
32189 the expansion is forced to fail, or the result is an empty string, the private
32190 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
32191 <xref linkend="CHAPTLS"/> for further details.
32192 </para>
32193 <para>
32194 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32195 </para>
32196 <para>
32197 <indexterm role="option">
32198 <primary><option>tls_remember_esmtp</option></primary>
32199 </indexterm>
32200 </para>
32201 <informaltable frame="all">
32202 <tgroup cols="4" colsep="0" rowsep="0">
32203 <colspec colwidth="8*" align="left"/>
32204 <colspec colwidth="6*" align="center"/>
32205 <colspec colwidth="6*" align="center"/>
32206 <colspec colwidth="6*" align="right"/>
32207 <tbody>
32208 <row>
32209 <entry><option>tls_remember_esmtp</option></entry>
32210 <entry>Use: <emphasis>main</emphasis></entry>
32211 <entry>Type: <emphasis>boolean</emphasis></entry>
32212 <entry>Default: <emphasis>false</emphasis></entry>
32213 </row>
32214 </tbody>
32215 </tgroup>
32216 </informaltable>
32217 <para>
32218 <indexterm role="concept">
32219 <primary>TLS</primary>
32220 <secondary>esmtp state; remembering</secondary>
32221 </indexterm>
32222 <indexterm role="concept">
32223 <primary>TLS</primary>
32224 <secondary>broken clients</secondary>
32225 </indexterm>
32226 If this option is set true, Exim violates the RFCs by remembering that it is in
32227 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
32228 support for broken clients that fail to send a new EHLO after starting a
32229 TLS session.
32230 </para>
32231 <para>
32232 <indexterm role="option">
32233 <primary><option>tls_require_ciphers</option></primary>
32234 </indexterm>
32235 </para>
32236 <informaltable frame="all">
32237 <tgroup cols="4" colsep="0" rowsep="0">
32238 <colspec colwidth="8*" align="left"/>
32239 <colspec colwidth="6*" align="center"/>
32240 <colspec colwidth="6*" align="center"/>
32241 <colspec colwidth="6*" align="right"/>
32242 <tbody>
32243 <row>
32244 <entry><option>tls_require_ciphers</option></entry>
32245 <entry>Use: <emphasis>main</emphasis></entry>
32246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32247 <entry>Default: <emphasis>unset</emphasis></entry>
32248 </row>
32249 </tbody>
32250 </tgroup>
32251 </informaltable>
32252 <para>
32253 <indexterm role="concept">
32254 <primary>TLS</primary>
32255 <secondary>requiring specific ciphers</secondary>
32256 </indexterm>
32257 <indexterm role="concept">
32258 <primary>cipher</primary>
32259 <secondary>requiring specific</secondary>
32260 </indexterm>
32261 This option controls which ciphers can be used for incoming TLS connections.
32262 The <command>smtp</command> transport has an option of the same name for controlling outgoing
32263 connections. This option is expanded for each connection, so can be varied for
32264 different clients if required. The value of this option must be a list of
32265 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
32266 in somewhat different ways. If GnuTLS is being used, the client controls the
32267 preference order of the available ciphers. Details are given in sections
32268 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
32269 </para>
32270 <para>
32271 <indexterm role="option">
32272 <primary><option>tls_try_verify_hosts</option></primary>
32273 </indexterm>
32274 </para>
32275 <informaltable frame="all">
32276 <tgroup cols="4" colsep="0" rowsep="0">
32277 <colspec colwidth="8*" align="left"/>
32278 <colspec colwidth="6*" align="center"/>
32279 <colspec colwidth="6*" align="center"/>
32280 <colspec colwidth="6*" align="right"/>
32281 <tbody>
32282 <row>
32283 <entry><option>tls_try_verify_hosts</option></entry>
32284 <entry>Use: <emphasis>main</emphasis></entry>
32285 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32286 <entry>Default: <emphasis>unset</emphasis></entry>
32287 </row>
32288 </tbody>
32289 </tgroup>
32290 </informaltable>
32291 <para>
32292 <indexterm role="concept">
32293 <primary>TLS</primary>
32294 <secondary>client certificate verification</secondary>
32295 </indexterm>
32296 <indexterm role="concept">
32297 <primary>certificate</primary>
32298 <secondary>verification of client</secondary>
32299 </indexterm>
32300 See <option>tls_verify_hosts</option> below.
32301 </para>
32302 <para>
32303 <indexterm role="option">
32304 <primary><option>tls_verify_certificates</option></primary>
32305 </indexterm>
32306 </para>
32307 <informaltable frame="all">
32308 <tgroup cols="4" colsep="0" rowsep="0">
32309 <colspec colwidth="8*" align="left"/>
32310 <colspec colwidth="6*" align="center"/>
32311 <colspec colwidth="6*" align="center"/>
32312 <colspec colwidth="6*" align="right"/>
32313 <tbody>
32314 <row>
32315 <entry><option>tls_verify_certificates</option></entry>
32316 <entry>Use: <emphasis>main</emphasis></entry>
32317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32318 <entry>Default: <emphasis>system</emphasis></entry>
32319 </row>
32320 </tbody>
32321 </tgroup>
32322 </informaltable>
32323 <para>
32324 <indexterm role="concept">
32325 <primary>TLS</primary>
32326 <secondary>client certificate verification</secondary>
32327 </indexterm>
32328 <indexterm role="concept">
32329 <primary>certificate</primary>
32330 <secondary>verification of client</secondary>
32331 </indexterm>
32332 The value of this option is expanded, and must then be either the
32333 word "system"
32334 or the absolute path to
32335 a file or directory containing permitted certificates for clients that
32336 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
32337 </para>
32338 <para>
32339 The "system" value for the option will use a
32340 system default location compiled into the SSL library.
32341 This is not available for GnuTLS versions preceding 3.0.20,
32342 and will be taken as empty; an explicit location
32343 must be specified.
32344 </para>
32345 <para>
32346 The use of a directory for the option value is not available for GnuTLS versions
32347 preceding 3.3.6 and a single file must be used.
32348 </para>
32349 <para>
32350 With OpenSSL the certificates specified
32351 explicitly
32352 either by file or directory
32353 are added to those given by the system default location.
32354 </para>
32355 <para>
32356 These certificates should be for the certificate authorities trusted, rather
32357 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
32358 the value is a file then the certificates are sent by Exim as a server to
32359 connecting clients, defining the list of accepted certificate authorities.
32360 Thus the values defined should be considered public data.  To avoid this,
32361 use the explicit directory version.
32362 </para>
32363 <para>
32364 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32365 </para>
32366 <para>
32367 A forced expansion failure or setting to an empty string is equivalent to
32368 being unset.
32369 </para>
32370 <para>
32371 <indexterm role="option">
32372 <primary><option>tls_verify_hosts</option></primary>
32373 </indexterm>
32374 </para>
32375 <informaltable frame="all">
32376 <tgroup cols="4" colsep="0" rowsep="0">
32377 <colspec colwidth="8*" align="left"/>
32378 <colspec colwidth="6*" align="center"/>
32379 <colspec colwidth="6*" align="center"/>
32380 <colspec colwidth="6*" align="right"/>
32381 <tbody>
32382 <row>
32383 <entry><option>tls_verify_hosts</option></entry>
32384 <entry>Use: <emphasis>main</emphasis></entry>
32385 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32386 <entry>Default: <emphasis>unset</emphasis></entry>
32387 </row>
32388 </tbody>
32389 </tgroup>
32390 </informaltable>
32391 <para>
32392 <indexterm role="concept">
32393 <primary>TLS</primary>
32394 <secondary>client certificate verification</secondary>
32395 </indexterm>
32396 <indexterm role="concept">
32397 <primary>certificate</primary>
32398 <secondary>verification of client</secondary>
32399 </indexterm>
32400 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
32401 certificates from clients. The expected certificates are defined by
32402 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
32403 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
32404 <option>tls_verify_certificates</option> is not set.
32405 </para>
32406 <para>
32407 Any client that matches <option>tls_verify_hosts</option> is constrained by
32408 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
32409 present one of the listed certificates. If it does not, the connection is
32410 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
32411 the host to use TLS. It can still send SMTP commands through unencrypted
32412 connections. Forcing a client to use TLS has to be done separately using an
32413 ACL to reject inappropriate commands when the connection is not encrypted.
32414 </para>
32415 <para>
32416 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
32417 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
32418 certificate and checks it against <option>tls_verify_certificates</option>, but does not
32419 abort the connection if there is no certificate or if it does not match. This
32420 state can be detected in an ACL, which makes it possible to implement policies
32421 such as <quote>accept for relay only if a verified certificate has been received,
32422 but accept for local delivery if encrypted, even without a verified
32423 certificate</quote>.
32424 </para>
32425 <para>
32426 Client hosts that match neither of these lists are not asked to present
32427 certificates.
32428 </para>
32429 <para>
32430 <indexterm role="option">
32431 <primary><option>trusted_groups</option></primary>
32432 </indexterm>
32433 </para>
32434 <informaltable frame="all">
32435 <tgroup cols="4" colsep="0" rowsep="0">
32436 <colspec colwidth="8*" align="left"/>
32437 <colspec colwidth="6*" align="center"/>
32438 <colspec colwidth="6*" align="center"/>
32439 <colspec colwidth="6*" align="right"/>
32440 <tbody>
32441 <row>
32442 <entry><option>trusted_groups</option></entry>
32443 <entry>Use: <emphasis>main</emphasis></entry>
32444 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32445 <entry>Default: <emphasis>unset</emphasis></entry>
32446 </row>
32447 </tbody>
32448 </tgroup>
32449 </informaltable>
32450 <para>
32451 <indexterm role="concept">
32452 <primary>trusted groups</primary>
32453 </indexterm>
32454 <indexterm role="concept">
32455 <primary>groups</primary>
32456 <secondary>trusted</secondary>
32457 </indexterm>
32458 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32459 option is set, any process that is running in one of the listed groups, or
32460 which has one of them as a supplementary group, is trusted. The groups can be
32461 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
32462 details of what trusted callers are permitted to do. If neither
32463 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
32464 are trusted.
32465 </para>
32466 <para>
32467 <indexterm role="option">
32468 <primary><option>trusted_users</option></primary>
32469 </indexterm>
32470 </para>
32471 <informaltable frame="all">
32472 <tgroup cols="4" colsep="0" rowsep="0">
32473 <colspec colwidth="8*" align="left"/>
32474 <colspec colwidth="6*" align="center"/>
32475 <colspec colwidth="6*" align="center"/>
32476 <colspec colwidth="6*" align="right"/>
32477 <tbody>
32478 <row>
32479 <entry><option>trusted_users</option></entry>
32480 <entry>Use: <emphasis>main</emphasis></entry>
32481 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32482 <entry>Default: <emphasis>unset</emphasis></entry>
32483 </row>
32484 </tbody>
32485 </tgroup>
32486 </informaltable>
32487 <para>
32488 <indexterm role="concept">
32489 <primary>trusted users</primary>
32490 </indexterm>
32491 <indexterm role="concept">
32492 <primary>user</primary>
32493 <secondary>trusted</secondary>
32494 </indexterm>
32495 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32496 option is set, any process that is running as one of the listed users is
32497 trusted. The users can be specified numerically or by name. See section
32498 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
32499 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
32500 Exim user are trusted.
32501 </para>
32502 <para>
32503 <indexterm role="option">
32504 <primary><option>unknown_login</option></primary>
32505 </indexterm>
32506 </para>
32507 <informaltable frame="all">
32508 <tgroup cols="4" colsep="0" rowsep="0">
32509 <colspec colwidth="8*" align="left"/>
32510 <colspec colwidth="6*" align="center"/>
32511 <colspec colwidth="6*" align="center"/>
32512 <colspec colwidth="6*" align="right"/>
32513 <tbody>
32514 <row>
32515 <entry><option>unknown_login</option></entry>
32516 <entry>Use: <emphasis>main</emphasis></entry>
32517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32518 <entry>Default: <emphasis>unset</emphasis></entry>
32519 </row>
32520 </tbody>
32521 </tgroup>
32522 </informaltable>
32523 <para>
32524 <indexterm role="concept">
32525 <primary>uid (user id)</primary>
32526 <secondary>unknown caller</secondary>
32527 </indexterm>
32528 <indexterm role="variable">
32529 <primary><varname>$caller_uid</varname></primary>
32530 </indexterm>
32531 This is a specialized feature for use in unusual configurations. By default, if
32532 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
32533 gives up. The <option>unknown_login</option> option can be used to set a login name to be
32534 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
32535 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
32536 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
32537 <option>-F</option> option.
32538 </para>
32539 <para>
32540 <indexterm role="option">
32541 <primary><option>unknown_username</option></primary>
32542 </indexterm>
32543 </para>
32544 <informaltable frame="all">
32545 <tgroup cols="4" colsep="0" rowsep="0">
32546 <colspec colwidth="8*" align="left"/>
32547 <colspec colwidth="6*" align="center"/>
32548 <colspec colwidth="6*" align="center"/>
32549 <colspec colwidth="6*" align="right"/>
32550 <tbody>
32551 <row>
32552 <entry><option>unknown_username</option></entry>
32553 <entry>Use: <emphasis>main</emphasis></entry>
32554 <entry>Type: <emphasis>string</emphasis></entry>
32555 <entry>Default: <emphasis>unset</emphasis></entry>
32556 </row>
32557 </tbody>
32558 </tgroup>
32559 </informaltable>
32560 <para>
32561 See <option>unknown_login</option>.
32562 </para>
32563 <para>
32564 <indexterm role="option">
32565 <primary><option>untrusted_set_sender</option></primary>
32566 </indexterm>
32567 </para>
32568 <informaltable frame="all">
32569 <tgroup cols="4" colsep="0" rowsep="0">
32570 <colspec colwidth="8*" align="left"/>
32571 <colspec colwidth="6*" align="center"/>
32572 <colspec colwidth="6*" align="center"/>
32573 <colspec colwidth="6*" align="right"/>
32574 <tbody>
32575 <row>
32576 <entry><option>untrusted_set_sender</option></entry>
32577 <entry>Use: <emphasis>main</emphasis></entry>
32578 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32579 <entry>Default: <emphasis>unset</emphasis></entry>
32580 </row>
32581 </tbody>
32582 </tgroup>
32583 </informaltable>
32584 <para>
32585 <indexterm role="concept">
32586 <primary>trusted users</primary>
32587 </indexterm>
32588 <indexterm role="concept">
32589 <primary>sender</primary>
32590 <secondary>setting by untrusted user</secondary>
32591 </indexterm>
32592 <indexterm role="concept">
32593 <primary>untrusted user setting sender</primary>
32594 </indexterm>
32595 <indexterm role="concept">
32596 <primary>user</primary>
32597 <secondary>untrusted setting sender</secondary>
32598 </indexterm>
32599 <indexterm role="concept">
32600 <primary>envelope sender</primary>
32601 </indexterm>
32602 When an untrusted user submits a message to Exim using the standard input, Exim
32603 normally creates an envelope sender address from the user&#x2019;s login and the
32604 default qualification domain. Data from the <option>-f</option> option (for setting envelope
32605 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
32606 is used) is ignored.
32607 </para>
32608 <para>
32609 However, untrusted users are permitted to set an empty envelope sender address,
32610 to declare that a message should never generate any bounces. For example:
32611 </para>
32612 <literallayout class="monospaced">
32613 exim -f '&lt;&gt;' user@domain.example
32614 </literallayout>
32615 <para>
32616 <indexterm role="variable">
32617 <primary><varname>$sender_ident</varname></primary>
32618 </indexterm>
32619 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
32620 other envelope sender addresses in a controlled way. When it is set, untrusted
32621 users are allowed to set envelope sender addresses that match any of the
32622 patterns in the list. Like all address lists, the string is expanded. The
32623 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
32624 users to setting senders that start with their login ids
32625 followed by a hyphen
32626 by a setting like this:
32627 </para>
32628 <literallayout class="monospaced">
32629 untrusted_set_sender = ^$sender_ident-
32630 </literallayout>
32631 <para>
32632 If you want to allow untrusted users to set envelope sender addresses without
32633 restriction, you can use
32634 </para>
32635 <literallayout class="monospaced">
32636 untrusted_set_sender = *
32637 </literallayout>
32638 <para>
32639 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
32640 only to the setting of the envelope sender. It does not permit untrusted users
32641 to use the other options which trusted user can use to override message
32642 parameters. Furthermore, it does not stop Exim from removing an existing
32643 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
32644 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
32645 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
32646 described in section <xref linkend="SECTthesenhea"/>.
32647 </para>
32648 <para>
32649 The log line for a message&#x2019;s arrival shows the envelope sender following
32650 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
32651 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
32652 envelope sender address, the user&#x2019;s login is shown in parentheses after the
32653 sender address.
32654 </para>
32655 <para>
32656 <indexterm role="option">
32657 <primary><option>uucp_from_pattern</option></primary>
32658 </indexterm>
32659 </para>
32660 <informaltable frame="all">
32661 <tgroup cols="4" colsep="0" rowsep="0">
32662 <colspec colwidth="8*" align="left"/>
32663 <colspec colwidth="6*" align="center"/>
32664 <colspec colwidth="6*" align="center"/>
32665 <colspec colwidth="6*" align="right"/>
32666 <tbody>
32667 <row>
32668 <entry><option>uucp_from_pattern</option></entry>
32669 <entry>Use: <emphasis>main</emphasis></entry>
32670 <entry>Type: <emphasis>string</emphasis></entry>
32671 <entry>Default: <emphasis>see below</emphasis></entry>
32672 </row>
32673 </tbody>
32674 </tgroup>
32675 </informaltable>
32676 <para>
32677 <indexterm role="concept">
32678 <primary><quote>From</quote> line</primary>
32679 </indexterm>
32680 <indexterm role="concept">
32681 <primary>UUCP</primary>
32682 <secondary><quote>From</quote> line</secondary>
32683 </indexterm>
32684 Some applications that pass messages to an MTA via a command line interface use
32685 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
32686 particular, this is used by UUCP software. Exim recognizes such a line by means
32687 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
32688 matches, the sender address is constructed by expanding the contents of
32689 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
32690 default pattern recognizes lines in the following two forms:
32691 </para>
32692 <literallayout class="monospaced">
32693 From ph10 Fri Jan  5 12:35 GMT 1996
32694 From ph10 Fri, 7 Jan 97 14:00:00 GMT
32695 </literallayout>
32696 <para>
32697 The pattern can be seen by running
32698 </para>
32699 <literallayout class="monospaced">
32700 exim -bP uucp_from_pattern
32701 </literallayout>
32702 <para>
32703 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
32704 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
32705 regular expression by a parenthesized subpattern. The default value for
32706 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
32707 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
32708 <option>ignore_fromline_hosts</option>.
32709 </para>
32710 <para>
32711 <indexterm role="option">
32712 <primary><option>uucp_from_sender</option></primary>
32713 </indexterm>
32714 </para>
32715 <informaltable frame="all">
32716 <tgroup cols="4" colsep="0" rowsep="0">
32717 <colspec colwidth="8*" align="left"/>
32718 <colspec colwidth="6*" align="center"/>
32719 <colspec colwidth="6*" align="center"/>
32720 <colspec colwidth="6*" align="right"/>
32721 <tbody>
32722 <row>
32723 <entry><option>uucp_from_sender</option></entry>
32724 <entry>Use: <emphasis>main</emphasis></entry>
32725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32726 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
32727 </row>
32728 </tbody>
32729 </tgroup>
32730 </informaltable>
32731 <para>
32732 See <option>uucp_from_pattern</option> above.
32733 </para>
32734 <para>
32735 <indexterm role="option">
32736 <primary><option>warn_message_file</option></primary>
32737 </indexterm>
32738 </para>
32739 <informaltable frame="all">
32740 <tgroup cols="4" colsep="0" rowsep="0">
32741 <colspec colwidth="8*" align="left"/>
32742 <colspec colwidth="6*" align="center"/>
32743 <colspec colwidth="6*" align="center"/>
32744 <colspec colwidth="6*" align="right"/>
32745 <tbody>
32746 <row>
32747 <entry><option>warn_message_file</option></entry>
32748 <entry>Use: <emphasis>main</emphasis></entry>
32749 <entry>Type: <emphasis>string</emphasis></entry>
32750 <entry>Default: <emphasis>unset</emphasis></entry>
32751 </row>
32752 </tbody>
32753 </tgroup>
32754 </informaltable>
32755 <para>
32756 <indexterm role="concept">
32757 <primary>warning of delay</primary>
32758 <secondary>customizing the message</secondary>
32759 </indexterm>
32760 <indexterm role="concept">
32761 <primary>customizing</primary>
32762 <secondary>warning message</secondary>
32763 </indexterm>
32764 This option defines a template file containing paragraphs of text to be used
32765 for constructing the warning message which is sent by Exim when a message has
32766 been on the queue for a specified amount of time, as specified by
32767 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
32768 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
32769 </para>
32770 <para>
32771 <indexterm role="option">
32772 <primary><option>write_rejectlog</option></primary>
32773 </indexterm>
32774 </para>
32775 <informaltable frame="all">
32776 <tgroup cols="4" colsep="0" rowsep="0">
32777 <colspec colwidth="8*" align="left"/>
32778 <colspec colwidth="6*" align="center"/>
32779 <colspec colwidth="6*" align="center"/>
32780 <colspec colwidth="6*" align="right"/>
32781 <tbody>
32782 <row>
32783 <entry><option>write_rejectlog</option></entry>
32784 <entry>Use: <emphasis>main</emphasis></entry>
32785 <entry>Type: <emphasis>boolean</emphasis></entry>
32786 <entry>Default: <emphasis>true</emphasis></entry>
32787 </row>
32788 </tbody>
32789 </tgroup>
32790 </informaltable>
32791 <para>
32792 <indexterm role="concept">
32793 <primary>reject log</primary>
32794 <secondary>disabling</secondary>
32795 </indexterm>
32796 If this option is set false, Exim no longer writes anything to the reject log.
32797 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
32798 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
32799 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
32800 </para>
32801 </section>
32802 </chapter>
32803
32804 <chapter id="CHAProutergeneric">
32805 <title>Generic options for routers</title>
32806 <para>
32807 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
32808 <primary>options</primary>
32809 <secondary>generic; for routers</secondary>
32810 </indexterm>
32811 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
32812 <primary>generic options</primary>
32813 <secondary>router</secondary>
32814 </indexterm>
32815 This chapter describes the generic options that apply to all routers.
32816 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
32817 </para>
32818 <para>
32819 For a general description of how a router operates, see sections
32820 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
32821 which the preconditions are tested. The order of expansion of the options that
32822 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
32823 <option>headers_remove</option>, <option>transport</option>.
32824 </para>
32825 <para>
32826 <indexterm role="option">
32827 <primary><option>address_data</option></primary>
32828 </indexterm>
32829 </para>
32830 <informaltable frame="all">
32831 <tgroup cols="4" colsep="0" rowsep="0">
32832 <colspec colwidth="8*" align="left"/>
32833 <colspec colwidth="6*" align="center"/>
32834 <colspec colwidth="6*" align="center"/>
32835 <colspec colwidth="6*" align="right"/>
32836 <tbody>
32837 <row>
32838 <entry><option>address_data</option></entry>
32839 <entry>Use: <emphasis>routers</emphasis></entry>
32840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32841 <entry>Default: <emphasis>unset</emphasis></entry>
32842 </row>
32843 </tbody>
32844 </tgroup>
32845 </informaltable>
32846 <para>
32847 <indexterm role="concept">
32848 <primary>router</primary>
32849 <secondary>data attached to address</secondary>
32850 </indexterm>
32851 The string is expanded just before the router is run, that is, after all the
32852 precondition tests have succeeded. If the expansion is forced to fail, the
32853 router declines, the value of <option>address_data</option> remains unchanged, and the
32854 <option>more</option> option controls what happens next. Other expansion failures cause
32855 delivery of the address to be deferred.
32856 </para>
32857 <para>
32858 <indexterm role="variable">
32859 <primary><varname>$address_data</varname></primary>
32860 </indexterm>
32861 When the expansion succeeds, the value is retained with the address, and can be
32862 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
32863 routers, and the eventual transport.
32864 </para>
32865 <para>
32866 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
32867 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
32868 in the filter. This is not normally a problem, because such data is usually
32869 either not confidential or it <quote>belongs</quote> to the current user, but if you do
32870 put confidential data into <varname>$address_data</varname> you need to remember this point.
32871 </para>
32872 <para>
32873 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
32874 with the address, though it can be changed by another <option>address_data</option> setting
32875 on a subsequent router. If a router generates child addresses, the value of
32876 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
32877 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
32878 </para>
32879 <para>
32880 The idea of <option>address_data</option> is that you can use it to look up a lot of data
32881 for the address once, and then pick out parts of the data later. For example,
32882 you could use a single LDAP lookup to return a string of the form
32883 </para>
32884 <literallayout class="monospaced">
32885 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
32886 </literallayout>
32887 <para>
32888 In the transport you could pick out the mailbox by a setting such as
32889 </para>
32890 <literallayout class="monospaced">
32891 file = ${extract{mailbox}{$address_data}}
32892 </literallayout>
32893 <para>
32894 This makes the configuration file less messy, and also reduces the number of
32895 lookups (though Exim does cache lookups).
32896 </para>
32897 <para>
32898 <indexterm role="variable">
32899 <primary><varname>$sender_address_data</varname></primary>
32900 </indexterm>
32901 <indexterm role="variable">
32902 <primary><varname>$address_data</varname></primary>
32903 </indexterm>
32904 The <option>address_data</option> facility is also useful as a means of passing information
32905 from one router to another, and from a router to a transport. In addition, if
32906 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
32907 ACL, it remains available for use in the rest of the ACL statement. After
32908 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
32909 </para>
32910 <para>
32911 <indexterm role="option">
32912 <primary><option>address_test</option></primary>
32913 </indexterm>
32914 </para>
32915 <informaltable frame="all">
32916 <tgroup cols="4" colsep="0" rowsep="0">
32917 <colspec colwidth="8*" align="left"/>
32918 <colspec colwidth="6*" align="center"/>
32919 <colspec colwidth="6*" align="center"/>
32920 <colspec colwidth="6*" align="right"/>
32921 <tbody>
32922 <row>
32923 <entry><option>address_test</option></entry>
32924 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32925 <entry>Type: <emphasis>boolean</emphasis></entry>
32926 <entry>Default: <emphasis>true</emphasis></entry>
32927 </row>
32928 </tbody>
32929 </tgroup>
32930 </informaltable>
32931 <para>
32932 <indexterm role="option">
32933 <primary><option>-bt</option></primary>
32934 </indexterm>
32935 <indexterm role="concept">
32936 <primary>router</primary>
32937 <secondary>skipping when address testing</secondary>
32938 </indexterm>
32939 If this option is set false, the router is skipped when routing is being tested
32940 by means of the <option>-bt</option> command line option. This can be a convenience when
32941 your first router sends messages to an external scanner, because it saves you
32942 having to set the <quote>already scanned</quote> indicator when testing real address
32943 routing.
32944 </para>
32945 <para>
32946 <indexterm role="option">
32947 <primary><option>cannot_route_message</option></primary>
32948 </indexterm>
32949 </para>
32950 <informaltable frame="all">
32951 <tgroup cols="4" colsep="0" rowsep="0">
32952 <colspec colwidth="8*" align="left"/>
32953 <colspec colwidth="6*" align="center"/>
32954 <colspec colwidth="6*" align="center"/>
32955 <colspec colwidth="6*" align="right"/>
32956 <tbody>
32957 <row>
32958 <entry><option>cannot_route_message</option></entry>
32959 <entry>Use: <emphasis>routers</emphasis></entry>
32960 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32961 <entry>Default: <emphasis>unset</emphasis></entry>
32962 </row>
32963 </tbody>
32964 </tgroup>
32965 </informaltable>
32966 <para>
32967 <indexterm role="concept">
32968 <primary>router</primary>
32969 <secondary>customizing <quote>cannot route</quote> message</secondary>
32970 </indexterm>
32971 <indexterm role="concept">
32972 <primary>customizing</primary>
32973 <secondary><quote>cannot route</quote> message</secondary>
32974 </indexterm>
32975 This option specifies a text message that is used when an address cannot be
32976 routed because Exim has run out of routers. The default message is
32977 <quote>Unrouteable address</quote>. This option is useful only on routers that have
32978 <option>more</option> set false, or on the very last router in a configuration, because the
32979 value that is used is taken from the last router that is considered. This
32980 includes a router that is skipped because its preconditions are not met, as
32981 well as a router that declines. For example, using the default configuration,
32982 you could put:
32983 </para>
32984 <literallayout class="monospaced">
32985 cannot_route_message = Remote domain not found in DNS
32986 </literallayout>
32987 <para>
32988 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
32989 and
32990 </para>
32991 <literallayout class="monospaced">
32992 cannot_route_message = Unknown local user
32993 </literallayout>
32994 <para>
32995 on the final router that checks for local users. If string expansion fails for
32996 this option, the default message is used. Unless the expansion failure was
32997 explicitly forced, a message about the failure is written to the main and panic
32998 logs, in addition to the normal message about the routing failure.
32999 </para>
33000 <para>
33001 <indexterm role="option">
33002 <primary><option>caseful_local_part</option></primary>
33003 </indexterm>
33004 </para>
33005 <informaltable frame="all">
33006 <tgroup cols="4" colsep="0" rowsep="0">
33007 <colspec colwidth="8*" align="left"/>
33008 <colspec colwidth="6*" align="center"/>
33009 <colspec colwidth="6*" align="center"/>
33010 <colspec colwidth="6*" align="right"/>
33011 <tbody>
33012 <row>
33013 <entry><option>caseful_local_part</option></entry>
33014 <entry>Use: <emphasis>routers</emphasis></entry>
33015 <entry>Type: <emphasis>boolean</emphasis></entry>
33016 <entry>Default: <emphasis>false</emphasis></entry>
33017 </row>
33018 </tbody>
33019 </tgroup>
33020 </informaltable>
33021 <para>
33022 <indexterm role="concept">
33023 <primary>case of local parts</primary>
33024 </indexterm>
33025 <indexterm role="concept">
33026 <primary>router</primary>
33027 <secondary>case of local parts</secondary>
33028 </indexterm>
33029 By default, routers handle the local parts of addresses in a case-insensitive
33030 manner, though the actual case is preserved for transmission with the message.
33031 If you want the case of letters to be significant in a router, you must set
33032 this option true. For individual router options that contain address or local
33033 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
33034 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
33035 more details.
33036 </para>
33037 <para>
33038 <indexterm role="variable">
33039 <primary><varname>$local_part</varname></primary>
33040 </indexterm>
33041 <indexterm role="variable">
33042 <primary><varname>$original_local_part</varname></primary>
33043 </indexterm>
33044 <indexterm role="variable">
33045 <primary><varname>$parent_local_part</varname></primary>
33046 </indexterm>
33047 The value of the <varname>$local_part</varname> variable is forced to lower case while a
33048 router is running unless <option>caseful_local_part</option> is set. When a router assigns
33049 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
33050 is the same as it was in the router. Similarly, when a router generates child
33051 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
33052 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
33053 </para>
33054 <para>
33055 This option applies to the processing of an address by a router. When a
33056 recipient address is being processed in an ACL, there is a separate <option>control</option>
33057 modifier that can be used to specify case-sensitive processing within the ACL
33058 (see section <xref linkend="SECTcontrols"/>).
33059 </para>
33060 <para>
33061 <indexterm role="option">
33062 <primary><option>check_local_user</option></primary>
33063 </indexterm>
33064 </para>
33065 <informaltable frame="all">
33066 <tgroup cols="4" colsep="0" rowsep="0">
33067 <colspec colwidth="8*" align="left"/>
33068 <colspec colwidth="6*" align="center"/>
33069 <colspec colwidth="6*" align="center"/>
33070 <colspec colwidth="6*" align="right"/>
33071 <tbody>
33072 <row>
33073 <entry><option>check_local_user</option></entry>
33074 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33075 <entry>Type: <emphasis>boolean</emphasis></entry>
33076 <entry>Default: <emphasis>false</emphasis></entry>
33077 </row>
33078 </tbody>
33079 </tgroup>
33080 </informaltable>
33081 <para>
33082 <indexterm role="concept">
33083 <primary>local user, checking in router</primary>
33084 </indexterm>
33085 <indexterm role="concept">
33086 <primary>router</primary>
33087 <secondary>checking for local user</secondary>
33088 </indexterm>
33089 <indexterm role="concept">
33090 <primary><filename>/etc/passwd</filename></primary>
33091 </indexterm>
33092 <indexterm role="variable">
33093 <primary><varname>$home</varname></primary>
33094 </indexterm>
33095 When this option is true, Exim checks that the local part of the recipient
33096 address (with affixes removed if relevant) is the name of an account on the
33097 local system. The check is done by calling the <function>getpwnam()</function> function rather
33098 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
33099 holding password data (such as NIS) are supported. If the local part is a local
33100 user, <varname>$home</varname> is set from the password data, and can be tested in other
33101 preconditions that are evaluated after this one (the order of evaluation is
33102 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
33103 overridden by <option>router_home_directory</option>. If the local part is not a local user,
33104 the router is skipped.
33105 </para>
33106 <para>
33107 If you want to check that the local part is either the name of a local user
33108 or matches something else, you cannot combine <option>check_local_user</option> with a
33109 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
33110 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
33111 setting to achieve this. For example:
33112 </para>
33113 <literallayout class="monospaced">
33114 local_parts = passwd;$local_part : lsearch;/etc/other/users
33115 </literallayout>
33116 <para>
33117 Note, however, that the side effects of <option>check_local_user</option> (such as setting
33118 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
33119 <option>local_parts</option> (or any other) precondition.
33120 </para>
33121 <para>
33122 <indexterm role="option">
33123 <primary><option>condition</option></primary>
33124 </indexterm>
33125 </para>
33126 <informaltable frame="all">
33127 <tgroup cols="4" colsep="0" rowsep="0">
33128 <colspec colwidth="8*" align="left"/>
33129 <colspec colwidth="6*" align="center"/>
33130 <colspec colwidth="6*" align="center"/>
33131 <colspec colwidth="6*" align="right"/>
33132 <tbody>
33133 <row>
33134 <entry><option>condition</option></entry>
33135 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33136 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33137 <entry>Default: <emphasis>unset</emphasis></entry>
33138 </row>
33139 </tbody>
33140 </tgroup>
33141 </informaltable>
33142 <para>
33143 <indexterm role="concept">
33144 <primary>router</primary>
33145 <secondary>customized precondition</secondary>
33146 </indexterm>
33147 This option specifies a general precondition test that has to succeed for the
33148 router to be called. The <option>condition</option> option is the last precondition to be
33149 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
33150 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
33151 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
33152 router is skipped, and the address is offered to the next one.
33153 </para>
33154 <para>
33155 If the result is any other value, the router is run (as this is the last
33156 precondition to be evaluated, all the other preconditions must be true).
33157 </para>
33158 <para>
33159 This option is unusual in that multiple <option>condition</option> options may be present.
33160 All <option>condition</option> options must succeed.
33161 </para>
33162 <para>
33163 The <option>condition</option> option provides a means of applying custom conditions to the
33164 running of routers. Note that in the case of a simple conditional expansion,
33165 the default expansion values are exactly what is wanted. For example:
33166 </para>
33167 <literallayout class="monospaced">
33168 condition = ${if &gt;{$message_age}{600}}
33169 </literallayout>
33170 <para>
33171 Because of the default behaviour of the string expansion, this is equivalent to
33172 </para>
33173 <literallayout class="monospaced">
33174 condition = ${if &gt;{$message_age}{600}{true}{}}
33175 </literallayout>
33176 <para>
33177 A multiple condition example, which succeeds:
33178 </para>
33179 <literallayout class="monospaced">
33180 condition = ${if &gt;{$message_age}{600}}
33181 condition = ${if !eq{${lc:$local_part}}{postmaster}}
33182 condition = foobar
33183 </literallayout>
33184 <para>
33185 If the expansion fails (other than forced failure) delivery is deferred. Some
33186 of the other precondition options are common special cases that could in fact
33187 be specified using <option>condition</option>.
33188 </para>
33189 <para>
33190 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
33191 are far older, and use one set of semantics.  ACLs are newer and when
33192 they were created, the ACL <option>condition</option> process was given far stricter
33193 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
33194 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
33195 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
33196 Router rules processing behavior.
33197 </para>
33198 <para>
33199 This is best illustrated in an example:
33200 </para>
33201 <literallayout class="monospaced">
33202 # If used in an ACL condition will fail with a syntax error, but
33203 # in a router condition any extra characters are treated as a string
33204
33205 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
33206 true {yes} {no}}
33207
33208 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
33209  {yes} {no}}
33210 </literallayout>
33211 <para>
33212 In each example above, the <option>if</option> statement actually ends after
33213 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
33214 default <option>if</option> behavior is to return a boolean true or a null answer
33215 (which evaluates to false). The rest of the line is then treated as a
33216 string. So the first example resulted in the boolean answer <quote>true</quote>
33217 with the string <quote> {yes} {no}}</quote> appended to it. The second example
33218 resulted in the null output (indicating false) with the string
33219 <quote> {yes} {no}}</quote> appended to it.
33220 </para>
33221 <para>
33222 In fact you can put excess forward braces in too.  In the router
33223 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
33224 mean something, like after a <quote>$</quote> or when required as part of a
33225 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
33226 string characters.
33227 </para>
33228 <para>
33229 Thus, in a Router, the above expansion strings will both always evaluate
33230 true, as the result of expansion is a non-empty string which doesn&#x2019;t
33231 match an explicit false value.  This can be tricky to debug.  By
33232 contrast, in an ACL either of those strings will always result in an
33233 expansion error because the result doesn&#x2019;t look sufficiently boolean.
33234 </para>
33235 <para>
33236 <indexterm role="option">
33237 <primary><option>debug_print</option></primary>
33238 </indexterm>
33239 </para>
33240 <informaltable frame="all">
33241 <tgroup cols="4" colsep="0" rowsep="0">
33242 <colspec colwidth="8*" align="left"/>
33243 <colspec colwidth="6*" align="center"/>
33244 <colspec colwidth="6*" align="center"/>
33245 <colspec colwidth="6*" align="right"/>
33246 <tbody>
33247 <row>
33248 <entry><option>debug_print</option></entry>
33249 <entry>Use: <emphasis>routers</emphasis></entry>
33250 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33251 <entry>Default: <emphasis>unset</emphasis></entry>
33252 </row>
33253 </tbody>
33254 </tgroup>
33255 </informaltable>
33256 <para>
33257 <indexterm role="concept">
33258 <primary>testing</primary>
33259 <secondary>variables in drivers</secondary>
33260 </indexterm>
33261 If this option is set and debugging is enabled (see the <option>-d</option> command line
33262 option) or in address-testing mode (see the <option>-bt</option> command line option),
33263 the string is expanded and included in the debugging output.
33264 If expansion of the string fails, the error message is written to the debugging
33265 output, and Exim carries on processing.
33266 This option is provided to help with checking out the values of variables and
33267 so on when debugging router configurations. For example, if a <option>condition</option>
33268 option appears not to be working, <option>debug_print</option> can be used to output the
33269 variables it references. The output happens after checks for <option>domains</option>,
33270 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
33271 are tested. A newline is added to the text if it does not end with one.
33272 The variable <varname>$router_name</varname> contains the name of the router.
33273 </para>
33274 <para>
33275 <indexterm role="option">
33276 <primary><option>disable_logging</option></primary>
33277 </indexterm>
33278 </para>
33279 <informaltable frame="all">
33280 <tgroup cols="4" colsep="0" rowsep="0">
33281 <colspec colwidth="8*" align="left"/>
33282 <colspec colwidth="6*" align="center"/>
33283 <colspec colwidth="6*" align="center"/>
33284 <colspec colwidth="6*" align="right"/>
33285 <tbody>
33286 <row>
33287 <entry><option>disable_logging</option></entry>
33288 <entry>Use: <emphasis>routers</emphasis></entry>
33289 <entry>Type: <emphasis>boolean</emphasis></entry>
33290 <entry>Default: <emphasis>false</emphasis></entry>
33291 </row>
33292 </tbody>
33293 </tgroup>
33294 </informaltable>
33295 <para>
33296 If this option is set true, nothing is logged for any routing errors
33297 or for any deliveries caused by this router. You should not set this option
33298 unless you really, really know what you are doing. See also the generic
33299 transport option of the same name.
33300 </para>
33301 <para>
33302 <indexterm role="option">
33303 <primary><option>dnssec_request_domains</option></primary>
33304 </indexterm>
33305 </para>
33306 <informaltable frame="all">
33307 <tgroup cols="4" colsep="0" rowsep="0">
33308 <colspec colwidth="8*" align="left"/>
33309 <colspec colwidth="6*" align="center"/>
33310 <colspec colwidth="6*" align="center"/>
33311 <colspec colwidth="6*" align="right"/>
33312 <tbody>
33313 <row>
33314 <entry><option>dnssec_request_domains</option></entry>
33315 <entry>Use: <emphasis>routers</emphasis></entry>
33316 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33317 <entry>Default: <emphasis>unset</emphasis></entry>
33318 </row>
33319 </tbody>
33320 </tgroup>
33321 </informaltable>
33322 <para>
33323 <indexterm role="concept">
33324 <primary>MX record</primary>
33325 <secondary>security</secondary>
33326 </indexterm>
33327 <indexterm role="concept">
33328 <primary>DNSSEC</primary>
33329 <secondary>MX lookup</secondary>
33330 </indexterm>
33331 <indexterm role="concept">
33332 <primary>security</primary>
33333 <secondary>MX lookup</secondary>
33334 </indexterm>
33335 <indexterm role="concept">
33336 <primary>DNS</primary>
33337 <secondary>DNSSEC</secondary>
33338 </indexterm>
33339 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33340 the dnssec request bit set.
33341 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33342 </para>
33343 <para>
33344 <indexterm role="option">
33345 <primary><option>dnssec_require_domains</option></primary>
33346 </indexterm>
33347 </para>
33348 <informaltable frame="all">
33349 <tgroup cols="4" colsep="0" rowsep="0">
33350 <colspec colwidth="8*" align="left"/>
33351 <colspec colwidth="6*" align="center"/>
33352 <colspec colwidth="6*" align="center"/>
33353 <colspec colwidth="6*" align="right"/>
33354 <tbody>
33355 <row>
33356 <entry><option>dnssec_require_domains</option></entry>
33357 <entry>Use: <emphasis>routers</emphasis></entry>
33358 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33359 <entry>Default: <emphasis>unset</emphasis></entry>
33360 </row>
33361 </tbody>
33362 </tgroup>
33363 </informaltable>
33364 <para>
33365 <indexterm role="concept">
33366 <primary>MX record</primary>
33367 <secondary>security</secondary>
33368 </indexterm>
33369 <indexterm role="concept">
33370 <primary>DNSSEC</primary>
33371 <secondary>MX lookup</secondary>
33372 </indexterm>
33373 <indexterm role="concept">
33374 <primary>security</primary>
33375 <secondary>MX lookup</secondary>
33376 </indexterm>
33377 <indexterm role="concept">
33378 <primary>DNS</primary>
33379 <secondary>DNSSEC</secondary>
33380 </indexterm>
33381 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
33382 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33383 (AD bit) set will be ignored and logged as a host-lookup failure.
33384 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33385 </para>
33386 <para>
33387 <indexterm role="option">
33388 <primary><option>domains</option></primary>
33389 </indexterm>
33390 </para>
33391 <informaltable frame="all">
33392 <tgroup cols="4" colsep="0" rowsep="0">
33393 <colspec colwidth="8*" align="left"/>
33394 <colspec colwidth="6*" align="center"/>
33395 <colspec colwidth="6*" align="center"/>
33396 <colspec colwidth="6*" align="right"/>
33397 <tbody>
33398 <row>
33399 <entry><option>domains</option></entry>
33400 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33401 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33402 <entry>Default: <emphasis>unset</emphasis></entry>
33403 </row>
33404 </tbody>
33405 </tgroup>
33406 </informaltable>
33407 <para>
33408 <indexterm role="concept">
33409 <primary>router</primary>
33410 <secondary>restricting to specific domains</secondary>
33411 </indexterm>
33412 <indexterm role="variable">
33413 <primary><varname>$domain_data</varname></primary>
33414 </indexterm>
33415 If this option is set, the router is skipped unless the current domain matches
33416 the list. If the match is achieved by means of a file lookup, the data that the
33417 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
33418 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
33419 a list of the order in which preconditions are evaluated.
33420 </para>
33421 <para>
33422 <indexterm role="option">
33423 <primary><option>driver</option></primary>
33424 </indexterm>
33425 </para>
33426 <informaltable frame="all">
33427 <tgroup cols="4" colsep="0" rowsep="0">
33428 <colspec colwidth="8*" align="left"/>
33429 <colspec colwidth="6*" align="center"/>
33430 <colspec colwidth="6*" align="center"/>
33431 <colspec colwidth="6*" align="right"/>
33432 <tbody>
33433 <row>
33434 <entry><option>driver</option></entry>
33435 <entry>Use: <emphasis>routers</emphasis></entry>
33436 <entry>Type: <emphasis>string</emphasis></entry>
33437 <entry>Default: <emphasis>unset</emphasis></entry>
33438 </row>
33439 </tbody>
33440 </tgroup>
33441 </informaltable>
33442 <para>
33443 This option must always be set. It specifies which of the available routers is
33444 to be used.
33445 </para>
33446 <para>
33447 <indexterm role="option">
33448 <primary><option>dsn_lasthop</option></primary>
33449 </indexterm>
33450 </para>
33451 <informaltable frame="all">
33452 <tgroup cols="4" colsep="0" rowsep="0">
33453 <colspec colwidth="8*" align="left"/>
33454 <colspec colwidth="6*" align="center"/>
33455 <colspec colwidth="6*" align="center"/>
33456 <colspec colwidth="6*" align="right"/>
33457 <tbody>
33458 <row>
33459 <entry><option>dsn_lasthop</option></entry>
33460 <entry>Use: <emphasis>routers</emphasis></entry>
33461 <entry>Type: <emphasis>boolean</emphasis></entry>
33462 <entry>Default: <emphasis>false</emphasis></entry>
33463 </row>
33464 </tbody>
33465 </tgroup>
33466 </informaltable>
33467 <para>
33468 <indexterm role="concept">
33469 <primary>DSN</primary>
33470 <secondary>success</secondary>
33471 </indexterm>
33472 <indexterm role="concept">
33473 <primary>Delivery Status Notification</primary>
33474 <secondary>success</secondary>
33475 </indexterm>
33476 If this option is set true, and extended DSN (RFC3461) processing is in effect,
33477 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
33478 instead send a success DSN as if the next hop does not support DSN.
33479 Not effective on redirect routers.
33480 </para>
33481 <para>
33482 <indexterm role="option">
33483 <primary><option>errors_to</option></primary>
33484 </indexterm>
33485 </para>
33486 <informaltable frame="all">
33487 <tgroup cols="4" colsep="0" rowsep="0">
33488 <colspec colwidth="8*" align="left"/>
33489 <colspec colwidth="6*" align="center"/>
33490 <colspec colwidth="6*" align="center"/>
33491 <colspec colwidth="6*" align="right"/>
33492 <tbody>
33493 <row>
33494 <entry><option>errors_to</option></entry>
33495 <entry>Use: <emphasis>routers</emphasis></entry>
33496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33497 <entry>Default: <emphasis>unset</emphasis></entry>
33498 </row>
33499 </tbody>
33500 </tgroup>
33501 </informaltable>
33502 <para>
33503 <indexterm role="concept">
33504 <primary>envelope sender</primary>
33505 </indexterm>
33506 <indexterm role="concept">
33507 <primary>router</primary>
33508 <secondary>changing address for errors</secondary>
33509 </indexterm>
33510 If a router successfully handles an address, it may assign the address to a
33511 transport for delivery or it may generate child addresses. In both cases, if
33512 there is a delivery problem during later processing, the resulting bounce
33513 message is sent to the address that results from expanding this string,
33514 provided that the address verifies successfully. The <option>errors_to</option> option is
33515 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
33516 </para>
33517 <para>
33518 The <option>errors_to</option> setting associated with an address can be overridden if it
33519 subsequently passes through other routers that have their own <option>errors_to</option>
33520 settings, or if the message is delivered by a transport with a <option>return_path</option>
33521 setting.
33522 </para>
33523 <para>
33524 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
33525 the expansion fails to verify, the errors address associated with the incoming
33526 address is used. At top level, this is the envelope sender. A non-forced
33527 expansion failure causes delivery to be deferred.
33528 </para>
33529 <para>
33530 If an address for which <option>errors_to</option> has been set ends up being delivered over
33531 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
33532 any bounces that are generated by other MTAs on the delivery route are also
33533 sent there. You can set <option>errors_to</option> to the empty string by either of these
33534 settings:
33535 </para>
33536 <literallayout class="monospaced">
33537 errors_to =
33538 errors_to = ""
33539 </literallayout>
33540 <para>
33541 An expansion item that yields an empty string has the same effect. If you do
33542 this, a locally detected delivery error for addresses processed by this router
33543 no longer gives rise to a bounce message; the error is discarded. If the
33544 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
33545 overridden by the <option>return_path</option> option on the transport.
33546 </para>
33547 <para>
33548 <indexterm role="variable">
33549 <primary><varname>$address_data</varname></primary>
33550 </indexterm>
33551 If for some reason you want to discard local errors, but use a non-empty
33552 MAIL command for remote delivery, you can preserve the original return
33553 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
33554 setting <option>return_path</option>.
33555 </para>
33556 <para>
33557 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
33558 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
33559 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
33560 </para>
33561 <para>
33562 <indexterm role="option">
33563 <primary><option>expn</option></primary>
33564 </indexterm>
33565 </para>
33566 <informaltable frame="all">
33567 <tgroup cols="4" colsep="0" rowsep="0">
33568 <colspec colwidth="8*" align="left"/>
33569 <colspec colwidth="6*" align="center"/>
33570 <colspec colwidth="6*" align="center"/>
33571 <colspec colwidth="6*" align="right"/>
33572 <tbody>
33573 <row>
33574 <entry><option>expn</option></entry>
33575 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33576 <entry>Type: <emphasis>boolean</emphasis></entry>
33577 <entry>Default: <emphasis>true</emphasis></entry>
33578 </row>
33579 </tbody>
33580 </tgroup>
33581 </informaltable>
33582 <para>
33583 <indexterm role="concept">
33584 <primary>address</primary>
33585 <secondary>testing</secondary>
33586 </indexterm>
33587 <indexterm role="concept">
33588 <primary>testing</primary>
33589 <secondary>addresses</secondary>
33590 </indexterm>
33591 <indexterm role="concept">
33592 <primary>EXPN</primary>
33593 <secondary>router skipping</secondary>
33594 </indexterm>
33595 <indexterm role="concept">
33596 <primary>router</primary>
33597 <secondary>skipping for EXPN</secondary>
33598 </indexterm>
33599 If this option is turned off, the router is skipped when testing an address
33600 as a result of processing an SMTP EXPN command. You might, for example,
33601 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
33602 on for the system alias file.
33603 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33604 are evaluated.
33605 </para>
33606 <para>
33607 The use of the SMTP EXPN command is controlled by an ACL (see chapter
33608 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
33609 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
33610 </para>
33611 <para>
33612 <indexterm role="option">
33613 <primary><option>fail_verify</option></primary>
33614 </indexterm>
33615 </para>
33616 <informaltable frame="all">
33617 <tgroup cols="4" colsep="0" rowsep="0">
33618 <colspec colwidth="8*" align="left"/>
33619 <colspec colwidth="6*" align="center"/>
33620 <colspec colwidth="6*" align="center"/>
33621 <colspec colwidth="6*" align="right"/>
33622 <tbody>
33623 <row>
33624 <entry><option>fail_verify</option></entry>
33625 <entry>Use: <emphasis>routers</emphasis></entry>
33626 <entry>Type: <emphasis>boolean</emphasis></entry>
33627 <entry>Default: <emphasis>false</emphasis></entry>
33628 </row>
33629 </tbody>
33630 </tgroup>
33631 </informaltable>
33632 <para>
33633 <indexterm role="concept">
33634 <primary>router</primary>
33635 <secondary>forcing verification failure</secondary>
33636 </indexterm>
33637 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
33638 <option>fail_verify_recipient</option> to the same value.
33639 </para>
33640 <para>
33641 <indexterm role="option">
33642 <primary><option>fail_verify_recipient</option></primary>
33643 </indexterm>
33644 </para>
33645 <informaltable frame="all">
33646 <tgroup cols="4" colsep="0" rowsep="0">
33647 <colspec colwidth="8*" align="left"/>
33648 <colspec colwidth="6*" align="center"/>
33649 <colspec colwidth="6*" align="center"/>
33650 <colspec colwidth="6*" align="right"/>
33651 <tbody>
33652 <row>
33653 <entry><option>fail_verify_recipient</option></entry>
33654 <entry>Use: <emphasis>routers</emphasis></entry>
33655 <entry>Type: <emphasis>boolean</emphasis></entry>
33656 <entry>Default: <emphasis>false</emphasis></entry>
33657 </row>
33658 </tbody>
33659 </tgroup>
33660 </informaltable>
33661 <para>
33662 If this option is true and an address is accepted by this router when
33663 verifying a recipient, verification fails.
33664 </para>
33665 <para>
33666 <indexterm role="option">
33667 <primary><option>fail_verify_sender</option></primary>
33668 </indexterm>
33669 </para>
33670 <informaltable frame="all">
33671 <tgroup cols="4" colsep="0" rowsep="0">
33672 <colspec colwidth="8*" align="left"/>
33673 <colspec colwidth="6*" align="center"/>
33674 <colspec colwidth="6*" align="center"/>
33675 <colspec colwidth="6*" align="right"/>
33676 <tbody>
33677 <row>
33678 <entry><option>fail_verify_sender</option></entry>
33679 <entry>Use: <emphasis>routers</emphasis></entry>
33680 <entry>Type: <emphasis>boolean</emphasis></entry>
33681 <entry>Default: <emphasis>false</emphasis></entry>
33682 </row>
33683 </tbody>
33684 </tgroup>
33685 </informaltable>
33686 <para>
33687 If this option is true and an address is accepted by this router when
33688 verifying a sender, verification fails.
33689 </para>
33690 <para>
33691 <indexterm role="option">
33692 <primary><option>fallback_hosts</option></primary>
33693 </indexterm>
33694 </para>
33695 <informaltable frame="all">
33696 <tgroup cols="4" colsep="0" rowsep="0">
33697 <colspec colwidth="8*" align="left"/>
33698 <colspec colwidth="6*" align="center"/>
33699 <colspec colwidth="6*" align="center"/>
33700 <colspec colwidth="6*" align="right"/>
33701 <tbody>
33702 <row>
33703 <entry><option>fallback_hosts</option></entry>
33704 <entry>Use: <emphasis>routers</emphasis></entry>
33705 <entry>Type: <emphasis>string list</emphasis></entry>
33706 <entry>Default: <emphasis>unset</emphasis></entry>
33707 </row>
33708 </tbody>
33709 </tgroup>
33710 </informaltable>
33711 <para>
33712 <indexterm role="concept">
33713 <primary>router</primary>
33714 <secondary>fallback hosts</secondary>
33715 </indexterm>
33716 <indexterm role="concept">
33717 <primary>fallback</primary>
33718 <secondary>hosts specified on router</secondary>
33719 </indexterm>
33720 String expansion is not applied to this option. The argument must be a
33721 colon-separated list of host names or IP addresses. The list separator can be
33722 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
33723 each name or address. In fact, the format of each item is exactly the same as
33724 defined for the list of hosts in a <command>manualroute</command> router (see section
33725 <xref linkend="SECTformatonehostitem"/>).
33726 </para>
33727 <para>
33728 If a router queues an address for a remote transport, this host list is
33729 associated with the address, and used instead of the transport&#x2019;s fallback host
33730 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
33731 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
33732 transport for further details.
33733 </para>
33734 <para>
33735 <indexterm role="option">
33736 <primary><option>group</option></primary>
33737 </indexterm>
33738 </para>
33739 <informaltable frame="all">
33740 <tgroup cols="4" colsep="0" rowsep="0">
33741 <colspec colwidth="8*" align="left"/>
33742 <colspec colwidth="6*" align="center"/>
33743 <colspec colwidth="6*" align="center"/>
33744 <colspec colwidth="6*" align="right"/>
33745 <tbody>
33746 <row>
33747 <entry><option>group</option></entry>
33748 <entry>Use: <emphasis>routers</emphasis></entry>
33749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33750 <entry>Default: <emphasis>see below</emphasis></entry>
33751 </row>
33752 </tbody>
33753 </tgroup>
33754 </informaltable>
33755 <para>
33756 <indexterm role="concept">
33757 <primary>gid (group id)</primary>
33758 <secondary>local delivery</secondary>
33759 </indexterm>
33760 <indexterm role="concept">
33761 <primary>local transports</primary>
33762 <secondary>uid and gid</secondary>
33763 </indexterm>
33764 <indexterm role="concept">
33765 <primary>transport</primary>
33766 <secondary>local</secondary>
33767 </indexterm>
33768 <indexterm role="concept">
33769 <primary>router</primary>
33770 <secondary>setting group</secondary>
33771 </indexterm>
33772 When a router queues an address for a transport, and the transport does not
33773 specify a group, the group given here is used when running the delivery
33774 process.
33775 The group may be specified numerically or by name. If expansion fails, the
33776 error is logged and delivery is deferred.
33777 The default is unset, unless <option>check_local_user</option> is set, when the default
33778 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
33779 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33780 </para>
33781 <para>
33782 <indexterm role="option">
33783 <primary><option>headers_add</option></primary>
33784 </indexterm>
33785 </para>
33786 <informaltable frame="all">
33787 <tgroup cols="4" colsep="0" rowsep="0">
33788 <colspec colwidth="8*" align="left"/>
33789 <colspec colwidth="6*" align="center"/>
33790 <colspec colwidth="6*" align="center"/>
33791 <colspec colwidth="6*" align="right"/>
33792 <tbody>
33793 <row>
33794 <entry><option>headers_add</option></entry>
33795 <entry>Use: <emphasis>routers</emphasis></entry>
33796 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33797 <entry>Default: <emphasis>unset</emphasis></entry>
33798 </row>
33799 </tbody>
33800 </tgroup>
33801 </informaltable>
33802 <para>
33803 <indexterm role="concept">
33804 <primary>header lines</primary>
33805 <secondary>adding</secondary>
33806 </indexterm>
33807 <indexterm role="concept">
33808 <primary>router</primary>
33809 <secondary>adding header lines</secondary>
33810 </indexterm>
33811 This option specifies a list of text headers,
33812 newline-separated (by default, changeable in the usual way),
33813 that is associated with any addresses that are accepted by the router.
33814 Each item is separately expanded, at routing time.  However, this
33815 option has no effect when an address is just being verified. The way in which
33816 the text is used to add header lines at transport time is described in section
33817 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
33818 message is in the process of being transported. This means that references to
33819 header lines in string expansions in the transport&#x2019;s configuration do not
33820 <quote>see</quote> the added header lines.
33821 </para>
33822 <para>
33823 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
33824 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
33825 an item expansion is forced to fail, the item has no effect. Other expansion
33826 failures are treated as configuration errors.
33827 </para>
33828 <para>
33829 Unlike most options, <option>headers_add</option> can be specified multiple times
33830 for a router; all listed headers are added.
33831 </para>
33832 <para>
33833 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
33834 router that has the <option>one_time</option> option set.
33835 </para>
33836 <para>
33837 <indexterm role="concept">
33838 <primary>duplicate addresses</primary>
33839 </indexterm>
33840 <indexterm role="option">
33841 <primary><option>unseen</option></primary>
33842 </indexterm>
33843 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33844 additions are deleted when the address is passed on to subsequent routers.
33845 For a <option>redirect</option> router, if a generated address is the same as the incoming
33846 address, this can lead to duplicate addresses with different header
33847 modifications. Exim does not do duplicate deliveries (except, in certain
33848 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
33849 which of the duplicates is discarded, so this ambiguous situation should be
33850 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
33851 </para>
33852 <para>
33853 <indexterm role="option">
33854 <primary><option>headers_remove</option></primary>
33855 </indexterm>
33856 </para>
33857 <informaltable frame="all">
33858 <tgroup cols="4" colsep="0" rowsep="0">
33859 <colspec colwidth="8*" align="left"/>
33860 <colspec colwidth="6*" align="center"/>
33861 <colspec colwidth="6*" align="center"/>
33862 <colspec colwidth="6*" align="right"/>
33863 <tbody>
33864 <row>
33865 <entry><option>headers_remove</option></entry>
33866 <entry>Use: <emphasis>routers</emphasis></entry>
33867 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33868 <entry>Default: <emphasis>unset</emphasis></entry>
33869 </row>
33870 </tbody>
33871 </tgroup>
33872 </informaltable>
33873 <para>
33874 <indexterm role="concept">
33875 <primary>header lines</primary>
33876 <secondary>removing</secondary>
33877 </indexterm>
33878 <indexterm role="concept">
33879 <primary>router</primary>
33880 <secondary>removing header lines</secondary>
33881 </indexterm>
33882 This option specifies a list of text headers,
33883 colon-separated (by default, changeable in the usual way),
33884 that is associated with any addresses that are accepted by the router.
33885 Each item is separately expanded, at routing time.  However, this
33886 option has no effect when an address is just being verified. The way in which
33887 the text is used to remove header lines at transport time is described in
33888 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
33889 the message is in the process of being transported. This means that references
33890 to header lines in string expansions in the transport&#x2019;s configuration still
33891 <quote>see</quote> the original header lines.
33892 </para>
33893 <para>
33894 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
33895 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
33896 the item has no effect. Other expansion failures are treated as configuration
33897 errors.
33898 </para>
33899 <para>
33900 Unlike most options, <option>headers_remove</option> can be specified multiple times
33901 for a router; all listed headers are removed.
33902 </para>
33903 <para>
33904 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
33905 router that has the <option>one_time</option> option set.
33906 </para>
33907 <para>
33908 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33909 removal requests are deleted when the address is passed on to subsequent
33910 routers, and this can lead to problems with duplicates -- see the similar
33911 warning for <option>headers_add</option> above.
33912 </para>
33913 <para>
33914 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
33915 items that contain a list separator must have it doubled.
33916 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
33917 </para>
33918 <para>
33919 <indexterm role="option">
33920 <primary><option>ignore_target_hosts</option></primary>
33921 </indexterm>
33922 </para>
33923 <informaltable frame="all">
33924 <tgroup cols="4" colsep="0" rowsep="0">
33925 <colspec colwidth="8*" align="left"/>
33926 <colspec colwidth="6*" align="center"/>
33927 <colspec colwidth="6*" align="center"/>
33928 <colspec colwidth="6*" align="right"/>
33929 <tbody>
33930 <row>
33931 <entry><option>ignore_target_hosts</option></entry>
33932 <entry>Use: <emphasis>routers</emphasis></entry>
33933 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33934 <entry>Default: <emphasis>unset</emphasis></entry>
33935 </row>
33936 </tbody>
33937 </tgroup>
33938 </informaltable>
33939 <para>
33940 <indexterm role="concept">
33941 <primary>IP address</primary>
33942 <secondary>discarding</secondary>
33943 </indexterm>
33944 <indexterm role="concept">
33945 <primary>router</primary>
33946 <secondary>discarding IP addresses</secondary>
33947 </indexterm>
33948 Although this option is a host list, it should normally contain IP address
33949 entries rather than names. If any host that is looked up by the router has an
33950 IP address that matches an item in this list, Exim behaves as if that IP
33951 address did not exist. This option allows you to cope with rogue DNS entries
33952 like
33953 </para>
33954 <literallayout class="monospaced">
33955 remote.domain.example.  A  127.0.0.1
33956 </literallayout>
33957 <para>
33958 by setting
33959 </para>
33960 <literallayout class="monospaced">
33961 ignore_target_hosts = 127.0.0.1
33962 </literallayout>
33963 <para>
33964 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
33965 discarded in this way, the router declines. In a conventional configuration, an
33966 attempt to mail to such a domain would normally provoke the <quote>unrouteable
33967 domain</quote> error, and an attempt to verify an address in the domain would fail.
33968 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
33969 router declines if presented with one of the listed addresses.
33970 </para>
33971 <para>
33972 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
33973 means of the first or the second of the following settings, respectively:
33974 </para>
33975 <literallayout class="monospaced">
33976 ignore_target_hosts = 0.0.0.0/0
33977 ignore_target_hosts = &lt;; 0::0/0
33978 </literallayout>
33979 <para>
33980 The pattern in the first line matches all IPv4 addresses, whereas the pattern
33981 in the second line matches all IPv6 addresses.
33982 </para>
33983 <para>
33984 This option may also be useful for ignoring link-local and site-local IPv6
33985 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
33986 is expanded before use as a list, it is possible to make it dependent on the
33987 domain that is being routed.
33988 </para>
33989 <para>
33990 <indexterm role="variable">
33991 <primary><varname>$host_address</varname></primary>
33992 </indexterm>
33993 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
33994 checked.
33995 </para>
33996 <para>
33997 <indexterm role="option">
33998 <primary><option>initgroups</option></primary>
33999 </indexterm>
34000 </para>
34001 <informaltable frame="all">
34002 <tgroup cols="4" colsep="0" rowsep="0">
34003 <colspec colwidth="8*" align="left"/>
34004 <colspec colwidth="6*" align="center"/>
34005 <colspec colwidth="6*" align="center"/>
34006 <colspec colwidth="6*" align="right"/>
34007 <tbody>
34008 <row>
34009 <entry><option>initgroups</option></entry>
34010 <entry>Use: <emphasis>routers</emphasis></entry>
34011 <entry>Type: <emphasis>boolean</emphasis></entry>
34012 <entry>Default: <emphasis>false</emphasis></entry>
34013 </row>
34014 </tbody>
34015 </tgroup>
34016 </informaltable>
34017 <para>
34018 <indexterm role="concept">
34019 <primary>additional groups</primary>
34020 </indexterm>
34021 <indexterm role="concept">
34022 <primary>groups</primary>
34023 <secondary>additional</secondary>
34024 </indexterm>
34025 <indexterm role="concept">
34026 <primary>local transports</primary>
34027 <secondary>uid and gid</secondary>
34028 </indexterm>
34029 <indexterm role="concept">
34030 <primary>transport</primary>
34031 <secondary>local</secondary>
34032 </indexterm>
34033 If the router queues an address for a transport, and this option is true, and
34034 the uid supplied by the router is not overridden by the transport, the
34035 <function>initgroups()</function> function is called when running the transport to ensure that
34036 any additional groups associated with the uid are set up. See also <option>group</option>
34037 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
34038 </para>
34039 <para>
34040 <indexterm role="option">
34041 <primary><option>local_part_prefix</option></primary>
34042 </indexterm>
34043 </para>
34044 <informaltable frame="all">
34045 <tgroup cols="4" colsep="0" rowsep="0">
34046 <colspec colwidth="8*" align="left"/>
34047 <colspec colwidth="6*" align="center"/>
34048 <colspec colwidth="6*" align="center"/>
34049 <colspec colwidth="6*" align="right"/>
34050 <tbody>
34051 <row>
34052 <entry><option>local_part_prefix</option></entry>
34053 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34054 <entry>Type: <emphasis>string list</emphasis></entry>
34055 <entry>Default: <emphasis>unset</emphasis></entry>
34056 </row>
34057 </tbody>
34058 </tgroup>
34059 </informaltable>
34060 <para>
34061 <indexterm role="concept">
34062 <primary>router</primary>
34063 <secondary>prefix for local part</secondary>
34064 </indexterm>
34065 <indexterm role="concept">
34066 <primary>prefix</primary>
34067 <secondary>for local part, used in router</secondary>
34068 </indexterm>
34069 If this option is set, the router is skipped unless the local part starts with
34070 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
34071 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
34072 evaluated.
34073 </para>
34074 <para>
34075 The list is scanned from left to right, and the first prefix that matches is
34076 used. A limited form of wildcard is available; if the prefix begins with an
34077 asterisk, it matches the longest possible sequence of arbitrary characters at
34078 the start of the local part. An asterisk should therefore always be followed by
34079 some character that does not occur in normal local parts.
34080 <indexterm role="concept">
34081 <primary>multiple mailboxes</primary>
34082 </indexterm>
34083 <indexterm role="concept">
34084 <primary>mailbox</primary>
34085 <secondary>multiple</secondary>
34086 </indexterm>
34087 Wildcarding can be used to set up multiple user mailboxes, as described in
34088 section <xref linkend="SECTmulbox"/>.
34089 </para>
34090 <para>
34091 <indexterm role="variable">
34092 <primary><varname>$local_part</varname></primary>
34093 </indexterm>
34094 <indexterm role="variable">
34095 <primary><varname>$local_part_prefix</varname></primary>
34096 </indexterm>
34097 During the testing of the <option>local_parts</option> option, and while the router is
34098 running, the prefix is removed from the local part, and is available in the
34099 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
34100 the router accepts the address, this remains true during subsequent delivery by
34101 a transport. In particular, the local part that is transmitted in the RCPT
34102 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
34103 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
34104 the relevant transport.
34105 </para>
34106 <para>
34107 When an address is being verified, <option>local_part_prefix</option> affects only the
34108 behaviour of the router. If the callout feature of verification is in use, this
34109 means that the full address, including the prefix, will be used during the
34110 callout.
34111 </para>
34112 <para>
34113 The prefix facility is commonly used to handle local parts of the form
34114 <option>owner-something</option>. Another common use is to support local parts of the form
34115 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
34116 to tell a user their forwarding is broken &ndash; by placing a router like this one
34117 immediately before the router that handles <filename>.forward</filename> files:
34118 </para>
34119 <literallayout class="monospaced">
34120 real_localuser:
34121   driver = accept
34122   local_part_prefix = real-
34123   check_local_user
34124   transport = local_delivery
34125 </literallayout>
34126 <para>
34127 For security, it would probably be a good idea to restrict the use of this
34128 router to locally-generated messages, using a condition such as this:
34129 </para>
34130 <literallayout class="monospaced">
34131   condition = ${if match {$sender_host_address}\
34132                          {\N^(|127\.0\.0\.1)$\N}}
34133 </literallayout>
34134 <para>
34135 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
34136 both conditions must be met if not optional. Care must be taken if wildcards
34137 are used in both a prefix and a suffix on the same router. Different
34138 separator characters must be used to avoid ambiguity.
34139 </para>
34140 <para>
34141 <indexterm role="option">
34142 <primary><option>local_part_prefix_optional</option></primary>
34143 </indexterm>
34144 </para>
34145 <informaltable frame="all">
34146 <tgroup cols="4" colsep="0" rowsep="0">
34147 <colspec colwidth="8*" align="left"/>
34148 <colspec colwidth="6*" align="center"/>
34149 <colspec colwidth="6*" align="center"/>
34150 <colspec colwidth="6*" align="right"/>
34151 <tbody>
34152 <row>
34153 <entry><option>local_part_prefix_optional</option></entry>
34154 <entry>Use: <emphasis>routers</emphasis></entry>
34155 <entry>Type: <emphasis>boolean</emphasis></entry>
34156 <entry>Default: <emphasis>false</emphasis></entry>
34157 </row>
34158 </tbody>
34159 </tgroup>
34160 </informaltable>
34161 <para>
34162 See <option>local_part_prefix</option> above.
34163 </para>
34164 <para>
34165 <indexterm role="option">
34166 <primary><option>local_part_suffix</option></primary>
34167 </indexterm>
34168 </para>
34169 <informaltable frame="all">
34170 <tgroup cols="4" colsep="0" rowsep="0">
34171 <colspec colwidth="8*" align="left"/>
34172 <colspec colwidth="6*" align="center"/>
34173 <colspec colwidth="6*" align="center"/>
34174 <colspec colwidth="6*" align="right"/>
34175 <tbody>
34176 <row>
34177 <entry><option>local_part_suffix</option></entry>
34178 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34179 <entry>Type: <emphasis>string list</emphasis></entry>
34180 <entry>Default: <emphasis>unset</emphasis></entry>
34181 </row>
34182 </tbody>
34183 </tgroup>
34184 </informaltable>
34185 <para>
34186 <indexterm role="concept">
34187 <primary>router</primary>
34188 <secondary>suffix for local part</secondary>
34189 </indexterm>
34190 <indexterm role="concept">
34191 <primary>suffix for local part</primary>
34192 <secondary>used in router</secondary>
34193 </indexterm>
34194 This option operates in the same way as <option>local_part_prefix</option>, except that the
34195 local part must end (rather than start) with the given string, the
34196 <option>local_part_suffix_optional</option> option determines whether the suffix is
34197 mandatory, and the wildcard * character, if present, must be the last
34198 character of the suffix. This option facility is commonly used to handle local
34199 parts of the form <option>something-request</option> and multiple user mailboxes of the form
34200 <option>username-foo</option>.
34201 </para>
34202 <para>
34203 <indexterm role="option">
34204 <primary><option>local_part_suffix_optional</option></primary>
34205 </indexterm>
34206 </para>
34207 <informaltable frame="all">
34208 <tgroup cols="4" colsep="0" rowsep="0">
34209 <colspec colwidth="8*" align="left"/>
34210 <colspec colwidth="6*" align="center"/>
34211 <colspec colwidth="6*" align="center"/>
34212 <colspec colwidth="6*" align="right"/>
34213 <tbody>
34214 <row>
34215 <entry><option>local_part_suffix_optional</option></entry>
34216 <entry>Use: <emphasis>routers</emphasis></entry>
34217 <entry>Type: <emphasis>boolean</emphasis></entry>
34218 <entry>Default: <emphasis>false</emphasis></entry>
34219 </row>
34220 </tbody>
34221 </tgroup>
34222 </informaltable>
34223 <para>
34224 See <option>local_part_suffix</option> above.
34225 </para>
34226 <para>
34227 <indexterm role="option">
34228 <primary><option>local_parts</option></primary>
34229 </indexterm>
34230 </para>
34231 <informaltable frame="all">
34232 <tgroup cols="4" colsep="0" rowsep="0">
34233 <colspec colwidth="8*" align="left"/>
34234 <colspec colwidth="6*" align="center"/>
34235 <colspec colwidth="6*" align="center"/>
34236 <colspec colwidth="6*" align="right"/>
34237 <tbody>
34238 <row>
34239 <entry><option>local_parts</option></entry>
34240 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34241 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
34242 <entry>Default: <emphasis>unset</emphasis></entry>
34243 </row>
34244 </tbody>
34245 </tgroup>
34246 </informaltable>
34247 <para>
34248 <indexterm role="concept">
34249 <primary>router</primary>
34250 <secondary>restricting to specific local parts</secondary>
34251 </indexterm>
34252 <indexterm role="concept">
34253 <primary>local part</primary>
34254 <secondary>checking in router</secondary>
34255 </indexterm>
34256 The router is run only if the local part of the address matches the list.
34257 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34258 are evaluated, and
34259 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
34260 string is expanded, it is possible to make it depend on the domain, for
34261 example:
34262 </para>
34263 <literallayout class="monospaced">
34264 local_parts = dbm;/usr/local/specials/$domain
34265 </literallayout>
34266 <para>
34267 <indexterm role="variable">
34268 <primary><varname>$local_part_data</varname></primary>
34269 </indexterm>
34270 If the match is achieved by a lookup, the data that the lookup returned
34271 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
34272 expansions of the router&#x2019;s private options. You might use this option, for
34273 example, if you have a large number of local virtual domains, and you want to
34274 send all postmaster mail to the same place without having to set up an alias in
34275 each virtual domain:
34276 </para>
34277 <literallayout class="monospaced">
34278 postmaster:
34279   driver = redirect
34280   local_parts = postmaster
34281   data = postmaster@real.domain.example
34282 </literallayout>
34283 <para>
34284 <indexterm role="option">
34285 <primary><option>log_as_local</option></primary>
34286 </indexterm>
34287 </para>
34288 <informaltable frame="all">
34289 <tgroup cols="4" colsep="0" rowsep="0">
34290 <colspec colwidth="8*" align="left"/>
34291 <colspec colwidth="6*" align="center"/>
34292 <colspec colwidth="6*" align="center"/>
34293 <colspec colwidth="6*" align="right"/>
34294 <tbody>
34295 <row>
34296 <entry><option>log_as_local</option></entry>
34297 <entry>Use: <emphasis>routers</emphasis></entry>
34298 <entry>Type: <emphasis>boolean</emphasis></entry>
34299 <entry>Default: <emphasis>see below</emphasis></entry>
34300 </row>
34301 </tbody>
34302 </tgroup>
34303 </informaltable>
34304 <para>
34305 <indexterm role="concept">
34306 <primary>log</primary>
34307 <secondary>delivery line</secondary>
34308 </indexterm>
34309 <indexterm role="concept">
34310 <primary>delivery</primary>
34311 <secondary>log line format</secondary>
34312 </indexterm>
34313 Exim has two logging styles for delivery, the idea being to make local
34314 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
34315 recipient address is given just as the local part, without a domain. The use of
34316 this style is controlled by this option. It defaults to true for the <command>accept</command>
34317 router, and false for all the others. This option applies only when a
34318 router assigns an address to a transport. It has no effect on routers that
34319 redirect addresses.
34320 </para>
34321 <para>
34322 <indexterm role="option">
34323 <primary><option>more</option></primary>
34324 </indexterm>
34325 </para>
34326 <informaltable frame="all">
34327 <tgroup cols="4" colsep="0" rowsep="0">
34328 <colspec colwidth="8*" align="left"/>
34329 <colspec colwidth="6*" align="center"/>
34330 <colspec colwidth="6*" align="center"/>
34331 <colspec colwidth="6*" align="right"/>
34332 <tbody>
34333 <row>
34334 <entry><option>more</option></entry>
34335 <entry>Use: <emphasis>routers</emphasis></entry>
34336 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34337 <entry>Default: <emphasis>true</emphasis></entry>
34338 </row>
34339 </tbody>
34340 </tgroup>
34341 </informaltable>
34342 <para>
34343 The result of string expansion for this option must be a valid boolean value,
34344 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34345 result causes an error, and delivery is deferred. If the expansion is forced to
34346 fail, the default value for the option (true) is used. Other failures cause
34347 delivery to be deferred.
34348 </para>
34349 <para>
34350 If this option is set false, and the router declines to handle the address, no
34351 further routers are tried, routing fails, and the address is bounced.
34352 <indexterm role="option">
34353 <primary><option>self</option></primary>
34354 </indexterm>
34355 However, if the router explicitly passes an address to the following router by
34356 means of the setting
34357 </para>
34358 <literallayout class="monospaced">
34359 self = pass
34360 </literallayout>
34361 <para>
34362 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
34363 does not affect the behaviour if one of the precondition tests fails. In that
34364 case, the address is always passed to the next router.
34365 </para>
34366 <para>
34367 Note that <option>address_data</option> is not considered to be a precondition. If its
34368 expansion is forced to fail, the router declines, and the value of <option>more</option>
34369 controls what happens next.
34370 </para>
34371 <para>
34372 <indexterm role="option">
34373 <primary><option>pass_on_timeout</option></primary>
34374 </indexterm>
34375 </para>
34376 <informaltable frame="all">
34377 <tgroup cols="4" colsep="0" rowsep="0">
34378 <colspec colwidth="8*" align="left"/>
34379 <colspec colwidth="6*" align="center"/>
34380 <colspec colwidth="6*" align="center"/>
34381 <colspec colwidth="6*" align="right"/>
34382 <tbody>
34383 <row>
34384 <entry><option>pass_on_timeout</option></entry>
34385 <entry>Use: <emphasis>routers</emphasis></entry>
34386 <entry>Type: <emphasis>boolean</emphasis></entry>
34387 <entry>Default: <emphasis>false</emphasis></entry>
34388 </row>
34389 </tbody>
34390 </tgroup>
34391 </informaltable>
34392 <para>
34393 <indexterm role="concept">
34394 <primary>timeout</primary>
34395 <secondary>of router</secondary>
34396 </indexterm>
34397 <indexterm role="concept">
34398 <primary>router</primary>
34399 <secondary>timeout</secondary>
34400 </indexterm>
34401 If a router times out during a host lookup, it normally causes deferral of the
34402 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
34403 router, overriding <option>no_more</option>. This may be helpful for systems that are
34404 intermittently connected to the Internet, or those that want to pass to a smart
34405 host any messages that cannot immediately be delivered.
34406 </para>
34407 <para>
34408 There are occasional other temporary errors that can occur while doing DNS
34409 lookups. They are treated in the same way as a timeout, and this option
34410 applies to all of them.
34411 </para>
34412 <para>
34413 <indexterm role="option">
34414 <primary><option>pass_router</option></primary>
34415 </indexterm>
34416 </para>
34417 <informaltable frame="all">
34418 <tgroup cols="4" colsep="0" rowsep="0">
34419 <colspec colwidth="8*" align="left"/>
34420 <colspec colwidth="6*" align="center"/>
34421 <colspec colwidth="6*" align="center"/>
34422 <colspec colwidth="6*" align="right"/>
34423 <tbody>
34424 <row>
34425 <entry><option>pass_router</option></entry>
34426 <entry>Use: <emphasis>routers</emphasis></entry>
34427 <entry>Type: <emphasis>string</emphasis></entry>
34428 <entry>Default: <emphasis>unset</emphasis></entry>
34429 </row>
34430 </tbody>
34431 </tgroup>
34432 </informaltable>
34433 <para>
34434 <indexterm role="concept">
34435 <primary>router</primary>
34436 <secondary>go to after <quote>pass</quote></secondary>
34437 </indexterm>
34438 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
34439 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
34440 routing to continue, and overriding a false setting of <option>more</option>. When one of
34441 these routers returns <quote>pass</quote>, the address is normally handed on to the next
34442 router in sequence. This can be changed by setting <option>pass_router</option> to the name
34443 of another router. However (unlike <option>redirect_router</option>) the named router must
34444 be below the current router, to avoid loops. Note that this option applies only
34445 to the special case of <quote>pass</quote>. It does not apply when a router returns
34446 <quote>decline</quote> because it cannot handle an address.
34447 </para>
34448 <para>
34449 <indexterm role="option">
34450 <primary><option>redirect_router</option></primary>
34451 </indexterm>
34452 </para>
34453 <informaltable frame="all">
34454 <tgroup cols="4" colsep="0" rowsep="0">
34455 <colspec colwidth="8*" align="left"/>
34456 <colspec colwidth="6*" align="center"/>
34457 <colspec colwidth="6*" align="center"/>
34458 <colspec colwidth="6*" align="right"/>
34459 <tbody>
34460 <row>
34461 <entry><option>redirect_router</option></entry>
34462 <entry>Use: <emphasis>routers</emphasis></entry>
34463 <entry>Type: <emphasis>string</emphasis></entry>
34464 <entry>Default: <emphasis>unset</emphasis></entry>
34465 </row>
34466 </tbody>
34467 </tgroup>
34468 </informaltable>
34469 <para>
34470 <indexterm role="concept">
34471 <primary>router</primary>
34472 <secondary>start at after redirection</secondary>
34473 </indexterm>
34474 Sometimes an administrator knows that it is pointless to reprocess addresses
34475 generated from alias or forward files with the same router again. For
34476 example, if an alias file translates real names into login ids there is no
34477 point searching the alias file a second time, especially if it is a large file.
34478 </para>
34479 <para>
34480 The <option>redirect_router</option> option can be set to the name of any router instance.
34481 It causes the routing of any generated addresses to start at the named router
34482 instead of at the first router. This option has no effect if the router in
34483 which it is set does not generate new addresses.
34484 </para>
34485 <para>
34486 <indexterm role="option">
34487 <primary><option>require_files</option></primary>
34488 </indexterm>
34489 </para>
34490 <informaltable frame="all">
34491 <tgroup cols="4" colsep="0" rowsep="0">
34492 <colspec colwidth="8*" align="left"/>
34493 <colspec colwidth="6*" align="center"/>
34494 <colspec colwidth="6*" align="center"/>
34495 <colspec colwidth="6*" align="right"/>
34496 <tbody>
34497 <row>
34498 <entry><option>require_files</option></entry>
34499 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34500 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34501 <entry>Default: <emphasis>unset</emphasis></entry>
34502 </row>
34503 </tbody>
34504 </tgroup>
34505 </informaltable>
34506 <para>
34507 <indexterm role="concept">
34508 <primary>file</primary>
34509 <secondary>requiring for router</secondary>
34510 </indexterm>
34511 <indexterm role="concept">
34512 <primary>router</primary>
34513 <secondary>requiring file existence</secondary>
34514 </indexterm>
34515 This option provides a general mechanism for predicating the running of a
34516 router on the existence or non-existence of certain files or directories.
34517 Before running a router, as one of its precondition tests, Exim works its way
34518 through the <option>require_files</option> list, expanding each item separately.
34519 </para>
34520 <para>
34521 Because the list is split before expansion, any colons in expansion items must
34522 be doubled, or the facility for using a different list separator must be used.
34523 If any expansion is forced to fail, the item is ignored. Other expansion
34524 failures cause routing of the address to be deferred.
34525 </para>
34526 <para>
34527 If any expanded string is empty, it is ignored. Otherwise, except as described
34528 below, each string must be a fully qualified file path, optionally preceded by
34529 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
34530 existence of the files or directories. The router is skipped if any paths not
34531 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
34532 </para>
34533 <para>
34534 <indexterm role="concept">
34535 <primary>NFS</primary>
34536 </indexterm>
34537 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
34538 the message is deferred. This can happen when NFS-mounted filesystems are
34539 unavailable.
34540 </para>
34541 <para>
34542 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
34543 options, so you cannot use it to check for the existence of a file in which to
34544 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
34545 full list of the order in which preconditions are evaluated.) However, as
34546 these options are all expanded, you can use the <option>exists</option> expansion condition
34547 to make such tests. The <option>require_files</option> option is intended for checking files
34548 that the router may be going to use internally, or which are needed by a
34549 transport (for example <filename>.procmailrc</filename>).
34550 </para>
34551 <para>
34552 During delivery, the <function>stat()</function> function is run as root, but there is a
34553 facility for some checking of the accessibility of a file by another user.
34554 This is not a proper permissions check, but just a <quote>rough</quote> check that
34555 operates as follows:
34556 </para>
34557 <para>
34558 If an item in a <option>require_files</option> list does not contain any forward slash
34559 characters, it is taken to be the user (and optional group, separated by a
34560 comma) to be checked for subsequent files in the list. If no group is specified
34561 but the user is specified symbolically, the gid associated with the uid is
34562 used. For example:
34563 </para>
34564 <literallayout class="monospaced">
34565 require_files = mail:/some/file
34566 require_files = $local_part:$home/.procmailrc
34567 </literallayout>
34568 <para>
34569 If a user or group name in a <option>require_files</option> list does not exist, the
34570 <option>require_files</option> condition fails.
34571 </para>
34572 <para>
34573 Exim performs the check by scanning along the components of the file path, and
34574 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
34575 directories, and <quote>r</quote> access on the final file. Note that this means that file
34576 access control lists, if the operating system has them, are ignored.
34577 </para>
34578 <para>
34579 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
34580 incoming SMTP message, Exim is not running as root, but under its own uid. This
34581 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
34582 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
34583 user is not permitted to read one of the directories on the file&#x2019;s path.
34584 </para>
34585 <para>
34586 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
34587 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
34588 without root access. In this case, if a check for access by a particular user
34589 is requested, Exim creates a subprocess that runs as that user, and tries the
34590 check again in that process.
34591 </para>
34592 <para>
34593 The default action for handling an unresolved EACCES is to consider it to
34594 be caused by a configuration error, and routing is deferred because the
34595 existence or non-existence of the file cannot be determined. However, in some
34596 circumstances it may be desirable to treat this condition as if the file did
34597 not exist. If the file name (or the exclamation mark that precedes the file
34598 name for non-existence) is preceded by a plus sign, the EACCES error is treated
34599 as if the file did not exist. For example:
34600 </para>
34601 <literallayout class="monospaced">
34602 require_files = +/some/file
34603 </literallayout>
34604 <para>
34605 If the router is not an essential part of verification (for example, it
34606 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
34607 option false so that the router is skipped when verifying.
34608 </para>
34609 <para>
34610 <indexterm role="option">
34611 <primary><option>retry_use_local_part</option></primary>
34612 </indexterm>
34613 </para>
34614 <informaltable frame="all">
34615 <tgroup cols="4" colsep="0" rowsep="0">
34616 <colspec colwidth="8*" align="left"/>
34617 <colspec colwidth="6*" align="center"/>
34618 <colspec colwidth="6*" align="center"/>
34619 <colspec colwidth="6*" align="right"/>
34620 <tbody>
34621 <row>
34622 <entry><option>retry_use_local_part</option></entry>
34623 <entry>Use: <emphasis>routers</emphasis></entry>
34624 <entry>Type: <emphasis>boolean</emphasis></entry>
34625 <entry>Default: <emphasis>see below</emphasis></entry>
34626 </row>
34627 </tbody>
34628 </tgroup>
34629 </informaltable>
34630 <para>
34631 <indexterm role="concept">
34632 <primary>hints database</primary>
34633 <secondary>retry keys</secondary>
34634 </indexterm>
34635 <indexterm role="concept">
34636 <primary>local part</primary>
34637 <secondary>in retry keys</secondary>
34638 </indexterm>
34639 When a delivery suffers a temporary routing failure, a retry record is created
34640 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
34641 domain, the key for the retry record should not involve the local part, but for
34642 other addresses, both the domain and the local part should be included.
34643 Usually, remote routing is of the former kind, and local routing is of the
34644 latter kind.
34645 </para>
34646 <para>
34647 This option controls whether the local part is used to form the key for retry
34648 hints for addresses that suffer temporary errors while being handled by this
34649 router. The default value is true for any router that has <option>check_local_user</option>
34650 set, and false otherwise. Note that this option does not apply to hints keys
34651 for transport delays; they are controlled by a generic transport option of the
34652 same name.
34653 </para>
34654 <para>
34655 The setting of <option>retry_use_local_part</option> applies only to the router on which it
34656 appears. If the router generates child addresses, they are routed
34657 independently; this setting does not become attached to them.
34658 </para>
34659 <para>
34660 <indexterm role="option">
34661 <primary><option>router_home_directory</option></primary>
34662 </indexterm>
34663 </para>
34664 <informaltable frame="all">
34665 <tgroup cols="4" colsep="0" rowsep="0">
34666 <colspec colwidth="8*" align="left"/>
34667 <colspec colwidth="6*" align="center"/>
34668 <colspec colwidth="6*" align="center"/>
34669 <colspec colwidth="6*" align="right"/>
34670 <tbody>
34671 <row>
34672 <entry><option>router_home_directory</option></entry>
34673 <entry>Use: <emphasis>routers</emphasis></entry>
34674 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34675 <entry>Default: <emphasis>unset</emphasis></entry>
34676 </row>
34677 </tbody>
34678 </tgroup>
34679 </informaltable>
34680 <para>
34681 <indexterm role="concept">
34682 <primary>router</primary>
34683 <secondary>home directory for</secondary>
34684 </indexterm>
34685 <indexterm role="concept">
34686 <primary>home directory</primary>
34687 <secondary>for router</secondary>
34688 </indexterm>
34689 <indexterm role="variable">
34690 <primary><varname>$home</varname></primary>
34691 </indexterm>
34692 This option sets a home directory for use while the router is running. (Compare
34693 <option>transport_home_directory</option>, which sets a home directory for later
34694 transporting.) In particular, if used on a <command>redirect</command> router, this option
34695 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
34696 forced expansion failure causes the option to be ignored &ndash; other failures
34697 cause the router to defer.
34698 </para>
34699 <para>
34700 Expansion of <option>router_home_directory</option> happens immediately after the
34701 <option>check_local_user</option> test (if configured), before any further expansions take
34702 place.
34703 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34704 are evaluated.)
34705 While the router is running, <option>router_home_directory</option> overrides the value of
34706 <varname>$home</varname> that came from <option>check_local_user</option>.
34707 </para>
34708 <para>
34709 When a router accepts an address and assigns it to a local transport (including
34710 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
34711 delivery), the home directory setting for the transport is taken from the first
34712 of these values that is set:
34713 </para>
34714 <itemizedlist>
34715 <listitem>
34716 <para>
34717 The <option>home_directory</option> option on the transport;
34718 </para>
34719 </listitem>
34720 <listitem>
34721 <para>
34722 The <option>transport_home_directory</option> option on the router;
34723 </para>
34724 </listitem>
34725 <listitem>
34726 <para>
34727 The password data if <option>check_local_user</option> is set on the router;
34728 </para>
34729 </listitem>
34730 <listitem>
34731 <para>
34732 The <option>router_home_directory</option> option on the router.
34733 </para>
34734 </listitem>
34735 </itemizedlist>
34736 <para>
34737 In other words, <option>router_home_directory</option> overrides the password data for the
34738 router, but not for the transport.
34739 </para>
34740 <para>
34741 <indexterm role="option">
34742 <primary><option>self</option></primary>
34743 </indexterm>
34744 </para>
34745 <informaltable frame="all">
34746 <tgroup cols="4" colsep="0" rowsep="0">
34747 <colspec colwidth="8*" align="left"/>
34748 <colspec colwidth="6*" align="center"/>
34749 <colspec colwidth="6*" align="center"/>
34750 <colspec colwidth="6*" align="right"/>
34751 <tbody>
34752 <row>
34753 <entry><option>self</option></entry>
34754 <entry>Use: <emphasis>routers</emphasis></entry>
34755 <entry>Type: <emphasis>string</emphasis></entry>
34756 <entry>Default: <emphasis>freeze</emphasis></entry>
34757 </row>
34758 </tbody>
34759 </tgroup>
34760 </informaltable>
34761 <para>
34762 <indexterm role="concept">
34763 <primary>MX record</primary>
34764 <secondary>pointing to local host</secondary>
34765 </indexterm>
34766 <indexterm role="concept">
34767 <primary>local host</primary>
34768 <secondary>MX pointing to</secondary>
34769 </indexterm>
34770 This option applies to those routers that use a recipient address to find a
34771 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
34772 and <command>manualroute</command> routers.
34773 Certain configurations of the <command>queryprogram</command> router can also specify a list
34774 of remote hosts.
34775 Usually such routers are configured to send the message to a remote host via an
34776 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
34777 host on the list turns out to be the local host.
34778 The way in which Exim checks for the local host is described in section
34779 <xref linkend="SECTreclocipadd"/>.
34780 </para>
34781 <para>
34782 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
34783 example, the router should be configured not to process this domain), or an
34784 error in the DNS (for example, the MX should not point to this host). For this
34785 reason, the default action is to log the incident, defer the address, and
34786 freeze the message. The following alternatives are provided for use in special
34787 cases:
34788 </para>
34789 <variablelist>
34790 <varlistentry>
34791 <term><option>defer</option></term>
34792 <listitem>
34793 <para>
34794 Delivery of the message is tried again later, but the message is not frozen.
34795 </para>
34796 </listitem></varlistentry>
34797 <varlistentry>
34798 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
34799 <listitem>
34800 <para>
34801 The domain is changed to the given domain, and the address is passed back to
34802 be reprocessed by the routers. No rewriting of headers takes place. This
34803 behaviour is essentially a redirection.
34804 </para>
34805 </listitem></varlistentry>
34806 <varlistentry>
34807 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
34808 <listitem>
34809 <para>
34810 The domain is changed to the given domain, and the address is passed back to be
34811 reprocessed by the routers. Any headers that contain the original domain are
34812 rewritten.
34813 </para>
34814 </listitem></varlistentry>
34815 <varlistentry>
34816 <term><option>pass</option></term>
34817 <listitem>
34818 <para>
34819 <indexterm role="option">
34820 <primary><option>more</option></primary>
34821 </indexterm>
34822 <indexterm role="variable">
34823 <primary><varname>$self_hostname</varname></primary>
34824 </indexterm>
34825 The router passes the address to the next router, or to the router named in the
34826 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
34827 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
34828 name of the local host that the router encountered. This can be used to
34829 distinguish between different cases for hosts with multiple names. The
34830 combination
34831 </para>
34832 <literallayout class="monospaced">
34833 self = pass
34834 no_more
34835 </literallayout>
34836 <para>
34837 ensures that only those addresses that routed to the local host are passed on.
34838 Without <option>no_more</option>, addresses that were declined for other reasons would also
34839 be passed to the next router.
34840 </para>
34841 </listitem></varlistentry>
34842 <varlistentry>
34843 <term><option>fail</option></term>
34844 <listitem>
34845 <para>
34846 Delivery fails and an error report is generated.
34847 </para>
34848 </listitem></varlistentry>
34849 <varlistentry>
34850 <term><option>send</option></term>
34851 <listitem>
34852 <para>
34853 <indexterm role="concept">
34854 <primary>local host</primary>
34855 <secondary>sending to</secondary>
34856 </indexterm>
34857 The anomaly is ignored and the address is queued for the transport. This
34858 setting should be used with extreme caution. For an <command>smtp</command> transport, it
34859 makes sense only in cases where the program that is listening on the SMTP port
34860 is not this version of Exim. That is, it must be some other MTA, or Exim with a
34861 different configuration file that handles the domain in another way.
34862 </para>
34863 </listitem></varlistentry>
34864 </variablelist>
34865 <para>
34866 <indexterm role="option">
34867 <primary><option>senders</option></primary>
34868 </indexterm>
34869 </para>
34870 <informaltable frame="all">
34871 <tgroup cols="4" colsep="0" rowsep="0">
34872 <colspec colwidth="8*" align="left"/>
34873 <colspec colwidth="6*" align="center"/>
34874 <colspec colwidth="6*" align="center"/>
34875 <colspec colwidth="6*" align="right"/>
34876 <tbody>
34877 <row>
34878 <entry><option>senders</option></entry>
34879 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34880 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34881 <entry>Default: <emphasis>unset</emphasis></entry>
34882 </row>
34883 </tbody>
34884 </tgroup>
34885 </informaltable>
34886 <para>
34887 <indexterm role="concept">
34888 <primary>router</primary>
34889 <secondary>checking senders</secondary>
34890 </indexterm>
34891 If this option is set, the router is skipped unless the message&#x2019;s sender
34892 address matches something on the list.
34893 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34894 are evaluated.
34895 </para>
34896 <para>
34897 There are issues concerning verification when the running of routers is
34898 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
34899 setting, it sets the sender to the null string. When using the <option>-bt</option> option
34900 to check a configuration file, it is necessary also to use the <option>-f</option> option to
34901 set an appropriate sender. For incoming mail, the sender is unset when
34902 verifying the sender, but is available when verifying any recipients. If the
34903 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
34904 matters.
34905 </para>
34906 <para>
34907 <indexterm role="option">
34908 <primary><option>translate_ip_address</option></primary>
34909 </indexterm>
34910 </para>
34911 <informaltable frame="all">
34912 <tgroup cols="4" colsep="0" rowsep="0">
34913 <colspec colwidth="8*" align="left"/>
34914 <colspec colwidth="6*" align="center"/>
34915 <colspec colwidth="6*" align="center"/>
34916 <colspec colwidth="6*" align="right"/>
34917 <tbody>
34918 <row>
34919 <entry><option>translate_ip_address</option></entry>
34920 <entry>Use: <emphasis>routers</emphasis></entry>
34921 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34922 <entry>Default: <emphasis>unset</emphasis></entry>
34923 </row>
34924 </tbody>
34925 </tgroup>
34926 </informaltable>
34927 <para>
34928 <indexterm role="concept">
34929 <primary>IP address</primary>
34930 <secondary>translating</secondary>
34931 </indexterm>
34932 <indexterm role="concept">
34933 <primary>packet radio</primary>
34934 </indexterm>
34935 <indexterm role="concept">
34936 <primary>router</primary>
34937 <secondary>IP address translation</secondary>
34938 </indexterm>
34939 There exist some rare networking situations (for example, packet radio) where
34940 it is helpful to be able to translate IP addresses generated by normal routing
34941 mechanisms into other IP addresses, thus performing a kind of manual IP
34942 routing. This should be done only if the normal IP routing of the TCP/IP stack
34943 is inadequate or broken. Because this is an extremely uncommon requirement, the
34944 code to support this option is not included in the Exim binary unless
34945 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
34946 </para>
34947 <para>
34948 <indexterm role="variable">
34949 <primary><varname>$host_address</varname></primary>
34950 </indexterm>
34951 The <option>translate_ip_address</option> string is expanded for every IP address generated
34952 by the router, with the generated address set in <varname>$host_address</varname>. If the
34953 expansion is forced to fail, no action is taken.
34954 For any other expansion error, delivery of the message is deferred.
34955 If the result of the expansion is an IP address, that replaces the original
34956 address; otherwise the result is assumed to be a host name &ndash; this is looked
34957 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
34958 produce one or more replacement IP addresses. For example, to subvert all IP
34959 addresses in some specific networks, this could be added to a router:
34960 </para>
34961 <literallayout class="monospaced">
34962 translate_ip_address = \
34963   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
34964     {$value}fail}}
34965 </literallayout>
34966 <para>
34967 The file would contain lines like
34968 </para>
34969 <literallayout class="monospaced">
34970 10.2.3.128/26    some.host
34971 10.8.4.34/26     10.44.8.15
34972 </literallayout>
34973 <para>
34974 You should not make use of this facility unless you really understand what you
34975 are doing.
34976 </para>
34977 <para>
34978 <indexterm role="option">
34979 <primary><option>transport</option></primary>
34980 </indexterm>
34981 </para>
34982 <informaltable frame="all">
34983 <tgroup cols="4" colsep="0" rowsep="0">
34984 <colspec colwidth="8*" align="left"/>
34985 <colspec colwidth="6*" align="center"/>
34986 <colspec colwidth="6*" align="center"/>
34987 <colspec colwidth="6*" align="right"/>
34988 <tbody>
34989 <row>
34990 <entry><option>transport</option></entry>
34991 <entry>Use: <emphasis>routers</emphasis></entry>
34992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34993 <entry>Default: <emphasis>unset</emphasis></entry>
34994 </row>
34995 </tbody>
34996 </tgroup>
34997 </informaltable>
34998 <para>
34999 This option specifies the transport to be used when a router accepts an address
35000 and sets it up for delivery. A transport is never needed if a router is used
35001 only for verification. The value of the option is expanded at routing time,
35002 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
35003 and result must be the name of one of the configured transports. If it is not,
35004 delivery is deferred.
35005 </para>
35006 <para>
35007 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
35008 have some private options that set up transports for pipe and file deliveries
35009 (see chapter <xref linkend="CHAPredirect"/>).
35010 </para>
35011 <para>
35012 <indexterm role="option">
35013 <primary><option>transport_current_directory</option></primary>
35014 </indexterm>
35015 </para>
35016 <informaltable frame="all">
35017 <tgroup cols="4" colsep="0" rowsep="0">
35018 <colspec colwidth="8*" align="left"/>
35019 <colspec colwidth="6*" align="center"/>
35020 <colspec colwidth="6*" align="center"/>
35021 <colspec colwidth="6*" align="right"/>
35022 <tbody>
35023 <row>
35024 <entry><option>transport_current_directory</option></entry>
35025 <entry>Use: <emphasis>routers</emphasis></entry>
35026 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35027 <entry>Default: <emphasis>unset</emphasis></entry>
35028 </row>
35029 </tbody>
35030 </tgroup>
35031 </informaltable>
35032 <para>
35033 <indexterm role="concept">
35034 <primary>current directory for local transport</primary>
35035 </indexterm>
35036 This option associates a current directory with any address that is routed
35037 to a local transport. This can happen either because a transport is
35038 explicitly configured for the router, or because it generates a delivery to a
35039 file or a pipe. During the delivery process (that is, at transport time), this
35040 option string is expanded and is set as the current directory, unless
35041 overridden by a setting on the transport.
35042 If the expansion fails for any reason, including forced failure, an error is
35043 logged, and delivery is deferred.
35044 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
35045 environment.
35046 </para>
35047 <para>
35048 <indexterm role="option">
35049 <primary><option>transport_home_directory</option></primary>
35050 </indexterm>
35051 </para>
35052 <informaltable frame="all">
35053 <tgroup cols="4" colsep="0" rowsep="0">
35054 <colspec colwidth="8*" align="left"/>
35055 <colspec colwidth="6*" align="center"/>
35056 <colspec colwidth="6*" align="center"/>
35057 <colspec colwidth="6*" align="right"/>
35058 <tbody>
35059 <row>
35060 <entry><option>transport_home_directory</option></entry>
35061 <entry>Use: <emphasis>routers</emphasis></entry>
35062 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35063 <entry>Default: <emphasis>see below</emphasis></entry>
35064 </row>
35065 </tbody>
35066 </tgroup>
35067 </informaltable>
35068 <para>
35069 <indexterm role="concept">
35070 <primary>home directory</primary>
35071 <secondary>for local transport</secondary>
35072 </indexterm>
35073 This option associates a home directory with any address that is routed to a
35074 local transport. This can happen either because a transport is explicitly
35075 configured for the router, or because it generates a delivery to a file or a
35076 pipe. During the delivery process (that is, at transport time), the option
35077 string is expanded and is set as the home directory, unless overridden by a
35078 setting of <option>home_directory</option> on the transport.
35079 If the expansion fails for any reason, including forced failure, an error is
35080 logged, and delivery is deferred.
35081 </para>
35082 <para>
35083 If the transport does not specify a home directory, and
35084 <option>transport_home_directory</option> is not set for the router, the home directory for
35085 the transport is taken from the password data if <option>check_local_user</option> is set for
35086 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
35087 is set; if not, no home directory is set for the transport.
35088 </para>
35089 <para>
35090 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
35091 environment.
35092 </para>
35093 <para>
35094 <indexterm role="option">
35095 <primary><option>unseen</option></primary>
35096 </indexterm>
35097 </para>
35098 <informaltable frame="all">
35099 <tgroup cols="4" colsep="0" rowsep="0">
35100 <colspec colwidth="8*" align="left"/>
35101 <colspec colwidth="6*" align="center"/>
35102 <colspec colwidth="6*" align="center"/>
35103 <colspec colwidth="6*" align="right"/>
35104 <tbody>
35105 <row>
35106 <entry><option>unseen</option></entry>
35107 <entry>Use: <emphasis>routers</emphasis></entry>
35108 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
35109 <entry>Default: <emphasis>false</emphasis></entry>
35110 </row>
35111 </tbody>
35112 </tgroup>
35113 </informaltable>
35114 <para>
35115 <indexterm role="concept">
35116 <primary>router</primary>
35117 <secondary>carrying on after success</secondary>
35118 </indexterm>
35119 The result of string expansion for this option must be a valid boolean value,
35120 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
35121 result causes an error, and delivery is deferred. If the expansion is forced to
35122 fail, the default value for the option (false) is used. Other failures cause
35123 delivery to be deferred.
35124 </para>
35125 <para>
35126 When this option is set true, routing does not cease if the router accepts the
35127 address. Instead, a copy of the incoming address is passed to the next router,
35128 overriding a false setting of <option>more</option>. There is little point in setting
35129 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
35130 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
35131 sometimes true and sometimes false).
35132 </para>
35133 <para>
35134 <indexterm role="concept">
35135 <primary>copy of message (<option>unseen</option> option)</primary>
35136 </indexterm>
35137 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
35138 qualifier in filter files. It can be used to cause copies of messages to be
35139 delivered to some other destination, while also carrying out a normal delivery.
35140 In effect, the current address is made into a <quote>parent</quote> that has two children
35141 &ndash; one that is delivered as specified by this router, and a clone that goes on
35142 to be routed further. For this reason, <option>unseen</option> may not be combined with the
35143 <option>one_time</option> option in a <command>redirect</command> router.
35144 </para>
35145 <para>
35146 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
35147 this router or by previous routers affect the <quote>unseen</quote> copy of the message
35148 only. The clone that continues to be processed by further routers starts with
35149 no added headers and none specified for removal. For a <option>redirect</option> router, if
35150 a generated address is the same as the incoming address, this can lead to
35151 duplicate addresses with different header modifications. Exim does not do
35152 duplicate deliveries (except, in certain circumstances, to pipes -- see section
35153 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
35154 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
35155 <option>redirect</option> router may be of help.
35156 </para>
35157 <para>
35158 Unlike the handling of header modifications, any data that was set by the
35159 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
35160 subsequent routers.
35161 </para>
35162 <para>
35163 <indexterm role="option">
35164 <primary><option>user</option></primary>
35165 </indexterm>
35166 </para>
35167 <informaltable frame="all">
35168 <tgroup cols="4" colsep="0" rowsep="0">
35169 <colspec colwidth="8*" align="left"/>
35170 <colspec colwidth="6*" align="center"/>
35171 <colspec colwidth="6*" align="center"/>
35172 <colspec colwidth="6*" align="right"/>
35173 <tbody>
35174 <row>
35175 <entry><option>user</option></entry>
35176 <entry>Use: <emphasis>routers</emphasis></entry>
35177 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35178 <entry>Default: <emphasis>see below</emphasis></entry>
35179 </row>
35180 </tbody>
35181 </tgroup>
35182 </informaltable>
35183 <para>
35184 <indexterm role="concept">
35185 <primary>uid (user id)</primary>
35186 <secondary>local delivery</secondary>
35187 </indexterm>
35188 <indexterm role="concept">
35189 <primary>local transports</primary>
35190 <secondary>uid and gid</secondary>
35191 </indexterm>
35192 <indexterm role="concept">
35193 <primary>transport</primary>
35194 <secondary>local</secondary>
35195 </indexterm>
35196 <indexterm role="concept">
35197 <primary>router</primary>
35198 <secondary>user for filter processing</secondary>
35199 </indexterm>
35200 <indexterm role="concept">
35201 <primary>filter</primary>
35202 <secondary>user for processing</secondary>
35203 </indexterm>
35204 When a router queues an address for a transport, and the transport does not
35205 specify a user, the user given here is used when running the delivery process.
35206 The user may be specified numerically or by name. If expansion fails, the
35207 error is logged and delivery is deferred.
35208 This user is also used by the <command>redirect</command> router when running a filter file.
35209 The default is unset, except when <option>check_local_user</option> is set. In this case,
35210 the default is taken from the password information. If the user is specified as
35211 a name, and <option>group</option> is not set, the group associated with the user is used.
35212 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
35213 <xref linkend="CHAPenvironment"/>.
35214 </para>
35215 <para>
35216 <indexterm role="option">
35217 <primary><option>verify</option></primary>
35218 </indexterm>
35219 </para>
35220 <informaltable frame="all">
35221 <tgroup cols="4" colsep="0" rowsep="0">
35222 <colspec colwidth="8*" align="left"/>
35223 <colspec colwidth="6*" align="center"/>
35224 <colspec colwidth="6*" align="center"/>
35225 <colspec colwidth="6*" align="right"/>
35226 <tbody>
35227 <row>
35228 <entry><option>verify</option></entry>
35229 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35230 <entry>Type: <emphasis>boolean</emphasis></entry>
35231 <entry>Default: <emphasis>true</emphasis></entry>
35232 </row>
35233 </tbody>
35234 </tgroup>
35235 </informaltable>
35236 <para>
35237 Setting this option has the effect of setting <option>verify_sender</option> and
35238 <option>verify_recipient</option> to the same value.
35239 </para>
35240 <para>
35241 <indexterm role="option">
35242 <primary><option>verify_only</option></primary>
35243 </indexterm>
35244 </para>
35245 <informaltable frame="all">
35246 <tgroup cols="4" colsep="0" rowsep="0">
35247 <colspec colwidth="8*" align="left"/>
35248 <colspec colwidth="6*" align="center"/>
35249 <colspec colwidth="6*" align="center"/>
35250 <colspec colwidth="6*" align="right"/>
35251 <tbody>
35252 <row>
35253 <entry><option>verify_only</option></entry>
35254 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35255 <entry>Type: <emphasis>boolean</emphasis></entry>
35256 <entry>Default: <emphasis>false</emphasis></entry>
35257 </row>
35258 </tbody>
35259 </tgroup>
35260 </informaltable>
35261 <para>
35262 <indexterm role="concept">
35263 <primary>EXPN</primary>
35264 <secondary>with <option>verify_only</option></secondary>
35265 </indexterm>
35266 <indexterm role="option">
35267 <primary><option>-bv</option></primary>
35268 </indexterm>
35269 <indexterm role="concept">
35270 <primary>router</primary>
35271 <secondary>used only when verifying</secondary>
35272 </indexterm>
35273 If this option is set, the router is used only when verifying an address,
35274 delivering in cutthrough mode or
35275 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
35276 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
35277 restricted to verifying only senders or recipients by means of
35278 <option>verify_sender</option> and <option>verify_recipient</option>.
35279 </para>
35280 <para>
35281 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
35282 SMTP message, Exim is not running as root, but under its own uid. If the router
35283 accesses any files, you need to make sure that they are accessible to the Exim
35284 user or group.
35285 </para>
35286 <para>
35287 <indexterm role="option">
35288 <primary><option>verify_recipient</option></primary>
35289 </indexterm>
35290 </para>
35291 <informaltable frame="all">
35292 <tgroup cols="4" colsep="0" rowsep="0">
35293 <colspec colwidth="8*" align="left"/>
35294 <colspec colwidth="6*" align="center"/>
35295 <colspec colwidth="6*" align="center"/>
35296 <colspec colwidth="6*" align="right"/>
35297 <tbody>
35298 <row>
35299 <entry><option>verify_recipient</option></entry>
35300 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35301 <entry>Type: <emphasis>boolean</emphasis></entry>
35302 <entry>Default: <emphasis>true</emphasis></entry>
35303 </row>
35304 </tbody>
35305 </tgroup>
35306 </informaltable>
35307 <para>
35308 If this option is false, the router is skipped when verifying recipient
35309 addresses,
35310 delivering in cutthrough mode
35311 or testing recipient verification using <option>-bv</option>.
35312 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35313 are evaluated.
35314 See also the <varname>$verify_mode</varname> variable.
35315 </para>
35316 <para>
35317 <indexterm role="option">
35318 <primary><option>verify_sender</option></primary>
35319 </indexterm>
35320 </para>
35321 <informaltable frame="all">
35322 <tgroup cols="4" colsep="0" rowsep="0">
35323 <colspec colwidth="8*" align="left"/>
35324 <colspec colwidth="6*" align="center"/>
35325 <colspec colwidth="6*" align="center"/>
35326 <colspec colwidth="6*" align="right"/>
35327 <tbody>
35328 <row>
35329 <entry><option>verify_sender</option></entry>
35330 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35331 <entry>Type: <emphasis>boolean</emphasis></entry>
35332 <entry>Default: <emphasis>true</emphasis></entry>
35333 </row>
35334 </tbody>
35335 </tgroup>
35336 </informaltable>
35337 <para>
35338 If this option is false, the router is skipped when verifying sender addresses
35339 or testing sender verification using <option>-bvs</option>.
35340 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35341 are evaluated.
35342 See also the <varname>$verify_mode</varname> variable.
35343 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
35344 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
35345 </para>
35346 </chapter>
35347
35348 <chapter id="CHID4">
35349 <title>The accept router</title>
35350 <para>
35351 <indexterm role="concept">
35352 <primary><command>accept</command> router</primary>
35353 </indexterm>
35354 <indexterm role="concept">
35355 <primary>routers</primary>
35356 <secondary><command>accept</command></secondary>
35357 </indexterm>
35358 The <command>accept</command> router has no private options of its own. Unless it is being
35359 used purely for verification (see <option>verify_only</option>) a transport is required to
35360 be defined by the generic <option>transport</option> option. If the preconditions that are
35361 specified by generic options are met, the router accepts the address and queues
35362 it for the given transport. The most common use of this router is for setting
35363 up deliveries to local mailboxes. For example:
35364 </para>
35365 <literallayout class="monospaced">
35366 localusers:
35367   driver = accept
35368   domains = mydomain.example
35369   check_local_user
35370   transport = local_delivery
35371 </literallayout>
35372 <para>
35373 The <option>domains</option> condition in this example checks the domain of the address, and
35374 <option>check_local_user</option> checks that the local part is the login of a local user.
35375 When both preconditions are met, the <command>accept</command> router runs, and queues the
35376 address for the <command>local_delivery</command> transport.
35377 </para>
35378 </chapter>
35379
35380 <chapter id="CHAPdnslookup">
35381 <title>The dnslookup router</title>
35382 <para>
35383 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
35384 <primary><command>dnslookup</command> router</primary>
35385 </indexterm>
35386 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
35387 <primary>routers</primary>
35388 <secondary><command>dnslookup</command></secondary>
35389 </indexterm>
35390 The <command>dnslookup</command> router looks up the hosts that handle mail for the
35391 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
35392 unless <option>verify_only</option> is set.
35393 </para>
35394 <para>
35395 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
35396 SRV records. If none are found, or if SRV support is not configured,
35397 MX records are looked up. If no MX records exist, address records are sought.
35398 However, <option>mx_domains</option> can be set to disable the direct use of address
35399 records.
35400 </para>
35401 <para>
35402 MX records of equal priority are sorted by Exim into a random order. Exim then
35403 looks for address records for the host names obtained from MX or SRV records.
35404 When a host has more than one IP address, they are sorted into a random order,
35405 </para>
35406 <para revisionflag="changed">
35407 except that IPv6 addresses are sorted before IPv4 addresses. If all the
35408 </para>
35409 <para>
35410 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
35411 generic option, the router declines.
35412 </para>
35413 <para>
35414 Unless they have the highest priority (lowest MX value), MX records that point
35415 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
35416 are discarded, together with any other MX records of equal or lower priority.
35417 </para>
35418 <para>
35419 <indexterm role="concept">
35420 <primary>MX record</primary>
35421 <secondary>pointing to local host</secondary>
35422 </indexterm>
35423 <indexterm role="concept">
35424 <primary>local host</primary>
35425 <secondary>MX pointing to</secondary>
35426 </indexterm>
35427 <indexterm role="option">
35428 <primary><option>self</option></primary>
35429 <secondary>in <command>dnslookup</command> router</secondary>
35430 </indexterm>
35431 If the host pointed to by the highest priority MX record, or looked up as an
35432 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
35433 happens is controlled by the generic <option>self</option> option.
35434 </para>
35435 <section id="SECTprowitdnsloo">
35436 <title>Problems with DNS lookups</title>
35437 <para>
35438 There have been problems with DNS servers when SRV records are looked up.
35439 Some misbehaving servers return a DNS error or timeout when a non-existent
35440 SRV record is sought. Similar problems have in the past been reported for
35441 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
35442 problem, but it is heavy-handed because it is a global option.
35443 </para>
35444 <para>
35445 For this reason, there are two options, <option>srv_fail_domains</option> and
35446 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
35447 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
35448 an attempt to look up an SRV or MX record causes one of these results, and the
35449 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
35450 such record</quote>. In the case of an SRV lookup, this means that the router
35451 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
35452 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
35453 case routing fails.
35454 </para>
35455 </section>
35456 <section id="SECTdnslookupdecline">
35457 <title>Declining addresses by dnslookup</title>
35458 <para>
35459 <indexterm role="concept">
35460 <primary><command>dnslookup</command> router</primary>
35461 <secondary>declines</secondary>
35462 </indexterm>
35463 There are a few cases where a <command>dnslookup</command> router will decline to accept
35464 an address; if such a router is expected to handle "all remaining non-local
35465 domains", then it is important to set <option>no_more</option>.
35466 </para>
35467 <para>
35468 The router will defer rather than decline if the domain
35469 is found in the <option>fail_defer_domains</option> router option.
35470 </para>
35471 <para>
35472 Reasons for a <command>dnslookup</command> router to decline currently include:
35473 </para>
35474 <itemizedlist>
35475 <listitem>
35476 <para>
35477 The domain does not exist in DNS
35478 </para>
35479 </listitem>
35480 <listitem>
35481 <para>
35482 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
35483 convention (borrowed from SRV) used to indicate that there is no such service
35484 for this domain and to not fall back to trying A/AAAA records.
35485 </para>
35486 </listitem>
35487 <listitem>
35488 <para>
35489 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
35490 </para>
35491 </listitem>
35492 <listitem>
35493 <para>
35494 MX record points to a non-existent host.
35495 </para>
35496 </listitem>
35497 <listitem>
35498 <para>
35499 MX record points to an IP address and the main section option
35500 <option>allow_mx_to_ip</option> is not set.
35501 </para>
35502 </listitem>
35503 <listitem>
35504 <para>
35505 MX records exist and point to valid hosts, but all hosts resolve only to
35506 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
35507 </para>
35508 </listitem>
35509 <listitem>
35510 <para>
35511 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
35512 <option>dns_check_names_pattern</option> for handling one variant of this)
35513 </para>
35514 </listitem>
35515 <listitem>
35516 <para>
35517 <option>check_secondary_mx</option> is set on this router but the local host can
35518 not be found in the MX records (see below)
35519 </para>
35520 </listitem>
35521 </itemizedlist>
35522 </section>
35523 <section id="SECID118">
35524 <title>Private options for dnslookup</title>
35525 <para>
35526 <indexterm role="concept">
35527 <primary>options</primary>
35528 <secondary><command>dnslookup</command> router</secondary>
35529 </indexterm>
35530 The private options for the <command>dnslookup</command> router are as follows:
35531 </para>
35532 <para>
35533 <indexterm role="option">
35534 <primary><option>check_secondary_mx</option></primary>
35535 </indexterm>
35536 </para>
35537 <informaltable frame="all">
35538 <tgroup cols="4" colsep="0" rowsep="0">
35539 <colspec colwidth="8*" align="left"/>
35540 <colspec colwidth="6*" align="center"/>
35541 <colspec colwidth="6*" align="center"/>
35542 <colspec colwidth="6*" align="right"/>
35543 <tbody>
35544 <row>
35545 <entry><option>check_secondary_mx</option></entry>
35546 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35547 <entry>Type: <emphasis>boolean</emphasis></entry>
35548 <entry>Default: <emphasis>false</emphasis></entry>
35549 </row>
35550 </tbody>
35551 </tgroup>
35552 </informaltable>
35553 <para>
35554 <indexterm role="concept">
35555 <primary>MX record</primary>
35556 <secondary>checking for secondary</secondary>
35557 </indexterm>
35558 If this option is set, the router declines unless the local host is found in
35559 (and removed from) the list of hosts obtained by MX lookup. This can be used to
35560 process domains for which the local host is a secondary mail exchanger
35561 differently to other domains. The way in which Exim decides whether a host is
35562 the local host is described in section <xref linkend="SECTreclocipadd"/>.
35563 </para>
35564 <para>
35565 <indexterm role="option">
35566 <primary><option>check_srv</option></primary>
35567 </indexterm>
35568 </para>
35569 <informaltable frame="all">
35570 <tgroup cols="4" colsep="0" rowsep="0">
35571 <colspec colwidth="8*" align="left"/>
35572 <colspec colwidth="6*" align="center"/>
35573 <colspec colwidth="6*" align="center"/>
35574 <colspec colwidth="6*" align="right"/>
35575 <tbody>
35576 <row>
35577 <entry><option>check_srv</option></entry>
35578 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35580 <entry>Default: <emphasis>unset</emphasis></entry>
35581 </row>
35582 </tbody>
35583 </tgroup>
35584 </informaltable>
35585 <para>
35586 <indexterm role="concept">
35587 <primary>SRV record</primary>
35588 <secondary>enabling use of</secondary>
35589 </indexterm>
35590 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
35591 addition to MX and address records. The support is disabled by default. To
35592 enable SRV support, set the <option>check_srv</option> option to the name of the service
35593 required. For example,
35594 </para>
35595 <literallayout class="monospaced">
35596 check_srv = smtp
35597 </literallayout>
35598 <para>
35599 looks for SRV records that refer to the normal smtp service. The option is
35600 expanded, so the service name can vary from message to message or address
35601 to address. This might be helpful if SRV records are being used for a
35602 submission service. If the expansion is forced to fail, the <option>check_srv</option>
35603 option is ignored, and the router proceeds to look for MX records in the
35604 normal way.
35605 </para>
35606 <para>
35607 When the expansion succeeds, the router searches first for SRV records for
35608 the given service (it assumes TCP protocol). A single SRV record with a
35609 host name that consists of just a single dot indicates <quote>no such service for
35610 this domain</quote>; if this is encountered, the router declines. If other kinds of
35611 SRV record are found, they are used to construct a host list for delivery
35612 according to the rules of RFC 2782. MX records are not sought in this case.
35613 </para>
35614 <para>
35615 When no SRV records are found, MX records (and address records) are sought in
35616 the traditional way. In other words, SRV records take precedence over MX
35617 records, just as MX records take precedence over address records. Note that
35618 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
35619 defined it. It is apparently believed that MX records are sufficient for email
35620 and that SRV records should not be used for this purpose. However, SRV records
35621 have an additional <quote>weight</quote> feature which some people might find useful when
35622 trying to split an SMTP load between hosts of different power.
35623 </para>
35624 <para>
35625 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
35626 when there is a DNS lookup error.
35627 </para>
35628 <para>
35629 <indexterm role="option">
35630 <primary><option>fail_defer_domains</option></primary>
35631 </indexterm>
35632 </para>
35633 <informaltable frame="all">
35634 <tgroup cols="4" colsep="0" rowsep="0">
35635 <colspec colwidth="8*" align="left"/>
35636 <colspec colwidth="6*" align="center"/>
35637 <colspec colwidth="6*" align="center"/>
35638 <colspec colwidth="6*" align="right"/>
35639 <tbody>
35640 <row>
35641 <entry><option>fail_defer_domains</option></entry>
35642 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35643 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35644 <entry>Default: <emphasis>unset</emphasis></entry>
35645 </row>
35646 </tbody>
35647 </tgroup>
35648 </informaltable>
35649 <para>
35650 <indexterm role="concept">
35651 <primary>MX record</primary>
35652 <secondary>not found</secondary>
35653 </indexterm>
35654 DNS lookups for domains matching <option>fail_defer_domains</option>
35655 which find no matching record will cause the router to defer
35656 rather than the default behaviour of decline.
35657 This maybe be useful for queueing messages for a newly created
35658 domain while the DNS configuration is not ready.
35659 However, it will result in any message with mistyped domains
35660 also being queued.
35661 </para>
35662 <para revisionflag="changed">
35663 <indexterm role="option">
35664 <primary><option>ipv4_only</option></primary>
35665 </indexterm>
35666 </para>
35667 <informaltable frame="all" revisionflag="changed">
35668 <tgroup cols="4" colsep="0" rowsep="0">
35669 <colspec colwidth="8*" align="left"/>
35670 <colspec colwidth="6*" align="center"/>
35671 <colspec colwidth="6*" align="center"/>
35672 <colspec colwidth="6*" align="right"/>
35673 <tbody>
35674 <row>
35675 <entry><option>ipv4_only</option></entry>
35676 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35677 <entry>Type: <emphasis>unset</emphasis></entry>
35678 <entry>Default: <emphasis></emphasis></entry>
35679 </row>
35680 </tbody>
35681 </tgroup>
35682 </informaltable>
35683 <para revisionflag="changed">
35684 <indexterm role="concept">
35685 <primary>IPv6</primary>
35686 <secondary>disabling</secondary>
35687 </indexterm>
35688 <indexterm role="concept">
35689 <primary>DNS</primary>
35690 <secondary>IPv6 disabling</secondary>
35691 </indexterm>
35692 The string is expanded, and if the result is anything but a forced failure,
35693 or an empty string, or one of the strings “0” or “no” or “false”
35694 (checked without regard to the case of the letters),
35695 only A records are used.
35696 </para>
35697 <para revisionflag="changed">
35698 <indexterm role="option">
35699 <primary><option>ipv4_prefer</option></primary>
35700 </indexterm>
35701 </para>
35702 <informaltable frame="all" revisionflag="changed">
35703 <tgroup cols="4" colsep="0" rowsep="0">
35704 <colspec colwidth="8*" align="left"/>
35705 <colspec colwidth="6*" align="center"/>
35706 <colspec colwidth="6*" align="center"/>
35707 <colspec colwidth="6*" align="right"/>
35708 <tbody>
35709 <row>
35710 <entry><option>ipv4_prefer</option></entry>
35711 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35712 <entry>Type: <emphasis>unset</emphasis></entry>
35713 <entry>Default: <emphasis></emphasis></entry>
35714 </row>
35715 </tbody>
35716 </tgroup>
35717 </informaltable>
35718 <para revisionflag="changed">
35719 <indexterm role="concept">
35720 <primary>IPv4</primary>
35721 <secondary>preference</secondary>
35722 </indexterm>
35723 <indexterm role="concept">
35724 <primary>DNS</primary>
35725 <secondary>IPv4 preference</secondary>
35726 </indexterm>
35727 The string is expanded, and if the result is anything but a forced failure,
35728 or an empty string, or one of the strings “0” or “no” or “false”
35729 (checked without regard to the case of the letters),
35730 A records are sorted before AAAA records (inverting the default).
35731 </para>
35732 <para>
35733 <indexterm role="option">
35734 <primary><option>mx_domains</option></primary>
35735 </indexterm>
35736 </para>
35737 <informaltable frame="all">
35738 <tgroup cols="4" colsep="0" rowsep="0">
35739 <colspec colwidth="8*" align="left"/>
35740 <colspec colwidth="6*" align="center"/>
35741 <colspec colwidth="6*" align="center"/>
35742 <colspec colwidth="6*" align="right"/>
35743 <tbody>
35744 <row>
35745 <entry><option>mx_domains</option></entry>
35746 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35747 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35748 <entry>Default: <emphasis>unset</emphasis></entry>
35749 </row>
35750 </tbody>
35751 </tgroup>
35752 </informaltable>
35753 <para>
35754 <indexterm role="concept">
35755 <primary>MX record</primary>
35756 <secondary>required to exist</secondary>
35757 </indexterm>
35758 <indexterm role="concept">
35759 <primary>SRV record</primary>
35760 <secondary>required to exist</secondary>
35761 </indexterm>
35762 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
35763 record in order to be recognized. (The name of this option could be improved.)
35764 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
35765 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
35766 setting:
35767 </para>
35768 <literallayout class="monospaced">
35769 mx_domains = ! *.discworld.fict.example : *.fict.example
35770 </literallayout>
35771 <para>
35772 This specifies that messages addressed to a domain that matches the list but
35773 has no MX record should be bounced immediately instead of being routed using
35774 the address record.
35775 </para>
35776 <para>
35777 <indexterm role="option">
35778 <primary><option>mx_fail_domains</option></primary>
35779 </indexterm>
35780 </para>
35781 <informaltable frame="all">
35782 <tgroup cols="4" colsep="0" rowsep="0">
35783 <colspec colwidth="8*" align="left"/>
35784 <colspec colwidth="6*" align="center"/>
35785 <colspec colwidth="6*" align="center"/>
35786 <colspec colwidth="6*" align="right"/>
35787 <tbody>
35788 <row>
35789 <entry><option>mx_fail_domains</option></entry>
35790 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35791 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35792 <entry>Default: <emphasis>unset</emphasis></entry>
35793 </row>
35794 </tbody>
35795 </tgroup>
35796 </informaltable>
35797 <para>
35798 If the DNS lookup for MX records for one of the domains in this list causes a
35799 DNS lookup error, Exim behaves as if no MX records were found. See section
35800 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35801 </para>
35802 <para>
35803 <indexterm role="option">
35804 <primary><option>qualify_single</option></primary>
35805 </indexterm>
35806 </para>
35807 <informaltable frame="all">
35808 <tgroup cols="4" colsep="0" rowsep="0">
35809 <colspec colwidth="8*" align="left"/>
35810 <colspec colwidth="6*" align="center"/>
35811 <colspec colwidth="6*" align="center"/>
35812 <colspec colwidth="6*" align="right"/>
35813 <tbody>
35814 <row>
35815 <entry><option>qualify_single</option></entry>
35816 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35817 <entry>Type: <emphasis>boolean</emphasis></entry>
35818 <entry>Default: <emphasis>true</emphasis></entry>
35819 </row>
35820 </tbody>
35821 </tgroup>
35822 </informaltable>
35823 <para>
35824 <indexterm role="concept">
35825 <primary>DNS</primary>
35826 <secondary>resolver options</secondary>
35827 </indexterm>
35828 <indexterm role="concept">
35829 <primary>DNS</primary>
35830 <secondary>qualifying single-component names</secondary>
35831 </indexterm>
35832 When this option is true, the resolver option RES_DEFNAMES is set for DNS
35833 lookups. Typically, but not standardly, this causes the resolver to qualify
35834 single-component names with the default domain. For example, on a machine
35835 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
35836 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
35837 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
35838 <emphasis>resolv.conf</emphasis>.
35839 </para>
35840 <para>
35841 <indexterm role="option">
35842 <primary><option>rewrite_headers</option></primary>
35843 </indexterm>
35844 </para>
35845 <informaltable frame="all">
35846 <tgroup cols="4" colsep="0" rowsep="0">
35847 <colspec colwidth="8*" align="left"/>
35848 <colspec colwidth="6*" align="center"/>
35849 <colspec colwidth="6*" align="center"/>
35850 <colspec colwidth="6*" align="right"/>
35851 <tbody>
35852 <row>
35853 <entry><option>rewrite_headers</option></entry>
35854 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35855 <entry>Type: <emphasis>boolean</emphasis></entry>
35856 <entry>Default: <emphasis>true</emphasis></entry>
35857 </row>
35858 </tbody>
35859 </tgroup>
35860 </informaltable>
35861 <para>
35862 <indexterm role="concept">
35863 <primary>rewriting</primary>
35864 <secondary>header lines</secondary>
35865 </indexterm>
35866 <indexterm role="concept">
35867 <primary>header lines</primary>
35868 <secondary>rewriting</secondary>
35869 </indexterm>
35870 If the domain name in the address that is being processed is not fully
35871 qualified, it may be expanded to its full form by a DNS lookup. For example, if
35872 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
35873 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
35874 occur as a result of setting the <option>widen_domains</option> option. If
35875 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
35876 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
35877 header lines of the message are rewritten with the full domain name.
35878 </para>
35879 <para>
35880 This option should be turned off only when it is known that no message is
35881 ever going to be sent outside an environment where the abbreviation makes
35882 sense.
35883 </para>
35884 <para>
35885 When an MX record is looked up in the DNS and matches a wildcard record, name
35886 servers normally return a record containing the name that has been looked up,
35887 making it impossible to detect whether a wildcard was present or not. However,
35888 some name servers have recently been seen to return the wildcard entry. If the
35889 name returned by a DNS lookup begins with an asterisk, it is not used for
35890 header rewriting.
35891 </para>
35892 <para>
35893 <indexterm role="option">
35894 <primary><option>same_domain_copy_routing</option></primary>
35895 </indexterm>
35896 </para>
35897 <informaltable frame="all">
35898 <tgroup cols="4" colsep="0" rowsep="0">
35899 <colspec colwidth="8*" align="left"/>
35900 <colspec colwidth="6*" align="center"/>
35901 <colspec colwidth="6*" align="center"/>
35902 <colspec colwidth="6*" align="right"/>
35903 <tbody>
35904 <row>
35905 <entry><option>same_domain_copy_routing</option></entry>
35906 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35907 <entry>Type: <emphasis>boolean</emphasis></entry>
35908 <entry>Default: <emphasis>false</emphasis></entry>
35909 </row>
35910 </tbody>
35911 </tgroup>
35912 </informaltable>
35913 <para>
35914 <indexterm role="concept">
35915 <primary>address</primary>
35916 <secondary>copying routing</secondary>
35917 </indexterm>
35918 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
35919 to the same list of hosts. However, this cannot be presumed, because the router
35920 options and preconditions may refer to the local part of the address. By
35921 default, therefore, Exim routes each address in a message independently. DNS
35922 servers run caches, so repeated DNS lookups are not normally expensive, and in
35923 any case, personal messages rarely have more than a few recipients.
35924 </para>
35925 <para>
35926 If you are running mailing lists with large numbers of subscribers at the same
35927 domain, and you are using a <command>dnslookup</command> router which is independent of the
35928 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35929 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
35930 routes an address to a remote transport, any other unrouted addresses in the
35931 message that have the same domain are automatically given the same routing
35932 without processing them independently,
35933 provided the following conditions are met:
35934 </para>
35935 <itemizedlist>
35936 <listitem>
35937 <para>
35938 No router that processed the address specified <option>headers_add</option> or
35939 <option>headers_remove</option>.
35940 </para>
35941 </listitem>
35942 <listitem>
35943 <para>
35944 The router did not change the address in any way, for example, by <quote>widening</quote>
35945 the domain.
35946 </para>
35947 </listitem>
35948 </itemizedlist>
35949 <para>
35950 <indexterm role="option">
35951 <primary><option>search_parents</option></primary>
35952 </indexterm>
35953 </para>
35954 <informaltable frame="all">
35955 <tgroup cols="4" colsep="0" rowsep="0">
35956 <colspec colwidth="8*" align="left"/>
35957 <colspec colwidth="6*" align="center"/>
35958 <colspec colwidth="6*" align="center"/>
35959 <colspec colwidth="6*" align="right"/>
35960 <tbody>
35961 <row>
35962 <entry><option>search_parents</option></entry>
35963 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35964 <entry>Type: <emphasis>boolean</emphasis></entry>
35965 <entry>Default: <emphasis>false</emphasis></entry>
35966 </row>
35967 </tbody>
35968 </tgroup>
35969 </informaltable>
35970 <para>
35971 <indexterm role="concept">
35972 <primary>DNS</primary>
35973 <secondary>resolver options</secondary>
35974 </indexterm>
35975 When this option is true, the resolver option RES_DNSRCH is set for DNS
35976 lookups. This is different from the <option>qualify_single</option> option in that it
35977 applies to domains containing dots. Typically, but not standardly, it causes
35978 the resolver to search for the name in the current domain and in parent
35979 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
35980 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
35981 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
35982 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
35983 </para>
35984 <para>
35985 Setting this option true can cause problems in domains that have a wildcard MX
35986 record, because any domain that does not have its own MX record matches the
35987 local wildcard.
35988 </para>
35989 <para>
35990 <indexterm role="option">
35991 <primary><option>srv_fail_domains</option></primary>
35992 </indexterm>
35993 </para>
35994 <informaltable frame="all">
35995 <tgroup cols="4" colsep="0" rowsep="0">
35996 <colspec colwidth="8*" align="left"/>
35997 <colspec colwidth="6*" align="center"/>
35998 <colspec colwidth="6*" align="center"/>
35999 <colspec colwidth="6*" align="right"/>
36000 <tbody>
36001 <row>
36002 <entry><option>srv_fail_domains</option></entry>
36003 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36004 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36005 <entry>Default: <emphasis>unset</emphasis></entry>
36006 </row>
36007 </tbody>
36008 </tgroup>
36009 </informaltable>
36010 <para>
36011 If the DNS lookup for SRV records for one of the domains in this list causes a
36012 DNS lookup error, Exim behaves as if no SRV records were found. See section
36013 <xref linkend="SECTprowitdnsloo"/> for more discussion.
36014 </para>
36015 <para>
36016 <indexterm role="option">
36017 <primary><option>widen_domains</option></primary>
36018 </indexterm>
36019 </para>
36020 <informaltable frame="all">
36021 <tgroup cols="4" colsep="0" rowsep="0">
36022 <colspec colwidth="8*" align="left"/>
36023 <colspec colwidth="6*" align="center"/>
36024 <colspec colwidth="6*" align="center"/>
36025 <colspec colwidth="6*" align="right"/>
36026 <tbody>
36027 <row>
36028 <entry><option>widen_domains</option></entry>
36029 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36030 <entry>Type: <emphasis>string list</emphasis></entry>
36031 <entry>Default: <emphasis>unset</emphasis></entry>
36032 </row>
36033 </tbody>
36034 </tgroup>
36035 </informaltable>
36036 <para>
36037 <indexterm role="concept">
36038 <primary>domain</primary>
36039 <secondary>partial; widening</secondary>
36040 </indexterm>
36041 If a DNS lookup fails and this option is set, each of its strings in turn is
36042 added onto the end of the domain, and the lookup is tried again. For example,
36043 if
36044 </para>
36045 <literallayout class="monospaced">
36046 widen_domains = fict.example:ref.example
36047 </literallayout>
36048 <para>
36049 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
36050 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
36051 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
36052 and <option>search_parents</option> options can cause some widening to be undertaken inside
36053 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
36054 when verifying, unless <option>rewrite_headers</option> is false (not the default).
36055 </para>
36056 </section>
36057 <section id="SECID119">
36058 <title>Effect of qualify_single and search_parents</title>
36059 <para>
36060 When a domain from an envelope recipient is changed by the resolver as a result
36061 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
36062 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
36063 is set false. Exim then re-routes the address, using the full domain.
36064 </para>
36065 <para>
36066 These two options affect only the DNS lookup that takes place inside the router
36067 for the domain of the address that is being routed. They do not affect lookups
36068 such as that implied by
36069 </para>
36070 <literallayout class="monospaced">
36071 domains = @mx_any
36072 </literallayout>
36073 <para>
36074 that may happen while processing a router precondition before the router is
36075 entered. No widening ever takes place for these lookups.
36076 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
36077 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
36078 </para>
36079 </section>
36080 </chapter>
36081
36082 <chapter id="CHID5">
36083 <title>The ipliteral router</title>
36084 <para>
36085 <indexterm role="concept">
36086 <primary><command>ipliteral</command> router</primary>
36087 </indexterm>
36088 <indexterm role="concept">
36089 <primary>domain literal</primary>
36090 <secondary>routing</secondary>
36091 </indexterm>
36092 <indexterm role="concept">
36093 <primary>routers</primary>
36094 <secondary><command>ipliteral</command></secondary>
36095 </indexterm>
36096 This router has no private options. Unless it is being used purely for
36097 verification (see <option>verify_only</option>) a transport is required to be defined by the
36098 generic <option>transport</option> option. The router accepts the address if its domain part
36099 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
36100 router handles the address
36101 </para>
36102 <literallayout class="monospaced">
36103 root@[192.168.1.1]
36104 </literallayout>
36105 <para>
36106 by setting up delivery to the host with that IP address. IPv4 domain literals
36107 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
36108 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
36109 </para>
36110 <literallayout class="monospaced">
36111 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
36112 </literallayout>
36113 <para>
36114 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
36115 grounds that sooner or later somebody will try it.
36116 </para>
36117 <para>
36118 <indexterm role="option">
36119 <primary><option>self</option></primary>
36120 <secondary>in <command>ipliteral</command> router</secondary>
36121 </indexterm>
36122 If the IP address matches something in <option>ignore_target_hosts</option>, the router
36123 declines. If an IP literal turns out to refer to the local host, the generic
36124 <option>self</option> option determines what happens.
36125 </para>
36126 <para>
36127 The RFCs require support for domain literals; however, their use is
36128 controversial in today&#x2019;s Internet. If you want to use this router, you must
36129 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
36130 Exim will not recognize the domain literal syntax in addresses.
36131 </para>
36132 </chapter>
36133
36134 <chapter id="CHID6">
36135 <title>The iplookup router</title>
36136 <para>
36137 <indexterm role="concept">
36138 <primary><command>iplookup</command> router</primary>
36139 </indexterm>
36140 <indexterm role="concept">
36141 <primary>routers</primary>
36142 <secondary><command>iplookup</command></secondary>
36143 </indexterm>
36144 The <command>iplookup</command> router was written to fulfil a specific requirement in
36145 Cambridge University (which in fact no longer exists). For this reason, it is
36146 not included in the binary of Exim by default. If you want to include it, you
36147 must set
36148 </para>
36149 <literallayout class="monospaced">
36150 ROUTER_IPLOOKUP=yes
36151 </literallayout>
36152 <para>
36153 in your <filename>Local/Makefile</filename> configuration file.
36154 </para>
36155 <para>
36156 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
36157 connection to one or more specific hosts. The host can then return the same or
36158 a different address &ndash; in effect rewriting the recipient address in the
36159 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
36160 this process fails, the address can be passed on to other routers, or delivery
36161 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
36162 must not be specified for it.
36163 </para>
36164 <para>
36165 <indexterm role="concept">
36166 <primary>options</primary>
36167 <secondary><command>iplookup</command> router</secondary>
36168 </indexterm>
36169 <indexterm role="option">
36170 <primary><option>hosts</option></primary>
36171 </indexterm>
36172 </para>
36173 <informaltable frame="all">
36174 <tgroup cols="4" colsep="0" rowsep="0">
36175 <colspec colwidth="8*" align="left"/>
36176 <colspec colwidth="6*" align="center"/>
36177 <colspec colwidth="6*" align="center"/>
36178 <colspec colwidth="6*" align="right"/>
36179 <tbody>
36180 <row>
36181 <entry><option>hosts</option></entry>
36182 <entry>Use: <emphasis>iplookup</emphasis></entry>
36183 <entry>Type: <emphasis>string</emphasis></entry>
36184 <entry>Default: <emphasis>unset</emphasis></entry>
36185 </row>
36186 </tbody>
36187 </tgroup>
36188 </informaltable>
36189 <para>
36190 This option must be supplied. Its value is a colon-separated list of host
36191 names. The hosts are looked up using <function>gethostbyname()</function>
36192 (or <function>getipnodebyname()</function> when available)
36193 and are tried in order until one responds to the query. If none respond, what
36194 happens is controlled by <option>optional</option>.
36195 </para>
36196 <para>
36197 <indexterm role="option">
36198 <primary><option>optional</option></primary>
36199 </indexterm>
36200 </para>
36201 <informaltable frame="all">
36202 <tgroup cols="4" colsep="0" rowsep="0">
36203 <colspec colwidth="8*" align="left"/>
36204 <colspec colwidth="6*" align="center"/>
36205 <colspec colwidth="6*" align="center"/>
36206 <colspec colwidth="6*" align="right"/>
36207 <tbody>
36208 <row>
36209 <entry><option>optional</option></entry>
36210 <entry>Use: <emphasis>iplookup</emphasis></entry>
36211 <entry>Type: <emphasis>boolean</emphasis></entry>
36212 <entry>Default: <emphasis>false</emphasis></entry>
36213 </row>
36214 </tbody>
36215 </tgroup>
36216 </informaltable>
36217 <para>
36218 If <option>optional</option> is true, if no response is obtained from any host, the address
36219 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
36220 delivery to the address is deferred.
36221 </para>
36222 <para>
36223 <indexterm role="option">
36224 <primary><option>port</option></primary>
36225 </indexterm>
36226 </para>
36227 <informaltable frame="all">
36228 <tgroup cols="4" colsep="0" rowsep="0">
36229 <colspec colwidth="8*" align="left"/>
36230 <colspec colwidth="6*" align="center"/>
36231 <colspec colwidth="6*" align="center"/>
36232 <colspec colwidth="6*" align="right"/>
36233 <tbody>
36234 <row>
36235 <entry><option>port</option></entry>
36236 <entry>Use: <emphasis>iplookup</emphasis></entry>
36237 <entry>Type: <emphasis>integer</emphasis></entry>
36238 <entry>Default: <emphasis>0</emphasis></entry>
36239 </row>
36240 </tbody>
36241 </tgroup>
36242 </informaltable>
36243 <para>
36244 <indexterm role="concept">
36245 <primary>port</primary>
36246 <secondary><command>iplookup</command> router</secondary>
36247 </indexterm>
36248 This option must be supplied. It specifies the port number for the TCP or UDP
36249 call.
36250 </para>
36251 <para>
36252 <indexterm role="option">
36253 <primary><option>protocol</option></primary>
36254 </indexterm>
36255 </para>
36256 <informaltable frame="all">
36257 <tgroup cols="4" colsep="0" rowsep="0">
36258 <colspec colwidth="8*" align="left"/>
36259 <colspec colwidth="6*" align="center"/>
36260 <colspec colwidth="6*" align="center"/>
36261 <colspec colwidth="6*" align="right"/>
36262 <tbody>
36263 <row>
36264 <entry><option>protocol</option></entry>
36265 <entry>Use: <emphasis>iplookup</emphasis></entry>
36266 <entry>Type: <emphasis>string</emphasis></entry>
36267 <entry>Default: <emphasis>udp</emphasis></entry>
36268 </row>
36269 </tbody>
36270 </tgroup>
36271 </informaltable>
36272 <para>
36273 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
36274 protocols is to be used.
36275 </para>
36276 <para>
36277 <indexterm role="option">
36278 <primary><option>query</option></primary>
36279 </indexterm>
36280 </para>
36281 <informaltable frame="all">
36282 <tgroup cols="4" colsep="0" rowsep="0">
36283 <colspec colwidth="8*" align="left"/>
36284 <colspec colwidth="6*" align="center"/>
36285 <colspec colwidth="6*" align="center"/>
36286 <colspec colwidth="6*" align="right"/>
36287 <tbody>
36288 <row>
36289 <entry><option>query</option></entry>
36290 <entry>Use: <emphasis>iplookup</emphasis></entry>
36291 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36292 <entry>Default: <emphasis>see below</emphasis></entry>
36293 </row>
36294 </tbody>
36295 </tgroup>
36296 </informaltable>
36297 <para>
36298 This defines the content of the query that is sent to the remote hosts. The
36299 default value is:
36300 </para>
36301 <literallayout class="monospaced">
36302 $local_part@$domain $local_part@$domain
36303 </literallayout>
36304 <para>
36305 The repetition serves as a way of checking that a response is to the correct
36306 query in the default case (see <option>response_pattern</option> below).
36307 </para>
36308 <para>
36309 <indexterm role="option">
36310 <primary><option>reroute</option></primary>
36311 </indexterm>
36312 </para>
36313 <informaltable frame="all">
36314 <tgroup cols="4" colsep="0" rowsep="0">
36315 <colspec colwidth="8*" align="left"/>
36316 <colspec colwidth="6*" align="center"/>
36317 <colspec colwidth="6*" align="center"/>
36318 <colspec colwidth="6*" align="right"/>
36319 <tbody>
36320 <row>
36321 <entry><option>reroute</option></entry>
36322 <entry>Use: <emphasis>iplookup</emphasis></entry>
36323 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36324 <entry>Default: <emphasis>unset</emphasis></entry>
36325 </row>
36326 </tbody>
36327 </tgroup>
36328 </informaltable>
36329 <para>
36330 If this option is not set, the rerouted address is precisely the byte string
36331 returned by the remote host, up to the first white space, if any. If set, the
36332 string is expanded to form the rerouted address. It can include parts matched
36333 in the response by <option>response_pattern</option> by means of numeric variables such as
36334 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
36335 whether or not a pattern is in use. In all cases, the rerouted address must end
36336 up in the form <emphasis>local_part@domain</emphasis>.
36337 </para>
36338 <para>
36339 <indexterm role="option">
36340 <primary><option>response_pattern</option></primary>
36341 </indexterm>
36342 </para>
36343 <informaltable frame="all">
36344 <tgroup cols="4" colsep="0" rowsep="0">
36345 <colspec colwidth="8*" align="left"/>
36346 <colspec colwidth="6*" align="center"/>
36347 <colspec colwidth="6*" align="center"/>
36348 <colspec colwidth="6*" align="right"/>
36349 <tbody>
36350 <row>
36351 <entry><option>response_pattern</option></entry>
36352 <entry>Use: <emphasis>iplookup</emphasis></entry>
36353 <entry>Type: <emphasis>string</emphasis></entry>
36354 <entry>Default: <emphasis>unset</emphasis></entry>
36355 </row>
36356 </tbody>
36357 </tgroup>
36358 </informaltable>
36359 <para>
36360 This option can be set to a regular expression that is applied to the string
36361 returned from the remote host. If the pattern does not match the response, the
36362 router declines. If <option>response_pattern</option> is not set, no checking of the
36363 response is done, unless the query was defaulted, in which case there is a
36364 check that the text returned after the first white space is the original
36365 address. This checks that the answer that has been received is in response to
36366 the correct question. For example, if the response is just a new domain, the
36367 following could be used:
36368 </para>
36369 <literallayout class="monospaced">
36370 response_pattern = ^([^@]+)$
36371 reroute = $local_part@$1
36372 </literallayout>
36373 <para>
36374 <indexterm role="option">
36375 <primary><option>timeout</option></primary>
36376 </indexterm>
36377 </para>
36378 <informaltable frame="all">
36379 <tgroup cols="4" colsep="0" rowsep="0">
36380 <colspec colwidth="8*" align="left"/>
36381 <colspec colwidth="6*" align="center"/>
36382 <colspec colwidth="6*" align="center"/>
36383 <colspec colwidth="6*" align="right"/>
36384 <tbody>
36385 <row>
36386 <entry><option>timeout</option></entry>
36387 <entry>Use: <emphasis>iplookup</emphasis></entry>
36388 <entry>Type: <emphasis>time</emphasis></entry>
36389 <entry>Default: <emphasis>5s</emphasis></entry>
36390 </row>
36391 </tbody>
36392 </tgroup>
36393 </informaltable>
36394 <para>
36395 This specifies the amount of time to wait for a response from the remote
36396 machine. The same timeout is used for the <function>connect()</function> function for a TCP
36397 call. It does not apply to UDP.
36398 </para>
36399 </chapter>
36400
36401 <chapter id="CHID7">
36402 <title>The manualroute router</title>
36403 <para>
36404 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
36405 <primary><command>manualroute</command> router</primary>
36406 </indexterm>
36407 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
36408 <primary>routers</primary>
36409 <secondary><command>manualroute</command></secondary>
36410 </indexterm>
36411 <indexterm role="concept">
36412 <primary>domain</primary>
36413 <secondary>manually routing</secondary>
36414 </indexterm>
36415 The <command>manualroute</command> router is so-called because it provides a way of manually
36416 routing an address according to its domain. It is mainly used when you want to
36417 route addresses to remote hosts according to your own rules, bypassing the
36418 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
36419 route to local transports, a facility that may be useful if you want to save
36420 messages for dial-in hosts in local files.
36421 </para>
36422 <para>
36423 The <command>manualroute</command> router compares a list of domain patterns with the domain
36424 it is trying to route. If there is no match, the router declines. Each pattern
36425 has associated with it a list of hosts and some other optional data, which may
36426 include a transport. The combination of a pattern and its data is called a
36427 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
36428 generic <option>transport</option> option must specify a transport, unless the router is
36429 being used purely for verification (see <option>verify_only</option>).
36430 </para>
36431 <para>
36432 <indexterm role="variable">
36433 <primary><varname>$host</varname></primary>
36434 </indexterm>
36435 In the case of verification, matching the domain pattern is sufficient for the
36436 router to accept the address. When actually routing an address for delivery,
36437 an address that matches a domain pattern is queued for the associated
36438 transport. If the transport is not a local one, a host list must be associated
36439 with the pattern; IP addresses are looked up for the hosts, and these are
36440 passed to the transport along with the mail address. For local transports, a
36441 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
36442 text string.
36443 </para>
36444 <para>
36445 The list of routing rules can be provided as an inline string in
36446 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
36447 or database by setting <option>route_data</option>. Only one of these settings may appear in
36448 any one instance of <command>manualroute</command>. The format of routing rules is described
36449 below, following the list of private options.
36450 </para>
36451 <section id="SECTprioptman">
36452 <title>Private options for manualroute</title>
36453 <para>
36454 <indexterm role="concept">
36455 <primary>options</primary>
36456 <secondary><command>manualroute</command> router</secondary>
36457 </indexterm>
36458 The private options for the <command>manualroute</command> router are as follows:
36459 </para>
36460 <para>
36461 <indexterm role="option">
36462 <primary><option>host_all_ignored</option></primary>
36463 </indexterm>
36464 </para>
36465 <informaltable frame="all">
36466 <tgroup cols="4" colsep="0" rowsep="0">
36467 <colspec colwidth="8*" align="left"/>
36468 <colspec colwidth="6*" align="center"/>
36469 <colspec colwidth="6*" align="center"/>
36470 <colspec colwidth="6*" align="right"/>
36471 <tbody>
36472 <row>
36473 <entry><option>host_all_ignored</option></entry>
36474 <entry>Use: <emphasis>manualroute</emphasis></entry>
36475 <entry>Type: <emphasis>string</emphasis></entry>
36476 <entry>Default: <emphasis>defer</emphasis></entry>
36477 </row>
36478 </tbody>
36479 </tgroup>
36480 </informaltable>
36481 <para>
36482 See <option>host_find_failed</option>.
36483 </para>
36484 <para>
36485 <indexterm role="option">
36486 <primary><option>host_find_failed</option></primary>
36487 </indexterm>
36488 </para>
36489 <informaltable frame="all">
36490 <tgroup cols="4" colsep="0" rowsep="0">
36491 <colspec colwidth="8*" align="left"/>
36492 <colspec colwidth="6*" align="center"/>
36493 <colspec colwidth="6*" align="center"/>
36494 <colspec colwidth="6*" align="right"/>
36495 <tbody>
36496 <row>
36497 <entry><option>host_find_failed</option></entry>
36498 <entry>Use: <emphasis>manualroute</emphasis></entry>
36499 <entry>Type: <emphasis>string</emphasis></entry>
36500 <entry>Default: <emphasis>freeze</emphasis></entry>
36501 </row>
36502 </tbody>
36503 </tgroup>
36504 </informaltable>
36505 <para>
36506 This option controls what happens when <command>manualroute</command> tries to find an IP
36507 address for a host, and the host does not exist. The option can be set to one
36508 of the following values:
36509 </para>
36510 <literallayout class="monospaced">
36511 decline
36512 defer
36513 fail
36514 freeze
36515 ignore
36516 pass
36517 </literallayout>
36518 <para>
36519 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
36520 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
36521 forces the address to be passed to the next router (or the router defined by
36522 <option>pass_router</option>),
36523 <indexterm role="option">
36524 <primary><option>more</option></primary>
36525 </indexterm>
36526 overriding <option>no_more</option>, whereas the latter passes the address to the next
36527 router only if <option>more</option> is true.
36528 </para>
36529 <para>
36530 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
36531 cannot be found. If all the hosts in the list are ignored, the behaviour is
36532 controlled by the <option>host_all_ignored</option> option. This takes the same values
36533 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
36534 </para>
36535 <para>
36536 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
36537 state; if a host lookup gets a temporary error, delivery is deferred unless the
36538 generic <option>pass_on_timeout</option> option is set.
36539 </para>
36540 <para>
36541 <indexterm role="option">
36542 <primary><option>hosts_randomize</option></primary>
36543 </indexterm>
36544 </para>
36545 <informaltable frame="all">
36546 <tgroup cols="4" colsep="0" rowsep="0">
36547 <colspec colwidth="8*" align="left"/>
36548 <colspec colwidth="6*" align="center"/>
36549 <colspec colwidth="6*" align="center"/>
36550 <colspec colwidth="6*" align="right"/>
36551 <tbody>
36552 <row>
36553 <entry><option>hosts_randomize</option></entry>
36554 <entry>Use: <emphasis>manualroute</emphasis></entry>
36555 <entry>Type: <emphasis>boolean</emphasis></entry>
36556 <entry>Default: <emphasis>false</emphasis></entry>
36557 </row>
36558 </tbody>
36559 </tgroup>
36560 </informaltable>
36561 <para>
36562 <indexterm role="concept">
36563 <primary>randomized host list</primary>
36564 </indexterm>
36565 <indexterm role="concept">
36566 <primary>host</primary>
36567 <secondary>list of; randomized</secondary>
36568 </indexterm>
36569 If this option is set, the order of the items in a host list in a routing rule
36570 is randomized each time the list is used, unless an option in the routing rule
36571 overrides (see below). Randomizing the order of a host list can be used to do
36572 crude load sharing. However, if more than one mail address is routed by the
36573 same router to the same host list, the host lists are considered to be the same
36574 (even though they may be randomized into different orders) for the purpose of
36575 deciding whether to batch the deliveries into a single SMTP transaction.
36576 </para>
36577 <para>
36578 When <option>hosts_randomize</option> is true, a host list may be split
36579 into groups whose order is separately randomized. This makes it possible to
36580 set up MX-like behaviour. The boundaries between groups are indicated by an
36581 item that is just <literal>+</literal> in the host list. For example:
36582 </para>
36583 <literallayout class="monospaced">
36584 route_list = * host1:host2:host3:+:host4:host5
36585 </literallayout>
36586 <para>
36587 The order of the first three hosts and the order of the last two hosts is
36588 randomized for each use, but the first three always end up before the last two.
36589 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
36590 randomized host list is passed to an <command>smtp</command> transport that also has
36591 <option>hosts_randomize set</option>, the list is not re-randomized.
36592 </para>
36593 <para>
36594 <indexterm role="option">
36595 <primary><option>route_data</option></primary>
36596 </indexterm>
36597 </para>
36598 <informaltable frame="all">
36599 <tgroup cols="4" colsep="0" rowsep="0">
36600 <colspec colwidth="8*" align="left"/>
36601 <colspec colwidth="6*" align="center"/>
36602 <colspec colwidth="6*" align="center"/>
36603 <colspec colwidth="6*" align="right"/>
36604 <tbody>
36605 <row>
36606 <entry><option>route_data</option></entry>
36607 <entry>Use: <emphasis>manualroute</emphasis></entry>
36608 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36609 <entry>Default: <emphasis>unset</emphasis></entry>
36610 </row>
36611 </tbody>
36612 </tgroup>
36613 </informaltable>
36614 <para>
36615 If this option is set, it must expand to yield the data part of a routing rule.
36616 Typically, the expansion string includes a lookup based on the domain. For
36617 example:
36618 </para>
36619 <literallayout class="monospaced">
36620 route_data = ${lookup{$domain}dbm{/etc/routes}}
36621 </literallayout>
36622 <para>
36623 If the expansion is forced to fail, or the result is an empty string, the
36624 router declines. Other kinds of expansion failure cause delivery to be
36625 deferred.
36626 </para>
36627 <para>
36628 <indexterm role="option">
36629 <primary><option>route_list</option></primary>
36630 </indexterm>
36631 </para>
36632 <informaltable frame="all">
36633 <tgroup cols="4" colsep="0" rowsep="0">
36634 <colspec colwidth="8*" align="left"/>
36635 <colspec colwidth="6*" align="center"/>
36636 <colspec colwidth="6*" align="center"/>
36637 <colspec colwidth="6*" align="right"/>
36638 <tbody>
36639 <row>
36640 <entry><option>route_list</option></entry>
36641 <entry>Use: <emphasis>manualroute</emphasis></entry>
36642 <entry>Type: <emphasis>string list</emphasis></entry>
36643 <entry>Default: <emphasis>unset</emphasis></entry>
36644 </row>
36645 </tbody>
36646 </tgroup>
36647 </informaltable>
36648 <para>
36649 This string is a list of routing rules, in the form defined below. Note that,
36650 unlike most string lists, the items are separated by semicolons. This is so
36651 that they may contain colon-separated host lists.
36652 </para>
36653 <para>
36654 <indexterm role="option">
36655 <primary><option>same_domain_copy_routing</option></primary>
36656 </indexterm>
36657 </para>
36658 <informaltable frame="all">
36659 <tgroup cols="4" colsep="0" rowsep="0">
36660 <colspec colwidth="8*" align="left"/>
36661 <colspec colwidth="6*" align="center"/>
36662 <colspec colwidth="6*" align="center"/>
36663 <colspec colwidth="6*" align="right"/>
36664 <tbody>
36665 <row>
36666 <entry><option>same_domain_copy_routing</option></entry>
36667 <entry>Use: <emphasis>manualroute</emphasis></entry>
36668 <entry>Type: <emphasis>boolean</emphasis></entry>
36669 <entry>Default: <emphasis>false</emphasis></entry>
36670 </row>
36671 </tbody>
36672 </tgroup>
36673 </informaltable>
36674 <para>
36675 <indexterm role="concept">
36676 <primary>address</primary>
36677 <secondary>copying routing</secondary>
36678 </indexterm>
36679 Addresses with the same domain are normally routed by the <command>manualroute</command>
36680 router to the same list of hosts. However, this cannot be presumed, because the
36681 router options and preconditions may refer to the local part of the address. By
36682 default, therefore, Exim routes each address in a message independently. DNS
36683 servers run caches, so repeated DNS lookups are not normally expensive, and in
36684 any case, personal messages rarely have more than a few recipients.
36685 </para>
36686 <para>
36687 If you are running mailing lists with large numbers of subscribers at the same
36688 domain, and you are using a <command>manualroute</command> router which is independent of the
36689 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
36690 lookups for identical domains in one message. In this case, when
36691 <command>manualroute</command> routes an address to a remote transport, any other unrouted
36692 addresses in the message that have the same domain are automatically given the
36693 same routing without processing them independently. However, this is only done
36694 if <option>headers_add</option> and <option>headers_remove</option> are unset.
36695 </para>
36696 </section>
36697 <section id="SECID120">
36698 <title>Routing rules in route_list</title>
36699 <para>
36700 The value of <option>route_list</option> is a string consisting of a sequence of routing
36701 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
36702 entered as two semicolons. Alternatively, the list separator can be changed as
36703 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
36704 Empty rules are ignored. The format of each rule is
36705 </para>
36706 <literallayout>
36707 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
36708 </literallayout>
36709 <para>
36710 The following example contains two rules, each with a simple domain pattern and
36711 no options:
36712 </para>
36713 <literallayout class="monospaced">
36714 route_list = \
36715   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
36716   thes.ref.example  mail-3.ref.example:mail-4.ref.example
36717 </literallayout>
36718 <para>
36719 The three parts of a rule are separated by white space. The pattern and the
36720 list of hosts can be enclosed in quotes if necessary, and if they are, the
36721 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
36722 single domain pattern, which is the only mandatory item in the rule. The
36723 pattern is in the same format as one item in a domain list (see section
36724 <xref linkend="SECTdomainlist"/>),
36725 except that it may not be the name of an interpolated file.
36726 That is, it may be wildcarded, or a regular expression, or a file or database
36727 lookup (with semicolons doubled, because of the use of semicolon as a separator
36728 in a <option>route_list</option>).
36729 </para>
36730 <para>
36731 The rules in <option>route_list</option> are searched in order until one of the patterns
36732 matches the domain that is being routed. The list of hosts and then options are
36733 then used as described below. If there is no match, the router declines. When
36734 <option>route_list</option> is set, <option>route_data</option> must not be set.
36735 </para>
36736 </section>
36737 <section id="SECID121">
36738 <title>Routing rules in route_data</title>
36739 <para>
36740 The use of <option>route_list</option> is convenient when there are only a small number of
36741 routing rules. For larger numbers, it is easier to use a file or database to
36742 hold the routing information, and use the <option>route_data</option> option instead.
36743 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
36744 Most commonly, <option>route_data</option> is set as a string that contains an
36745 expansion lookup. For example, suppose we place two routing rules in a file
36746 like this:
36747 </para>
36748 <literallayout class="monospaced">
36749 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
36750 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
36751 </literallayout>
36752 <para>
36753 This data can be accessed by setting
36754 </para>
36755 <literallayout class="monospaced">
36756 route_data = ${lookup{$domain}lsearch{/the/file/name}}
36757 </literallayout>
36758 <para>
36759 Failure of the lookup results in an empty string, causing the router to
36760 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
36761 requirement is that the result of expanding the string is a list of hosts,
36762 possibly followed by options, separated by white space. The list of hosts must
36763 be enclosed in quotes if it contains white space.
36764 </para>
36765 </section>
36766 <section id="SECID122">
36767 <title>Format of the list of hosts</title>
36768 <para>
36769 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
36770 always separately expanded before use. If the expansion fails, the router
36771 declines. The result of the expansion must be a colon-separated list of names
36772 and/or IP addresses, optionally also including ports. The format of each item
36773 in the list is described in the next section. The list separator can be changed
36774 as described in section <xref linkend="SECTlistconstruct"/>.
36775 </para>
36776 <para>
36777 If the list of hosts was obtained from a <option>route_list</option> item, the following
36778 variables are set during its expansion:
36779 </para>
36780 <itemizedlist>
36781 <listitem>
36782 <para>
36783 <indexterm role="concept">
36784 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
36785 <secondary>in <command>manualroute</command> router</secondary>
36786 </indexterm>
36787 If the domain was matched against a regular expression, the numeric variables
36788 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
36789 </para>
36790 <literallayout class="monospaced">
36791 route_list = ^domain(\d+)   host-$1.text.example
36792 </literallayout>
36793 </listitem>
36794 <listitem>
36795 <para>
36796 <varname>$0</varname> is always set to the entire domain.
36797 </para>
36798 </listitem>
36799 <listitem>
36800 <para>
36801 <varname>$1</varname> is also set when partial matching is done in a file lookup.
36802 </para>
36803 </listitem>
36804 <listitem>
36805 <para>
36806 <indexterm role="variable">
36807 <primary><varname>$value</varname></primary>
36808 </indexterm>
36809 If the pattern that matched the domain was a lookup item, the data that was
36810 looked up is available in the expansion variable <varname>$value</varname>. For example:
36811 </para>
36812 <literallayout class="monospaced">
36813 route_list = lsearch;;/some/file.routes  $value
36814 </literallayout>
36815 </listitem>
36816 </itemizedlist>
36817 <para>
36818 Note the doubling of the semicolon in the pattern that is necessary because
36819 semicolon is the default route list separator.
36820 </para>
36821 </section>
36822 <section id="SECTformatonehostitem">
36823 <title>Format of one host item</title>
36824 <para>
36825 Each item in the list of hosts is either a host name or an IP address,
36826 optionally with an attached port number. When no port is given, an IP address
36827 is not enclosed in brackets. When a port is specified, it overrides the port
36828 specification on the transport. The port is separated from the name or address
36829 by a colon. This leads to some complications:
36830 </para>
36831 <itemizedlist>
36832 <listitem>
36833 <para>
36834 Because colon is the default separator for the list of hosts, either
36835 the colon that specifies a port must be doubled, or the list separator must
36836 be changed. The following two examples have the same effect:
36837 </para>
36838 <literallayout class="monospaced">
36839 route_list = * "host1.tld::1225 : host2.tld::1226"
36840 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
36841 </literallayout>
36842 </listitem>
36843 <listitem>
36844 <para>
36845 When IPv6 addresses are involved, it gets worse, because they contain
36846 colons of their own. To make this case easier, it is permitted to
36847 enclose an IP address (either v4 or v6) in square brackets if a port
36848 number follows. For example:
36849 </para>
36850 <literallayout class="monospaced">
36851 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
36852 </literallayout>
36853 </listitem>
36854 </itemizedlist>
36855 </section>
36856 <section id="SECThostshowused">
36857 <title>How the list of hosts is used</title>
36858 <para>
36859 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
36860 the hosts is tried, in the order specified, when carrying out the SMTP
36861 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
36862 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
36863 transport.
36864 </para>
36865 <para>
36866 Hosts may be listed by name or by IP address. An unadorned name in the list of
36867 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
36868 interpreted as an indirection to a sublist of hosts obtained by looking up MX
36869 records in the DNS. For example:
36870 </para>
36871 <literallayout class="monospaced">
36872 route_list = *  x.y.z:p.q.r/MX:e.f.g
36873 </literallayout>
36874 <para>
36875 If this feature is used with a port specifier, the port must come last. For
36876 example:
36877 </para>
36878 <literallayout class="monospaced">
36879 route_list = *  dom1.tld/mx::1225
36880 </literallayout>
36881 <para>
36882 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
36883 randomized before any lookups are done. Exim then scans the list; for any name
36884 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
36885 be an interface on the local host and the item is not the first in the list,
36886 Exim discards it and any subsequent items. If it is the first item, what
36887 happens is controlled by the
36888 <indexterm role="option">
36889 <primary><option>self</option></primary>
36890 <secondary>in <command>manualroute</command> router</secondary>
36891 </indexterm>
36892 <option>self</option> option of the router.
36893 </para>
36894 <para>
36895 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
36896 hosts obtained by looking up MX records for the name. This is always a DNS
36897 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
36898 below) are not relevant here. The order of these hosts is determined by the
36899 preference values in the MX records, according to the usual rules. Because
36900 randomizing happens before the MX lookup, it does not affect the order that is
36901 defined by MX preferences.
36902 </para>
36903 <para>
36904 If the local host is present in the sublist obtained from MX records, but is
36905 not the most preferred host in that list, it and any equally or less
36906 preferred hosts are removed before the sublist is inserted into the main list.
36907 </para>
36908 <para>
36909 If the local host is the most preferred host in the MX list, what happens
36910 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
36911 is not the first item (that is, there are previous hosts in the main list),
36912 Exim discards this name and any subsequent items in the main list.
36913 </para>
36914 <para>
36915 If the MX item is first in the list of hosts, and the local host is the
36916 most preferred host, what happens is controlled by the <option>self</option> option of the
36917 router.
36918 </para>
36919 <para>
36920 DNS failures when lookup up the MX records are treated in the same way as DNS
36921 failures when looking up IP addresses: <option>pass_on_timeout</option> and
36922 <option>host_find_failed</option> are used when relevant.
36923 </para>
36924 <para>
36925 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
36926 whether obtained from an MX lookup or not.
36927 </para>
36928 </section>
36929 <section id="SECThowoptused">
36930 <title>How the options are used</title>
36931 <para>
36932 The options are a sequence of words, space-separated.
36933 One of the words can be the name of a transport; this overrides the
36934 <option>transport</option> option on the router for this particular routing rule only. The
36935 other words (if present) control randomization of the list of hosts on a
36936 per-rule basis, and how the IP addresses of the hosts are to be found when
36937 routing to a remote transport. These options are as follows:
36938 </para>
36939 <itemizedlist>
36940 <listitem>
36941 <para>
36942 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
36943 setting of <option>hosts_randomize</option> for this routing rule only.
36944 </para>
36945 </listitem>
36946 <listitem>
36947 <para>
36948 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
36949 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
36950 </para>
36951 </listitem>
36952 <listitem>
36953 <para>
36954 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
36955 find IP addresses. This function may ultimately cause a DNS lookup, but it may
36956 also look in <filename>/etc/hosts</filename> or other sources of information.
36957 </para>
36958 </listitem>
36959 <listitem>
36960 <para>
36961 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
36962 no address records are found. If there is a temporary DNS error (such as a
36963 timeout), delivery is deferred.
36964 </para>
36965 </listitem>
36966 <listitem>
36967 <para revisionflag="changed">
36968 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
36969 </para>
36970 </listitem>
36971 <listitem>
36972 <para revisionflag="changed">
36973 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
36974 </para>
36975 </listitem>
36976 </itemizedlist>
36977 <para>
36978 For example:
36979 </para>
36980 <literallayout class="monospaced">
36981 route_list = domain1  host1:host2:host3  randomize bydns;\
36982              domain2  host4:host5
36983 </literallayout>
36984 <para>
36985 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
36986 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
36987 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
36988 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
36989 call.
36990 </para>
36991 <para>
36992 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
36993 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
36994 instead of TRY_AGAIN. That is why the default action is to try a DNS
36995 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
36996 function called.
36997 </para>
36998 <para>
36999 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
37000 inadvertent constraint that a transport name as an option had to be the last
37001 option specified.
37002 </para>
37003 <para>
37004 If no IP address for a host can be found, what happens is controlled by the
37005 <option>host_find_failed</option> option.
37006 </para>
37007 <para>
37008 <indexterm role="variable">
37009 <primary><varname>$host</varname></primary>
37010 </indexterm>
37011 When an address is routed to a local transport, IP addresses are not looked up.
37012 The host list is passed to the transport in the <varname>$host</varname> variable.
37013 </para>
37014 </section>
37015 <section id="SECID123">
37016 <title>Manualroute examples</title>
37017 <para>
37018 In some of the examples that follow, the presence of the <option>remote_smtp</option>
37019 transport, as defined in the default configuration file, is assumed:
37020 </para>
37021 <itemizedlist>
37022 <listitem>
37023 <para>
37024 <indexterm role="concept">
37025 <primary>smart host</primary>
37026 <secondary>example router</secondary>
37027 </indexterm>
37028 The <command>manualroute</command> router can be used to forward all external mail to a
37029 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
37030 named domain list that contains your local domains, for example:
37031 </para>
37032 <literallayout class="monospaced">
37033 domainlist local_domains = my.domain.example
37034 </literallayout>
37035 <para>
37036 You can arrange for all other domains to be routed to a smart host by making
37037 your first router something like this:
37038 </para>
37039 <literallayout class="monospaced">
37040 smart_route:
37041   driver = manualroute
37042   domains = !+local_domains
37043   transport = remote_smtp
37044   route_list = * smarthost.ref.example
37045 </literallayout>
37046 <para>
37047 This causes all non-local addresses to be sent to the single host
37048 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
37049 they are tried in order
37050 (but you can use <option>hosts_randomize</option> to vary the order each time).
37051 Another way of configuring the same thing is this:
37052 </para>
37053 <literallayout class="monospaced">
37054 smart_route:
37055   driver = manualroute
37056   transport = remote_smtp
37057   route_list = !+local_domains  smarthost.ref.example
37058 </literallayout>
37059 <para>
37060 There is no difference in behaviour between these two routers as they stand.
37061 However, they behave differently if <option>no_more</option> is added to them. In the first
37062 example, the router is skipped if the domain does not match the <option>domains</option>
37063 precondition; the following router is always tried. If the router runs, it
37064 always matches the domain and so can never decline. Therefore, <option>no_more</option>
37065 would have no effect. In the second case, the router is never skipped; it
37066 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
37067 <option>no_more</option> would prevent subsequent routers from running.
37068 </para>
37069 </listitem>
37070 <listitem>
37071 <para>
37072 <indexterm role="concept">
37073 <primary>mail hub example</primary>
37074 </indexterm>
37075 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
37076 records in the DNS and delivers it via its own private routing mechanism. Often
37077 the final destinations are behind a firewall, with the mail hub being the one
37078 machine that can connect to machines both inside and outside the firewall. The
37079 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
37080 to the correct hosts. For a small number of domains, the routing can be inline,
37081 using the <option>route_list</option> option, but for a larger number a file or database
37082 lookup is easier to manage.
37083 </para>
37084 <para>
37085 If the domain names are in fact the names of the machines to which the mail is
37086 to be sent by the mail hub, the configuration can be quite simple. For
37087 example:
37088 </para>
37089 <literallayout class="monospaced">
37090 hub_route:
37091   driver = manualroute
37092   transport = remote_smtp
37093   route_list = *.rhodes.tvs.example  $domain
37094 </literallayout>
37095 <para>
37096 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
37097 whose names are the same as the mail domains. A similar approach can be taken
37098 if the host name can be obtained from the domain name by a string manipulation
37099 that the expansion facilities can handle. Otherwise, a lookup based on the
37100 domain can be used to find the host:
37101 </para>
37102 <literallayout class="monospaced">
37103 through_firewall:
37104   driver = manualroute
37105   transport = remote_smtp
37106   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
37107 </literallayout>
37108 <para>
37109 The result of the lookup must be the name or IP address of the host (or
37110 hosts) to which the address is to be routed. If the lookup fails, the route
37111 data is empty, causing the router to decline. The address then passes to the
37112 next router.
37113 </para>
37114 </listitem>
37115 <listitem>
37116 <para>
37117 <indexterm role="concept">
37118 <primary>batched SMTP output example</primary>
37119 </indexterm>
37120 <indexterm role="concept">
37121 <primary>SMTP</primary>
37122 <secondary>batched outgoing; example</secondary>
37123 </indexterm>
37124 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
37125 SMTP format for onward transportation by some other means. This is one way of
37126 storing mail for a dial-up host when it is not connected. The route list entry
37127 can be as simple as a single domain name in a configuration like this:
37128 </para>
37129 <literallayout class="monospaced">
37130 save_in_file:
37131   driver = manualroute
37132   transport = batchsmtp_appendfile
37133   route_list = saved.domain.example
37134 </literallayout>
37135 <para>
37136 though often a pattern is used to pick up more than one domain. If there are
37137 several domains or groups of domains with different transport requirements,
37138 different transports can be listed in the routing information:
37139 </para>
37140 <literallayout class="monospaced">
37141 save_in_file:
37142   driver = manualroute
37143   route_list = \
37144     *.saved.domain1.example  $domain  batch_appendfile; \
37145     *.saved.domain2.example  \
37146       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
37147       batch_pipe
37148 </literallayout>
37149 <para>
37150 <indexterm role="variable">
37151 <primary><varname>$domain</varname></primary>
37152 </indexterm>
37153 <indexterm role="variable">
37154 <primary><varname>$host</varname></primary>
37155 </indexterm>
37156 The first of these just passes the domain in the <varname>$host</varname> variable, which
37157 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
37158 file lookup to find a value to pass, causing the router to decline to handle
37159 the address if the lookup fails.
37160 </para>
37161 </listitem>
37162 <listitem>
37163 <para>
37164 <indexterm role="concept">
37165 <primary>UUCP</primary>
37166 <secondary>example of router for</secondary>
37167 </indexterm>
37168 Routing mail directly to UUCP software is a specific case of the use of
37169 <command>manualroute</command> in a gateway to another mail environment. This is an example of
37170 one way it can be done:
37171 </para>
37172 <literallayout class="monospaced">
37173 # Transport
37174 uucp:
37175   driver = pipe
37176   user = nobody
37177   command = /usr/local/bin/uux -r - \
37178     ${substr_-5:$host}!rmail ${local_part}
37179   return_fail_output = true
37180
37181 # Router
37182 uucphost:
37183   transport = uucp
37184   driver = manualroute
37185   route_data = \
37186     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
37187 </literallayout>
37188 <para>
37189 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
37190 </para>
37191 <literallayout class="monospaced">
37192 darksite.ethereal.example:           darksite.UUCP
37193 </literallayout>
37194 <para>
37195 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
37196 makes clear the distinction between the domain name
37197 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
37198 </para>
37199 </listitem>
37200 </itemizedlist>
37201 <para>
37202 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
37203 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
37204 </para>
37205 </section>
37206 </chapter>
37207
37208 <chapter id="CHAPdriverlast">
37209 <title>The queryprogram router</title>
37210 <para>
37211 <indexterm role="concept" id="IIDquerou1" class="startofrange">
37212 <primary><command>queryprogram</command> router</primary>
37213 </indexterm>
37214 <indexterm role="concept" id="IIDquerou2" class="startofrange">
37215 <primary>routers</primary>
37216 <secondary><command>queryprogram</command></secondary>
37217 </indexterm>
37218 <indexterm role="concept">
37219 <primary>routing</primary>
37220 <secondary>by external program</secondary>
37221 </indexterm>
37222 The <command>queryprogram</command> router routes an address by running an external command
37223 and acting on its output. This is an expensive way to route, and is intended
37224 mainly for use in lightly-loaded systems, or for performing experiments.
37225 However, if it is possible to use the precondition options (<option>domains</option>,
37226 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
37227 be used in special cases, even on a busy host. There are the following private
37228 options:
37229 <indexterm role="concept">
37230 <primary>options</primary>
37231 <secondary><command>queryprogram</command> router</secondary>
37232 </indexterm>
37233 </para>
37234 <para>
37235 <indexterm role="option">
37236 <primary><option>command</option></primary>
37237 </indexterm>
37238 </para>
37239 <informaltable frame="all">
37240 <tgroup cols="4" colsep="0" rowsep="0">
37241 <colspec colwidth="8*" align="left"/>
37242 <colspec colwidth="6*" align="center"/>
37243 <colspec colwidth="6*" align="center"/>
37244 <colspec colwidth="6*" align="right"/>
37245 <tbody>
37246 <row>
37247 <entry><option>command</option></entry>
37248 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37249 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37250 <entry>Default: <emphasis>unset</emphasis></entry>
37251 </row>
37252 </tbody>
37253 </tgroup>
37254 </informaltable>
37255 <para>
37256 This option must be set. It specifies the command that is to be run. The
37257 command is split up into a command name and arguments, and then each is
37258 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
37259 <xref linkend="CHAPpipetransport"/>).
37260 </para>
37261 <para>
37262 <indexterm role="option">
37263 <primary><option>command_group</option></primary>
37264 </indexterm>
37265 </para>
37266 <informaltable frame="all">
37267 <tgroup cols="4" colsep="0" rowsep="0">
37268 <colspec colwidth="8*" align="left"/>
37269 <colspec colwidth="6*" align="center"/>
37270 <colspec colwidth="6*" align="center"/>
37271 <colspec colwidth="6*" align="right"/>
37272 <tbody>
37273 <row>
37274 <entry><option>command_group</option></entry>
37275 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37276 <entry>Type: <emphasis>string</emphasis></entry>
37277 <entry>Default: <emphasis>unset</emphasis></entry>
37278 </row>
37279 </tbody>
37280 </tgroup>
37281 </informaltable>
37282 <para>
37283 <indexterm role="concept">
37284 <primary>gid (group id)</primary>
37285 <secondary>in <command>queryprogram</command> router</secondary>
37286 </indexterm>
37287 This option specifies a gid to be set when running the command while routing an
37288 address for deliver. It must be set if <option>command_user</option> specifies a numerical
37289 uid. If it begins with a digit, it is interpreted as the numerical value of the
37290 gid. Otherwise it is looked up using <function>getgrnam()</function>.
37291 </para>
37292 <para>
37293 <indexterm role="option">
37294 <primary><option>command_user</option></primary>
37295 </indexterm>
37296 </para>
37297 <informaltable frame="all">
37298 <tgroup cols="4" colsep="0" rowsep="0">
37299 <colspec colwidth="8*" align="left"/>
37300 <colspec colwidth="6*" align="center"/>
37301 <colspec colwidth="6*" align="center"/>
37302 <colspec colwidth="6*" align="right"/>
37303 <tbody>
37304 <row>
37305 <entry><option>command_user</option></entry>
37306 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37307 <entry>Type: <emphasis>string</emphasis></entry>
37308 <entry>Default: <emphasis>unset</emphasis></entry>
37309 </row>
37310 </tbody>
37311 </tgroup>
37312 </informaltable>
37313 <para>
37314 <indexterm role="concept">
37315 <primary>uid (user id)</primary>
37316 <secondary>for <command>queryprogram</command></secondary>
37317 </indexterm>
37318 This option must be set. It specifies the uid which is set when running the
37319 command while routing an address for delivery. If the value begins with a digit,
37320 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
37321 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
37322 not set, a value for the gid also.
37323 </para>
37324 <para>
37325 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
37326 root, which it does during a normal delivery in a conventional configuration.
37327 However, when an address is being verified during message reception, Exim is
37328 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
37329 is called from a non-root process, Exim cannot change uid or gid before running
37330 the command. In this circumstance the command runs under the current uid and
37331 gid.
37332 </para>
37333 <para>
37334 <indexterm role="option">
37335 <primary><option>current_directory</option></primary>
37336 </indexterm>
37337 </para>
37338 <informaltable frame="all">
37339 <tgroup cols="4" colsep="0" rowsep="0">
37340 <colspec colwidth="8*" align="left"/>
37341 <colspec colwidth="6*" align="center"/>
37342 <colspec colwidth="6*" align="center"/>
37343 <colspec colwidth="6*" align="right"/>
37344 <tbody>
37345 <row>
37346 <entry><option>current_directory</option></entry>
37347 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37348 <entry>Type: <emphasis>string</emphasis></entry>
37349 <entry>Default: <emphasis>/</emphasis></entry>
37350 </row>
37351 </tbody>
37352 </tgroup>
37353 </informaltable>
37354 <para>
37355 This option specifies an absolute path which is made the current directory
37356 before running the command.
37357 </para>
37358 <para>
37359 <indexterm role="option">
37360 <primary><option>timeout</option></primary>
37361 </indexterm>
37362 </para>
37363 <informaltable frame="all">
37364 <tgroup cols="4" colsep="0" rowsep="0">
37365 <colspec colwidth="8*" align="left"/>
37366 <colspec colwidth="6*" align="center"/>
37367 <colspec colwidth="6*" align="center"/>
37368 <colspec colwidth="6*" align="right"/>
37369 <tbody>
37370 <row>
37371 <entry><option>timeout</option></entry>
37372 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37373 <entry>Type: <emphasis>time</emphasis></entry>
37374 <entry>Default: <emphasis>1h</emphasis></entry>
37375 </row>
37376 </tbody>
37377 </tgroup>
37378 </informaltable>
37379 <para>
37380 If the command does not complete within the timeout period, its process group
37381 is killed and the message is frozen. A value of zero time specifies no
37382 timeout.
37383 </para>
37384 <para>
37385 The standard output of the command is connected to a pipe, which is read when
37386 the command terminates. It should consist of a single line of output,
37387 containing up to five fields, separated by white space. The maximum length of
37388 the line is 1023 characters. Longer lines are silently truncated. The first
37389 field is one of the following words (case-insensitive):
37390 </para>
37391 <itemizedlist>
37392 <listitem>
37393 <para>
37394 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
37395 below).
37396 </para>
37397 </listitem>
37398 <listitem>
37399 <para>
37400 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
37401 <option>no_more</option> is set.
37402 </para>
37403 </listitem>
37404 <listitem>
37405 <para>
37406 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
37407 subsequent text on the line is an error message. If the router is run as part
37408 of address verification during an incoming SMTP message, the message is
37409 included in the SMTP response.
37410 </para>
37411 </listitem>
37412 <listitem>
37413 <para>
37414 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
37415 subsequent text on the line is an error message which is logged. It is not
37416 included in any SMTP response.
37417 </para>
37418 </listitem>
37419 <listitem>
37420 <para>
37421 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
37422 </para>
37423 </listitem>
37424 <listitem>
37425 <para>
37426 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
37427 <option>pass_router</option>), overriding <option>no_more</option>.
37428 </para>
37429 </listitem>
37430 <listitem>
37431 <para>
37432 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
37433 new addresses, which are routed independently, starting with the first router,
37434 or the router specified by <option>redirect_router</option>, if set.
37435 </para>
37436 </listitem>
37437 </itemizedlist>
37438 <para>
37439 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
37440 number of keyed data values, as follows (split into two lines here, to fit on
37441 the page):
37442 </para>
37443 <literallayout class="monospaced">
37444 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
37445 LOOKUP=byname|bydns DATA=&lt;text&gt;
37446 </literallayout>
37447 <para>
37448 The data items can be given in any order, and all are optional. If no transport
37449 is included, the transport specified by the generic <option>transport</option> option is
37450 used. The list of hosts and the lookup type are needed only if the transport is
37451 an <command>smtp</command> transport that does not itself supply a list of hosts.
37452 </para>
37453 <para>
37454 The format of the list of hosts is the same as for the <command>manualroute</command> router.
37455 As well as host names and IP addresses with optional port numbers, as described
37456 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
37457 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
37458 (see section <xref linkend="SECThostshowused"/>).
37459 </para>
37460 <para>
37461 If the lookup type is not specified, Exim behaves as follows when trying to
37462 find an IP address for each host: First, a DNS lookup is done. If this yields
37463 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
37464 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
37465 result of the lookup is the result of that call.
37466 </para>
37467 <para>
37468 <indexterm role="variable">
37469 <primary><varname>$address_data</varname></primary>
37470 </indexterm>
37471 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
37472 variable. For example, this return line
37473 </para>
37474 <literallayout class="monospaced">
37475 accept hosts=x1.y.example:x2.y.example data="rule1"
37476 </literallayout>
37477 <para>
37478 routes the address to the default transport, passing a list of two hosts. When
37479 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
37480 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
37481 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
37482 </para>
37483 </chapter>
37484
37485 <chapter id="CHAPredirect">
37486 <title>The redirect router</title>
37487 <para>
37488 <indexterm role="concept" id="IIDredrou1" class="startofrange">
37489 <primary><command>redirect</command> router</primary>
37490 </indexterm>
37491 <indexterm role="concept" id="IIDredrou2" class="startofrange">
37492 <primary>routers</primary>
37493 <secondary><command>redirect</command></secondary>
37494 </indexterm>
37495 <indexterm role="concept">
37496 <primary>alias file</primary>
37497 <secondary>in a <command>redirect</command> router</secondary>
37498 </indexterm>
37499 <indexterm role="concept">
37500 <primary>address redirection</primary>
37501 <secondary><command>redirect</command> router</secondary>
37502 </indexterm>
37503 The <command>redirect</command> router handles several kinds of address redirection. Its most
37504 common uses are for resolving local part aliases from a central alias file
37505 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
37506 files, but it has many other potential uses. The incoming address can be
37507 redirected in several different ways:
37508 </para>
37509 <itemizedlist>
37510 <listitem>
37511 <para>
37512 It can be replaced by one or more new addresses which are themselves routed
37513 independently.
37514 </para>
37515 </listitem>
37516 <listitem>
37517 <para>
37518 It can be routed to be delivered to a given file or directory.
37519 </para>
37520 </listitem>
37521 <listitem>
37522 <para>
37523 It can be routed to be delivered to a specified pipe command.
37524 </para>
37525 </listitem>
37526 <listitem>
37527 <para>
37528 It can cause an automatic reply to be generated.
37529 </para>
37530 </listitem>
37531 <listitem>
37532 <para>
37533 It can be forced to fail, optionally with a custom error message.
37534 </para>
37535 </listitem>
37536 <listitem>
37537 <para>
37538 It can be temporarily deferred, optionally with a custom message.
37539 </para>
37540 </listitem>
37541 <listitem>
37542 <para>
37543 It can be discarded.
37544 </para>
37545 </listitem>
37546 </itemizedlist>
37547 <para>
37548 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
37549 However, there are some private options which define transports for delivery to
37550 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
37551 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
37552 </para>
37553 <para>
37554 If success DSNs have been requested
37555 <indexterm role="concept">
37556 <primary>DSN</primary>
37557 <secondary>success</secondary>
37558 </indexterm>
37559 <indexterm role="concept">
37560 <primary>Delivery Status Notification</primary>
37561 <secondary>success</secondary>
37562 </indexterm>
37563 redirection triggers one and the DSN options are not passed any further.
37564 </para>
37565 <section id="SECID124">
37566 <title>Redirection data</title>
37567 <para>
37568 The router operates by interpreting a text string which it obtains either by
37569 expanding the contents of the <option>data</option> option, or by reading the entire
37570 contents of a file whose name is given in the <option>file</option> option. These two
37571 options are mutually exclusive. The first is commonly used for handling system
37572 aliases, in a configuration like this:
37573 </para>
37574 <literallayout class="monospaced">
37575 system_aliases:
37576   driver = redirect
37577   data = ${lookup{$local_part}lsearch{/etc/aliases}}
37578 </literallayout>
37579 <para>
37580 If the lookup fails, the expanded string in this example is empty. When the
37581 expansion of <option>data</option> results in an empty string, the router declines. A forced
37582 expansion failure also causes the router to decline; other expansion failures
37583 cause delivery to be deferred.
37584 </para>
37585 <para>
37586 A configuration using <option>file</option> is commonly used for handling users&#x2019;
37587 <filename>.forward</filename> files, like this:
37588 </para>
37589 <literallayout class="monospaced">
37590 userforward:
37591   driver = redirect
37592   check_local_user
37593   file = $home/.forward
37594   no_verify
37595 </literallayout>
37596 <para>
37597 If the file does not exist, or causes no action to be taken (for example, it is
37598 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
37599 is not the case when the file contains syntactically valid items that happen to
37600 yield empty addresses, for example, items containing only RFC 2822 address
37601 comments.
37602 </para>
37603 </section>
37604 <section id="SECID125">
37605 <title>Forward files and address verification</title>
37606 <para>
37607 <indexterm role="concept">
37608 <primary>address redirection</primary>
37609 <secondary>while verifying</secondary>
37610 </indexterm>
37611 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
37612 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
37613 </para>
37614 <itemizedlist>
37615 <listitem>
37616 <para>
37617 When Exim is receiving an incoming SMTP message from a remote host, it is
37618 running under the Exim uid, not as root. Exim is unable to change uid to read
37619 the file as the user, and it may not be able to read it as the Exim user. So in
37620 practice the router may not be able to operate.
37621 </para>
37622 </listitem>
37623 <listitem>
37624 <para>
37625 However, even when the router can operate, the existence of a <filename>.forward</filename> file
37626 is unimportant when verifying an address. What should be checked is whether the
37627 local part is a valid user name or not. Cutting out the redirection processing
37628 saves some resources.
37629 </para>
37630 </listitem>
37631 </itemizedlist>
37632 </section>
37633 <section id="SECID126">
37634 <title>Interpreting redirection data</title>
37635 <para>
37636 <indexterm role="concept">
37637 <primary>Sieve filter</primary>
37638 <secondary>specifying in redirection data</secondary>
37639 </indexterm>
37640 <indexterm role="concept">
37641 <primary>filter</primary>
37642 <secondary>specifying in redirection data</secondary>
37643 </indexterm>
37644 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
37645 can be interpreted in two different ways:
37646 </para>
37647 <itemizedlist>
37648 <listitem>
37649 <para>
37650 If the <option>allow_filter</option> option is set true, and the data begins with the text
37651 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
37652 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
37653 respectively. Details of the syntax and semantics of filter files are described
37654 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
37655 document is intended for use by end users.
37656 </para>
37657 </listitem>
37658 <listitem>
37659 <para>
37660 Otherwise, the data must be a comma-separated list of redirection items, as
37661 described in the next section.
37662 </para>
37663 </listitem>
37664 </itemizedlist>
37665 <para>
37666 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
37667 in a non-filter redirection list must always be an absolute path. A filter may
37668 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
37669 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
37670 for the <command>appendfile</command> transport.
37671 </para>
37672 </section>
37673 <section id="SECTitenonfilred">
37674 <title>Items in a non-filter redirection list</title>
37675 <para>
37676 <indexterm role="concept">
37677 <primary>address redirection</primary>
37678 <secondary>non-filter list items</secondary>
37679 </indexterm>
37680 When the redirection data is not an Exim or Sieve filter, for example, if it
37681 comes from a conventional alias or forward file, it consists of a list of
37682 addresses, file names, pipe commands, or certain special items (see section
37683 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
37684 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
37685 depending on their default values. The items in the list are separated by
37686 commas or newlines.
37687 If a comma is required in an item, the entire item must be enclosed in double
37688 quotes.
37689 </para>
37690 <para>
37691 Lines starting with a # character are comments, and are ignored, and # may
37692 also appear following a comma, in which case everything between the # and the
37693 next newline character is ignored.
37694 </para>
37695 <para>
37696 If an item is entirely enclosed in double quotes, these are removed. Otherwise
37697 double quotes are retained because some forms of mail address require their use
37698 (but never to enclose the entire address). In the following description,
37699 <quote>item</quote> refers to what remains after any surrounding double quotes have been
37700 removed.
37701 </para>
37702 <para>
37703 <indexterm role="variable">
37704 <primary><varname>$local_part</varname></primary>
37705 </indexterm>
37706 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
37707 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
37708 of the <option>quote_local_part</option> expansion operator, in case the local part contains
37709 special characters. For example, to redirect all mail for the domain
37710 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
37711 setting:
37712 </para>
37713 <literallayout class="monospaced">
37714 data = ${quote_local_part:$local_part}@newdomain.example
37715 </literallayout>
37716 </section>
37717 <section id="SECTredlocmai">
37718 <title>Redirecting to a local mailbox</title>
37719 <para>
37720 <indexterm role="concept">
37721 <primary>routing</primary>
37722 <secondary>loops in</secondary>
37723 </indexterm>
37724 <indexterm role="concept">
37725 <primary>loop</primary>
37726 <secondary>while routing, avoidance of</secondary>
37727 </indexterm>
37728 <indexterm role="concept">
37729 <primary>address redirection</primary>
37730 <secondary>to local mailbox</secondary>
37731 </indexterm>
37732 A redirection item may safely be the same as the address currently under
37733 consideration. This does not cause a routing loop, because a router is
37734 automatically skipped if any ancestor of the address that is being processed
37735 is the same as the current address and was processed by the current router.
37736 Such an address is therefore passed to the following routers, so it is handled
37737 as if there were no redirection. When making this loop-avoidance test, the
37738 complete local part, including any prefix or suffix, is used.
37739 </para>
37740 <para>
37741 <indexterm role="concept">
37742 <primary>address redirection</primary>
37743 <secondary>local part without domain</secondary>
37744 </indexterm>
37745 Specifying the same local part without a domain is a common usage in personal
37746 filter files when the user wants to have messages delivered to the local
37747 mailbox and also forwarded elsewhere. For example, the user whose login is
37748 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
37749 </para>
37750 <literallayout class="monospaced">
37751 cleo, cleopatra@egypt.example
37752 </literallayout>
37753 <para>
37754 <indexterm role="concept">
37755 <primary>backslash in alias file</primary>
37756 </indexterm>
37757 <indexterm role="concept">
37758 <primary>alias file</primary>
37759 <secondary>backslash in</secondary>
37760 </indexterm>
37761 For compatibility with other MTAs, such unqualified local parts may be
37762 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
37763 it does make a difference if more than one domain is being handled
37764 synonymously.
37765 </para>
37766 <para>
37767 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
37768 2822 address that does not include a domain, the item is qualified using the
37769 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
37770 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
37771 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
37772 </para>
37773 <para>
37774 Care must be taken if there are alias names for local users.
37775 Consider an MTA handling a single local domain where the system alias file
37776 contains:
37777 </para>
37778 <literallayout class="monospaced">
37779 Sam.Reman: spqr
37780 </literallayout>
37781 <para>
37782 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
37783 messages in the local mailbox, and also forward copies elsewhere. He creates
37784 this forward file:
37785 </para>
37786 <literallayout class="monospaced">
37787 Sam.Reman, spqr@reme.elsewhere.example
37788 </literallayout>
37789 <para>
37790 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
37791 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
37792 second time round, because it has previously routed it,
37793 and the following routers presumably cannot handle the alias. The forward file
37794 should really contain
37795 </para>
37796 <literallayout class="monospaced">
37797 spqr, spqr@reme.elsewhere.example
37798 </literallayout>
37799 <para>
37800 but because this is such a common error, the <option>check_ancestor</option> option (see
37801 below) exists to provide a way to get round it. This is normally set on a
37802 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
37803 </para>
37804 </section>
37805 <section id="SECTspecitredli">
37806 <title>Special items in redirection lists</title>
37807 <para>
37808 In addition to addresses, the following types of item may appear in redirection
37809 lists (that is, in non-filter redirection data):
37810 </para>
37811 <itemizedlist>
37812 <listitem>
37813 <para>
37814 <indexterm role="concept">
37815 <primary>pipe</primary>
37816 <secondary>in redirection list</secondary>
37817 </indexterm>
37818 <indexterm role="concept">
37819 <primary>address redirection</primary>
37820 <secondary>to pipe</secondary>
37821 </indexterm>
37822 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
37823 as a valid RFC 2822 address that includes a domain. A transport for running the
37824 command must be specified by the <option>pipe_transport</option> option.
37825 Normally, either the router or the transport specifies a user and a group under
37826 which to run the delivery. The default is to use the Exim user and group.
37827 </para>
37828 <para>
37829 Single or double quotes can be used for enclosing the individual arguments of
37830 the pipe command; no interpretation of escapes is done for single quotes. If
37831 the command contains a comma character, it is necessary to put the whole item
37832 in double quotes, for example:
37833 </para>
37834 <literallayout class="monospaced">
37835 "|/some/command ready,steady,go"
37836 </literallayout>
37837 <para>
37838 since items in redirection lists are terminated by commas. Do not, however,
37839 quote just the command. An item such as
37840 </para>
37841 <literallayout class="monospaced">
37842 |"/some/command ready,steady,go"
37843 </literallayout>
37844 <para>
37845 is interpreted as a pipe with a rather strange command name, and no arguments.
37846 </para>
37847 <para>
37848 Note that the above example assumes that the text comes from a lookup source
37849 of some sort, so that the quotes are part of the data.  If composing a
37850 redirect router with a <option>data</option> option directly specifying this command, the
37851 quotes will be used by the configuration parser to define the extent of one
37852 string, but will not be passed down into the redirect router itself.  There
37853 are two main approaches to get around this: escape quotes to be part of the
37854 data itself, or avoid using this mechanism and instead create a custom
37855 transport with the <option>command</option> option set and reference that transport from
37856 an <option>accept</option> router.
37857 </para>
37858 </listitem>
37859 <listitem>
37860 <para>
37861 <indexterm role="concept">
37862 <primary>file</primary>
37863 <secondary>in redirection list</secondary>
37864 </indexterm>
37865 <indexterm role="concept">
37866 <primary>address redirection</primary>
37867 <secondary>to file</secondary>
37868 </indexterm>
37869 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
37870 parse as a valid RFC 2822 address that includes a domain. For example,
37871 </para>
37872 <literallayout class="monospaced">
37873 /home/world/minbari
37874 </literallayout>
37875 <para>
37876 is treated as a file name, but
37877 </para>
37878 <literallayout class="monospaced">
37879 /s=molari/o=babylon/@x400gate.way
37880 </literallayout>
37881 <para>
37882 is treated as an address. For a file name, a transport must be specified using
37883 the <option>file_transport</option> option. However, if the generated path name ends with a
37884 forward slash character, it is interpreted as a directory name rather than a
37885 file name, and <option>directory_transport</option> is used instead.
37886 </para>
37887 <para>
37888 Normally, either the router or the transport specifies a user and a group under
37889 which to run the delivery. The default is to use the Exim user and group.
37890 </para>
37891 <para>
37892 <indexterm role="concept">
37893 <primary><filename>/dev/null</filename></primary>
37894 </indexterm>
37895 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
37896 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
37897 instead of a transport name. In this case the user and group are not used.
37898 </para>
37899 </listitem>
37900 <listitem>
37901 <para>
37902 <indexterm role="concept">
37903 <primary>included address list</primary>
37904 </indexterm>
37905 <indexterm role="concept">
37906 <primary>address redirection</primary>
37907 <secondary>included external list</secondary>
37908 </indexterm>
37909 If an item is of the form
37910 </para>
37911 <literallayout class="monospaced">
37912 :include:&lt;path name&gt;
37913 </literallayout>
37914 <para>
37915 a list of further items is taken from the given file and included at that
37916 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
37917 out-of-line addition to the list. The items in the included list are separated
37918 by commas or newlines and are not subject to expansion. If this is the first
37919 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
37920 the alias name. This example is incorrect:
37921 </para>
37922 <literallayout class="monospaced">
37923 list1    :include:/opt/lists/list1
37924 </literallayout>
37925 <para>
37926 It must be given as
37927 </para>
37928 <literallayout class="monospaced">
37929 list1:   :include:/opt/lists/list1
37930 </literallayout>
37931 </listitem>
37932 <listitem>
37933 <para>
37934 <indexterm role="concept">
37935 <primary>address redirection</primary>
37936 <secondary>to black hole</secondary>
37937 </indexterm>
37938 <indexterm role="concept">
37939 <primary>delivery</primary>
37940 <secondary>discard</secondary>
37941 </indexterm>
37942 <indexterm role="concept">
37943 <primary>delivery</primary>
37944 <secondary>blackhole</secondary>
37945 </indexterm>
37946 <indexterm role="concept">
37947 <primary>black hole</primary>
37948 </indexterm>
37949 <indexterm role="concept">
37950 <primary>abandoning mail</primary>
37951 </indexterm>
37952 Sometimes you want to throw away mail to a particular local part.  Making the
37953 <option>data</option> option expand to an empty string does not work, because that causes
37954 the router to decline. Instead, the alias item
37955 </para>
37956 <literallayout class="monospaced">
37957 :blackhole:
37958 </literallayout>
37959 <para>
37960 can be used. It does what its name implies. No delivery is
37961 done, and no error message is generated. This has the same effect as specifying
37962 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
37963 </para>
37964 <para>
37965 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
37966 delivery is done for the original local part, even if other redirection items
37967 are present. If you are generating a multi-item list (for example, by reading a
37968 database) and need the ability to provide a no-op item, you must use
37969 <filename>/dev/null</filename>.
37970 </para>
37971 </listitem>
37972 <listitem>
37973 <para>
37974 <indexterm role="concept">
37975 <primary>delivery</primary>
37976 <secondary>forcing failure</secondary>
37977 </indexterm>
37978 <indexterm role="concept">
37979 <primary>delivery</primary>
37980 <secondary>forcing deferral</secondary>
37981 </indexterm>
37982 <indexterm role="concept">
37983 <primary>failing delivery</primary>
37984 <secondary>forcing</secondary>
37985 </indexterm>
37986 <indexterm role="concept">
37987 <primary>deferred delivery, forcing</primary>
37988 </indexterm>
37989 <indexterm role="concept">
37990 <primary>customizing</primary>
37991 <secondary>failure message</secondary>
37992 </indexterm>
37993 An attempt to deliver a particular address can be deferred or forced to fail by
37994 redirection items of the form
37995 </para>
37996 <literallayout class="monospaced">
37997 :defer:
37998 :fail:
37999 </literallayout>
38000 <para>
38001 respectively. When a redirection list contains such an item, it applies
38002 to the entire redirection; any other items in the list are ignored. Any
38003 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
38004 associated with the failure. For example, an alias file might contain:
38005 </para>
38006 <literallayout class="monospaced">
38007 X.Employee:  :fail: Gone away, no forwarding address
38008 </literallayout>
38009 <para>
38010 In the case of an address that is being verified from an ACL or as the subject
38011 of a
38012 <indexterm role="concept">
38013 <primary>VRFY</primary>
38014 <secondary>error text, display of</secondary>
38015 </indexterm>
38016 VRFY command, the text is included in the SMTP error response by
38017 default.
38018 <indexterm role="concept">
38019 <primary>EXPN</primary>
38020 <secondary>error text, display of</secondary>
38021 </indexterm>
38022 The text is not included in the response to an EXPN command. In non-SMTP cases
38023 the text is included in the error message that Exim generates.
38024 </para>
38025 <para>
38026 <indexterm role="concept">
38027 <primary>SMTP</primary>
38028 <secondary>error codes</secondary>
38029 </indexterm>
38030 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
38031 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
38032 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
38033 followed by a space, and the very first digit is the same as the default error
38034 code, the code from the message is used instead. If the very first digit is
38035 incorrect, a panic error is logged, and the default code is used. You can
38036 suppress the use of the supplied code in a redirect router by setting the
38037 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
38038 ignored.
38039 </para>
38040 <para>
38041 <indexterm role="variable">
38042 <primary><varname>$acl_verify_message</varname></primary>
38043 </indexterm>
38044 In an ACL, an explicitly provided message overrides the default, but the
38045 default message is available in the variable <varname>$acl_verify_message</varname> and can
38046 therefore be included in a custom message if this is desired.
38047 </para>
38048 <para>
38049 Normally the error text is the rest of the redirection list &ndash; a comma does
38050 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
38051 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
38052 as part of the continuation process, but they may exist in other kinds of
38053 lookup and in <emphasis>:include:</emphasis> files.
38054 </para>
38055 <para>
38056 During routing for message delivery (as opposed to verification), a redirection
38057 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
38058 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
38059 subsequent delivery attempt can happen at a later time. If an address is
38060 deferred for too long, it will ultimately fail, because the normal retry
38061 rules still apply.
38062 </para>
38063 </listitem>
38064 <listitem>
38065 <para>
38066 <indexterm role="concept">
38067 <primary>alias file</primary>
38068 <secondary>exception to default</secondary>
38069 </indexterm>
38070 Sometimes it is useful to use a single-key search type with a default (see
38071 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
38072 for exceptions to the default. These can be handled by aliasing them to
38073 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
38074 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
38075 results in an empty redirection list has the same effect.
38076 </para>
38077 </listitem>
38078 </itemizedlist>
38079 </section>
38080 <section id="SECTdupaddr">
38081 <title>Duplicate addresses</title>
38082 <para>
38083 <indexterm role="concept">
38084 <primary>duplicate addresses</primary>
38085 </indexterm>
38086 <indexterm role="concept">
38087 <primary>address duplicate, discarding</primary>
38088 </indexterm>
38089 <indexterm role="concept">
38090 <primary>pipe</primary>
38091 <secondary>duplicated</secondary>
38092 </indexterm>
38093 Exim removes duplicate addresses from the list to which it is delivering, so as
38094 to deliver just one copy to each address. This does not apply to deliveries
38095 routed to pipes by different immediate parent addresses, but an indirect
38096 aliasing scheme of the type
38097 </para>
38098 <literallayout class="monospaced">
38099 pipe:       |/some/command $local_part
38100 localpart1: pipe
38101 localpart2: pipe
38102 </literallayout>
38103 <para>
38104 does not work with a message that is addressed to both local parts, because
38105 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
38106 discarded as being the same as a previously handled address. However, a scheme
38107 such as
38108 </para>
38109 <literallayout class="monospaced">
38110 localpart1: |/some/command $local_part
38111 localpart2: |/some/command $local_part
38112 </literallayout>
38113 <para>
38114 does result in two different pipe deliveries, because the immediate parents of
38115 the pipes are distinct.
38116 </para>
38117 </section>
38118 <section id="SECID128">
38119 <title>Repeated redirection expansion</title>
38120 <para>
38121 <indexterm role="concept">
38122 <primary>repeated redirection expansion</primary>
38123 </indexterm>
38124 <indexterm role="concept">
38125 <primary>address redirection</primary>
38126 <secondary>repeated for each delivery attempt</secondary>
38127 </indexterm>
38128 When a message cannot be delivered to all of its recipients immediately,
38129 leading to two or more delivery attempts, redirection expansion is carried out
38130 afresh each time for those addresses whose children were not all previously
38131 delivered. If redirection is being used as a mailing list, this can lead to new
38132 members of the list receiving copies of old messages. The <option>one_time</option> option
38133 can be used to avoid this.
38134 </para>
38135 </section>
38136 <section id="SECID129">
38137 <title>Errors in redirection lists</title>
38138 <para>
38139 <indexterm role="concept">
38140 <primary>address redirection</primary>
38141 <secondary>errors</secondary>
38142 </indexterm>
38143 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
38144 error is skipped, and an entry is written to the main log. This may be useful
38145 for mailing lists that are automatically managed. Otherwise, if an error is
38146 detected while generating the list of new addresses, the original address is
38147 deferred. See also <option>syntax_errors_to</option>.
38148 </para>
38149 </section>
38150 <section id="SECID130">
38151 <title>Private options for the redirect router</title>
38152 <para>
38153 <indexterm role="concept">
38154 <primary>options</primary>
38155 <secondary><command>redirect</command> router</secondary>
38156 </indexterm>
38157 The private options for the <command>redirect</command> router are as follows:
38158 </para>
38159 <para>
38160 <indexterm role="option">
38161 <primary><option>allow_defer</option></primary>
38162 </indexterm>
38163 </para>
38164 <informaltable frame="all">
38165 <tgroup cols="4" colsep="0" rowsep="0">
38166 <colspec colwidth="8*" align="left"/>
38167 <colspec colwidth="6*" align="center"/>
38168 <colspec colwidth="6*" align="center"/>
38169 <colspec colwidth="6*" align="right"/>
38170 <tbody>
38171 <row>
38172 <entry><option>allow_defer</option></entry>
38173 <entry>Use: <emphasis>redirect</emphasis></entry>
38174 <entry>Type: <emphasis>boolean</emphasis></entry>
38175 <entry>Default: <emphasis>false</emphasis></entry>
38176 </row>
38177 </tbody>
38178 </tgroup>
38179 </informaltable>
38180 <para>
38181 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
38182 data, or the <option>defer</option> command in an Exim filter file.
38183 </para>
38184 <para>
38185 <indexterm role="option">
38186 <primary><option>allow_fail</option></primary>
38187 </indexterm>
38188 </para>
38189 <informaltable frame="all">
38190 <tgroup cols="4" colsep="0" rowsep="0">
38191 <colspec colwidth="8*" align="left"/>
38192 <colspec colwidth="6*" align="center"/>
38193 <colspec colwidth="6*" align="center"/>
38194 <colspec colwidth="6*" align="right"/>
38195 <tbody>
38196 <row>
38197 <entry><option>allow_fail</option></entry>
38198 <entry>Use: <emphasis>redirect</emphasis></entry>
38199 <entry>Type: <emphasis>boolean</emphasis></entry>
38200 <entry>Default: <emphasis>false</emphasis></entry>
38201 </row>
38202 </tbody>
38203 </tgroup>
38204 </informaltable>
38205 <para>
38206 <indexterm role="concept">
38207 <primary>failing delivery</primary>
38208 <secondary>from filter</secondary>
38209 </indexterm>
38210 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
38211 and the <option>fail</option> command may be used in an Exim filter file.
38212 </para>
38213 <para>
38214 <indexterm role="option">
38215 <primary><option>allow_filter</option></primary>
38216 </indexterm>
38217 </para>
38218 <informaltable frame="all">
38219 <tgroup cols="4" colsep="0" rowsep="0">
38220 <colspec colwidth="8*" align="left"/>
38221 <colspec colwidth="6*" align="center"/>
38222 <colspec colwidth="6*" align="center"/>
38223 <colspec colwidth="6*" align="right"/>
38224 <tbody>
38225 <row>
38226 <entry><option>allow_filter</option></entry>
38227 <entry>Use: <emphasis>redirect</emphasis></entry>
38228 <entry>Type: <emphasis>boolean</emphasis></entry>
38229 <entry>Default: <emphasis>false</emphasis></entry>
38230 </row>
38231 </tbody>
38232 </tgroup>
38233 </informaltable>
38234 <para>
38235 <indexterm role="concept">
38236 <primary>filter</primary>
38237 <secondary>enabling use of</secondary>
38238 </indexterm>
38239 <indexterm role="concept">
38240 <primary>Sieve filter</primary>
38241 <secondary>enabling use of</secondary>
38242 </indexterm>
38243 Setting this option allows Exim to interpret redirection data that starts with
38244 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
38245 are some features of Exim filter files that some administrators may wish to
38246 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
38247 </para>
38248 <para>
38249 It is also possible to lock out Exim filters or Sieve filters while allowing
38250 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
38251 </para>
38252 <para>
38253 The filter is run using the uid and gid set by the generic <option>user</option> and
38254 <option>group</option> options. These take their defaults from the password data if
38255 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
38256 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
38257 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
38258 </para>
38259 <para>
38260 <indexterm role="option">
38261 <primary><option>allow_freeze</option></primary>
38262 </indexterm>
38263 </para>
38264 <informaltable frame="all">
38265 <tgroup cols="4" colsep="0" rowsep="0">
38266 <colspec colwidth="8*" align="left"/>
38267 <colspec colwidth="6*" align="center"/>
38268 <colspec colwidth="6*" align="center"/>
38269 <colspec colwidth="6*" align="right"/>
38270 <tbody>
38271 <row>
38272 <entry><option>allow_freeze</option></entry>
38273 <entry>Use: <emphasis>redirect</emphasis></entry>
38274 <entry>Type: <emphasis>boolean</emphasis></entry>
38275 <entry>Default: <emphasis>false</emphasis></entry>
38276 </row>
38277 </tbody>
38278 </tgroup>
38279 </informaltable>
38280 <para>
38281 <indexterm role="concept">
38282 <primary>freezing messages</primary>
38283 <secondary>allowing in filter</secondary>
38284 </indexterm>
38285 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
38286 This command is more normally encountered in system filters, and is disabled by
38287 default for redirection filters because it isn&#x2019;t something you usually want to
38288 let ordinary users do.
38289 </para>
38290 <para>
38291 <indexterm role="option">
38292 <primary><option>check_ancestor</option></primary>
38293 </indexterm>
38294 </para>
38295 <informaltable frame="all">
38296 <tgroup cols="4" colsep="0" rowsep="0">
38297 <colspec colwidth="8*" align="left"/>
38298 <colspec colwidth="6*" align="center"/>
38299 <colspec colwidth="6*" align="center"/>
38300 <colspec colwidth="6*" align="right"/>
38301 <tbody>
38302 <row>
38303 <entry><option>check_ancestor</option></entry>
38304 <entry>Use: <emphasis>redirect</emphasis></entry>
38305 <entry>Type: <emphasis>boolean</emphasis></entry>
38306 <entry>Default: <emphasis>false</emphasis></entry>
38307 </row>
38308 </tbody>
38309 </tgroup>
38310 </informaltable>
38311 <para>
38312 This option is concerned with handling generated addresses that are the same
38313 as some address in the list of redirection ancestors of the current address.
38314 Although it is turned off by default in the code, it is set in the default
38315 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
38316 for this use of the <command>redirect</command> router.
38317 </para>
38318 <para>
38319 When <option>check_ancestor</option> is set, if a generated address (including the domain)
38320 is the same as any ancestor of the current address, it is replaced by a copy of
38321 the current address. This helps in the case where local part A is aliased to B,
38322 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
38323 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
38324 <filename>&nbsp;jb/.forward</filename> contains:
38325 </para>
38326 <literallayout class="monospaced">
38327 \Joe.Bloggs, &lt;other item(s)&gt;
38328 </literallayout>
38329 <para>
38330 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
38331 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
38332 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
38333 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
38334 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
38335 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
38336 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
38337 original address. See also the <option>repeat_use</option> option below.
38338 </para>
38339 <para>
38340 <indexterm role="option">
38341 <primary><option>check_group</option></primary>
38342 </indexterm>
38343 </para>
38344 <informaltable frame="all">
38345 <tgroup cols="4" colsep="0" rowsep="0">
38346 <colspec colwidth="8*" align="left"/>
38347 <colspec colwidth="6*" align="center"/>
38348 <colspec colwidth="6*" align="center"/>
38349 <colspec colwidth="6*" align="right"/>
38350 <tbody>
38351 <row>
38352 <entry><option>check_group</option></entry>
38353 <entry>Use: <emphasis>redirect</emphasis></entry>
38354 <entry>Type: <emphasis>boolean</emphasis></entry>
38355 <entry>Default: <emphasis>see below</emphasis></entry>
38356 </row>
38357 </tbody>
38358 </tgroup>
38359 </informaltable>
38360 <para>
38361 When the <option>file</option> option is used, the group owner of the file is checked only
38362 when this option is set. The permitted groups are those listed in the
38363 <option>owngroups</option> option, together with the user&#x2019;s default group if
38364 <option>check_local_user</option> is set. If the file has the wrong group, routing is
38365 deferred. The default setting for this option is true if <option>check_local_user</option>
38366 is set and the <option>modemask</option> option permits the group write bit, or if the
38367 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
38368 </para>
38369 <para>
38370 <indexterm role="option">
38371 <primary><option>check_owner</option></primary>
38372 </indexterm>
38373 </para>
38374 <informaltable frame="all">
38375 <tgroup cols="4" colsep="0" rowsep="0">
38376 <colspec colwidth="8*" align="left"/>
38377 <colspec colwidth="6*" align="center"/>
38378 <colspec colwidth="6*" align="center"/>
38379 <colspec colwidth="6*" align="right"/>
38380 <tbody>
38381 <row>
38382 <entry><option>check_owner</option></entry>
38383 <entry>Use: <emphasis>redirect</emphasis></entry>
38384 <entry>Type: <emphasis>boolean</emphasis></entry>
38385 <entry>Default: <emphasis>see below</emphasis></entry>
38386 </row>
38387 </tbody>
38388 </tgroup>
38389 </informaltable>
38390 <para>
38391 When the <option>file</option> option is used, the owner of the file is checked only when
38392 this option is set. If <option>check_local_user</option> is set, the local user is
38393 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
38394 option. The default value for this option is true if <option>check_local_user</option> or
38395 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
38396 </para>
38397 <para>
38398 <indexterm role="option">
38399 <primary><option>data</option></primary>
38400 </indexterm>
38401 </para>
38402 <informaltable frame="all">
38403 <tgroup cols="4" colsep="0" rowsep="0">
38404 <colspec colwidth="8*" align="left"/>
38405 <colspec colwidth="6*" align="center"/>
38406 <colspec colwidth="6*" align="center"/>
38407 <colspec colwidth="6*" align="right"/>
38408 <tbody>
38409 <row>
38410 <entry><option>data</option></entry>
38411 <entry>Use: <emphasis>redirect</emphasis></entry>
38412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38413 <entry>Default: <emphasis>unset</emphasis></entry>
38414 </row>
38415 </tbody>
38416 </tgroup>
38417 </informaltable>
38418 <para>
38419 This option is mutually exclusive with <option>file</option>. One or other of them must be
38420 set, but not both. The contents of <option>data</option> are expanded, and then used as the
38421 list of forwarding items, or as a set of filtering instructions. If the
38422 expansion is forced to fail, or the result is an empty string or a string that
38423 has no effect (consists entirely of comments), the router declines.
38424 </para>
38425 <para>
38426 When filtering instructions are used, the string must begin with <quote>#Exim
38427 filter</quote>, and all comments in the string, including this initial one, must be
38428 terminated with newline characters. For example:
38429 </para>
38430 <literallayout class="monospaced">
38431 data = #Exim filter\n\
38432        if $h_to: contains Exim then save $home/mail/exim endif
38433 </literallayout>
38434 <para>
38435 If you are reading the data from a database where newlines cannot be included,
38436 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
38437 choice into a newline.
38438 </para>
38439 <para>
38440 <indexterm role="option">
38441 <primary><option>directory_transport</option></primary>
38442 </indexterm>
38443 </para>
38444 <informaltable frame="all">
38445 <tgroup cols="4" colsep="0" rowsep="0">
38446 <colspec colwidth="8*" align="left"/>
38447 <colspec colwidth="6*" align="center"/>
38448 <colspec colwidth="6*" align="center"/>
38449 <colspec colwidth="6*" align="right"/>
38450 <tbody>
38451 <row>
38452 <entry><option>directory_transport</option></entry>
38453 <entry>Use: <emphasis>redirect</emphasis></entry>
38454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38455 <entry>Default: <emphasis>unset</emphasis></entry>
38456 </row>
38457 </tbody>
38458 </tgroup>
38459 </informaltable>
38460 <para>
38461 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
38462 ending with a slash is specified as a new <quote>address</quote>. The transport used is
38463 specified by this option, which, after expansion, must be the name of a
38464 configured transport. This should normally be an <command>appendfile</command> transport.
38465 </para>
38466 <para>
38467 <indexterm role="option">
38468 <primary><option>file</option></primary>
38469 </indexterm>
38470 </para>
38471 <informaltable frame="all">
38472 <tgroup cols="4" colsep="0" rowsep="0">
38473 <colspec colwidth="8*" align="left"/>
38474 <colspec colwidth="6*" align="center"/>
38475 <colspec colwidth="6*" align="center"/>
38476 <colspec colwidth="6*" align="right"/>
38477 <tbody>
38478 <row>
38479 <entry><option>file</option></entry>
38480 <entry>Use: <emphasis>redirect</emphasis></entry>
38481 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38482 <entry>Default: <emphasis>unset</emphasis></entry>
38483 </row>
38484 </tbody>
38485 </tgroup>
38486 </informaltable>
38487 <para>
38488 This option specifies the name of a file that contains the redirection data. It
38489 is mutually exclusive with the <option>data</option> option. The string is expanded before
38490 use; if the expansion is forced to fail, the router declines. Other expansion
38491 failures cause delivery to be deferred. The result of a successful expansion
38492 must be an absolute path. The entire file is read and used as the redirection
38493 data. If the data is an empty string or a string that has no effect (consists
38494 entirely of comments), the router declines.
38495 </para>
38496 <para>
38497 <indexterm role="concept">
38498 <primary>NFS</primary>
38499 <secondary>checking for file existence</secondary>
38500 </indexterm>
38501 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
38502 runs a check on the containing directory,
38503 unless <option>ignore_enotdir</option> is true (see below).
38504 If the directory does not appear to exist, delivery is deferred. This can
38505 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
38506 is a mount problem. If the containing directory does exist, but the file does
38507 not, the router declines.
38508 </para>
38509 <para>
38510 <indexterm role="option">
38511 <primary><option>file_transport</option></primary>
38512 </indexterm>
38513 </para>
38514 <informaltable frame="all">
38515 <tgroup cols="4" colsep="0" rowsep="0">
38516 <colspec colwidth="8*" align="left"/>
38517 <colspec colwidth="6*" align="center"/>
38518 <colspec colwidth="6*" align="center"/>
38519 <colspec colwidth="6*" align="right"/>
38520 <tbody>
38521 <row>
38522 <entry><option>file_transport</option></entry>
38523 <entry>Use: <emphasis>redirect</emphasis></entry>
38524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38525 <entry>Default: <emphasis>unset</emphasis></entry>
38526 </row>
38527 </tbody>
38528 </tgroup>
38529 </informaltable>
38530 <para>
38531 <indexterm role="variable">
38532 <primary><varname>$address_file</varname></primary>
38533 </indexterm>
38534 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
38535 ending in a slash is specified as a new <quote>address</quote>. The transport used is
38536 specified by this option, which, after expansion, must be the name of a
38537 configured transport. This should normally be an <command>appendfile</command> transport. When
38538 it is running, the file name is in <varname>$address_file</varname>.
38539 </para>
38540 <para>
38541 <indexterm role="option">
38542 <primary><option>filter_prepend_home</option></primary>
38543 </indexterm>
38544 </para>
38545 <informaltable frame="all">
38546 <tgroup cols="4" colsep="0" rowsep="0">
38547 <colspec colwidth="8*" align="left"/>
38548 <colspec colwidth="6*" align="center"/>
38549 <colspec colwidth="6*" align="center"/>
38550 <colspec colwidth="6*" align="right"/>
38551 <tbody>
38552 <row>
38553 <entry><option>filter_prepend_home</option></entry>
38554 <entry>Use: <emphasis>redirect</emphasis></entry>
38555 <entry>Type: <emphasis>boolean</emphasis></entry>
38556 <entry>Default: <emphasis>true</emphasis></entry>
38557 </row>
38558 </tbody>
38559 </tgroup>
38560 </informaltable>
38561 <para>
38562 When this option is true, if a <command>save</command> command in an Exim filter specifies a
38563 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
38564 relative path. If this option is set false, this action does not happen. The
38565 relative path is then passed to the transport unmodified.
38566 </para>
38567 <para>
38568 <indexterm role="option">
38569 <primary><option>forbid_blackhole</option></primary>
38570 </indexterm>
38571 </para>
38572 <informaltable frame="all">
38573 <tgroup cols="4" colsep="0" rowsep="0">
38574 <colspec colwidth="8*" align="left"/>
38575 <colspec colwidth="6*" align="center"/>
38576 <colspec colwidth="6*" align="center"/>
38577 <colspec colwidth="6*" align="right"/>
38578 <tbody>
38579 <row>
38580 <entry><option>forbid_blackhole</option></entry>
38581 <entry>Use: <emphasis>redirect</emphasis></entry>
38582 <entry>Type: <emphasis>boolean</emphasis></entry>
38583 <entry>Default: <emphasis>false</emphasis></entry>
38584 </row>
38585 </tbody>
38586 </tgroup>
38587 </informaltable>
38588 <para>
38589 <indexterm role="concept">
38590 <primary>restricting access to features</primary>
38591 </indexterm>
38592 <indexterm role="concept">
38593 <primary>filter</primary>
38594 <secondary>locking out certain features</secondary>
38595 </indexterm>
38596 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
38597 redirection list.
38598 </para>
38599 <para>
38600 <indexterm role="option">
38601 <primary><option>forbid_exim_filter</option></primary>
38602 </indexterm>
38603 </para>
38604 <informaltable frame="all">
38605 <tgroup cols="4" colsep="0" rowsep="0">
38606 <colspec colwidth="8*" align="left"/>
38607 <colspec colwidth="6*" align="center"/>
38608 <colspec colwidth="6*" align="center"/>
38609 <colspec colwidth="6*" align="right"/>
38610 <tbody>
38611 <row>
38612 <entry><option>forbid_exim_filter</option></entry>
38613 <entry>Use: <emphasis>redirect</emphasis></entry>
38614 <entry>Type: <emphasis>boolean</emphasis></entry>
38615 <entry>Default: <emphasis>false</emphasis></entry>
38616 </row>
38617 </tbody>
38618 </tgroup>
38619 </informaltable>
38620 <para>
38621 <indexterm role="concept">
38622 <primary>restricting access to features</primary>
38623 </indexterm>
38624 <indexterm role="concept">
38625 <primary>filter</primary>
38626 <secondary>locking out certain features</secondary>
38627 </indexterm>
38628 If this option is set true, only Sieve filters are permitted when
38629 <option>allow_filter</option> is true.
38630 </para>
38631 <para>
38632 <indexterm role="option">
38633 <primary><option>forbid_file</option></primary>
38634 </indexterm>
38635 </para>
38636 <informaltable frame="all">
38637 <tgroup cols="4" colsep="0" rowsep="0">
38638 <colspec colwidth="8*" align="left"/>
38639 <colspec colwidth="6*" align="center"/>
38640 <colspec colwidth="6*" align="center"/>
38641 <colspec colwidth="6*" align="right"/>
38642 <tbody>
38643 <row>
38644 <entry><option>forbid_file</option></entry>
38645 <entry>Use: <emphasis>redirect</emphasis></entry>
38646 <entry>Type: <emphasis>boolean</emphasis></entry>
38647 <entry>Default: <emphasis>false</emphasis></entry>
38648 </row>
38649 </tbody>
38650 </tgroup>
38651 </informaltable>
38652 <para>
38653 <indexterm role="concept">
38654 <primary>restricting access to features</primary>
38655 </indexterm>
38656 <indexterm role="concept">
38657 <primary>delivery</primary>
38658 <secondary>to file; forbidding</secondary>
38659 </indexterm>
38660 <indexterm role="concept">
38661 <primary>filter</primary>
38662 <secondary>locking out certain features</secondary>
38663 </indexterm>
38664 <indexterm role="concept">
38665 <primary>Sieve filter</primary>
38666 <secondary>forbidding delivery to a file</secondary>
38667 </indexterm>
38668 <indexterm role="concept">
38669 <primary>Sieve filter</primary>
38670 <secondary><quote>keep</quote> facility; disabling</secondary>
38671 </indexterm>
38672 If this option is true, this router may not generate a new address that
38673 specifies delivery to a local file or directory, either from a filter or from a
38674 conventional forward file. This option is forced to be true if <option>one_time</option> is
38675 set. It applies to Sieve filters as well as to Exim filters, but if true, it
38676 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
38677 </para>
38678 <para>
38679 <indexterm role="option">
38680 <primary><option>forbid_filter_dlfunc</option></primary>
38681 </indexterm>
38682 </para>
38683 <informaltable frame="all">
38684 <tgroup cols="4" colsep="0" rowsep="0">
38685 <colspec colwidth="8*" align="left"/>
38686 <colspec colwidth="6*" align="center"/>
38687 <colspec colwidth="6*" align="center"/>
38688 <colspec colwidth="6*" align="right"/>
38689 <tbody>
38690 <row>
38691 <entry><option>forbid_filter_dlfunc</option></entry>
38692 <entry>Use: <emphasis>redirect</emphasis></entry>
38693 <entry>Type: <emphasis>boolean</emphasis></entry>
38694 <entry>Default: <emphasis>false</emphasis></entry>
38695 </row>
38696 </tbody>
38697 </tgroup>
38698 </informaltable>
38699 <para>
38700 <indexterm role="concept">
38701 <primary>restricting access to features</primary>
38702 </indexterm>
38703 <indexterm role="concept">
38704 <primary>filter</primary>
38705 <secondary>locking out certain features</secondary>
38706 </indexterm>
38707 If this option is true, string expansions in Exim filters are not allowed to
38708 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
38709 functions.
38710 </para>
38711 <para>
38712 <indexterm role="option">
38713 <primary><option>forbid_filter_existstest</option></primary>
38714 </indexterm>
38715 </para>
38716 <informaltable frame="all">
38717 <tgroup cols="4" colsep="0" rowsep="0">
38718 <colspec colwidth="8*" align="left"/>
38719 <colspec colwidth="6*" align="center"/>
38720 <colspec colwidth="6*" align="center"/>
38721 <colspec colwidth="6*" align="right"/>
38722 <tbody>
38723 <row>
38724 <entry><option>forbid_filter_existstest</option></entry>
38725 <entry>Use: <emphasis>redirect</emphasis></entry>
38726 <entry>Type: <emphasis>boolean</emphasis></entry>
38727 <entry>Default: <emphasis>false</emphasis></entry>
38728 </row>
38729 </tbody>
38730 </tgroup>
38731 </informaltable>
38732 <para>
38733 <indexterm role="concept">
38734 <primary>restricting access to features</primary>
38735 </indexterm>
38736 <indexterm role="concept">
38737 <primary>filter</primary>
38738 <secondary>locking out certain features</secondary>
38739 </indexterm>
38740 <indexterm role="concept">
38741 <primary>expansion</primary>
38742 <secondary>statting a file</secondary>
38743 </indexterm>
38744 If this option is true, string expansions in Exim filters are not allowed to
38745 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
38746 </para>
38747 <para>
38748 <indexterm role="option">
38749 <primary><option>forbid_filter_logwrite</option></primary>
38750 </indexterm>
38751 </para>
38752 <informaltable frame="all">
38753 <tgroup cols="4" colsep="0" rowsep="0">
38754 <colspec colwidth="8*" align="left"/>
38755 <colspec colwidth="6*" align="center"/>
38756 <colspec colwidth="6*" align="center"/>
38757 <colspec colwidth="6*" align="right"/>
38758 <tbody>
38759 <row>
38760 <entry><option>forbid_filter_logwrite</option></entry>
38761 <entry>Use: <emphasis>redirect</emphasis></entry>
38762 <entry>Type: <emphasis>boolean</emphasis></entry>
38763 <entry>Default: <emphasis>false</emphasis></entry>
38764 </row>
38765 </tbody>
38766 </tgroup>
38767 </informaltable>
38768 <para>
38769 <indexterm role="concept">
38770 <primary>restricting access to features</primary>
38771 </indexterm>
38772 <indexterm role="concept">
38773 <primary>filter</primary>
38774 <secondary>locking out certain features</secondary>
38775 </indexterm>
38776 If this option is true, use of the logging facility in Exim filters is not
38777 permitted. Logging is in any case available only if the filter is being run
38778 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
38779 <filename>.forward</filename> files).
38780 </para>
38781 <para>
38782 <indexterm role="option">
38783 <primary><option>forbid_filter_lookup</option></primary>
38784 </indexterm>
38785 </para>
38786 <informaltable frame="all">
38787 <tgroup cols="4" colsep="0" rowsep="0">
38788 <colspec colwidth="8*" align="left"/>
38789 <colspec colwidth="6*" align="center"/>
38790 <colspec colwidth="6*" align="center"/>
38791 <colspec colwidth="6*" align="right"/>
38792 <tbody>
38793 <row>
38794 <entry><option>forbid_filter_lookup</option></entry>
38795 <entry>Use: <emphasis>redirect</emphasis></entry>
38796 <entry>Type: <emphasis>boolean</emphasis></entry>
38797 <entry>Default: <emphasis>false</emphasis></entry>
38798 </row>
38799 </tbody>
38800 </tgroup>
38801 </informaltable>
38802 <para>
38803 <indexterm role="concept">
38804 <primary>restricting access to features</primary>
38805 </indexterm>
38806 <indexterm role="concept">
38807 <primary>filter</primary>
38808 <secondary>locking out certain features</secondary>
38809 </indexterm>
38810 If this option is true, string expansions in Exim filter files are not allowed
38811 to make use of <option>lookup</option> items.
38812 </para>
38813 <para>
38814 <indexterm role="option">
38815 <primary><option>forbid_filter_perl</option></primary>
38816 </indexterm>
38817 </para>
38818 <informaltable frame="all">
38819 <tgroup cols="4" colsep="0" rowsep="0">
38820 <colspec colwidth="8*" align="left"/>
38821 <colspec colwidth="6*" align="center"/>
38822 <colspec colwidth="6*" align="center"/>
38823 <colspec colwidth="6*" align="right"/>
38824 <tbody>
38825 <row>
38826 <entry><option>forbid_filter_perl</option></entry>
38827 <entry>Use: <emphasis>redirect</emphasis></entry>
38828 <entry>Type: <emphasis>boolean</emphasis></entry>
38829 <entry>Default: <emphasis>false</emphasis></entry>
38830 </row>
38831 </tbody>
38832 </tgroup>
38833 </informaltable>
38834 <para>
38835 <indexterm role="concept">
38836 <primary>restricting access to features</primary>
38837 </indexterm>
38838 <indexterm role="concept">
38839 <primary>filter</primary>
38840 <secondary>locking out certain features</secondary>
38841 </indexterm>
38842 This option has an effect only if Exim is built with embedded Perl support. If
38843 it is true, string expansions in Exim filter files are not allowed to make use
38844 of the embedded Perl support.
38845 </para>
38846 <para>
38847 <indexterm role="option">
38848 <primary><option>forbid_filter_readfile</option></primary>
38849 </indexterm>
38850 </para>
38851 <informaltable frame="all">
38852 <tgroup cols="4" colsep="0" rowsep="0">
38853 <colspec colwidth="8*" align="left"/>
38854 <colspec colwidth="6*" align="center"/>
38855 <colspec colwidth="6*" align="center"/>
38856 <colspec colwidth="6*" align="right"/>
38857 <tbody>
38858 <row>
38859 <entry><option>forbid_filter_readfile</option></entry>
38860 <entry>Use: <emphasis>redirect</emphasis></entry>
38861 <entry>Type: <emphasis>boolean</emphasis></entry>
38862 <entry>Default: <emphasis>false</emphasis></entry>
38863 </row>
38864 </tbody>
38865 </tgroup>
38866 </informaltable>
38867 <para>
38868 <indexterm role="concept">
38869 <primary>restricting access to features</primary>
38870 </indexterm>
38871 <indexterm role="concept">
38872 <primary>filter</primary>
38873 <secondary>locking out certain features</secondary>
38874 </indexterm>
38875 If this option is true, string expansions in Exim filter files are not allowed
38876 to make use of <option>readfile</option> items.
38877 </para>
38878 <para>
38879 <indexterm role="option">
38880 <primary><option>forbid_filter_readsocket</option></primary>
38881 </indexterm>
38882 </para>
38883 <informaltable frame="all">
38884 <tgroup cols="4" colsep="0" rowsep="0">
38885 <colspec colwidth="8*" align="left"/>
38886 <colspec colwidth="6*" align="center"/>
38887 <colspec colwidth="6*" align="center"/>
38888 <colspec colwidth="6*" align="right"/>
38889 <tbody>
38890 <row>
38891 <entry><option>forbid_filter_readsocket</option></entry>
38892 <entry>Use: <emphasis>redirect</emphasis></entry>
38893 <entry>Type: <emphasis>boolean</emphasis></entry>
38894 <entry>Default: <emphasis>false</emphasis></entry>
38895 </row>
38896 </tbody>
38897 </tgroup>
38898 </informaltable>
38899 <para>
38900 <indexterm role="concept">
38901 <primary>restricting access to features</primary>
38902 </indexterm>
38903 <indexterm role="concept">
38904 <primary>filter</primary>
38905 <secondary>locking out certain features</secondary>
38906 </indexterm>
38907 If this option is true, string expansions in Exim filter files are not allowed
38908 to make use of <option>readsocket</option> items.
38909 </para>
38910 <para>
38911 <indexterm role="option">
38912 <primary><option>forbid_filter_reply</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>forbid_filter_reply</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>restricting access to features</primary>
38934 </indexterm>
38935 <indexterm role="concept">
38936 <primary>filter</primary>
38937 <secondary>locking out certain features</secondary>
38938 </indexterm>
38939 If this option is true, this router may not generate an automatic reply
38940 message. Automatic replies can be generated only from Exim or Sieve filter
38941 files, not from traditional forward files. This option is forced to be true if
38942 <option>one_time</option> is set.
38943 </para>
38944 <para>
38945 <indexterm role="option">
38946 <primary><option>forbid_filter_run</option></primary>
38947 </indexterm>
38948 </para>
38949 <informaltable frame="all">
38950 <tgroup cols="4" colsep="0" rowsep="0">
38951 <colspec colwidth="8*" align="left"/>
38952 <colspec colwidth="6*" align="center"/>
38953 <colspec colwidth="6*" align="center"/>
38954 <colspec colwidth="6*" align="right"/>
38955 <tbody>
38956 <row>
38957 <entry><option>forbid_filter_run</option></entry>
38958 <entry>Use: <emphasis>redirect</emphasis></entry>
38959 <entry>Type: <emphasis>boolean</emphasis></entry>
38960 <entry>Default: <emphasis>false</emphasis></entry>
38961 </row>
38962 </tbody>
38963 </tgroup>
38964 </informaltable>
38965 <para>
38966 <indexterm role="concept">
38967 <primary>restricting access to features</primary>
38968 </indexterm>
38969 <indexterm role="concept">
38970 <primary>filter</primary>
38971 <secondary>locking out certain features</secondary>
38972 </indexterm>
38973 If this option is true, string expansions in Exim filter files are not allowed
38974 to make use of <option>run</option> items.
38975 </para>
38976 <para>
38977 <indexterm role="option">
38978 <primary><option>forbid_include</option></primary>
38979 </indexterm>
38980 </para>
38981 <informaltable frame="all">
38982 <tgroup cols="4" colsep="0" rowsep="0">
38983 <colspec colwidth="8*" align="left"/>
38984 <colspec colwidth="6*" align="center"/>
38985 <colspec colwidth="6*" align="center"/>
38986 <colspec colwidth="6*" align="right"/>
38987 <tbody>
38988 <row>
38989 <entry><option>forbid_include</option></entry>
38990 <entry>Use: <emphasis>redirect</emphasis></entry>
38991 <entry>Type: <emphasis>boolean</emphasis></entry>
38992 <entry>Default: <emphasis>false</emphasis></entry>
38993 </row>
38994 </tbody>
38995 </tgroup>
38996 </informaltable>
38997 <para>
38998 <indexterm role="concept">
38999 <primary>restricting access to features</primary>
39000 </indexterm>
39001 <indexterm role="concept">
39002 <primary>filter</primary>
39003 <secondary>locking out certain features</secondary>
39004 </indexterm>
39005 If this option is true, items of the form
39006 </para>
39007 <literallayout class="monospaced">
39008 :include:&lt;path name&gt;
39009 </literallayout>
39010 <para>
39011 are not permitted in non-filter redirection lists.
39012 </para>
39013 <para>
39014 <indexterm role="option">
39015 <primary><option>forbid_pipe</option></primary>
39016 </indexterm>
39017 </para>
39018 <informaltable frame="all">
39019 <tgroup cols="4" colsep="0" rowsep="0">
39020 <colspec colwidth="8*" align="left"/>
39021 <colspec colwidth="6*" align="center"/>
39022 <colspec colwidth="6*" align="center"/>
39023 <colspec colwidth="6*" align="right"/>
39024 <tbody>
39025 <row>
39026 <entry><option>forbid_pipe</option></entry>
39027 <entry>Use: <emphasis>redirect</emphasis></entry>
39028 <entry>Type: <emphasis>boolean</emphasis></entry>
39029 <entry>Default: <emphasis>false</emphasis></entry>
39030 </row>
39031 </tbody>
39032 </tgroup>
39033 </informaltable>
39034 <para>
39035 <indexterm role="concept">
39036 <primary>restricting access to features</primary>
39037 </indexterm>
39038 <indexterm role="concept">
39039 <primary>filter</primary>
39040 <secondary>locking out certain features</secondary>
39041 </indexterm>
39042 <indexterm role="concept">
39043 <primary>delivery</primary>
39044 <secondary>to pipe; forbidding</secondary>
39045 </indexterm>
39046 If this option is true, this router may not generate a new address which
39047 specifies delivery to a pipe, either from an Exim filter or from a conventional
39048 forward file. This option is forced to be true if <option>one_time</option> is set.
39049 </para>
39050 <para>
39051 <indexterm role="option">
39052 <primary><option>forbid_sieve_filter</option></primary>
39053 </indexterm>
39054 </para>
39055 <informaltable frame="all">
39056 <tgroup cols="4" colsep="0" rowsep="0">
39057 <colspec colwidth="8*" align="left"/>
39058 <colspec colwidth="6*" align="center"/>
39059 <colspec colwidth="6*" align="center"/>
39060 <colspec colwidth="6*" align="right"/>
39061 <tbody>
39062 <row>
39063 <entry><option>forbid_sieve_filter</option></entry>
39064 <entry>Use: <emphasis>redirect</emphasis></entry>
39065 <entry>Type: <emphasis>boolean</emphasis></entry>
39066 <entry>Default: <emphasis>false</emphasis></entry>
39067 </row>
39068 </tbody>
39069 </tgroup>
39070 </informaltable>
39071 <para>
39072 <indexterm role="concept">
39073 <primary>restricting access to features</primary>
39074 </indexterm>
39075 <indexterm role="concept">
39076 <primary>filter</primary>
39077 <secondary>locking out certain features</secondary>
39078 </indexterm>
39079 If this option is set true, only Exim filters are permitted when
39080 <option>allow_filter</option> is true.
39081 </para>
39082 <para>
39083 <indexterm role="concept">
39084 <primary>SMTP</primary>
39085 <secondary>error codes</secondary>
39086 </indexterm>
39087 <indexterm role="option">
39088 <primary><option>forbid_smtp_code</option></primary>
39089 </indexterm>
39090 </para>
39091 <informaltable frame="all">
39092 <tgroup cols="4" colsep="0" rowsep="0">
39093 <colspec colwidth="8*" align="left"/>
39094 <colspec colwidth="6*" align="center"/>
39095 <colspec colwidth="6*" align="center"/>
39096 <colspec colwidth="6*" align="right"/>
39097 <tbody>
39098 <row>
39099 <entry><option>forbid_smtp_code</option></entry>
39100 <entry>Use: <emphasis>redirect</emphasis></entry>
39101 <entry>Type: <emphasis>boolean</emphasis></entry>
39102 <entry>Default: <emphasis>false</emphasis></entry>
39103 </row>
39104 </tbody>
39105 </tgroup>
39106 </informaltable>
39107 <para>
39108 If this option is set true, any SMTP error codes that are present at the start
39109 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
39110 the default codes (451 and 550, respectively) are always used.
39111 </para>
39112 <para>
39113 <indexterm role="option">
39114 <primary><option>hide_child_in_errmsg</option></primary>
39115 </indexterm>
39116 </para>
39117 <informaltable frame="all">
39118 <tgroup cols="4" colsep="0" rowsep="0">
39119 <colspec colwidth="8*" align="left"/>
39120 <colspec colwidth="6*" align="center"/>
39121 <colspec colwidth="6*" align="center"/>
39122 <colspec colwidth="6*" align="right"/>
39123 <tbody>
39124 <row>
39125 <entry><option>hide_child_in_errmsg</option></entry>
39126 <entry>Use: <emphasis>redirect</emphasis></entry>
39127 <entry>Type: <emphasis>boolean</emphasis></entry>
39128 <entry>Default: <emphasis>false</emphasis></entry>
39129 </row>
39130 </tbody>
39131 </tgroup>
39132 </informaltable>
39133 <para>
39134 <indexterm role="concept">
39135 <primary>bounce message</primary>
39136 <secondary>redirection details; suppressing</secondary>
39137 </indexterm>
39138 If this option is true, it prevents Exim from quoting a child address if it
39139 generates a bounce or delay message for it. Instead it says <quote>an address
39140 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
39141 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
39142 bounce may well quote the generated address.
39143 </para>
39144 <para>
39145 <indexterm role="option">
39146 <primary><option>ignore_eacces</option></primary>
39147 </indexterm>
39148 </para>
39149 <informaltable frame="all">
39150 <tgroup cols="4" colsep="0" rowsep="0">
39151 <colspec colwidth="8*" align="left"/>
39152 <colspec colwidth="6*" align="center"/>
39153 <colspec colwidth="6*" align="center"/>
39154 <colspec colwidth="6*" align="right"/>
39155 <tbody>
39156 <row>
39157 <entry><option>ignore_eacces</option></entry>
39158 <entry>Use: <emphasis>redirect</emphasis></entry>
39159 <entry>Type: <emphasis>boolean</emphasis></entry>
39160 <entry>Default: <emphasis>false</emphasis></entry>
39161 </row>
39162 </tbody>
39163 </tgroup>
39164 </informaltable>
39165 <para>
39166 <indexterm role="concept">
39167 <primary>EACCES</primary>
39168 </indexterm>
39169 If this option is set and an attempt to open a redirection file yields the
39170 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
39171 file did not exist.
39172 </para>
39173 <para>
39174 <indexterm role="option">
39175 <primary><option>ignore_enotdir</option></primary>
39176 </indexterm>
39177 </para>
39178 <informaltable frame="all">
39179 <tgroup cols="4" colsep="0" rowsep="0">
39180 <colspec colwidth="8*" align="left"/>
39181 <colspec colwidth="6*" align="center"/>
39182 <colspec colwidth="6*" align="center"/>
39183 <colspec colwidth="6*" align="right"/>
39184 <tbody>
39185 <row>
39186 <entry><option>ignore_enotdir</option></entry>
39187 <entry>Use: <emphasis>redirect</emphasis></entry>
39188 <entry>Type: <emphasis>boolean</emphasis></entry>
39189 <entry>Default: <emphasis>false</emphasis></entry>
39190 </row>
39191 </tbody>
39192 </tgroup>
39193 </informaltable>
39194 <para>
39195 <indexterm role="concept">
39196 <primary>ENOTDIR</primary>
39197 </indexterm>
39198 If this option is set and an attempt to open a redirection file yields the
39199 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
39200 router behaves as if the file did not exist.
39201 </para>
39202 <para>
39203 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
39204 router that has the <option>file</option> option set discovers that the file does not exist
39205 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
39206 against unmounted NFS directories. If the parent can not be statted, delivery
39207 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
39208 is set, because that option tells Exim to ignore <quote>something on the path is not
39209 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
39210 that some operating systems give ENOENT where others give ENOTDIR.
39211 </para>
39212 <para>
39213 <indexterm role="option">
39214 <primary><option>include_directory</option></primary>
39215 </indexterm>
39216 </para>
39217 <informaltable frame="all">
39218 <tgroup cols="4" colsep="0" rowsep="0">
39219 <colspec colwidth="8*" align="left"/>
39220 <colspec colwidth="6*" align="center"/>
39221 <colspec colwidth="6*" align="center"/>
39222 <colspec colwidth="6*" align="right"/>
39223 <tbody>
39224 <row>
39225 <entry><option>include_directory</option></entry>
39226 <entry>Use: <emphasis>redirect</emphasis></entry>
39227 <entry>Type: <emphasis>string</emphasis></entry>
39228 <entry>Default: <emphasis>unset</emphasis></entry>
39229 </row>
39230 </tbody>
39231 </tgroup>
39232 </informaltable>
39233 <para>
39234 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
39235 redirection list must start with this directory.
39236 </para>
39237 <para>
39238 <indexterm role="option">
39239 <primary><option>modemask</option></primary>
39240 </indexterm>
39241 </para>
39242 <informaltable frame="all">
39243 <tgroup cols="4" colsep="0" rowsep="0">
39244 <colspec colwidth="8*" align="left"/>
39245 <colspec colwidth="6*" align="center"/>
39246 <colspec colwidth="6*" align="center"/>
39247 <colspec colwidth="6*" align="right"/>
39248 <tbody>
39249 <row>
39250 <entry><option>modemask</option></entry>
39251 <entry>Use: <emphasis>redirect</emphasis></entry>
39252 <entry>Type: <emphasis>octal integer</emphasis></entry>
39253 <entry>Default: <emphasis>022</emphasis></entry>
39254 </row>
39255 </tbody>
39256 </tgroup>
39257 </informaltable>
39258 <para>
39259 This specifies mode bits which must not be set for a file specified by the
39260 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
39261 </para>
39262 <para>
39263 <indexterm role="option">
39264 <primary><option>one_time</option></primary>
39265 </indexterm>
39266 </para>
39267 <informaltable frame="all">
39268 <tgroup cols="4" colsep="0" rowsep="0">
39269 <colspec colwidth="8*" align="left"/>
39270 <colspec colwidth="6*" align="center"/>
39271 <colspec colwidth="6*" align="center"/>
39272 <colspec colwidth="6*" align="right"/>
39273 <tbody>
39274 <row>
39275 <entry><option>one_time</option></entry>
39276 <entry>Use: <emphasis>redirect</emphasis></entry>
39277 <entry>Type: <emphasis>boolean</emphasis></entry>
39278 <entry>Default: <emphasis>false</emphasis></entry>
39279 </row>
39280 </tbody>
39281 </tgroup>
39282 </informaltable>
39283 <para>
39284 <indexterm role="concept">
39285 <primary>one-time aliasing/forwarding expansion</primary>
39286 </indexterm>
39287 <indexterm role="concept">
39288 <primary>alias file</primary>
39289 <secondary>one-time expansion</secondary>
39290 </indexterm>
39291 <indexterm role="concept">
39292 <primary>forward file</primary>
39293 <secondary>one-time expansion</secondary>
39294 </indexterm>
39295 <indexterm role="concept">
39296 <primary>mailing lists</primary>
39297 <secondary>one-time expansion</secondary>
39298 </indexterm>
39299 <indexterm role="concept">
39300 <primary>address redirection</primary>
39301 <secondary>one-time expansion</secondary>
39302 </indexterm>
39303 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
39304 files each time it tries to deliver a message causes a problem when one or more
39305 of the generated addresses fails be delivered at the first attempt. The problem
39306 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
39307 but of what happens when the redirection list changes during the time that the
39308 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
39309 lists, where new subscribers might receive copies of messages that were posted
39310 before they subscribed.
39311 </para>
39312 <para>
39313 If <option>one_time</option> is set and any addresses generated by the router fail to
39314 deliver at the first attempt, the failing addresses are added to the message as
39315 <quote>top level</quote> addresses, and the parent address that generated them is marked
39316 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
39317 attempt.
39318 </para>
39319 <para>
39320 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
39321 router would be lost if delivery did not succeed at the first attempt. For this
39322 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
39323 permitted when <option>one_time</option> is set.
39324 </para>
39325 <para>
39326 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
39327 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
39328 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
39329 </para>
39330 <para>
39331 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
39332 <option>one_time</option>.
39333 </para>
39334 <para>
39335 The original top-level address is remembered with each of the generated
39336 addresses, and is output in any log messages. However, any intermediate parent
39337 addresses are not recorded. This makes a difference to the log only if
39338 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
39339 typically be used for mailing lists, where there is normally just one level of
39340 expansion.
39341 </para>
39342 <para>
39343 <indexterm role="option">
39344 <primary><option>owners</option></primary>
39345 </indexterm>
39346 </para>
39347 <informaltable frame="all">
39348 <tgroup cols="4" colsep="0" rowsep="0">
39349 <colspec colwidth="8*" align="left"/>
39350 <colspec colwidth="6*" align="center"/>
39351 <colspec colwidth="6*" align="center"/>
39352 <colspec colwidth="6*" align="right"/>
39353 <tbody>
39354 <row>
39355 <entry><option>owners</option></entry>
39356 <entry>Use: <emphasis>redirect</emphasis></entry>
39357 <entry>Type: <emphasis>string list</emphasis></entry>
39358 <entry>Default: <emphasis>unset</emphasis></entry>
39359 </row>
39360 </tbody>
39361 </tgroup>
39362 </informaltable>
39363 <para>
39364 <indexterm role="concept">
39365 <primary>ownership</primary>
39366 <secondary>alias file</secondary>
39367 </indexterm>
39368 <indexterm role="concept">
39369 <primary>ownership</primary>
39370 <secondary>forward file</secondary>
39371 </indexterm>
39372 <indexterm role="concept">
39373 <primary>alias file</primary>
39374 <secondary>ownership</secondary>
39375 </indexterm>
39376 <indexterm role="concept">
39377 <primary>forward file</primary>
39378 <secondary>ownership</secondary>
39379 </indexterm>
39380 This specifies a list of permitted owners for the file specified by <option>file</option>.
39381 This list is in addition to the local user when <option>check_local_user</option> is set.
39382 See <option>check_owner</option> above.
39383 </para>
39384 <para>
39385 <indexterm role="option">
39386 <primary><option>owngroups</option></primary>
39387 </indexterm>
39388 </para>
39389 <informaltable frame="all">
39390 <tgroup cols="4" colsep="0" rowsep="0">
39391 <colspec colwidth="8*" align="left"/>
39392 <colspec colwidth="6*" align="center"/>
39393 <colspec colwidth="6*" align="center"/>
39394 <colspec colwidth="6*" align="right"/>
39395 <tbody>
39396 <row>
39397 <entry><option>owngroups</option></entry>
39398 <entry>Use: <emphasis>redirect</emphasis></entry>
39399 <entry>Type: <emphasis>string list</emphasis></entry>
39400 <entry>Default: <emphasis>unset</emphasis></entry>
39401 </row>
39402 </tbody>
39403 </tgroup>
39404 </informaltable>
39405 <para>
39406 This specifies a list of permitted groups for the file specified by <option>file</option>.
39407 The list is in addition to the local user&#x2019;s primary group when
39408 <option>check_local_user</option> is set. See <option>check_group</option> above.
39409 </para>
39410 <para>
39411 <indexterm role="option">
39412 <primary><option>pipe_transport</option></primary>
39413 </indexterm>
39414 </para>
39415 <informaltable frame="all">
39416 <tgroup cols="4" colsep="0" rowsep="0">
39417 <colspec colwidth="8*" align="left"/>
39418 <colspec colwidth="6*" align="center"/>
39419 <colspec colwidth="6*" align="center"/>
39420 <colspec colwidth="6*" align="right"/>
39421 <tbody>
39422 <row>
39423 <entry><option>pipe_transport</option></entry>
39424 <entry>Use: <emphasis>redirect</emphasis></entry>
39425 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39426 <entry>Default: <emphasis>unset</emphasis></entry>
39427 </row>
39428 </tbody>
39429 </tgroup>
39430 </informaltable>
39431 <para>
39432 <indexterm role="variable">
39433 <primary><varname>$address_pipe</varname></primary>
39434 </indexterm>
39435 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
39436 starting with a vertical bar character is specified as a new <quote>address</quote>. The
39437 transport used is specified by this option, which, after expansion, must be the
39438 name of a configured transport. This should normally be a <command>pipe</command> transport.
39439 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
39440 </para>
39441 <para>
39442 <indexterm role="option">
39443 <primary><option>qualify_domain</option></primary>
39444 </indexterm>
39445 </para>
39446 <informaltable frame="all">
39447 <tgroup cols="4" colsep="0" rowsep="0">
39448 <colspec colwidth="8*" align="left"/>
39449 <colspec colwidth="6*" align="center"/>
39450 <colspec colwidth="6*" align="center"/>
39451 <colspec colwidth="6*" align="right"/>
39452 <tbody>
39453 <row>
39454 <entry><option>qualify_domain</option></entry>
39455 <entry>Use: <emphasis>redirect</emphasis></entry>
39456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39457 <entry>Default: <emphasis>unset</emphasis></entry>
39458 </row>
39459 </tbody>
39460 </tgroup>
39461 </informaltable>
39462 <para>
39463 <indexterm role="variable">
39464 <primary><varname>$qualify_recipient</varname></primary>
39465 </indexterm>
39466 If this option is set, and an unqualified address (one without a domain) is
39467 generated, and that address would normally be qualified by the global setting
39468 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
39469 expanding this string. If the expansion fails, the router declines. If you want
39470 to revert to the default, you can have the expansion generate
39471 <varname>$qualify_recipient</varname>.
39472 </para>
39473 <para>
39474 This option applies to all unqualified addresses generated by Exim filters,
39475 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
39476 not preceded by a backslash. Sieve filters cannot generate unqualified
39477 addresses.
39478 </para>
39479 <para>
39480 <indexterm role="option">
39481 <primary><option>qualify_preserve_domain</option></primary>
39482 </indexterm>
39483 </para>
39484 <informaltable frame="all">
39485 <tgroup cols="4" colsep="0" rowsep="0">
39486 <colspec colwidth="8*" align="left"/>
39487 <colspec colwidth="6*" align="center"/>
39488 <colspec colwidth="6*" align="center"/>
39489 <colspec colwidth="6*" align="right"/>
39490 <tbody>
39491 <row>
39492 <entry><option>qualify_preserve_domain</option></entry>
39493 <entry>Use: <emphasis>redirect</emphasis></entry>
39494 <entry>Type: <emphasis>boolean</emphasis></entry>
39495 <entry>Default: <emphasis>false</emphasis></entry>
39496 </row>
39497 </tbody>
39498 </tgroup>
39499 </informaltable>
39500 <para>
39501 <indexterm role="concept">
39502 <primary>domain</primary>
39503 <secondary>in redirection; preserving</secondary>
39504 </indexterm>
39505 <indexterm role="concept">
39506 <primary>preserving domain in redirection</primary>
39507 </indexterm>
39508 <indexterm role="concept">
39509 <primary>address redirection</primary>
39510 <secondary>domain; preserving</secondary>
39511 </indexterm>
39512 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
39513 set (a configuration error occurs if it is). If an unqualified address (one
39514 without a domain) is generated, it is qualified with the domain of the parent
39515 address (the immediately preceding ancestor) instead of the global
39516 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
39517 this applies whether or not the address is preceded by a backslash.
39518 </para>
39519 <para>
39520 <indexterm role="option">
39521 <primary><option>repeat_use</option></primary>
39522 </indexterm>
39523 </para>
39524 <informaltable frame="all">
39525 <tgroup cols="4" colsep="0" rowsep="0">
39526 <colspec colwidth="8*" align="left"/>
39527 <colspec colwidth="6*" align="center"/>
39528 <colspec colwidth="6*" align="center"/>
39529 <colspec colwidth="6*" align="right"/>
39530 <tbody>
39531 <row>
39532 <entry><option>repeat_use</option></entry>
39533 <entry>Use: <emphasis>redirect</emphasis></entry>
39534 <entry>Type: <emphasis>boolean</emphasis></entry>
39535 <entry>Default: <emphasis>true</emphasis></entry>
39536 </row>
39537 </tbody>
39538 </tgroup>
39539 </informaltable>
39540 <para>
39541 If this option is set false, the router is skipped for a child address that has
39542 any ancestor that was routed by this router. This test happens before any of
39543 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
39544 only when the ancestor is the same as the current address. See also
39545 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
39546 </para>
39547 <para>
39548 <indexterm role="option">
39549 <primary><option>reply_transport</option></primary>
39550 </indexterm>
39551 </para>
39552 <informaltable frame="all">
39553 <tgroup cols="4" colsep="0" rowsep="0">
39554 <colspec colwidth="8*" align="left"/>
39555 <colspec colwidth="6*" align="center"/>
39556 <colspec colwidth="6*" align="center"/>
39557 <colspec colwidth="6*" align="right"/>
39558 <tbody>
39559 <row>
39560 <entry><option>reply_transport</option></entry>
39561 <entry>Use: <emphasis>redirect</emphasis></entry>
39562 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39563 <entry>Default: <emphasis>unset</emphasis></entry>
39564 </row>
39565 </tbody>
39566 </tgroup>
39567 </informaltable>
39568 <para>
39569 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
39570 <option>vacation</option> command is used in a filter file. The transport used is specified
39571 by this option, which, after expansion, must be the name of a configured
39572 transport. This should normally be an <command>autoreply</command> transport. Other transports
39573 are unlikely to do anything sensible or useful.
39574 </para>
39575 <para>
39576 <indexterm role="option">
39577 <primary><option>rewrite</option></primary>
39578 </indexterm>
39579 </para>
39580 <informaltable frame="all">
39581 <tgroup cols="4" colsep="0" rowsep="0">
39582 <colspec colwidth="8*" align="left"/>
39583 <colspec colwidth="6*" align="center"/>
39584 <colspec colwidth="6*" align="center"/>
39585 <colspec colwidth="6*" align="right"/>
39586 <tbody>
39587 <row>
39588 <entry><option>rewrite</option></entry>
39589 <entry>Use: <emphasis>redirect</emphasis></entry>
39590 <entry>Type: <emphasis>boolean</emphasis></entry>
39591 <entry>Default: <emphasis>true</emphasis></entry>
39592 </row>
39593 </tbody>
39594 </tgroup>
39595 </informaltable>
39596 <para>
39597 <indexterm role="concept">
39598 <primary>address redirection</primary>
39599 <secondary>disabling rewriting</secondary>
39600 </indexterm>
39601 If this option is set false, addresses generated by the router are not
39602 subject to address rewriting. Otherwise, they are treated like new addresses
39603 and are rewritten according to the global rewriting rules.
39604 </para>
39605 <para>
39606 <indexterm role="option">
39607 <primary><option>sieve_subaddress</option></primary>
39608 </indexterm>
39609 </para>
39610 <informaltable frame="all">
39611 <tgroup cols="4" colsep="0" rowsep="0">
39612 <colspec colwidth="8*" align="left"/>
39613 <colspec colwidth="6*" align="center"/>
39614 <colspec colwidth="6*" align="center"/>
39615 <colspec colwidth="6*" align="right"/>
39616 <tbody>
39617 <row>
39618 <entry><option>sieve_subaddress</option></entry>
39619 <entry>Use: <emphasis>redirect</emphasis></entry>
39620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39621 <entry>Default: <emphasis>unset</emphasis></entry>
39622 </row>
39623 </tbody>
39624 </tgroup>
39625 </informaltable>
39626 <para>
39627 The value of this option is passed to a Sieve filter to specify the
39628 :subaddress part of an address.
39629 </para>
39630 <para>
39631 <indexterm role="option">
39632 <primary><option>sieve_useraddress</option></primary>
39633 </indexterm>
39634 </para>
39635 <informaltable frame="all">
39636 <tgroup cols="4" colsep="0" rowsep="0">
39637 <colspec colwidth="8*" align="left"/>
39638 <colspec colwidth="6*" align="center"/>
39639 <colspec colwidth="6*" align="center"/>
39640 <colspec colwidth="6*" align="right"/>
39641 <tbody>
39642 <row>
39643 <entry><option>sieve_useraddress</option></entry>
39644 <entry>Use: <emphasis>redirect</emphasis></entry>
39645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39646 <entry>Default: <emphasis>unset</emphasis></entry>
39647 </row>
39648 </tbody>
39649 </tgroup>
39650 </informaltable>
39651 <para>
39652 The value of this option is passed to a Sieve filter to specify the :user part
39653 of an address. However, if it is unset, the entire original local part
39654 (including any prefix or suffix) is used for :user.
39655 </para>
39656 <para>
39657 <indexterm role="option">
39658 <primary><option>sieve_vacation_directory</option></primary>
39659 </indexterm>
39660 </para>
39661 <informaltable frame="all">
39662 <tgroup cols="4" colsep="0" rowsep="0">
39663 <colspec colwidth="8*" align="left"/>
39664 <colspec colwidth="6*" align="center"/>
39665 <colspec colwidth="6*" align="center"/>
39666 <colspec colwidth="6*" align="right"/>
39667 <tbody>
39668 <row>
39669 <entry><option>sieve_vacation_directory</option></entry>
39670 <entry>Use: <emphasis>redirect</emphasis></entry>
39671 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39672 <entry>Default: <emphasis>unset</emphasis></entry>
39673 </row>
39674 </tbody>
39675 </tgroup>
39676 </informaltable>
39677 <para>
39678 <indexterm role="concept">
39679 <primary>Sieve filter</primary>
39680 <secondary>vacation directory</secondary>
39681 </indexterm>
39682 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
39683 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
39684 (do not put anything else in that directory), and ensure that the
39685 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
39686 needs their own directory; Exim will create it if necessary.
39687 </para>
39688 <para>
39689 <indexterm role="option">
39690 <primary><option>skip_syntax_errors</option></primary>
39691 </indexterm>
39692 </para>
39693 <informaltable frame="all">
39694 <tgroup cols="4" colsep="0" rowsep="0">
39695 <colspec colwidth="8*" align="left"/>
39696 <colspec colwidth="6*" align="center"/>
39697 <colspec colwidth="6*" align="center"/>
39698 <colspec colwidth="6*" align="right"/>
39699 <tbody>
39700 <row>
39701 <entry><option>skip_syntax_errors</option></entry>
39702 <entry>Use: <emphasis>redirect</emphasis></entry>
39703 <entry>Type: <emphasis>boolean</emphasis></entry>
39704 <entry>Default: <emphasis>false</emphasis></entry>
39705 </row>
39706 </tbody>
39707 </tgroup>
39708 </informaltable>
39709 <para>
39710 <indexterm role="concept">
39711 <primary>forward file</primary>
39712 <secondary>broken</secondary>
39713 </indexterm>
39714 <indexterm role="concept">
39715 <primary>address redirection</primary>
39716 <secondary>broken files</secondary>
39717 </indexterm>
39718 <indexterm role="concept">
39719 <primary>alias file</primary>
39720 <secondary>broken</secondary>
39721 </indexterm>
39722 <indexterm role="concept">
39723 <primary>broken alias or forward files</primary>
39724 </indexterm>
39725 <indexterm role="concept">
39726 <primary>ignoring faulty addresses</primary>
39727 </indexterm>
39728 <indexterm role="concept">
39729 <primary>skipping faulty addresses</primary>
39730 </indexterm>
39731 <indexterm role="concept">
39732 <primary>error</primary>
39733 <secondary>skipping bad syntax</secondary>
39734 </indexterm>
39735 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
39736 non-filter redirection data are skipped, and each failing address is logged. If
39737 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
39738 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
39739 are expanded and placed at the head of the error message generated by
39740 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
39741 be the same address as the generic <option>errors_to</option> option. The
39742 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
39743 </para>
39744 <para>
39745 If all the addresses in a redirection list are skipped because of syntax
39746 errors, the router declines to handle the original address, and it is passed to
39747 the following routers.
39748 </para>
39749 <para>
39750 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
39751 error in the filter causes filtering to be abandoned without any action being
39752 taken. The incident is logged, and the router declines to handle the address,
39753 so it is passed to the following routers.
39754 </para>
39755 <para>
39756 <indexterm role="concept">
39757 <primary>Sieve filter</primary>
39758 <secondary>syntax errors in</secondary>
39759 </indexterm>
39760 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
39761 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
39762 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
39763 </para>
39764 <para>
39765 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
39766 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
39767 option, used with an address that does not get redirected, can be used to
39768 notify users of these errors, by means of a router like this:
39769 </para>
39770 <literallayout class="monospaced">
39771 userforward:
39772   driver = redirect
39773   allow_filter
39774   check_local_user
39775   file = $home/.forward
39776   file_transport = address_file
39777   pipe_transport = address_pipe
39778   reply_transport = address_reply
39779   no_verify
39780   skip_syntax_errors
39781   syntax_errors_to = real-$local_part@$domain
39782   syntax_errors_text = \
39783    This is an automatically generated message. An error has\n\
39784    been found in your .forward file. Details of the error are\n\
39785    reported below. While this error persists, you will receive\n\
39786    a copy of this message for every message that is addressed\n\
39787    to you. If your .forward file is a filter file, or if it is\n\
39788    a non-filter file containing no valid forwarding addresses,\n\
39789    a copy of each incoming message will be put in your normal\n\
39790    mailbox. If a non-filter file contains at least one valid\n\
39791    forwarding address, forwarding to the valid addresses will\n\
39792    happen, and those will be the only deliveries that occur.
39793 </literallayout>
39794 <para>
39795 You also need a router to ensure that local addresses that are prefixed by
39796 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
39797 put this immediately before the <command>userforward</command> router:
39798 </para>
39799 <literallayout class="monospaced">
39800 real_localuser:
39801   driver = accept
39802   check_local_user
39803   local_part_prefix = real-
39804   transport = local_delivery
39805 </literallayout>
39806 <para>
39807 For security, it would probably be a good idea to restrict the use of this
39808 router to locally-generated messages, using a condition such as this:
39809 </para>
39810 <literallayout class="monospaced">
39811   condition = ${if match {$sender_host_address}\
39812                          {\N^(|127\.0\.0\.1)$\N}}
39813 </literallayout>
39814 <para>
39815 <indexterm role="option">
39816 <primary><option>syntax_errors_text</option></primary>
39817 </indexterm>
39818 </para>
39819 <informaltable frame="all">
39820 <tgroup cols="4" colsep="0" rowsep="0">
39821 <colspec colwidth="8*" align="left"/>
39822 <colspec colwidth="6*" align="center"/>
39823 <colspec colwidth="6*" align="center"/>
39824 <colspec colwidth="6*" align="right"/>
39825 <tbody>
39826 <row>
39827 <entry><option>syntax_errors_text</option></entry>
39828 <entry>Use: <emphasis>redirect</emphasis></entry>
39829 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39830 <entry>Default: <emphasis>unset</emphasis></entry>
39831 </row>
39832 </tbody>
39833 </tgroup>
39834 </informaltable>
39835 <para>
39836 See <option>skip_syntax_errors</option> above.
39837 </para>
39838 <para>
39839 <indexterm role="option">
39840 <primary><option>syntax_errors_to</option></primary>
39841 </indexterm>
39842 </para>
39843 <informaltable frame="all">
39844 <tgroup cols="4" colsep="0" rowsep="0">
39845 <colspec colwidth="8*" align="left"/>
39846 <colspec colwidth="6*" align="center"/>
39847 <colspec colwidth="6*" align="center"/>
39848 <colspec colwidth="6*" align="right"/>
39849 <tbody>
39850 <row>
39851 <entry><option>syntax_errors_to</option></entry>
39852 <entry>Use: <emphasis>redirect</emphasis></entry>
39853 <entry>Type: <emphasis>string</emphasis></entry>
39854 <entry>Default: <emphasis>unset</emphasis></entry>
39855 </row>
39856 </tbody>
39857 </tgroup>
39858 </informaltable>
39859 <para>
39860 See <option>skip_syntax_errors</option> above.
39861 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
39862 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
39863 </para>
39864 </section>
39865 </chapter>
39866
39867 <chapter id="CHAPenvironment">
39868 <title>Environment for running local transports</title>
39869 <titleabbrev>Environment for local transports</titleabbrev>
39870 <para>
39871 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
39872 <primary>local transports</primary>
39873 <secondary>environment for</secondary>
39874 </indexterm>
39875 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
39876 <primary>environment</primary>
39877 <secondary>local transports</secondary>
39878 </indexterm>
39879 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
39880 <primary>transport</primary>
39881 <secondary>local; environment for</secondary>
39882 </indexterm>
39883 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
39884 transport can be thought of as similar to a pipe.) Exim always runs transports
39885 in subprocesses, under specified uids and gids. Typical deliveries to local
39886 mailboxes run under the uid and gid of the local user.
39887 </para>
39888 <para>
39889 Exim also sets a specific current directory while running the transport; for
39890 some transports a home directory setting is also relevant. The <command>pipe</command>
39891 transport is the only one that sets up environment variables; see section
39892 <xref linkend="SECTpipeenv"/> for details.
39893 </para>
39894 <para>
39895 The values used for the uid, gid, and the directories may come from several
39896 different places. In many cases, the router that handles the address associates
39897 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
39898 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
39899 configuration, and these override anything that comes from the router.
39900 </para>
39901 <section id="SECID131">
39902 <title>Concurrent deliveries</title>
39903 <para>
39904 <indexterm role="concept">
39905 <primary>concurrent deliveries</primary>
39906 </indexterm>
39907 <indexterm role="concept">
39908 <primary>simultaneous deliveries</primary>
39909 </indexterm>
39910 If two different messages for the same local recipient arrive more or less
39911 simultaneously, the two delivery processes are likely to run concurrently. When
39912 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
39913 rules to stop concurrent processes from writing to the same file at the same
39914 time.
39915 </para>
39916 <para>
39917 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
39918 locking that is needed. Here is a silly example:
39919 </para>
39920 <literallayout class="monospaced">
39921 my_transport:
39922   driver = pipe
39923   command = /bin/sh -c 'cat &gt;&gt;/some/file'
39924 </literallayout>
39925 <para>
39926 This is supposed to write the message at the end of the file. However, if two
39927 messages arrive at the same time, the file will be scrambled. You can use the
39928 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
39929 file using the same algorithm that Exim itself uses.
39930 </para>
39931 </section>
39932 <section id="SECTenvuidgid">
39933 <title>Uids and gids</title>
39934 <para>
39935 <indexterm role="concept">
39936 <primary>local transports</primary>
39937 <secondary>uid and gid</secondary>
39938 </indexterm>
39939 <indexterm role="concept">
39940 <primary>transport</primary>
39941 <secondary>local; uid and gid</secondary>
39942 </indexterm>
39943 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
39944 overrides any group that the router set in the address, even if <option>user</option> is not
39945 set for the transport. This makes it possible, for example, to run local mail
39946 delivery under the uid of the recipient (set by the router), but in a special
39947 group (set by the transport). For example:
39948 </para>
39949 <literallayout class="monospaced">
39950 # Routers ...
39951 # User/group are set by check_local_user in this router
39952 local_users:
39953   driver = accept
39954   check_local_user
39955   transport = group_delivery
39956
39957 # Transports ...
39958 # This transport overrides the group
39959 group_delivery:
39960   driver = appendfile
39961   file = /var/spool/mail/$local_part
39962   group = mail
39963 </literallayout>
39964 <para>
39965 If <option>user</option> is set for a transport, its value overrides what is set in the
39966 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
39967 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
39968 set.
39969 </para>
39970 <para>
39971 <indexterm role="option">
39972 <primary><option>initgroups</option></primary>
39973 </indexterm>
39974 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
39975 function is called for the groups associated with that uid if the
39976 <option>initgroups</option> option is set for the transport. When the uid is not specified
39977 by the transport, but is associated with the address by a router, the option
39978 for calling <function>initgroups()</function> is taken from the router configuration.
39979 </para>
39980 <para>
39981 <indexterm role="concept">
39982 <primary><command>pipe</command> transport</primary>
39983 <secondary>uid for</secondary>
39984 </indexterm>
39985 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
39986 is set and <option>user</option> is not set, the uid of the process that called Exim to
39987 receive the message is used, and if <option>group</option> is not set, the corresponding
39988 original gid is also used.
39989 </para>
39990 <para>
39991 This is the detailed preference order for obtaining a gid; the first of the
39992 following that is set is used:
39993 </para>
39994 <itemizedlist>
39995 <listitem>
39996 <para>
39997 A <option>group</option> setting of the transport;
39998 </para>
39999 </listitem>
40000 <listitem>
40001 <para>
40002 A <option>group</option> setting of the router;
40003 </para>
40004 </listitem>
40005 <listitem>
40006 <para>
40007 A gid associated with a user setting of the router, either as a result of
40008 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
40009 </para>
40010 </listitem>
40011 <listitem>
40012 <para>
40013 The group associated with a non-numeric <option>user</option> setting of the transport;
40014 </para>
40015 </listitem>
40016 <listitem>
40017 <para>
40018 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
40019 the uid is the creator&#x2019;s uid;
40020 </para>
40021 </listitem>
40022 <listitem>
40023 <para>
40024 The Exim gid if the Exim uid is being used as a default.
40025 </para>
40026 </listitem>
40027 </itemizedlist>
40028 <para>
40029 If, for example, the user is specified numerically on the router and there are
40030 no group settings, no gid is available. In this situation, an error occurs.
40031 This is different for the uid, for which there always is an ultimate default.
40032 The first of the following that is set is used:
40033 </para>
40034 <itemizedlist>
40035 <listitem>
40036 <para>
40037 A <option>user</option> setting of the transport;
40038 </para>
40039 </listitem>
40040 <listitem>
40041 <para>
40042 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
40043 </para>
40044 </listitem>
40045 <listitem>
40046 <para>
40047 A <option>user</option> setting of the router;
40048 </para>
40049 </listitem>
40050 <listitem>
40051 <para>
40052 A <option>check_local_user</option> setting of the router;
40053 </para>
40054 </listitem>
40055 <listitem>
40056 <para>
40057 The Exim uid.
40058 </para>
40059 </listitem>
40060 </itemizedlist>
40061 <para>
40062 Of course, an error will still occur if the uid that is chosen is on the
40063 <option>never_users</option> list.
40064 </para>
40065 </section>
40066 <section id="SECID132">
40067 <title>Current and home directories</title>
40068 <para>
40069 <indexterm role="concept">
40070 <primary>current directory for local transport</primary>
40071 </indexterm>
40072 <indexterm role="concept">
40073 <primary>home directory</primary>
40074 <secondary>for local transport</secondary>
40075 </indexterm>
40076 <indexterm role="concept">
40077 <primary>transport</primary>
40078 <secondary>local; home directory for</secondary>
40079 </indexterm>
40080 <indexterm role="concept">
40081 <primary>transport</primary>
40082 <secondary>local; current directory for</secondary>
40083 </indexterm>
40084 Routers may set current and home directories for local transports by means of
40085 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
40086 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
40087 are set, they override the router&#x2019;s values. In detail, the home directory
40088 for a local transport is taken from the first of these values that is set:
40089 </para>
40090 <itemizedlist>
40091 <listitem>
40092 <para>
40093 The <option>home_directory</option> option on the transport;
40094 </para>
40095 </listitem>
40096 <listitem>
40097 <para>
40098 The <option>transport_home_directory</option> option on the router;
40099 </para>
40100 </listitem>
40101 <listitem>
40102 <para>
40103 The password data if <option>check_local_user</option> is set on the router;
40104 </para>
40105 </listitem>
40106 <listitem>
40107 <para>
40108 The <option>router_home_directory</option> option on the router.
40109 </para>
40110 </listitem>
40111 </itemizedlist>
40112 <para>
40113 The current directory is taken from the first of these values that is set:
40114 </para>
40115 <itemizedlist>
40116 <listitem>
40117 <para>
40118 The <option>current_directory</option> option on the transport;
40119 </para>
40120 </listitem>
40121 <listitem>
40122 <para>
40123 The <option>transport_current_directory</option> option on the router.
40124 </para>
40125 </listitem>
40126 </itemizedlist>
40127 <para>
40128 If neither the router nor the transport sets a current directory, Exim uses the
40129 value of the home directory, if it is set. Otherwise it sets the current
40130 directory to <filename>/</filename> before running a local transport.
40131 </para>
40132 </section>
40133 <section id="SECID133">
40134 <title>Expansion variables derived from the address</title>
40135 <para>
40136 <indexterm role="variable">
40137 <primary><varname>$domain</varname></primary>
40138 </indexterm>
40139 <indexterm role="variable">
40140 <primary><varname>$local_part</varname></primary>
40141 </indexterm>
40142 <indexterm role="variable">
40143 <primary><varname>$original_domain</varname></primary>
40144 </indexterm>
40145 Normally a local delivery is handling a single address, and in that case the
40146 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
40147 deliveries. However, in some circumstances more than one address may be handled
40148 at once (for example, while writing batch SMTP for onward transmission by some
40149 other means). In this case, the variables associated with the local part are
40150 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
40151 and <varname>$original_domain</varname> is never set.
40152 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
40153 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
40154 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
40155 </para>
40156 </section>
40157 </chapter>
40158
40159 <chapter id="CHAPtransportgeneric">
40160 <title>Generic options for transports</title>
40161 <para>
40162 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
40163 <primary>generic options</primary>
40164 <secondary>transport</secondary>
40165 </indexterm>
40166 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
40167 <primary>options</primary>
40168 <secondary>generic; for transports</secondary>
40169 </indexterm>
40170 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
40171 <primary>transport</primary>
40172 <secondary>generic options for</secondary>
40173 </indexterm>
40174 The following generic options apply to all transports:
40175 </para>
40176 <para>
40177 <indexterm role="option">
40178 <primary><option>body_only</option></primary>
40179 </indexterm>
40180 </para>
40181 <informaltable frame="all">
40182 <tgroup cols="4" colsep="0" rowsep="0">
40183 <colspec colwidth="8*" align="left"/>
40184 <colspec colwidth="6*" align="center"/>
40185 <colspec colwidth="6*" align="center"/>
40186 <colspec colwidth="6*" align="right"/>
40187 <tbody>
40188 <row>
40189 <entry><option>body_only</option></entry>
40190 <entry>Use: <emphasis>transports</emphasis></entry>
40191 <entry>Type: <emphasis>boolean</emphasis></entry>
40192 <entry>Default: <emphasis>false</emphasis></entry>
40193 </row>
40194 </tbody>
40195 </tgroup>
40196 </informaltable>
40197 <para>
40198 <indexterm role="concept">
40199 <primary>transport</primary>
40200 <secondary>body only</secondary>
40201 </indexterm>
40202 <indexterm role="concept">
40203 <primary>message</primary>
40204 <secondary>transporting body only</secondary>
40205 </indexterm>
40206 <indexterm role="concept">
40207 <primary>body of message</primary>
40208 <secondary>transporting</secondary>
40209 </indexterm>
40210 If this option is set, the message&#x2019;s headers are not transported. It is
40211 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
40212 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
40213 <option>message_suffix</option> should be checked, because this option does not
40214 automatically suppress them.
40215 </para>
40216 <para>
40217 <indexterm role="option">
40218 <primary><option>current_directory</option></primary>
40219 </indexterm>
40220 </para>
40221 <informaltable frame="all">
40222 <tgroup cols="4" colsep="0" rowsep="0">
40223 <colspec colwidth="8*" align="left"/>
40224 <colspec colwidth="6*" align="center"/>
40225 <colspec colwidth="6*" align="center"/>
40226 <colspec colwidth="6*" align="right"/>
40227 <tbody>
40228 <row>
40229 <entry><option>current_directory</option></entry>
40230 <entry>Use: <emphasis>transports</emphasis></entry>
40231 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40232 <entry>Default: <emphasis>unset</emphasis></entry>
40233 </row>
40234 </tbody>
40235 </tgroup>
40236 </informaltable>
40237 <para>
40238 <indexterm role="concept">
40239 <primary>transport</primary>
40240 <secondary>current directory for</secondary>
40241 </indexterm>
40242 This specifies the current directory that is to be set while running the
40243 transport, overriding any value that may have been set by the router.
40244 If the expansion fails for any reason, including forced failure, an error is
40245 logged, and delivery is deferred.
40246 </para>
40247 <para>
40248 <indexterm role="option">
40249 <primary><option>disable_logging</option></primary>
40250 </indexterm>
40251 </para>
40252 <informaltable frame="all">
40253 <tgroup cols="4" colsep="0" rowsep="0">
40254 <colspec colwidth="8*" align="left"/>
40255 <colspec colwidth="6*" align="center"/>
40256 <colspec colwidth="6*" align="center"/>
40257 <colspec colwidth="6*" align="right"/>
40258 <tbody>
40259 <row>
40260 <entry><option>disable_logging</option></entry>
40261 <entry>Use: <emphasis>transports</emphasis></entry>
40262 <entry>Type: <emphasis>boolean</emphasis></entry>
40263 <entry>Default: <emphasis>false</emphasis></entry>
40264 </row>
40265 </tbody>
40266 </tgroup>
40267 </informaltable>
40268 <para>
40269 If this option is set true, nothing is logged for any
40270 deliveries by the transport or for any
40271 transport errors. You should not set this option unless you really, really know
40272 what you are doing.
40273 </para>
40274 <para>
40275 <indexterm role="option">
40276 <primary><option>debug_print</option></primary>
40277 </indexterm>
40278 </para>
40279 <informaltable frame="all">
40280 <tgroup cols="4" colsep="0" rowsep="0">
40281 <colspec colwidth="8*" align="left"/>
40282 <colspec colwidth="6*" align="center"/>
40283 <colspec colwidth="6*" align="center"/>
40284 <colspec colwidth="6*" align="right"/>
40285 <tbody>
40286 <row>
40287 <entry><option>debug_print</option></entry>
40288 <entry>Use: <emphasis>transports</emphasis></entry>
40289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40290 <entry>Default: <emphasis>unset</emphasis></entry>
40291 </row>
40292 </tbody>
40293 </tgroup>
40294 </informaltable>
40295 <para>
40296 <indexterm role="concept">
40297 <primary>testing</primary>
40298 <secondary>variables in drivers</secondary>
40299 </indexterm>
40300 If this option is set and debugging is enabled (see the <option>-d</option> command line
40301 option), the string is expanded and included in the debugging output when the
40302 transport is run.
40303 If expansion of the string fails, the error message is written to the debugging
40304 output, and Exim carries on processing.
40305 This facility is provided to help with checking out the values of variables and
40306 so on when debugging driver configurations. For example, if a <option>headers_add</option>
40307 option is not working properly, <option>debug_print</option> could be used to output the
40308 variables it references. A newline is added to the text if it does not end with
40309 one.
40310 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
40311 transport and the router that called it.
40312 </para>
40313 <para>
40314 <indexterm role="option">
40315 <primary><option>delivery_date_add</option></primary>
40316 </indexterm>
40317 </para>
40318 <informaltable frame="all">
40319 <tgroup cols="4" colsep="0" rowsep="0">
40320 <colspec colwidth="8*" align="left"/>
40321 <colspec colwidth="6*" align="center"/>
40322 <colspec colwidth="6*" align="center"/>
40323 <colspec colwidth="6*" align="right"/>
40324 <tbody>
40325 <row>
40326 <entry><option>delivery_date_add</option></entry>
40327 <entry>Use: <emphasis>transports</emphasis></entry>
40328 <entry>Type: <emphasis>boolean</emphasis></entry>
40329 <entry>Default: <emphasis>false</emphasis></entry>
40330 </row>
40331 </tbody>
40332 </tgroup>
40333 </informaltable>
40334 <para>
40335 <indexterm role="concept">
40336 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
40337 </indexterm>
40338 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
40339 This gives the actual time the delivery was made. As this is not a standard
40340 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
40341 requests its removal from incoming messages, so that delivered messages can
40342 safely be resent to other recipients.
40343 </para>
40344 <para>
40345 <indexterm role="option">
40346 <primary><option>driver</option></primary>
40347 </indexterm>
40348 </para>
40349 <informaltable frame="all">
40350 <tgroup cols="4" colsep="0" rowsep="0">
40351 <colspec colwidth="8*" align="left"/>
40352 <colspec colwidth="6*" align="center"/>
40353 <colspec colwidth="6*" align="center"/>
40354 <colspec colwidth="6*" align="right"/>
40355 <tbody>
40356 <row>
40357 <entry><option>driver</option></entry>
40358 <entry>Use: <emphasis>transports</emphasis></entry>
40359 <entry>Type: <emphasis>string</emphasis></entry>
40360 <entry>Default: <emphasis>unset</emphasis></entry>
40361 </row>
40362 </tbody>
40363 </tgroup>
40364 </informaltable>
40365 <para>
40366 This specifies which of the available transport drivers is to be used.
40367 There is no default, and this option must be set for every transport.
40368 </para>
40369 <para>
40370 <indexterm role="option">
40371 <primary><option>envelope_to_add</option></primary>
40372 </indexterm>
40373 </para>
40374 <informaltable frame="all">
40375 <tgroup cols="4" colsep="0" rowsep="0">
40376 <colspec colwidth="8*" align="left"/>
40377 <colspec colwidth="6*" align="center"/>
40378 <colspec colwidth="6*" align="center"/>
40379 <colspec colwidth="6*" align="right"/>
40380 <tbody>
40381 <row>
40382 <entry><option>envelope_to_add</option></entry>
40383 <entry>Use: <emphasis>transports</emphasis></entry>
40384 <entry>Type: <emphasis>boolean</emphasis></entry>
40385 <entry>Default: <emphasis>false</emphasis></entry>
40386 </row>
40387 </tbody>
40388 </tgroup>
40389 </informaltable>
40390 <para>
40391 <indexterm role="concept">
40392 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40393 </indexterm>
40394 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
40395 This gives the original address(es) in the incoming envelope that caused this
40396 delivery to happen. More than one address may be present if the transport is
40397 configured to handle several addresses at once, or if more than one original
40398 address was redirected to the same final address. As this is not a standard
40399 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
40400 its removal from incoming messages, so that delivered messages can safely be
40401 resent to other recipients.
40402 </para>
40403 <para>
40404 <indexterm role="option">
40405 <primary><option>event_action</option></primary>
40406 </indexterm>
40407 </para>
40408 <informaltable frame="all">
40409 <tgroup cols="4" colsep="0" rowsep="0">
40410 <colspec colwidth="8*" align="left"/>
40411 <colspec colwidth="6*" align="center"/>
40412 <colspec colwidth="6*" align="center"/>
40413 <colspec colwidth="6*" align="right"/>
40414 <tbody>
40415 <row>
40416 <entry><option>event_action</option></entry>
40417 <entry>Use: <emphasis>transports</emphasis></entry>
40418 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40419 <entry>Default: <emphasis>unset</emphasis></entry>
40420 </row>
40421 </tbody>
40422 </tgroup>
40423 </informaltable>
40424 <para>
40425 <indexterm role="concept">
40426 <primary>events</primary>
40427 </indexterm>
40428 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
40429 For details see chapter <xref linkend="CHAPevents"/>.
40430 </para>
40431 <para>
40432 <indexterm role="option">
40433 <primary><option>group</option></primary>
40434 </indexterm>
40435 </para>
40436 <informaltable frame="all">
40437 <tgroup cols="4" colsep="0" rowsep="0">
40438 <colspec colwidth="8*" align="left"/>
40439 <colspec colwidth="6*" align="center"/>
40440 <colspec colwidth="6*" align="center"/>
40441 <colspec colwidth="6*" align="right"/>
40442 <tbody>
40443 <row>
40444 <entry><option>group</option></entry>
40445 <entry>Use: <emphasis>transports</emphasis></entry>
40446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40447 <entry>Default: <emphasis>Exim group</emphasis></entry>
40448 </row>
40449 </tbody>
40450 </tgroup>
40451 </informaltable>
40452 <para>
40453 <indexterm role="concept">
40454 <primary>transport</primary>
40455 <secondary>group; specifying</secondary>
40456 </indexterm>
40457 This option specifies a gid for running the transport process, overriding any
40458 value that the router supplies, and also overriding any value associated with
40459 <option>user</option> (see below).
40460 </para>
40461 <para>
40462 <indexterm role="option">
40463 <primary><option>headers_add</option></primary>
40464 </indexterm>
40465 </para>
40466 <informaltable frame="all">
40467 <tgroup cols="4" colsep="0" rowsep="0">
40468 <colspec colwidth="8*" align="left"/>
40469 <colspec colwidth="6*" align="center"/>
40470 <colspec colwidth="6*" align="center"/>
40471 <colspec colwidth="6*" align="right"/>
40472 <tbody>
40473 <row>
40474 <entry><option>headers_add</option></entry>
40475 <entry>Use: <emphasis>transports</emphasis></entry>
40476 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40477 <entry>Default: <emphasis>unset</emphasis></entry>
40478 </row>
40479 </tbody>
40480 </tgroup>
40481 </informaltable>
40482 <para>
40483 <indexterm role="concept">
40484 <primary>header lines</primary>
40485 <secondary>adding in transport</secondary>
40486 </indexterm>
40487 <indexterm role="concept">
40488 <primary>transport</primary>
40489 <secondary>header lines; adding</secondary>
40490 </indexterm>
40491 This option specifies a list of text headers,
40492 newline-separated (by default, changeable in the usual way),
40493 which are (separately) expanded and added to the header
40494 portion of a message as it is transported, as described in section
40495 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
40496 routers. If the result of the expansion is an empty string, or if the expansion
40497 is forced to fail, no action is taken. Other expansion failures are treated as
40498 errors and cause the delivery to be deferred.
40499 </para>
40500 <para>
40501 Unlike most options, <option>headers_add</option> can be specified multiple times
40502 for a transport; all listed headers are added.
40503 </para>
40504 <para>
40505 <indexterm role="option">
40506 <primary><option>headers_only</option></primary>
40507 </indexterm>
40508 </para>
40509 <informaltable frame="all">
40510 <tgroup cols="4" colsep="0" rowsep="0">
40511 <colspec colwidth="8*" align="left"/>
40512 <colspec colwidth="6*" align="center"/>
40513 <colspec colwidth="6*" align="center"/>
40514 <colspec colwidth="6*" align="right"/>
40515 <tbody>
40516 <row>
40517 <entry><option>headers_only</option></entry>
40518 <entry>Use: <emphasis>transports</emphasis></entry>
40519 <entry>Type: <emphasis>boolean</emphasis></entry>
40520 <entry>Default: <emphasis>false</emphasis></entry>
40521 </row>
40522 </tbody>
40523 </tgroup>
40524 </informaltable>
40525 <para>
40526 <indexterm role="concept">
40527 <primary>transport</primary>
40528 <secondary>header lines only</secondary>
40529 </indexterm>
40530 <indexterm role="concept">
40531 <primary>message</primary>
40532 <secondary>transporting headers only</secondary>
40533 </indexterm>
40534 <indexterm role="concept">
40535 <primary>header lines</primary>
40536 <secondary>transporting</secondary>
40537 </indexterm>
40538 If this option is set, the message&#x2019;s body is not transported. It is mutually
40539 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
40540 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
40541 checked, since this option does not automatically suppress them.
40542 </para>
40543 <para>
40544 <indexterm role="option">
40545 <primary><option>headers_remove</option></primary>
40546 </indexterm>
40547 </para>
40548 <informaltable frame="all">
40549 <tgroup cols="4" colsep="0" rowsep="0">
40550 <colspec colwidth="8*" align="left"/>
40551 <colspec colwidth="6*" align="center"/>
40552 <colspec colwidth="6*" align="center"/>
40553 <colspec colwidth="6*" align="right"/>
40554 <tbody>
40555 <row>
40556 <entry><option>headers_remove</option></entry>
40557 <entry>Use: <emphasis>transports</emphasis></entry>
40558 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40559 <entry>Default: <emphasis>unset</emphasis></entry>
40560 </row>
40561 </tbody>
40562 </tgroup>
40563 </informaltable>
40564 <para>
40565 <indexterm role="concept">
40566 <primary>header lines</primary>
40567 <secondary>removing</secondary>
40568 </indexterm>
40569 <indexterm role="concept">
40570 <primary>transport</primary>
40571 <secondary>header lines; removing</secondary>
40572 </indexterm>
40573 This option specifies a list of header names,
40574 colon-separated (by default, changeable in the usual way);
40575 these headers are omitted from the message as it is transported, as described
40576 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
40577 routers.
40578 Each list item is separately expanded.
40579 If the result of the expansion is an empty string, or if the expansion
40580 is forced to fail, no action is taken. Other expansion failures are treated as
40581 errors and cause the delivery to be deferred.
40582 </para>
40583 <para>
40584 Unlike most options, <option>headers_remove</option> can be specified multiple times
40585 for a transport; all listed headers are removed.
40586 </para>
40587 <para>
40588 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
40589 items that contain a list separator must have it doubled.
40590 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
40591 </para>
40592 <para>
40593 <indexterm role="option">
40594 <primary><option>headers_rewrite</option></primary>
40595 </indexterm>
40596 </para>
40597 <informaltable frame="all">
40598 <tgroup cols="4" colsep="0" rowsep="0">
40599 <colspec colwidth="8*" align="left"/>
40600 <colspec colwidth="6*" align="center"/>
40601 <colspec colwidth="6*" align="center"/>
40602 <colspec colwidth="6*" align="right"/>
40603 <tbody>
40604 <row>
40605 <entry><option>headers_rewrite</option></entry>
40606 <entry>Use: <emphasis>transports</emphasis></entry>
40607 <entry>Type: <emphasis>string</emphasis></entry>
40608 <entry>Default: <emphasis>unset</emphasis></entry>
40609 </row>
40610 </tbody>
40611 </tgroup>
40612 </informaltable>
40613 <para>
40614 <indexterm role="concept">
40615 <primary>transport</primary>
40616 <secondary>header lines; rewriting</secondary>
40617 </indexterm>
40618 <indexterm role="concept">
40619 <primary>rewriting</primary>
40620 <secondary>at transport time</secondary>
40621 </indexterm>
40622 This option allows addresses in header lines to be rewritten at transport time,
40623 that is, as the message is being copied to its destination. The contents of the
40624 option are a colon-separated list of rewriting rules. Each rule is in exactly
40625 the same form as one of the general rewriting rules that are applied when a
40626 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
40627 example,
40628 </para>
40629 <literallayout class="monospaced">
40630 headers_rewrite = a@b c@d f : \
40631                   x@y w@z
40632 </literallayout>
40633 <para>
40634 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
40635 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
40636 header lines just before they are written out at transport time, so they affect
40637 only those copies of the message that pass through the transport. However, only
40638 the message&#x2019;s original header lines, and any that were added by a system
40639 filter, are rewritten. If a router or transport adds header lines, they are not
40640 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
40641 envelope. You can change the return path using <option>return_path</option>, but you cannot
40642 change envelope recipients at this time.
40643 </para>
40644 <para>
40645 <indexterm role="option">
40646 <primary><option>home_directory</option></primary>
40647 </indexterm>
40648 </para>
40649 <informaltable frame="all">
40650 <tgroup cols="4" colsep="0" rowsep="0">
40651 <colspec colwidth="8*" align="left"/>
40652 <colspec colwidth="6*" align="center"/>
40653 <colspec colwidth="6*" align="center"/>
40654 <colspec colwidth="6*" align="right"/>
40655 <tbody>
40656 <row>
40657 <entry><option>home_directory</option></entry>
40658 <entry>Use: <emphasis>transports</emphasis></entry>
40659 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40660 <entry>Default: <emphasis>unset</emphasis></entry>
40661 </row>
40662 </tbody>
40663 </tgroup>
40664 </informaltable>
40665 <para>
40666 <indexterm role="concept">
40667 <primary>transport</primary>
40668 <secondary>home directory for</secondary>
40669 </indexterm>
40670 <indexterm role="variable">
40671 <primary><varname>$home</varname></primary>
40672 </indexterm>
40673 This option specifies a home directory setting for a local transport,
40674 overriding any value that may be set by the router. The home directory is
40675 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
40676 used as the current directory if no current directory is set by the
40677 <option>current_directory</option> option on the transport or the
40678 <option>transport_current_directory</option> option on the router. If the expansion fails
40679 for any reason, including forced failure, an error is logged, and delivery is
40680 deferred.
40681 </para>
40682 <para>
40683 <indexterm role="option">
40684 <primary><option>initgroups</option></primary>
40685 </indexterm>
40686 </para>
40687 <informaltable frame="all">
40688 <tgroup cols="4" colsep="0" rowsep="0">
40689 <colspec colwidth="8*" align="left"/>
40690 <colspec colwidth="6*" align="center"/>
40691 <colspec colwidth="6*" align="center"/>
40692 <colspec colwidth="6*" align="right"/>
40693 <tbody>
40694 <row>
40695 <entry><option>initgroups</option></entry>
40696 <entry>Use: <emphasis>transports</emphasis></entry>
40697 <entry>Type: <emphasis>boolean</emphasis></entry>
40698 <entry>Default: <emphasis>false</emphasis></entry>
40699 </row>
40700 </tbody>
40701 </tgroup>
40702 </informaltable>
40703 <para>
40704 <indexterm role="concept">
40705 <primary>additional groups</primary>
40706 </indexterm>
40707 <indexterm role="concept">
40708 <primary>groups</primary>
40709 <secondary>additional</secondary>
40710 </indexterm>
40711 <indexterm role="concept">
40712 <primary>transport</primary>
40713 <secondary>group; additional</secondary>
40714 </indexterm>
40715 If this option is true and the uid for the delivery process is provided by the
40716 transport, the <function>initgroups()</function> function is called when running the transport
40717 to ensure that any additional groups associated with the uid are set up.
40718 </para>
40719 <para>
40720 <indexterm role="option">
40721 <primary><option>max_parallel</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>max_parallel</option></entry>
40733 <entry>Use: <emphasis>transports</emphasis></entry>
40734 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
40735 <entry>Default: <emphasis>unset</emphasis></entry>
40736 </row>
40737 </tbody>
40738 </tgroup>
40739 </informaltable>
40740 <para>
40741 <indexterm role="concept">
40742 <primary>limit</primary>
40743 <secondary>transport parallelism</secondary>
40744 </indexterm>
40745 <indexterm role="concept">
40746 <primary>transport</primary>
40747 <secondary>parallel processes</secondary>
40748 </indexterm>
40749 <indexterm role="concept">
40750 <primary>transport</primary>
40751 <secondary>concurrency limit</secondary>
40752 </indexterm>
40753 <indexterm role="concept">
40754 <primary>delivery</primary>
40755 <secondary>parallelism for transport</secondary>
40756 </indexterm>
40757 If this option is set and expands to an integer greater than zero
40758 it limits the number of concurrent runs of the transport.
40759 The control does not apply to shadow transports.
40760 </para>
40761 <para>
40762 <indexterm role="concept">
40763 <primary>hints database</primary>
40764 <secondary>transport concurrency control</secondary>
40765 </indexterm>
40766 Exim implements this control by means of a hints database in which a record is
40767 incremented whenever a transport process is being created. The record
40768 is decremented and possibly removed when the process terminates.
40769 Obviously there is scope for
40770 records to get left lying around if there is a system or program crash. To
40771 guard against this, Exim ignores any records that are more than six hours old.
40772 </para>
40773 <para>
40774 If you use this option, you should also arrange to delete the
40775 relevant hints database whenever your system reboots. The names of the files
40776 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
40777 may be one or two files, depending on the type of DBM in use. The same files
40778 are used for ETRN and smtp transport serialization.
40779 </para>
40780 <para>
40781 <indexterm role="option">
40782 <primary><option>message_size_limit</option></primary>
40783 </indexterm>
40784 </para>
40785 <informaltable frame="all">
40786 <tgroup cols="4" colsep="0" rowsep="0">
40787 <colspec colwidth="8*" align="left"/>
40788 <colspec colwidth="6*" align="center"/>
40789 <colspec colwidth="6*" align="center"/>
40790 <colspec colwidth="6*" align="right"/>
40791 <tbody>
40792 <row>
40793 <entry><option>message_size_limit</option></entry>
40794 <entry>Use: <emphasis>transports</emphasis></entry>
40795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40796 <entry>Default: <emphasis>0</emphasis></entry>
40797 </row>
40798 </tbody>
40799 </tgroup>
40800 </informaltable>
40801 <para>
40802 <indexterm role="concept">
40803 <primary>limit</primary>
40804 <secondary>message size per transport</secondary>
40805 </indexterm>
40806 <indexterm role="concept">
40807 <primary>size</primary>
40808 <secondary>of message, limit</secondary>
40809 </indexterm>
40810 <indexterm role="concept">
40811 <primary>transport</primary>
40812 <secondary>message size; limiting</secondary>
40813 </indexterm>
40814 This option controls the size of messages passed through the transport. It is
40815 expanded before use; the result of the expansion must be a sequence of decimal
40816 digits, optionally followed by K or M. If the expansion fails for any reason,
40817 including forced failure, or if the result is not of the required form,
40818 delivery is deferred. If the value is greater than zero and the size of a
40819 message exceeds this limit, the address is failed. If there is any chance that
40820 the resulting bounce message could be routed to the same transport, you should
40821 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
40822 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
40823 delivered.
40824 </para>
40825 <para>
40826 <indexterm role="option">
40827 <primary><option>rcpt_include_affixes</option></primary>
40828 </indexterm>
40829 </para>
40830 <informaltable frame="all">
40831 <tgroup cols="4" colsep="0" rowsep="0">
40832 <colspec colwidth="8*" align="left"/>
40833 <colspec colwidth="6*" align="center"/>
40834 <colspec colwidth="6*" align="center"/>
40835 <colspec colwidth="6*" align="right"/>
40836 <tbody>
40837 <row>
40838 <entry><option>rcpt_include_affixes</option></entry>
40839 <entry>Use: <emphasis>transports</emphasis></entry>
40840 <entry>Type: <emphasis>boolean</emphasis></entry>
40841 <entry>Default: <emphasis>false</emphasis></entry>
40842 </row>
40843 </tbody>
40844 </tgroup>
40845 </informaltable>
40846 <para>
40847 <indexterm role="concept">
40848 <primary>prefix</primary>
40849 <secondary>for local part, including in envelope</secondary>
40850 </indexterm>
40851 <indexterm role="concept">
40852 <primary>suffix for local part</primary>
40853 <secondary>including in envelope</secondary>
40854 </indexterm>
40855 <indexterm role="concept">
40856 <primary>local part</primary>
40857 <secondary>prefix</secondary>
40858 </indexterm>
40859 <indexterm role="concept">
40860 <primary>local part</primary>
40861 <secondary>suffix</secondary>
40862 </indexterm>
40863 When this option is false (the default), and an address that has had any
40864 affixes (prefixes or suffixes) removed from the local part is delivered by any
40865 form of SMTP or LMTP, the affixes are not included. For example, if a router
40866 that contains
40867 </para>
40868 <literallayout class="monospaced">
40869 local_part_prefix = *-
40870 </literallayout>
40871 <para>
40872 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
40873 is delivered with
40874 </para>
40875 <literallayout class="monospaced">
40876 RCPT TO:&lt;xyz@some.domain&gt;
40877 </literallayout>
40878 <para>
40879 This is also the case when an ACL-time callout is being used to verify a
40880 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
40881 whole local part is included in the RCPT command. This option applies to BSMTP
40882 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
40883 <command>lmtp</command> and <command>smtp</command> transports.
40884 </para>
40885 <para>
40886 <indexterm role="option">
40887 <primary><option>retry_use_local_part</option></primary>
40888 </indexterm>
40889 </para>
40890 <informaltable frame="all">
40891 <tgroup cols="4" colsep="0" rowsep="0">
40892 <colspec colwidth="8*" align="left"/>
40893 <colspec colwidth="6*" align="center"/>
40894 <colspec colwidth="6*" align="center"/>
40895 <colspec colwidth="6*" align="right"/>
40896 <tbody>
40897 <row>
40898 <entry><option>retry_use_local_part</option></entry>
40899 <entry>Use: <emphasis>transports</emphasis></entry>
40900 <entry>Type: <emphasis>boolean</emphasis></entry>
40901 <entry>Default: <emphasis>see below</emphasis></entry>
40902 </row>
40903 </tbody>
40904 </tgroup>
40905 </informaltable>
40906 <para>
40907 <indexterm role="concept">
40908 <primary>hints database</primary>
40909 <secondary>retry keys</secondary>
40910 </indexterm>
40911 When a delivery suffers a temporary failure, a retry record is created
40912 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
40913 is based on the name and/or IP address of the failing remote host. For local
40914 deliveries, the key is normally the entire address, including both the local
40915 part and the domain. This is suitable for most common cases of local delivery
40916 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
40917 deliveries to that mailbox, not to the whole domain.
40918 </para>
40919 <para>
40920 However, in some special cases you may want to treat a temporary local delivery
40921 as a failure associated with the domain, and not with a particular local part.
40922 (For example, if you are storing all mail for some domain in files.) You can do
40923 this by setting <option>retry_use_local_part</option> false.
40924 </para>
40925 <para>
40926 For all the local transports, its default value is true. For remote transports,
40927 the default value is false for tidiness, but changing the value has no effect
40928 on a remote transport in the current implementation.
40929 </para>
40930 <para>
40931 <indexterm role="option">
40932 <primary><option>return_path</option></primary>
40933 </indexterm>
40934 </para>
40935 <informaltable frame="all">
40936 <tgroup cols="4" colsep="0" rowsep="0">
40937 <colspec colwidth="8*" align="left"/>
40938 <colspec colwidth="6*" align="center"/>
40939 <colspec colwidth="6*" align="center"/>
40940 <colspec colwidth="6*" align="right"/>
40941 <tbody>
40942 <row>
40943 <entry><option>return_path</option></entry>
40944 <entry>Use: <emphasis>transports</emphasis></entry>
40945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40946 <entry>Default: <emphasis>unset</emphasis></entry>
40947 </row>
40948 </tbody>
40949 </tgroup>
40950 </informaltable>
40951 <para>
40952 <indexterm role="concept">
40953 <primary>envelope sender</primary>
40954 </indexterm>
40955 <indexterm role="concept">
40956 <primary>transport</primary>
40957 <secondary>return path; changing</secondary>
40958 </indexterm>
40959 <indexterm role="concept">
40960 <primary>return path</primary>
40961 <secondary>changing in transport</secondary>
40962 </indexterm>
40963 If this option is set, the string is expanded at transport time and replaces
40964 the existing return path (envelope sender) value in the copy of the message
40965 that is being delivered. An empty return path is permitted. This feature is
40966 designed for remote deliveries, where the value of this option is used in the
40967 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
40968 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
40969 header line, if one is added to the message (see the next option).
40970 </para>
40971 <para>
40972 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
40973 <option>return_path_on_delivery</option> to the log selector.
40974 </para>
40975 <para>
40976 <indexterm role="variable">
40977 <primary><varname>$return_path</varname></primary>
40978 </indexterm>
40979 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
40980 either the message&#x2019;s envelope sender, or an address set by the
40981 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
40982 replacement occurs; if it fails for another reason, delivery is deferred. This
40983 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
40984 section <xref linkend="SECTverp"/>.
40985 </para>
40986 <para>
40987 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
40988 remote server rejects a message at SMTP time, the bounce message is not sent to
40989 the value of this option. It is sent to the previously set errors address.
40990 This defaults to the incoming sender address, but can be changed by setting
40991 <option>errors_to</option> in a router.
40992 </para>
40993 <para>
40994 <indexterm role="option">
40995 <primary><option>return_path_add</option></primary>
40996 </indexterm>
40997 </para>
40998 <informaltable frame="all">
40999 <tgroup cols="4" colsep="0" rowsep="0">
41000 <colspec colwidth="8*" align="left"/>
41001 <colspec colwidth="6*" align="center"/>
41002 <colspec colwidth="6*" align="center"/>
41003 <colspec colwidth="6*" align="right"/>
41004 <tbody>
41005 <row>
41006 <entry><option>return_path_add</option></entry>
41007 <entry>Use: <emphasis>transports</emphasis></entry>
41008 <entry>Type: <emphasis>boolean</emphasis></entry>
41009 <entry>Default: <emphasis>false</emphasis></entry>
41010 </row>
41011 </tbody>
41012 </tgroup>
41013 </informaltable>
41014 <para>
41015 <indexterm role="concept">
41016 <primary><emphasis>Return-path:</emphasis> header line</primary>
41017 </indexterm>
41018 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
41019 Although the return path is normally available in the prefix line of BSD
41020 mailboxes, this is commonly not displayed by MUAs, and so the user does not
41021 have easy access to it.
41022 </para>
41023 <para>
41024 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
41025 the delivery SMTP server makes the final delivery</quote>. This implies that this
41026 header should not be present in incoming messages. Exim has a configuration
41027 option, <option>return_path_remove</option>, which requests removal of this header from
41028 incoming messages, so that delivered messages can safely be resent to other
41029 recipients.
41030 </para>
41031 <para>
41032 <indexterm role="option">
41033 <primary><option>shadow_condition</option></primary>
41034 </indexterm>
41035 </para>
41036 <informaltable frame="all">
41037 <tgroup cols="4" colsep="0" rowsep="0">
41038 <colspec colwidth="8*" align="left"/>
41039 <colspec colwidth="6*" align="center"/>
41040 <colspec colwidth="6*" align="center"/>
41041 <colspec colwidth="6*" align="right"/>
41042 <tbody>
41043 <row>
41044 <entry><option>shadow_condition</option></entry>
41045 <entry>Use: <emphasis>transports</emphasis></entry>
41046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41047 <entry>Default: <emphasis>unset</emphasis></entry>
41048 </row>
41049 </tbody>
41050 </tgroup>
41051 </informaltable>
41052 <para>
41053 See <option>shadow_transport</option> below.
41054 </para>
41055 <para>
41056 <indexterm role="option">
41057 <primary><option>shadow_transport</option></primary>
41058 </indexterm>
41059 </para>
41060 <informaltable frame="all">
41061 <tgroup cols="4" colsep="0" rowsep="0">
41062 <colspec colwidth="8*" align="left"/>
41063 <colspec colwidth="6*" align="center"/>
41064 <colspec colwidth="6*" align="center"/>
41065 <colspec colwidth="6*" align="right"/>
41066 <tbody>
41067 <row>
41068 <entry><option>shadow_transport</option></entry>
41069 <entry>Use: <emphasis>transports</emphasis></entry>
41070 <entry>Type: <emphasis>string</emphasis></entry>
41071 <entry>Default: <emphasis>unset</emphasis></entry>
41072 </row>
41073 </tbody>
41074 </tgroup>
41075 </informaltable>
41076 <para>
41077 <indexterm role="concept">
41078 <primary>shadow transport</primary>
41079 </indexterm>
41080 <indexterm role="concept">
41081 <primary>transport</primary>
41082 <secondary>shadow</secondary>
41083 </indexterm>
41084 A local transport may set the <option>shadow_transport</option> option to the name of
41085 another local transport. Shadow remote transports are not supported.
41086 </para>
41087 <para>
41088 Whenever a delivery to the main transport succeeds, and either
41089 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
41090 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
41091 passed to the shadow transport, with the same delivery address or addresses. If
41092 expansion fails, no action is taken except that non-forced expansion failures
41093 cause a log line to be written.
41094 </para>
41095 <para>
41096 The result of the shadow transport is discarded and does not affect the
41097 subsequent processing of the message. Only a single level of shadowing is
41098 provided; the <option>shadow_transport</option> option is ignored on any transport when it
41099 is running as a shadow. Options concerned with output from pipes are also
41100 ignored. The log line for the successful delivery has an item added on the end,
41101 of the form
41102 </para>
41103 <literallayout class="monospaced">
41104 ST=&lt;shadow transport name&gt;
41105 </literallayout>
41106 <para>
41107 If the shadow transport did not succeed, the error message is put in
41108 parentheses afterwards. Shadow transports can be used for a number of different
41109 purposes, including keeping more detailed log information than Exim normally
41110 provides, and implementing automatic acknowledgment policies based on message
41111 headers that some sites insist on.
41112 </para>
41113 <para>
41114 <indexterm role="option">
41115 <primary><option>transport_filter</option></primary>
41116 </indexterm>
41117 </para>
41118 <informaltable frame="all">
41119 <tgroup cols="4" colsep="0" rowsep="0">
41120 <colspec colwidth="8*" align="left"/>
41121 <colspec colwidth="6*" align="center"/>
41122 <colspec colwidth="6*" align="center"/>
41123 <colspec colwidth="6*" align="right"/>
41124 <tbody>
41125 <row>
41126 <entry><option>transport_filter</option></entry>
41127 <entry>Use: <emphasis>transports</emphasis></entry>
41128 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41129 <entry>Default: <emphasis>unset</emphasis></entry>
41130 </row>
41131 </tbody>
41132 </tgroup>
41133 </informaltable>
41134 <para>
41135 <indexterm role="concept">
41136 <primary>transport</primary>
41137 <secondary>filter</secondary>
41138 </indexterm>
41139 <indexterm role="concept">
41140 <primary>filter</primary>
41141 <secondary>transport filter</secondary>
41142 </indexterm>
41143 This option sets up a filtering (in the Unix shell sense) process for messages
41144 at transport time. It should not be confused with mail filtering as set up by
41145 individual users or via a system filter.
41146 If unset, or expanding to an empty string, no filtering is done.
41147 </para>
41148 <para>
41149 When the message is about to be written out, the command specified by
41150 <option>transport_filter</option> is started up in a separate, parallel process, and
41151 the entire message, including the header lines, is passed to it on its standard
41152 input (this in fact is done from a third process, to avoid deadlock). The
41153 command must be specified as an absolute path.
41154 </para>
41155 <para>
41156 The lines of the message that are written to the transport filter are
41157 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
41158 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
41159 lines beginning with a dot, and also before any processing implied by the
41160 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
41161 <command>pipe</command> transports.
41162 </para>
41163 <para>
41164 The standard error for the filter process is set to the same destination as its
41165 standard output; this is read and written to the message&#x2019;s ultimate
41166 destination. The process that writes the message to the filter, the
41167 filter itself, and the original process that reads the result and delivers it
41168 are all run in parallel, like a shell pipeline.
41169 </para>
41170 <para>
41171 The filter can perform any transformations it likes, but of course should take
41172 care not to break RFC 2822 syntax. Exim does not check the result, except to
41173 test for a final newline when SMTP is in use. All messages transmitted over
41174 SMTP must end with a newline, so Exim supplies one if it is missing.
41175 </para>
41176 <para>
41177 <indexterm role="concept">
41178 <primary>content scanning</primary>
41179 <secondary>per user</secondary>
41180 </indexterm>
41181 A transport filter can be used to provide content-scanning on a per-user basis
41182 at delivery time if the only required effect of the scan is to modify the
41183 message. For example, a content scan could insert a new header line containing
41184 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
41185 not possible to discard a message at this stage.
41186 </para>
41187 <para>
41188 <indexterm role="concept">
41189 <primary>SMTP</primary>
41190 <secondary>SIZE</secondary>
41191 </indexterm>
41192 A problem might arise if the filter increases the size of a message that is
41193 being sent down an SMTP connection. If the receiving SMTP server has indicated
41194 support for the SIZE parameter, Exim will have sent the size of the message
41195 at the start of the SMTP session. If what is actually sent is substantially
41196 more, the server might reject the message. This can be worked round by setting
41197 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
41198 additions to the message, or to disable the use of SIZE altogether.
41199 </para>
41200 <para>
41201 <indexterm role="variable">
41202 <primary><varname>$pipe_addresses</varname></primary>
41203 </indexterm>
41204 The value of the <option>transport_filter</option> option is the command string for starting
41205 the filter, which is run directly from Exim, not under a shell. The string is
41206 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
41207 Exim breaks it up into arguments and then expands each argument separately (see
41208 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
41209 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
41210 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
41211 an ideal name for this feature here, but as it was already implemented for the
41212 <command>pipe</command> transport, it seemed sensible not to change it.)
41213 </para>
41214 <para>
41215 <indexterm role="variable">
41216 <primary><varname>$host</varname></primary>
41217 </indexterm>
41218 <indexterm role="variable">
41219 <primary><varname>$host_address</varname></primary>
41220 </indexterm>
41221 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
41222 transport is a remote one. They contain the name and IP address of the host to
41223 which the message is being sent. For example:
41224 </para>
41225 <literallayout class="monospaced">
41226 transport_filter = /some/directory/transport-filter.pl \
41227   $host $host_address $sender_address $pipe_addresses
41228 </literallayout>
41229 <para>
41230 Two problems arise if you want to use more complicated expansion items to
41231 generate transport filter commands, both of which due to the fact that the
41232 command is split up <emphasis>before</emphasis> expansion.
41233 </para>
41234 <itemizedlist>
41235 <listitem>
41236 <para>
41237 If an expansion item contains white space, you must quote it, so that it is all
41238 part of the same command item. If the entire option setting is one such
41239 expansion item, you have to take care what kind of quoting you use. For
41240 example:
41241 </para>
41242 <literallayout class="monospaced">
41243 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
41244 </literallayout>
41245 <para>
41246 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
41247 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
41248 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
41249 the single quotes were missing, the line would be split into two items,
41250 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
41251 Exim tried to expand the first one.
41252 </para>
41253 </listitem>
41254 <listitem>
41255 <para>
41256 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
41257 expansion cannot generate multiple arguments, or a command name followed by
41258 arguments. Consider this example:
41259 </para>
41260 <literallayout class="monospaced">
41261 transport_filter = ${lookup{$host}lsearch{/a/file}\
41262                     {$value}{/bin/cat}}
41263 </literallayout>
41264 <para>
41265 The result of the lookup is interpreted as the name of the command, even
41266 if it contains white space. The simplest way round this is to use a shell:
41267 </para>
41268 <literallayout class="monospaced">
41269 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
41270                                {$value}{/bin/cat}}
41271 </literallayout>
41272 </listitem>
41273 </itemizedlist>
41274 <para>
41275 The filter process is run under the same uid and gid as the normal delivery.
41276 For remote deliveries this is the Exim uid/gid by default. The command should
41277 normally yield a zero return code. Transport filters are not supposed to fail.
41278 A non-zero code is taken to mean that the transport filter encountered some
41279 serious problem. Delivery of the message is deferred; the message remains on
41280 the queue and is tried again later. It is not possible to cause a message to be
41281 bounced from a transport filter.
41282 </para>
41283 <para>
41284 If a transport filter is set on an autoreply transport, the original message is
41285 passed through the filter as it is being copied into the newly generated
41286 message, which happens if the <option>return_message</option> option is set.
41287 </para>
41288 <para>
41289 <indexterm role="option">
41290 <primary><option>transport_filter_timeout</option></primary>
41291 </indexterm>
41292 </para>
41293 <informaltable frame="all">
41294 <tgroup cols="4" colsep="0" rowsep="0">
41295 <colspec colwidth="8*" align="left"/>
41296 <colspec colwidth="6*" align="center"/>
41297 <colspec colwidth="6*" align="center"/>
41298 <colspec colwidth="6*" align="right"/>
41299 <tbody>
41300 <row>
41301 <entry><option>transport_filter_timeout</option></entry>
41302 <entry>Use: <emphasis>transports</emphasis></entry>
41303 <entry>Type: <emphasis>time</emphasis></entry>
41304 <entry>Default: <emphasis>5m</emphasis></entry>
41305 </row>
41306 </tbody>
41307 </tgroup>
41308 </informaltable>
41309 <para>
41310 <indexterm role="concept">
41311 <primary>transport</primary>
41312 <secondary>filter, timeout</secondary>
41313 </indexterm>
41314 When Exim is reading the output of a transport filter, it applies a timeout
41315 that can be set by this option. Exceeding the timeout is normally treated as a
41316 temporary delivery failure. However, if a transport filter is used with a
41317 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
41318 way as a timeout in the pipe command itself. By default, a timeout is a hard
41319 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
41320 becomes a temporary error.
41321 </para>
41322 <para>
41323 <indexterm role="option">
41324 <primary><option>user</option></primary>
41325 </indexterm>
41326 </para>
41327 <informaltable frame="all">
41328 <tgroup cols="4" colsep="0" rowsep="0">
41329 <colspec colwidth="8*" align="left"/>
41330 <colspec colwidth="6*" align="center"/>
41331 <colspec colwidth="6*" align="center"/>
41332 <colspec colwidth="6*" align="right"/>
41333 <tbody>
41334 <row>
41335 <entry><option>user</option></entry>
41336 <entry>Use: <emphasis>transports</emphasis></entry>
41337 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41338 <entry>Default: <emphasis>Exim user</emphasis></entry>
41339 </row>
41340 </tbody>
41341 </tgroup>
41342 </informaltable>
41343 <para>
41344 <indexterm role="concept">
41345 <primary>uid (user id)</primary>
41346 <secondary>local delivery</secondary>
41347 </indexterm>
41348 <indexterm role="concept">
41349 <primary>transport</primary>
41350 <secondary>user, specifying</secondary>
41351 </indexterm>
41352 This option specifies the user under whose uid the delivery process is to be
41353 run, overriding any uid that may have been set by the router. If the user is
41354 given as a name, the uid is looked up from the password data, and the
41355 associated group is taken as the value of the gid to be used if the <option>group</option>
41356 option is not set.
41357 </para>
41358 <para>
41359 For deliveries that use local transports, a user and group are normally
41360 specified explicitly or implicitly (for example, as a result of
41361 <option>check_local_user</option>) by the router or transport.
41362 </para>
41363 <para>
41364 <indexterm role="concept">
41365 <primary>hints database</primary>
41366 <secondary>access by remote transport</secondary>
41367 </indexterm>
41368 For remote transports, you should leave this option unset unless you really are
41369 sure you know what you are doing. When a remote transport is running, it needs
41370 to be able to access Exim&#x2019;s hints databases, because each host may have its own
41371 retry data.
41372 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
41373 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
41374 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
41375 </para>
41376 </chapter>
41377
41378 <chapter id="CHAPbatching">
41379 <title>Address batching in local transports</title>
41380 <titleabbrev>Address batching</titleabbrev>
41381 <para>
41382 <indexterm role="concept">
41383 <primary>transport</primary>
41384 <secondary>local; address batching in</secondary>
41385 </indexterm>
41386 The only remote transport (<command>smtp</command>) is normally configured to handle more than
41387 one address at a time, so that when several addresses are routed to the same
41388 remote host, just one copy of the message is sent. Local transports, however,
41389 normally handle one address at a time. That is, a separate instance of the
41390 transport is run for each address that is routed to the transport. A separate
41391 copy of the message is delivered each time.
41392 </para>
41393 <para>
41394 <indexterm role="concept">
41395 <primary>batched local delivery</primary>
41396 </indexterm>
41397 <indexterm role="option">
41398 <primary><option>batch_max</option></primary>
41399 </indexterm>
41400 <indexterm role="option">
41401 <primary><option>batch_id</option></primary>
41402 </indexterm>
41403 In special cases, it may be desirable to handle several addresses at once in a
41404 local transport, for example:
41405 </para>
41406 <itemizedlist>
41407 <listitem>
41408 <para>
41409 In an <command>appendfile</command> transport, when storing messages in files for later
41410 delivery by some other means, a single copy of the message with multiple
41411 recipients saves space.
41412 </para>
41413 </listitem>
41414 <listitem>
41415 <para>
41416 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
41417 a single copy saves time, and is the normal way LMTP is expected to work.
41418 </para>
41419 </listitem>
41420 <listitem>
41421 <para>
41422 In a <command>pipe</command> transport, when passing the message
41423 to a scanner program or
41424 to some other delivery mechanism such as UUCP, multiple recipients may be
41425 acceptable.
41426 </para>
41427 </listitem>
41428 </itemizedlist>
41429 <para>
41430 These three local transports all have the same options for controlling multiple
41431 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
41432 repeating the information for each transport, these options are described here.
41433 </para>
41434 <para>
41435 The <option>batch_max</option> option specifies the maximum number of addresses that can be
41436 delivered together in a single run of the transport. Its default value is one
41437 (no batching). When more than one address is routed to a transport that has a
41438 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
41439 (that is, in a single run of the transport with multiple recipients), subject
41440 to certain conditions:
41441 </para>
41442 <itemizedlist>
41443 <listitem>
41444 <para>
41445 <indexterm role="variable">
41446 <primary><varname>$local_part</varname></primary>
41447 </indexterm>
41448 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
41449 batching is possible.
41450 </para>
41451 </listitem>
41452 <listitem>
41453 <para>
41454 <indexterm role="variable">
41455 <primary><varname>$domain</varname></primary>
41456 </indexterm>
41457 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
41458 addresses with the same domain are batched.
41459 </para>
41460 </listitem>
41461 <listitem>
41462 <para>
41463 <indexterm role="concept">
41464 <primary>customizing</primary>
41465 <secondary>batching condition</secondary>
41466 </indexterm>
41467 If <option>batch_id</option> is set, it is expanded for each address, and only those
41468 addresses with the same expanded value are batched. This allows you to specify
41469 customized batching conditions. Failure of the expansion for any reason,
41470 including forced failure, disables batching, but it does not stop the delivery
41471 from taking place.
41472 </para>
41473 </listitem>
41474 <listitem>
41475 <para>
41476 Batched addresses must also have the same errors address (where to send
41477 delivery errors), the same header additions and removals, the same user and
41478 group for the transport, and if a host list is present, the first host must
41479 be the same.
41480 </para>
41481 </listitem>
41482 </itemizedlist>
41483 <para>
41484 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
41485 both when the file or pipe command is specified in the transport, and when it
41486 is specified by a <command>redirect</command> router, but all the batched addresses must of
41487 course be routed to the same file or pipe command. These two transports have an
41488 option called <option>use_bsmtp</option>, which causes them to deliver the message in
41489 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
41490 <option>check_string</option> and <option>escape_string</option> options are forced to the values
41491 </para>
41492 <literallayout class="monospaced">
41493 check_string = "."
41494 escape_string = ".."
41495 </literallayout>
41496 <para>
41497 when batched SMTP is in use. A full description of the batch SMTP mechanism is
41498 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
41499 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
41500 </para>
41501 <para>
41502 <indexterm role="concept">
41503 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
41504 </indexterm>
41505 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
41506 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
41507 that are being processed together. If you are using a batching <command>appendfile</command>
41508 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
41509 addresses is to set the <option>envelope_to_add</option> option.
41510 </para>
41511 <para>
41512 <indexterm role="concept">
41513 <primary><command>pipe</command> transport</primary>
41514 <secondary>with multiple addresses</secondary>
41515 </indexterm>
41516 <indexterm role="variable">
41517 <primary><varname>$pipe_addresses</varname></primary>
41518 </indexterm>
41519 If you are using a <command>pipe</command> transport without BSMTP, and setting the
41520 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
41521 the command. This is not a true variable; it is a bit of magic that causes each
41522 of the recipient addresses to be inserted into the command as a separate
41523 argument. This provides a way of accessing all the addresses that are being
41524 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
41525 are specified by a <command>redirect</command> router.
41526 </para>
41527 </chapter>
41528
41529 <chapter id="CHAPappendfile">
41530 <title>The appendfile transport</title>
41531 <para>
41532 <indexterm role="concept" id="IIDapptra1" class="startofrange">
41533 <primary><command>appendfile</command> transport</primary>
41534 </indexterm>
41535 <indexterm role="concept" id="IIDapptra2" class="startofrange">
41536 <primary>transports</primary>
41537 <secondary><command>appendfile</command></secondary>
41538 </indexterm>
41539 <indexterm role="concept">
41540 <primary>directory creation</primary>
41541 </indexterm>
41542 <indexterm role="concept">
41543 <primary>creating directories</primary>
41544 </indexterm>
41545 The <command>appendfile</command> transport delivers a message by appending it to an existing
41546 file, or by creating an entirely new file in a specified directory. Single
41547 files to which messages are appended can be in the traditional Unix mailbox
41548 format, or optionally in the MBX format supported by the Pine MUA and
41549 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
41550 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
41551 to give added protection against failures that happen part-way through the
41552 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
41553 supported. For all file formats, Exim attempts to create as many levels of
41554 directory as necessary, provided that <option>create_directory</option> is set.
41555 </para>
41556 <para>
41557 The code for the optional formats is not included in the Exim binary by
41558 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
41559 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
41560 included.
41561 </para>
41562 <para>
41563 <indexterm role="concept">
41564 <primary>quota</primary>
41565 <secondary>system</secondary>
41566 </indexterm>
41567 Exim recognizes system quota errors, and generates an appropriate message. Exim
41568 also supports its own quota control within the transport, for use when the
41569 system facility is unavailable or cannot be used for some reason.
41570 </para>
41571 <para>
41572 If there is an error while appending to a file (for example, quota exceeded or
41573 partition filled), Exim attempts to reset the file&#x2019;s length and last
41574 modification time back to what they were before. If there is an error while
41575 creating an entirely new file, the new file is removed.
41576 </para>
41577 <para>
41578 Before appending to a file, a number of security checks are made, and the
41579 file is locked. A detailed description is given below, after the list of
41580 private options.
41581 </para>
41582 <para>
41583 The <command>appendfile</command> transport is most commonly used for local deliveries to
41584 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
41585 putting messages into files for remote delivery by some means other than Exim.
41586 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
41587 option).
41588 </para>
41589 <section id="SECTfildiropt">
41590 <title>The file and directory options</title>
41591 <para>
41592 The <option>file</option> option specifies a single file, to which the message is appended;
41593 the <option>directory</option> option specifies a directory, in which a new file containing
41594 the message is created. Only one of these two options can be set, and for
41595 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
41596 </para>
41597 <para>
41598 <indexterm role="variable">
41599 <primary><varname>$address_file</varname></primary>
41600 </indexterm>
41601 <indexterm role="variable">
41602 <primary><varname>$local_part</varname></primary>
41603 </indexterm>
41604 However, <command>appendfile</command> is also used for delivering messages to files or
41605 directories whose names (or parts of names) are obtained from alias,
41606 forwarding, or filtering operations (for example, a <option>save</option> command in a
41607 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
41608 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
41609 name (or partial name) of the file or directory generated by the redirection
41610 operation. There are two cases:
41611 </para>
41612 <itemizedlist>
41613 <listitem>
41614 <para>
41615 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
41616 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
41617 common case when users with local accounts use filtering to sort mail into
41618 different folders. See for example, the <command>address_file</command> transport in the
41619 default configuration. If the path ends with a slash, it is assumed to be the
41620 name of a directory. A delivery to a directory can also be forced by setting
41621 <option>maildir_format</option> or <option>mailstore_format</option>.
41622 </para>
41623 </listitem>
41624 <listitem>
41625 <para>
41626 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
41627 used to determine the file or directory name for the delivery. Normally, the
41628 contents of <varname>$address_file</varname> are used in some way in the string expansion.
41629 </para>
41630 </listitem>
41631 </itemizedlist>
41632 <para>
41633 <indexterm role="concept">
41634 <primary>Sieve filter</primary>
41635 <secondary>configuring <command>appendfile</command></secondary>
41636 </indexterm>
41637 <indexterm role="concept">
41638 <primary>Sieve filter</primary>
41639 <secondary>relative mailbox path handling</secondary>
41640 </indexterm>
41641 As an example of the second case, consider an environment where users do not
41642 have home directories. They may be permitted to use Exim filter commands of the
41643 form:
41644 </para>
41645 <literallayout class="monospaced">
41646 save folder23
41647 </literallayout>
41648 <para>
41649 or Sieve filter commands of the form:
41650 </para>
41651 <literallayout class="monospaced">
41652 require "fileinto";
41653 fileinto "folder23";
41654 </literallayout>
41655 <para>
41656 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
41657 must transform the relative path into an appropriate absolute file name. In the
41658 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
41659 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
41660 way of handling this requirement:
41661 </para>
41662 <literallayout class="monospaced">
41663 file = ${if eq{$address_file}{inbox} \
41664             {/var/mail/$local_part} \
41665             {${if eq{${substr_0_1:$address_file}}{/} \
41666                   {$address_file} \
41667                   {$home/mail/$address_file} \
41668             }} \
41669        }
41670 </literallayout>
41671 <para>
41672 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
41673 location, absolute paths are used without change, and other folders are in the
41674 <filename>mail</filename> directory within the home directory.
41675 </para>
41676 <para>
41677 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
41678 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
41679 the router. In particular, this is the case if <option>check_local_user</option> is set. If
41680 you want to prevent this happening at routing time, you can set
41681 <option>router_home_directory</option> empty. This forces the router to pass the relative
41682 path to the transport.
41683 </para>
41684 <para>
41685 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
41686 the <option>file</option> or <option>directory</option> option is still used if it is set.
41687 </para>
41688 </section>
41689 <section id="SECID134">
41690 <title>Private options for appendfile</title>
41691 <para>
41692 <indexterm role="concept">
41693 <primary>options</primary>
41694 <secondary><command>appendfile</command> transport</secondary>
41695 </indexterm>
41696 </para>
41697 <para>
41698 <indexterm role="option">
41699 <primary><option>allow_fifo</option></primary>
41700 </indexterm>
41701 </para>
41702 <informaltable frame="all">
41703 <tgroup cols="4" colsep="0" rowsep="0">
41704 <colspec colwidth="8*" align="left"/>
41705 <colspec colwidth="6*" align="center"/>
41706 <colspec colwidth="6*" align="center"/>
41707 <colspec colwidth="6*" align="right"/>
41708 <tbody>
41709 <row>
41710 <entry><option>allow_fifo</option></entry>
41711 <entry>Use: <emphasis>appendfile</emphasis></entry>
41712 <entry>Type: <emphasis>boolean</emphasis></entry>
41713 <entry>Default: <emphasis>false</emphasis></entry>
41714 </row>
41715 </tbody>
41716 </tgroup>
41717 </informaltable>
41718 <para>
41719 <indexterm role="concept">
41720 <primary>fifo (named pipe)</primary>
41721 </indexterm>
41722 <indexterm role="concept">
41723 <primary>named pipe (fifo)</primary>
41724 </indexterm>
41725 <indexterm role="concept">
41726 <primary>pipe</primary>
41727 <secondary>named (fifo)</secondary>
41728 </indexterm>
41729 Setting this option permits delivery to named pipes (FIFOs) as well as to
41730 regular files. If no process is reading the named pipe at delivery time, the
41731 delivery is deferred.
41732 </para>
41733 <para>
41734 <indexterm role="option">
41735 <primary><option>allow_symlink</option></primary>
41736 </indexterm>
41737 </para>
41738 <informaltable frame="all">
41739 <tgroup cols="4" colsep="0" rowsep="0">
41740 <colspec colwidth="8*" align="left"/>
41741 <colspec colwidth="6*" align="center"/>
41742 <colspec colwidth="6*" align="center"/>
41743 <colspec colwidth="6*" align="right"/>
41744 <tbody>
41745 <row>
41746 <entry><option>allow_symlink</option></entry>
41747 <entry>Use: <emphasis>appendfile</emphasis></entry>
41748 <entry>Type: <emphasis>boolean</emphasis></entry>
41749 <entry>Default: <emphasis>false</emphasis></entry>
41750 </row>
41751 </tbody>
41752 </tgroup>
41753 </informaltable>
41754 <para>
41755 <indexterm role="concept">
41756 <primary>symbolic link</primary>
41757 <secondary>to mailbox</secondary>
41758 </indexterm>
41759 <indexterm role="concept">
41760 <primary>mailbox</primary>
41761 <secondary>symbolic link</secondary>
41762 </indexterm>
41763 By default, <command>appendfile</command> will not deliver if the path name for the file is
41764 that of a symbolic link. Setting this option relaxes that constraint, but there
41765 are security issues involved in the use of symbolic links. Be sure you know
41766 what you are doing if you set this. Details of exactly what this option affects
41767 are included in the discussion which follows this list of options.
41768 </para>
41769 <para>
41770 <indexterm role="option">
41771 <primary><option>batch_id</option></primary>
41772 </indexterm>
41773 </para>
41774 <informaltable frame="all">
41775 <tgroup cols="4" colsep="0" rowsep="0">
41776 <colspec colwidth="8*" align="left"/>
41777 <colspec colwidth="6*" align="center"/>
41778 <colspec colwidth="6*" align="center"/>
41779 <colspec colwidth="6*" align="right"/>
41780 <tbody>
41781 <row>
41782 <entry><option>batch_id</option></entry>
41783 <entry>Use: <emphasis>appendfile</emphasis></entry>
41784 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41785 <entry>Default: <emphasis>unset</emphasis></entry>
41786 </row>
41787 </tbody>
41788 </tgroup>
41789 </informaltable>
41790 <para>
41791 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41792 However, batching is automatically disabled for <command>appendfile</command> deliveries that
41793 happen as a result of forwarding or aliasing or other redirection directly to a
41794 file.
41795 </para>
41796 <para>
41797 <indexterm role="option">
41798 <primary><option>batch_max</option></primary>
41799 </indexterm>
41800 </para>
41801 <informaltable frame="all">
41802 <tgroup cols="4" colsep="0" rowsep="0">
41803 <colspec colwidth="8*" align="left"/>
41804 <colspec colwidth="6*" align="center"/>
41805 <colspec colwidth="6*" align="center"/>
41806 <colspec colwidth="6*" align="right"/>
41807 <tbody>
41808 <row>
41809 <entry><option>batch_max</option></entry>
41810 <entry>Use: <emphasis>appendfile</emphasis></entry>
41811 <entry>Type: <emphasis>integer</emphasis></entry>
41812 <entry>Default: <emphasis>1</emphasis></entry>
41813 </row>
41814 </tbody>
41815 </tgroup>
41816 </informaltable>
41817 <para>
41818 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41819 </para>
41820 <para>
41821 <indexterm role="option">
41822 <primary><option>check_group</option></primary>
41823 </indexterm>
41824 </para>
41825 <informaltable frame="all">
41826 <tgroup cols="4" colsep="0" rowsep="0">
41827 <colspec colwidth="8*" align="left"/>
41828 <colspec colwidth="6*" align="center"/>
41829 <colspec colwidth="6*" align="center"/>
41830 <colspec colwidth="6*" align="right"/>
41831 <tbody>
41832 <row>
41833 <entry><option>check_group</option></entry>
41834 <entry>Use: <emphasis>appendfile</emphasis></entry>
41835 <entry>Type: <emphasis>boolean</emphasis></entry>
41836 <entry>Default: <emphasis>false</emphasis></entry>
41837 </row>
41838 </tbody>
41839 </tgroup>
41840 </informaltable>
41841 <para>
41842 When this option is set, the group owner of the file defined by the <option>file</option>
41843 option is checked to see that it is the same as the group under which the
41844 delivery process is running. The default setting is false because the default
41845 file mode is 0600, which means that the group is irrelevant.
41846 </para>
41847 <para>
41848 <indexterm role="option">
41849 <primary><option>check_owner</option></primary>
41850 </indexterm>
41851 </para>
41852 <informaltable frame="all">
41853 <tgroup cols="4" colsep="0" rowsep="0">
41854 <colspec colwidth="8*" align="left"/>
41855 <colspec colwidth="6*" align="center"/>
41856 <colspec colwidth="6*" align="center"/>
41857 <colspec colwidth="6*" align="right"/>
41858 <tbody>
41859 <row>
41860 <entry><option>check_owner</option></entry>
41861 <entry>Use: <emphasis>appendfile</emphasis></entry>
41862 <entry>Type: <emphasis>boolean</emphasis></entry>
41863 <entry>Default: <emphasis>true</emphasis></entry>
41864 </row>
41865 </tbody>
41866 </tgroup>
41867 </informaltable>
41868 <para>
41869 When this option is set, the owner of the file defined by the <option>file</option> option
41870 is checked to ensure that it is the same as the user under which the delivery
41871 process is running.
41872 </para>
41873 <para>
41874 <indexterm role="option">
41875 <primary><option>check_string</option></primary>
41876 </indexterm>
41877 </para>
41878 <informaltable frame="all">
41879 <tgroup cols="4" colsep="0" rowsep="0">
41880 <colspec colwidth="8*" align="left"/>
41881 <colspec colwidth="6*" align="center"/>
41882 <colspec colwidth="6*" align="center"/>
41883 <colspec colwidth="6*" align="right"/>
41884 <tbody>
41885 <row>
41886 <entry><option>check_string</option></entry>
41887 <entry>Use: <emphasis>appendfile</emphasis></entry>
41888 <entry>Type: <emphasis>string</emphasis></entry>
41889 <entry>Default: <emphasis>see below</emphasis></entry>
41890 </row>
41891 </tbody>
41892 </tgroup>
41893 </informaltable>
41894 <para>
41895 <indexterm role="concept">
41896 <primary><quote>From</quote> line</primary>
41897 </indexterm>
41898 As <command>appendfile</command> writes the message, the start of each line is tested for
41899 matching <option>check_string</option>, and if it does, the initial matching characters are
41900 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
41901 a literal string, not a regular expression, and the case of any letters it
41902 contains is significant.
41903 </para>
41904 <para>
41905 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
41906 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
41907 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
41908 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
41909 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
41910 </para>
41911 <para>
41912 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
41913 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
41914 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
41915 if another format is used. For example, to deliver to mailboxes in MMDF format:
41916 <indexterm role="concept">
41917 <primary>MMDF format mailbox</primary>
41918 </indexterm>
41919 <indexterm role="concept">
41920 <primary>mailbox</primary>
41921 <secondary>MMDF format</secondary>
41922 </indexterm>
41923 </para>
41924 <literallayout class="monospaced">
41925 check_string = "\1\1\1\1\n"
41926 escape_string = "\1\1\1\1 \n"
41927 message_prefix = "\1\1\1\1\n"
41928 message_suffix = "\1\1\1\1\n"
41929 </literallayout>
41930 <para>
41931 <indexterm role="option">
41932 <primary><option>create_directory</option></primary>
41933 </indexterm>
41934 </para>
41935 <informaltable frame="all">
41936 <tgroup cols="4" colsep="0" rowsep="0">
41937 <colspec colwidth="8*" align="left"/>
41938 <colspec colwidth="6*" align="center"/>
41939 <colspec colwidth="6*" align="center"/>
41940 <colspec colwidth="6*" align="right"/>
41941 <tbody>
41942 <row>
41943 <entry><option>create_directory</option></entry>
41944 <entry>Use: <emphasis>appendfile</emphasis></entry>
41945 <entry>Type: <emphasis>boolean</emphasis></entry>
41946 <entry>Default: <emphasis>true</emphasis></entry>
41947 </row>
41948 </tbody>
41949 </tgroup>
41950 </informaltable>
41951 <para>
41952 <indexterm role="concept">
41953 <primary>directory creation</primary>
41954 </indexterm>
41955 When this option is true, Exim attempts to create any missing superior
41956 directories for the file that it is about to write. A created directory&#x2019;s mode
41957 is given by the <option>directory_mode</option> option.
41958 </para>
41959 <para>
41960 The group ownership of a newly created directory is highly dependent on the
41961 operating system (and possibly the file system) that is being used. For
41962 example, in Solaris, if the parent directory has the setgid bit set, its group
41963 is propagated to the child; if not, the currently set group is used. However,
41964 in FreeBSD, the parent&#x2019;s group is always used.
41965 </para>
41966 <para>
41967 <indexterm role="option">
41968 <primary><option>create_file</option></primary>
41969 </indexterm>
41970 </para>
41971 <informaltable frame="all">
41972 <tgroup cols="4" colsep="0" rowsep="0">
41973 <colspec colwidth="8*" align="left"/>
41974 <colspec colwidth="6*" align="center"/>
41975 <colspec colwidth="6*" align="center"/>
41976 <colspec colwidth="6*" align="right"/>
41977 <tbody>
41978 <row>
41979 <entry><option>create_file</option></entry>
41980 <entry>Use: <emphasis>appendfile</emphasis></entry>
41981 <entry>Type: <emphasis>string</emphasis></entry>
41982 <entry>Default: <emphasis>anywhere</emphasis></entry>
41983 </row>
41984 </tbody>
41985 </tgroup>
41986 </informaltable>
41987 <para>
41988 This option constrains the location of files and directories that are created
41989 by this transport. It applies to files defined by the <option>file</option> option and
41990 directories defined by the <option>directory</option> option. In the case of maildir
41991 delivery, it applies to the top level directory, not the maildir directories
41992 beneath.
41993 </para>
41994 <para>
41995 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
41996 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
41997 set for the transport. This option is not useful when an explicit file name is
41998 given for normal mailbox deliveries. It is intended for the case when file
41999 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
42000 by an <command>appendfile</command> transport called <option>address_file</option>. See also
42001 <option>file_must_exist</option>.
42002 </para>
42003 <para>
42004 <indexterm role="option">
42005 <primary><option>directory</option></primary>
42006 </indexterm>
42007 </para>
42008 <informaltable frame="all">
42009 <tgroup cols="4" colsep="0" rowsep="0">
42010 <colspec colwidth="8*" align="left"/>
42011 <colspec colwidth="6*" align="center"/>
42012 <colspec colwidth="6*" align="center"/>
42013 <colspec colwidth="6*" align="right"/>
42014 <tbody>
42015 <row>
42016 <entry><option>directory</option></entry>
42017 <entry>Use: <emphasis>appendfile</emphasis></entry>
42018 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42019 <entry>Default: <emphasis>unset</emphasis></entry>
42020 </row>
42021 </tbody>
42022 </tgroup>
42023 </informaltable>
42024 <para>
42025 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
42026 or <option>directory</option> must be set, unless the delivery is the direct result of a
42027 redirection (see section <xref linkend="SECTfildiropt"/>).
42028 </para>
42029 <para>
42030 When <option>directory</option> is set, the string is expanded, and the message is delivered
42031 into a new file or files in or below the given directory, instead of being
42032 appended to a single mailbox file. A number of different formats are provided
42033 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
42034 <xref linkend="SECTopdir"/> for further details of this form of delivery.
42035 </para>
42036 <para>
42037 <indexterm role="option">
42038 <primary><option>directory_file</option></primary>
42039 </indexterm>
42040 </para>
42041 <informaltable frame="all">
42042 <tgroup cols="4" colsep="0" rowsep="0">
42043 <colspec colwidth="8*" align="left"/>
42044 <colspec colwidth="6*" align="center"/>
42045 <colspec colwidth="6*" align="center"/>
42046 <colspec colwidth="6*" align="right"/>
42047 <tbody>
42048 <row>
42049 <entry><option>directory_file</option></entry>
42050 <entry>Use: <emphasis>appendfile</emphasis></entry>
42051 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42052 <entry>Default: <emphasis>see below</emphasis></entry>
42053 </row>
42054 </tbody>
42055 </tgroup>
42056 </informaltable>
42057 <para>
42058 <indexterm role="concept">
42059 <primary>base62</primary>
42060 </indexterm>
42061 <indexterm role="variable">
42062 <primary><varname>$inode</varname></primary>
42063 </indexterm>
42064 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
42065 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
42066 whose name is obtained by expanding this string. The default value is:
42067 </para>
42068 <literallayout class="monospaced">
42069 q${base62:$tod_epoch}-$inode
42070 </literallayout>
42071 <para>
42072 This generates a unique name from the current time, in base 62 form, and the
42073 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
42074 option.
42075 </para>
42076 <para>
42077 <indexterm role="option">
42078 <primary><option>directory_mode</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>directory_mode</option></entry>
42090 <entry>Use: <emphasis>appendfile</emphasis></entry>
42091 <entry>Type: <emphasis>octal integer</emphasis></entry>
42092 <entry>Default: <emphasis>0700</emphasis></entry>
42093 </row>
42094 </tbody>
42095 </tgroup>
42096 </informaltable>
42097 <para>
42098 If <command>appendfile</command> creates any directories as a result of the
42099 <option>create_directory</option> option, their mode is specified by this option.
42100 </para>
42101 <para>
42102 <indexterm role="option">
42103 <primary><option>escape_string</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>escape_string</option></entry>
42115 <entry>Use: <emphasis>appendfile</emphasis></entry>
42116 <entry>Type: <emphasis>string</emphasis></entry>
42117 <entry>Default: <emphasis>see description</emphasis></entry>
42118 </row>
42119 </tbody>
42120 </tgroup>
42121 </informaltable>
42122 <para>
42123 See <option>check_string</option> above.
42124 </para>
42125 <para>
42126 <indexterm role="option">
42127 <primary><option>file</option></primary>
42128 </indexterm>
42129 </para>
42130 <informaltable frame="all">
42131 <tgroup cols="4" colsep="0" rowsep="0">
42132 <colspec colwidth="8*" align="left"/>
42133 <colspec colwidth="6*" align="center"/>
42134 <colspec colwidth="6*" align="center"/>
42135 <colspec colwidth="6*" align="right"/>
42136 <tbody>
42137 <row>
42138 <entry><option>file</option></entry>
42139 <entry>Use: <emphasis>appendfile</emphasis></entry>
42140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42141 <entry>Default: <emphasis>unset</emphasis></entry>
42142 </row>
42143 </tbody>
42144 </tgroup>
42145 </informaltable>
42146 <para>
42147 This option is mutually exclusive with the <option>directory</option> option, but one of
42148 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
42149 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
42150 specifies a single file, to which the message is appended. One or more of
42151 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
42152 <option>file</option>.
42153 </para>
42154 <para>
42155 <indexterm role="concept">
42156 <primary>NFS</primary>
42157 <secondary>lock file</secondary>
42158 </indexterm>
42159 <indexterm role="concept">
42160 <primary>locking files</primary>
42161 </indexterm>
42162 <indexterm role="concept">
42163 <primary>lock files</primary>
42164 </indexterm>
42165 If you are using more than one host to deliver over NFS into the same
42166 mailboxes, you should always use lock files.
42167 </para>
42168 <para>
42169 The string value is expanded for each delivery, and must yield an absolute
42170 path. The most common settings of this option are variations on one of these
42171 examples:
42172 </para>
42173 <literallayout class="monospaced">
42174 file = /var/spool/mail/$local_part
42175 file = /home/$local_part/inbox
42176 file = $home/inbox
42177 </literallayout>
42178 <para>
42179 <indexterm role="concept">
42180 <primary><quote>sticky</quote> bit</primary>
42181 </indexterm>
42182 In the first example, all deliveries are done into the same directory. If Exim
42183 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
42184 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
42185 deliveries to be possible, or alternatively the <option>group</option> option can be used to
42186 run the delivery under a group id which has write access to the directory.
42187 </para>
42188 <para>
42189 <indexterm role="option">
42190 <primary><option>file_format</option></primary>
42191 </indexterm>
42192 </para>
42193 <informaltable frame="all">
42194 <tgroup cols="4" colsep="0" rowsep="0">
42195 <colspec colwidth="8*" align="left"/>
42196 <colspec colwidth="6*" align="center"/>
42197 <colspec colwidth="6*" align="center"/>
42198 <colspec colwidth="6*" align="right"/>
42199 <tbody>
42200 <row>
42201 <entry><option>file_format</option></entry>
42202 <entry>Use: <emphasis>appendfile</emphasis></entry>
42203 <entry>Type: <emphasis>string</emphasis></entry>
42204 <entry>Default: <emphasis>unset</emphasis></entry>
42205 </row>
42206 </tbody>
42207 </tgroup>
42208 </informaltable>
42209 <para>
42210 <indexterm role="concept">
42211 <primary>file</primary>
42212 <secondary>mailbox; checking existing format</secondary>
42213 </indexterm>
42214 This option requests the transport to check the format of an existing file
42215 before adding to it. The check consists of matching a specific string at the
42216 start of the file. The value of the option consists of an even number of
42217 colon-separated strings. The first of each pair is the test string, and the
42218 second is the name of a transport. If the transport associated with a matched
42219 string is not the current transport, control is passed over to the other
42220 transport. For example, suppose the standard <command>local_delivery</command> transport has
42221 this added to it:
42222 </para>
42223 <literallayout class="monospaced">
42224 file_format = "From       : local_delivery :\
42225                \1\1\1\1\n : local_mmdf_delivery"
42226 </literallayout>
42227 <para>
42228 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
42229 a mailbox begins with four binary ones followed by a newline, control is passed
42230 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
42231 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
42232 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
42233 match any string, or if the transport named for a given string is not defined,
42234 delivery is deferred.
42235 </para>
42236 <para>
42237 <indexterm role="option">
42238 <primary><option>file_must_exist</option></primary>
42239 </indexterm>
42240 </para>
42241 <informaltable frame="all">
42242 <tgroup cols="4" colsep="0" rowsep="0">
42243 <colspec colwidth="8*" align="left"/>
42244 <colspec colwidth="6*" align="center"/>
42245 <colspec colwidth="6*" align="center"/>
42246 <colspec colwidth="6*" align="right"/>
42247 <tbody>
42248 <row>
42249 <entry><option>file_must_exist</option></entry>
42250 <entry>Use: <emphasis>appendfile</emphasis></entry>
42251 <entry>Type: <emphasis>boolean</emphasis></entry>
42252 <entry>Default: <emphasis>false</emphasis></entry>
42253 </row>
42254 </tbody>
42255 </tgroup>
42256 </informaltable>
42257 <para>
42258 If this option is true, the file specified by the <option>file</option> option must exist.
42259 A temporary error occurs if it does not, causing delivery to be deferred.
42260 If this option is false, the file is created if it does not exist.
42261 </para>
42262 <para>
42263 <indexterm role="option">
42264 <primary><option>lock_fcntl_timeout</option></primary>
42265 </indexterm>
42266 </para>
42267 <informaltable frame="all">
42268 <tgroup cols="4" colsep="0" rowsep="0">
42269 <colspec colwidth="8*" align="left"/>
42270 <colspec colwidth="6*" align="center"/>
42271 <colspec colwidth="6*" align="center"/>
42272 <colspec colwidth="6*" align="right"/>
42273 <tbody>
42274 <row>
42275 <entry><option>lock_fcntl_timeout</option></entry>
42276 <entry>Use: <emphasis>appendfile</emphasis></entry>
42277 <entry>Type: <emphasis>time</emphasis></entry>
42278 <entry>Default: <emphasis>0s</emphasis></entry>
42279 </row>
42280 </tbody>
42281 </tgroup>
42282 </informaltable>
42283 <para>
42284 <indexterm role="concept">
42285 <primary>timeout</primary>
42286 <secondary>mailbox locking</secondary>
42287 </indexterm>
42288 <indexterm role="concept">
42289 <primary>mailbox</primary>
42290 <secondary>locking, blocking and non-blocking</secondary>
42291 </indexterm>
42292 <indexterm role="concept">
42293 <primary>locking files</primary>
42294 </indexterm>
42295 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
42296 when locking an open mailbox file. If the call fails, the delivery process
42297 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
42298 Non-blocking calls are used so that the file is not kept open during the wait
42299 for the lock; the reason for this is to make it as safe as possible for
42300 deliveries over NFS in the case when processes might be accessing an NFS
42301 mailbox without using a lock file. This should not be done, but
42302 misunderstandings and hence misconfigurations are not unknown.
42303 </para>
42304 <para>
42305 On a busy system, however, the performance of a non-blocking lock approach is
42306 not as good as using a blocking lock with a timeout. In this case, the waiting
42307 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
42308 and can proceed as soon as the previous lock holder releases it.
42309 </para>
42310 <para>
42311 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
42312 timeout, are used. There may still be some retrying: the maximum number of
42313 retries is
42314 </para>
42315 <literallayout class="monospaced">
42316 (lock_retries * lock_interval) / lock_fcntl_timeout
42317 </literallayout>
42318 <para>
42319 rounded up to the next whole number. In other words, the total time during
42320 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
42321 <option>lock_fcntl_timeout</option> is set very large.
42322 </para>
42323 <para>
42324 You should consider setting this option if you are getting a lot of delayed
42325 local deliveries because of errors of the form
42326 </para>
42327 <literallayout class="monospaced">
42328 failed to lock mailbox /some/file (fcntl)
42329 </literallayout>
42330 <para>
42331 <indexterm role="option">
42332 <primary><option>lock_flock_timeout</option></primary>
42333 </indexterm>
42334 </para>
42335 <informaltable frame="all">
42336 <tgroup cols="4" colsep="0" rowsep="0">
42337 <colspec colwidth="8*" align="left"/>
42338 <colspec colwidth="6*" align="center"/>
42339 <colspec colwidth="6*" align="center"/>
42340 <colspec colwidth="6*" align="right"/>
42341 <tbody>
42342 <row>
42343 <entry><option>lock_flock_timeout</option></entry>
42344 <entry>Use: <emphasis>appendfile</emphasis></entry>
42345 <entry>Type: <emphasis>time</emphasis></entry>
42346 <entry>Default: <emphasis>0s</emphasis></entry>
42347 </row>
42348 </tbody>
42349 </tgroup>
42350 </informaltable>
42351 <para>
42352 This timeout applies to file locking when using <function>flock()</function> (see
42353 <option>use_flock</option>); the timeout operates in a similar manner to
42354 <option>lock_fcntl_timeout</option>.
42355 </para>
42356 <para>
42357 <indexterm role="option">
42358 <primary><option>lock_interval</option></primary>
42359 </indexterm>
42360 </para>
42361 <informaltable frame="all">
42362 <tgroup cols="4" colsep="0" rowsep="0">
42363 <colspec colwidth="8*" align="left"/>
42364 <colspec colwidth="6*" align="center"/>
42365 <colspec colwidth="6*" align="center"/>
42366 <colspec colwidth="6*" align="right"/>
42367 <tbody>
42368 <row>
42369 <entry><option>lock_interval</option></entry>
42370 <entry>Use: <emphasis>appendfile</emphasis></entry>
42371 <entry>Type: <emphasis>time</emphasis></entry>
42372 <entry>Default: <emphasis>3s</emphasis></entry>
42373 </row>
42374 </tbody>
42375 </tgroup>
42376 </informaltable>
42377 <para>
42378 This specifies the time to wait between attempts to lock the file. See below
42379 for details of locking.
42380 </para>
42381 <para>
42382 <indexterm role="option">
42383 <primary><option>lock_retries</option></primary>
42384 </indexterm>
42385 </para>
42386 <informaltable frame="all">
42387 <tgroup cols="4" colsep="0" rowsep="0">
42388 <colspec colwidth="8*" align="left"/>
42389 <colspec colwidth="6*" align="center"/>
42390 <colspec colwidth="6*" align="center"/>
42391 <colspec colwidth="6*" align="right"/>
42392 <tbody>
42393 <row>
42394 <entry><option>lock_retries</option></entry>
42395 <entry>Use: <emphasis>appendfile</emphasis></entry>
42396 <entry>Type: <emphasis>integer</emphasis></entry>
42397 <entry>Default: <emphasis>10</emphasis></entry>
42398 </row>
42399 </tbody>
42400 </tgroup>
42401 </informaltable>
42402 <para>
42403 This specifies the maximum number of attempts to lock the file. A value of zero
42404 is treated as 1. See below for details of locking.
42405 </para>
42406 <para>
42407 <indexterm role="option">
42408 <primary><option>lockfile_mode</option></primary>
42409 </indexterm>
42410 </para>
42411 <informaltable frame="all">
42412 <tgroup cols="4" colsep="0" rowsep="0">
42413 <colspec colwidth="8*" align="left"/>
42414 <colspec colwidth="6*" align="center"/>
42415 <colspec colwidth="6*" align="center"/>
42416 <colspec colwidth="6*" align="right"/>
42417 <tbody>
42418 <row>
42419 <entry><option>lockfile_mode</option></entry>
42420 <entry>Use: <emphasis>appendfile</emphasis></entry>
42421 <entry>Type: <emphasis>octal integer</emphasis></entry>
42422 <entry>Default: <emphasis>0600</emphasis></entry>
42423 </row>
42424 </tbody>
42425 </tgroup>
42426 </informaltable>
42427 <para>
42428 This specifies the mode of the created lock file, when a lock file is being
42429 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
42430 </para>
42431 <para>
42432 <indexterm role="option">
42433 <primary><option>lockfile_timeout</option></primary>
42434 </indexterm>
42435 </para>
42436 <informaltable frame="all">
42437 <tgroup cols="4" colsep="0" rowsep="0">
42438 <colspec colwidth="8*" align="left"/>
42439 <colspec colwidth="6*" align="center"/>
42440 <colspec colwidth="6*" align="center"/>
42441 <colspec colwidth="6*" align="right"/>
42442 <tbody>
42443 <row>
42444 <entry><option>lockfile_timeout</option></entry>
42445 <entry>Use: <emphasis>appendfile</emphasis></entry>
42446 <entry>Type: <emphasis>time</emphasis></entry>
42447 <entry>Default: <emphasis>30m</emphasis></entry>
42448 </row>
42449 </tbody>
42450 </tgroup>
42451 </informaltable>
42452 <para>
42453 <indexterm role="concept">
42454 <primary>timeout</primary>
42455 <secondary>mailbox locking</secondary>
42456 </indexterm>
42457 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
42458 exists and is older than this value, it is assumed to have been left behind by
42459 accident, and Exim attempts to remove it.
42460 </para>
42461 <para>
42462 <indexterm role="option">
42463 <primary><option>mailbox_filecount</option></primary>
42464 </indexterm>
42465 </para>
42466 <informaltable frame="all">
42467 <tgroup cols="4" colsep="0" rowsep="0">
42468 <colspec colwidth="8*" align="left"/>
42469 <colspec colwidth="6*" align="center"/>
42470 <colspec colwidth="6*" align="center"/>
42471 <colspec colwidth="6*" align="right"/>
42472 <tbody>
42473 <row>
42474 <entry><option>mailbox_filecount</option></entry>
42475 <entry>Use: <emphasis>appendfile</emphasis></entry>
42476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42477 <entry>Default: <emphasis>unset</emphasis></entry>
42478 </row>
42479 </tbody>
42480 </tgroup>
42481 </informaltable>
42482 <para>
42483 <indexterm role="concept">
42484 <primary>mailbox</primary>
42485 <secondary>specifying size of</secondary>
42486 </indexterm>
42487 <indexterm role="concept">
42488 <primary>size</primary>
42489 <secondary>of mailbox</secondary>
42490 </indexterm>
42491 If this option is set, it is expanded, and the result is taken as the current
42492 number of files in the mailbox. It must be a decimal number, optionally
42493 followed by K or M. This provides a way of obtaining this information from an
42494 external source that maintains the data.
42495 </para>
42496 <para>
42497 <indexterm role="option">
42498 <primary><option>mailbox_size</option></primary>
42499 </indexterm>
42500 </para>
42501 <informaltable frame="all">
42502 <tgroup cols="4" colsep="0" rowsep="0">
42503 <colspec colwidth="8*" align="left"/>
42504 <colspec colwidth="6*" align="center"/>
42505 <colspec colwidth="6*" align="center"/>
42506 <colspec colwidth="6*" align="right"/>
42507 <tbody>
42508 <row>
42509 <entry><option>mailbox_size</option></entry>
42510 <entry>Use: <emphasis>appendfile</emphasis></entry>
42511 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42512 <entry>Default: <emphasis>unset</emphasis></entry>
42513 </row>
42514 </tbody>
42515 </tgroup>
42516 </informaltable>
42517 <para>
42518 <indexterm role="concept">
42519 <primary>mailbox</primary>
42520 <secondary>specifying size of</secondary>
42521 </indexterm>
42522 <indexterm role="concept">
42523 <primary>size</primary>
42524 <secondary>of mailbox</secondary>
42525 </indexterm>
42526 If this option is set, it is expanded, and the result is taken as the current
42527 size the mailbox. It must be a decimal number, optionally followed by K or M.
42528 This provides a way of obtaining this information from an external source that
42529 maintains the data. This is likely to be helpful for maildir deliveries where
42530 it is computationally expensive to compute the size of a mailbox.
42531 </para>
42532 <para>
42533 <indexterm role="option">
42534 <primary><option>maildir_format</option></primary>
42535 </indexterm>
42536 </para>
42537 <informaltable frame="all">
42538 <tgroup cols="4" colsep="0" rowsep="0">
42539 <colspec colwidth="8*" align="left"/>
42540 <colspec colwidth="6*" align="center"/>
42541 <colspec colwidth="6*" align="center"/>
42542 <colspec colwidth="6*" align="right"/>
42543 <tbody>
42544 <row>
42545 <entry><option>maildir_format</option></entry>
42546 <entry>Use: <emphasis>appendfile</emphasis></entry>
42547 <entry>Type: <emphasis>boolean</emphasis></entry>
42548 <entry>Default: <emphasis>false</emphasis></entry>
42549 </row>
42550 </tbody>
42551 </tgroup>
42552 </informaltable>
42553 <para>
42554 <indexterm role="concept">
42555 <primary>maildir format</primary>
42556 <secondary>specifying</secondary>
42557 </indexterm>
42558 If this option is set with the <option>directory</option> option, the delivery is into a new
42559 file, in the <quote>maildir</quote> format that is used by other mail software. When the
42560 transport is activated directly from a <command>redirect</command> router (for example, the
42561 <command>address_file</command> transport in the default configuration), setting
42562 <option>maildir_format</option> causes the path received from the router to be treated as a
42563 directory, whether or not it ends with <literal>/</literal>. This option is available only if
42564 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
42565 <xref linkend="SECTmaildirdelivery"/> below for further details.
42566 </para>
42567 <para>
42568 <indexterm role="option">
42569 <primary><option>maildir_quota_directory_regex</option></primary>
42570 </indexterm>
42571 </para>
42572 <informaltable frame="all">
42573 <tgroup cols="4" colsep="0" rowsep="0">
42574 <colspec colwidth="8*" align="left"/>
42575 <colspec colwidth="6*" align="center"/>
42576 <colspec colwidth="6*" align="center"/>
42577 <colspec colwidth="6*" align="right"/>
42578 <tbody>
42579 <row>
42580 <entry><option>maildir_quota_directory_regex</option></entry>
42581 <entry>Use: <emphasis>appendfile</emphasis></entry>
42582 <entry>Type: <emphasis>string</emphasis></entry>
42583 <entry>Default: <emphasis>See below</emphasis></entry>
42584 </row>
42585 </tbody>
42586 </tgroup>
42587 </informaltable>
42588 <para>
42589 <indexterm role="concept">
42590 <primary>maildir format</primary>
42591 <secondary>quota; directories included in</secondary>
42592 </indexterm>
42593 <indexterm role="concept">
42594 <primary>quota</primary>
42595 <secondary>maildir; directories included in</secondary>
42596 </indexterm>
42597 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
42598 a regular expression for specifying directories, relative to the quota
42599 directory (see <option>quota_directory</option>), that should be included in the quota
42600 calculation. The default value is:
42601 </para>
42602 <literallayout class="monospaced">
42603 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
42604 </literallayout>
42605 <para>
42606 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
42607 (directories whose names begin with a dot). If you want to exclude the
42608 <filename>Trash</filename>
42609 folder from the count (as some sites do), you need to change this setting to
42610 </para>
42611 <literallayout class="monospaced">
42612 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
42613 </literallayout>
42614 <para>
42615 This uses a negative lookahead in the regular expression to exclude the
42616 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
42617 calculations, quota processing is bypassed for any messages that are delivered
42618 directly into that directory.
42619 </para>
42620 <para>
42621 <indexterm role="option">
42622 <primary><option>maildir_retries</option></primary>
42623 </indexterm>
42624 </para>
42625 <informaltable frame="all">
42626 <tgroup cols="4" colsep="0" rowsep="0">
42627 <colspec colwidth="8*" align="left"/>
42628 <colspec colwidth="6*" align="center"/>
42629 <colspec colwidth="6*" align="center"/>
42630 <colspec colwidth="6*" align="right"/>
42631 <tbody>
42632 <row>
42633 <entry><option>maildir_retries</option></entry>
42634 <entry>Use: <emphasis>appendfile</emphasis></entry>
42635 <entry>Type: <emphasis>integer</emphasis></entry>
42636 <entry>Default: <emphasis>10</emphasis></entry>
42637 </row>
42638 </tbody>
42639 </tgroup>
42640 </informaltable>
42641 <para>
42642 This option specifies the number of times to retry when writing a file in
42643 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
42644 </para>
42645 <para>
42646 <indexterm role="option">
42647 <primary><option>maildir_tag</option></primary>
42648 </indexterm>
42649 </para>
42650 <informaltable frame="all">
42651 <tgroup cols="4" colsep="0" rowsep="0">
42652 <colspec colwidth="8*" align="left"/>
42653 <colspec colwidth="6*" align="center"/>
42654 <colspec colwidth="6*" align="center"/>
42655 <colspec colwidth="6*" align="right"/>
42656 <tbody>
42657 <row>
42658 <entry><option>maildir_tag</option></entry>
42659 <entry>Use: <emphasis>appendfile</emphasis></entry>
42660 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42661 <entry>Default: <emphasis>unset</emphasis></entry>
42662 </row>
42663 </tbody>
42664 </tgroup>
42665 </informaltable>
42666 <para>
42667 This option applies only to deliveries in maildir format, and is described in
42668 section <xref linkend="SECTmaildirdelivery"/> below.
42669 </para>
42670 <para>
42671 <indexterm role="option">
42672 <primary><option>maildir_use_size_file</option></primary>
42673 </indexterm>
42674 </para>
42675 <informaltable frame="all">
42676 <tgroup cols="4" colsep="0" rowsep="0">
42677 <colspec colwidth="8*" align="left"/>
42678 <colspec colwidth="6*" align="center"/>
42679 <colspec colwidth="6*" align="center"/>
42680 <colspec colwidth="6*" align="right"/>
42681 <tbody>
42682 <row>
42683 <entry><option>maildir_use_size_file</option></entry>
42684 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
42685 <entry>Type: <emphasis>boolean</emphasis></entry>
42686 <entry>Default: <emphasis>false</emphasis></entry>
42687 </row>
42688 </tbody>
42689 </tgroup>
42690 </informaltable>
42691 <para>
42692 <indexterm role="concept">
42693 <primary>maildir format</primary>
42694 <secondary><filename>maildirsize</filename> file</secondary>
42695 </indexterm>
42696 The result of string expansion for this option must be a valid boolean value.
42697 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
42698 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
42699 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
42700 value is zero. See <option>maildir_quota_directory_regex</option> above and section
42701 <xref linkend="SECTmaildirdelivery"/> below for further details.
42702 </para>
42703 <para>
42704 <indexterm role="option">
42705 <primary><option>maildirfolder_create_regex</option></primary>
42706 </indexterm>
42707 </para>
42708 <informaltable frame="all">
42709 <tgroup cols="4" colsep="0" rowsep="0">
42710 <colspec colwidth="8*" align="left"/>
42711 <colspec colwidth="6*" align="center"/>
42712 <colspec colwidth="6*" align="center"/>
42713 <colspec colwidth="6*" align="right"/>
42714 <tbody>
42715 <row>
42716 <entry><option>maildirfolder_create_regex</option></entry>
42717 <entry>Use: <emphasis>appendfile</emphasis></entry>
42718 <entry>Type: <emphasis>string</emphasis></entry>
42719 <entry>Default: <emphasis>unset</emphasis></entry>
42720 </row>
42721 </tbody>
42722 </tgroup>
42723 </informaltable>
42724 <para>
42725 <indexterm role="concept">
42726 <primary>maildir format</primary>
42727 <secondary><filename>maildirfolder</filename> file</secondary>
42728 </indexterm>
42729 <indexterm role="concept">
42730 <primary><filename>maildirfolder</filename>, creating</primary>
42731 </indexterm>
42732 The value of this option is a regular expression. If it is unset, it has no
42733 effect. Otherwise, before a maildir delivery takes place, the pattern is
42734 matched against the name of the maildir directory, that is, the directory
42735 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
42736 delivery. If there is a match, Exim checks for the existence of a file called
42737 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
42738 See section <xref linkend="SECTmaildirdelivery"/> for more details.
42739 </para>
42740 <para>
42741 <indexterm role="option">
42742 <primary><option>mailstore_format</option></primary>
42743 </indexterm>
42744 </para>
42745 <informaltable frame="all">
42746 <tgroup cols="4" colsep="0" rowsep="0">
42747 <colspec colwidth="8*" align="left"/>
42748 <colspec colwidth="6*" align="center"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="right"/>
42751 <tbody>
42752 <row>
42753 <entry><option>mailstore_format</option></entry>
42754 <entry>Use: <emphasis>appendfile</emphasis></entry>
42755 <entry>Type: <emphasis>boolean</emphasis></entry>
42756 <entry>Default: <emphasis>false</emphasis></entry>
42757 </row>
42758 </tbody>
42759 </tgroup>
42760 </informaltable>
42761 <para>
42762 <indexterm role="concept">
42763 <primary>mailstore format</primary>
42764 <secondary>specifying</secondary>
42765 </indexterm>
42766 If this option is set with the <option>directory</option> option, the delivery is into two
42767 new files in  <quote>mailstore</quote> format. The option is available only if
42768 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
42769 below for further details.
42770 </para>
42771 <para>
42772 <indexterm role="option">
42773 <primary><option>mailstore_prefix</option></primary>
42774 </indexterm>
42775 </para>
42776 <informaltable frame="all">
42777 <tgroup cols="4" colsep="0" rowsep="0">
42778 <colspec colwidth="8*" align="left"/>
42779 <colspec colwidth="6*" align="center"/>
42780 <colspec colwidth="6*" align="center"/>
42781 <colspec colwidth="6*" align="right"/>
42782 <tbody>
42783 <row>
42784 <entry><option>mailstore_prefix</option></entry>
42785 <entry>Use: <emphasis>appendfile</emphasis></entry>
42786 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42787 <entry>Default: <emphasis>unset</emphasis></entry>
42788 </row>
42789 </tbody>
42790 </tgroup>
42791 </informaltable>
42792 <para>
42793 This option applies only to deliveries in mailstore format, and is described in
42794 section <xref linkend="SECTopdir"/> below.
42795 </para>
42796 <para>
42797 <indexterm role="option">
42798 <primary><option>mailstore_suffix</option></primary>
42799 </indexterm>
42800 </para>
42801 <informaltable frame="all">
42802 <tgroup cols="4" colsep="0" rowsep="0">
42803 <colspec colwidth="8*" align="left"/>
42804 <colspec colwidth="6*" align="center"/>
42805 <colspec colwidth="6*" align="center"/>
42806 <colspec colwidth="6*" align="right"/>
42807 <tbody>
42808 <row>
42809 <entry><option>mailstore_suffix</option></entry>
42810 <entry>Use: <emphasis>appendfile</emphasis></entry>
42811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42812 <entry>Default: <emphasis>unset</emphasis></entry>
42813 </row>
42814 </tbody>
42815 </tgroup>
42816 </informaltable>
42817 <para>
42818 This option applies only to deliveries in mailstore format, and is described in
42819 section <xref linkend="SECTopdir"/> below.
42820 </para>
42821 <para>
42822 <indexterm role="option">
42823 <primary><option>mbx_format</option></primary>
42824 </indexterm>
42825 </para>
42826 <informaltable frame="all">
42827 <tgroup cols="4" colsep="0" rowsep="0">
42828 <colspec colwidth="8*" align="left"/>
42829 <colspec colwidth="6*" align="center"/>
42830 <colspec colwidth="6*" align="center"/>
42831 <colspec colwidth="6*" align="right"/>
42832 <tbody>
42833 <row>
42834 <entry><option>mbx_format</option></entry>
42835 <entry>Use: <emphasis>appendfile</emphasis></entry>
42836 <entry>Type: <emphasis>boolean</emphasis></entry>
42837 <entry>Default: <emphasis>false</emphasis></entry>
42838 </row>
42839 </tbody>
42840 </tgroup>
42841 </informaltable>
42842 <para>
42843 <indexterm role="concept">
42844 <primary>locking files</primary>
42845 </indexterm>
42846 <indexterm role="concept">
42847 <primary>file</primary>
42848 <secondary>locking</secondary>
42849 </indexterm>
42850 <indexterm role="concept">
42851 <primary>file</primary>
42852 <secondary>MBX format</secondary>
42853 </indexterm>
42854 <indexterm role="concept">
42855 <primary>MBX format, specifying</primary>
42856 </indexterm>
42857 This option is available only if Exim has been compiled with SUPPORT_MBX
42858 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
42859 the message is appended to the mailbox file in MBX format instead of
42860 traditional Unix format. This format is supported by Pine4 and its associated
42861 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
42862 </para>
42863 <para>
42864 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
42865 automatically changed by the use of <option>mbx_format</option>. They should normally be set
42866 empty when using MBX format, so this option almost always appears in this
42867 combination:
42868 </para>
42869 <literallayout class="monospaced">
42870 mbx_format = true
42871 message_prefix =
42872 message_suffix =
42873 </literallayout>
42874 <para>
42875 If none of the locking options are mentioned in the configuration,
42876 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
42877 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
42878 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
42879 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
42880 should not be used if any program that does not use this form of locking is
42881 going to access the mailbox, nor should it be used if the mailbox file is NFS
42882 mounted, because it works only when the mailbox is accessed from a single host.
42883 </para>
42884 <para>
42885 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
42886 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
42887 (this means for the whole of a Pine or IMAP session), Exim will not be able to
42888 append messages to it.
42889 </para>
42890 <para>
42891 <indexterm role="option">
42892 <primary><option>message_prefix</option></primary>
42893 </indexterm>
42894 </para>
42895 <informaltable frame="all">
42896 <tgroup cols="4" colsep="0" rowsep="0">
42897 <colspec colwidth="8*" align="left"/>
42898 <colspec colwidth="6*" align="center"/>
42899 <colspec colwidth="6*" align="center"/>
42900 <colspec colwidth="6*" align="right"/>
42901 <tbody>
42902 <row>
42903 <entry><option>message_prefix</option></entry>
42904 <entry>Use: <emphasis>appendfile</emphasis></entry>
42905 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42906 <entry>Default: <emphasis>see below</emphasis></entry>
42907 </row>
42908 </tbody>
42909 </tgroup>
42910 </informaltable>
42911 <para>
42912 <indexterm role="concept">
42913 <primary><quote>From</quote> line</primary>
42914 </indexterm>
42915 The string specified here is expanded and output at the start of every message.
42916 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42917 in which case it is:
42918 </para>
42919 <literallayout class="monospaced">
42920 message_prefix = "From ${if def:return_path{$return_path}\
42921   {MAILER-DAEMON}} $tod_bsdinbox\n"
42922 </literallayout>
42923 <para>
42924 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42925 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
42926 </para>
42927 <para>
42928 <indexterm role="option">
42929 <primary><option>message_suffix</option></primary>
42930 </indexterm>
42931 </para>
42932 <informaltable frame="all">
42933 <tgroup cols="4" colsep="0" rowsep="0">
42934 <colspec colwidth="8*" align="left"/>
42935 <colspec colwidth="6*" align="center"/>
42936 <colspec colwidth="6*" align="center"/>
42937 <colspec colwidth="6*" align="right"/>
42938 <tbody>
42939 <row>
42940 <entry><option>message_suffix</option></entry>
42941 <entry>Use: <emphasis>appendfile</emphasis></entry>
42942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42943 <entry>Default: <emphasis>see below</emphasis></entry>
42944 </row>
42945 </tbody>
42946 </tgroup>
42947 </informaltable>
42948 <para>
42949 The string specified here is expanded and output at the end of every message.
42950 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42951 in which case it is a single newline character. The suffix can be suppressed by
42952 setting
42953 </para>
42954 <literallayout class="monospaced">
42955 message_suffix =
42956 </literallayout>
42957 <para>
42958 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42959 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
42960 </para>
42961 <para>
42962 <indexterm role="option">
42963 <primary><option>mode</option></primary>
42964 </indexterm>
42965 </para>
42966 <informaltable frame="all">
42967 <tgroup cols="4" colsep="0" rowsep="0">
42968 <colspec colwidth="8*" align="left"/>
42969 <colspec colwidth="6*" align="center"/>
42970 <colspec colwidth="6*" align="center"/>
42971 <colspec colwidth="6*" align="right"/>
42972 <tbody>
42973 <row>
42974 <entry><option>mode</option></entry>
42975 <entry>Use: <emphasis>appendfile</emphasis></entry>
42976 <entry>Type: <emphasis>octal integer</emphasis></entry>
42977 <entry>Default: <emphasis>0600</emphasis></entry>
42978 </row>
42979 </tbody>
42980 </tgroup>
42981 </informaltable>
42982 <para>
42983 If the output file is created, it is given this mode. If it already exists and
42984 has wider permissions, they are reduced to this mode. If it has narrower
42985 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
42986 if the delivery is the result of a <option>save</option> command in a filter file specifying
42987 a particular mode, the mode of the output file is always forced to take that
42988 value, and this option is ignored.
42989 </para>
42990 <para>
42991 <indexterm role="option">
42992 <primary><option>mode_fail_narrower</option></primary>
42993 </indexterm>
42994 </para>
42995 <informaltable frame="all">
42996 <tgroup cols="4" colsep="0" rowsep="0">
42997 <colspec colwidth="8*" align="left"/>
42998 <colspec colwidth="6*" align="center"/>
42999 <colspec colwidth="6*" align="center"/>
43000 <colspec colwidth="6*" align="right"/>
43001 <tbody>
43002 <row>
43003 <entry><option>mode_fail_narrower</option></entry>
43004 <entry>Use: <emphasis>appendfile</emphasis></entry>
43005 <entry>Type: <emphasis>boolean</emphasis></entry>
43006 <entry>Default: <emphasis>true</emphasis></entry>
43007 </row>
43008 </tbody>
43009 </tgroup>
43010 </informaltable>
43011 <para>
43012 This option applies in the case when an existing mailbox file has a narrower
43013 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
43014 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
43015 continues with the delivery attempt, using the existing mode of the file.
43016 </para>
43017 <para>
43018 <indexterm role="option">
43019 <primary><option>notify_comsat</option></primary>
43020 </indexterm>
43021 </para>
43022 <informaltable frame="all">
43023 <tgroup cols="4" colsep="0" rowsep="0">
43024 <colspec colwidth="8*" align="left"/>
43025 <colspec colwidth="6*" align="center"/>
43026 <colspec colwidth="6*" align="center"/>
43027 <colspec colwidth="6*" align="right"/>
43028 <tbody>
43029 <row>
43030 <entry><option>notify_comsat</option></entry>
43031 <entry>Use: <emphasis>appendfile</emphasis></entry>
43032 <entry>Type: <emphasis>boolean</emphasis></entry>
43033 <entry>Default: <emphasis>false</emphasis></entry>
43034 </row>
43035 </tbody>
43036 </tgroup>
43037 </informaltable>
43038 <para>
43039 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
43040 successful delivery to a user mailbox. This is the daemon that notifies logged
43041 on users about incoming mail.
43042 </para>
43043 <para>
43044 <indexterm role="option">
43045 <primary><option>quota</option></primary>
43046 </indexterm>
43047 </para>
43048 <informaltable frame="all">
43049 <tgroup cols="4" colsep="0" rowsep="0">
43050 <colspec colwidth="8*" align="left"/>
43051 <colspec colwidth="6*" align="center"/>
43052 <colspec colwidth="6*" align="center"/>
43053 <colspec colwidth="6*" align="right"/>
43054 <tbody>
43055 <row>
43056 <entry><option>quota</option></entry>
43057 <entry>Use: <emphasis>appendfile</emphasis></entry>
43058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43059 <entry>Default: <emphasis>unset</emphasis></entry>
43060 </row>
43061 </tbody>
43062 </tgroup>
43063 </informaltable>
43064 <para>
43065 <indexterm role="concept">
43066 <primary>quota</primary>
43067 <secondary>imposed by Exim</secondary>
43068 </indexterm>
43069 This option imposes a limit on the size of the file to which Exim is appending,
43070 or to the total space used in the directory tree when the <option>directory</option> option
43071 is set. In the latter case, computation of the space used is expensive, because
43072 all the files in the directory (and any sub-directories) have to be
43073 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
43074 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
43075 have no shell access to their mailboxes).
43076 </para>
43077 <para>
43078 As there is no interlock against two simultaneous deliveries into a
43079 multi-file mailbox, it is possible for the quota to be overrun in this case.
43080 For single-file mailboxes, of course, an interlock is a necessity.
43081 </para>
43082 <para>
43083 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
43084 may be a lot less than the actual amount of disk space allocated to the file.
43085 If the sizes of a number of files are being added up, the rounding effect can
43086 become quite noticeable, especially on systems that have large block sizes.
43087 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
43088 the obvious value which users understand most easily.
43089 </para>
43090 <para>
43091 The value of the option is expanded, and must then be a numerical value
43092 (decimal point allowed), optionally followed by one of the letters K, M, or G,
43093 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
43094 and further option modifiers. If Exim is running on a system with
43095 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
43096 be handled.
43097 </para>
43098 <para>
43099 The option modifier <option>no_check</option> can be used to force delivery even if the over
43100 quota condition is met. The quota gets updated as usual.
43101 </para>
43102 <para>
43103 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
43104 </para>
43105 <para>
43106 The expansion happens while Exim is running as root, before it changes uid for
43107 the delivery. This means that files that are inaccessible to the end user can
43108 be used to hold quota values that are looked up in the expansion. When delivery
43109 fails because this quota is exceeded, the handling of the error is as for
43110 system quota failures.
43111 </para>
43112 <para>
43113 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
43114 mailbox to the specified maximum size, though the value is not accurate to the
43115 last byte, owing to separator lines and additional headers that may get added
43116 during message delivery. When a mailbox is nearly full, large messages may get
43117 refused even though small ones are accepted, because the size of the current
43118 message is added to the quota when the check is made. This behaviour can be
43119 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
43120 for exceeding the quota does not include the current message. Thus, deliveries
43121 continue until the quota has been exceeded; thereafter, no further messages are
43122 delivered. See also <option>quota_warn_threshold</option>.
43123 </para>
43124 <para>
43125 <indexterm role="option">
43126 <primary><option>quota_directory</option></primary>
43127 </indexterm>
43128 </para>
43129 <informaltable frame="all">
43130 <tgroup cols="4" colsep="0" rowsep="0">
43131 <colspec colwidth="8*" align="left"/>
43132 <colspec colwidth="6*" align="center"/>
43133 <colspec colwidth="6*" align="center"/>
43134 <colspec colwidth="6*" align="right"/>
43135 <tbody>
43136 <row>
43137 <entry><option>quota_directory</option></entry>
43138 <entry>Use: <emphasis>appendfile</emphasis></entry>
43139 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43140 <entry>Default: <emphasis>unset</emphasis></entry>
43141 </row>
43142 </tbody>
43143 </tgroup>
43144 </informaltable>
43145 <para>
43146 This option defines the directory to check for quota purposes when delivering
43147 into individual files. The default is the delivery directory, or, if a file
43148 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
43149 delivery directory.
43150 </para>
43151 <para>
43152 <indexterm role="option">
43153 <primary><option>quota_filecount</option></primary>
43154 </indexterm>
43155 </para>
43156 <informaltable frame="all">
43157 <tgroup cols="4" colsep="0" rowsep="0">
43158 <colspec colwidth="8*" align="left"/>
43159 <colspec colwidth="6*" align="center"/>
43160 <colspec colwidth="6*" align="center"/>
43161 <colspec colwidth="6*" align="right"/>
43162 <tbody>
43163 <row>
43164 <entry><option>quota_filecount</option></entry>
43165 <entry>Use: <emphasis>appendfile</emphasis></entry>
43166 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43167 <entry>Default: <emphasis>0</emphasis></entry>
43168 </row>
43169 </tbody>
43170 </tgroup>
43171 </informaltable>
43172 <para>
43173 This option applies when the <option>directory</option> option is set. It limits the total
43174 number of files in the directory (compare the inode limit in system quotas). It
43175 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
43176 failure causes delivery to be deferred. A value of zero is interpreted as
43177 <quote>no quota</quote>.
43178 </para>
43179 <para>
43180 The option modifier <option>no_check</option> can be used to force delivery even if the over
43181 quota condition is met. The quota gets updated as usual.
43182 </para>
43183 <para>
43184 <indexterm role="option">
43185 <primary><option>quota_is_inclusive</option></primary>
43186 </indexterm>
43187 </para>
43188 <informaltable frame="all">
43189 <tgroup cols="4" colsep="0" rowsep="0">
43190 <colspec colwidth="8*" align="left"/>
43191 <colspec colwidth="6*" align="center"/>
43192 <colspec colwidth="6*" align="center"/>
43193 <colspec colwidth="6*" align="right"/>
43194 <tbody>
43195 <row>
43196 <entry><option>quota_is_inclusive</option></entry>
43197 <entry>Use: <emphasis>appendfile</emphasis></entry>
43198 <entry>Type: <emphasis>boolean</emphasis></entry>
43199 <entry>Default: <emphasis>true</emphasis></entry>
43200 </row>
43201 </tbody>
43202 </tgroup>
43203 </informaltable>
43204 <para>
43205 See <option>quota</option> above.
43206 </para>
43207 <para>
43208 <indexterm role="option">
43209 <primary><option>quota_size_regex</option></primary>
43210 </indexterm>
43211 </para>
43212 <informaltable frame="all">
43213 <tgroup cols="4" colsep="0" rowsep="0">
43214 <colspec colwidth="8*" align="left"/>
43215 <colspec colwidth="6*" align="center"/>
43216 <colspec colwidth="6*" align="center"/>
43217 <colspec colwidth="6*" align="right"/>
43218 <tbody>
43219 <row>
43220 <entry><option>quota_size_regex</option></entry>
43221 <entry>Use: <emphasis>appendfile</emphasis></entry>
43222 <entry>Type: <emphasis>string</emphasis></entry>
43223 <entry>Default: <emphasis>unset</emphasis></entry>
43224 </row>
43225 </tbody>
43226 </tgroup>
43227 </informaltable>
43228 <para>
43229 This option applies when one of the delivery modes that writes a separate file
43230 for each message is being used. When Exim wants to find the size of one of
43231 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
43232 If this is set to a regular expression that matches the file name, and it
43233 captures one string, that string is interpreted as a representation of the
43234 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
43235 </para>
43236 <para>
43237 This feature is useful only when users have no shell access to their mailboxes
43238 &ndash; otherwise they could defeat the quota simply by renaming the files. This
43239 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
43240 the file length to the file name. For example:
43241 </para>
43242 <literallayout class="monospaced">
43243 maildir_tag = ,S=$message_size
43244 quota_size_regex = ,S=(\d+)
43245 </literallayout>
43246 <para>
43247 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
43248 number of lines in the message.
43249 </para>
43250 <para>
43251 The regular expression should not assume that the length is at the end of the
43252 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
43253 sometimes add other information onto the ends of message file names.
43254 </para>
43255 <para>
43256 Section <xref linkend="SECID136"/> contains further information.
43257 </para>
43258 <para>
43259 <indexterm role="option">
43260 <primary><option>quota_warn_message</option></primary>
43261 </indexterm>
43262 </para>
43263 <informaltable frame="all">
43264 <tgroup cols="4" colsep="0" rowsep="0">
43265 <colspec colwidth="8*" align="left"/>
43266 <colspec colwidth="6*" align="center"/>
43267 <colspec colwidth="6*" align="center"/>
43268 <colspec colwidth="6*" align="right"/>
43269 <tbody>
43270 <row>
43271 <entry><option>quota_warn_message</option></entry>
43272 <entry>Use: <emphasis>appendfile</emphasis></entry>
43273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43274 <entry>Default: <emphasis>see below</emphasis></entry>
43275 </row>
43276 </tbody>
43277 </tgroup>
43278 </informaltable>
43279 <para>
43280 See below for the use of this option. If it is not set when
43281 <option>quota_warn_threshold</option> is set, it defaults to
43282 </para>
43283 <literallayout class="monospaced">
43284 quota_warn_message = "\
43285   To: $local_part@$domain\n\
43286   Subject: Your mailbox\n\n\
43287   This message is automatically created \
43288   by mail delivery software.\n\n\
43289   The size of your mailbox has exceeded \
43290   a warning threshold that is\n\
43291   set by the system administrator.\n"
43292 </literallayout>
43293 <para>
43294 <indexterm role="option">
43295 <primary><option>quota_warn_threshold</option></primary>
43296 </indexterm>
43297 </para>
43298 <informaltable frame="all">
43299 <tgroup cols="4" colsep="0" rowsep="0">
43300 <colspec colwidth="8*" align="left"/>
43301 <colspec colwidth="6*" align="center"/>
43302 <colspec colwidth="6*" align="center"/>
43303 <colspec colwidth="6*" align="right"/>
43304 <tbody>
43305 <row>
43306 <entry><option>quota_warn_threshold</option></entry>
43307 <entry>Use: <emphasis>appendfile</emphasis></entry>
43308 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43309 <entry>Default: <emphasis>0</emphasis></entry>
43310 </row>
43311 </tbody>
43312 </tgroup>
43313 </informaltable>
43314 <para>
43315 <indexterm role="concept">
43316 <primary>quota</primary>
43317 <secondary>warning threshold</secondary>
43318 </indexterm>
43319 <indexterm role="concept">
43320 <primary>mailbox</primary>
43321 <secondary>size warning</secondary>
43322 </indexterm>
43323 <indexterm role="concept">
43324 <primary>size</primary>
43325 <secondary>of mailbox</secondary>
43326 </indexterm>
43327 This option is expanded in the same way as <option>quota</option> (see above). If the
43328 resulting value is greater than zero, and delivery of the message causes the
43329 size of the file or total space in the directory tree to cross the given
43330 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
43331 may be specified as a percentage of it by following the value with a percent
43332 sign. For example:
43333 </para>
43334 <literallayout class="monospaced">
43335 quota = 10M
43336 quota_warn_threshold = 75%
43337 </literallayout>
43338 <para>
43339 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
43340 percent sign is ignored.
43341 </para>
43342 <para>
43343 The warning message itself is specified by the <option>quota_warn_message</option> option,
43344 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
43345 warning message. These do not necessarily have to include the recipient(s) of
43346 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
43347 can include any other header lines that you want. If you do not include a
43348 <emphasis>From:</emphasis> line, the default is:
43349 </para>
43350 <literallayout class="monospaced">
43351 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
43352 </literallayout>
43353 <para>
43354 <indexterm role="option">
43355 <primary><option>errors_reply_to</option></primary>
43356 </indexterm>
43357 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
43358 option.
43359 </para>
43360 <para>
43361 The <option>quota</option> option does not have to be set in order to use this option; they
43362 are independent of one another except when the threshold is specified as a
43363 percentage.
43364 </para>
43365 <para>
43366 <indexterm role="option">
43367 <primary><option>use_bsmtp</option></primary>
43368 </indexterm>
43369 </para>
43370 <informaltable frame="all">
43371 <tgroup cols="4" colsep="0" rowsep="0">
43372 <colspec colwidth="8*" align="left"/>
43373 <colspec colwidth="6*" align="center"/>
43374 <colspec colwidth="6*" align="center"/>
43375 <colspec colwidth="6*" align="right"/>
43376 <tbody>
43377 <row>
43378 <entry><option>use_bsmtp</option></entry>
43379 <entry>Use: <emphasis>appendfile</emphasis></entry>
43380 <entry>Type: <emphasis>boolean</emphasis></entry>
43381 <entry>Default: <emphasis>false</emphasis></entry>
43382 </row>
43383 </tbody>
43384 </tgroup>
43385 </informaltable>
43386 <para>
43387 <indexterm role="concept">
43388 <primary>envelope sender</primary>
43389 </indexterm>
43390 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
43391 format, with the envelope sender and recipient(s) included as SMTP commands. If
43392 you want to include a leading HELO command with such messages, you can do
43393 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
43394 for details of batch SMTP.
43395 </para>
43396 <para>
43397 <indexterm role="option">
43398 <primary><option>use_crlf</option></primary>
43399 </indexterm>
43400 </para>
43401 <informaltable frame="all">
43402 <tgroup cols="4" colsep="0" rowsep="0">
43403 <colspec colwidth="8*" align="left"/>
43404 <colspec colwidth="6*" align="center"/>
43405 <colspec colwidth="6*" align="center"/>
43406 <colspec colwidth="6*" align="right"/>
43407 <tbody>
43408 <row>
43409 <entry><option>use_crlf</option></entry>
43410 <entry>Use: <emphasis>appendfile</emphasis></entry>
43411 <entry>Type: <emphasis>boolean</emphasis></entry>
43412 <entry>Default: <emphasis>false</emphasis></entry>
43413 </row>
43414 </tbody>
43415 </tgroup>
43416 </informaltable>
43417 <para>
43418 <indexterm role="concept">
43419 <primary>carriage return</primary>
43420 </indexterm>
43421 <indexterm role="concept">
43422 <primary>linefeed</primary>
43423 </indexterm>
43424 This option causes lines to be terminated with the two-character CRLF sequence
43425 (carriage return, linefeed) instead of just a linefeed character. In the case
43426 of batched SMTP, the byte sequence written to the file is then an exact image
43427 of what would be sent down a real SMTP connection.
43428 </para>
43429 <para>
43430 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
43431 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
43432 in Berkeley-style mailboxes) are written verbatim, so must contain their own
43433 carriage return characters if these are needed. In cases where these options
43434 have non-empty defaults, the values end with a single linefeed, so they must be
43435 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43436 </para>
43437 <para>
43438 <indexterm role="option">
43439 <primary><option>use_fcntl_lock</option></primary>
43440 </indexterm>
43441 </para>
43442 <informaltable frame="all">
43443 <tgroup cols="4" colsep="0" rowsep="0">
43444 <colspec colwidth="8*" align="left"/>
43445 <colspec colwidth="6*" align="center"/>
43446 <colspec colwidth="6*" align="center"/>
43447 <colspec colwidth="6*" align="right"/>
43448 <tbody>
43449 <row>
43450 <entry><option>use_fcntl_lock</option></entry>
43451 <entry>Use: <emphasis>appendfile</emphasis></entry>
43452 <entry>Type: <emphasis>boolean</emphasis></entry>
43453 <entry>Default: <emphasis>see below</emphasis></entry>
43454 </row>
43455 </tbody>
43456 </tgroup>
43457 </informaltable>
43458 <para>
43459 This option controls the use of the <function>fcntl()</function> function to lock a file for
43460 exclusive use when a message is being appended. It is set by default unless
43461 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
43462 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
43463 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
43464 </para>
43465 <para>
43466 <indexterm role="option">
43467 <primary><option>use_flock_lock</option></primary>
43468 </indexterm>
43469 </para>
43470 <informaltable frame="all">
43471 <tgroup cols="4" colsep="0" rowsep="0">
43472 <colspec colwidth="8*" align="left"/>
43473 <colspec colwidth="6*" align="center"/>
43474 <colspec colwidth="6*" align="center"/>
43475 <colspec colwidth="6*" align="right"/>
43476 <tbody>
43477 <row>
43478 <entry><option>use_flock_lock</option></entry>
43479 <entry>Use: <emphasis>appendfile</emphasis></entry>
43480 <entry>Type: <emphasis>boolean</emphasis></entry>
43481 <entry>Default: <emphasis>false</emphasis></entry>
43482 </row>
43483 </tbody>
43484 </tgroup>
43485 </informaltable>
43486 <para>
43487 This option is provided to support the use of <function>flock()</function> for file locking, for
43488 the few situations where it is needed. Most modern operating systems support
43489 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
43490 each other. Exim uses <function>fcntl()</function> locking by default.
43491 </para>
43492 <para>
43493 This option is required only if you are using an operating system where
43494 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
43495 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
43496 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
43497 </para>
43498 <para>
43499 <indexterm role="concept">
43500 <primary>Solaris</primary>
43501 <secondary><function>flock()</function> support</secondary>
43502 </indexterm>
43503 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
43504 have it (and some, I think, provide a not quite right version built on top of
43505 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
43506 the ability to use it, and any attempt to do so will cause a configuration
43507 error.
43508 </para>
43509 <para>
43510 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
43511 is just being mapped onto <function>fcntl()</function> by the OS).
43512 </para>
43513 <para>
43514 <indexterm role="option">
43515 <primary><option>use_lockfile</option></primary>
43516 </indexterm>
43517 </para>
43518 <informaltable frame="all">
43519 <tgroup cols="4" colsep="0" rowsep="0">
43520 <colspec colwidth="8*" align="left"/>
43521 <colspec colwidth="6*" align="center"/>
43522 <colspec colwidth="6*" align="center"/>
43523 <colspec colwidth="6*" align="right"/>
43524 <tbody>
43525 <row>
43526 <entry><option>use_lockfile</option></entry>
43527 <entry>Use: <emphasis>appendfile</emphasis></entry>
43528 <entry>Type: <emphasis>boolean</emphasis></entry>
43529 <entry>Default: <emphasis>see below</emphasis></entry>
43530 </row>
43531 </tbody>
43532 </tgroup>
43533 </informaltable>
43534 <para>
43535 If this option is turned off, Exim does not attempt to create a lock file when
43536 appending to a mailbox file. In this situation, the only locking is by
43537 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
43538 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
43539 <function>fcntl()</function> rather than a lock file, and even then only when you are not
43540 delivering over NFS from more than one host.
43541 </para>
43542 <para>
43543 <indexterm role="concept">
43544 <primary>NFS</primary>
43545 <secondary>lock file</secondary>
43546 </indexterm>
43547 In order to append to an NFS file safely from more than one host, it is
43548 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
43549 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
43550 file corruption.
43551 </para>
43552 <para>
43553 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
43554 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
43555 except when <option>mbx_format</option> is set.
43556 </para>
43557 <para>
43558 <indexterm role="option">
43559 <primary><option>use_mbx_lock</option></primary>
43560 </indexterm>
43561 </para>
43562 <informaltable frame="all">
43563 <tgroup cols="4" colsep="0" rowsep="0">
43564 <colspec colwidth="8*" align="left"/>
43565 <colspec colwidth="6*" align="center"/>
43566 <colspec colwidth="6*" align="center"/>
43567 <colspec colwidth="6*" align="right"/>
43568 <tbody>
43569 <row>
43570 <entry><option>use_mbx_lock</option></entry>
43571 <entry>Use: <emphasis>appendfile</emphasis></entry>
43572 <entry>Type: <emphasis>boolean</emphasis></entry>
43573 <entry>Default: <emphasis>see below</emphasis></entry>
43574 </row>
43575 </tbody>
43576 </tgroup>
43577 </informaltable>
43578 <para>
43579 This option is available only if Exim has been compiled with SUPPORT_MBX
43580 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
43581 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
43582 of the locking options are mentioned in the configuration. The locking rules
43583 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
43584 the IMAP4 and POP daemons that come with it (see the discussion below). The
43585 rules allow for shared access to the mailbox. However, this kind of locking
43586 does not work when the mailbox is NFS mounted.
43587 </para>
43588 <para>
43589 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
43590 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
43591 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
43592 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
43593 </para>
43594 </section>
43595 <section id="SECTopappend">
43596 <title>Operational details for appending</title>
43597 <para>
43598 <indexterm role="concept">
43599 <primary>appending to a file</primary>
43600 </indexterm>
43601 <indexterm role="concept">
43602 <primary>file</primary>
43603 <secondary>appending</secondary>
43604 </indexterm>
43605 Before appending to a file, the following preparations are made:
43606 </para>
43607 <itemizedlist>
43608 <listitem>
43609 <para>
43610 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
43611 return is given.
43612 </para>
43613 </listitem>
43614 <listitem>
43615 <para>
43616 <indexterm role="concept">
43617 <primary>directory creation</primary>
43618 </indexterm>
43619 If any directories on the file&#x2019;s path are missing, Exim creates them if the
43620 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
43621 <option>directory_mode</option> option.
43622 </para>
43623 </listitem>
43624 <listitem>
43625 <para>
43626 If <option>file_format</option> is set, the format of an existing file is checked. If this
43627 indicates that a different transport should be used, control is passed to that
43628 transport.
43629 </para>
43630 </listitem>
43631 <listitem>
43632 <para>
43633 <indexterm role="concept">
43634 <primary>file</primary>
43635 <secondary>locking</secondary>
43636 </indexterm>
43637 <indexterm role="concept">
43638 <primary>locking files</primary>
43639 </indexterm>
43640 <indexterm role="concept">
43641 <primary>NFS</primary>
43642 <secondary>lock file</secondary>
43643 </indexterm>
43644 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
43645 reliably over NFS, as follows:
43646 </para>
43647 <orderedlist numeration="arabic">
43648 <listitem>
43649 <para>
43650 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
43651 current time, primary host name, and process id added, by opening for writing
43652 as a new file. If this fails with an access error, delivery is deferred.
43653 </para>
43654 </listitem>
43655 <listitem>
43656 <para>
43657 Close the hitching post file, and hard link it to the lock file name.
43658 </para>
43659 </listitem>
43660 <listitem>
43661 <para>
43662 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
43663 Unlink the hitching post name.
43664 </para>
43665 </listitem>
43666 <listitem>
43667 <para>
43668 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
43669 then unlink hitching post name. If the number of links is exactly two, creation
43670 of the lock file succeeded but something (for example, an NFS server crash and
43671 restart) caused this fact not to be communicated to the <function>link()</function> call.
43672 </para>
43673 </listitem>
43674 <listitem>
43675 <para>
43676 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
43677 up to <option>lock_retries</option> times. However, since any program that writes to a
43678 mailbox should complete its task very quickly, it is reasonable to time out old
43679 lock files that are normally the result of user agent and system crashes. If an
43680 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
43681 it before trying again.
43682 </para>
43683 </listitem>
43684 </orderedlist>
43685 </listitem>
43686 <listitem>
43687 <para>
43688 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
43689 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
43690 than non-existence, delivery is deferred.
43691 </para>
43692 </listitem>
43693 <listitem>
43694 <para>
43695 <indexterm role="concept">
43696 <primary>symbolic link</primary>
43697 <secondary>to mailbox</secondary>
43698 </indexterm>
43699 <indexterm role="concept">
43700 <primary>mailbox</primary>
43701 <secondary>symbolic link</secondary>
43702 </indexterm>
43703 If the file does exist and is a symbolic link, delivery is deferred, unless the
43704 <option>allow_symlink</option> option is set, in which case the ownership of the link is
43705 checked, and then <function>stat()</function> is called to find out about the real file, which
43706 is then subjected to the checks below. The check on the top-level link
43707 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
43708 directory, though allowing symbolic links in this case is definitely not a good
43709 idea. If there is a chain of symbolic links, the intermediate ones are not
43710 checked.
43711 </para>
43712 </listitem>
43713 <listitem>
43714 <para>
43715 If the file already exists but is not a regular file, or if the file&#x2019;s owner
43716 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
43717 different from the user and group under which the delivery is running,
43718 delivery is deferred.
43719 </para>
43720 </listitem>
43721 <listitem>
43722 <para>
43723 If the file&#x2019;s permissions are more generous than specified, they are reduced.
43724 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
43725 is set false, in which case the delivery is tried using the existing
43726 permissions.
43727 </para>
43728 </listitem>
43729 <listitem>
43730 <para>
43731 The file&#x2019;s inode number is saved, and the file is then opened for appending.
43732 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
43733 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
43734 </para>
43735 </listitem>
43736 <listitem>
43737 <para>
43738 If the file is opened successfully, check that the inode number hasn&#x2019;t
43739 changed, that it is still a regular file, and that the owner and permissions
43740 have not changed. If anything is wrong, defer delivery and freeze the message.
43741 </para>
43742 </listitem>
43743 <listitem>
43744 <para>
43745 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
43746 option is set. Otherwise, check that the file is being created in a permitted
43747 directory if the <option>create_file</option> option is set (deferring on failure), and then
43748 open for writing as a new file, with the O_EXCL and O_CREAT options,
43749 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
43750 set). In this case, which can happen if the link points to a non-existent file,
43751 the file is opened for writing using O_CREAT but not O_EXCL, because
43752 that prevents link following.
43753 </para>
43754 </listitem>
43755 <listitem>
43756 <para>
43757 <indexterm role="concept">
43758 <primary>loop</primary>
43759 <secondary>while file testing</secondary>
43760 </indexterm>
43761 If opening fails because the file exists, obey the tests given above for
43762 existing files. However, to avoid looping in a situation where the file is
43763 being continuously created and destroyed, the exists/not-exists loop is broken
43764 after 10 repetitions, and the message is then frozen.
43765 </para>
43766 </listitem>
43767 <listitem>
43768 <para>
43769 If opening fails with any other error, defer delivery.
43770 </para>
43771 </listitem>
43772 <listitem>
43773 <para>
43774 <indexterm role="concept">
43775 <primary>file</primary>
43776 <secondary>locking</secondary>
43777 </indexterm>
43778 <indexterm role="concept">
43779 <primary>locking files</primary>
43780 </indexterm>
43781 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
43782 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
43783 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
43784 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
43785 file, and an exclusive lock on the file whose name is
43786 </para>
43787 <literallayout class="monospaced">
43788 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
43789 </literallayout>
43790 <para>
43791 using the device and inode numbers of the open mailbox file, in accordance with
43792 the MBX locking rules. This file is created with a mode that is specified by
43793 the <option>lockfile_mode</option> option.
43794 </para>
43795 <para>
43796 If Exim fails to lock the file, there are two possible courses of action,
43797 depending on the value of the locking timeout. This is obtained from
43798 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
43799 </para>
43800 <para>
43801 If the timeout value is zero, the file is closed, Exim waits for
43802 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
43803 to lock it again. This happens up to <option>lock_retries</option> times, after which the
43804 delivery is deferred.
43805 </para>
43806 <para>
43807 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
43808 <function>flock()</function> are used (with the given timeout), so there has already been some
43809 waiting involved by the time locking fails. Nevertheless, Exim does not give up
43810 immediately. It retries up to
43811 </para>
43812 <literallayout class="monospaced">
43813 (lock_retries * lock_interval) / &lt;timeout&gt;
43814 </literallayout>
43815 <para>
43816 times (rounded up).
43817 </para>
43818 </listitem>
43819 </itemizedlist>
43820 <para>
43821 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
43822 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
43823 </para>
43824 </section>
43825 <section id="SECTopdir">
43826 <title>Operational details for delivery to a new file</title>
43827 <para>
43828 <indexterm role="concept">
43829 <primary>delivery</primary>
43830 <secondary>to single file</secondary>
43831 </indexterm>
43832 <indexterm role="concept">
43833 <primary><quote>From</quote> line</primary>
43834 </indexterm>
43835 When the <option>directory</option> option is set instead of <option>file</option>, each message is
43836 delivered into a newly-created file or set of files. When <command>appendfile</command> is
43837 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
43838 <option>directory</option> is normally set, because the path for delivery is supplied by the
43839 router. (See for example, the <command>address_file</command> transport in the default
43840 configuration.) In this case, delivery is to a new file if either the path name
43841 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
43842 </para>
43843 <para>
43844 No locking is required while writing the message to a new file, so the various
43845 locking options of the transport are ignored. The <quote>From</quote> line that by default
43846 separates messages in a single file is not normally needed, nor is the escaping
43847 of message lines that start with <quote>From</quote>, and there is no need to ensure a
43848 newline at the end of each message. Consequently, the default values for
43849 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
43850 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
43851 </para>
43852 <para>
43853 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
43854 the files in the delivery directory by default. However, you can specify a
43855 different directory by setting <option>quota_directory</option>. Also, for maildir
43856 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
43857 </para>
43858 <para>
43859 <indexterm role="concept">
43860 <primary>maildir format</primary>
43861 </indexterm>
43862 <indexterm role="concept">
43863 <primary>mailstore format</primary>
43864 </indexterm>
43865 There are three different ways in which delivery to individual files can be
43866 done, controlled by the settings of the <option>maildir_format</option> and
43867 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
43868 formats is not included in the binary unless SUPPORT_MAILDIR or
43869 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
43870 </para>
43871 <para>
43872 <indexterm role="concept">
43873 <primary>directory creation</primary>
43874 </indexterm>
43875 In all three cases an attempt is made to create the directory and any necessary
43876 sub-directories if they do not exist, provided that the <option>create_directory</option>
43877 option is set (the default). The location of a created directory can be
43878 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
43879 the <option>directory_mode</option> option. If creation fails, or if the
43880 <option>create_directory</option> option is not set when creation is required, delivery is
43881 deferred.
43882 </para>
43883 </section>
43884 <section id="SECTmaildirdelivery">
43885 <title>Maildir delivery</title>
43886 <para>
43887 <indexterm role="concept">
43888 <primary>maildir format</primary>
43889 <secondary>description of</secondary>
43890 </indexterm>
43891 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
43892 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
43893 directory that is defined by the <option>directory</option> option (the <quote>delivery
43894 directory</quote>). If the delivery is successful, the file is renamed into the
43895 <filename>new</filename> subdirectory.
43896 </para>
43897 <para>
43898 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
43899 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
43900 Exim checks that the time-of-day clock has moved on by at least one microsecond
43901 before terminating the delivery process. This guarantees uniqueness for the
43902 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
43903 opening it. If any response other than ENOENT (does not exist) is given,
43904 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
43905 </para>
43906 <para>
43907 Before Exim carries out a maildir delivery, it ensures that subdirectories
43908 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
43909 do not exist, Exim tries to create them and any superior directories in their
43910 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
43911 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
43912 contains matches the delivery directory, Exim also ensures that a file called
43913 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
43914 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
43915 </para>
43916 <para>
43917 These features make it possible to use Exim to create all the necessary files
43918 and directories in a maildir mailbox, including subdirectories for maildir++
43919 folders. Consider this example:
43920 </para>
43921 <literallayout class="monospaced">
43922 maildir_format = true
43923 directory = /var/mail/$local_part\
43924            ${if eq{$local_part_suffix}{}{}\
43925            {/.${substr_1:$local_part_suffix}}}
43926 maildirfolder_create_regex = /\.[^/]+$
43927 </literallayout>
43928 <para>
43929 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
43930 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
43931 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
43932 not match this name, so Exim will not look for or create the file
43933 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
43934 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
43935 </para>
43936 <para>
43937 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
43938 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
43939 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
43940 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
43941 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
43942 </para>
43943 <para>
43944 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
43945 not inadvertently match the toplevel maildir directory, because a
43946 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
43947 </para>
43948 <para>
43949 <indexterm role="concept">
43950 <primary>quota</primary>
43951 <secondary>in maildir delivery</secondary>
43952 </indexterm>
43953 <indexterm role="concept">
43954 <primary>maildir++</primary>
43955 </indexterm>
43956 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
43957 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
43958 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
43959 Exim assumes the directory is a maildir++ folder directory, which is one level
43960 down from the user&#x2019;s top level mailbox directory. This causes it to start at
43961 the parent directory instead of the current directory when calculating the
43962 amount of space used.
43963 </para>
43964 <para>
43965 One problem with delivering into a multi-file mailbox is that it is
43966 computationally expensive to compute the size of the mailbox for quota
43967 checking. Various approaches have been taken to reduce the amount of work
43968 needed. The next two sections describe two of them. A third alternative is to
43969 use some external process for maintaining the size data, and use the expansion
43970 of the <option>mailbox_size</option> option as a way of importing it into Exim.
43971 </para>
43972 </section>
43973 <section id="SECID135">
43974 <title>Using tags to record message sizes</title>
43975 <para>
43976 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
43977 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
43978 tag is added to its name. However, if adding the tag takes the length of the
43979 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
43980 the tag is dropped and the maildir file is created with no tag.
43981 </para>
43982 <para>
43983 <indexterm role="variable">
43984 <primary><varname>$message_size</varname></primary>
43985 </indexterm>
43986 Tags can be used to encode the size of files in their names; see
43987 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
43988 happens after the message has been written. The value of the <varname>$message_size</varname>
43989 variable is set to the number of bytes actually written. If the expansion is
43990 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
43991 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
43992 Non-printing characters in the string are ignored; if the resulting string is
43993 empty, it is ignored. If it starts with an alphanumeric character, a leading
43994 colon is inserted; this default has not proven to be the path that popular
43995 maildir implementations have chosen (but changing it in Exim would break
43996 backwards compatibility).
43997 </para>
43998 <para>
43999 For one common implementation, you might set:
44000 </para>
44001 <literallayout class="monospaced">
44002 maildir_tag = ,S=${message_size}
44003 </literallayout>
44004 <para>
44005 but you should check the documentation of the other software to be sure.
44006 </para>
44007 <para>
44008 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
44009 as this allows Exim to extract the size from your tag, instead of having to
44010 <function>stat()</function> each message file.
44011 </para>
44012 </section>
44013 <section id="SECID136">
44014 <title>Using a maildirsize file</title>
44015 <para>
44016 <indexterm role="concept">
44017 <primary>quota</primary>
44018 <secondary>in maildir delivery</secondary>
44019 </indexterm>
44020 <indexterm role="concept">
44021 <primary>maildir format</primary>
44022 <secondary><filename>maildirsize</filename> file</secondary>
44023 </indexterm>
44024 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
44025 storing quota and message size information in a file called <filename>maildirsize</filename>
44026 within the toplevel maildir directory. If this file does not exist, Exim
44027 creates it, setting the quota from the <option>quota</option> option of the transport. If
44028 the maildir directory itself does not exist, it is created before any attempt
44029 to write a <filename>maildirsize</filename> file.
44030 </para>
44031 <para>
44032 The <filename>maildirsize</filename> file is used to hold information about the sizes of
44033 messages in the maildir, thus speeding up quota calculations. The quota value
44034 in the file is just a cache; if the quota is changed in the transport, the new
44035 value overrides the cached value when the next message is delivered. The cache
44036 is maintained for the benefit of other programs that access the maildir and
44037 need to know the quota.
44038 </para>
44039 <para>
44040 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
44041 file is maintained (with a zero quota setting), but no quota is imposed.
44042 </para>
44043 <para>
44044 A regular expression is available for controlling which directories in the
44045 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
44046 See the description of the <option>maildir_quota_directory_regex</option> option above for
44047 details.
44048 </para>
44049 </section>
44050 <section id="SECID137">
44051 <title>Mailstore delivery</title>
44052 <para>
44053 <indexterm role="concept">
44054 <primary>mailstore format</primary>
44055 <secondary>description of</secondary>
44056 </indexterm>
44057 If the <option>mailstore_format</option> option is true, each message is written as two
44058 files in the given directory. A unique base name is constructed from the
44059 message id and the current delivery process, and the files that are written use
44060 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
44061 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
44062 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
44063 </para>
44064 <para>
44065 During delivery, the envelope is first written to a file with the suffix
44066 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
44067 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
44068 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
44069 file before accessing either of them. An alternative approach is to wait for
44070 the absence of a <filename>.tmp</filename> file.
44071 </para>
44072 <para>
44073 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
44074 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
44075 the sender address on one line, then all the recipient addresses, one per line.
44076 There can be more than one recipient only if the <option>batch_max</option> option is set
44077 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
44078 appended to the file, followed by a newline if it does not end with one.
44079 </para>
44080 <para>
44081 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
44082 failure, it is ignored. Other expansion errors are treated as serious
44083 configuration errors, and delivery is deferred. The variable
44084 <varname>$mailstore_basename</varname> is available for use during these expansions.
44085 </para>
44086 </section>
44087 <section id="SECID138">
44088 <title>Non-special new file delivery</title>
44089 <para>
44090 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
44091 file is created directly in the named directory. For example, when delivering
44092 messages into files in batched SMTP format for later delivery to some host (see
44093 section <xref linkend="SECTbatchSMTP"/>), a setting such as
44094 </para>
44095 <literallayout class="monospaced">
44096 directory = /var/bsmtp/$host
44097 </literallayout>
44098 <para>
44099 might be used. A message is written to a file with a temporary name, which is
44100 then renamed when the delivery is complete. The final name is obtained by
44101 expanding the contents of the <option>directory_file</option> option.
44102 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
44103 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
44104 </para>
44105 </section>
44106 </chapter>
44107
44108 <chapter id="CHID8">
44109 <title>The autoreply transport</title>
44110 <para>
44111 <indexterm role="concept" id="IIDauttra1" class="startofrange">
44112 <primary>transports</primary>
44113 <secondary><command>autoreply</command></secondary>
44114 </indexterm>
44115 <indexterm role="concept" id="IIDauttra2" class="startofrange">
44116 <primary><command>autoreply</command> transport</primary>
44117 </indexterm>
44118 The <command>autoreply</command> transport is not a true transport in that it does not cause
44119 the message to be transmitted. Instead, it generates a new mail message as an
44120 automatic reply to the incoming message. <emphasis>References:</emphasis> and
44121 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
44122 to the rules in RFCs 2822 and 3834, respectively.
44123 </para>
44124 <para>
44125 If the router that passes the message to this transport does not have the
44126 <option>unseen</option> option set, the original message (for the current recipient) is not
44127 delivered anywhere. However, when the <option>unseen</option> option is set on the router
44128 that passes the message to this transport, routing of the address continues, so
44129 another router can set up a normal message delivery.
44130 </para>
44131 <para>
44132 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
44133 <quote>vacation</quote> message being the standard example. However, it can also be run
44134 directly from a router like any other transport. To reduce the possibility of
44135 message cascades, messages created by the <command>autoreply</command> transport always have
44136 empty envelope sender addresses, like bounce messages.
44137 </para>
44138 <para>
44139 The parameters of the message to be sent can be specified in the configuration
44140 by options described below. However, these are used only when the address
44141 passed to the transport does not contain its own reply information. When the
44142 transport is run as a consequence of a
44143 <option>mail</option>
44144 or <option>vacation</option> command in a filter file, the parameters of the message are
44145 supplied by the filter, and passed with the address. The transport&#x2019;s options
44146 that define the message are then ignored (so they are not usually set in this
44147 case). The message is specified entirely by the filter or by the transport; it
44148 is never built from a mixture of options. However, the <option>file_optional</option>,
44149 <option>mode</option>, and <option>return_message</option> options apply in all cases.
44150 </para>
44151 <para>
44152 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
44153 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
44154 gid of the user, and with appropriate current and home directories (see chapter
44155 <xref linkend="CHAPenvironment"/>).
44156 </para>
44157 <para>
44158 There is a subtle difference between routing a message to a <command>pipe</command> transport
44159 that generates some text to be returned to the sender, and routing it to an
44160 <command>autoreply</command> transport. This difference is noticeable only if more than one
44161 address from the same message is so handled. In the case of a pipe, the
44162 separate outputs from the different addresses are gathered up and returned to
44163 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
44164 message is generated for each address that is passed to it.
44165 </para>
44166 <para>
44167 Non-printing characters are not permitted in the header lines generated for the
44168 message that <command>autoreply</command> creates, with the exception of newlines that are
44169 immediately followed by white space. If any non-printing characters are found,
44170 the transport defers.
44171 Whether characters with the top bit set count as printing characters or not is
44172 controlled by the <option>print_topbitchars</option> global option.
44173 </para>
44174 <para>
44175 If any of the generic options for manipulating headers (for example,
44176 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
44177 of the original message that is included in the generated message when
44178 <option>return_message</option> is set. They do not apply to the generated message itself.
44179 </para>
44180 <para>
44181 <indexterm role="variable">
44182 <primary><varname>$sender_address</varname></primary>
44183 </indexterm>
44184 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
44185 the message, indicating that there were no recipients, it does not treat this
44186 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
44187 is empty (because the incoming message is a bounce message) do not cause
44188 problems. They are just discarded.
44189 </para>
44190 <section id="SECID139">
44191 <title>Private options for autoreply</title>
44192 <para>
44193 <indexterm role="concept">
44194 <primary>options</primary>
44195 <secondary><command>autoreply</command> transport</secondary>
44196 </indexterm>
44197 </para>
44198 <para>
44199 <indexterm role="option">
44200 <primary><option>bcc</option></primary>
44201 </indexterm>
44202 </para>
44203 <informaltable frame="all">
44204 <tgroup cols="4" colsep="0" rowsep="0">
44205 <colspec colwidth="8*" align="left"/>
44206 <colspec colwidth="6*" align="center"/>
44207 <colspec colwidth="6*" align="center"/>
44208 <colspec colwidth="6*" align="right"/>
44209 <tbody>
44210 <row>
44211 <entry><option>bcc</option></entry>
44212 <entry>Use: <emphasis>autoreply</emphasis></entry>
44213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44214 <entry>Default: <emphasis>unset</emphasis></entry>
44215 </row>
44216 </tbody>
44217 </tgroup>
44218 </informaltable>
44219 <para>
44220 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
44221 message when the message is specified by the transport.
44222 </para>
44223 <para>
44224 <indexterm role="option">
44225 <primary><option>cc</option></primary>
44226 </indexterm>
44227 </para>
44228 <informaltable frame="all">
44229 <tgroup cols="4" colsep="0" rowsep="0">
44230 <colspec colwidth="8*" align="left"/>
44231 <colspec colwidth="6*" align="center"/>
44232 <colspec colwidth="6*" align="center"/>
44233 <colspec colwidth="6*" align="right"/>
44234 <tbody>
44235 <row>
44236 <entry><option>cc</option></entry>
44237 <entry>Use: <emphasis>autoreply</emphasis></entry>
44238 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44239 <entry>Default: <emphasis>unset</emphasis></entry>
44240 </row>
44241 </tbody>
44242 </tgroup>
44243 </informaltable>
44244 <para>
44245 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
44246 when the message is specified by the transport.
44247 </para>
44248 <para>
44249 <indexterm role="option">
44250 <primary><option>file</option></primary>
44251 </indexterm>
44252 </para>
44253 <informaltable frame="all">
44254 <tgroup cols="4" colsep="0" rowsep="0">
44255 <colspec colwidth="8*" align="left"/>
44256 <colspec colwidth="6*" align="center"/>
44257 <colspec colwidth="6*" align="center"/>
44258 <colspec colwidth="6*" align="right"/>
44259 <tbody>
44260 <row>
44261 <entry><option>file</option></entry>
44262 <entry>Use: <emphasis>autoreply</emphasis></entry>
44263 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44264 <entry>Default: <emphasis>unset</emphasis></entry>
44265 </row>
44266 </tbody>
44267 </tgroup>
44268 </informaltable>
44269 <para>
44270 The contents of the file are sent as the body of the message when the message
44271 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
44272 string comes first.
44273 </para>
44274 <para>
44275 <indexterm role="option">
44276 <primary><option>file_expand</option></primary>
44277 </indexterm>
44278 </para>
44279 <informaltable frame="all">
44280 <tgroup cols="4" colsep="0" rowsep="0">
44281 <colspec colwidth="8*" align="left"/>
44282 <colspec colwidth="6*" align="center"/>
44283 <colspec colwidth="6*" align="center"/>
44284 <colspec colwidth="6*" align="right"/>
44285 <tbody>
44286 <row>
44287 <entry><option>file_expand</option></entry>
44288 <entry>Use: <emphasis>autoreply</emphasis></entry>
44289 <entry>Type: <emphasis>boolean</emphasis></entry>
44290 <entry>Default: <emphasis>false</emphasis></entry>
44291 </row>
44292 </tbody>
44293 </tgroup>
44294 </informaltable>
44295 <para>
44296 If this is set, the contents of the file named by the <option>file</option> option are
44297 subjected to string expansion as they are added to the message.
44298 </para>
44299 <para>
44300 <indexterm role="option">
44301 <primary><option>file_optional</option></primary>
44302 </indexterm>
44303 </para>
44304 <informaltable frame="all">
44305 <tgroup cols="4" colsep="0" rowsep="0">
44306 <colspec colwidth="8*" align="left"/>
44307 <colspec colwidth="6*" align="center"/>
44308 <colspec colwidth="6*" align="center"/>
44309 <colspec colwidth="6*" align="right"/>
44310 <tbody>
44311 <row>
44312 <entry><option>file_optional</option></entry>
44313 <entry>Use: <emphasis>autoreply</emphasis></entry>
44314 <entry>Type: <emphasis>boolean</emphasis></entry>
44315 <entry>Default: <emphasis>false</emphasis></entry>
44316 </row>
44317 </tbody>
44318 </tgroup>
44319 </informaltable>
44320 <para>
44321 If this option is true, no error is generated if the file named by the <option>file</option>
44322 option or passed with the address does not exist or cannot be read.
44323 </para>
44324 <para>
44325 <indexterm role="option">
44326 <primary><option>from</option></primary>
44327 </indexterm>
44328 </para>
44329 <informaltable frame="all">
44330 <tgroup cols="4" colsep="0" rowsep="0">
44331 <colspec colwidth="8*" align="left"/>
44332 <colspec colwidth="6*" align="center"/>
44333 <colspec colwidth="6*" align="center"/>
44334 <colspec colwidth="6*" align="right"/>
44335 <tbody>
44336 <row>
44337 <entry><option>from</option></entry>
44338 <entry>Use: <emphasis>autoreply</emphasis></entry>
44339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44340 <entry>Default: <emphasis>unset</emphasis></entry>
44341 </row>
44342 </tbody>
44343 </tgroup>
44344 </informaltable>
44345 <para>
44346 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
44347 specified by the transport.
44348 </para>
44349 <para>
44350 <indexterm role="option">
44351 <primary><option>headers</option></primary>
44352 </indexterm>
44353 </para>
44354 <informaltable frame="all">
44355 <tgroup cols="4" colsep="0" rowsep="0">
44356 <colspec colwidth="8*" align="left"/>
44357 <colspec colwidth="6*" align="center"/>
44358 <colspec colwidth="6*" align="center"/>
44359 <colspec colwidth="6*" align="right"/>
44360 <tbody>
44361 <row>
44362 <entry><option>headers</option></entry>
44363 <entry>Use: <emphasis>autoreply</emphasis></entry>
44364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44365 <entry>Default: <emphasis>unset</emphasis></entry>
44366 </row>
44367 </tbody>
44368 </tgroup>
44369 </informaltable>
44370 <para>
44371 This specifies additional RFC 2822 headers that are to be added to the message
44372 when the message is specified by the transport. Several can be given by using
44373 <quote>\n</quote> to separate them. There is no check on the format.
44374 </para>
44375 <para>
44376 <indexterm role="option">
44377 <primary><option>log</option></primary>
44378 </indexterm>
44379 </para>
44380 <informaltable frame="all">
44381 <tgroup cols="4" colsep="0" rowsep="0">
44382 <colspec colwidth="8*" align="left"/>
44383 <colspec colwidth="6*" align="center"/>
44384 <colspec colwidth="6*" align="center"/>
44385 <colspec colwidth="6*" align="right"/>
44386 <tbody>
44387 <row>
44388 <entry><option>log</option></entry>
44389 <entry>Use: <emphasis>autoreply</emphasis></entry>
44390 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44391 <entry>Default: <emphasis>unset</emphasis></entry>
44392 </row>
44393 </tbody>
44394 </tgroup>
44395 </informaltable>
44396 <para>
44397 This option names a file in which a record of every message sent is logged when
44398 the message is specified by the transport.
44399 </para>
44400 <para>
44401 <indexterm role="option">
44402 <primary><option>mode</option></primary>
44403 </indexterm>
44404 </para>
44405 <informaltable frame="all">
44406 <tgroup cols="4" colsep="0" rowsep="0">
44407 <colspec colwidth="8*" align="left"/>
44408 <colspec colwidth="6*" align="center"/>
44409 <colspec colwidth="6*" align="center"/>
44410 <colspec colwidth="6*" align="right"/>
44411 <tbody>
44412 <row>
44413 <entry><option>mode</option></entry>
44414 <entry>Use: <emphasis>autoreply</emphasis></entry>
44415 <entry>Type: <emphasis>octal integer</emphasis></entry>
44416 <entry>Default: <emphasis>0600</emphasis></entry>
44417 </row>
44418 </tbody>
44419 </tgroup>
44420 </informaltable>
44421 <para>
44422 If either the log file or the <quote>once</quote> file has to be created, this mode is
44423 used.
44424 </para>
44425 <para>
44426 <indexterm role="option">
44427 <primary><option>never_mail</option></primary>
44428 </indexterm>
44429 </para>
44430 <informaltable frame="all">
44431 <tgroup cols="4" colsep="0" rowsep="0">
44432 <colspec colwidth="8*" align="left"/>
44433 <colspec colwidth="6*" align="center"/>
44434 <colspec colwidth="6*" align="center"/>
44435 <colspec colwidth="6*" align="right"/>
44436 <tbody>
44437 <row>
44438 <entry><option>never_mail</option></entry>
44439 <entry>Use: <emphasis>autoreply</emphasis></entry>
44440 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
44441 <entry>Default: <emphasis>unset</emphasis></entry>
44442 </row>
44443 </tbody>
44444 </tgroup>
44445 </informaltable>
44446 <para>
44447 If any run of the transport creates a message with a recipient that matches any
44448 item in the list, that recipient is quietly discarded. If all recipients are
44449 discarded, no message is created. This applies both when the recipients are
44450 generated by a filter and when they are specified in the transport.
44451 </para>
44452 <para>
44453 <indexterm role="option">
44454 <primary><option>once</option></primary>
44455 </indexterm>
44456 </para>
44457 <informaltable frame="all">
44458 <tgroup cols="4" colsep="0" rowsep="0">
44459 <colspec colwidth="8*" align="left"/>
44460 <colspec colwidth="6*" align="center"/>
44461 <colspec colwidth="6*" align="center"/>
44462 <colspec colwidth="6*" align="right"/>
44463 <tbody>
44464 <row>
44465 <entry><option>once</option></entry>
44466 <entry>Use: <emphasis>autoreply</emphasis></entry>
44467 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44468 <entry>Default: <emphasis>unset</emphasis></entry>
44469 </row>
44470 </tbody>
44471 </tgroup>
44472 </informaltable>
44473 <para>
44474 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
44475 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
44476 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
44477 </para>
44478 <para>
44479 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
44480 By default, if <option>once</option> is set to a non-empty file name, the message
44481 is not sent if a potential recipient is already listed in the database.
44482 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
44483 message is sent if that much time has elapsed since a message was last sent to
44484 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
44485 prevents a message from being sent a second time &ndash; in this case, zero means
44486 infinity.
44487 </para>
44488 <para>
44489 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
44490 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
44491 greater than zero, it changes the way Exim implements the <option>once</option> option.
44492 Instead of using a DBM file to record every recipient it sends to, it uses a
44493 regular file, whose size will never get larger than the given value.
44494 </para>
44495 <para>
44496 In the file, Exim keeps a linear list of recipient addresses and the times at
44497 which they were sent messages. If the file is full when a new address needs to
44498 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
44499 means that a given recipient may receive multiple messages, but at
44500 unpredictable intervals that depend on the rate of turnover of addresses in the
44501 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
44502 </para>
44503 <para>
44504 <indexterm role="option">
44505 <primary><option>once_file_size</option></primary>
44506 </indexterm>
44507 </para>
44508 <informaltable frame="all">
44509 <tgroup cols="4" colsep="0" rowsep="0">
44510 <colspec colwidth="8*" align="left"/>
44511 <colspec colwidth="6*" align="center"/>
44512 <colspec colwidth="6*" align="center"/>
44513 <colspec colwidth="6*" align="right"/>
44514 <tbody>
44515 <row>
44516 <entry><option>once_file_size</option></entry>
44517 <entry>Use: <emphasis>autoreply</emphasis></entry>
44518 <entry>Type: <emphasis>integer</emphasis></entry>
44519 <entry>Default: <emphasis>0</emphasis></entry>
44520 </row>
44521 </tbody>
44522 </tgroup>
44523 </informaltable>
44524 <para>
44525 See <option>once</option> above.
44526 </para>
44527 <para>
44528 <indexterm role="option">
44529 <primary><option>once_repeat</option></primary>
44530 </indexterm>
44531 </para>
44532 <informaltable frame="all">
44533 <tgroup cols="4" colsep="0" rowsep="0">
44534 <colspec colwidth="8*" align="left"/>
44535 <colspec colwidth="6*" align="center"/>
44536 <colspec colwidth="6*" align="center"/>
44537 <colspec colwidth="6*" align="right"/>
44538 <tbody>
44539 <row>
44540 <entry><option>once_repeat</option></entry>
44541 <entry>Use: <emphasis>autoreply</emphasis></entry>
44542 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
44543 <entry>Default: <emphasis>0s</emphasis></entry>
44544 </row>
44545 </tbody>
44546 </tgroup>
44547 </informaltable>
44548 <para>
44549 See <option>once</option> above.
44550 After expansion, the value of this option must be a valid time value.
44551 </para>
44552 <para>
44553 <indexterm role="option">
44554 <primary><option>reply_to</option></primary>
44555 </indexterm>
44556 </para>
44557 <informaltable frame="all">
44558 <tgroup cols="4" colsep="0" rowsep="0">
44559 <colspec colwidth="8*" align="left"/>
44560 <colspec colwidth="6*" align="center"/>
44561 <colspec colwidth="6*" align="center"/>
44562 <colspec colwidth="6*" align="right"/>
44563 <tbody>
44564 <row>
44565 <entry><option>reply_to</option></entry>
44566 <entry>Use: <emphasis>autoreply</emphasis></entry>
44567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44568 <entry>Default: <emphasis>unset</emphasis></entry>
44569 </row>
44570 </tbody>
44571 </tgroup>
44572 </informaltable>
44573 <para>
44574 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
44575 specified by the transport.
44576 </para>
44577 <para>
44578 <indexterm role="option">
44579 <primary><option>return_message</option></primary>
44580 </indexterm>
44581 </para>
44582 <informaltable frame="all">
44583 <tgroup cols="4" colsep="0" rowsep="0">
44584 <colspec colwidth="8*" align="left"/>
44585 <colspec colwidth="6*" align="center"/>
44586 <colspec colwidth="6*" align="center"/>
44587 <colspec colwidth="6*" align="right"/>
44588 <tbody>
44589 <row>
44590 <entry><option>return_message</option></entry>
44591 <entry>Use: <emphasis>autoreply</emphasis></entry>
44592 <entry>Type: <emphasis>boolean</emphasis></entry>
44593 <entry>Default: <emphasis>false</emphasis></entry>
44594 </row>
44595 </tbody>
44596 </tgroup>
44597 </informaltable>
44598 <para>
44599 If this is set, a copy of the original message is returned with the new
44600 message, subject to the maximum size set in the <option>return_size_limit</option> global
44601 configuration option.
44602 </para>
44603 <para>
44604 <indexterm role="option">
44605 <primary><option>subject</option></primary>
44606 </indexterm>
44607 </para>
44608 <informaltable frame="all">
44609 <tgroup cols="4" colsep="0" rowsep="0">
44610 <colspec colwidth="8*" align="left"/>
44611 <colspec colwidth="6*" align="center"/>
44612 <colspec colwidth="6*" align="center"/>
44613 <colspec colwidth="6*" align="right"/>
44614 <tbody>
44615 <row>
44616 <entry><option>subject</option></entry>
44617 <entry>Use: <emphasis>autoreply</emphasis></entry>
44618 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44619 <entry>Default: <emphasis>unset</emphasis></entry>
44620 </row>
44621 </tbody>
44622 </tgroup>
44623 </informaltable>
44624 <para>
44625 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
44626 specified by the transport. It is tempting to quote the original subject in
44627 automatic responses. For example:
44628 </para>
44629 <literallayout class="monospaced">
44630 subject = Re: $h_subject:
44631 </literallayout>
44632 <para>
44633 There is a danger in doing this, however. It may allow a third party to
44634 subscribe your users to an opt-in mailing list, provided that the list accepts
44635 bounce messages as subscription confirmations. Well-managed lists require a
44636 non-bounce message to confirm a subscription, so the danger is relatively
44637 small.
44638 </para>
44639 <para>
44640 <indexterm role="option">
44641 <primary><option>text</option></primary>
44642 </indexterm>
44643 </para>
44644 <informaltable frame="all">
44645 <tgroup cols="4" colsep="0" rowsep="0">
44646 <colspec colwidth="8*" align="left"/>
44647 <colspec colwidth="6*" align="center"/>
44648 <colspec colwidth="6*" align="center"/>
44649 <colspec colwidth="6*" align="right"/>
44650 <tbody>
44651 <row>
44652 <entry><option>text</option></entry>
44653 <entry>Use: <emphasis>autoreply</emphasis></entry>
44654 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44655 <entry>Default: <emphasis>unset</emphasis></entry>
44656 </row>
44657 </tbody>
44658 </tgroup>
44659 </informaltable>
44660 <para>
44661 This specifies a single string to be used as the body of the message when the
44662 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
44663 the text comes first.
44664 </para>
44665 <para>
44666 <indexterm role="option">
44667 <primary><option>to</option></primary>
44668 </indexterm>
44669 </para>
44670 <informaltable frame="all">
44671 <tgroup cols="4" colsep="0" rowsep="0">
44672 <colspec colwidth="8*" align="left"/>
44673 <colspec colwidth="6*" align="center"/>
44674 <colspec colwidth="6*" align="center"/>
44675 <colspec colwidth="6*" align="right"/>
44676 <tbody>
44677 <row>
44678 <entry><option>to</option></entry>
44679 <entry>Use: <emphasis>autoreply</emphasis></entry>
44680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44681 <entry>Default: <emphasis>unset</emphasis></entry>
44682 </row>
44683 </tbody>
44684 </tgroup>
44685 </informaltable>
44686 <para>
44687 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
44688 when the message is specified by the transport.
44689 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
44690 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
44691 </para>
44692 </section>
44693 </chapter>
44694
44695 <chapter id="CHAPLMTP">
44696 <title>The lmtp transport</title>
44697 <para>
44698 <indexterm role="concept">
44699 <primary>transports</primary>
44700 <secondary><command>lmtp</command></secondary>
44701 </indexterm>
44702 <indexterm role="concept">
44703 <primary><command>lmtp</command> transport</primary>
44704 </indexterm>
44705 <indexterm role="concept">
44706 <primary>LMTP</primary>
44707 <secondary>over a pipe</secondary>
44708 </indexterm>
44709 <indexterm role="concept">
44710 <primary>LMTP</primary>
44711 <secondary>over a socket</secondary>
44712 </indexterm>
44713 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
44714 specified command
44715 or by interacting with a Unix domain socket.
44716 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
44717 transports. Exim also has support for using LMTP over TCP/IP; this is
44718 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
44719 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
44720 has it commented out. You need to ensure that
44721 </para>
44722 <literallayout class="monospaced">
44723 TRANSPORT_LMTP=yes
44724 </literallayout>
44725 <para>
44726 <indexterm role="concept">
44727 <primary>options</primary>
44728 <secondary><command>lmtp</command> transport</secondary>
44729 </indexterm>
44730 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
44731 included in the Exim binary. The private options of the <command>lmtp</command> transport are
44732 as follows:
44733 </para>
44734 <para>
44735 <indexterm role="option">
44736 <primary><option>batch_id</option></primary>
44737 </indexterm>
44738 </para>
44739 <informaltable frame="all">
44740 <tgroup cols="4" colsep="0" rowsep="0">
44741 <colspec colwidth="8*" align="left"/>
44742 <colspec colwidth="6*" align="center"/>
44743 <colspec colwidth="6*" align="center"/>
44744 <colspec colwidth="6*" align="right"/>
44745 <tbody>
44746 <row>
44747 <entry><option>batch_id</option></entry>
44748 <entry>Use: <emphasis>lmtp</emphasis></entry>
44749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44750 <entry>Default: <emphasis>unset</emphasis></entry>
44751 </row>
44752 </tbody>
44753 </tgroup>
44754 </informaltable>
44755 <para>
44756 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44757 </para>
44758 <para>
44759 <indexterm role="option">
44760 <primary><option>batch_max</option></primary>
44761 </indexterm>
44762 </para>
44763 <informaltable frame="all">
44764 <tgroup cols="4" colsep="0" rowsep="0">
44765 <colspec colwidth="8*" align="left"/>
44766 <colspec colwidth="6*" align="center"/>
44767 <colspec colwidth="6*" align="center"/>
44768 <colspec colwidth="6*" align="right"/>
44769 <tbody>
44770 <row>
44771 <entry><option>batch_max</option></entry>
44772 <entry>Use: <emphasis>lmtp</emphasis></entry>
44773 <entry>Type: <emphasis>integer</emphasis></entry>
44774 <entry>Default: <emphasis>1</emphasis></entry>
44775 </row>
44776 </tbody>
44777 </tgroup>
44778 </informaltable>
44779 <para>
44780 This limits the number of addresses that can be handled in a single delivery.
44781 Most LMTP servers can handle several addresses at once, so it is normally a
44782 good idea to increase this value. See the description of local delivery
44783 batching in chapter <xref linkend="CHAPbatching"/>.
44784 </para>
44785 <para>
44786 <indexterm role="option">
44787 <primary><option>command</option></primary>
44788 </indexterm>
44789 </para>
44790 <informaltable frame="all">
44791 <tgroup cols="4" colsep="0" rowsep="0">
44792 <colspec colwidth="8*" align="left"/>
44793 <colspec colwidth="6*" align="center"/>
44794 <colspec colwidth="6*" align="center"/>
44795 <colspec colwidth="6*" align="right"/>
44796 <tbody>
44797 <row>
44798 <entry><option>command</option></entry>
44799 <entry>Use: <emphasis>lmtp</emphasis></entry>
44800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44801 <entry>Default: <emphasis>unset</emphasis></entry>
44802 </row>
44803 </tbody>
44804 </tgroup>
44805 </informaltable>
44806 <para>
44807 This option must be set if <option>socket</option> is not set. The string is a command which
44808 is run in a separate process. It is split up into a command name and list of
44809 arguments, each of which is separately expanded (so expansion cannot change the
44810 number of arguments). The command is run directly, not via a shell. The message
44811 is passed to the new process using the standard input and output to operate the
44812 LMTP protocol.
44813 </para>
44814 <para>
44815 <indexterm role="option">
44816 <primary><option>ignore_quota</option></primary>
44817 </indexterm>
44818 </para>
44819 <informaltable frame="all">
44820 <tgroup cols="4" colsep="0" rowsep="0">
44821 <colspec colwidth="8*" align="left"/>
44822 <colspec colwidth="6*" align="center"/>
44823 <colspec colwidth="6*" align="center"/>
44824 <colspec colwidth="6*" align="right"/>
44825 <tbody>
44826 <row>
44827 <entry><option>ignore_quota</option></entry>
44828 <entry>Use: <emphasis>lmtp</emphasis></entry>
44829 <entry>Type: <emphasis>boolean</emphasis></entry>
44830 <entry>Default: <emphasis>false</emphasis></entry>
44831 </row>
44832 </tbody>
44833 </tgroup>
44834 </informaltable>
44835 <para>
44836 <indexterm role="concept">
44837 <primary>LMTP</primary>
44838 <secondary>ignoring quota errors</secondary>
44839 </indexterm>
44840 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
44841 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
44842 in its response to the LHLO command.
44843 </para>
44844 <para>
44845 <indexterm role="option">
44846 <primary><option>socket</option></primary>
44847 </indexterm>
44848 </para>
44849 <informaltable frame="all">
44850 <tgroup cols="4" colsep="0" rowsep="0">
44851 <colspec colwidth="8*" align="left"/>
44852 <colspec colwidth="6*" align="center"/>
44853 <colspec colwidth="6*" align="center"/>
44854 <colspec colwidth="6*" align="right"/>
44855 <tbody>
44856 <row>
44857 <entry><option>socket</option></entry>
44858 <entry>Use: <emphasis>lmtp</emphasis></entry>
44859 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44860 <entry>Default: <emphasis>unset</emphasis></entry>
44861 </row>
44862 </tbody>
44863 </tgroup>
44864 </informaltable>
44865 <para>
44866 This option must be set if <option>command</option> is not set. The result of expansion must
44867 be the name of a Unix domain socket. The transport connects to the socket and
44868 delivers the message to it using the LMTP protocol.
44869 </para>
44870 <para>
44871 <indexterm role="option">
44872 <primary><option>timeout</option></primary>
44873 </indexterm>
44874 </para>
44875 <informaltable frame="all">
44876 <tgroup cols="4" colsep="0" rowsep="0">
44877 <colspec colwidth="8*" align="left"/>
44878 <colspec colwidth="6*" align="center"/>
44879 <colspec colwidth="6*" align="center"/>
44880 <colspec colwidth="6*" align="right"/>
44881 <tbody>
44882 <row>
44883 <entry><option>timeout</option></entry>
44884 <entry>Use: <emphasis>lmtp</emphasis></entry>
44885 <entry>Type: <emphasis>time</emphasis></entry>
44886 <entry>Default: <emphasis>5m</emphasis></entry>
44887 </row>
44888 </tbody>
44889 </tgroup>
44890 </informaltable>
44891 <para>
44892 The transport is aborted if the created process or Unix domain socket does not
44893 respond to LMTP commands or message input within this timeout. Delivery
44894 is deferred, and will be tried again later. Here is an example of a typical
44895 LMTP transport:
44896 </para>
44897 <literallayout class="monospaced">
44898 lmtp:
44899   driver = lmtp
44900   command = /some/local/lmtp/delivery/program
44901   batch_max = 20
44902   user = exim
44903 </literallayout>
44904 <para>
44905 This delivers up to 20 addresses at a time, in a mixture of domains if
44906 necessary, running as the user <emphasis>exim</emphasis>.
44907 </para>
44908 </chapter>
44909
44910 <chapter id="CHAPpipetransport">
44911 <title>The pipe transport</title>
44912 <para>
44913 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
44914 <primary>transports</primary>
44915 <secondary><command>pipe</command></secondary>
44916 </indexterm>
44917 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
44918 <primary><command>pipe</command> transport</primary>
44919 </indexterm>
44920 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
44921 running in another process. One example is the use of <command>pipe</command> as a
44922 pseudo-remote transport for passing messages to some other delivery mechanism
44923 (such as UUCP). Another is the use by individual users to automatically process
44924 their incoming messages. The <command>pipe</command> transport can be used in one of the
44925 following ways:
44926 </para>
44927 <itemizedlist>
44928 <listitem>
44929 <para>
44930 <indexterm role="variable">
44931 <primary><varname>$local_part</varname></primary>
44932 </indexterm>
44933 A router routes one address to a transport in the normal way, and the
44934 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
44935 contains the local part of the address (as usual), and the command that is run
44936 is specified by the <option>command</option> option on the transport.
44937 </para>
44938 </listitem>
44939 <listitem>
44940 <para>
44941 <indexterm role="variable">
44942 <primary><varname>$pipe_addresses</varname></primary>
44943 </indexterm>
44944 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
44945 transport can handle more than one address in a single run. In this case, when
44946 more than one address is routed to the transport, <varname>$local_part</varname> is not set
44947 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
44948 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
44949 that are routed to the transport.
44950 </para>
44951 </listitem>
44952 <listitem>
44953 <para>
44954 <indexterm role="variable">
44955 <primary><varname>$address_pipe</varname></primary>
44956 </indexterm>
44957 A router redirects an address directly to a pipe command (for example, from an
44958 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
44959 pipe command, and the <option>command</option> option on the transport is ignored unless
44960 <option>force_command</option> is set. If only one address is being transported
44961 (<option>batch_max</option> is not greater than one, or only one address was redirected to
44962 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
44963 </para>
44964 </listitem>
44965 </itemizedlist>
44966 <para>
44967 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
44968 deliver messages over pipes using the LMTP interactive protocol. This is
44969 implemented by the <command>lmtp</command> transport.
44970 </para>
44971 <para>
44972 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
44973 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
44974 other cases, the uid and gid have to be specified explicitly, either on the
44975 transport or on the router that handles the address. Current and <quote>home</quote>
44976 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
44977 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
44978 for a discussion of local delivery batching.
44979 </para>
44980 <section id="SECID140">
44981 <title>Concurrent delivery</title>
44982 <para>
44983 If two messages arrive at almost the same time, and both are routed to a pipe
44984 delivery, the two pipe transports may be run concurrently. You must ensure that
44985 any pipe commands you set up are robust against this happening. If the commands
44986 write to a file, the <option>exim_lock</option> utility might be of use.
44987 Alternatively the <option>max_parallel</option> option could be used with a value
44988 of "1" to enforce serialization.
44989 </para>
44990 </section>
44991 <section id="SECID141">
44992 <title>Returned status and data</title>
44993 <para>
44994 <indexterm role="concept">
44995 <primary><command>pipe</command> transport</primary>
44996 <secondary>returned data</secondary>
44997 </indexterm>
44998 If the command exits with a non-zero return code, the delivery is deemed to
44999 have failed, unless either the <option>ignore_status</option> option is set (in which case
45000 the return code is treated as zero), or the return code is one of those listed
45001 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
45002 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
45003 logged, but are not included in the bounce message, which merely contains
45004 <quote>local delivery failed</quote>.
45005 </para>
45006 <para>
45007 If the command exits on a signal and the <option>freeze_signal</option> option is set then
45008 the message will be frozen in the queue. If that option is not set, a bounce
45009 will be sent as normal.
45010 </para>
45011 <para>
45012 If the return code is greater than 128 and the command being run is a shell
45013 script, it normally means that the script was terminated by a signal whose
45014 value is the return code minus 128. The <option>freeze_signal</option> option does not
45015 apply in this case.
45016 </para>
45017 <para>
45018 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
45019 return code is set to 127. This is the value that a shell returns if it is
45020 asked to run a non-existent command. The wording for the log line suggests that
45021 a non-existent command may be the problem.
45022 </para>
45023 <para>
45024 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
45025 set and the command produces any output on its standard output or standard
45026 error streams, the command is considered to have failed, even if it gave a zero
45027 return code or if <option>ignore_status</option> is set. The output from the command is
45028 included as part of the bounce message. The <option>return_fail_output</option> option is
45029 similar, except that output is returned only when the command exits with a
45030 failure return code, that is, a value other than zero or a code that matches
45031 <option>temp_errors</option>.
45032 </para>
45033 </section>
45034 <section id="SECThowcommandrun">
45035 <title>How the command is run</title>
45036 <para>
45037 <indexterm role="concept">
45038 <primary><command>pipe</command> transport</primary>
45039 <secondary>path for command</secondary>
45040 </indexterm>
45041 The command line is (by default) broken down into a command name and arguments
45042 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
45043 <option>restrict_to_path</option> options can be used to restrict the commands that may be
45044 run.
45045 </para>
45046 <para>
45047 <indexterm role="concept">
45048 <primary>quoting</primary>
45049 <secondary>in pipe command</secondary>
45050 </indexterm>
45051 Unquoted arguments are delimited by white space. If an argument appears in
45052 double quotes, backslash is interpreted as an escape character in the usual
45053 way. If an argument appears in single quotes, no escaping is done.
45054 </para>
45055 <para>
45056 String expansion is applied to the command line except when it comes from a
45057 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
45058 expansion is applied to each argument in turn rather than to the whole line.
45059 For this reason, any string expansion item that contains white space must be
45060 quoted so as to be contained within a single argument. A setting such as
45061 </para>
45062 <literallayout class="monospaced">
45063 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
45064 </literallayout>
45065 <para>
45066 will not work, because the expansion item gets split between several
45067 arguments. You have to write
45068 </para>
45069 <literallayout class="monospaced">
45070 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
45071 </literallayout>
45072 <para>
45073 to ensure that it is all in one argument. The expansion is done in this way,
45074 argument by argument, so that the number of arguments cannot be changed as a
45075 result of expansion, and quotes or backslashes in inserted variables do not
45076 interact with external quoting. However, this leads to problems if you want to
45077 generate multiple arguments (or the command name plus arguments) from a single
45078 expansion. In this situation, the simplest solution is to use a shell. For
45079 example:
45080 </para>
45081 <literallayout class="monospaced">
45082 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
45083 </literallayout>
45084 <para>
45085 <indexterm role="concept">
45086 <primary>transport</primary>
45087 <secondary>filter</secondary>
45088 </indexterm>
45089 <indexterm role="concept">
45090 <primary>filter</primary>
45091 <secondary>transport filter</secondary>
45092 </indexterm>
45093 <indexterm role="variable">
45094 <primary><varname>$pipe_addresses</varname></primary>
45095 </indexterm>
45096 Special handling takes place when an argument consists of precisely the text
45097 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
45098 place this string is recognized is when it appears as an argument for a pipe or
45099 transport filter command. It causes each address that is being handled to be
45100 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
45101 avoids any problems with spaces or shell metacharacters, and is of use when a
45102 <command>pipe</command> transport is handling groups of addresses in a batch.
45103 </para>
45104 <para>
45105 If <option>force_command</option> is enabled on the transport, Special handling takes place
45106 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
45107 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
45108 argument is inserted in the argument list at that point
45109 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
45110 the only item in the argument; in fact, if it were then <option>force_command</option>
45111 should behave as a no-op.  Rather, it should be used to adjust the command
45112 run while preserving the argument vector separation.
45113 </para>
45114 <para>
45115 After splitting up into arguments and expansion, the resulting command is run
45116 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
45117 message that is being delivered is supplied on the standard input, and the
45118 standard output and standard error are both connected to a single pipe that is
45119 read by Exim. The <option>max_output</option> option controls how much output the command
45120 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
45121 control what is done with it.
45122 </para>
45123 <para>
45124 Not running the command under a shell (by default) lessens the security risks
45125 in cases when a command from a user&#x2019;s filter file is built out of data that was
45126 taken from an incoming message. If a shell is required, it can of course be
45127 explicitly specified as the command to be run. However, there are circumstances
45128 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
45129 under a shell and cannot easily be modified. To allow for these cases, there is
45130 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
45131 works. Instead of breaking up the command line as just described, it expands it
45132 as a single string and passes the result to <filename>/bin/sh</filename>. The
45133 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
45134 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
45135 </para>
45136 </section>
45137 <section id="SECTpipeenv">
45138 <title>Environment variables</title>
45139 <para>
45140 <indexterm role="concept">
45141 <primary><command>pipe</command> transport</primary>
45142 <secondary>environment for command</secondary>
45143 </indexterm>
45144 <indexterm role="concept">
45145 <primary>environment</primary>
45146 <secondary><command>pipe</command> transport</secondary>
45147 </indexterm>
45148 The environment variables listed below are set up when the command is invoked.
45149 This list is a compromise for maximum compatibility with other MTAs. Note that
45150 the <option>environment</option> option can be used to add additional variables to this
45151 environment. The environment for the <command>pipe</command> transport is not subject
45152 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
45153 </para>
45154 <literallayout>
45155 <literal>DOMAIN            </literal>   the domain of the address
45156 <literal>HOME              </literal>   the home directory, if set
45157 <literal>HOST              </literal>   the host name when called from a router (see below)
45158 <literal>LOCAL_PART        </literal>   see below
45159 <literal>LOCAL_PART_PREFIX </literal>   see below
45160 <literal>LOCAL_PART_SUFFIX </literal>   see below
45161 <literal>LOGNAME           </literal>   see below
45162 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
45163 <literal>PATH              </literal>   as specified by the <option>path</option> option below
45164 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
45165 <literal>RECIPIENT         </literal>   the complete recipient address
45166 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
45167 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
45168 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
45169 <literal>USER              </literal>   see below
45170 </literallayout>
45171 <para>
45172 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
45173 router, LOCAL_PART is set to the local part of the address. When it is
45174 called as a result of a forward or alias expansion, LOCAL_PART is set to
45175 the local part of the address that was expanded. In both cases, any affixes are
45176 removed from the local part, and made available in LOCAL_PART_PREFIX and
45177 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
45178 same value as LOCAL_PART for compatibility with other MTAs.
45179 </para>
45180 <para>
45181 <indexterm role="concept">
45182 <primary>HOST</primary>
45183 </indexterm>
45184 HOST is set only when a <command>pipe</command> transport is called from a router that
45185 associates hosts with an address, typically when using <command>pipe</command> as a
45186 pseudo-remote transport. HOST is set to the first host name specified by
45187 the router.
45188 </para>
45189 <para>
45190 <indexterm role="concept">
45191 <primary>HOME</primary>
45192 </indexterm>
45193 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
45194 for the HOME environment variable. Otherwise, a home directory may be set
45195 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
45196 user&#x2019;s home directory if <option>check_local_user</option> is set.
45197 </para>
45198 </section>
45199 <section id="SECID142">
45200 <title>Private options for pipe</title>
45201 <para>
45202 <indexterm role="concept">
45203 <primary>options</primary>
45204 <secondary><command>pipe</command> transport</secondary>
45205 </indexterm>
45206 </para>
45207 <para>
45208 <indexterm role="option">
45209 <primary><option>allow_commands</option></primary>
45210 </indexterm>
45211 </para>
45212 <informaltable frame="all">
45213 <tgroup cols="4" colsep="0" rowsep="0">
45214 <colspec colwidth="8*" align="left"/>
45215 <colspec colwidth="6*" align="center"/>
45216 <colspec colwidth="6*" align="center"/>
45217 <colspec colwidth="6*" align="right"/>
45218 <tbody>
45219 <row>
45220 <entry><option>allow_commands</option></entry>
45221 <entry>Use: <emphasis>pipe</emphasis></entry>
45222 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45223 <entry>Default: <emphasis>unset</emphasis></entry>
45224 </row>
45225 </tbody>
45226 </tgroup>
45227 </informaltable>
45228 <para>
45229 <indexterm role="concept">
45230 <primary><command>pipe</command> transport</primary>
45231 <secondary>permitted commands</secondary>
45232 </indexterm>
45233 The string is expanded, and is then interpreted as a colon-separated list of
45234 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
45235 permitted are those in the <option>allow_commands</option> list. They need not be absolute
45236 paths; the <option>path</option> option is still used for relative paths. If
45237 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
45238 in the <option>allow_commands</option> list, or a name without any slashes that is found on
45239 the path. In other words, if neither <option>allow_commands</option> nor
45240 <option>restrict_to_path</option> is set, there is no restriction on the command, but
45241 otherwise only commands that are permitted by one or the other are allowed. For
45242 example, if
45243 </para>
45244 <literallayout class="monospaced">
45245 allow_commands = /usr/bin/vacation
45246 </literallayout>
45247 <para>
45248 and <option>restrict_to_path</option> is not set, the only permitted command is
45249 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
45250 <option>use_shell</option> is set.
45251 </para>
45252 <para>
45253 <indexterm role="option">
45254 <primary><option>batch_id</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>batch_id</option></entry>
45266 <entry>Use: <emphasis>pipe</emphasis></entry>
45267 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45268 <entry>Default: <emphasis>unset</emphasis></entry>
45269 </row>
45270 </tbody>
45271 </tgroup>
45272 </informaltable>
45273 <para>
45274 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45275 </para>
45276 <para>
45277 <indexterm role="option">
45278 <primary><option>batch_max</option></primary>
45279 </indexterm>
45280 </para>
45281 <informaltable frame="all">
45282 <tgroup cols="4" colsep="0" rowsep="0">
45283 <colspec colwidth="8*" align="left"/>
45284 <colspec colwidth="6*" align="center"/>
45285 <colspec colwidth="6*" align="center"/>
45286 <colspec colwidth="6*" align="right"/>
45287 <tbody>
45288 <row>
45289 <entry><option>batch_max</option></entry>
45290 <entry>Use: <emphasis>pipe</emphasis></entry>
45291 <entry>Type: <emphasis>integer</emphasis></entry>
45292 <entry>Default: <emphasis>1</emphasis></entry>
45293 </row>
45294 </tbody>
45295 </tgroup>
45296 </informaltable>
45297 <para>
45298 This limits the number of addresses that can be handled in a single delivery.
45299 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45300 </para>
45301 <para>
45302 <indexterm role="option">
45303 <primary><option>check_string</option></primary>
45304 </indexterm>
45305 </para>
45306 <informaltable frame="all">
45307 <tgroup cols="4" colsep="0" rowsep="0">
45308 <colspec colwidth="8*" align="left"/>
45309 <colspec colwidth="6*" align="center"/>
45310 <colspec colwidth="6*" align="center"/>
45311 <colspec colwidth="6*" align="right"/>
45312 <tbody>
45313 <row>
45314 <entry><option>check_string</option></entry>
45315 <entry>Use: <emphasis>pipe</emphasis></entry>
45316 <entry>Type: <emphasis>string</emphasis></entry>
45317 <entry>Default: <emphasis>unset</emphasis></entry>
45318 </row>
45319 </tbody>
45320 </tgroup>
45321 </informaltable>
45322 <para>
45323 As <command>pipe</command> writes the message, the start of each line is tested for matching
45324 <option>check_string</option>, and if it does, the initial matching characters are replaced
45325 by the contents of <option>escape_string</option>, provided both are set. The value of
45326 <option>check_string</option> is a literal string, not a regular expression, and the case of
45327 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
45328 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
45329 the SMTP escaping protocol. Any settings made in the configuration file are
45330 ignored.
45331 </para>
45332 <para>
45333 <indexterm role="option">
45334 <primary><option>command</option></primary>
45335 </indexterm>
45336 </para>
45337 <informaltable frame="all">
45338 <tgroup cols="4" colsep="0" rowsep="0">
45339 <colspec colwidth="8*" align="left"/>
45340 <colspec colwidth="6*" align="center"/>
45341 <colspec colwidth="6*" align="center"/>
45342 <colspec colwidth="6*" align="right"/>
45343 <tbody>
45344 <row>
45345 <entry><option>command</option></entry>
45346 <entry>Use: <emphasis>pipe</emphasis></entry>
45347 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45348 <entry>Default: <emphasis>unset</emphasis></entry>
45349 </row>
45350 </tbody>
45351 </tgroup>
45352 </informaltable>
45353 <para>
45354 This option need not be set when <command>pipe</command> is being used to deliver to pipes
45355 obtained directly from address redirections. In other cases, the option must be
45356 set, to provide a command to be run. It need not yield an absolute path (see
45357 the <option>path</option> option below). The command is split up into separate arguments by
45358 Exim, and each argument is separately expanded, as described in section
45359 <xref linkend="SECThowcommandrun"/> above.
45360 </para>
45361 <para>
45362 <indexterm role="option">
45363 <primary><option>environment</option></primary>
45364 </indexterm>
45365 </para>
45366 <informaltable frame="all">
45367 <tgroup cols="4" colsep="0" rowsep="0">
45368 <colspec colwidth="8*" align="left"/>
45369 <colspec colwidth="6*" align="center"/>
45370 <colspec colwidth="6*" align="center"/>
45371 <colspec colwidth="6*" align="right"/>
45372 <tbody>
45373 <row>
45374 <entry><option>environment</option></entry>
45375 <entry>Use: <emphasis>pipe</emphasis></entry>
45376 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45377 <entry>Default: <emphasis>unset</emphasis></entry>
45378 </row>
45379 </tbody>
45380 </tgroup>
45381 </informaltable>
45382 <para>
45383 <indexterm role="concept">
45384 <primary><command>pipe</command> transport</primary>
45385 <secondary>environment for command</secondary>
45386 </indexterm>
45387 <indexterm role="concept">
45388 <primary>environment</primary>
45389 <secondary><command>pipe</command> transport</secondary>
45390 </indexterm>
45391 This option is used to add additional variables to the environment in which the
45392 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
45393 a string which is expanded, and then interpreted as a colon-separated list of
45394 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
45395 </para>
45396 <para>
45397 <indexterm role="option">
45398 <primary><option>escape_string</option></primary>
45399 </indexterm>
45400 </para>
45401 <informaltable frame="all">
45402 <tgroup cols="4" colsep="0" rowsep="0">
45403 <colspec colwidth="8*" align="left"/>
45404 <colspec colwidth="6*" align="center"/>
45405 <colspec colwidth="6*" align="center"/>
45406 <colspec colwidth="6*" align="right"/>
45407 <tbody>
45408 <row>
45409 <entry><option>escape_string</option></entry>
45410 <entry>Use: <emphasis>pipe</emphasis></entry>
45411 <entry>Type: <emphasis>string</emphasis></entry>
45412 <entry>Default: <emphasis>unset</emphasis></entry>
45413 </row>
45414 </tbody>
45415 </tgroup>
45416 </informaltable>
45417 <para>
45418 See <option>check_string</option> above.
45419 </para>
45420 <para>
45421 <indexterm role="option">
45422 <primary><option>freeze_exec_fail</option></primary>
45423 </indexterm>
45424 </para>
45425 <informaltable frame="all">
45426 <tgroup cols="4" colsep="0" rowsep="0">
45427 <colspec colwidth="8*" align="left"/>
45428 <colspec colwidth="6*" align="center"/>
45429 <colspec colwidth="6*" align="center"/>
45430 <colspec colwidth="6*" align="right"/>
45431 <tbody>
45432 <row>
45433 <entry><option>freeze_exec_fail</option></entry>
45434 <entry>Use: <emphasis>pipe</emphasis></entry>
45435 <entry>Type: <emphasis>boolean</emphasis></entry>
45436 <entry>Default: <emphasis>false</emphasis></entry>
45437 </row>
45438 </tbody>
45439 </tgroup>
45440 </informaltable>
45441 <para>
45442 <indexterm role="concept">
45443 <primary>exec failure</primary>
45444 </indexterm>
45445 <indexterm role="concept">
45446 <primary>failure of exec</primary>
45447 </indexterm>
45448 <indexterm role="concept">
45449 <primary><command>pipe</command> transport</primary>
45450 <secondary>failure of exec</secondary>
45451 </indexterm>
45452 Failure to exec the command in a pipe transport is by default treated like
45453 any other failure while running the command. However, if <option>freeze_exec_fail</option>
45454 is set, failure to exec is treated specially, and causes the message to be
45455 frozen, whatever the setting of <option>ignore_status</option>.
45456 </para>
45457 <para>
45458 <indexterm role="option">
45459 <primary><option>freeze_signal</option></primary>
45460 </indexterm>
45461 </para>
45462 <informaltable frame="all">
45463 <tgroup cols="4" colsep="0" rowsep="0">
45464 <colspec colwidth="8*" align="left"/>
45465 <colspec colwidth="6*" align="center"/>
45466 <colspec colwidth="6*" align="center"/>
45467 <colspec colwidth="6*" align="right"/>
45468 <tbody>
45469 <row>
45470 <entry><option>freeze_signal</option></entry>
45471 <entry>Use: <emphasis>pipe</emphasis></entry>
45472 <entry>Type: <emphasis>boolean</emphasis></entry>
45473 <entry>Default: <emphasis>false</emphasis></entry>
45474 </row>
45475 </tbody>
45476 </tgroup>
45477 </informaltable>
45478 <para>
45479 <indexterm role="concept">
45480 <primary>signal exit</primary>
45481 </indexterm>
45482 <indexterm role="concept">
45483 <primary><command>pipe</command> transport</primary>
45484 <secondary>,</secondary>
45485 </indexterm>
45486 Normally if the process run by a command in a pipe transport exits on a signal,
45487 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
45488 frozen in Exim&#x2019;s queue instead.
45489 </para>
45490 <para>
45491 <indexterm role="option">
45492 <primary><option>force_command</option></primary>
45493 </indexterm>
45494 </para>
45495 <informaltable frame="all">
45496 <tgroup cols="4" colsep="0" rowsep="0">
45497 <colspec colwidth="8*" align="left"/>
45498 <colspec colwidth="6*" align="center"/>
45499 <colspec colwidth="6*" align="center"/>
45500 <colspec colwidth="6*" align="right"/>
45501 <tbody>
45502 <row>
45503 <entry><option>force_command</option></entry>
45504 <entry>Use: <emphasis>pipe</emphasis></entry>
45505 <entry>Type: <emphasis>boolean</emphasis></entry>
45506 <entry>Default: <emphasis>false</emphasis></entry>
45507 </row>
45508 </tbody>
45509 </tgroup>
45510 </informaltable>
45511 <para>
45512 <indexterm role="concept">
45513 <primary>force command</primary>
45514 </indexterm>
45515 <indexterm role="concept">
45516 <primary><command>pipe</command> transport</primary>
45517 <secondary>,</secondary>
45518 </indexterm>
45519 Normally when a router redirects an address directly to a pipe command
45520 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
45521 is set, the <option>command</option> option will used. This is especially
45522 useful for forcing a wrapper or additional argument to be added to the
45523 command. For example:
45524 </para>
45525 <literallayout class="monospaced">
45526 command = /usr/bin/remote_exec myhost -- $address_pipe
45527 force_command
45528 </literallayout>
45529 <para>
45530 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
45531 <option>force_command</option> is set, expanding out to the original argument vector as
45532 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
45533 </para>
45534 <para>
45535 <indexterm role="option">
45536 <primary><option>ignore_status</option></primary>
45537 </indexterm>
45538 </para>
45539 <informaltable frame="all">
45540 <tgroup cols="4" colsep="0" rowsep="0">
45541 <colspec colwidth="8*" align="left"/>
45542 <colspec colwidth="6*" align="center"/>
45543 <colspec colwidth="6*" align="center"/>
45544 <colspec colwidth="6*" align="right"/>
45545 <tbody>
45546 <row>
45547 <entry><option>ignore_status</option></entry>
45548 <entry>Use: <emphasis>pipe</emphasis></entry>
45549 <entry>Type: <emphasis>boolean</emphasis></entry>
45550 <entry>Default: <emphasis>false</emphasis></entry>
45551 </row>
45552 </tbody>
45553 </tgroup>
45554 </informaltable>
45555 <para>
45556 If this option is true, the status returned by the subprocess that is set up to
45557 run the command is ignored, and Exim behaves as if zero had been returned.
45558 Otherwise, a non-zero status or termination by signal causes an error return
45559 from the transport unless the status value is one of those listed in
45560 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
45561 </para>
45562 <para>
45563 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
45564 See the <option>timeout_defer</option> option for how timeouts are handled.
45565 </para>
45566 <para>
45567 <indexterm role="option">
45568 <primary><option>log_defer_output</option></primary>
45569 </indexterm>
45570 </para>
45571 <informaltable frame="all">
45572 <tgroup cols="4" colsep="0" rowsep="0">
45573 <colspec colwidth="8*" align="left"/>
45574 <colspec colwidth="6*" align="center"/>
45575 <colspec colwidth="6*" align="center"/>
45576 <colspec colwidth="6*" align="right"/>
45577 <tbody>
45578 <row>
45579 <entry><option>log_defer_output</option></entry>
45580 <entry>Use: <emphasis>pipe</emphasis></entry>
45581 <entry>Type: <emphasis>boolean</emphasis></entry>
45582 <entry>Default: <emphasis>false</emphasis></entry>
45583 </row>
45584 </tbody>
45585 </tgroup>
45586 </informaltable>
45587 <para>
45588 <indexterm role="concept">
45589 <primary><command>pipe</command> transport</primary>
45590 <secondary>logging output</secondary>
45591 </indexterm>
45592 If this option is set, and the status returned by the command is
45593 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
45594 and any output was produced on stdout or stderr, the first line of it is
45595 written to the main log.
45596 </para>
45597 <para>
45598 <indexterm role="option">
45599 <primary><option>log_fail_output</option></primary>
45600 </indexterm>
45601 </para>
45602 <informaltable frame="all">
45603 <tgroup cols="4" colsep="0" rowsep="0">
45604 <colspec colwidth="8*" align="left"/>
45605 <colspec colwidth="6*" align="center"/>
45606 <colspec colwidth="6*" align="center"/>
45607 <colspec colwidth="6*" align="right"/>
45608 <tbody>
45609 <row>
45610 <entry><option>log_fail_output</option></entry>
45611 <entry>Use: <emphasis>pipe</emphasis></entry>
45612 <entry>Type: <emphasis>boolean</emphasis></entry>
45613 <entry>Default: <emphasis>false</emphasis></entry>
45614 </row>
45615 </tbody>
45616 </tgroup>
45617 </informaltable>
45618 <para>
45619 If this option is set, and the command returns any output on stdout or
45620 stderr, and also ends with a return code that is neither zero nor one of
45621 the return codes listed in <option>temp_errors</option> (that is, the delivery
45622 failed), the first line of output is written to the main log. This
45623 option and <option>log_output</option> are mutually exclusive.  Only one of them may
45624 be set.
45625 </para>
45626 <para>
45627 <indexterm role="option">
45628 <primary><option>log_output</option></primary>
45629 </indexterm>
45630 </para>
45631 <informaltable frame="all">
45632 <tgroup cols="4" colsep="0" rowsep="0">
45633 <colspec colwidth="8*" align="left"/>
45634 <colspec colwidth="6*" align="center"/>
45635 <colspec colwidth="6*" align="center"/>
45636 <colspec colwidth="6*" align="right"/>
45637 <tbody>
45638 <row>
45639 <entry><option>log_output</option></entry>
45640 <entry>Use: <emphasis>pipe</emphasis></entry>
45641 <entry>Type: <emphasis>boolean</emphasis></entry>
45642 <entry>Default: <emphasis>false</emphasis></entry>
45643 </row>
45644 </tbody>
45645 </tgroup>
45646 </informaltable>
45647 <para>
45648 If this option is set and the command returns any output on stdout or
45649 stderr, the first line of output is written to the main log, whatever
45650 the return code. This option and <option>log_fail_output</option> are mutually
45651 exclusive. Only one of them may be set.
45652 </para>
45653 <para>
45654 <indexterm role="option">
45655 <primary><option>max_output</option></primary>
45656 </indexterm>
45657 </para>
45658 <informaltable frame="all">
45659 <tgroup cols="4" colsep="0" rowsep="0">
45660 <colspec colwidth="8*" align="left"/>
45661 <colspec colwidth="6*" align="center"/>
45662 <colspec colwidth="6*" align="center"/>
45663 <colspec colwidth="6*" align="right"/>
45664 <tbody>
45665 <row>
45666 <entry><option>max_output</option></entry>
45667 <entry>Use: <emphasis>pipe</emphasis></entry>
45668 <entry>Type: <emphasis>integer</emphasis></entry>
45669 <entry>Default: <emphasis>20K</emphasis></entry>
45670 </row>
45671 </tbody>
45672 </tgroup>
45673 </informaltable>
45674 <para>
45675 This specifies the maximum amount of output that the command may produce on its
45676 standard output and standard error file combined. If the limit is exceeded, the
45677 process running the command is killed. This is intended as a safety measure to
45678 catch runaway processes. The limit is applied independently of the settings of
45679 the options that control what is done with such output (for example,
45680 <option>return_output</option>). Because of buffering effects, the amount of output may
45681 exceed the limit by a small amount before Exim notices.
45682 </para>
45683 <para>
45684 <indexterm role="option">
45685 <primary><option>message_prefix</option></primary>
45686 </indexterm>
45687 </para>
45688 <informaltable frame="all">
45689 <tgroup cols="4" colsep="0" rowsep="0">
45690 <colspec colwidth="8*" align="left"/>
45691 <colspec colwidth="6*" align="center"/>
45692 <colspec colwidth="6*" align="center"/>
45693 <colspec colwidth="6*" align="right"/>
45694 <tbody>
45695 <row>
45696 <entry><option>message_prefix</option></entry>
45697 <entry>Use: <emphasis>pipe</emphasis></entry>
45698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45699 <entry>Default: <emphasis>see below</emphasis></entry>
45700 </row>
45701 </tbody>
45702 </tgroup>
45703 </informaltable>
45704 <para>
45705 The string specified here is expanded and output at the start of every message.
45706 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
45707 </para>
45708 <literallayout class="monospaced">
45709 message_prefix = \
45710   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
45711   ${tod_bsdinbox}\n
45712 </literallayout>
45713 <para>
45714 <indexterm role="concept">
45715 <primary>Cyrus</primary>
45716 </indexterm>
45717 <indexterm role="concept">
45718 <primary><option>tmail</option></primary>
45719 </indexterm>
45720 <indexterm role="concept">
45721 <primary><quote>From</quote> line</primary>
45722 </indexterm>
45723 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
45724 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
45725 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
45726 setting
45727 </para>
45728 <literallayout class="monospaced">
45729 message_prefix =
45730 </literallayout>
45731 <para>
45732 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45733 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
45734 </para>
45735 <para>
45736 <indexterm role="option">
45737 <primary><option>message_suffix</option></primary>
45738 </indexterm>
45739 </para>
45740 <informaltable frame="all">
45741 <tgroup cols="4" colsep="0" rowsep="0">
45742 <colspec colwidth="8*" align="left"/>
45743 <colspec colwidth="6*" align="center"/>
45744 <colspec colwidth="6*" align="center"/>
45745 <colspec colwidth="6*" align="right"/>
45746 <tbody>
45747 <row>
45748 <entry><option>message_suffix</option></entry>
45749 <entry>Use: <emphasis>pipe</emphasis></entry>
45750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45751 <entry>Default: <emphasis>see below</emphasis></entry>
45752 </row>
45753 </tbody>
45754 </tgroup>
45755 </informaltable>
45756 <para>
45757 The string specified here is expanded and output at the end of every message.
45758 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
45759 The suffix can be suppressed by setting
45760 </para>
45761 <literallayout class="monospaced">
45762 message_suffix =
45763 </literallayout>
45764 <para>
45765 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45766 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
45767 </para>
45768 <para>
45769 <indexterm role="option">
45770 <primary><option>path</option></primary>
45771 </indexterm>
45772 </para>
45773 <informaltable frame="all">
45774 <tgroup cols="4" colsep="0" rowsep="0">
45775 <colspec colwidth="8*" align="left"/>
45776 <colspec colwidth="6*" align="center"/>
45777 <colspec colwidth="6*" align="center"/>
45778 <colspec colwidth="6*" align="right"/>
45779 <tbody>
45780 <row>
45781 <entry><option>path</option></entry>
45782 <entry>Use: <emphasis>pipe</emphasis></entry>
45783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45784 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
45785 </row>
45786 </tbody>
45787 </tgroup>
45788 </informaltable>
45789 <para>
45790 This option is expanded and
45791 specifies the string that is set up in the PATH environment
45792 variable of the subprocess.
45793 If the <option>command</option> option does not yield an absolute path name, the command is
45794 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
45795 apply to a command specified as a transport filter.
45796 </para>
45797 <para>
45798 <indexterm role="option">
45799 <primary><option>permit_coredump</option></primary>
45800 </indexterm>
45801 </para>
45802 <informaltable frame="all">
45803 <tgroup cols="4" colsep="0" rowsep="0">
45804 <colspec colwidth="8*" align="left"/>
45805 <colspec colwidth="6*" align="center"/>
45806 <colspec colwidth="6*" align="center"/>
45807 <colspec colwidth="6*" align="right"/>
45808 <tbody>
45809 <row>
45810 <entry><option>permit_coredump</option></entry>
45811 <entry>Use: <emphasis>pipe</emphasis></entry>
45812 <entry>Type: <emphasis>boolean</emphasis></entry>
45813 <entry>Default: <emphasis>false</emphasis></entry>
45814 </row>
45815 </tbody>
45816 </tgroup>
45817 </informaltable>
45818 <para>
45819 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
45820 a core-dump of a pipe command, enable this command.  This enables core-dumps
45821 during delivery and affects both the Exim binary and the pipe command run.
45822 It is recommended that this option remain off unless and until you have a need
45823 for it and that this only be enabled when needed, as the risk of excessive
45824 resource consumption can be quite high.  Note also that Exim is typically
45825 installed as a setuid binary and most operating systems will inhibit coredumps
45826 of these by default, so further OS-specific action may be required.
45827 </para>
45828 <para>
45829 <indexterm role="option">
45830 <primary><option>pipe_as_creator</option></primary>
45831 </indexterm>
45832 </para>
45833 <informaltable frame="all">
45834 <tgroup cols="4" colsep="0" rowsep="0">
45835 <colspec colwidth="8*" align="left"/>
45836 <colspec colwidth="6*" align="center"/>
45837 <colspec colwidth="6*" align="center"/>
45838 <colspec colwidth="6*" align="right"/>
45839 <tbody>
45840 <row>
45841 <entry><option>pipe_as_creator</option></entry>
45842 <entry>Use: <emphasis>pipe</emphasis></entry>
45843 <entry>Type: <emphasis>boolean</emphasis></entry>
45844 <entry>Default: <emphasis>false</emphasis></entry>
45845 </row>
45846 </tbody>
45847 </tgroup>
45848 </informaltable>
45849 <para>
45850 <indexterm role="concept">
45851 <primary>uid (user id)</primary>
45852 <secondary>local delivery</secondary>
45853 </indexterm>
45854 If the generic <option>user</option> option is not set and this option is true, the delivery
45855 process is run under the uid that was in force when Exim was originally called
45856 to accept the message. If the group id is not otherwise set (via the generic
45857 <option>group</option> option), the gid that was in force when Exim was originally called to
45858 accept the message is used.
45859 </para>
45860 <para>
45861 <indexterm role="option">
45862 <primary><option>restrict_to_path</option></primary>
45863 </indexterm>
45864 </para>
45865 <informaltable frame="all">
45866 <tgroup cols="4" colsep="0" rowsep="0">
45867 <colspec colwidth="8*" align="left"/>
45868 <colspec colwidth="6*" align="center"/>
45869 <colspec colwidth="6*" align="center"/>
45870 <colspec colwidth="6*" align="right"/>
45871 <tbody>
45872 <row>
45873 <entry><option>restrict_to_path</option></entry>
45874 <entry>Use: <emphasis>pipe</emphasis></entry>
45875 <entry>Type: <emphasis>boolean</emphasis></entry>
45876 <entry>Default: <emphasis>false</emphasis></entry>
45877 </row>
45878 </tbody>
45879 </tgroup>
45880 </informaltable>
45881 <para>
45882 When this option is set, any command name not listed in <option>allow_commands</option> must
45883 contain no slashes. The command is searched for only in the directories listed
45884 in the <option>path</option> option. This option is intended for use in the case when a pipe
45885 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
45886 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
45887 </para>
45888 <para>
45889 <indexterm role="option">
45890 <primary><option>return_fail_output</option></primary>
45891 </indexterm>
45892 </para>
45893 <informaltable frame="all">
45894 <tgroup cols="4" colsep="0" rowsep="0">
45895 <colspec colwidth="8*" align="left"/>
45896 <colspec colwidth="6*" align="center"/>
45897 <colspec colwidth="6*" align="center"/>
45898 <colspec colwidth="6*" align="right"/>
45899 <tbody>
45900 <row>
45901 <entry><option>return_fail_output</option></entry>
45902 <entry>Use: <emphasis>pipe</emphasis></entry>
45903 <entry>Type: <emphasis>boolean</emphasis></entry>
45904 <entry>Default: <emphasis>false</emphasis></entry>
45905 </row>
45906 </tbody>
45907 </tgroup>
45908 </informaltable>
45909 <para>
45910 If this option is true, and the command produced any output and ended with a
45911 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
45912 is, the delivery failed), the output is returned in the bounce message.
45913 However, if the message has a null sender (that is, it is itself a bounce
45914 message), output from the command is discarded. This option and
45915 <option>return_output</option> are mutually exclusive. Only one of them may be set.
45916 </para>
45917 <para>
45918 <indexterm role="option">
45919 <primary><option>return_output</option></primary>
45920 </indexterm>
45921 </para>
45922 <informaltable frame="all">
45923 <tgroup cols="4" colsep="0" rowsep="0">
45924 <colspec colwidth="8*" align="left"/>
45925 <colspec colwidth="6*" align="center"/>
45926 <colspec colwidth="6*" align="center"/>
45927 <colspec colwidth="6*" align="right"/>
45928 <tbody>
45929 <row>
45930 <entry><option>return_output</option></entry>
45931 <entry>Use: <emphasis>pipe</emphasis></entry>
45932 <entry>Type: <emphasis>boolean</emphasis></entry>
45933 <entry>Default: <emphasis>false</emphasis></entry>
45934 </row>
45935 </tbody>
45936 </tgroup>
45937 </informaltable>
45938 <para>
45939 If this option is true, and the command produced any output, the delivery is
45940 deemed to have failed whatever the return code from the command, and the output
45941 is returned in the bounce message. Otherwise, the output is just discarded.
45942 However, if the message has a null sender (that is, it is a bounce message),
45943 output from the command is always discarded, whatever the setting of this
45944 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
45945 of them may be set.
45946 </para>
45947 <para>
45948 <indexterm role="option">
45949 <primary><option>temp_errors</option></primary>
45950 </indexterm>
45951 </para>
45952 <informaltable frame="all">
45953 <tgroup cols="4" colsep="0" rowsep="0">
45954 <colspec colwidth="8*" align="left"/>
45955 <colspec colwidth="6*" align="center"/>
45956 <colspec colwidth="6*" align="center"/>
45957 <colspec colwidth="6*" align="right"/>
45958 <tbody>
45959 <row>
45960 <entry><option>temp_errors</option></entry>
45961 <entry>Use: <emphasis>pipe</emphasis></entry>
45962 <entry>Type: <emphasis>string list</emphasis></entry>
45963 <entry>Default: <emphasis>see below</emphasis></entry>
45964 </row>
45965 </tbody>
45966 </tgroup>
45967 </informaltable>
45968 <para>
45969 <indexterm role="concept">
45970 <primary><command>pipe</command> transport</primary>
45971 <secondary>temporary failure</secondary>
45972 </indexterm>
45973 This option contains either a colon-separated list of numbers, or a single
45974 asterisk. If <option>ignore_status</option> is false
45975 and <option>return_output</option> is not set,
45976 and the command exits with a non-zero return code, the failure is treated as
45977 temporary and the delivery is deferred if the return code matches one of the
45978 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
45979 codes are treated as permanent errors. The default setting contains the codes
45980 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
45981 compiled on a system that does not define these macros, it assumes values of 75
45982 and 73, respectively.
45983 </para>
45984 <para>
45985 <indexterm role="option">
45986 <primary><option>timeout</option></primary>
45987 </indexterm>
45988 </para>
45989 <informaltable frame="all">
45990 <tgroup cols="4" colsep="0" rowsep="0">
45991 <colspec colwidth="8*" align="left"/>
45992 <colspec colwidth="6*" align="center"/>
45993 <colspec colwidth="6*" align="center"/>
45994 <colspec colwidth="6*" align="right"/>
45995 <tbody>
45996 <row>
45997 <entry><option>timeout</option></entry>
45998 <entry>Use: <emphasis>pipe</emphasis></entry>
45999 <entry>Type: <emphasis>time</emphasis></entry>
46000 <entry>Default: <emphasis>1h</emphasis></entry>
46001 </row>
46002 </tbody>
46003 </tgroup>
46004 </informaltable>
46005 <para>
46006 If the command fails to complete within this time, it is killed. This normally
46007 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
46008 specifies no timeout. In order to ensure that any subprocesses created by the
46009 command are also killed, Exim makes the initial process a process group leader,
46010 and kills the whole process group on a timeout. However, this can be defeated
46011 if one of the processes starts a new process group.
46012 </para>
46013 <para>
46014 <indexterm role="option">
46015 <primary><option>timeout_defer</option></primary>
46016 </indexterm>
46017 </para>
46018 <informaltable frame="all">
46019 <tgroup cols="4" colsep="0" rowsep="0">
46020 <colspec colwidth="8*" align="left"/>
46021 <colspec colwidth="6*" align="center"/>
46022 <colspec colwidth="6*" align="center"/>
46023 <colspec colwidth="6*" align="right"/>
46024 <tbody>
46025 <row>
46026 <entry><option>timeout_defer</option></entry>
46027 <entry>Use: <emphasis>pipe</emphasis></entry>
46028 <entry>Type: <emphasis>boolean</emphasis></entry>
46029 <entry>Default: <emphasis>false</emphasis></entry>
46030 </row>
46031 </tbody>
46032 </tgroup>
46033 </informaltable>
46034 <para>
46035 A timeout in a <command>pipe</command> transport, either in the command that the transport
46036 runs, or in a transport filter that is associated with it, is by default
46037 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
46038 is set true, both kinds of timeout become temporary errors, causing the
46039 delivery to be deferred.
46040 </para>
46041 <para>
46042 <indexterm role="option">
46043 <primary><option>umask</option></primary>
46044 </indexterm>
46045 </para>
46046 <informaltable frame="all">
46047 <tgroup cols="4" colsep="0" rowsep="0">
46048 <colspec colwidth="8*" align="left"/>
46049 <colspec colwidth="6*" align="center"/>
46050 <colspec colwidth="6*" align="center"/>
46051 <colspec colwidth="6*" align="right"/>
46052 <tbody>
46053 <row>
46054 <entry><option>umask</option></entry>
46055 <entry>Use: <emphasis>pipe</emphasis></entry>
46056 <entry>Type: <emphasis>octal integer</emphasis></entry>
46057 <entry>Default: <emphasis>022</emphasis></entry>
46058 </row>
46059 </tbody>
46060 </tgroup>
46061 </informaltable>
46062 <para>
46063 This specifies the umask setting for the subprocess that runs the command.
46064 </para>
46065 <para>
46066 <indexterm role="option">
46067 <primary><option>use_bsmtp</option></primary>
46068 </indexterm>
46069 </para>
46070 <informaltable frame="all">
46071 <tgroup cols="4" colsep="0" rowsep="0">
46072 <colspec colwidth="8*" align="left"/>
46073 <colspec colwidth="6*" align="center"/>
46074 <colspec colwidth="6*" align="center"/>
46075 <colspec colwidth="6*" align="right"/>
46076 <tbody>
46077 <row>
46078 <entry><option>use_bsmtp</option></entry>
46079 <entry>Use: <emphasis>pipe</emphasis></entry>
46080 <entry>Type: <emphasis>boolean</emphasis></entry>
46081 <entry>Default: <emphasis>false</emphasis></entry>
46082 </row>
46083 </tbody>
46084 </tgroup>
46085 </informaltable>
46086 <para>
46087 <indexterm role="concept">
46088 <primary>envelope sender</primary>
46089 </indexterm>
46090 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
46091 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
46092 commands. If you want to include a leading HELO command with such messages,
46093 you can do so by setting the <option>message_prefix</option> option. See section
46094 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
46095 </para>
46096 <para>
46097 <indexterm role="option">
46098 <primary><option>use_classresources</option></primary>
46099 </indexterm>
46100 </para>
46101 <informaltable frame="all">
46102 <tgroup cols="4" colsep="0" rowsep="0">
46103 <colspec colwidth="8*" align="left"/>
46104 <colspec colwidth="6*" align="center"/>
46105 <colspec colwidth="6*" align="center"/>
46106 <colspec colwidth="6*" align="right"/>
46107 <tbody>
46108 <row>
46109 <entry><option>use_classresources</option></entry>
46110 <entry>Use: <emphasis>pipe</emphasis></entry>
46111 <entry>Type: <emphasis>boolean</emphasis></entry>
46112 <entry>Default: <emphasis>false</emphasis></entry>
46113 </row>
46114 </tbody>
46115 </tgroup>
46116 </informaltable>
46117 <para>
46118 <indexterm role="concept">
46119 <primary>class resources (BSD)</primary>
46120 </indexterm>
46121 This option is available only when Exim is running on FreeBSD, NetBSD, or
46122 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
46123 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
46124 limits for the uid under which the pipe is to run are obtained from the login
46125 class database.
46126 </para>
46127 <para>
46128 <indexterm role="option">
46129 <primary><option>use_crlf</option></primary>
46130 </indexterm>
46131 </para>
46132 <informaltable frame="all">
46133 <tgroup cols="4" colsep="0" rowsep="0">
46134 <colspec colwidth="8*" align="left"/>
46135 <colspec colwidth="6*" align="center"/>
46136 <colspec colwidth="6*" align="center"/>
46137 <colspec colwidth="6*" align="right"/>
46138 <tbody>
46139 <row>
46140 <entry><option>use_crlf</option></entry>
46141 <entry>Use: <emphasis>pipe</emphasis></entry>
46142 <entry>Type: <emphasis>boolean</emphasis></entry>
46143 <entry>Default: <emphasis>false</emphasis></entry>
46144 </row>
46145 </tbody>
46146 </tgroup>
46147 </informaltable>
46148 <para>
46149 <indexterm role="concept">
46150 <primary>carriage return</primary>
46151 </indexterm>
46152 <indexterm role="concept">
46153 <primary>linefeed</primary>
46154 </indexterm>
46155 This option causes lines to be terminated with the two-character CRLF sequence
46156 (carriage return, linefeed) instead of just a linefeed character. In the case
46157 of batched SMTP, the byte sequence written to the pipe is then an exact image
46158 of what would be sent down a real SMTP connection.
46159 </para>
46160 <para>
46161 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
46162 written verbatim, so must contain their own carriage return characters if these
46163 are needed. When <option>use_bsmtp</option> is not set, the default values for both
46164 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
46165 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
46166 </para>
46167 <para>
46168 <indexterm role="option">
46169 <primary><option>use_shell</option></primary>
46170 </indexterm>
46171 </para>
46172 <informaltable frame="all">
46173 <tgroup cols="4" colsep="0" rowsep="0">
46174 <colspec colwidth="8*" align="left"/>
46175 <colspec colwidth="6*" align="center"/>
46176 <colspec colwidth="6*" align="center"/>
46177 <colspec colwidth="6*" align="right"/>
46178 <tbody>
46179 <row>
46180 <entry><option>use_shell</option></entry>
46181 <entry>Use: <emphasis>pipe</emphasis></entry>
46182 <entry>Type: <emphasis>boolean</emphasis></entry>
46183 <entry>Default: <emphasis>false</emphasis></entry>
46184 </row>
46185 </tbody>
46186 </tgroup>
46187 </informaltable>
46188 <para>
46189 <indexterm role="variable">
46190 <primary><varname>$pipe_addresses</varname></primary>
46191 </indexterm>
46192 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
46193 instead of being run directly from the transport, as described in section
46194 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
46195 where the command is expected to be run under a shell and cannot easily be
46196 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
46197 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
46198 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
46199 its <option>-c</option> option.
46200 </para>
46201 </section>
46202 <section id="SECID143">
46203 <title>Using an external local delivery agent</title>
46204 <para>
46205 <indexterm role="concept">
46206 <primary>local delivery</primary>
46207 <secondary>using an external agent</secondary>
46208 </indexterm>
46209 <indexterm role="concept">
46210 <primary><emphasis>procmail</emphasis></primary>
46211 </indexterm>
46212 <indexterm role="concept">
46213 <primary>external local delivery</primary>
46214 </indexterm>
46215 <indexterm role="concept">
46216 <primary>delivery</primary>
46217 <secondary><emphasis>procmail</emphasis></secondary>
46218 </indexterm>
46219 <indexterm role="concept">
46220 <primary>delivery</primary>
46221 <secondary>by external agent</secondary>
46222 </indexterm>
46223 The <command>pipe</command> transport can be used to pass all messages that require local
46224 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
46225 this, care must be taken to ensure that the pipe is run under an appropriate
46226 uid and gid. In some configurations one wants this to be a uid that is trusted
46227 by the delivery agent to supply the correct sender of the message. It may be
46228 necessary to recompile or reconfigure the delivery agent so that it trusts an
46229 appropriate user. The following is an example transport and router
46230 configuration for <option>procmail</option>:
46231 </para>
46232 <literallayout class="monospaced">
46233 # transport
46234 procmail_pipe:
46235   driver = pipe
46236   command = /usr/local/bin/procmail -d $local_part
46237   return_path_add
46238   delivery_date_add
46239   envelope_to_add
46240   check_string = "From "
46241   escape_string = "&gt;From "
46242   umask = 077
46243   user = $local_part
46244   group = mail
46245
46246 # router
46247 procmail:
46248   driver = accept
46249   check_local_user
46250   transport = procmail_pipe
46251 </literallayout>
46252 <para>
46253 In this example, the pipe is run as the local user, but with the group set to
46254 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
46255 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
46256 user to supply a correct sender address. If you do not specify either a
46257 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
46258 home directory is the user&#x2019;s home directory by default.
46259 </para>
46260 <para>
46261 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
46262 </para>
46263 <literallayout class="monospaced">
46264 IFS=" "
46265 </literallayout>
46266 <para>
46267 as shown in some <option>procmail</option> documentation, because Exim does not by default
46268 use a shell to run pipe commands.
46269 </para>
46270 <para>
46271 <indexterm role="concept">
46272 <primary>Cyrus</primary>
46273 </indexterm>
46274 The next example shows a transport and a router for a system where local
46275 deliveries are handled by the Cyrus IMAP server.
46276 </para>
46277 <literallayout class="monospaced">
46278 # transport
46279 local_delivery_cyrus:
46280   driver = pipe
46281   command = /usr/cyrus/bin/deliver \
46282             -m ${substr_1:$local_part_suffix} -- $local_part
46283   user = cyrus
46284   group = mail
46285   return_output
46286   log_output
46287   message_prefix =
46288   message_suffix =
46289
46290 # router
46291 local_user_cyrus:
46292   driver = accept
46293   check_local_user
46294   local_part_suffix = .*
46295   transport = local_delivery_cyrus
46296 </literallayout>
46297 <para>
46298 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
46299 <option>return_output</option> to cause any text written by Cyrus to be returned to the
46300 sender.
46301 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
46302 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
46303 </para>
46304 </section>
46305 </chapter>
46306
46307 <chapter id="CHAPsmtptrans">
46308 <title>The smtp transport</title>
46309 <para>
46310 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
46311 <primary>transports</primary>
46312 <secondary><command>smtp</command></secondary>
46313 </indexterm>
46314 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
46315 <primary><command>smtp</command> transport</primary>
46316 </indexterm>
46317 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
46318 or LMTP protocol. The list of hosts to try can either be taken from the address
46319 that is being processed (having been set up by the router), or specified
46320 explicitly for the transport. Timeout and retry processing (see chapter
46321 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
46322 </para>
46323 <section id="SECID144">
46324 <title>Multiple messages on a single connection</title>
46325 <para>
46326 The sending of multiple messages over a single TCP/IP connection can arise in
46327 two ways:
46328 </para>
46329 <itemizedlist>
46330 <listitem>
46331 <para>
46332 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
46333 routed to the same host, more than one copy of the message has to be sent to
46334 that host. In this situation, multiple copies may be sent in a single run of
46335 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
46336 does when it has too many addresses to send in one message also depends on the
46337 value of the global <option>remote_max_parallel</option> option. Details are given in
46338 section <xref linkend="SECToutSMTPTCP"/>.)
46339 </para>
46340 </listitem>
46341 <listitem>
46342 <para>
46343 <indexterm role="concept">
46344 <primary>hints database</primary>
46345 <secondary>remembering routing</secondary>
46346 </indexterm>
46347 When a message has been successfully delivered over a TCP/IP connection, Exim
46348 looks in its hints database to see if there are any other messages awaiting a
46349 connection to the same host. If there are, a new delivery process is started
46350 for one of them, and the current TCP/IP connection is passed on to it. The new
46351 process may in turn send multiple copies and possibly create yet another
46352 process.
46353 </para>
46354 </listitem>
46355 </itemizedlist>
46356 <para>
46357 For each copy sent over the same TCP/IP connection, a sequence counter is
46358 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
46359 no further messages are sent over that connection.
46360 </para>
46361 </section>
46362 <section id="SECID145">
46363 <title>Use of the $host and $host_address variables</title>
46364 <para>
46365 <indexterm role="variable">
46366 <primary><varname>$host</varname></primary>
46367 </indexterm>
46368 <indexterm role="variable">
46369 <primary><varname>$host_address</varname></primary>
46370 </indexterm>
46371 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
46372 <varname>$host_address</varname> are the name and IP address of the first host on the host list
46373 passed by the router. However, when the transport is about to connect to a
46374 specific host, and while it is connected to that host, <varname>$host</varname> and
46375 <varname>$host_address</varname> are set to the values for that host. These are the values
46376 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
46377 <option>serialize_hosts</option>, and the various TLS options are expanded.
46378 </para>
46379 </section>
46380 <section id="usecippeer">
46381 <title>Use of $tls_cipher and $tls_peerdn</title>
46382 <para>
46383 <indexterm role="variable">
46384 <primary><varname>$tls_bits</varname></primary>
46385 </indexterm>
46386 <indexterm role="variable">
46387 <primary><varname>$tls_cipher</varname></primary>
46388 </indexterm>
46389 <indexterm role="variable">
46390 <primary><varname>$tls_peerdn</varname></primary>
46391 </indexterm>
46392 <indexterm role="variable">
46393 <primary><varname>$tls_sni</varname></primary>
46394 </indexterm>
46395 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
46396 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
46397 are the values that were set when the message was received.
46398 These are the values that are used for options that are expanded before any
46399 SMTP connections are made. Just before each connection is made, these four
46400 variables are emptied. If TLS is subsequently started, they are set to the
46401 appropriate values for the outgoing connection, and these are the values that
46402 are in force when any authenticators are run and when the
46403 <option>authenticated_sender</option> option is expanded.
46404 </para>
46405 <para>
46406 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
46407 and will be removed in a future release.
46408 </para>
46409 </section>
46410 <section id="SECID146">
46411 <title>Private options for smtp</title>
46412 <para>
46413 <indexterm role="concept">
46414 <primary>options</primary>
46415 <secondary><command>smtp</command> transport</secondary>
46416 </indexterm>
46417 The private options of the <command>smtp</command> transport are as follows:
46418 </para>
46419 <para>
46420 <indexterm role="option">
46421 <primary><option>address_retry_include_sender</option></primary>
46422 </indexterm>
46423 </para>
46424 <informaltable frame="all">
46425 <tgroup cols="4" colsep="0" rowsep="0">
46426 <colspec colwidth="8*" align="left"/>
46427 <colspec colwidth="6*" align="center"/>
46428 <colspec colwidth="6*" align="center"/>
46429 <colspec colwidth="6*" align="right"/>
46430 <tbody>
46431 <row>
46432 <entry><option>address_retry_include_sender</option></entry>
46433 <entry>Use: <emphasis>smtp</emphasis></entry>
46434 <entry>Type: <emphasis>boolean</emphasis></entry>
46435 <entry>Default: <emphasis>true</emphasis></entry>
46436 </row>
46437 </tbody>
46438 </tgroup>
46439 </informaltable>
46440 <para>
46441 <indexterm role="concept">
46442 <primary>4<emphasis>xx</emphasis> responses</primary>
46443 <secondary>retrying after</secondary>
46444 </indexterm>
46445 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
46446 is the combination of sender and recipient that is delayed in subsequent queue
46447 runs until the retry time is reached. You can delay the recipient without
46448 reference to the sender (which is what earlier versions of Exim did), by
46449 setting <option>address_retry_include_sender</option> false. However, this can lead to
46450 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
46451 </para>
46452 <para>
46453 <indexterm role="option">
46454 <primary><option>allow_localhost</option></primary>
46455 </indexterm>
46456 </para>
46457 <informaltable frame="all">
46458 <tgroup cols="4" colsep="0" rowsep="0">
46459 <colspec colwidth="8*" align="left"/>
46460 <colspec colwidth="6*" align="center"/>
46461 <colspec colwidth="6*" align="center"/>
46462 <colspec colwidth="6*" align="right"/>
46463 <tbody>
46464 <row>
46465 <entry><option>allow_localhost</option></entry>
46466 <entry>Use: <emphasis>smtp</emphasis></entry>
46467 <entry>Type: <emphasis>boolean</emphasis></entry>
46468 <entry>Default: <emphasis>false</emphasis></entry>
46469 </row>
46470 </tbody>
46471 </tgroup>
46472 </informaltable>
46473 <para>
46474 <indexterm role="concept">
46475 <primary>local host</primary>
46476 <secondary>sending to</secondary>
46477 </indexterm>
46478 <indexterm role="concept">
46479 <primary>fallback</primary>
46480 <secondary>hosts specified on transport</secondary>
46481 </indexterm>
46482 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
46483 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
46484 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
46485 the delivery anyway. This should be used only in special cases when the
46486 configuration ensures that no looping will result (for example, a differently
46487 configured Exim is listening on the port to which the message is sent).
46488 </para>
46489 <para>
46490 <indexterm role="option">
46491 <primary><option>authenticated_sender</option></primary>
46492 </indexterm>
46493 </para>
46494 <informaltable frame="all">
46495 <tgroup cols="4" colsep="0" rowsep="0">
46496 <colspec colwidth="8*" align="left"/>
46497 <colspec colwidth="6*" align="center"/>
46498 <colspec colwidth="6*" align="center"/>
46499 <colspec colwidth="6*" align="right"/>
46500 <tbody>
46501 <row>
46502 <entry><option>authenticated_sender</option></entry>
46503 <entry>Use: <emphasis>smtp</emphasis></entry>
46504 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46505 <entry>Default: <emphasis>unset</emphasis></entry>
46506 </row>
46507 </tbody>
46508 </tgroup>
46509 </informaltable>
46510 <para>
46511 <indexterm role="concept">
46512 <primary>Cyrus</primary>
46513 </indexterm>
46514 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
46515 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
46516 overriding any existing authenticated sender value. If the string expansion is
46517 forced to fail, the option is ignored. Other expansion failures cause delivery
46518 to be deferred. If the result of expansion is an empty string, that is also
46519 ignored.
46520 </para>
46521 <para>
46522 The expansion happens after the outgoing connection has been made and TLS
46523 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
46524 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
46525 particular connection.
46526 </para>
46527 <para>
46528 If the SMTP session is not authenticated, the expansion of
46529 <option>authenticated_sender</option> still happens (and can cause the delivery to be
46530 deferred if it fails), but no AUTH= item is added to MAIL commands
46531 unless <option>authenticated_sender_force</option> is true.
46532 </para>
46533 <para>
46534 This option allows you to use the <command>smtp</command> transport in LMTP mode to
46535 deliver mail to Cyrus IMAP and provide the proper local part as the
46536 <quote>authenticated sender</quote>, via a setting such as:
46537 </para>
46538 <literallayout class="monospaced">
46539 authenticated_sender = $local_part
46540 </literallayout>
46541 <para>
46542 This removes the need for IMAP subfolders to be assigned special ACLs to
46543 allow direct delivery to those subfolders.
46544 </para>
46545 <para>
46546 Because of expected uses such as that just described for Cyrus (when no
46547 domain is involved), there is no checking on the syntax of the provided
46548 value.
46549 </para>
46550 <para>
46551 <indexterm role="option">
46552 <primary><option>authenticated_sender_force</option></primary>
46553 </indexterm>
46554 </para>
46555 <informaltable frame="all">
46556 <tgroup cols="4" colsep="0" rowsep="0">
46557 <colspec colwidth="8*" align="left"/>
46558 <colspec colwidth="6*" align="center"/>
46559 <colspec colwidth="6*" align="center"/>
46560 <colspec colwidth="6*" align="right"/>
46561 <tbody>
46562 <row>
46563 <entry><option>authenticated_sender_force</option></entry>
46564 <entry>Use: <emphasis>smtp</emphasis></entry>
46565 <entry>Type: <emphasis>boolean</emphasis></entry>
46566 <entry>Default: <emphasis>false</emphasis></entry>
46567 </row>
46568 </tbody>
46569 </tgroup>
46570 </informaltable>
46571 <para>
46572 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
46573 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
46574 authenticated as a client.
46575 </para>
46576 <para>
46577 <indexterm role="option">
46578 <primary><option>command_timeout</option></primary>
46579 </indexterm>
46580 </para>
46581 <informaltable frame="all">
46582 <tgroup cols="4" colsep="0" rowsep="0">
46583 <colspec colwidth="8*" align="left"/>
46584 <colspec colwidth="6*" align="center"/>
46585 <colspec colwidth="6*" align="center"/>
46586 <colspec colwidth="6*" align="right"/>
46587 <tbody>
46588 <row>
46589 <entry><option>command_timeout</option></entry>
46590 <entry>Use: <emphasis>smtp</emphasis></entry>
46591 <entry>Type: <emphasis>time</emphasis></entry>
46592 <entry>Default: <emphasis>5m</emphasis></entry>
46593 </row>
46594 </tbody>
46595 </tgroup>
46596 </informaltable>
46597 <para>
46598 This sets a timeout for receiving a response to an SMTP command that has been
46599 sent out. It is also used when waiting for the initial banner line from the
46600 remote host. Its value must not be zero.
46601 </para>
46602 <para>
46603 <indexterm role="option">
46604 <primary><option>connect_timeout</option></primary>
46605 </indexterm>
46606 </para>
46607 <informaltable frame="all">
46608 <tgroup cols="4" colsep="0" rowsep="0">
46609 <colspec colwidth="8*" align="left"/>
46610 <colspec colwidth="6*" align="center"/>
46611 <colspec colwidth="6*" align="center"/>
46612 <colspec colwidth="6*" align="right"/>
46613 <tbody>
46614 <row>
46615 <entry><option>connect_timeout</option></entry>
46616 <entry>Use: <emphasis>smtp</emphasis></entry>
46617 <entry>Type: <emphasis>time</emphasis></entry>
46618 <entry>Default: <emphasis>5m</emphasis></entry>
46619 </row>
46620 </tbody>
46621 </tgroup>
46622 </informaltable>
46623 <para>
46624 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
46625 to a remote host. A setting of zero allows the system timeout (typically
46626 several minutes) to act. To have any effect, the value of this option must be
46627 less than the system timeout. However, it has been observed that on some
46628 systems there is no system timeout, which is why the default value for this
46629 option is 5 minutes, a value recommended by RFC 1123.
46630 </para>
46631 <para>
46632 <indexterm role="option">
46633 <primary><option>connection_max_messages</option></primary>
46634 </indexterm>
46635 </para>
46636 <informaltable frame="all">
46637 <tgroup cols="4" colsep="0" rowsep="0">
46638 <colspec colwidth="8*" align="left"/>
46639 <colspec colwidth="6*" align="center"/>
46640 <colspec colwidth="6*" align="center"/>
46641 <colspec colwidth="6*" align="right"/>
46642 <tbody>
46643 <row>
46644 <entry><option>connection_max_messages</option></entry>
46645 <entry>Use: <emphasis>smtp</emphasis></entry>
46646 <entry>Type: <emphasis>integer</emphasis></entry>
46647 <entry>Default: <emphasis>500</emphasis></entry>
46648 </row>
46649 </tbody>
46650 </tgroup>
46651 </informaltable>
46652 <para>
46653 <indexterm role="concept">
46654 <primary>SMTP</primary>
46655 <secondary>passed connection</secondary>
46656 </indexterm>
46657 <indexterm role="concept">
46658 <primary>SMTP</primary>
46659 <secondary>multiple deliveries</secondary>
46660 </indexterm>
46661 <indexterm role="concept">
46662 <primary>multiple SMTP deliveries</primary>
46663 </indexterm>
46664 This controls the maximum number of separate message deliveries that are sent
46665 over a single TCP/IP connection. If the value is zero, there is no limit.
46666 For testing purposes, this value can be overridden by the <option>-oB</option> command line
46667 option.
46668 </para>
46669 <para revisionflag="changed">
46670 <indexterm role="option">
46671 <primary><option>dane_require_tls_ciphers</option></primary>
46672 </indexterm>
46673 </para>
46674 <informaltable frame="all" revisionflag="changed">
46675 <tgroup cols="4" colsep="0" rowsep="0">
46676 <colspec colwidth="8*" align="left"/>
46677 <colspec colwidth="6*" align="center"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="right"/>
46680 <tbody>
46681 <row>
46682 <entry><option>dane_require_tls_ciphers</option></entry>
46683 <entry>Use: <emphasis>smtp</emphasis></entry>
46684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46685 <entry>Default: <emphasis>unset</emphasis></entry>
46686 </row>
46687 </tbody>
46688 </tgroup>
46689 </informaltable>
46690 <para revisionflag="changed">
46691 <indexterm role="concept">
46692 <primary>TLS</primary>
46693 <secondary>requiring specific ciphers for DANE</secondary>
46694 </indexterm>
46695 <indexterm role="concept">
46696 <primary>cipher</primary>
46697 <secondary>requiring specific</secondary>
46698 </indexterm>
46699 <indexterm role="concept">
46700 <primary>DANE</primary>
46701 <secondary>TLS ciphers</secondary>
46702 </indexterm>
46703 This option may be used to override <option>tls_require_ciphers</option> for connections
46704 where DANE has been determined to be in effect.
46705 If not set, then <option>tls_require_ciphers</option> will be used.
46706 Normal SMTP delivery is not able to make strong demands of TLS cipher
46707 configuration, because delivery will fall back to plaintext.  Once DANE has
46708 been determined to be in effect, there is no plaintext fallback and making the
46709 TLS cipherlist configuration stronger will increase security, rather than
46710 counter-intuitively decreasing it.
46711 If the option expands to be empty or is forced to fail, then it will
46712 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
46713 </para>
46714 <para>
46715 <indexterm role="option">
46716 <primary><option>data_timeout</option></primary>
46717 </indexterm>
46718 </para>
46719 <informaltable frame="all">
46720 <tgroup cols="4" colsep="0" rowsep="0">
46721 <colspec colwidth="8*" align="left"/>
46722 <colspec colwidth="6*" align="center"/>
46723 <colspec colwidth="6*" align="center"/>
46724 <colspec colwidth="6*" align="right"/>
46725 <tbody>
46726 <row>
46727 <entry><option>data_timeout</option></entry>
46728 <entry>Use: <emphasis>smtp</emphasis></entry>
46729 <entry>Type: <emphasis>time</emphasis></entry>
46730 <entry>Default: <emphasis>5m</emphasis></entry>
46731 </row>
46732 </tbody>
46733 </tgroup>
46734 </informaltable>
46735 <para>
46736 This sets a timeout for the transmission of each block in the data portion of
46737 the message. As a result, the overall timeout for a message depends on the size
46738 of the message. Its value must not be zero. See also <option>final_timeout</option>.
46739 </para>
46740 <para>
46741 <indexterm role="option">
46742 <primary><option>unset</option></primary>
46743 </indexterm>
46744 </para>
46745 <informaltable frame="all">
46746 <tgroup cols="4" colsep="0" rowsep="0">
46747 <colspec colwidth="8*" align="left"/>
46748 <colspec colwidth="6*" align="center"/>
46749 <colspec colwidth="6*" align="center"/>
46750 <colspec colwidth="6*" align="right"/>
46751 <tbody>
46752 <row>
46753 <entry><option>dkim_domain</option></entry>
46754 <entry>Use: <emphasis>smtp</emphasis></entry>
46755 <entry>Type: <emphasis>string</emphasis></entry>
46756 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
46757 </row>
46758 </tbody>
46759 </tgroup>
46760 </informaltable>
46761 <para>
46762 <indexterm role="option">
46763 <primary><option>dkim_selector</option></primary>
46764 </indexterm>
46765 </para>
46766 <informaltable frame="all">
46767 <tgroup cols="4" colsep="0" rowsep="0">
46768 <colspec colwidth="8*" align="left"/>
46769 <colspec colwidth="6*" align="center"/>
46770 <colspec colwidth="6*" align="center"/>
46771 <colspec colwidth="6*" align="right"/>
46772 <tbody>
46773 <row>
46774 <entry><option>dkim_selector</option></entry>
46775 <entry>Use: <emphasis>smtp</emphasis></entry>
46776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46777 <entry>Default: <emphasis>unset</emphasis></entry>
46778 </row>
46779 </tbody>
46780 </tgroup>
46781 </informaltable>
46782 <para>
46783 <indexterm role="option">
46784 <primary><option>dkim_private_key</option></primary>
46785 </indexterm>
46786 </para>
46787 <informaltable frame="all">
46788 <tgroup cols="4" colsep="0" rowsep="0">
46789 <colspec colwidth="8*" align="left"/>
46790 <colspec colwidth="6*" align="center"/>
46791 <colspec colwidth="6*" align="center"/>
46792 <colspec colwidth="6*" align="right"/>
46793 <tbody>
46794 <row>
46795 <entry><option>dkim_private_key</option></entry>
46796 <entry>Use: <emphasis>smtp</emphasis></entry>
46797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46798 <entry>Default: <emphasis>unset</emphasis></entry>
46799 </row>
46800 </tbody>
46801 </tgroup>
46802 </informaltable>
46803 <para>
46804 <indexterm role="option">
46805 <primary><option>dkim_canon</option></primary>
46806 </indexterm>
46807 </para>
46808 <informaltable frame="all">
46809 <tgroup cols="4" colsep="0" rowsep="0">
46810 <colspec colwidth="8*" align="left"/>
46811 <colspec colwidth="6*" align="center"/>
46812 <colspec colwidth="6*" align="center"/>
46813 <colspec colwidth="6*" align="right"/>
46814 <tbody>
46815 <row>
46816 <entry><option>dkim_canon</option></entry>
46817 <entry>Use: <emphasis>smtp</emphasis></entry>
46818 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46819 <entry>Default: <emphasis>unset</emphasis></entry>
46820 </row>
46821 </tbody>
46822 </tgroup>
46823 </informaltable>
46824 <para>
46825 <indexterm role="option">
46826 <primary><option>dkim_strict</option></primary>
46827 </indexterm>
46828 </para>
46829 <informaltable frame="all">
46830 <tgroup cols="4" colsep="0" rowsep="0">
46831 <colspec colwidth="8*" align="left"/>
46832 <colspec colwidth="6*" align="center"/>
46833 <colspec colwidth="6*" align="center"/>
46834 <colspec colwidth="6*" align="right"/>
46835 <tbody>
46836 <row>
46837 <entry><option>dkim_strict</option></entry>
46838 <entry>Use: <emphasis>smtp</emphasis></entry>
46839 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46840 <entry>Default: <emphasis>unset</emphasis></entry>
46841 </row>
46842 </tbody>
46843 </tgroup>
46844 </informaltable>
46845 <para>
46846 <indexterm role="option">
46847 <primary><option>dkim_sign_headers</option></primary>
46848 </indexterm>
46849 </para>
46850 <informaltable frame="all">
46851 <tgroup cols="4" colsep="0" rowsep="0">
46852 <colspec colwidth="8*" align="left"/>
46853 <colspec colwidth="6*" align="center"/>
46854 <colspec colwidth="6*" align="center"/>
46855 <colspec colwidth="6*" align="right"/>
46856 <tbody>
46857 <row>
46858 <entry><option>dkim_sign_headers</option></entry>
46859 <entry>Use: <emphasis>smtp</emphasis></entry>
46860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46861 <entry>Default: <emphasis>per RFC</emphasis></entry>
46862 </row>
46863 </tbody>
46864 </tgroup>
46865 </informaltable>
46866 <para>
46867 <indexterm role="option">
46868 <primary><option>dkim_hash</option></primary>
46869 </indexterm>
46870 </para>
46871 <informaltable frame="all">
46872 <tgroup cols="4" colsep="0" rowsep="0">
46873 <colspec colwidth="8*" align="left"/>
46874 <colspec colwidth="6*" align="center"/>
46875 <colspec colwidth="6*" align="center"/>
46876 <colspec colwidth="6*" align="right"/>
46877 <tbody>
46878 <row>
46879 <entry><option>dkim_hash</option></entry>
46880 <entry>Use: <emphasis>smtp</emphasis></entry>
46881 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46882 <entry>Default: <emphasis>sha256</emphasis></entry>
46883 </row>
46884 </tbody>
46885 </tgroup>
46886 </informaltable>
46887 <para>
46888 <indexterm role="option">
46889 <primary><option>dkim_identity</option></primary>
46890 </indexterm>
46891 </para>
46892 <informaltable frame="all">
46893 <tgroup cols="4" colsep="0" rowsep="0">
46894 <colspec colwidth="8*" align="left"/>
46895 <colspec colwidth="6*" align="center"/>
46896 <colspec colwidth="6*" align="center"/>
46897 <colspec colwidth="6*" align="right"/>
46898 <tbody>
46899 <row>
46900 <entry><option>dkim_identity</option></entry>
46901 <entry>Use: <emphasis>smtp</emphasis></entry>
46902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46903 <entry>Default: <emphasis>unset</emphasis></entry>
46904 </row>
46905 </tbody>
46906 </tgroup>
46907 </informaltable>
46908 <para>
46909 DKIM signing options.  For details see section <xref linkend="SECDKIMSIGN"/>.
46910 </para>
46911 <para>
46912 <indexterm role="option">
46913 <primary><option>delay_after_cutoff</option></primary>
46914 </indexterm>
46915 </para>
46916 <informaltable frame="all">
46917 <tgroup cols="4" colsep="0" rowsep="0">
46918 <colspec colwidth="8*" align="left"/>
46919 <colspec colwidth="6*" align="center"/>
46920 <colspec colwidth="6*" align="center"/>
46921 <colspec colwidth="6*" align="right"/>
46922 <tbody>
46923 <row>
46924 <entry><option>delay_after_cutoff</option></entry>
46925 <entry>Use: <emphasis>smtp</emphasis></entry>
46926 <entry>Type: <emphasis>boolean</emphasis></entry>
46927 <entry>Default: <emphasis>true</emphasis></entry>
46928 </row>
46929 </tbody>
46930 </tgroup>
46931 </informaltable>
46932 <para>
46933 This option controls what happens when all remote IP addresses for a given
46934 domain have been inaccessible for so long that they have passed their retry
46935 cutoff times.
46936 </para>
46937 <para>
46938 In the default state, if the next retry time has not been reached for any of
46939 them, the address is bounced without trying any deliveries. In other words,
46940 Exim delays retrying an IP address after the final cutoff time until a new
46941 retry time is reached, and can therefore bounce an address without ever trying
46942 a delivery, when machines have been down for a long time. Some people are
46943 unhappy at this prospect, so...
46944 </para>
46945 <para>
46946 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
46947 addresses are past their final cutoff time, Exim tries to deliver to those
46948 IP addresses that have not been tried since the message arrived. If there are
46949 none, of if they all fail, the address is bounced. In other words, it does not
46950 delay when a new message arrives, but immediately tries those expired IP
46951 addresses that haven&#x2019;t been tried since the message arrived. If there is a
46952 continuous stream of messages for the dead hosts, unsetting
46953 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
46954 to them.
46955 </para>
46956 <para>
46957 <indexterm role="option">
46958 <primary><option>dns_qualify_single</option></primary>
46959 </indexterm>
46960 </para>
46961 <informaltable frame="all">
46962 <tgroup cols="4" colsep="0" rowsep="0">
46963 <colspec colwidth="8*" align="left"/>
46964 <colspec colwidth="6*" align="center"/>
46965 <colspec colwidth="6*" align="center"/>
46966 <colspec colwidth="6*" align="right"/>
46967 <tbody>
46968 <row>
46969 <entry><option>dns_qualify_single</option></entry>
46970 <entry>Use: <emphasis>smtp</emphasis></entry>
46971 <entry>Type: <emphasis>boolean</emphasis></entry>
46972 <entry>Default: <emphasis>true</emphasis></entry>
46973 </row>
46974 </tbody>
46975 </tgroup>
46976 </informaltable>
46977 <para>
46978 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
46979 and the <option>gethostbyname</option> option is false,
46980 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
46981 in chapter <xref linkend="CHAPdnslookup"/> for more details.
46982 </para>
46983 <para>
46984 <indexterm role="option">
46985 <primary><option>dns_search_parents</option></primary>
46986 </indexterm>
46987 </para>
46988 <informaltable frame="all">
46989 <tgroup cols="4" colsep="0" rowsep="0">
46990 <colspec colwidth="8*" align="left"/>
46991 <colspec colwidth="6*" align="center"/>
46992 <colspec colwidth="6*" align="center"/>
46993 <colspec colwidth="6*" align="right"/>
46994 <tbody>
46995 <row>
46996 <entry><option>dns_search_parents</option></entry>
46997 <entry>Use: <emphasis>smtp</emphasis></entry>
46998 <entry>Type: <emphasis>boolean</emphasis></entry>
46999 <entry>Default: <emphasis>false</emphasis></entry>
47000 </row>
47001 </tbody>
47002 </tgroup>
47003 </informaltable>
47004 <para>
47005 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
47006 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
47007 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
47008 details.
47009 </para>
47010 <para>
47011 <indexterm role="option">
47012 <primary><option>dnssec_request_domains</option></primary>
47013 </indexterm>
47014 </para>
47015 <informaltable frame="all">
47016 <tgroup cols="4" colsep="0" rowsep="0">
47017 <colspec colwidth="8*" align="left"/>
47018 <colspec colwidth="6*" align="center"/>
47019 <colspec colwidth="6*" align="center"/>
47020 <colspec colwidth="6*" align="right"/>
47021 <tbody>
47022 <row>
47023 <entry><option>dnssec_request_domains</option></entry>
47024 <entry>Use: <emphasis>smtp</emphasis></entry>
47025 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
47026 <entry>Default: <emphasis>unset</emphasis></entry>
47027 </row>
47028 </tbody>
47029 </tgroup>
47030 </informaltable>
47031 <para>
47032 <indexterm role="concept">
47033 <primary>MX record</primary>
47034 <secondary>security</secondary>
47035 </indexterm>
47036 <indexterm role="concept">
47037 <primary>DNSSEC</primary>
47038 <secondary>MX lookup</secondary>
47039 </indexterm>
47040 <indexterm role="concept">
47041 <primary>security</primary>
47042 <secondary>MX lookup</secondary>
47043 </indexterm>
47044 <indexterm role="concept">
47045 <primary>DNS</primary>
47046 <secondary>DNSSEC</secondary>
47047 </indexterm>
47048 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
47049 the dnssec request bit set.
47050 This applies to all of the SRV, MX, AAAA, A lookup sequence.
47051 </para>
47052 <para>
47053 <indexterm role="option">
47054 <primary><option>dnssec_require_domains</option></primary>
47055 </indexterm>
47056 </para>
47057 <informaltable frame="all">
47058 <tgroup cols="4" colsep="0" rowsep="0">
47059 <colspec colwidth="8*" align="left"/>
47060 <colspec colwidth="6*" align="center"/>
47061 <colspec colwidth="6*" align="center"/>
47062 <colspec colwidth="6*" align="right"/>
47063 <tbody>
47064 <row>
47065 <entry><option>dnssec_require_domains</option></entry>
47066 <entry>Use: <emphasis>smtp</emphasis></entry>
47067 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
47068 <entry>Default: <emphasis>unset</emphasis></entry>
47069 </row>
47070 </tbody>
47071 </tgroup>
47072 </informaltable>
47073 <para>
47074 <indexterm role="concept">
47075 <primary>MX record</primary>
47076 <secondary>security</secondary>
47077 </indexterm>
47078 <indexterm role="concept">
47079 <primary>DNSSEC</primary>
47080 <secondary>MX lookup</secondary>
47081 </indexterm>
47082 <indexterm role="concept">
47083 <primary>security</primary>
47084 <secondary>MX lookup</secondary>
47085 </indexterm>
47086 <indexterm role="concept">
47087 <primary>DNS</primary>
47088 <secondary>DNSSEC</secondary>
47089 </indexterm>
47090 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
47091 the dnssec request bit set.  Any returns not having the Authenticated Data bit
47092 (AD bit) set will be ignored and logged as a host-lookup failure.
47093 This applies to all of the SRV, MX, AAAA, A lookup sequence.
47094 </para>
47095 <para>
47096 <indexterm role="option">
47097 <primary><option>dscp</option></primary>
47098 </indexterm>
47099 </para>
47100 <informaltable frame="all">
47101 <tgroup cols="4" colsep="0" rowsep="0">
47102 <colspec colwidth="8*" align="left"/>
47103 <colspec colwidth="6*" align="center"/>
47104 <colspec colwidth="6*" align="center"/>
47105 <colspec colwidth="6*" align="right"/>
47106 <tbody>
47107 <row>
47108 <entry><option>dscp</option></entry>
47109 <entry>Use: <emphasis>smtp</emphasis></entry>
47110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47111 <entry>Default: <emphasis>unset</emphasis></entry>
47112 </row>
47113 </tbody>
47114 </tgroup>
47115 </informaltable>
47116 <para>
47117 <indexterm role="concept">
47118 <primary>DCSP</primary>
47119 <secondary>outbound</secondary>
47120 </indexterm>
47121 This option causes the DSCP value associated with a socket to be set to one
47122 of a number of fixed strings or to numeric value.
47123 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
47124 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
47125 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
47126 </para>
47127 <para>
47128 The outbound packets from Exim will be marked with this value in the header
47129 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
47130 that these values will have any effect, not be stripped by networking
47131 equipment, or do much of anything without cooperation with your Network
47132 Engineer and those of all network operators between the source and destination.
47133 </para>
47134 <para>
47135 <indexterm role="option">
47136 <primary><option>fallback_hosts</option></primary>
47137 </indexterm>
47138 </para>
47139 <informaltable frame="all">
47140 <tgroup cols="4" colsep="0" rowsep="0">
47141 <colspec colwidth="8*" align="left"/>
47142 <colspec colwidth="6*" align="center"/>
47143 <colspec colwidth="6*" align="center"/>
47144 <colspec colwidth="6*" align="right"/>
47145 <tbody>
47146 <row>
47147 <entry><option>fallback_hosts</option></entry>
47148 <entry>Use: <emphasis>smtp</emphasis></entry>
47149 <entry>Type: <emphasis>string list</emphasis></entry>
47150 <entry>Default: <emphasis>unset</emphasis></entry>
47151 </row>
47152 </tbody>
47153 </tgroup>
47154 </informaltable>
47155 <para>
47156 <indexterm role="concept">
47157 <primary>fallback</primary>
47158 <secondary>hosts specified on transport</secondary>
47159 </indexterm>
47160 String expansion is not applied to this option. The argument must be a
47161 colon-separated list of host names or IP addresses, optionally also including
47162 port numbers, though the separator can be changed, as described in section
47163 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
47164 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
47165 in section <xref linkend="SECTformatonehostitem"/>.
47166 </para>
47167 <para>
47168 Fallback hosts can also be specified on routers, which associate them with the
47169 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
47170 <option>fallback_hosts</option> specified on the transport is used only if the address does
47171 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
47172 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
47173 However, <option>hosts_randomize</option> does apply to fallback host lists.
47174 </para>
47175 <para>
47176 If Exim is unable to deliver to any of the hosts for a particular address, and
47177 the errors are not permanent rejections, the address is put on a separate
47178 transport queue with its host list replaced by the fallback hosts, unless the
47179 address was routed via MX records and the current host was in the original MX
47180 list. In that situation, the fallback host list is not used.
47181 </para>
47182 <para>
47183 Once normal deliveries are complete, the fallback queue is delivered by
47184 re-running the same transports with the new host lists. If several failing
47185 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
47186 copy of the message is sent.
47187 </para>
47188 <para>
47189 The resolution of the host names on the fallback list is controlled by the
47190 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
47191 both to cases when the host list comes with the address and when it is taken
47192 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
47193 fails</quote> facility.
47194 </para>
47195 <para>
47196 <indexterm role="option">
47197 <primary><option>final_timeout</option></primary>
47198 </indexterm>
47199 </para>
47200 <informaltable frame="all">
47201 <tgroup cols="4" colsep="0" rowsep="0">
47202 <colspec colwidth="8*" align="left"/>
47203 <colspec colwidth="6*" align="center"/>
47204 <colspec colwidth="6*" align="center"/>
47205 <colspec colwidth="6*" align="right"/>
47206 <tbody>
47207 <row>
47208 <entry><option>final_timeout</option></entry>
47209 <entry>Use: <emphasis>smtp</emphasis></entry>
47210 <entry>Type: <emphasis>time</emphasis></entry>
47211 <entry>Default: <emphasis>10m</emphasis></entry>
47212 </row>
47213 </tbody>
47214 </tgroup>
47215 </informaltable>
47216 <para>
47217 This is the timeout that applies while waiting for the response to the final
47218 line containing just <quote>.</quote> that terminates a message. Its value must not be
47219 zero.
47220 </para>
47221 <para>
47222 <indexterm role="option">
47223 <primary><option>gethostbyname</option></primary>
47224 </indexterm>
47225 </para>
47226 <informaltable frame="all">
47227 <tgroup cols="4" colsep="0" rowsep="0">
47228 <colspec colwidth="8*" align="left"/>
47229 <colspec colwidth="6*" align="center"/>
47230 <colspec colwidth="6*" align="center"/>
47231 <colspec colwidth="6*" align="right"/>
47232 <tbody>
47233 <row>
47234 <entry><option>gethostbyname</option></entry>
47235 <entry>Use: <emphasis>smtp</emphasis></entry>
47236 <entry>Type: <emphasis>boolean</emphasis></entry>
47237 <entry>Default: <emphasis>false</emphasis></entry>
47238 </row>
47239 </tbody>
47240 </tgroup>
47241 </informaltable>
47242 <para>
47243 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
47244 being used, names are looked up using <function>gethostbyname()</function>
47245 (or <function>getipnodebyname()</function> when available)
47246 instead of using the DNS. Of course, that function may in fact use the DNS, but
47247 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
47248 </para>
47249 <para>
47250 <indexterm role="option">
47251 <primary><option>gnutls_compat_mode</option></primary>
47252 </indexterm>
47253 </para>
47254 <informaltable frame="all">
47255 <tgroup cols="4" colsep="0" rowsep="0">
47256 <colspec colwidth="8*" align="left"/>
47257 <colspec colwidth="6*" align="center"/>
47258 <colspec colwidth="6*" align="center"/>
47259 <colspec colwidth="6*" align="right"/>
47260 <tbody>
47261 <row>
47262 <entry><option>gnutls_compat_mode</option></entry>
47263 <entry>Use: <emphasis>smtp</emphasis></entry>
47264 <entry>Type: <emphasis>boolean</emphasis></entry>
47265 <entry>Default: <emphasis>unset</emphasis></entry>
47266 </row>
47267 </tbody>
47268 </tgroup>
47269 </informaltable>
47270 <para>
47271 This option controls whether GnuTLS is used in compatibility mode in an Exim
47272 server. This reduces security slightly, but improves interworking with older
47273 implementations of TLS.
47274 </para>
47275 <para>
47276 <indexterm role="option">
47277 <primary><option>helo_data</option></primary>
47278 </indexterm>
47279 </para>
47280 <informaltable frame="all">
47281 <tgroup cols="4" colsep="0" rowsep="0">
47282 <colspec colwidth="8*" align="left"/>
47283 <colspec colwidth="6*" align="center"/>
47284 <colspec colwidth="6*" align="center"/>
47285 <colspec colwidth="6*" align="right"/>
47286 <tbody>
47287 <row>
47288 <entry><option>helo_data</option></entry>
47289 <entry>Use: <emphasis>smtp</emphasis></entry>
47290 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47291 <entry>Default: <emphasis>see below</emphasis></entry>
47292 </row>
47293 </tbody>
47294 </tgroup>
47295 </informaltable>
47296 <para>
47297 <indexterm role="concept">
47298 <primary>HELO</primary>
47299 <secondary>argument, setting</secondary>
47300 </indexterm>
47301 <indexterm role="concept">
47302 <primary>EHLO</primary>
47303 <secondary>argument, setting</secondary>
47304 </indexterm>
47305 <indexterm role="concept">
47306 <primary>LHLO argument setting</primary>
47307 </indexterm>
47308 The value of this option is expanded after a connection to a another host has
47309 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
47310 command that starts the outgoing SMTP or LMTP session. The default value of the
47311 option is:
47312 </para>
47313 <literallayout class="monospaced">
47314 $primary_hostname
47315 </literallayout>
47316 <para>
47317 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
47318 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
47319 <varname>$sending_port</varname> are set to the local IP address and port number that are being
47320 used. These variables can be used to generate different values for different
47321 servers or different local IP addresses. For example, if you want the string
47322 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
47323 interface address, you could use this:
47324 </para>
47325 <literallayout class="monospaced">
47326 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
47327   {$primary_hostname}}
47328 </literallayout>
47329 <para>
47330 The use of <option>helo_data</option> applies both to sending messages and when doing
47331 callouts.
47332 </para>
47333 <para>
47334 <indexterm role="option">
47335 <primary><option>hosts</option></primary>
47336 </indexterm>
47337 </para>
47338 <informaltable frame="all">
47339 <tgroup cols="4" colsep="0" rowsep="0">
47340 <colspec colwidth="8*" align="left"/>
47341 <colspec colwidth="6*" align="center"/>
47342 <colspec colwidth="6*" align="center"/>
47343 <colspec colwidth="6*" align="right"/>
47344 <tbody>
47345 <row>
47346 <entry><option>hosts</option></entry>
47347 <entry>Use: <emphasis>smtp</emphasis></entry>
47348 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47349 <entry>Default: <emphasis>unset</emphasis></entry>
47350 </row>
47351 </tbody>
47352 </tgroup>
47353 </informaltable>
47354 <para>
47355 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
47356 finds the hosts by looking up the address domain in the DNS, or by
47357 <command>manualroute</command>, which has lists of hosts in its configuration. However,
47358 email addresses can be passed to the <command>smtp</command> transport by any router, and not
47359 all of them can provide an associated list of hosts.
47360 </para>
47361 <para>
47362 The <option>hosts</option> option specifies a list of hosts to be used if the address being
47363 processed does not have any hosts associated with it. The hosts specified by
47364 <option>hosts</option> are also used, whether or not the address has its own hosts, if
47365 <option>hosts_override</option> is set.
47366 </para>
47367 <para>
47368 The string is first expanded, before being interpreted as a colon-separated
47369 list of host names or IP addresses, possibly including port numbers. The
47370 separator may be changed to something other than colon, as described in section
47371 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
47372 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
47373 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
47374 of the <command>manualroute</command> router is not available here.
47375 </para>
47376 <para>
47377 If the expansion fails, delivery is deferred. Unless the failure was caused by
47378 the inability to complete a lookup, the error is logged to the panic log as
47379 well as the main log. Host names are looked up either by searching directly for
47380 address records in the DNS or by calling <function>gethostbyname()</function> (or
47381 <function>getipnodebyname()</function> when available), depending on the setting of the
47382 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
47383 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
47384 address are used.
47385 </para>
47386 <para>
47387 During delivery, the hosts are tried in order, subject to their retry status,
47388 unless <option>hosts_randomize</option> is set.
47389 </para>
47390 <para>
47391 <indexterm role="option">
47392 <primary><option>hosts_avoid_esmtp</option></primary>
47393 </indexterm>
47394 </para>
47395 <informaltable frame="all">
47396 <tgroup cols="4" colsep="0" rowsep="0">
47397 <colspec colwidth="8*" align="left"/>
47398 <colspec colwidth="6*" align="center"/>
47399 <colspec colwidth="6*" align="center"/>
47400 <colspec colwidth="6*" align="right"/>
47401 <tbody>
47402 <row>
47403 <entry><option>hosts_avoid_esmtp</option></entry>
47404 <entry>Use: <emphasis>smtp</emphasis></entry>
47405 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47406 <entry>Default: <emphasis>unset</emphasis></entry>
47407 </row>
47408 </tbody>
47409 </tgroup>
47410 </informaltable>
47411 <para>
47412 <indexterm role="concept">
47413 <primary>ESMTP, avoiding use of</primary>
47414 </indexterm>
47415 <indexterm role="concept">
47416 <primary>HELO</primary>
47417 <secondary>forcing use of</secondary>
47418 </indexterm>
47419 <indexterm role="concept">
47420 <primary>EHLO</primary>
47421 <secondary>avoiding use of</secondary>
47422 </indexterm>
47423 <indexterm role="concept">
47424 <primary>PIPELINING</primary>
47425 <secondary>avoiding the use of</secondary>
47426 </indexterm>
47427 This option is for use with broken hosts that announce ESMTP facilities (for
47428 example, PIPELINING) and then fail to implement them properly. When a host
47429 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
47430 start of the SMTP session. This means that it cannot use any of the ESMTP
47431 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
47432 </para>
47433 <para>
47434 <indexterm role="option">
47435 <primary><option>hosts_avoid_pipelining</option></primary>
47436 </indexterm>
47437 </para>
47438 <informaltable frame="all">
47439 <tgroup cols="4" colsep="0" rowsep="0">
47440 <colspec colwidth="8*" align="left"/>
47441 <colspec colwidth="6*" align="center"/>
47442 <colspec colwidth="6*" align="center"/>
47443 <colspec colwidth="6*" align="right"/>
47444 <tbody>
47445 <row>
47446 <entry><option>hosts_avoid_pipelining</option></entry>
47447 <entry>Use: <emphasis>smtp</emphasis></entry>
47448 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47449 <entry>Default: <emphasis>unset</emphasis></entry>
47450 </row>
47451 </tbody>
47452 </tgroup>
47453 </informaltable>
47454 <para>
47455 <indexterm role="concept">
47456 <primary>PIPELINING</primary>
47457 <secondary>avoiding the use of</secondary>
47458 </indexterm>
47459 Exim will not use the SMTP PIPELINING extension when delivering to any host
47460 that matches this list, even if the server host advertises PIPELINING support.
47461 </para>
47462 <para>
47463 <indexterm role="option">
47464 <primary><option>hosts_avoid_tls</option></primary>
47465 </indexterm>
47466 </para>
47467 <informaltable frame="all">
47468 <tgroup cols="4" colsep="0" rowsep="0">
47469 <colspec colwidth="8*" align="left"/>
47470 <colspec colwidth="6*" align="center"/>
47471 <colspec colwidth="6*" align="center"/>
47472 <colspec colwidth="6*" align="right"/>
47473 <tbody>
47474 <row>
47475 <entry><option>hosts_avoid_tls</option></entry>
47476 <entry>Use: <emphasis>smtp</emphasis></entry>
47477 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47478 <entry>Default: <emphasis>unset</emphasis></entry>
47479 </row>
47480 </tbody>
47481 </tgroup>
47482 </informaltable>
47483 <para>
47484 <indexterm role="concept">
47485 <primary>TLS</primary>
47486 <secondary>avoiding for certain hosts</secondary>
47487 </indexterm>
47488 Exim will not try to start a TLS session when delivering to any host that
47489 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47490 </para>
47491 <para>
47492 <indexterm role="option">
47493 <primary><option>hosts_verify_avoid_tls</option></primary>
47494 </indexterm>
47495 </para>
47496 <informaltable frame="all">
47497 <tgroup cols="4" colsep="0" rowsep="0">
47498 <colspec colwidth="8*" align="left"/>
47499 <colspec colwidth="6*" align="center"/>
47500 <colspec colwidth="6*" align="center"/>
47501 <colspec colwidth="6*" align="right"/>
47502 <tbody>
47503 <row>
47504 <entry><option>hosts_verify_avoid_tls</option></entry>
47505 <entry>Use: <emphasis>smtp</emphasis></entry>
47506 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47507 <entry>Default: <emphasis>unset</emphasis></entry>
47508 </row>
47509 </tbody>
47510 </tgroup>
47511 </informaltable>
47512 <para>
47513 <indexterm role="concept">
47514 <primary>TLS</primary>
47515 <secondary>avoiding for certain hosts</secondary>
47516 </indexterm>
47517 Exim will not try to start a TLS session for a verify callout,
47518 or when delivering in cutthrough mode,
47519 to any host that matches this list.
47520 </para>
47521 <para>
47522 <indexterm role="option">
47523 <primary><option>hosts_max_try</option></primary>
47524 </indexterm>
47525 </para>
47526 <informaltable frame="all">
47527 <tgroup cols="4" colsep="0" rowsep="0">
47528 <colspec colwidth="8*" align="left"/>
47529 <colspec colwidth="6*" align="center"/>
47530 <colspec colwidth="6*" align="center"/>
47531 <colspec colwidth="6*" align="right"/>
47532 <tbody>
47533 <row>
47534 <entry><option>hosts_max_try</option></entry>
47535 <entry>Use: <emphasis>smtp</emphasis></entry>
47536 <entry>Type: <emphasis>integer</emphasis></entry>
47537 <entry>Default: <emphasis>5</emphasis></entry>
47538 </row>
47539 </tbody>
47540 </tgroup>
47541 </informaltable>
47542 <para>
47543 <indexterm role="concept">
47544 <primary>host</primary>
47545 <secondary>maximum number to try</secondary>
47546 </indexterm>
47547 <indexterm role="concept">
47548 <primary>limit</primary>
47549 <secondary>number of hosts tried</secondary>
47550 </indexterm>
47551 <indexterm role="concept">
47552 <primary>limit</primary>
47553 <secondary>number of MX tried</secondary>
47554 </indexterm>
47555 <indexterm role="concept">
47556 <primary>MX record</primary>
47557 <secondary>maximum tried</secondary>
47558 </indexterm>
47559 This option limits the number of IP addresses that are tried for any one
47560 delivery in cases where there are temporary delivery errors. Section
47561 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
47562 </para>
47563 <para>
47564 <indexterm role="option">
47565 <primary><option>hosts_max_try_hardlimit</option></primary>
47566 </indexterm>
47567 </para>
47568 <informaltable frame="all">
47569 <tgroup cols="4" colsep="0" rowsep="0">
47570 <colspec colwidth="8*" align="left"/>
47571 <colspec colwidth="6*" align="center"/>
47572 <colspec colwidth="6*" align="center"/>
47573 <colspec colwidth="6*" align="right"/>
47574 <tbody>
47575 <row>
47576 <entry><option>hosts_max_try_hardlimit</option></entry>
47577 <entry>Use: <emphasis>smtp</emphasis></entry>
47578 <entry>Type: <emphasis>integer</emphasis></entry>
47579 <entry>Default: <emphasis>50</emphasis></entry>
47580 </row>
47581 </tbody>
47582 </tgroup>
47583 </informaltable>
47584 <para>
47585 This is an additional check on the maximum number of IP addresses that Exim
47586 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
47587 why it exists.
47588 </para>
47589 <para>
47590 <indexterm role="option">
47591 <primary><option>hosts_nopass_tls</option></primary>
47592 </indexterm>
47593 </para>
47594 <informaltable frame="all">
47595 <tgroup cols="4" colsep="0" rowsep="0">
47596 <colspec colwidth="8*" align="left"/>
47597 <colspec colwidth="6*" align="center"/>
47598 <colspec colwidth="6*" align="center"/>
47599 <colspec colwidth="6*" align="right"/>
47600 <tbody>
47601 <row>
47602 <entry><option>hosts_nopass_tls</option></entry>
47603 <entry>Use: <emphasis>smtp</emphasis></entry>
47604 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47605 <entry>Default: <emphasis>unset</emphasis></entry>
47606 </row>
47607 </tbody>
47608 </tgroup>
47609 </informaltable>
47610 <para>
47611 <indexterm role="concept">
47612 <primary>TLS</primary>
47613 <secondary>passing connection</secondary>
47614 </indexterm>
47615 <indexterm role="concept">
47616 <primary>multiple SMTP deliveries</primary>
47617 </indexterm>
47618 <indexterm role="concept">
47619 <primary>TLS</primary>
47620 <secondary>multiple message deliveries</secondary>
47621 </indexterm>
47622 For any host that matches this list, a connection on which a TLS session has
47623 been started will not be passed to a new delivery process for sending another
47624 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
47625 explanation of when this might be needed.
47626 </para>
47627 <para>
47628 <indexterm role="option">
47629 <primary><option>hosts_noproxy_tls</option></primary>
47630 </indexterm>
47631 </para>
47632 <informaltable frame="all">
47633 <tgroup cols="4" colsep="0" rowsep="0">
47634 <colspec colwidth="8*" align="left"/>
47635 <colspec colwidth="6*" align="center"/>
47636 <colspec colwidth="6*" align="center"/>
47637 <colspec colwidth="6*" align="right"/>
47638 <tbody>
47639 <row>
47640 <entry><option>hosts_noproxy_tls</option></entry>
47641 <entry>Use: <emphasis>smtp</emphasis></entry>
47642 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47643 <entry>Default: <emphasis>*</emphasis></entry>
47644 </row>
47645 </tbody>
47646 </tgroup>
47647 </informaltable>
47648 <para>
47649 <indexterm role="concept">
47650 <primary>TLS</primary>
47651 <secondary>passing connection</secondary>
47652 </indexterm>
47653 <indexterm role="concept">
47654 <primary>multiple SMTP deliveries</primary>
47655 </indexterm>
47656 <indexterm role="concept">
47657 <primary>TLS</primary>
47658 <secondary>multiple message deliveries</secondary>
47659 </indexterm>
47660 For any host that matches this list, a TLS session which has
47661 been started will not be passed to a new delivery process for sending another
47662 message on the same session.
47663 </para>
47664 <para>
47665 The traditional implementation closes down TLS and re-starts it in the new
47666 process, on the same open TCP connection, for each successive message
47667 sent.  If permitted by this option a pipe to to the new process is set up
47668 instead, and the original process maintains the TLS connection and proxies
47669 the SMTP connection from and to the new process and any subsequents.
47670 The new process has no access to TLS information, so cannot include it in
47671 logging.
47672 </para>
47673 <para>
47674 <indexterm role="option">
47675 <primary><option>hosts_override</option></primary>
47676 </indexterm>
47677 </para>
47678 <informaltable frame="all">
47679 <tgroup cols="4" colsep="0" rowsep="0">
47680 <colspec colwidth="8*" align="left"/>
47681 <colspec colwidth="6*" align="center"/>
47682 <colspec colwidth="6*" align="center"/>
47683 <colspec colwidth="6*" align="right"/>
47684 <tbody>
47685 <row>
47686 <entry><option>hosts_override</option></entry>
47687 <entry>Use: <emphasis>smtp</emphasis></entry>
47688 <entry>Type: <emphasis>boolean</emphasis></entry>
47689 <entry>Default: <emphasis>false</emphasis></entry>
47690 </row>
47691 </tbody>
47692 </tgroup>
47693 </informaltable>
47694 <para>
47695 If this option is set and the <option>hosts</option> option is also set, any hosts that are
47696 attached to the address are ignored, and instead the hosts specified by the
47697 <option>hosts</option> option are always used. This option does not apply to
47698 <option>fallback_hosts</option>.
47699 </para>
47700 <para>
47701 <indexterm role="option">
47702 <primary><option>hosts_randomize</option></primary>
47703 </indexterm>
47704 </para>
47705 <informaltable frame="all">
47706 <tgroup cols="4" colsep="0" rowsep="0">
47707 <colspec colwidth="8*" align="left"/>
47708 <colspec colwidth="6*" align="center"/>
47709 <colspec colwidth="6*" align="center"/>
47710 <colspec colwidth="6*" align="right"/>
47711 <tbody>
47712 <row>
47713 <entry><option>hosts_randomize</option></entry>
47714 <entry>Use: <emphasis>smtp</emphasis></entry>
47715 <entry>Type: <emphasis>boolean</emphasis></entry>
47716 <entry>Default: <emphasis>false</emphasis></entry>
47717 </row>
47718 </tbody>
47719 </tgroup>
47720 </informaltable>
47721 <para>
47722 <indexterm role="concept">
47723 <primary>randomized host list</primary>
47724 </indexterm>
47725 <indexterm role="concept">
47726 <primary>host</primary>
47727 <secondary>list of; randomized</secondary>
47728 </indexterm>
47729 <indexterm role="concept">
47730 <primary>fallback</primary>
47731 <secondary>randomized hosts</secondary>
47732 </indexterm>
47733 If this option is set, and either the list of hosts is taken from the
47734 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
47735 were not obtained from MX records (this includes fallback hosts from the
47736 router), and were not randomized by the router, the order of trying the hosts
47737 is randomized each time the transport runs. Randomizing the order of a host
47738 list can be used to do crude load sharing.
47739 </para>
47740 <para>
47741 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
47742 order is separately randomized. This makes it possible to set up MX-like
47743 behaviour. The boundaries between groups are indicated by an item that is just
47744 <literal>+</literal> in the host list. For example:
47745 </para>
47746 <literallayout class="monospaced">
47747 hosts = host1:host2:host3:+:host4:host5
47748 </literallayout>
47749 <para>
47750 The order of the first three hosts and the order of the last two hosts is
47751 randomized for each use, but the first three always end up before the last two.
47752 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
47753 </para>
47754 <para>
47755 <indexterm role="option">
47756 <primary><option>hosts_require_auth</option></primary>
47757 </indexterm>
47758 </para>
47759 <informaltable frame="all">
47760 <tgroup cols="4" colsep="0" rowsep="0">
47761 <colspec colwidth="8*" align="left"/>
47762 <colspec colwidth="6*" align="center"/>
47763 <colspec colwidth="6*" align="center"/>
47764 <colspec colwidth="6*" align="right"/>
47765 <tbody>
47766 <row>
47767 <entry><option>hosts_require_auth</option></entry>
47768 <entry>Use: <emphasis>smtp</emphasis></entry>
47769 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47770 <entry>Default: <emphasis>unset</emphasis></entry>
47771 </row>
47772 </tbody>
47773 </tgroup>
47774 </informaltable>
47775 <para>
47776 <indexterm role="concept">
47777 <primary>authentication</primary>
47778 <secondary>required by client</secondary>
47779 </indexterm>
47780 This option provides a list of servers for which authentication must succeed
47781 before Exim will try to transfer a message. If authentication fails for
47782 servers which are not in this list, Exim tries to send unauthenticated. If
47783 authentication fails for one of these servers, delivery is deferred. This
47784 temporary error is detectable in the retry rules, so it can be turned into a
47785 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
47786 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47787 </para>
47788 <para>
47789 <indexterm role="option">
47790 <primary><option>hosts_request_ocsp</option></primary>
47791 </indexterm>
47792 </para>
47793 <informaltable frame="all">
47794 <tgroup cols="4" colsep="0" rowsep="0">
47795 <colspec colwidth="8*" align="left"/>
47796 <colspec colwidth="6*" align="center"/>
47797 <colspec colwidth="6*" align="center"/>
47798 <colspec colwidth="6*" align="right"/>
47799 <tbody>
47800 <row>
47801 <entry><option>hosts_request_ocsp</option></entry>
47802 <entry>Use: <emphasis>smtp</emphasis></entry>
47803 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47804 <entry>Default: <emphasis>*</emphasis></entry>
47805 </row>
47806 </tbody>
47807 </tgroup>
47808 </informaltable>
47809 <para>
47810 <indexterm role="concept">
47811 <primary>TLS</primary>
47812 <secondary>requiring for certain servers</secondary>
47813 </indexterm>
47814 Exim will request a Certificate Status on a
47815 TLS session for any host that matches this list.
47816 <option>tls_verify_certificates</option> should also be set for the transport.
47817 </para>
47818 <para revisionflag="changed">
47819 <indexterm role="option">
47820 <primary><option>hosts_require_dane</option></primary>
47821 </indexterm>
47822 </para>
47823 <informaltable frame="all" revisionflag="changed">
47824 <tgroup cols="4" colsep="0" rowsep="0">
47825 <colspec colwidth="8*" align="left"/>
47826 <colspec colwidth="6*" align="center"/>
47827 <colspec colwidth="6*" align="center"/>
47828 <colspec colwidth="6*" align="right"/>
47829 <tbody>
47830 <row>
47831 <entry><option>hosts_require_dane</option></entry>
47832 <entry>Use: <emphasis>smtp</emphasis></entry>
47833 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47834 <entry>Default: <emphasis>unset</emphasis></entry>
47835 </row>
47836 </tbody>
47837 </tgroup>
47838 </informaltable>
47839 <para revisionflag="changed">
47840 <indexterm role="concept">
47841 <primary>DANE</primary>
47842 <secondary>transport options</secondary>
47843 </indexterm>
47844 <indexterm role="concept">
47845 <primary>DANE</primary>
47846 <secondary>requiring for certain servers</secondary>
47847 </indexterm>
47848 If built with DANE support, Exim  will require that a DNSSEC-validated
47849 TLSA record is present for any host matching the list,
47850 and that a DANE-verified TLS connection is made.
47851 There will be no fallback to in-clear communication.
47852 See section <xref linkend="SECDANE"/>.
47853 </para>
47854 <para>
47855 <indexterm role="option">
47856 <primary><option>hosts_require_ocsp</option></primary>
47857 </indexterm>
47858 </para>
47859 <informaltable frame="all">
47860 <tgroup cols="4" colsep="0" rowsep="0">
47861 <colspec colwidth="8*" align="left"/>
47862 <colspec colwidth="6*" align="center"/>
47863 <colspec colwidth="6*" align="center"/>
47864 <colspec colwidth="6*" align="right"/>
47865 <tbody>
47866 <row>
47867 <entry><option>hosts_require_ocsp</option></entry>
47868 <entry>Use: <emphasis>smtp</emphasis></entry>
47869 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47870 <entry>Default: <emphasis>unset</emphasis></entry>
47871 </row>
47872 </tbody>
47873 </tgroup>
47874 </informaltable>
47875 <para>
47876 <indexterm role="concept">
47877 <primary>TLS</primary>
47878 <secondary>requiring for certain servers</secondary>
47879 </indexterm>
47880 Exim will request, and check for a valid Certificate Status being given, on a
47881 TLS session for any host that matches this list.
47882 <option>tls_verify_certificates</option> should also be set for the transport.
47883 </para>
47884 <para>
47885 <indexterm role="option">
47886 <primary><option>hosts_require_tls</option></primary>
47887 </indexterm>
47888 </para>
47889 <informaltable frame="all">
47890 <tgroup cols="4" colsep="0" rowsep="0">
47891 <colspec colwidth="8*" align="left"/>
47892 <colspec colwidth="6*" align="center"/>
47893 <colspec colwidth="6*" align="center"/>
47894 <colspec colwidth="6*" align="right"/>
47895 <tbody>
47896 <row>
47897 <entry><option>hosts_require_tls</option></entry>
47898 <entry>Use: <emphasis>smtp</emphasis></entry>
47899 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47900 <entry>Default: <emphasis>unset</emphasis></entry>
47901 </row>
47902 </tbody>
47903 </tgroup>
47904 </informaltable>
47905 <para>
47906 <indexterm role="concept">
47907 <primary>TLS</primary>
47908 <secondary>requiring for certain servers</secondary>
47909 </indexterm>
47910 Exim will insist on using a TLS session when delivering to any host that
47911 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47912 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
47913 incoming messages, use an appropriate ACL.
47914 </para>
47915 <para>
47916 <indexterm role="option">
47917 <primary><option>hosts_try_auth</option></primary>
47918 </indexterm>
47919 </para>
47920 <informaltable frame="all">
47921 <tgroup cols="4" colsep="0" rowsep="0">
47922 <colspec colwidth="8*" align="left"/>
47923 <colspec colwidth="6*" align="center"/>
47924 <colspec colwidth="6*" align="center"/>
47925 <colspec colwidth="6*" align="right"/>
47926 <tbody>
47927 <row>
47928 <entry><option>hosts_try_auth</option></entry>
47929 <entry>Use: <emphasis>smtp</emphasis></entry>
47930 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47931 <entry>Default: <emphasis>unset</emphasis></entry>
47932 </row>
47933 </tbody>
47934 </tgroup>
47935 </informaltable>
47936 <para>
47937 <indexterm role="concept">
47938 <primary>authentication</primary>
47939 <secondary>optional in client</secondary>
47940 </indexterm>
47941 This option provides a list of servers to which, provided they announce
47942 authentication support, Exim will attempt to authenticate as a client when it
47943 connects. If authentication fails, Exim will try to transfer the message
47944 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
47945 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47946 </para>
47947 <para>
47948 <indexterm role="option">
47949 <primary><option>hosts_try_chunking</option></primary>
47950 </indexterm>
47951 </para>
47952 <informaltable frame="all">
47953 <tgroup cols="4" colsep="0" rowsep="0">
47954 <colspec colwidth="8*" align="left"/>
47955 <colspec colwidth="6*" align="center"/>
47956 <colspec colwidth="6*" align="center"/>
47957 <colspec colwidth="6*" align="right"/>
47958 <tbody>
47959 <row>
47960 <entry><option>hosts_try_chunking</option></entry>
47961 <entry>Use: <emphasis>smtp</emphasis></entry>
47962 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47963 <entry>Default: <emphasis>*</emphasis></entry>
47964 </row>
47965 </tbody>
47966 </tgroup>
47967 </informaltable>
47968 <para>
47969 <indexterm role="concept">
47970 <primary>CHUNKING</primary>
47971 <secondary>enabling, in client</secondary>
47972 </indexterm>
47973 <indexterm role="concept">
47974 <primary>BDAT</primary>
47975 <secondary>SMTP command</secondary>
47976 </indexterm>
47977 <indexterm role="concept">
47978 <primary>RFC 3030</primary>
47979 <secondary>CHUNKING</secondary>
47980 </indexterm>
47981 This option provides a list of servers to which, provided they announce
47982 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
47983 BDAT will not be used in conjunction with a transport filter.
47984 </para>
47985 <para revisionflag="changed">
47986 <indexterm role="option">
47987 <primary><option>hosts_try_dane</option></primary>
47988 </indexterm>
47989 </para>
47990 <informaltable frame="all" revisionflag="changed">
47991 <tgroup cols="4" colsep="0" rowsep="0">
47992 <colspec colwidth="8*" align="left"/>
47993 <colspec colwidth="6*" align="center"/>
47994 <colspec colwidth="6*" align="center"/>
47995 <colspec colwidth="6*" align="right"/>
47996 <tbody>
47997 <row>
47998 <entry><option>hosts_try_dane</option></entry>
47999 <entry>Use: <emphasis>smtp</emphasis></entry>
48000 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48001 <entry>Default: <emphasis>unset</emphasis></entry>
48002 </row>
48003 </tbody>
48004 </tgroup>
48005 </informaltable>
48006 <para revisionflag="changed">
48007 <indexterm role="concept">
48008 <primary>DANE</primary>
48009 <secondary>transport options</secondary>
48010 </indexterm>
48011 <indexterm role="concept">
48012 <primary>DANE</primary>
48013 <secondary>attempting for certain servers</secondary>
48014 </indexterm>
48015 If built with DANE support, Exim  will lookup a
48016 TLSA record for any host matching the list.
48017 If found and verified by DNSSEC,
48018 a DANE-verified TLS connection is made to that host;
48019 there will be no fallback to in-clear communication.
48020 See section <xref linkend="SECDANE"/>.
48021 </para>
48022 <para>
48023 <indexterm role="option">
48024 <primary><option>hosts_try_fastopen</option></primary>
48025 </indexterm>
48026 </para>
48027 <informaltable frame="all">
48028 <tgroup cols="4" colsep="0" rowsep="0">
48029 <colspec colwidth="8*" align="left"/>
48030 <colspec colwidth="6*" align="center"/>
48031 <colspec colwidth="6*" align="center"/>
48032 <colspec colwidth="6*" align="right"/>
48033 <tbody>
48034 <row>
48035 <entry><option>hosts_try_fastopen</option></entry>
48036 <entry>Use: <emphasis>smtp</emphasis></entry>
48037 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48038 <entry>Default: <emphasis>unset</emphasis></entry>
48039 </row>
48040 </tbody>
48041 </tgroup>
48042 </informaltable>
48043 <para>
48044 <indexterm role="concept">
48045 <primary>fast open, TCP</primary>
48046 <secondary>enabling, in client</secondary>
48047 </indexterm>
48048 <indexterm role="concept">
48049 <primary>TCP Fast Open</primary>
48050 <secondary>enabling, in client</secondary>
48051 </indexterm>
48052 <indexterm role="concept">
48053 <primary>RFC 7413</primary>
48054 <secondary>TCP Fast Open</secondary>
48055 </indexterm>
48056 This option provides a list of servers to which, provided
48057 the facility is supported by this system, Exim will attempt to
48058 perform a TCP Fast Open.
48059 No data is sent on the SYN segment but, if the remote server also
48060 supports the facility, it can send its SMTP banner immediately after
48061 the SYN,ACK segment.  This can save up to one round-trip time.
48062 </para>
48063 <para>
48064 The facility is only active for previously-contacted servers,
48065 as the initiator must present a cookie in the SYN segment.
48066 </para>
48067 <para>
48068 On (at least some) current Linux distributions the facility must be enabled
48069 in the kernel by the sysadmin before the support is usable.
48070 There is no option for control of the server side; if the system supports
48071 it it is always enabled.  Note that lengthy operations in the connect ACL,
48072 such as DNSBL lookups, will still delay the emission of the SMTP banner.
48073 </para>
48074 <para>
48075 <indexterm role="option">
48076 <primary><option>hosts_try_prdr</option></primary>
48077 </indexterm>
48078 </para>
48079 <informaltable frame="all">
48080 <tgroup cols="4" colsep="0" rowsep="0">
48081 <colspec colwidth="8*" align="left"/>
48082 <colspec colwidth="6*" align="center"/>
48083 <colspec colwidth="6*" align="center"/>
48084 <colspec colwidth="6*" align="right"/>
48085 <tbody>
48086 <row>
48087 <entry><option>hosts_try_prdr</option></entry>
48088 <entry>Use: <emphasis>smtp</emphasis></entry>
48089 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48090 <entry>Default: <emphasis>*</emphasis></entry>
48091 </row>
48092 </tbody>
48093 </tgroup>
48094 </informaltable>
48095 <para>
48096 <indexterm role="concept">
48097 <primary>PRDR</primary>
48098 <secondary>enabling, optional in client</secondary>
48099 </indexterm>
48100 This option provides a list of servers to which, provided they announce
48101 PRDR support, Exim will attempt to negotiate PRDR
48102 for multi-recipient messages.
48103 The option can usually be left as default.
48104 </para>
48105 <para>
48106 <indexterm role="option">
48107 <primary><option>interface</option></primary>
48108 </indexterm>
48109 </para>
48110 <informaltable frame="all">
48111 <tgroup cols="4" colsep="0" rowsep="0">
48112 <colspec colwidth="8*" align="left"/>
48113 <colspec colwidth="6*" align="center"/>
48114 <colspec colwidth="6*" align="center"/>
48115 <colspec colwidth="6*" align="right"/>
48116 <tbody>
48117 <row>
48118 <entry><option>interface</option></entry>
48119 <entry>Use: <emphasis>smtp</emphasis></entry>
48120 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
48121 <entry>Default: <emphasis>unset</emphasis></entry>
48122 </row>
48123 </tbody>
48124 </tgroup>
48125 </informaltable>
48126 <para>
48127 <indexterm role="concept">
48128 <primary>bind IP address</primary>
48129 </indexterm>
48130 <indexterm role="concept">
48131 <primary>IP address</primary>
48132 <secondary>binding</secondary>
48133 </indexterm>
48134 <indexterm role="variable">
48135 <primary><varname>$host</varname></primary>
48136 </indexterm>
48137 <indexterm role="variable">
48138 <primary><varname>$host_address</varname></primary>
48139 </indexterm>
48140 This option specifies which interface to bind to when making an outgoing SMTP
48141 call. The value is an IP address, not an interface name such as
48142 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
48143 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
48144 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
48145 outgoing interface address. There is no variable that contains an outgoing
48146 interface address because, unless it is set by this option, its value is
48147 unknown.
48148 </para>
48149 <para>
48150 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
48151 <varname>$host_address</varname> refer to the host to which a connection is about to be made
48152 during the expansion of the string. Forced expansion failure, or an empty
48153 string result causes the option to be ignored. Otherwise, after expansion, the
48154 string must be a list of IP addresses, colon-separated by default, but the
48155 separator can be changed in the usual way. For example:
48156 </para>
48157 <literallayout class="monospaced">
48158 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
48159 </literallayout>
48160 <para>
48161 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
48162 connection. If none of them are the correct type, the option is ignored. If
48163 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
48164 interface to use if the host has more than one.
48165 </para>
48166 <para>
48167 <indexterm role="option">
48168 <primary><option>keepalive</option></primary>
48169 </indexterm>
48170 </para>
48171 <informaltable frame="all">
48172 <tgroup cols="4" colsep="0" rowsep="0">
48173 <colspec colwidth="8*" align="left"/>
48174 <colspec colwidth="6*" align="center"/>
48175 <colspec colwidth="6*" align="center"/>
48176 <colspec colwidth="6*" align="right"/>
48177 <tbody>
48178 <row>
48179 <entry><option>keepalive</option></entry>
48180 <entry>Use: <emphasis>smtp</emphasis></entry>
48181 <entry>Type: <emphasis>boolean</emphasis></entry>
48182 <entry>Default: <emphasis>true</emphasis></entry>
48183 </row>
48184 </tbody>
48185 </tgroup>
48186 </informaltable>
48187 <para>
48188 <indexterm role="concept">
48189 <primary>keepalive</primary>
48190 <secondary>on outgoing connection</secondary>
48191 </indexterm>
48192 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
48193 connections. When set, it causes the kernel to probe idle connections
48194 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
48195 of the connection should send a acknowledgment if the connection is still okay
48196 or a reset if the connection has been aborted. The reason for doing this is
48197 that it has the beneficial effect of freeing up certain types of connection
48198 that can get stuck when the remote host is disconnected without tidying up the
48199 TCP/IP call properly. The keepalive mechanism takes several hours to detect
48200 unreachable hosts.
48201 </para>
48202 <para>
48203 <indexterm role="option">
48204 <primary><option>lmtp_ignore_quota</option></primary>
48205 </indexterm>
48206 </para>
48207 <informaltable frame="all">
48208 <tgroup cols="4" colsep="0" rowsep="0">
48209 <colspec colwidth="8*" align="left"/>
48210 <colspec colwidth="6*" align="center"/>
48211 <colspec colwidth="6*" align="center"/>
48212 <colspec colwidth="6*" align="right"/>
48213 <tbody>
48214 <row>
48215 <entry><option>lmtp_ignore_quota</option></entry>
48216 <entry>Use: <emphasis>smtp</emphasis></entry>
48217 <entry>Type: <emphasis>boolean</emphasis></entry>
48218 <entry>Default: <emphasis>false</emphasis></entry>
48219 </row>
48220 </tbody>
48221 </tgroup>
48222 </informaltable>
48223 <para>
48224 <indexterm role="concept">
48225 <primary>LMTP</primary>
48226 <secondary>ignoring quota errors</secondary>
48227 </indexterm>
48228 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
48229 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
48230 has advertised support for IGNOREQUOTA in its response to the LHLO command.
48231 </para>
48232 <para>
48233 <indexterm role="option">
48234 <primary><option>max_rcpt</option></primary>
48235 </indexterm>
48236 </para>
48237 <informaltable frame="all">
48238 <tgroup cols="4" colsep="0" rowsep="0">
48239 <colspec colwidth="8*" align="left"/>
48240 <colspec colwidth="6*" align="center"/>
48241 <colspec colwidth="6*" align="center"/>
48242 <colspec colwidth="6*" align="right"/>
48243 <tbody>
48244 <row>
48245 <entry><option>max_rcpt</option></entry>
48246 <entry>Use: <emphasis>smtp</emphasis></entry>
48247 <entry>Type: <emphasis>integer</emphasis></entry>
48248 <entry>Default: <emphasis>100</emphasis></entry>
48249 </row>
48250 </tbody>
48251 </tgroup>
48252 </informaltable>
48253 <para>
48254 <indexterm role="concept">
48255 <primary>RCPT</primary>
48256 <secondary>maximum number of outgoing</secondary>
48257 </indexterm>
48258 This option limits the number of RCPT commands that are sent in a single
48259 SMTP message transaction. Each set of addresses is treated independently, and
48260 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
48261 permits this.
48262 </para>
48263 <para>
48264 <indexterm role="option">
48265 <primary><option>multi_domain</option></primary>
48266 </indexterm>
48267 </para>
48268 <informaltable frame="all">
48269 <tgroup cols="4" colsep="0" rowsep="0">
48270 <colspec colwidth="8*" align="left"/>
48271 <colspec colwidth="6*" align="center"/>
48272 <colspec colwidth="6*" align="center"/>
48273 <colspec colwidth="6*" align="right"/>
48274 <tbody>
48275 <row>
48276 <entry><option>multi_domain</option></entry>
48277 <entry>Use: <emphasis>smtp</emphasis></entry>
48278 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
48279 <entry>Default: <emphasis>true</emphasis></entry>
48280 </row>
48281 </tbody>
48282 </tgroup>
48283 </informaltable>
48284 <para>
48285 <indexterm role="variable">
48286 <primary><varname>$domain</varname></primary>
48287 </indexterm>
48288 When this option is set, the <command>smtp</command> transport can handle a number of
48289 addresses containing a mixture of different domains provided they all resolve
48290 to the same list of hosts. Turning the option off restricts the transport to
48291 handling only one domain at a time. This is useful if you want to use
48292 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
48293 is a single domain involved in a remote delivery.
48294 </para>
48295 <para>
48296 It is expanded per-address and can depend on any of
48297 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
48298 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
48299 </para>
48300 <para>
48301 <indexterm role="option">
48302 <primary><option>port</option></primary>
48303 </indexterm>
48304 </para>
48305 <informaltable frame="all">
48306 <tgroup cols="4" colsep="0" rowsep="0">
48307 <colspec colwidth="8*" align="left"/>
48308 <colspec colwidth="6*" align="center"/>
48309 <colspec colwidth="6*" align="center"/>
48310 <colspec colwidth="6*" align="right"/>
48311 <tbody>
48312 <row>
48313 <entry><option>port</option></entry>
48314 <entry>Use: <emphasis>smtp</emphasis></entry>
48315 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48316 <entry>Default: <emphasis>see below</emphasis></entry>
48317 </row>
48318 </tbody>
48319 </tgroup>
48320 </informaltable>
48321 <para>
48322 <indexterm role="concept">
48323 <primary>port</primary>
48324 <secondary>sending TCP/IP</secondary>
48325 </indexterm>
48326 <indexterm role="concept">
48327 <primary>TCP/IP</primary>
48328 <secondary>setting outgoing port</secondary>
48329 </indexterm>
48330 This option specifies the TCP/IP port on the server to which Exim connects.
48331 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
48332 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
48333 The name was changed to minimize confusion with the outgoing port. There is no
48334 variable that contains an outgoing port.
48335 </para>
48336 <para>
48337 If the value of this option begins with a digit it is taken as a port number;
48338 otherwise it is looked up using <function>getservbyname()</function>. The default value is
48339 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
48340 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
48341 is deferred.
48342 </para>
48343 <para>
48344 <indexterm role="option">
48345 <primary><option>protocol</option></primary>
48346 </indexterm>
48347 </para>
48348 <informaltable frame="all">
48349 <tgroup cols="4" colsep="0" rowsep="0">
48350 <colspec colwidth="8*" align="left"/>
48351 <colspec colwidth="6*" align="center"/>
48352 <colspec colwidth="6*" align="center"/>
48353 <colspec colwidth="6*" align="right"/>
48354 <tbody>
48355 <row>
48356 <entry><option>protocol</option></entry>
48357 <entry>Use: <emphasis>smtp</emphasis></entry>
48358 <entry>Type: <emphasis>string</emphasis></entry>
48359 <entry>Default: <emphasis>smtp</emphasis></entry>
48360 </row>
48361 </tbody>
48362 </tgroup>
48363 </informaltable>
48364 <para>
48365 <indexterm role="concept">
48366 <primary>LMTP</primary>
48367 <secondary>over TCP/IP</secondary>
48368 </indexterm>
48369 <indexterm role="concept">
48370 <primary>ssmtp protocol</primary>
48371 <secondary>outbound</secondary>
48372 </indexterm>
48373 <indexterm role="concept">
48374 <primary>TLS</primary>
48375 <secondary>SSL-on-connect outbound</secondary>
48376 </indexterm>
48377 <indexterm role="variable">
48378 <primary><varname>$port</varname></primary>
48379 </indexterm>
48380 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
48381 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
48382 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
48383 deliveries into closed message stores. Exim also has support for running LMTP
48384 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
48385 </para>
48386 <para>
48387 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
48388 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
48389 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
48390 The Internet standards bodies strongly discourage use of this mode.
48391 </para>
48392 <para>
48393 <indexterm role="option">
48394 <primary><option>retry_include_ip_address</option></primary>
48395 </indexterm>
48396 </para>
48397 <informaltable frame="all">
48398 <tgroup cols="4" colsep="0" rowsep="0">
48399 <colspec colwidth="8*" align="left"/>
48400 <colspec colwidth="6*" align="center"/>
48401 <colspec colwidth="6*" align="center"/>
48402 <colspec colwidth="6*" align="right"/>
48403 <tbody>
48404 <row>
48405 <entry><option>retry_include_ip_address</option></entry>
48406 <entry>Use: <emphasis>smtp</emphasis></entry>
48407 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
48408 <entry>Default: <emphasis>true</emphasis></entry>
48409 </row>
48410 </tbody>
48411 </tgroup>
48412 </informaltable>
48413 <para>
48414 Exim normally includes both the host name and the IP address in the key it
48415 constructs for indexing retry data after a temporary delivery failure. This
48416 means that when one of several IP addresses for a host is failing, it gets
48417 tried periodically (controlled by the retry rules), but use of the other IP
48418 addresses is not affected.
48419 </para>
48420 <para>
48421 However, in some dialup environments hosts are assigned a different IP address
48422 each time they connect. In this situation the use of the IP address as part of
48423 the retry key leads to undesirable behaviour. Setting this option false causes
48424 Exim to use only the host name.
48425 Since it is expanded it can be made to depend on the host or domain.
48426 </para>
48427 <para>
48428 <indexterm role="option">
48429 <primary><option>serialize_hosts</option></primary>
48430 </indexterm>
48431 </para>
48432 <informaltable frame="all">
48433 <tgroup cols="4" colsep="0" rowsep="0">
48434 <colspec colwidth="8*" align="left"/>
48435 <colspec colwidth="6*" align="center"/>
48436 <colspec colwidth="6*" align="center"/>
48437 <colspec colwidth="6*" align="right"/>
48438 <tbody>
48439 <row>
48440 <entry><option>serialize_hosts</option></entry>
48441 <entry>Use: <emphasis>smtp</emphasis></entry>
48442 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48443 <entry>Default: <emphasis>unset</emphasis></entry>
48444 </row>
48445 </tbody>
48446 </tgroup>
48447 </informaltable>
48448 <para>
48449 <indexterm role="concept">
48450 <primary>serializing connections</primary>
48451 </indexterm>
48452 <indexterm role="concept">
48453 <primary>host</primary>
48454 <secondary>serializing connections</secondary>
48455 </indexterm>
48456 Because Exim operates in a distributed manner, if several messages for the same
48457 host arrive at around the same time, more than one simultaneous connection to
48458 the remote host can occur. This is not usually a problem except when there is a
48459 slow link between the hosts. In that situation it may be helpful to restrict
48460 Exim to one connection at a time. This can be done by setting
48461 <option>serialize_hosts</option> to match the relevant hosts.
48462 </para>
48463 <para>
48464 <indexterm role="concept">
48465 <primary>hints database</primary>
48466 <secondary>serializing deliveries to a host</secondary>
48467 </indexterm>
48468 Exim implements serialization by means of a hints database in which a record is
48469 written whenever a process connects to one of the restricted hosts. The record
48470 is deleted when the connection is completed. Obviously there is scope for
48471 records to get left lying around if there is a system or program crash. To
48472 guard against this, Exim ignores any records that are more than six hours old.
48473 </para>
48474 <para>
48475 If you set up this kind of serialization, you should also arrange to delete the
48476 relevant hints database whenever your system reboots. The names of the files
48477 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
48478 may be one or two files, depending on the type of DBM in use. The same files
48479 are used for ETRN serialization.
48480 </para>
48481 <para>
48482 See also the <option>max_parallel</option> generic transport option.
48483 </para>
48484 <para>
48485 <indexterm role="option">
48486 <primary><option>size_addition</option></primary>
48487 </indexterm>
48488 </para>
48489 <informaltable frame="all">
48490 <tgroup cols="4" colsep="0" rowsep="0">
48491 <colspec colwidth="8*" align="left"/>
48492 <colspec colwidth="6*" align="center"/>
48493 <colspec colwidth="6*" align="center"/>
48494 <colspec colwidth="6*" align="right"/>
48495 <tbody>
48496 <row>
48497 <entry><option>size_addition</option></entry>
48498 <entry>Use: <emphasis>smtp</emphasis></entry>
48499 <entry>Type: <emphasis>integer</emphasis></entry>
48500 <entry>Default: <emphasis>1024</emphasis></entry>
48501 </row>
48502 </tbody>
48503 </tgroup>
48504 </informaltable>
48505 <para>
48506 <indexterm role="concept">
48507 <primary>SMTP</primary>
48508 <secondary>SIZE</secondary>
48509 </indexterm>
48510 <indexterm role="concept">
48511 <primary>message</primary>
48512 <secondary>size issue for transport filter</secondary>
48513 </indexterm>
48514 <indexterm role="concept">
48515 <primary>size</primary>
48516 <secondary>of message</secondary>
48517 </indexterm>
48518 <indexterm role="concept">
48519 <primary>transport</primary>
48520 <secondary>filter</secondary>
48521 </indexterm>
48522 <indexterm role="concept">
48523 <primary>filter</primary>
48524 <secondary>transport filter</secondary>
48525 </indexterm>
48526 If a remote SMTP server indicates that it supports the SIZE option of the
48527 MAIL command, Exim uses this to pass over the message size at the start of
48528 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
48529 sends, to allow for headers and other text that may be added during delivery by
48530 configuration options or in a transport filter. It may be necessary to increase
48531 this if a lot of text is added to messages.
48532 </para>
48533 <para>
48534 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
48535 the use of the SIZE option altogether.
48536 </para>
48537 <para>
48538 <indexterm role="option">
48539 <primary><option>socks_proxy</option></primary>
48540 </indexterm>
48541 </para>
48542 <informaltable frame="all">
48543 <tgroup cols="4" colsep="0" rowsep="0">
48544 <colspec colwidth="8*" align="left"/>
48545 <colspec colwidth="6*" align="center"/>
48546 <colspec colwidth="6*" align="center"/>
48547 <colspec colwidth="6*" align="right"/>
48548 <tbody>
48549 <row>
48550 <entry><option>socks_proxy</option></entry>
48551 <entry>Use: <emphasis>smtp</emphasis></entry>
48552 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48553 <entry>Default: <emphasis>unset</emphasis></entry>
48554 </row>
48555 </tbody>
48556 </tgroup>
48557 </informaltable>
48558 <para>
48559 <indexterm role="concept">
48560 <primary>proxy</primary>
48561 <secondary>SOCKS</secondary>
48562 </indexterm>
48563 This option enables use of SOCKS proxies for connections made by the
48564 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
48565 </para>
48566 <para>
48567 <indexterm role="option">
48568 <primary><option>tls_certificate</option></primary>
48569 </indexterm>
48570 </para>
48571 <informaltable frame="all">
48572 <tgroup cols="4" colsep="0" rowsep="0">
48573 <colspec colwidth="8*" align="left"/>
48574 <colspec colwidth="6*" align="center"/>
48575 <colspec colwidth="6*" align="center"/>
48576 <colspec colwidth="6*" align="right"/>
48577 <tbody>
48578 <row>
48579 <entry><option>tls_certificate</option></entry>
48580 <entry>Use: <emphasis>smtp</emphasis></entry>
48581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48582 <entry>Default: <emphasis>unset</emphasis></entry>
48583 </row>
48584 </tbody>
48585 </tgroup>
48586 </informaltable>
48587 <para>
48588 <indexterm role="concept">
48589 <primary>TLS</primary>
48590 <secondary>client certificate, location of</secondary>
48591 </indexterm>
48592 <indexterm role="concept">
48593 <primary>certificate</primary>
48594 <secondary>client, location of</secondary>
48595 </indexterm>
48596 <indexterm role="variable">
48597 <primary><varname>$host</varname></primary>
48598 </indexterm>
48599 <indexterm role="variable">
48600 <primary><varname>$host_address</varname></primary>
48601 </indexterm>
48602 The value of this option must be the absolute path to a file which contains the
48603 client&#x2019;s certificate, for possible use when sending a message over an encrypted
48604 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
48605 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
48606 details of TLS.
48607 </para>
48608 <para>
48609 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
48610 certificate when sending messages as a client. The global option of the same
48611 name specifies the certificate for Exim as a server; it is not automatically
48612 assumed that the same certificate should be used when Exim is operating as a
48613 client.
48614 </para>
48615 <para>
48616 <indexterm role="option">
48617 <primary><option>tls_crl</option></primary>
48618 </indexterm>
48619 </para>
48620 <informaltable frame="all">
48621 <tgroup cols="4" colsep="0" rowsep="0">
48622 <colspec colwidth="8*" align="left"/>
48623 <colspec colwidth="6*" align="center"/>
48624 <colspec colwidth="6*" align="center"/>
48625 <colspec colwidth="6*" align="right"/>
48626 <tbody>
48627 <row>
48628 <entry><option>tls_crl</option></entry>
48629 <entry>Use: <emphasis>smtp</emphasis></entry>
48630 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48631 <entry>Default: <emphasis>unset</emphasis></entry>
48632 </row>
48633 </tbody>
48634 </tgroup>
48635 </informaltable>
48636 <para>
48637 <indexterm role="concept">
48638 <primary>TLS</primary>
48639 <secondary>client certificate revocation list</secondary>
48640 </indexterm>
48641 <indexterm role="concept">
48642 <primary>certificate</primary>
48643 <secondary>revocation list for client</secondary>
48644 </indexterm>
48645 This option specifies a certificate revocation list. The expanded value must
48646 be the name of a file that contains a CRL in PEM format.
48647 </para>
48648 <para>
48649 <indexterm role="option">
48650 <primary><option>tls_dh_min_bits</option></primary>
48651 </indexterm>
48652 </para>
48653 <informaltable frame="all">
48654 <tgroup cols="4" colsep="0" rowsep="0">
48655 <colspec colwidth="8*" align="left"/>
48656 <colspec colwidth="6*" align="center"/>
48657 <colspec colwidth="6*" align="center"/>
48658 <colspec colwidth="6*" align="right"/>
48659 <tbody>
48660 <row>
48661 <entry><option>tls_dh_min_bits</option></entry>
48662 <entry>Use: <emphasis>smtp</emphasis></entry>
48663 <entry>Type: <emphasis>integer</emphasis></entry>
48664 <entry>Default: <emphasis>1024</emphasis></entry>
48665 </row>
48666 </tbody>
48667 </tgroup>
48668 </informaltable>
48669 <para>
48670 <indexterm role="concept">
48671 <primary>TLS</primary>
48672 <secondary>Diffie-Hellman minimum acceptable size</secondary>
48673 </indexterm>
48674 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
48675 key agreement is negotiated, the server will provide a large prime number
48676 for use.  This option establishes the minimum acceptable size of that number.
48677 If the parameter offered by the server is too small, then the TLS handshake
48678 will fail.
48679 </para>
48680 <para>
48681 Only supported when using GnuTLS.
48682 </para>
48683 <para>
48684 <indexterm role="option">
48685 <primary><option>tls_privatekey</option></primary>
48686 </indexterm>
48687 </para>
48688 <informaltable frame="all">
48689 <tgroup cols="4" colsep="0" rowsep="0">
48690 <colspec colwidth="8*" align="left"/>
48691 <colspec colwidth="6*" align="center"/>
48692 <colspec colwidth="6*" align="center"/>
48693 <colspec colwidth="6*" align="right"/>
48694 <tbody>
48695 <row>
48696 <entry><option>tls_privatekey</option></entry>
48697 <entry>Use: <emphasis>smtp</emphasis></entry>
48698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48699 <entry>Default: <emphasis>unset</emphasis></entry>
48700 </row>
48701 </tbody>
48702 </tgroup>
48703 </informaltable>
48704 <para>
48705 <indexterm role="concept">
48706 <primary>TLS</primary>
48707 <secondary>client private key, location of</secondary>
48708 </indexterm>
48709 <indexterm role="variable">
48710 <primary><varname>$host</varname></primary>
48711 </indexterm>
48712 <indexterm role="variable">
48713 <primary><varname>$host_address</varname></primary>
48714 </indexterm>
48715 The value of this option must be the absolute path to a file which contains the
48716 client&#x2019;s private key. This is used when sending a message over an encrypted
48717 connection using a client certificate. The values of <varname>$host</varname> and
48718 <varname>$host_address</varname> are set to the name and address of the server during the
48719 expansion. If this option is unset, or the expansion is forced to fail, or the
48720 result is an empty string, the private key is assumed to be in the same file as
48721 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48722 </para>
48723 <para>
48724 <indexterm role="option">
48725 <primary><option>tls_require_ciphers</option></primary>
48726 </indexterm>
48727 </para>
48728 <informaltable frame="all">
48729 <tgroup cols="4" colsep="0" rowsep="0">
48730 <colspec colwidth="8*" align="left"/>
48731 <colspec colwidth="6*" align="center"/>
48732 <colspec colwidth="6*" align="center"/>
48733 <colspec colwidth="6*" align="right"/>
48734 <tbody>
48735 <row>
48736 <entry><option>tls_require_ciphers</option></entry>
48737 <entry>Use: <emphasis>smtp</emphasis></entry>
48738 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48739 <entry>Default: <emphasis>unset</emphasis></entry>
48740 </row>
48741 </tbody>
48742 </tgroup>
48743 </informaltable>
48744 <para>
48745 <indexterm role="concept">
48746 <primary>TLS</primary>
48747 <secondary>requiring specific ciphers</secondary>
48748 </indexterm>
48749 <indexterm role="concept">
48750 <primary>cipher</primary>
48751 <secondary>requiring specific</secondary>
48752 </indexterm>
48753 <indexterm role="variable">
48754 <primary><varname>$host</varname></primary>
48755 </indexterm>
48756 <indexterm role="variable">
48757 <primary><varname>$host_address</varname></primary>
48758 </indexterm>
48759 The value of this option must be a list of permitted cipher suites, for use
48760 when setting up an outgoing encrypted connection. (There is a global option of
48761 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
48762 <varname>$host_address</varname> are set to the name and address of the server during the
48763 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
48764 is used in different ways by OpenSSL and GnuTLS (see sections
48765 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
48766 ciphers is a preference order.
48767 </para>
48768 <para>
48769 <indexterm role="option">
48770 <primary><option>tls_sni</option></primary>
48771 </indexterm>
48772 </para>
48773 <informaltable frame="all">
48774 <tgroup cols="4" colsep="0" rowsep="0">
48775 <colspec colwidth="8*" align="left"/>
48776 <colspec colwidth="6*" align="center"/>
48777 <colspec colwidth="6*" align="center"/>
48778 <colspec colwidth="6*" align="right"/>
48779 <tbody>
48780 <row>
48781 <entry><option>tls_sni</option></entry>
48782 <entry>Use: <emphasis>smtp</emphasis></entry>
48783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48784 <entry>Default: <emphasis>unset</emphasis></entry>
48785 </row>
48786 </tbody>
48787 </tgroup>
48788 </informaltable>
48789 <para>
48790 <indexterm role="concept">
48791 <primary>TLS</primary>
48792 <secondary>Server Name Indication</secondary>
48793 </indexterm>
48794 <indexterm role="variable">
48795 <primary><varname>$tls_sni</varname></primary>
48796 </indexterm>
48797 If this option is set then it sets the $tls_out_sni variable and causes any
48798 TLS session to pass this value as the Server Name Indication extension to
48799 the remote side, which can be used by the remote side to select an appropriate
48800 certificate and private key for the session.
48801 </para>
48802 <para>
48803 See <xref linkend="SECTtlssni"/> for more information.
48804 </para>
48805 <para>
48806 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
48807 TLS extensions.
48808 </para>
48809 <para>
48810 <indexterm role="option">
48811 <primary><option>tls_tempfail_tryclear</option></primary>
48812 </indexterm>
48813 </para>
48814 <informaltable frame="all">
48815 <tgroup cols="4" colsep="0" rowsep="0">
48816 <colspec colwidth="8*" align="left"/>
48817 <colspec colwidth="6*" align="center"/>
48818 <colspec colwidth="6*" align="center"/>
48819 <colspec colwidth="6*" align="right"/>
48820 <tbody>
48821 <row>
48822 <entry><option>tls_tempfail_tryclear</option></entry>
48823 <entry>Use: <emphasis>smtp</emphasis></entry>
48824 <entry>Type: <emphasis>boolean</emphasis></entry>
48825 <entry>Default: <emphasis>true</emphasis></entry>
48826 </row>
48827 </tbody>
48828 </tgroup>
48829 </informaltable>
48830 <para>
48831 <indexterm role="concept">
48832 <primary>4<emphasis>xx</emphasis> responses</primary>
48833 <secondary>to STARTTLS</secondary>
48834 </indexterm>
48835 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
48836 setting up a TLS session, this option determines whether or not Exim should try
48837 to deliver the message unencrypted. If it is set false, delivery to the
48838 current host is deferred; if there are other hosts, they are tried. If this
48839 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
48840 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
48841 TLS negotiation fails, Exim closes the current connection (because it is in an
48842 unknown state), opens a new one to the same host, and then tries the delivery
48843 in clear.
48844 </para>
48845 <para>
48846 <indexterm role="option">
48847 <primary><option>tls_try_verify_hosts</option></primary>
48848 </indexterm>
48849 </para>
48850 <informaltable frame="all">
48851 <tgroup cols="4" colsep="0" rowsep="0">
48852 <colspec colwidth="8*" align="left"/>
48853 <colspec colwidth="6*" align="center"/>
48854 <colspec colwidth="6*" align="center"/>
48855 <colspec colwidth="6*" align="right"/>
48856 <tbody>
48857 <row>
48858 <entry><option>tls_try_verify_hosts</option></entry>
48859 <entry>Use: <emphasis>smtp</emphasis></entry>
48860 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48861 <entry>Default: <emphasis>*</emphasis></entry>
48862 </row>
48863 </tbody>
48864 </tgroup>
48865 </informaltable>
48866 <para>
48867 <indexterm role="concept">
48868 <primary>TLS</primary>
48869 <secondary>server certificate verification</secondary>
48870 </indexterm>
48871 <indexterm role="concept">
48872 <primary>certificate</primary>
48873 <secondary>verification of server</secondary>
48874 </indexterm>
48875 This option gives a list of hosts for which, on encrypted connections,
48876 certificate verification will be tried but need not succeed.
48877 The <option>tls_verify_certificates</option> option must also be set.
48878 Note that unless the host is in this list
48879 TLS connections will be denied to hosts using self-signed certificates
48880 when <option>tls_verify_certificates</option> is matched.
48881 The <varname>$tls_out_certificate_verified</varname> variable is set when
48882 certificate verification succeeds.
48883 </para>
48884 <para>
48885 <indexterm role="option">
48886 <primary><option>tls_verify_cert_hostnames</option></primary>
48887 </indexterm>
48888 </para>
48889 <informaltable frame="all">
48890 <tgroup cols="4" colsep="0" rowsep="0">
48891 <colspec colwidth="8*" align="left"/>
48892 <colspec colwidth="6*" align="center"/>
48893 <colspec colwidth="6*" align="center"/>
48894 <colspec colwidth="6*" align="right"/>
48895 <tbody>
48896 <row>
48897 <entry><option>tls_verify_cert_hostnames</option></entry>
48898 <entry>Use: <emphasis>smtp</emphasis></entry>
48899 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48900 <entry>Default: <emphasis>*</emphasis></entry>
48901 </row>
48902 </tbody>
48903 </tgroup>
48904 </informaltable>
48905 <para>
48906 <indexterm role="concept">
48907 <primary>TLS</primary>
48908 <secondary>server certificate hostname verification</secondary>
48909 </indexterm>
48910 <indexterm role="concept">
48911 <primary>certificate</primary>
48912 <secondary>verification of server</secondary>
48913 </indexterm>
48914 This option give a list of hosts for which,
48915 while verifying the server certificate,
48916 checks will be included on the host name
48917 (note that this will generally be the result of a DNS MX lookup)
48918 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
48919 limited to being the initial component of a 3-or-more component FQDN.
48920 </para>
48921 <para>
48922 There is no equivalent checking on client certificates.
48923 </para>
48924 <para>
48925 <indexterm role="option">
48926 <primary><option>tls_verify_certificates</option></primary>
48927 </indexterm>
48928 </para>
48929 <informaltable frame="all">
48930 <tgroup cols="4" colsep="0" rowsep="0">
48931 <colspec colwidth="8*" align="left"/>
48932 <colspec colwidth="6*" align="center"/>
48933 <colspec colwidth="6*" align="center"/>
48934 <colspec colwidth="6*" align="right"/>
48935 <tbody>
48936 <row>
48937 <entry><option>tls_verify_certificates</option></entry>
48938 <entry>Use: <emphasis>smtp</emphasis></entry>
48939 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48940 <entry>Default: <emphasis>system</emphasis></entry>
48941 </row>
48942 </tbody>
48943 </tgroup>
48944 </informaltable>
48945 <para>
48946 <indexterm role="concept">
48947 <primary>TLS</primary>
48948 <secondary>server certificate verification</secondary>
48949 </indexterm>
48950 <indexterm role="concept">
48951 <primary>certificate</primary>
48952 <secondary>verification of server</secondary>
48953 </indexterm>
48954 <indexterm role="variable">
48955 <primary><varname>$host</varname></primary>
48956 </indexterm>
48957 <indexterm role="variable">
48958 <primary><varname>$host_address</varname></primary>
48959 </indexterm>
48960 The value of this option must be either the
48961 word "system"
48962 or the absolute path to
48963 a file or directory containing permitted certificates for servers,
48964 for use when setting up an encrypted connection.
48965 </para>
48966 <para>
48967 The "system" value for the option will use a location compiled into the SSL library.
48968 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
48969 is taken as empty and an explicit location
48970 must be specified.
48971 </para>
48972 <para>
48973 The use of a directory for the option value is not available for GnuTLS versions
48974 preceding 3.3.6 and a single file must be used.
48975 </para>
48976 <para>
48977 With OpenSSL the certificates specified
48978 explicitly
48979 either by file or directory
48980 are added to those given by the system default location.
48981 </para>
48982 <para>
48983 The values of <varname>$host</varname> and
48984 <varname>$host_address</varname> are set to the name and address of the server during the
48985 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48986 </para>
48987 <para>
48988 For back-compatibility,
48989 if neither tls_verify_hosts nor tls_try_verify_hosts are set
48990 (a single-colon empty list counts as being set)
48991 and certificate verification fails the TLS connection is closed.
48992 </para>
48993 <para>
48994 <indexterm role="option">
48995 <primary><option>tls_verify_hosts</option></primary>
48996 </indexterm>
48997 </para>
48998 <informaltable frame="all">
48999 <tgroup cols="4" colsep="0" rowsep="0">
49000 <colspec colwidth="8*" align="left"/>
49001 <colspec colwidth="6*" align="center"/>
49002 <colspec colwidth="6*" align="center"/>
49003 <colspec colwidth="6*" align="right"/>
49004 <tbody>
49005 <row>
49006 <entry><option>tls_verify_hosts</option></entry>
49007 <entry>Use: <emphasis>smtp</emphasis></entry>
49008 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49009 <entry>Default: <emphasis>unset</emphasis></entry>
49010 </row>
49011 </tbody>
49012 </tgroup>
49013 </informaltable>
49014 <para>
49015 <indexterm role="concept">
49016 <primary>TLS</primary>
49017 <secondary>server certificate verification</secondary>
49018 </indexterm>
49019 <indexterm role="concept">
49020 <primary>certificate</primary>
49021 <secondary>verification of server</secondary>
49022 </indexterm>
49023 This option gives a list of hosts for which, on encrypted connections,
49024 certificate verification must succeed.
49025 The <option>tls_verify_certificates</option> option must also be set.
49026 If both this option and <option>tls_try_verify_hosts</option> are unset
49027 operation is as if this option selected all hosts.
49028 </para>
49029 </section>
49030 <section id="SECTvalhosmax">
49031 <title>How the limits for the number of hosts to try are used</title>
49032 <para>
49033 <indexterm role="concept">
49034 <primary>host</primary>
49035 <secondary>maximum number to try</secondary>
49036 </indexterm>
49037 <indexterm role="concept">
49038 <primary>limit</primary>
49039 <secondary>hosts; maximum number tried</secondary>
49040 </indexterm>
49041 There are two options that are concerned with the number of hosts that are
49042 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
49043 <option>hosts_max_try_hardlimit</option>.
49044 </para>
49045 <para>
49046 The <option>hosts_max_try</option> option limits the number of hosts that are tried
49047 for a single delivery. However, despite the term <quote>host</quote> in its name, the
49048 option actually applies to each IP address independently. In other words, a
49049 multihomed host is treated as several independent hosts, just as it is for
49050 retrying.
49051 </para>
49052 <para>
49053 Many of the larger ISPs have multiple MX records which often point to
49054 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
49055 created as a result of routing one of these domains.
49056 </para>
49057 <para>
49058 Trying every single IP address on such a long list does not seem sensible; if
49059 several at the top of the list fail, it is reasonable to assume there is some
49060 problem that is likely to affect all of them. Roughly speaking, the value of
49061 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
49062 delivery. However, the logic cannot be quite that simple.
49063 </para>
49064 <para>
49065 Firstly, IP addresses that are skipped because their retry times have not
49066 arrived do not count, and in addition, addresses that are past their retry
49067 limits are also not counted, even when they are tried. This means that when
49068 some IP addresses are past their retry limits, more than the value of
49069 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
49070 that all IP addresses are considered before timing out an email address (but
49071 see below for an exception).
49072 </para>
49073 <para>
49074 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
49075 list to see if there is a subsequent host with a different (higher valued) MX.
49076 If there is, that host is considered next, and the current IP address is used
49077 but not counted. This behaviour helps in the case of a domain with a retry rule
49078 that hardly ever delays any hosts, as is now explained:
49079 </para>
49080 <para>
49081 Consider the case of a long list of hosts with one MX value, and a few with a
49082 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
49083 hosts at the top of the list are tried at first. With the default retry rule,
49084 which specifies increasing retry times, the higher MX hosts are eventually
49085 tried when those at the top of the list are skipped because they have not
49086 reached their retry times.
49087 </para>
49088 <para>
49089 However, it is common practice to put a fixed short retry time on domains for
49090 large ISPs, on the grounds that their servers are rarely down for very long.
49091 Unfortunately, these are exactly the domains that tend to resolve to long lists
49092 of hosts. The short retry time means that the lowest MX hosts are tried every
49093 time. The attempts may be in a different order because of random sorting, but
49094 without the special MX check, the higher MX hosts would never be tried until
49095 all the lower MX hosts had timed out (which might be several days), because
49096 there are always some lower MX hosts that have reached their retry times. With
49097 the special check, Exim considers at least one IP address from each MX value at
49098 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
49099 reached.
49100 </para>
49101 <para>
49102 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
49103 particular, Exim normally eventually tries all the IP addresses before timing
49104 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
49105 reasonable thing to do. Recently, however, some lunatic DNS configurations have
49106 been set up with hundreds of IP addresses for some domains. It can
49107 take a very long time indeed for an address to time out in these cases.
49108 </para>
49109 <para>
49110 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
49111 Exim never tries more than this number of IP addresses; if it hits this limit
49112 and they are all timed out, the email address is bounced, even though not all
49113 possible IP addresses have been tried.
49114 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
49115 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
49116 </para>
49117 </section>
49118 </chapter>
49119
49120 <chapter id="CHAPrewrite">
49121 <title>Address rewriting</title>
49122 <para>
49123 <indexterm role="concept" id="IIDaddrew" class="startofrange">
49124 <primary>rewriting</primary>
49125 <secondary>addresses</secondary>
49126 </indexterm>
49127 There are some circumstances in which Exim automatically rewrites domains in
49128 addresses. The two most common are when an address is given without a domain
49129 (referred to as an <quote>unqualified address</quote>) or when an address contains an
49130 abbreviated domain that is expanded by DNS lookup.
49131 </para>
49132 <para>
49133 Unqualified envelope addresses are accepted only for locally submitted
49134 messages, or for messages that are received from hosts matching
49135 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49136 appropriate. Unqualified addresses in header lines are qualified if they are in
49137 locally submitted messages, or messages from hosts that are permitted to send
49138 unqualified envelope addresses. Otherwise, unqualified addresses in header
49139 lines are neither qualified nor rewritten.
49140 </para>
49141 <para>
49142 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
49143 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
49144 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
49145 do this. The new RFCs do not contain this suggestion.
49146 </para>
49147 <section id="SECID147">
49148 <title>Explicitly configured address rewriting</title>
49149 <para>
49150 This chapter describes the rewriting rules that can be used in the
49151 main rewrite section of the configuration file, and also in the generic
49152 <option>headers_rewrite</option> option that can be set on any transport.
49153 </para>
49154 <para>
49155 Some people believe that configured address rewriting is a Mortal Sin.
49156 Others believe that life is not possible without it. Exim provides the
49157 facility; you do not have to use it.
49158 </para>
49159 <para>
49160 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
49161 configuration file are applied to addresses in incoming messages, both envelope
49162 addresses and addresses in header lines. Each rule specifies the types of
49163 address to which it applies.
49164 </para>
49165 <para>
49166 Whether or not addresses in header lines are rewritten depends on the origin of
49167 the headers and the type of rewriting. Global rewriting, that is, rewriting
49168 rules from the rewrite section of the configuration file, is applied only to
49169 those headers that were received with the message. Header lines that are added
49170 by ACLs or by a system filter or by individual routers or transports (which
49171 are specific to individual recipient addresses) are not rewritten by the global
49172 rules.
49173 </para>
49174 <para>
49175 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
49176 applies all headers except those added by routers and transports. That is, as
49177 well as the headers that were received with the message, it also applies to
49178 headers that were added by an ACL or a system filter.
49179 </para>
49180 <para>
49181 In general, rewriting addresses from your own system or domain has some
49182 legitimacy. Rewriting other addresses should be done only with great care and
49183 in special circumstances. The author of Exim believes that rewriting should be
49184 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
49185 Although it can sometimes be used as a routing tool, this is very strongly
49186 discouraged.
49187 </para>
49188 <para>
49189 There are two commonly encountered circumstances where rewriting is used, as
49190 illustrated by these examples:
49191 </para>
49192 <itemizedlist>
49193 <listitem>
49194 <para>
49195 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
49196 exchange mail with each other behind a firewall, but there is only a single
49197 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
49198 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
49199 </para>
49200 </listitem>
49201 <listitem>
49202 <para>
49203 A host rewrites the local parts of its own users so that, for example,
49204 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
49205 </para>
49206 </listitem>
49207 </itemizedlist>
49208 </section>
49209 <section id="SECID148">
49210 <title>When does rewriting happen?</title>
49211 <para>
49212 <indexterm role="concept">
49213 <primary>rewriting</primary>
49214 <secondary>timing of</secondary>
49215 </indexterm>
49216 <indexterm role="concept">
49217 <primary>access control lists (ACLs)</primary>
49218 <secondary>rewriting addresses in</secondary>
49219 </indexterm>
49220 Configured address rewriting can take place at several different stages of a
49221 message&#x2019;s processing.
49222 </para>
49223 <para>
49224 <indexterm role="variable">
49225 <primary><varname>$sender_address</varname></primary>
49226 </indexterm>
49227 At the start of an ACL for MAIL, the sender address may have been rewritten
49228 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
49229 ordinary rewrite rules have yet been applied. If, however, the sender address
49230 is verified in the ACL, it is rewritten before verification, and remains
49231 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
49232 rewritten address. This also applies if sender verification happens in a
49233 RCPT ACL. Otherwise, when the sender address is not verified, it is
49234 rewritten as soon as a message&#x2019;s header lines have been received.
49235 </para>
49236 <para>
49237 <indexterm role="variable">
49238 <primary><varname>$domain</varname></primary>
49239 </indexterm>
49240 <indexterm role="variable">
49241 <primary><varname>$local_part</varname></primary>
49242 </indexterm>
49243 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
49244 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
49245 rewrite rules have yet been applied to it. However, the behaviour is different
49246 from the sender address when a recipient is verified. The address is rewritten
49247 for the verification, but the rewriting is not remembered at this stage. The
49248 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
49249 as they were before (that is, they contain the unrewritten &ndash; except for
49250 SMTP-time rewriting &ndash; address).
49251 </para>
49252 <para>
49253 As soon as a message&#x2019;s header lines have been received, all the envelope
49254 recipient addresses are permanently rewritten, and rewriting is also applied to
49255 the addresses in the header lines (if configured). This happens before adding
49256 any header lines that were specified in MAIL or RCPT ACLs, and
49257 <indexterm role="concept">
49258 <primary><function>local_scan()</function> function</primary>
49259 <secondary>address rewriting; timing of</secondary>
49260 </indexterm>
49261 before the DATA ACL and <function>local_scan()</function> functions are run.
49262 </para>
49263 <para>
49264 When an address is being routed, either for delivery or for verification,
49265 rewriting is applied immediately to child addresses that are generated by
49266 redirection, unless <option>no_rewrite</option> is set on the router.
49267 </para>
49268 <para>
49269 <indexterm role="concept">
49270 <primary>envelope sender</primary>
49271 <secondary>rewriting at transport time</secondary>
49272 </indexterm>
49273 <indexterm role="concept">
49274 <primary>rewriting</primary>
49275 <secondary>at transport time</secondary>
49276 </indexterm>
49277 <indexterm role="concept">
49278 <primary>header lines</primary>
49279 <secondary>rewriting at transport time</secondary>
49280 </indexterm>
49281 At transport time, additional rewriting of addresses in header lines can be
49282 specified by setting the generic <option>headers_rewrite</option> option on a transport.
49283 This option contains rules that are identical in form to those in the rewrite
49284 section of the configuration file. They are applied to the original message
49285 header lines and any that were added by ACLs or a system filter. They are not
49286 applied to header lines that are added by routers or the transport.
49287 </para>
49288 <para>
49289 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
49290 transport option. However, it is not possible to rewrite envelope recipients at
49291 transport time.
49292 </para>
49293 </section>
49294 <section id="SECID149">
49295 <title>Testing the rewriting rules that apply on input</title>
49296 <para>
49297 <indexterm role="concept">
49298 <primary>rewriting</primary>
49299 <secondary>testing</secondary>
49300 </indexterm>
49301 <indexterm role="concept">
49302 <primary>testing</primary>
49303 <secondary>rewriting</secondary>
49304 </indexterm>
49305 Exim&#x2019;s input rewriting configuration appears in a part of the run time
49306 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
49307 <option>-brw</option> command line option. This takes an address (which can be a full RFC
49308 2822 address) as its argument. The output is a list of how the address would be
49309 transformed by the rewriting rules for each of the different places it might
49310 appear in an incoming message, that is, for each different header and for the
49311 envelope sender and recipient fields. For example,
49312 </para>
49313 <literallayout class="monospaced">
49314 exim -brw ph10@exim.workshop.example
49315 </literallayout>
49316 <para>
49317 might produce the output
49318 </para>
49319 <literallayout class="monospaced">
49320 sender: Philip.Hazel@exim.workshop.example
49321 from: Philip.Hazel@exim.workshop.example
49322 to: ph10@exim.workshop.example
49323 cc: ph10@exim.workshop.example
49324 bcc: ph10@exim.workshop.example
49325 reply-to: Philip.Hazel@exim.workshop.example
49326 env-from: Philip.Hazel@exim.workshop.example
49327 env-to: ph10@exim.workshop.example
49328 </literallayout>
49329 <para>
49330 which shows that rewriting has been set up for that address when used in any of
49331 the source fields, but not when it appears as a recipient address. At the
49332 present time, there is no equivalent way of testing rewriting rules that are
49333 set for a particular transport.
49334 </para>
49335 </section>
49336 <section id="SECID150">
49337 <title>Rewriting rules</title>
49338 <para>
49339 <indexterm role="concept">
49340 <primary>rewriting</primary>
49341 <secondary>rules</secondary>
49342 </indexterm>
49343 The rewrite section of the configuration file consists of lines of rewriting
49344 rules in the form
49345 </para>
49346 <literallayout>
49347 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
49348 </literallayout>
49349 <para>
49350 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
49351 transport option are given as a colon-separated list. Each item in the list
49352 takes the same form as a line in the main rewriting configuration (except that
49353 any colons must be doubled, of course).
49354 </para>
49355 <para>
49356 The formats of source patterns and replacement strings are described below.
49357 Each is terminated by white space, unless enclosed in double quotes, in which
49358 case normal quoting conventions apply inside the quotes. The flags are single
49359 characters which may appear in any order. Spaces and tabs between them are
49360 ignored.
49361 </para>
49362 <para>
49363 For each address that could potentially be rewritten, the rules are scanned in
49364 order, and replacements for the address from earlier rules can themselves be
49365 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
49366 </para>
49367 <para>
49368 The order in which addresses are rewritten is undefined, may change between
49369 releases, and must not be relied on, with one exception: when a message is
49370 received, the envelope sender is always rewritten first, before any header
49371 lines are rewritten. For example, the replacement string for a rewrite of an
49372 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
49373 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
49374 that the envelope sender has already been rewritten.
49375 </para>
49376 <para>
49377 <indexterm role="variable">
49378 <primary><varname>$domain</varname></primary>
49379 </indexterm>
49380 <indexterm role="variable">
49381 <primary><varname>$local_part</varname></primary>
49382 </indexterm>
49383 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
49384 string to refer to the address that is being rewritten. Note that lookup-driven
49385 rewriting can be done by a rule of the form
49386 </para>
49387 <literallayout class="monospaced">
49388 *@*   ${lookup ...
49389 </literallayout>
49390 <para>
49391 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
49392 refer to the address that is being rewritten.
49393 </para>
49394 </section>
49395 <section id="SECID151">
49396 <title>Rewriting patterns</title>
49397 <para>
49398 <indexterm role="concept">
49399 <primary>rewriting</primary>
49400 <secondary>patterns</secondary>
49401 </indexterm>
49402 <indexterm role="concept">
49403 <primary>address list</primary>
49404 <secondary>in a rewriting pattern</secondary>
49405 </indexterm>
49406 The source pattern in a rewriting rule is any item which may appear in an
49407 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
49408 single-item address list, which means that it is expanded before being tested
49409 against the address. As always, if you use a regular expression as a pattern,
49410 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
49411 facility to suppress string expansion within the regular expression.
49412 </para>
49413 <para>
49414 Domains in patterns should be given in lower case. Local parts in patterns are
49415 case-sensitive. If you want to do case-insensitive matching of local parts, you
49416 can use a regular expression that starts with <literal>^(?i)</literal>.
49417 </para>
49418 <para>
49419 <indexterm role="concept">
49420 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49421 <secondary>in rewriting rules</secondary>
49422 </indexterm>
49423 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
49424 depending on the type of match which occurred. These can be used in the
49425 replacement string to insert portions of the incoming address. <varname>$0</varname> always
49426 refers to the complete incoming address. When a regular expression is used, the
49427 numerical variables are set from its capturing subexpressions. For other types
49428 of pattern they are set as follows:
49429 </para>
49430 <itemizedlist>
49431 <listitem>
49432 <para>
49433 If a local part or domain starts with an asterisk, the numerical variables
49434 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
49435 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
49436 pattern
49437 </para>
49438 <literallayout class="monospaced">
49439 *queen@*.fict.example
49440 </literallayout>
49441 <para>
49442 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
49443 </para>
49444 <literallayout class="monospaced">
49445 $0 = hearts-queen@wonderland.fict.example
49446 $1 = hearts-
49447 $2 = wonderland
49448 </literallayout>
49449 <para>
49450 Note that if the local part does not start with an asterisk, but the domain
49451 does, it is <varname>$1</varname> that contains the wild part of the domain.
49452 </para>
49453 </listitem>
49454 <listitem>
49455 <para>
49456 If the domain part of the pattern is a partial lookup, the wild and fixed parts
49457 of the domain are placed in the next available numerical variables. Suppose,
49458 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
49459 rewriting rule of the form
49460 </para>
49461 <literallayout>
49462 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
49463 </literallayout>
49464 <para>
49465 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
49466 </para>
49467 <literallayout class="monospaced">
49468 $1 = foo
49469 $2 = bar
49470 $3 = baz.example
49471 </literallayout>
49472 <para>
49473 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
49474 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
49475 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
49476 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
49477 whole domain. For non-partial domain lookups, no numerical variables are set.
49478 </para>
49479 </listitem>
49480 </itemizedlist>
49481 </section>
49482 <section id="SECID152">
49483 <title>Rewriting replacements</title>
49484 <para>
49485 <indexterm role="concept">
49486 <primary>rewriting</primary>
49487 <secondary>replacements</secondary>
49488 </indexterm>
49489 If the replacement string for a rule is a single asterisk, addresses that
49490 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
49491 rewriting rules are scanned. For example,
49492 </para>
49493 <literallayout class="monospaced">
49494 hatta@lookingglass.fict.example  *  f
49495 </literallayout>
49496 <para>
49497 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
49498 <emphasis>From:</emphasis> headers.
49499 </para>
49500 <para>
49501 <indexterm role="variable">
49502 <primary><varname>$domain</varname></primary>
49503 </indexterm>
49504 <indexterm role="variable">
49505 <primary><varname>$local_part</varname></primary>
49506 </indexterm>
49507 If the replacement string is not a single asterisk, it is expanded, and must
49508 yield a fully qualified address. Within the expansion, the variables
49509 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
49510 Any letters they contain retain their original case &ndash; they are not lower
49511 cased. The numerical variables are set up according to the type of pattern that
49512 matched the address, as described above. If the expansion is forced to fail by
49513 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
49514 current rule is abandoned, but subsequent rules may take effect. Any other
49515 expansion failure causes the entire rewriting operation to be abandoned, and an
49516 entry written to the panic log.
49517 </para>
49518 </section>
49519 <section id="SECID153">
49520 <title>Rewriting flags</title>
49521 <para>
49522 There are three different kinds of flag that may appear on rewriting rules:
49523 </para>
49524 <itemizedlist>
49525 <listitem>
49526 <para>
49527 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
49528 c, f, h, r, s, t.
49529 </para>
49530 </listitem>
49531 <listitem>
49532 <para>
49533 A flag that specifies rewriting at SMTP time: S.
49534 </para>
49535 </listitem>
49536 <listitem>
49537 <para>
49538 Flags that control the rewriting process: Q, q, R, w.
49539 </para>
49540 </listitem>
49541 </itemizedlist>
49542 <para>
49543 For rules that are part of the <option>headers_rewrite</option> generic transport option,
49544 E, F, T, and S are not permitted.
49545 </para>
49546 </section>
49547 <section id="SECID154">
49548 <title>Flags specifying which headers and envelope addresses to rewrite</title>
49549 <para>
49550 <indexterm role="concept">
49551 <primary>rewriting</primary>
49552 <secondary>flags</secondary>
49553 </indexterm>
49554 If none of the following flag letters, nor the <quote>S</quote> flag (see section
49555 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
49556 and to both the sender and recipient fields of the envelope, whereas a
49557 transport-time rewriting rule just applies to all headers. Otherwise, the
49558 rewriting rule is skipped unless the relevant addresses are being processed.
49559 </para>
49560 <literallayout>
49561 <literal>E</literal>       rewrite all envelope fields
49562 <literal>F</literal>       rewrite the envelope From field
49563 <literal>T</literal>       rewrite the envelope To field
49564 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
49565 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
49566 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
49567 <literal>h</literal>       rewrite all headers
49568 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
49569 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
49570 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
49571 </literallayout>
49572 <para>
49573 "All headers" means all of the headers listed above that can be selected
49574 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
49575 other headers such as <emphasis>Subject:</emphasis> etc.
49576 </para>
49577 <para>
49578 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
49579 restrict this to special known cases in your own domains.
49580 </para>
49581 </section>
49582 <section id="SECTrewriteS">
49583 <title>The SMTP-time rewriting flag</title>
49584 <para>
49585 <indexterm role="concept">
49586 <primary>SMTP</primary>
49587 <secondary>rewriting malformed addresses</secondary>
49588 </indexterm>
49589 <indexterm role="concept">
49590 <primary>RCPT</primary>
49591 <secondary>rewriting argument of</secondary>
49592 </indexterm>
49593 <indexterm role="concept">
49594 <primary>MAIL</primary>
49595 <secondary>rewriting argument of</secondary>
49596 </indexterm>
49597 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
49598 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
49599 before any other processing; even before syntax checking. The pattern is
49600 required to be a regular expression, and it is matched against the whole of the
49601 data for the command, including any surrounding angle brackets.
49602 </para>
49603 <para>
49604 <indexterm role="variable">
49605 <primary><varname>$domain</varname></primary>
49606 </indexterm>
49607 <indexterm role="variable">
49608 <primary><varname>$local_part</varname></primary>
49609 </indexterm>
49610 This form of rewrite rule allows for the handling of addresses that are not
49611 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
49612 input). Because the input is not required to be a syntactically valid address,
49613 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
49614 expansion of the replacement string. The result of rewriting replaces the
49615 original address in the MAIL or RCPT command.
49616 </para>
49617 </section>
49618 <section id="SECID155">
49619 <title>Flags controlling the rewriting process</title>
49620 <para>
49621 There are four flags which control the way the rewriting process works. These
49622 take effect only when a rule is invoked, that is, when the address is of the
49623 correct type (matches the flags) and matches the pattern:
49624 </para>
49625 <itemizedlist>
49626 <listitem>
49627 <para>
49628 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
49629 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
49630 absence of <quote>Q</quote> the rewritten address must always include a domain.
49631 </para>
49632 </listitem>
49633 <listitem>
49634 <para>
49635 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
49636 even if no rewriting actually takes place because of a <quote>fail</quote> in the
49637 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
49638 (does not match the flags) or does not match the pattern.
49639 </para>
49640 </listitem>
49641 <listitem>
49642 <para>
49643 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
49644 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
49645 rewriting once it fails to match (after at least one successful rewrite).
49646 </para>
49647 </listitem>
49648 <listitem>
49649 <para>
49650 <indexterm role="concept">
49651 <primary>rewriting</primary>
49652 <secondary>whole addresses</secondary>
49653 </indexterm>
49654 When an address in a header is rewritten, the rewriting normally applies only
49655 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
49656 left unchanged. For example, rewriting might change
49657 </para>
49658 <literallayout class="monospaced">
49659 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
49660 </literallayout>
49661 <para>
49662 into
49663 </para>
49664 <literallayout class="monospaced">
49665 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
49666 </literallayout>
49667 <para>
49668 <indexterm role="concept">
49669 <primary>RFC 2047</primary>
49670 </indexterm>
49671 Sometimes there is a need to replace the whole address item, and this can be
49672 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
49673 causes an address in a header line to be rewritten, the entire address is
49674 replaced, not just the working part. The replacement must be a complete RFC
49675 2822 address, including the angle brackets if necessary. If text outside angle
49676 brackets contains a character whose value is greater than 126 or less than 32
49677 (except for tab), the text is encoded according to RFC 2047. The character set
49678 is taken from <option>headers_charset</option>, which gets its default at build time.
49679 </para>
49680 <para>
49681 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
49682 rewritten, all but the working part of the replacement address is discarded.
49683 </para>
49684 </listitem>
49685 </itemizedlist>
49686 </section>
49687 <section id="SECID156">
49688 <title>Rewriting examples</title>
49689 <para>
49690 Here is an example of the two common rewriting paradigms:
49691 </para>
49692 <literallayout class="monospaced">
49693 *@*.hitch.fict.example  $1@hitch.fict.example
49694 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
49695                      {$value}fail}@hitch.fict.example bctfrF
49696 </literallayout>
49697 <para>
49698 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
49699 the string expansion to fail if the lookup does not succeed. In this context it
49700 has the effect of leaving the original address unchanged, but Exim goes on to
49701 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
49702 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
49703 explicitly, which would cause the rewritten address to be the same as before,
49704 at the cost of a small bit of processing. Not supplying either of these is an
49705 error, since the rewritten address would then contain no local part.
49706 </para>
49707 <para>
49708 The first example above replaces the domain with a superior, more general
49709 domain. This may not be desirable for certain local parts. If the rule
49710 </para>
49711 <literallayout class="monospaced">
49712 root@*.hitch.fict.example  *
49713 </literallayout>
49714 <para>
49715 were inserted before the first rule, rewriting would be suppressed for the
49716 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
49717 </para>
49718 <para>
49719 Rewriting can be made conditional on a number of tests, by making use of
49720 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
49721 messages that originate outside the local host:
49722 </para>
49723 <literallayout class="monospaced">
49724 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
49725                          {$1@hitch.fict.example}fail}"
49726 </literallayout>
49727 <para>
49728 The replacement string is quoted in this example because it contains white
49729 space.
49730 </para>
49731 <para>
49732 <indexterm role="concept">
49733 <primary>rewriting</primary>
49734 <secondary>bang paths</secondary>
49735 </indexterm>
49736 <indexterm role="concept">
49737 <primary>bang paths</primary>
49738 <secondary>rewriting</secondary>
49739 </indexterm>
49740 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
49741 an address it treats it as an unqualified local part which it qualifies with
49742 the local qualification domain (if the source of the message is local or if the
49743 remote host is permitted to send unqualified addresses). Rewriting can
49744 sometimes be used to handle simple bang paths with a fixed number of
49745 components. For example, the rule
49746 </para>
49747 <literallayout class="monospaced">
49748 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
49749 </literallayout>
49750 <para>
49751 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
49752 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
49753 a global rewriting rule for envelope addresses. It can provide a backdoor
49754 method for using your system as a relay, because the incoming addresses appear
49755 to be local. If the bang path addresses are received via SMTP, it is safer to
49756 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
49757 can be done on the rewritten addresses.
49758 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
49759 </para>
49760 </section>
49761 </chapter>
49762
49763 <chapter id="CHAPretry">
49764 <title>Retry configuration</title>
49765 <para>
49766 <indexterm role="concept" id="IIDretconf1" class="startofrange">
49767 <primary>retry</primary>
49768 <secondary>configuration, description of</secondary>
49769 </indexterm>
49770 <indexterm role="concept" id="IIDregconf2" class="startofrange">
49771 <primary>configuration file</primary>
49772 <secondary>retry section</secondary>
49773 </indexterm>
49774 The <quote>retry</quote> section of the runtime configuration file contains a list of
49775 retry rules that control how often Exim tries to deliver messages that cannot
49776 be delivered at the first attempt. If there are no retry rules (the section is
49777 empty or not present), there are no retries. In this situation, temporary
49778 errors are treated as permanent. The default configuration contains a single,
49779 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
49780 line option can be used to test which retry rule will be used for a given
49781 address, domain and error.
49782 </para>
49783 <para>
49784 The most common cause of retries is temporary failure to deliver to a remote
49785 host because the host is down, or inaccessible because of a network problem.
49786 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
49787 address) basis, not on a per-message basis. Thus, if one message has recently
49788 been delayed, delivery of a new message to the same host is not immediately
49789 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
49790 log selector is set, the message
49791 <indexterm role="concept">
49792 <primary>retry</primary>
49793 <secondary>time not reached</secondary>
49794 </indexterm>
49795 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
49796 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
49797 the handling of errors during remote deliveries.
49798 </para>
49799 <para>
49800 Retry processing applies to routing as well as to delivering, except as covered
49801 in the next paragraph. The retry rules do not distinguish between these
49802 actions. It is not possible, for example, to specify different behaviour for
49803 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
49804 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
49805 added complication, so did not implement it. However, although they share the
49806 same retry rule, the actual retry times for routing and transporting a given
49807 domain are maintained independently.
49808 </para>
49809 <para>
49810 When a delivery is not part of a queue run (typically an immediate delivery on
49811 receipt of a message), the routers are always run, and local deliveries are
49812 always attempted, even if retry times are set for them. This makes for better
49813 behaviour if one particular message is causing problems (for example, causing
49814 quota overflow, or provoking an error in a filter file). If such a delivery
49815 suffers a temporary failure, the retry data is updated as normal, and
49816 subsequent delivery attempts from queue runs occur only when the retry time for
49817 the local address is reached.
49818 </para>
49819 <section id="SECID157">
49820 <title>Changing retry rules</title>
49821 <para>
49822 If you change the retry rules in your configuration, you should consider
49823 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
49824 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
49825 always safe; that is why they are called <quote>hints</quote>.
49826 </para>
49827 <para>
49828 The hints retry data contains suggested retry times based on the previous
49829 rules. In the case of a long-running problem with a remote host, it might
49830 record the fact that the host has timed out. If your new rules increase the
49831 timeout time for such a host, you should definitely remove the old retry data
49832 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
49833 messages that it should now be retaining.
49834 </para>
49835 </section>
49836 <section id="SECID158">
49837 <title>Format of retry rules</title>
49838 <para>
49839 <indexterm role="concept">
49840 <primary>retry</primary>
49841 <secondary>rules</secondary>
49842 </indexterm>
49843 Each retry rule occupies one line and consists of three or four parts,
49844 separated by white space: a pattern, an error name, an optional list of sender
49845 addresses, and a list of retry parameters. The pattern and sender lists must be
49846 enclosed in double quotes if they contain white space. The rules are searched
49847 in order until one is found where the pattern, error name, and sender list (if
49848 present) match the failing host or address, the error that occurred, and the
49849 message&#x2019;s sender, respectively.
49850 </para>
49851 <para>
49852 The pattern is any single item that may appear in an address list (see section
49853 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
49854 which means that it is expanded before being tested against the address that
49855 has been delayed. A negated address list item is permitted. Address
49856 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
49857 which makes it possible for many retry rules to start with just a domain. For
49858 example,
49859 </para>
49860 <literallayout class="monospaced">
49861 lookingglass.fict.example        *  F,24h,30m;
49862 </literallayout>
49863 <para>
49864 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
49865 whereas
49866 </para>
49867 <literallayout class="monospaced">
49868 alice@lookingglass.fict.example  *  F,24h,30m;
49869 </literallayout>
49870 <para>
49871 applies only to temporary failures involving the local part <option>alice</option>.
49872 In practice, almost all rules start with a domain name pattern without a local
49873 part.
49874 </para>
49875 <para>
49876 <indexterm role="concept">
49877 <primary>regular expressions</primary>
49878 <secondary>in retry rules</secondary>
49879 </indexterm>
49880 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
49881 must match a complete address, not just a domain, because that is how regular
49882 expressions work in address lists.
49883 </para>
49884 <literallayout>
49885 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
49886 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
49887 </literallayout>
49888 </section>
49889 <section id="SECID159">
49890 <title>Choosing which retry rule to use for address errors</title>
49891 <para>
49892 When Exim is looking for a retry rule after a routing attempt has failed (for
49893 example, after a DNS timeout), each line in the retry configuration is tested
49894 against the complete address only if <option>retry_use_local_part</option> is set for the
49895 router. Otherwise, only the domain is used, except when matching against a
49896 regular expression, when the local part of the address is replaced with <quote>*</quote>.
49897 A domain on its own can match a domain pattern, or a pattern that starts with
49898 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
49899 <option>check_local_user</option> is true, and false for other routers.
49900 </para>
49901 <para>
49902 Similarly, when Exim is looking for a retry rule after a local delivery has
49903 failed (for example, after a mailbox full error), each line in the retry
49904 configuration is tested against the complete address only if
49905 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
49906 local transports).
49907 </para>
49908 <para>
49909 <indexterm role="concept">
49910 <primary>4<emphasis>xx</emphasis> responses</primary>
49911 <secondary>retry rules for</secondary>
49912 </indexterm>
49913 However, when Exim is looking for a retry rule after a remote delivery attempt
49914 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
49915 whole address is always used as the key when searching the retry rules. The
49916 rule that is found is used to create a retry time for the combination of the
49917 failing address and the message&#x2019;s sender. It is the combination of sender and
49918 recipient that is delayed in subsequent queue runs until its retry time is
49919 reached. You can delay the recipient without regard to the sender by setting
49920 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
49921 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
49922 commands.
49923 </para>
49924 </section>
49925 <section id="SECID160">
49926 <title>Choosing which retry rule to use for host and message errors</title>
49927 <para>
49928 For a temporary error that is not related to an individual address (for
49929 example, a connection timeout), each line in the retry configuration is checked
49930 twice. First, the name of the remote host is used as a domain name (preceded by
49931 <quote>*@</quote> when matching a regular expression). If this does not match the line,
49932 the domain from the email address is tried in a similar fashion. For example,
49933 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
49934 </para>
49935 <literallayout class="monospaced">
49936 a.b.c.example  MX  5  x.y.z.example
49937                MX  6  p.q.r.example
49938                MX  7  m.n.o.example
49939 </literallayout>
49940 <para>
49941 and the retry rules are
49942 </para>
49943 <literallayout class="monospaced">
49944 p.q.r.example    *      F,24h,30m;
49945 a.b.c.example    *      F,4d,45m;
49946 </literallayout>
49947 <para>
49948 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
49949 first rule matches neither the host nor the domain, so Exim looks at the second
49950 rule. This does not match the host, but it does match the domain, so it is used
49951 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
49952 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
49953 first retry rule is used, because it matches the host.
49954 </para>
49955 <para>
49956 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
49957 first rule to determine retry times, but for all the other hosts for the domain
49958 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
49959 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
49960 </para>
49961 <para>
49962 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
49963 However, if a message is routed directly to an IP address without the use of a
49964 host name, for example, if a <command>manualroute</command> router contains a setting such as:
49965 </para>
49966 <literallayout class="monospaced">
49967 route_list = *.a.example  192.168.34.23
49968 </literallayout>
49969 <para>
49970 then the <quote>host name</quote> that is used when searching for a retry rule is the
49971 textual form of the IP address.
49972 </para>
49973 </section>
49974 <section id="SECID161">
49975 <title>Retry rules for specific errors</title>
49976 <para>
49977 <indexterm role="concept">
49978 <primary>retry</primary>
49979 <secondary>specific errors; specifying</secondary>
49980 </indexterm>
49981 The second field in a retry rule is the name of a particular error, or an
49982 asterisk, which matches any error. The errors that can be tested for are:
49983 </para>
49984 <variablelist>
49985 <varlistentry>
49986 <term><option>auth_failed</option></term>
49987 <listitem>
49988 <para>
49989 Authentication failed when trying to send to a host in the
49990 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
49991 </para>
49992 </listitem></varlistentry>
49993 <varlistentry>
49994 <term><option>data_4xx</option></term>
49995 <listitem>
49996 <para>
49997 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
49998 after the command, or after sending the message&#x2019;s data.
49999 </para>
50000 </listitem></varlistentry>
50001 <varlistentry>
50002 <term><option>mail_4xx</option></term>
50003 <listitem>
50004 <para>
50005 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
50006 </para>
50007 </listitem></varlistentry>
50008 <varlistentry>
50009 <term><option>rcpt_4xx</option></term>
50010 <listitem>
50011 <para>
50012 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
50013 </para>
50014 </listitem></varlistentry>
50015 </variablelist>
50016 <para>
50017 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
50018 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
50019 recognize 452 errors given to RCPT commands for addresses in a certain domain,
50020 and have retries every ten minutes with a one-hour timeout, you could set up a
50021 retry rule of this form:
50022 </para>
50023 <literallayout class="monospaced">
50024 the.domain.name  rcpt_452   F,1h,10m
50025 </literallayout>
50026 <para>
50027 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
50028 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
50029 </para>
50030 <variablelist>
50031 <varlistentry>
50032 <term><option>lost_connection</option></term>
50033 <listitem>
50034 <para>
50035 A server unexpectedly closed the SMTP connection. There may, of course,
50036 legitimate reasons for this (host died, network died), but if it repeats a lot
50037 for the same host, it indicates something odd.
50038 </para>
50039 </listitem></varlistentry>
50040 <varlistentry>
50041 <term><option>lookup</option></term>
50042 <listitem>
50043 <para>
50044 A DNS lookup for a host failed.
50045 Note that a <option>dnslookup</option> router will need to have matched
50046 its <option>fail_defer_domains</option> option for this retry type to be usable.
50047 Also note that a <option>manualroute</option> router will probably need
50048 its <option>host_find_failed</option> option set to <option>defer</option>.
50049 </para>
50050 </listitem></varlistentry>
50051 <varlistentry>
50052 <term><option>refused_MX</option></term>
50053 <listitem>
50054 <para>
50055 A connection to a host obtained from an MX record was refused.
50056 </para>
50057 </listitem></varlistentry>
50058 <varlistentry>
50059 <term><option>refused_A</option></term>
50060 <listitem>
50061 <para>
50062 A connection to a host not obtained from an MX record was refused.
50063 </para>
50064 </listitem></varlistentry>
50065 <varlistentry>
50066 <term><option>refused</option></term>
50067 <listitem>
50068 <para>
50069 A connection was refused.
50070 </para>
50071 </listitem></varlistentry>
50072 <varlistentry>
50073 <term><option>timeout_connect_MX</option></term>
50074 <listitem>
50075 <para>
50076 A connection attempt to a host obtained from an MX record timed out.
50077 </para>
50078 </listitem></varlistentry>
50079 <varlistentry>
50080 <term><option>timeout_connect_A</option></term>
50081 <listitem>
50082 <para>
50083 A connection attempt to a host not obtained from an MX record timed out.
50084 </para>
50085 </listitem></varlistentry>
50086 <varlistentry>
50087 <term><option>timeout_connect</option></term>
50088 <listitem>
50089 <para>
50090 A connection attempt timed out.
50091 </para>
50092 </listitem></varlistentry>
50093 <varlistentry>
50094 <term><option>timeout_MX</option></term>
50095 <listitem>
50096 <para>
50097 There was a timeout while connecting or during an SMTP session with a host
50098 obtained from an MX record.
50099 </para>
50100 </listitem></varlistentry>
50101 <varlistentry>
50102 <term><option>timeout_A</option></term>
50103 <listitem>
50104 <para>
50105 There was a timeout while connecting or during an SMTP session with a host not
50106 obtained from an MX record.
50107 </para>
50108 </listitem></varlistentry>
50109 <varlistentry>
50110 <term><option>timeout</option></term>
50111 <listitem>
50112 <para>
50113 There was a timeout while connecting or during an SMTP session.
50114 </para>
50115 </listitem></varlistentry>
50116 <varlistentry>
50117 <term><option>tls_required</option></term>
50118 <listitem>
50119 <para>
50120 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
50121 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
50122 to STARTTLS, or there was a problem setting up the TLS connection.
50123 </para>
50124 </listitem></varlistentry>
50125 <varlistentry>
50126 <term><option>quota</option></term>
50127 <listitem>
50128 <para>
50129 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
50130 transport.
50131 </para>
50132 </listitem></varlistentry>
50133 <varlistentry>
50134 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
50135 <listitem>
50136 <para>
50137 <indexterm role="concept">
50138 <primary>quota</primary>
50139 <secondary>error testing in retry rule</secondary>
50140 </indexterm>
50141 <indexterm role="concept">
50142 <primary>retry</primary>
50143 <secondary>quota error testing</secondary>
50144 </indexterm>
50145 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
50146 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
50147 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
50148 for four days.
50149 </para>
50150 </listitem></varlistentry>
50151 </variablelist>
50152 <para>
50153 <indexterm role="concept">
50154 <primary>mailbox</primary>
50155 <secondary>time of last read</secondary>
50156 </indexterm>
50157 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
50158 timeouts when the mailbox is full and is not being read by its owner. Ideally,
50159 it should be based on the last time that the user accessed the mailbox.
50160 However, it is not always possible to determine this. Exim uses the following
50161 heuristic rules:
50162 </para>
50163 <itemizedlist>
50164 <listitem>
50165 <para>
50166 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
50167 used. As no new messages are being delivered (because the mailbox is over
50168 quota), Exim does not access the file, so this is the time of last user access.
50169 </para>
50170 </listitem>
50171 <listitem>
50172 <para>
50173 <indexterm role="concept">
50174 <primary>maildir format</primary>
50175 <secondary>time of last read</secondary>
50176 </indexterm>
50177 For a maildir delivery, the time of last modification of the <filename>new</filename>
50178 subdirectory is used. As the mailbox is over quota, no new files are created in
50179 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
50180 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
50181 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
50182 time that is used is therefore the last time that the user read a new message.
50183 </para>
50184 </listitem>
50185 <listitem>
50186 <para>
50187 For other kinds of multi-file mailbox, the time of last access cannot be
50188 obtained, so a retry rule that uses this type of error field is never matched.
50189 </para>
50190 </listitem>
50191 </itemizedlist>
50192 <para>
50193 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
50194 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
50195 when a local delivery is deferred because a partition is full (the ENOSPC
50196 error).
50197 </para>
50198 </section>
50199 <section id="SECID162">
50200 <title>Retry rules for specified senders</title>
50201 <para>
50202 <indexterm role="concept">
50203 <primary>retry</primary>
50204 <secondary>rules; sender-specific</secondary>
50205 </indexterm>
50206 You can specify retry rules that apply only when the failing message has a
50207 specific sender. In particular, this can be used to define retry rules that
50208 apply only to bounce messages. The third item in a retry rule can be of this
50209 form:
50210 </para>
50211 <literallayout>
50212 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
50213 </literallayout>
50214 <para>
50215 The retry timings themselves are then the fourth item. For example:
50216 </para>
50217 <literallayout class="monospaced">
50218 *   rcpt_4xx   senders=:   F,1h,30m
50219 </literallayout>
50220 <para>
50221 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
50222 host. If the address list contains white space, it must be enclosed in quotes.
50223 For example:
50224 </para>
50225 <literallayout class="monospaced">
50226 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
50227 </literallayout>
50228 <para>
50229 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
50230 (which do not depend on the recipient). The reason is that the sender is used
50231 only to match the retry rule. Once the rule has been found for a host error,
50232 its contents are used to set a retry time for the host, and this will apply to
50233 all messages, not just those with specific senders.
50234 </para>
50235 <para>
50236 When testing retry rules using <option>-brt</option>, you can supply a sender using the
50237 <option>-f</option> command line option, like this:
50238 </para>
50239 <literallayout class="monospaced">
50240 exim -f "" -brt user@dom.ain
50241 </literallayout>
50242 <para>
50243 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
50244 list is never matched.
50245 </para>
50246 </section>
50247 <section id="SECID163">
50248 <title>Retry parameters</title>
50249 <para>
50250 <indexterm role="concept">
50251 <primary>retry</primary>
50252 <secondary>parameters in rules</secondary>
50253 </indexterm>
50254 The third (or fourth, if a senders list is present) field in a retry rule is a
50255 sequence of retry parameter sets, separated by semicolons. Each set consists of
50256 </para>
50257 <literallayout>
50258 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
50259 </literallayout>
50260 <para>
50261 The letter identifies the algorithm for computing a new retry time; the cutoff
50262 time is the time beyond which this algorithm no longer applies, and the
50263 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
50264 time that the first failure for the domain (combined with the local part if
50265 relevant) was detected, not from the time the message was received.
50266 </para>
50267 <para>
50268 <indexterm role="concept">
50269 <primary>retry</primary>
50270 <secondary>algorithms</secondary>
50271 </indexterm>
50272 <indexterm role="concept">
50273 <primary>retry</primary>
50274 <secondary>fixed intervals</secondary>
50275 </indexterm>
50276 <indexterm role="concept">
50277 <primary>retry</primary>
50278 <secondary>increasing intervals</secondary>
50279 </indexterm>
50280 <indexterm role="concept">
50281 <primary>retry</primary>
50282 <secondary>random intervals</secondary>
50283 </indexterm>
50284 The available algorithms are:
50285 </para>
50286 <itemizedlist>
50287 <listitem>
50288 <para>
50289 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
50290 the interval.
50291 </para>
50292 </listitem>
50293 <listitem>
50294 <para>
50295 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
50296 specifies a starting value for the interval, and the second a multiplier, which
50297 is used to increase the size of the interval at each retry.
50298 </para>
50299 </listitem>
50300 <listitem>
50301 <para>
50302 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
50303 retry, the previous interval is multiplied by the factor in order to get a
50304 maximum for the next interval. The minimum interval is the first argument of
50305 the parameter, and an actual interval is chosen randomly between them. Such a
50306 rule has been found to be helpful in cluster configurations when all the
50307 members of the cluster restart at once, and may therefore synchronize their
50308 queue processing times.
50309 </para>
50310 </listitem>
50311 </itemizedlist>
50312 <para>
50313 When computing the next retry time, the algorithm definitions are scanned in
50314 order until one whose cutoff time has not yet passed is reached. This is then
50315 used to compute a new retry time that is later than the current time. In the
50316 case of fixed interval retries, this simply means adding the interval to the
50317 current time. For geometrically increasing intervals, retry intervals are
50318 computed from the rule&#x2019;s parameters until one that is greater than the previous
50319 interval is found. The main configuration variable
50320 <indexterm role="concept">
50321 <primary>limit</primary>
50322 <secondary>retry interval</secondary>
50323 </indexterm>
50324 <indexterm role="concept">
50325 <primary>retry</primary>
50326 <secondary>interval, maximum</secondary>
50327 </indexterm>
50328 <indexterm role="option">
50329 <primary><option>retry_interval_max</option></primary>
50330 </indexterm>
50331 <option>retry_interval_max</option> limits the maximum interval between retries. It
50332 cannot be set greater than <literal>24h</literal>, which is its default value.
50333 </para>
50334 <para>
50335 A single remote domain may have a number of hosts associated with it, and each
50336 host may have more than one IP address. Retry algorithms are selected on the
50337 basis of the domain name, but are applied to each IP address independently. If,
50338 for example, a host has two IP addresses and one is unusable, Exim will
50339 generate retry times for it and will not try to use it until its next retry
50340 time comes. Thus the good IP address is likely to be tried first most of the
50341 time.
50342 </para>
50343 <para>
50344 <indexterm role="concept">
50345 <primary>hints database</primary>
50346 <secondary>use for retrying</secondary>
50347 </indexterm>
50348 Retry times are hints rather than promises. Exim does not make any attempt to
50349 run deliveries exactly at the computed times. Instead, a queue runner process
50350 starts delivery processes for delayed messages periodically, and these attempt
50351 new deliveries only for those addresses that have passed their next retry time.
50352 If a new message arrives for a deferred address, an immediate delivery attempt
50353 occurs only if the address has passed its retry time. In the absence of new
50354 messages, the minimum time between retries is the interval between queue runner
50355 processes. There is not much point in setting retry times of five minutes if
50356 your queue runners happen only once an hour, unless there are a significant
50357 number of incoming messages (which might be the case on a system that is
50358 sending everything to a smart host, for example).
50359 </para>
50360 <para>
50361 The data in the retry hints database can be inspected by using the
50362 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
50363 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
50364 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
50365 are for the hosts associated with a particular mail domain, and also for local
50366 deliveries that have been deferred.
50367 </para>
50368 </section>
50369 <section id="SECID164">
50370 <title>Retry rule examples</title>
50371 <para>
50372 Here are some example retry rules:
50373 </para>
50374 <literallayout class="monospaced">
50375 alice@wonderland.fict.example quota_5d  F,7d,3h
50376 wonderland.fict.example       quota_5d
50377 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
50378 lookingglass.fict.example     *         F,24h,30m;
50379 *                 refused_A   F,2h,20m;
50380 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
50381 </literallayout>
50382 <para>
50383 The first rule sets up special handling for mail to
50384 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
50385 mailbox has not been read for at least 5 days. Retries continue every three
50386 hours for 7 days. The second rule handles over-quota errors for all other local
50387 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
50388 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
50389 fail are bounced immediately if the mailbox has not been read for at least 5
50390 days.
50391 </para>
50392 <para>
50393 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
50394 happen every 15 minutes for an hour, then with geometrically increasing
50395 intervals until two days have passed since a delivery first failed. After the
50396 first hour there is a delay of one hour, then two hours, then four hours, and
50397 so on (this is a rather extreme example).
50398 </para>
50399 <para>
50400 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
50401 They happen every 30 minutes for 24 hours only. The remaining two rules handle
50402 all other domains, with special action for connection refusal from hosts that
50403 were not obtained from an MX record.
50404 </para>
50405 <para>
50406 The final rule in a retry configuration should always have asterisks in the
50407 first two fields so as to provide a general catch-all for any addresses that do
50408 not have their own special handling. This example tries every 15 minutes for 2
50409 hours, then with intervals starting at one hour and increasing by a factor of
50410 1.5 up to 16 hours, then every 8 hours up to 5 days.
50411 </para>
50412 </section>
50413 <section id="SECID165">
50414 <title>Timeout of retry data</title>
50415 <para>
50416 <indexterm role="concept">
50417 <primary>timeout</primary>
50418 <secondary>of retry data</secondary>
50419 </indexterm>
50420 <indexterm role="option">
50421 <primary><option>retry_data_expire</option></primary>
50422 </indexterm>
50423 <indexterm role="concept">
50424 <primary>hints database</primary>
50425 <secondary>data expiry</secondary>
50426 </indexterm>
50427 <indexterm role="concept">
50428 <primary>retry</primary>
50429 <secondary>timeout of data</secondary>
50430 </indexterm>
50431 Exim timestamps the data that it writes to its retry hints database. When it
50432 consults the data during a delivery it ignores any that is older than the value
50433 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
50434 been tried for 7 days, Exim will try to deliver to it immediately a message
50435 arrives, and if that fails, it will calculate a retry time as if it were
50436 failing for the first time.
50437 </para>
50438 <para>
50439 This improves the behaviour for messages routed to rarely-used hosts such as MX
50440 backups. If such a host was down at one time, and happens to be down again when
50441 Exim tries a month later, using the old retry data would imply that it had been
50442 down all the time, which is not a justified assumption.
50443 </para>
50444 <para>
50445 If a host really is permanently dead, this behaviour causes a burst of retries
50446 every now and again, but only if messages routed to it are rare. If there is a
50447 message at least once every 7 days the retry data never expires.
50448 </para>
50449 </section>
50450 <section id="SECID166">
50451 <title>Long-term failures</title>
50452 <para>
50453 <indexterm role="concept">
50454 <primary>delivery failure, long-term</primary>
50455 </indexterm>
50456 <indexterm role="concept">
50457 <primary>retry</primary>
50458 <secondary>after long-term failure</secondary>
50459 </indexterm>
50460 Special processing happens when an email address has been failing for so long
50461 that the cutoff time for the last algorithm is reached. For example, using the
50462 default retry rule:
50463 </para>
50464 <literallayout class="monospaced">
50465 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
50466 </literallayout>
50467 <para>
50468 the cutoff time is four days. Reaching the retry cutoff is independent of how
50469 long any specific message has been failing; it is the length of continuous
50470 failure for the recipient address that counts.
50471 </para>
50472 <para>
50473 When the cutoff time is reached for a local delivery, or for all the IP
50474 addresses associated with a remote delivery, a subsequent delivery failure
50475 causes Exim to give up on the address, and a bounce message is generated.
50476 In order to cater for new messages that use the failing address, a next retry
50477 time is still computed from the final algorithm, and is used as follows:
50478 </para>
50479 <para>
50480 For local deliveries, one delivery attempt is always made for any subsequent
50481 messages. If this delivery fails, the address fails immediately. The
50482 post-cutoff retry time is not used.
50483 </para>
50484 <para>
50485 If the delivery is remote, there are two possibilities, controlled by the
50486 <indexterm role="option">
50487 <primary><option>delay_after_cutoff</option></primary>
50488 </indexterm>
50489 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
50490 default. Until the post-cutoff retry time for one of the IP addresses is
50491 reached, the failing email address is bounced immediately, without a delivery
50492 attempt taking place. After that time, one new delivery attempt is made to
50493 those IP addresses that are past their retry times, and if that still fails,
50494 the address is bounced and new retry times are computed.
50495 </para>
50496 <para>
50497 In other words, when all the hosts for a given email address have been failing
50498 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
50499 times is reached. Then it tries once, and bounces if that attempt fails. This
50500 behaviour ensures that few resources are wasted in repeatedly trying to deliver
50501 to a broken destination, but if the host does recover, Exim will eventually
50502 notice.
50503 </para>
50504 <para>
50505 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
50506 addresses are past their final cutoff time, Exim tries to deliver to those IP
50507 addresses that have not been tried since the message arrived. If there are
50508 no suitable IP addresses, or if they all fail, the address is bounced. In other
50509 words, it does not delay when a new message arrives, but tries the expired
50510 addresses immediately, unless they have been tried since the message arrived.
50511 If there is a continuous stream of messages for the failing domains, setting
50512 <option>delay_after_cutoff</option> false means that there will be many more attempts to
50513 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
50514 true.
50515 </para>
50516 </section>
50517 <section id="SECID167">
50518 <title>Deliveries that work intermittently</title>
50519 <para>
50520 <indexterm role="concept">
50521 <primary>retry</primary>
50522 <secondary>intermittently working deliveries</secondary>
50523 </indexterm>
50524 Some additional logic is needed to cope with cases where a host is
50525 intermittently available, or when a message has some attribute that prevents
50526 its delivery when others to the same address get through. In this situation,
50527 because some messages are successfully delivered, the <quote>retry clock</quote> for the
50528 host or address keeps getting reset by the successful deliveries, and so
50529 failing messages remain on the queue for ever because the cutoff time is never
50530 reached.
50531 </para>
50532 <para>
50533 Two exceptional actions are applied to prevent this happening. The first
50534 applies to errors that are related to a message rather than a remote host.
50535 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
50536 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
50537 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
50538 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
50539 is used when scanning the retry rules to decide when to try next and when to
50540 time out the address.
50541 </para>
50542 <para>
50543 The exceptional second action applies in all cases. If a message has been on
50544 the queue for longer than the cutoff time of any applicable retry rule for a
50545 given address, a delivery is attempted for that address, even if it is not yet
50546 time, and if this delivery fails, the address is timed out. A new retry time is
50547 not computed in this case, so that other messages for the same address are
50548 considered immediately.
50549 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
50550 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
50551 </para>
50552 </section>
50553 </chapter>
50554
50555 <chapter id="CHAPSMTPAUTH">
50556 <title>SMTP authentication</title>
50557 <para>
50558 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
50559 <primary>SMTP</primary>
50560 <secondary>authentication configuration</secondary>
50561 </indexterm>
50562 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
50563 <primary>authentication</primary>
50564 </indexterm>
50565 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
50566 with SMTP authentication. This facility is an extension to the SMTP protocol,
50567 described in RFC 2554, which allows a client SMTP host to authenticate itself
50568 to a server. This is a common way for a server to recognize clients that are
50569 permitted to use it as a relay. SMTP authentication is not of relevance to the
50570 transfer of mail between servers that have no managerial connection with each
50571 other.
50572 </para>
50573 <para>
50574 <indexterm role="concept">
50575 <primary>AUTH</primary>
50576 <secondary>description of</secondary>
50577 </indexterm>
50578 Very briefly, the way SMTP authentication works is as follows:
50579 </para>
50580 <itemizedlist>
50581 <listitem>
50582 <para>
50583 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
50584 the client&#x2019;s EHLO command.
50585 </para>
50586 </listitem>
50587 <listitem>
50588 <para>
50589 The client issues an AUTH command, naming a specific mechanism. The command
50590 may, optionally, contain some authentication data.
50591 </para>
50592 </listitem>
50593 <listitem>
50594 <para>
50595 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
50596 appropriate responses. In simple authentication mechanisms, the challenges are
50597 just prompts for user names and passwords. The server does not have to issue
50598 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
50599 with the AUTH command.
50600 </para>
50601 </listitem>
50602 <listitem>
50603 <para>
50604 The server either accepts or denies authentication.
50605 </para>
50606 </listitem>
50607 <listitem>
50608 <para>
50609 If authentication succeeds, the client may optionally make use of the AUTH
50610 option on the MAIL command to pass an authenticated sender in subsequent
50611 mail transactions. Authentication lasts for the remainder of the SMTP
50612 connection.
50613 </para>
50614 </listitem>
50615 <listitem>
50616 <para>
50617 If authentication fails, the client may give up, or it may try a different
50618 authentication mechanism, or it may try transferring mail over the
50619 unauthenticated connection.
50620 </para>
50621 </listitem>
50622 </itemizedlist>
50623 <para>
50624 If you are setting up a client, and want to know which authentication
50625 mechanisms the server supports, you can use Telnet to connect to port 25 (the
50626 SMTP port) on the server, and issue an EHLO command. The response to this
50627 includes the list of supported mechanisms. For example:
50628 </para>
50629 <literallayout>
50630 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
50631 <literal>Trying 192.168.34.25...</literal>
50632 <literal>Connected to server.example.</literal>
50633 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
50634 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
50635 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
50636 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
50637 <literal>250-SIZE 52428800</literal>
50638 <literal>250-PIPELINING</literal>
50639 <literal>250-AUTH PLAIN</literal>
50640 <literal>250 HELP</literal>
50641 </literallayout>
50642 <para>
50643 The second-last line of this example output shows that the server supports
50644 authentication using the PLAIN mechanism. In Exim, the different authentication
50645 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
50646 routers and transports, which authenticators are included in the binary is
50647 controlled by build-time definitions. The following are currently available,
50648 included by setting
50649 </para>
50650 <literallayout class="monospaced">
50651 AUTH_CRAM_MD5=yes
50652 AUTH_CYRUS_SASL=yes
50653 AUTH_DOVECOT=yes
50654 AUTH_GSASL=yes
50655 AUTH_HEIMDAL_GSSAPI=yes
50656 AUTH_PLAINTEXT=yes
50657 AUTH_SPA=yes
50658 AUTH_TLS=yes
50659 </literallayout>
50660 <para>
50661 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
50662 authentication mechanism (RFC 2195), and the second provides an interface to
50663 the Cyrus SASL authentication library.
50664 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
50665 work via a socket interface.
50666 The fourth provides an interface to the GNU SASL authentication library, which
50667 provides mechanisms but typically not data sources.
50668 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
50669 supporting setting a server keytab.
50670 The sixth can be configured to support
50671 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
50672 not formally documented, but used by several MUAs. The seventh authenticator
50673 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
50674 The eighth is an Exim authenticator but not an SMTP one;
50675 instead it can use information from a TLS negotiation.
50676 </para>
50677 <para>
50678 The authenticators are configured using the same syntax as other drivers (see
50679 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
50680 authentication section need be present in the configuration file. Each
50681 authenticator can in principle have both server and client functions. When Exim
50682 is receiving SMTP mail, it is acting as a server; when it is sending out
50683 messages over SMTP, it is acting as a client. Authenticator configuration
50684 options are provided for use in both these circumstances.
50685 </para>
50686 <para>
50687 To make it clear which options apply to which situation, the prefixes
50688 <option>server_</option> and <option>client_</option> are used on option names that are specific to
50689 either the server or the client function, respectively. Server and client
50690 functions are disabled if none of their options are set. If an authenticator is
50691 to be used for both server and client functions, a single definition, using
50692 both sets of options, is required. For example:
50693 </para>
50694 <literallayout class="monospaced">
50695 cram:
50696   driver = cram_md5
50697   public_name = CRAM-MD5
50698   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
50699   client_name = ph10
50700   client_secret = secret2
50701 </literallayout>
50702 <para>
50703 The <option>server_</option> option is used when Exim is acting as a server, and the
50704 <option>client_</option> options when it is acting as a client.
50705 </para>
50706 <para>
50707 Descriptions of the individual authenticators are given in subsequent chapters.
50708 The remainder of this chapter covers the generic options for the
50709 authenticators, followed by general discussion of the way authentication works
50710 in Exim.
50711 </para>
50712 <para>
50713 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
50714 per-mechanism basis.  Please read carefully to determine which variables hold
50715 account labels such as usercodes and which hold passwords or other
50716 authenticating data.
50717 </para>
50718 <para>
50719 Note that some mechanisms support two different identifiers for accounts: the
50720 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
50721 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
50722 Conceptually, authentication data such as passwords are tied to the identifier
50723 used to authenticate; servers may have rules to permit one user to act as a
50724 second user, so that after login the session is treated as though that second
50725 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
50726 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
50727 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
50728 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
50729 choose to honour.
50730 </para>
50731 <para>
50732 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
50733 to a client to help it select an account and credentials to use.  In some
50734 mechanisms, the client and server provably agree on the realm, but clients
50735 typically can not treat the realm as secure data to be blindly trusted.
50736 </para>
50737 <section id="SECID168">
50738 <title>Generic options for authenticators</title>
50739 <para>
50740 <indexterm role="concept">
50741 <primary>authentication</primary>
50742 <secondary>generic options</secondary>
50743 </indexterm>
50744 <indexterm role="concept">
50745 <primary>options</primary>
50746 <secondary>generic; for authenticators</secondary>
50747 </indexterm>
50748 </para>
50749 <para>
50750 <indexterm role="option">
50751 <primary><option>client_condition</option></primary>
50752 </indexterm>
50753 </para>
50754 <informaltable frame="all">
50755 <tgroup cols="4" colsep="0" rowsep="0">
50756 <colspec colwidth="8*" align="left"/>
50757 <colspec colwidth="6*" align="center"/>
50758 <colspec colwidth="6*" align="center"/>
50759 <colspec colwidth="6*" align="right"/>
50760 <tbody>
50761 <row>
50762 <entry><option>client_condition</option></entry>
50763 <entry>Use: <emphasis>authenticators</emphasis></entry>
50764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50765 <entry>Default: <emphasis>unset</emphasis></entry>
50766 </row>
50767 </tbody>
50768 </tgroup>
50769 </informaltable>
50770 <para>
50771 When Exim is authenticating as a client, it skips any authenticator whose
50772 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
50773 used, for example, to skip plain text authenticators when the connection is not
50774 encrypted by a setting such as:
50775 </para>
50776 <literallayout class="monospaced">
50777 client_condition = ${if !eq{$tls_out_cipher}{}}
50778 </literallayout>
50779 <para>
50780 <indexterm role="option">
50781 <primary><option>client_set_id</option></primary>
50782 </indexterm>
50783 </para>
50784 <informaltable frame="all">
50785 <tgroup cols="4" colsep="0" rowsep="0">
50786 <colspec colwidth="8*" align="left"/>
50787 <colspec colwidth="6*" align="center"/>
50788 <colspec colwidth="6*" align="center"/>
50789 <colspec colwidth="6*" align="right"/>
50790 <tbody>
50791 <row>
50792 <entry><option>client_set_id</option></entry>
50793 <entry>Use: <emphasis>authenticators</emphasis></entry>
50794 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50795 <entry>Default: <emphasis>unset</emphasis></entry>
50796 </row>
50797 </tbody>
50798 </tgroup>
50799 </informaltable>
50800 <para>
50801 When client authentication succeeds, this condition is expanded; the
50802 result is used in the log lines for outbound messages.
50803 Typically it will be the user name used for authentication.
50804 </para>
50805 <para>
50806 <indexterm role="option">
50807 <primary><option>driver</option></primary>
50808 </indexterm>
50809 </para>
50810 <informaltable frame="all">
50811 <tgroup cols="4" colsep="0" rowsep="0">
50812 <colspec colwidth="8*" align="left"/>
50813 <colspec colwidth="6*" align="center"/>
50814 <colspec colwidth="6*" align="center"/>
50815 <colspec colwidth="6*" align="right"/>
50816 <tbody>
50817 <row>
50818 <entry><option>driver</option></entry>
50819 <entry>Use: <emphasis>authenticators</emphasis></entry>
50820 <entry>Type: <emphasis>string</emphasis></entry>
50821 <entry>Default: <emphasis>unset</emphasis></entry>
50822 </row>
50823 </tbody>
50824 </tgroup>
50825 </informaltable>
50826 <para>
50827 This option must always be set. It specifies which of the available
50828 authenticators is to be used.
50829 </para>
50830 <para>
50831 <indexterm role="option">
50832 <primary><option>public_name</option></primary>
50833 </indexterm>
50834 </para>
50835 <informaltable frame="all">
50836 <tgroup cols="4" colsep="0" rowsep="0">
50837 <colspec colwidth="8*" align="left"/>
50838 <colspec colwidth="6*" align="center"/>
50839 <colspec colwidth="6*" align="center"/>
50840 <colspec colwidth="6*" align="right"/>
50841 <tbody>
50842 <row>
50843 <entry><option>public_name</option></entry>
50844 <entry>Use: <emphasis>authenticators</emphasis></entry>
50845 <entry>Type: <emphasis>string</emphasis></entry>
50846 <entry>Default: <emphasis>unset</emphasis></entry>
50847 </row>
50848 </tbody>
50849 </tgroup>
50850 </informaltable>
50851 <para>
50852 This option specifies the name of the authentication mechanism that the driver
50853 implements, and by which it is known to the outside world. These names should
50854 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
50855 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
50856 defaults to the driver&#x2019;s instance name.
50857 </para>
50858 <para>
50859 <indexterm role="option">
50860 <primary><option>server_advertise_condition</option></primary>
50861 </indexterm>
50862 </para>
50863 <informaltable frame="all">
50864 <tgroup cols="4" colsep="0" rowsep="0">
50865 <colspec colwidth="8*" align="left"/>
50866 <colspec colwidth="6*" align="center"/>
50867 <colspec colwidth="6*" align="center"/>
50868 <colspec colwidth="6*" align="right"/>
50869 <tbody>
50870 <row>
50871 <entry><option>server_advertise_condition</option></entry>
50872 <entry>Use: <emphasis>authenticators</emphasis></entry>
50873 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50874 <entry>Default: <emphasis>unset</emphasis></entry>
50875 </row>
50876 </tbody>
50877 </tgroup>
50878 </informaltable>
50879 <para>
50880 When a server is about to advertise an authentication mechanism, the condition
50881 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
50882 mechanism is not advertised.
50883 If the expansion fails, the mechanism is not advertised. If the failure was not
50884 forced, and was not caused by a lookup defer, the incident is logged.
50885 See section <xref linkend="SECTauthexiser"/> below for further discussion.
50886 </para>
50887 <para>
50888 <indexterm role="option">
50889 <primary><option>server_condition</option></primary>
50890 </indexterm>
50891 </para>
50892 <informaltable frame="all">
50893 <tgroup cols="4" colsep="0" rowsep="0">
50894 <colspec colwidth="8*" align="left"/>
50895 <colspec colwidth="6*" align="center"/>
50896 <colspec colwidth="6*" align="center"/>
50897 <colspec colwidth="6*" align="right"/>
50898 <tbody>
50899 <row>
50900 <entry><option>server_condition</option></entry>
50901 <entry>Use: <emphasis>authenticators</emphasis></entry>
50902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50903 <entry>Default: <emphasis>unset</emphasis></entry>
50904 </row>
50905 </tbody>
50906 </tgroup>
50907 </informaltable>
50908 <para>
50909 This option must be set for a <option>plaintext</option> server authenticator, where it
50910 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
50911 for details.
50912 </para>
50913 <para>
50914 For the <command>gsasl</command> authenticator, this option is required for various
50915 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
50916 </para>
50917 <para>
50918 For the other authenticators, <option>server_condition</option> can be used as an additional
50919 authentication or authorization mechanism that is applied after the other
50920 authenticator conditions succeed. If it is set, it is expanded when the
50921 authenticator would otherwise return a success code. If the expansion is forced
50922 to fail, authentication fails. Any other expansion failure causes a temporary
50923 error code to be returned. If the result of a successful expansion is an empty
50924 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50925 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
50926 other result, a temporary error code is returned, with the expanded string as
50927 the error text.
50928 </para>
50929 <para>
50930 <indexterm role="option">
50931 <primary><option>server_debug_print</option></primary>
50932 </indexterm>
50933 </para>
50934 <informaltable frame="all">
50935 <tgroup cols="4" colsep="0" rowsep="0">
50936 <colspec colwidth="8*" align="left"/>
50937 <colspec colwidth="6*" align="center"/>
50938 <colspec colwidth="6*" align="center"/>
50939 <colspec colwidth="6*" align="right"/>
50940 <tbody>
50941 <row>
50942 <entry><option>server_debug_print</option></entry>
50943 <entry>Use: <emphasis>authenticators</emphasis></entry>
50944 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50945 <entry>Default: <emphasis>unset</emphasis></entry>
50946 </row>
50947 </tbody>
50948 </tgroup>
50949 </informaltable>
50950 <para>
50951 If this option is set and authentication debugging is enabled (see the <option>-d</option>
50952 command line option), the string is expanded and included in the debugging
50953 output when the authenticator is run as a server. This can help with checking
50954 out the values of variables.
50955 If expansion of the string fails, the error message is written to the debugging
50956 output, and Exim carries on processing.
50957 </para>
50958 <para>
50959 <indexterm role="option">
50960 <primary><option>server_set_id</option></primary>
50961 </indexterm>
50962 </para>
50963 <informaltable frame="all">
50964 <tgroup cols="4" colsep="0" rowsep="0">
50965 <colspec colwidth="8*" align="left"/>
50966 <colspec colwidth="6*" align="center"/>
50967 <colspec colwidth="6*" align="center"/>
50968 <colspec colwidth="6*" align="right"/>
50969 <tbody>
50970 <row>
50971 <entry><option>server_set_id</option></entry>
50972 <entry>Use: <emphasis>authenticators</emphasis></entry>
50973 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50974 <entry>Default: <emphasis>unset</emphasis></entry>
50975 </row>
50976 </tbody>
50977 </tgroup>
50978 </informaltable>
50979 <para>
50980 <indexterm role="variable">
50981 <primary><varname>$authenticated_id</varname></primary>
50982 </indexterm>
50983 When an Exim server successfully authenticates a client, this string is
50984 expanded using data from the authentication, and preserved for any incoming
50985 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
50986 lines for incoming messages. For example, a user/password authenticator
50987 configuration might preserve the user name that was used to authenticate, and
50988 refer to it subsequently during delivery of the message.
50989 If expansion fails, the option is ignored.
50990 </para>
50991 <para>
50992 <indexterm role="option">
50993 <primary><option>server_mail_auth_condition</option></primary>
50994 </indexterm>
50995 </para>
50996 <informaltable frame="all">
50997 <tgroup cols="4" colsep="0" rowsep="0">
50998 <colspec colwidth="8*" align="left"/>
50999 <colspec colwidth="6*" align="center"/>
51000 <colspec colwidth="6*" align="center"/>
51001 <colspec colwidth="6*" align="right"/>
51002 <tbody>
51003 <row>
51004 <entry><option>server_mail_auth_condition</option></entry>
51005 <entry>Use: <emphasis>authenticators</emphasis></entry>
51006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51007 <entry>Default: <emphasis>unset</emphasis></entry>
51008 </row>
51009 </tbody>
51010 </tgroup>
51011 </informaltable>
51012 <para>
51013 This option allows a server to discard authenticated sender addresses supplied
51014 as part of MAIL commands in SMTP connections that are authenticated by the
51015 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
51016 as part of the authentication process; instead its (unexpanded) value is
51017 remembered for later use.
51018 How it is used is described in the following section.
51019 </para>
51020 </section>
51021 <section id="SECTauthparamail">
51022 <title>The AUTH parameter on MAIL commands</title>
51023 <para>
51024 <indexterm role="concept">
51025 <primary>authentication</primary>
51026 <secondary>sender; authenticated</secondary>
51027 </indexterm>
51028 <indexterm role="concept">
51029 <primary>AUTH</primary>
51030 <secondary>on MAIL command</secondary>
51031 </indexterm>
51032 When a client supplied an AUTH= item on a MAIL command, Exim applies
51033 the following checks before accepting it as the authenticated sender of the
51034 message:
51035 </para>
51036 <itemizedlist>
51037 <listitem>
51038 <para>
51039 If the connection is not using extended SMTP (that is, HELO was used rather
51040 than EHLO), the use of AUTH= is a syntax error.
51041 </para>
51042 </listitem>
51043 <listitem>
51044 <para>
51045 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
51046 </para>
51047 </listitem>
51048 <listitem>
51049 <para>
51050 <indexterm role="variable">
51051 <primary><varname>$authenticated_sender</varname></primary>
51052 </indexterm>
51053 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
51054 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
51055 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
51056 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
51057 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
51058 given for the MAIL command.
51059 </para>
51060 </listitem>
51061 <listitem>
51062 <para>
51063 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
51064 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
51065 authenticated.
51066 </para>
51067 </listitem>
51068 <listitem>
51069 <para>
51070 If the AUTH= value was accepted by either of the two previous rules, and
51071 the client has authenticated, and the authenticator has a setting for the
51072 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
51073 valued that was saved from the authenticator is expanded. If the expansion
51074 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
51075 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
51076 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
51077 message.
51078 </para>
51079 </listitem>
51080 </itemizedlist>
51081 <para>
51082 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
51083 hosts to which Exim authenticates as a client. Do not confuse this value with
51084 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
51085 process, and which is not usually a complete email address.
51086 </para>
51087 <para>
51088 <indexterm role="variable">
51089 <primary><varname>$sender_address</varname></primary>
51090 </indexterm>
51091 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
51092 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
51093 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
51094 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
51095 ACL is run.
51096 </para>
51097 </section>
51098 <section id="SECTauthexiser">
51099 <title>Authentication on an Exim server</title>
51100 <para>
51101 <indexterm role="concept">
51102 <primary>authentication</primary>
51103 <secondary>on an Exim server</secondary>
51104 </indexterm>
51105 When Exim receives an EHLO command, it advertises the public names of those
51106 authenticators that are configured as servers, subject to the following
51107 conditions:
51108 </para>
51109 <itemizedlist>
51110 <listitem>
51111 <para>
51112 The client host must match <option>auth_advertise_hosts</option> (default *).
51113 </para>
51114 </listitem>
51115 <listitem>
51116 <para>
51117 It the <option>server_advertise_condition</option> option is set, its expansion must not
51118 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
51119 </para>
51120 </listitem>
51121 </itemizedlist>
51122 <para>
51123 The order in which the authenticators are defined controls the order in which
51124 the mechanisms are advertised.
51125 </para>
51126 <para>
51127 Some mail clients (for example, some versions of Netscape) require the user to
51128 provide a name and password for authentication whenever AUTH is advertised,
51129 even though authentication may not in fact be needed (for example, Exim may be
51130 set up to allow unconditional relaying from the client by an IP address check).
51131 You can make such clients more friendly by not advertising AUTH to them.
51132 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
51133 that runs for RCPT) to relay without authentication, you should set
51134 </para>
51135 <literallayout class="monospaced">
51136 auth_advertise_hosts = ! 10.9.8.0/24
51137 </literallayout>
51138 <para>
51139 so that no authentication mechanisms are advertised to them.
51140 </para>
51141 <para>
51142 The <option>server_advertise_condition</option> controls the advertisement of individual
51143 authentication mechanisms. For example, it can be used to restrict the
51144 advertisement of a particular mechanism to encrypted connections, by a setting
51145 such as:
51146 </para>
51147 <literallayout class="monospaced">
51148 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
51149 </literallayout>
51150 <para>
51151 <indexterm role="variable">
51152 <primary><varname>$tls_in_cipher</varname></primary>
51153 </indexterm>
51154 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
51155 yields <quote>yes</quote>, which allows the advertisement to happen.
51156 </para>
51157 <para>
51158 When an Exim server receives an AUTH command from a client, it rejects it
51159 immediately if AUTH was not advertised in response to an earlier EHLO
51160 command. This is the case if
51161 </para>
51162 <itemizedlist>
51163 <listitem>
51164 <para>
51165 The client host does not match <option>auth_advertise_hosts</option>; or
51166 </para>
51167 </listitem>
51168 <listitem>
51169 <para>
51170 No authenticators are configured with server options; or
51171 </para>
51172 </listitem>
51173 <listitem>
51174 <para>
51175 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
51176 server authenticators.
51177 </para>
51178 </listitem>
51179 </itemizedlist>
51180 <para>
51181 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
51182 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
51183 AUTH is accepted from any client host.
51184 </para>
51185 <para>
51186 If AUTH is not rejected by the ACL, Exim searches its configuration for a
51187 server authentication mechanism that was advertised in response to EHLO and
51188 that matches the one named in the AUTH command. If it finds one, it runs
51189 the appropriate authentication protocol, and authentication either succeeds or
51190 fails. If there is no matching advertised mechanism, the AUTH command is
51191 rejected with a 504 error.
51192 </para>
51193 <para>
51194 <indexterm role="variable">
51195 <primary><varname>$received_protocol</varname></primary>
51196 </indexterm>
51197 <indexterm role="variable">
51198 <primary><varname>$sender_host_authenticated</varname></primary>
51199 </indexterm>
51200 When a message is received from an authenticated host, the value of
51201 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
51202 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
51203 public name) of the authenticator driver that successfully authenticated the
51204 client from which the message was received. This variable is empty if there was
51205 no successful authentication.
51206 </para>
51207 <para revisionflag="changed">
51208 <indexterm role="concept">
51209 <primary>authentication</primary>
51210 <secondary>expansion item</secondary>
51211 </indexterm>
51212 Successful authentication sets up information used by the
51213 <varname>$authresults</varname> expansion item.
51214 </para>
51215 </section>
51216 <section id="SECID169">
51217 <title>Testing server authentication</title>
51218 <para>
51219 <indexterm role="concept">
51220 <primary>authentication</primary>
51221 <secondary>testing a server</secondary>
51222 </indexterm>
51223 <indexterm role="concept">
51224 <primary>AUTH</primary>
51225 <secondary>testing a server</secondary>
51226 </indexterm>
51227 <indexterm role="concept">
51228 <primary>base64 encoding</primary>
51229 <secondary>creating authentication test data</secondary>
51230 </indexterm>
51231 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
51232 configurations. The data for the AUTH command has to be sent using base64
51233 encoding. A quick way to produce such data for testing is the following Perl
51234 script:
51235 </para>
51236 <literallayout class="monospaced">
51237 use MIME::Base64;
51238 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
51239 </literallayout>
51240 <para>
51241 <indexterm role="concept">
51242 <primary>binary zero</primary>
51243 <secondary>in authentication data</secondary>
51244 </indexterm>
51245 This interprets its argument as a Perl string, and then encodes it. The
51246 interpretation as a Perl string allows binary zeros, which are required for
51247 some kinds of authentication, to be included in the data. For example, a
51248 command line to run this script on such data might be
51249 </para>
51250 <literallayout class="monospaced">
51251 encode '\0user\0password'
51252 </literallayout>
51253 <para>
51254 Note the use of single quotes to prevent the shell interpreting the
51255 backslashes, so that they can be interpreted by Perl to specify characters
51256 whose code value is zero.
51257 </para>
51258 <para>
51259 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
51260 digit, you must use three zeros instead of one after the leading backslash. If
51261 you do not, the octal digit that starts your string will be incorrectly
51262 interpreted as part of the code for the first character.
51263 </para>
51264 <para>
51265 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
51266 specially, you must use a Perl escape to prevent them being misinterpreted. For
51267 example, a command such as
51268 </para>
51269 <literallayout class="monospaced">
51270 encode '\0user@domain.com\0pas$$word'
51271 </literallayout>
51272 <para>
51273 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
51274 </para>
51275 <para>
51276 If you have the <option>mimencode</option> command installed, another way to do produce
51277 base64-encoded strings is to run the command
51278 </para>
51279 <literallayout class="monospaced">
51280 echo -e -n `\0user\0password' | mimencode
51281 </literallayout>
51282 <para>
51283 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
51284 in the argument, and the <option>-n</option> option specifies no newline at the end of its
51285 output. However, not all versions of <option>echo</option> recognize these options, so you
51286 should check your version before relying on this suggestion.
51287 </para>
51288 </section>
51289 <section id="SECID170">
51290 <title>Authentication by an Exim client</title>
51291 <para>
51292 <indexterm role="concept">
51293 <primary>authentication</primary>
51294 <secondary>on an Exim client</secondary>
51295 </indexterm>
51296 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
51297 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
51298 announces support for authentication, and the host matches an entry in either
51299 of these options, Exim (as a client) tries to authenticate as follows:
51300 </para>
51301 <itemizedlist>
51302 <listitem>
51303 <para>
51304 For each authenticator that is configured as a client, in the order in which
51305 they are defined in the configuration, it searches the authentication
51306 mechanisms announced by the server for one whose name matches the public name
51307 of the authenticator.
51308 </para>
51309 </listitem>
51310 <listitem>
51311 <para>
51312 <indexterm role="variable">
51313 <primary><varname>$host</varname></primary>
51314 </indexterm>
51315 <indexterm role="variable">
51316 <primary><varname>$host_address</varname></primary>
51317 </indexterm>
51318 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
51319 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
51320 that the client might do. They are set to the server&#x2019;s name and IP address. If
51321 any expansion is forced to fail, the authentication attempt is abandoned, and
51322 Exim moves on to the next authenticator. Otherwise an expansion failure causes
51323 delivery to be deferred.
51324 </para>
51325 </listitem>
51326 <listitem>
51327 <para>
51328 If the result of the authentication attempt is a temporary error or a timeout,
51329 Exim abandons trying to send the message to the host for the moment. It will
51330 try again later. If there are any backup hosts available, they are tried in the
51331 usual way.
51332 </para>
51333 </listitem>
51334 <listitem>
51335 <para>
51336 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
51337 carries on searching the list of authenticators and tries another one if
51338 possible. If all authentication attempts give permanent errors, or if there are
51339 no attempts because no mechanisms match (or option expansions force failure),
51340 what happens depends on whether the host matches <option>hosts_require_auth</option> or
51341 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
51342 delivery is deferred. The error can be detected in the retry rules, and thereby
51343 turned into a permanent error if you wish. In the second case, Exim tries to
51344 deliver the message unauthenticated.
51345 </para>
51346 </listitem>
51347 </itemizedlist>
51348 <para>
51349 Note that the hostlist test for whether to do authentication can be
51350 confused if name-IP lookups change between the time the peer is decided
51351 upon and the time that the transport runs.  For example, with a manualroute
51352 router given a host name, and with DNS "round-robin" used by that name: if
51353 the local resolver cache times out between the router and the transport
51354 running, the transport may get an IP for the name for its authentication
51355 check which does not match the connection peer IP.
51356 No authentication will then be done, despite the names being identical.
51357 </para>
51358 <para>
51359 For such cases use a separate transport which always authenticates.
51360 </para>
51361 <para>
51362 <indexterm role="concept">
51363 <primary>AUTH</primary>
51364 <secondary>on MAIL command</secondary>
51365 </indexterm>
51366 When Exim has authenticated itself to a remote server, it adds the AUTH
51367 parameter to the MAIL commands it sends, if it has an authenticated sender for
51368 the message. If the message came from a remote host, the authenticated sender
51369 is the one that was receiving on an incoming MAIL command, provided that the
51370 incoming connection was authenticated and the <option>server_mail_auth</option> condition
51371 allowed the authenticated sender to be retained. If a local process calls Exim
51372 to send a message, the sender address that is built from the login name and
51373 <option>qualify_domain</option> is treated as authenticated. However, if the
51374 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
51375 the authenticated sender that was received with the message.
51376 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
51377 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
51378 </para>
51379 </section>
51380 </chapter>
51381
51382 <chapter id="CHAPplaintext">
51383 <title>The plaintext authenticator</title>
51384 <para>
51385 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
51386 <primary><command>plaintext</command> authenticator</primary>
51387 </indexterm>
51388 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
51389 <primary>authenticators</primary>
51390 <secondary><command>plaintext</command></secondary>
51391 </indexterm>
51392 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
51393 LOGIN authentication mechanisms, both of which transfer authentication data as
51394 plain (unencrypted) text (though base64 encoded). The use of plain text is a
51395 security risk; you are strongly advised to insist on the use of SMTP encryption
51396 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
51397 use unencrypted plain text, you should not use the same passwords for SMTP
51398 connections as you do for login accounts.
51399 </para>
51400 <section id="SECID171">
51401 <title>Plaintext options</title>
51402 <para>
51403 <indexterm role="concept">
51404 <primary>options</primary>
51405 <secondary><command>plaintext</command> authenticator (server)</secondary>
51406 </indexterm>
51407 When configured as a server, <command>plaintext</command> uses the following options:
51408 </para>
51409 <para>
51410 <indexterm role="option">
51411 <primary><option>server_condition</option></primary>
51412 </indexterm>
51413 </para>
51414 <informaltable frame="all">
51415 <tgroup cols="4" colsep="0" rowsep="0">
51416 <colspec colwidth="8*" align="left"/>
51417 <colspec colwidth="6*" align="center"/>
51418 <colspec colwidth="6*" align="center"/>
51419 <colspec colwidth="6*" align="right"/>
51420 <tbody>
51421 <row>
51422 <entry><option>server_condition</option></entry>
51423 <entry>Use: <emphasis>authenticators</emphasis></entry>
51424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51425 <entry>Default: <emphasis>unset</emphasis></entry>
51426 </row>
51427 </tbody>
51428 </tgroup>
51429 </informaltable>
51430 <para>
51431 This is actually a global authentication option, but it must be set in order to
51432 configure the <command>plaintext</command> driver as a server. Its use is described below.
51433 </para>
51434 <para>
51435 <indexterm role="option">
51436 <primary><option>server_prompts</option></primary>
51437 </indexterm>
51438 </para>
51439 <informaltable frame="all">
51440 <tgroup cols="4" colsep="0" rowsep="0">
51441 <colspec colwidth="8*" align="left"/>
51442 <colspec colwidth="6*" align="center"/>
51443 <colspec colwidth="6*" align="center"/>
51444 <colspec colwidth="6*" align="right"/>
51445 <tbody>
51446 <row>
51447 <entry><option>server_prompts</option></entry>
51448 <entry>Use: <emphasis>plaintext</emphasis></entry>
51449 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51450 <entry>Default: <emphasis>unset</emphasis></entry>
51451 </row>
51452 </tbody>
51453 </tgroup>
51454 </informaltable>
51455 <para>
51456 The contents of this option, after expansion, must be a colon-separated list of
51457 prompt strings. If expansion fails, a temporary authentication rejection is
51458 given.
51459 </para>
51460 </section>
51461 <section id="SECTplainserver">
51462 <title>Using plaintext in a server</title>
51463 <para>
51464 <indexterm role="concept">
51465 <primary>AUTH</primary>
51466 <secondary>in <command>plaintext</command> authenticator</secondary>
51467 </indexterm>
51468 <indexterm role="concept">
51469 <primary>binary zero</primary>
51470 <secondary>in <command>plaintext</command> authenticator</secondary>
51471 </indexterm>
51472 <indexterm role="concept">
51473 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51474 <secondary>in <command>plaintext</command> authenticator</secondary>
51475 </indexterm>
51476 <indexterm role="variable">
51477 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51478 </indexterm>
51479 <indexterm role="concept">
51480 <primary>base64 encoding</primary>
51481 <secondary>in <command>plaintext</command> authenticator</secondary>
51482 </indexterm>
51483 </para>
51484 <para>
51485 When running as a server, <command>plaintext</command> performs the authentication test by
51486 expanding a string. The data sent by the client with the AUTH command, or in
51487 response to subsequent prompts, is base64 encoded, and so may contain any byte
51488 values when decoded. If any data is supplied with the command, it is treated as
51489 a list of strings, separated by NULs (binary zeros), the first three of which
51490 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
51491 (neither LOGIN nor PLAIN uses more than three strings).
51492 </para>
51493 <para>
51494 For compatibility with previous releases of Exim, the values are also placed in
51495 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
51496 variables for this purpose is now deprecated, as it can lead to confusion in
51497 string expansions that also use them for other things.
51498 </para>
51499 <para>
51500 If there are more strings in <option>server_prompts</option> than the number of strings
51501 supplied with the AUTH command, the remaining prompts are used to obtain more
51502 data. Each response from the client may be a list of NUL-separated strings.
51503 </para>
51504 <para>
51505 <indexterm role="variable">
51506 <primary><varname>$authenticated_id</varname></primary>
51507 </indexterm>
51508 Once a sufficient number of data strings have been received,
51509 <option>server_condition</option> is expanded. If the expansion is forced to fail,
51510 authentication fails. Any other expansion failure causes a temporary error code
51511 to be returned. If the result of a successful expansion is an empty string,
51512 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
51513 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
51514 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
51515 For any other result, a temporary error code is returned, with the expanded
51516 string as the error text
51517 </para>
51518 <para>
51519 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
51520 password, be sure to make the authentication fail if the user is unknown.
51521 There are good and bad examples at the end of the next section.
51522 </para>
51523 </section>
51524 <section id="SECID172">
51525 <title>The PLAIN authentication mechanism</title>
51526 <para>
51527 <indexterm role="concept">
51528 <primary>PLAIN authentication mechanism</primary>
51529 </indexterm>
51530 <indexterm role="concept">
51531 <primary>authentication</primary>
51532 <secondary>PLAIN mechanism</secondary>
51533 </indexterm>
51534 <indexterm role="concept">
51535 <primary>binary zero</primary>
51536 <secondary>in <command>plaintext</command> authenticator</secondary>
51537 </indexterm>
51538 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
51539 sent as one item of data (that is, one combined string containing two NUL
51540 separators). The data is sent either as part of the AUTH command, or
51541 subsequently in response to an empty prompt from the server.
51542 </para>
51543 <para>
51544 The second and third strings are a user name and a corresponding password.
51545 Using a single fixed user name and password as an example, this could be
51546 configured as follows:
51547 </para>
51548 <literallayout class="monospaced">
51549 fixed_plain:
51550   driver = plaintext
51551   public_name = PLAIN
51552   server_prompts = :
51553   server_condition = \
51554     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
51555   server_set_id = $auth2
51556 </literallayout>
51557 <para>
51558 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
51559 are exactly what we want here, so they need not be specified. Obviously, if the
51560 password contains expansion-significant characters such as dollar, backslash,
51561 or closing brace, they have to be escaped.
51562 </para>
51563 <para>
51564 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
51565 the end of a string list are ignored). If all the data comes as part of the
51566 AUTH command, as is commonly the case, the prompt is not used. This
51567 authenticator is advertised in the response to EHLO as
51568 </para>
51569 <literallayout class="monospaced">
51570 250-AUTH PLAIN
51571 </literallayout>
51572 <para>
51573 and a client host can authenticate itself by sending the command
51574 </para>
51575 <literallayout class="monospaced">
51576 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
51577 </literallayout>
51578 <para>
51579 As this contains three strings (more than the number of prompts), no further
51580 data is required from the client. Alternatively, the client may just send
51581 </para>
51582 <literallayout class="monospaced">
51583 AUTH PLAIN
51584 </literallayout>
51585 <para>
51586 to initiate authentication, in which case the server replies with an empty
51587 prompt. The client must respond with the combined data string.
51588 </para>
51589 <para>
51590 The data string is base64 encoded, as required by the RFC. This example,
51591 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;
51592 represents a zero byte. This is split up into three strings, the first of which
51593 is empty. The <option>server_condition</option> option in the authenticator checks that the
51594 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
51595 </para>
51596 <para>
51597 Having just one fixed user name and password, as in this example, is not very
51598 realistic, though for a small organization with only a handful of
51599 authenticating clients it could make sense.
51600 </para>
51601 <para>
51602 A more sophisticated instance of this authenticator could use the user name in
51603 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
51604 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
51605 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
51606 This is an incorrect example:
51607 </para>
51608 <literallayout class="monospaced">
51609 server_condition = \
51610   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
51611 </literallayout>
51612 <para>
51613 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
51614 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
51615 incorrect? It works fine for existing users, but consider what happens if a
51616 non-existent user name is given. The lookup fails, but as no success/failure
51617 strings are given for the lookup, it yields an empty string. Thus, to defeat
51618 the authentication, all a client has to do is to supply a non-existent user
51619 name and an empty password. The correct way of writing this test is:
51620 </para>
51621 <literallayout class="monospaced">
51622 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
51623   {${if eq{$value}{$auth3}}} {false}}
51624 </literallayout>
51625 <para>
51626 In this case, if the lookup succeeds, the result is checked; if the lookup
51627 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
51628 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
51629 always fails if its second argument is empty. However, the second way of
51630 writing the test makes the logic clearer.
51631 </para>
51632 </section>
51633 <section id="SECID173">
51634 <title>The LOGIN authentication mechanism</title>
51635 <para>
51636 <indexterm role="concept">
51637 <primary>LOGIN authentication mechanism</primary>
51638 </indexterm>
51639 <indexterm role="concept">
51640 <primary>authentication</primary>
51641 <secondary>LOGIN mechanism</secondary>
51642 </indexterm>
51643 The LOGIN authentication mechanism is not documented in any RFC, but is in use
51644 in a number of programs. No data is sent with the AUTH command. Instead, a
51645 user name and password are supplied separately, in response to prompts. The
51646 plaintext authenticator can be configured to support this as in this example:
51647 </para>
51648 <literallayout class="monospaced">
51649 fixed_login:
51650   driver = plaintext
51651   public_name = LOGIN
51652   server_prompts = User Name : Password
51653   server_condition = \
51654     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
51655   server_set_id = $auth1
51656 </literallayout>
51657 <para>
51658 Because of the way plaintext operates, this authenticator accepts data supplied
51659 with the AUTH command (in contravention of the specification of LOGIN), but
51660 if the client does not supply it (as is the case for LOGIN clients), the prompt
51661 strings are used to obtain two data items.
51662 </para>
51663 <para>
51664 Some clients are very particular about the precise text of the prompts. For
51665 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
51666 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
51667 strings. It uses the <option>ldapauth</option> expansion condition to check the user
51668 name and password by binding to an LDAP server:
51669 </para>
51670 <literallayout class="monospaced">
51671 login:
51672   driver = plaintext
51673   public_name = LOGIN
51674   server_prompts = Username:: : Password::
51675   server_condition = ${if and{{ \
51676     !eq{}{$auth1} }{ \
51677     ldapauth{\
51678       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
51679       pass=${quote:$auth2} \
51680       ldap://ldap.example.org/} }} }
51681   server_set_id = uid=$auth1,ou=people,o=example.org
51682 </literallayout>
51683 <para>
51684 We have to check that the username is not empty before using it, because LDAP
51685 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
51686 operator to correctly quote the DN for authentication. However, the basic
51687 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
51688 correct one to use for the password, because quoting is needed only to make
51689 the password conform to the Exim syntax. At the LDAP level, the password is an
51690 uninterpreted string.
51691 </para>
51692 </section>
51693 <section id="SECID174">
51694 <title>Support for different kinds of authentication</title>
51695 <para>
51696 A number of string expansion features are provided for the purpose of
51697 interfacing to different ways of user authentication. These include checking
51698 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
51699 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
51700 <xref linkend="SECTexpcond"/>.
51701 </para>
51702 </section>
51703 <section id="SECID175">
51704 <title>Using plaintext in a client</title>
51705 <para>
51706 <indexterm role="concept">
51707 <primary>options</primary>
51708 <secondary><command>plaintext</command> authenticator (client)</secondary>
51709 </indexterm>
51710 The <command>plaintext</command> authenticator has two client options:
51711 </para>
51712 <para>
51713 <indexterm role="option">
51714 <primary><option>client_ignore_invalid_base64</option></primary>
51715 </indexterm>
51716 </para>
51717 <informaltable frame="all">
51718 <tgroup cols="4" colsep="0" rowsep="0">
51719 <colspec colwidth="8*" align="left"/>
51720 <colspec colwidth="6*" align="center"/>
51721 <colspec colwidth="6*" align="center"/>
51722 <colspec colwidth="6*" align="right"/>
51723 <tbody>
51724 <row>
51725 <entry><option>client_ignore_invalid_base64</option></entry>
51726 <entry>Use: <emphasis>plaintext</emphasis></entry>
51727 <entry>Type: <emphasis>boolean</emphasis></entry>
51728 <entry>Default: <emphasis>false</emphasis></entry>
51729 </row>
51730 </tbody>
51731 </tgroup>
51732 </informaltable>
51733 <para>
51734 If the client receives a server prompt that is not a valid base64 string,
51735 authentication is abandoned by default. However, if this option is set true,
51736 the error in the challenge is ignored and the client sends the response as
51737 usual.
51738 </para>
51739 <para>
51740 <indexterm role="option">
51741 <primary><option>client_send</option></primary>
51742 </indexterm>
51743 </para>
51744 <informaltable frame="all">
51745 <tgroup cols="4" colsep="0" rowsep="0">
51746 <colspec colwidth="8*" align="left"/>
51747 <colspec colwidth="6*" align="center"/>
51748 <colspec colwidth="6*" align="center"/>
51749 <colspec colwidth="6*" align="right"/>
51750 <tbody>
51751 <row>
51752 <entry><option>client_send</option></entry>
51753 <entry>Use: <emphasis>plaintext</emphasis></entry>
51754 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51755 <entry>Default: <emphasis>unset</emphasis></entry>
51756 </row>
51757 </tbody>
51758 </tgroup>
51759 </informaltable>
51760 <para>
51761 The string is a colon-separated list of authentication data strings. Each
51762 string is independently expanded before being sent to the server. The first
51763 string is sent with the AUTH command; any more strings are sent in response
51764 to prompts from the server. Before each string is expanded, the value of the
51765 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
51766 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
51767 way. Thus, the prompt that is received in response to sending the first string
51768 (with the AUTH command) can be used in the expansion of the second string, and
51769 so on. If an invalid base64 string is received when
51770 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
51771 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
51772 </para>
51773 <para>
51774 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
51775 splitting takes priority and happens first.
51776 </para>
51777 <para>
51778 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
51779 the data, further processing is applied to each string before it is sent. If
51780 there are any single circumflex characters in the string, they are converted to
51781 NULs. Should an actual circumflex be required as data, it must be doubled in
51782 the string.
51783 </para>
51784 <para>
51785 This is an example of a client configuration that implements the PLAIN
51786 authentication mechanism with a fixed user name and password:
51787 </para>
51788 <literallayout class="monospaced">
51789 fixed_plain:
51790   driver = plaintext
51791   public_name = PLAIN
51792   client_send = ^username^mysecret
51793 </literallayout>
51794 <para>
51795 The lack of colons means that the entire text is sent with the AUTH
51796 command, with the circumflex characters converted to NULs. A similar example
51797 that uses the LOGIN mechanism is:
51798 </para>
51799 <literallayout class="monospaced">
51800 fixed_login:
51801   driver = plaintext
51802   public_name = LOGIN
51803   client_send = : username : mysecret
51804 </literallayout>
51805 <para>
51806 The initial colon means that the first string is empty, so no data is sent with
51807 the AUTH command itself. The remaining strings are sent in response to
51808 prompts.
51809 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
51810 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
51811 </para>
51812 </section>
51813 </chapter>
51814
51815 <chapter id="CHID9">
51816 <title>The cram_md5 authenticator</title>
51817 <para>
51818 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
51819 <primary><command>cram_md5</command> authenticator</primary>
51820 </indexterm>
51821 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
51822 <primary>authenticators</primary>
51823 <secondary><command>cram_md5</command></secondary>
51824 </indexterm>
51825 <indexterm role="concept">
51826 <primary>CRAM-MD5 authentication mechanism</primary>
51827 </indexterm>
51828 <indexterm role="concept">
51829 <primary>authentication</primary>
51830 <secondary>CRAM-MD5 mechanism</secondary>
51831 </indexterm>
51832 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
51833 sends a challenge string to the client, and the response consists of a user
51834 name and the CRAM-MD5 digest of the challenge string combined with a secret
51835 string (password) which is known to both server and client. Thus, the secret
51836 is not sent over the network as plain text, which makes this authenticator more
51837 secure than <command>plaintext</command>. However, the downside is that the secret has to be
51838 available in plain text at either end.
51839 </para>
51840 <section id="SECID176">
51841 <title>Using cram_md5 as a server</title>
51842 <para>
51843 <indexterm role="concept">
51844 <primary>options</primary>
51845 <secondary><command>cram_md5</command> authenticator (server)</secondary>
51846 </indexterm>
51847 This authenticator has one server option, which must be set to configure the
51848 authenticator as a server:
51849 </para>
51850 <para>
51851 <indexterm role="option">
51852 <primary><option>server_secret</option></primary>
51853 </indexterm>
51854 </para>
51855 <informaltable frame="all">
51856 <tgroup cols="4" colsep="0" rowsep="0">
51857 <colspec colwidth="8*" align="left"/>
51858 <colspec colwidth="6*" align="center"/>
51859 <colspec colwidth="6*" align="center"/>
51860 <colspec colwidth="6*" align="right"/>
51861 <tbody>
51862 <row>
51863 <entry><option>server_secret</option></entry>
51864 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51866 <entry>Default: <emphasis>unset</emphasis></entry>
51867 </row>
51868 </tbody>
51869 </tgroup>
51870 </informaltable>
51871 <para>
51872 <indexterm role="concept">
51873 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51874 <secondary>in <command>cram_md5</command> authenticator</secondary>
51875 </indexterm>
51876 When the server receives the client&#x2019;s response, the user name is placed in
51877 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
51878 obtain the password for that user. The server then computes the CRAM-MD5 digest
51879 that the client should have sent, and checks that it received the correct
51880 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
51881 fails. If the expansion fails for some other reason, a temporary error code is
51882 returned to the client.
51883 </para>
51884 <para>
51885 For compatibility with previous releases of Exim, the user name is also placed
51886 in <varname>$1</varname>. However, the use of this variables for this purpose is now
51887 deprecated, as it can lead to confusion in string expansions that also use
51888 numeric variables for other things.
51889 </para>
51890 <para>
51891 For example, the following authenticator checks that the user name given by the
51892 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
51893 user name, authentication fails.
51894 </para>
51895 <literallayout class="monospaced">
51896 fixed_cram:
51897   driver = cram_md5
51898   public_name = CRAM-MD5
51899   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
51900   server_set_id = $auth1
51901 </literallayout>
51902 <para>
51903 <indexterm role="variable">
51904 <primary><varname>$authenticated_id</varname></primary>
51905 </indexterm>
51906 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
51907 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
51908 secret string in a file, using the user name as the key. For example:
51909 </para>
51910 <literallayout class="monospaced">
51911 lookup_cram:
51912   driver = cram_md5
51913   public_name = CRAM-MD5
51914   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
51915                   {$value}fail}
51916   server_set_id = $auth1
51917 </literallayout>
51918 <para>
51919 Note that this expansion explicitly forces failure if the lookup fails
51920 because <varname>$auth1</varname> contains an unknown user name.
51921 </para>
51922 <para>
51923 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
51924 using the relevant libraries, you need to know the realm to specify in the
51925 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
51926 realm, with:
51927 </para>
51928 <literallayout class="monospaced">
51929 cyrusless_crammd5:
51930   driver = cram_md5
51931   public_name = CRAM-MD5
51932   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
51933                   dbmjz{/etc/sasldb2}{$value}fail}
51934   server_set_id = $auth1
51935 </literallayout>
51936 </section>
51937 <section id="SECID177">
51938 <title>Using cram_md5 as a client</title>
51939 <para>
51940 <indexterm role="concept">
51941 <primary>options</primary>
51942 <secondary><command>cram_md5</command> authenticator (client)</secondary>
51943 </indexterm>
51944 When used as a client, the <command>cram_md5</command> authenticator has two options:
51945 </para>
51946 <para>
51947 <indexterm role="option">
51948 <primary><option>client_name</option></primary>
51949 </indexterm>
51950 </para>
51951 <informaltable frame="all">
51952 <tgroup cols="4" colsep="0" rowsep="0">
51953 <colspec colwidth="8*" align="left"/>
51954 <colspec colwidth="6*" align="center"/>
51955 <colspec colwidth="6*" align="center"/>
51956 <colspec colwidth="6*" align="right"/>
51957 <tbody>
51958 <row>
51959 <entry><option>client_name</option></entry>
51960 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51961 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51962 <entry>Default: <emphasis>the primary host name</emphasis></entry>
51963 </row>
51964 </tbody>
51965 </tgroup>
51966 </informaltable>
51967 <para>
51968 This string is expanded, and the result used as the user name data when
51969 computing the response to the server&#x2019;s challenge.
51970 </para>
51971 <para>
51972 <indexterm role="option">
51973 <primary><option>client_secret</option></primary>
51974 </indexterm>
51975 </para>
51976 <informaltable frame="all">
51977 <tgroup cols="4" colsep="0" rowsep="0">
51978 <colspec colwidth="8*" align="left"/>
51979 <colspec colwidth="6*" align="center"/>
51980 <colspec colwidth="6*" align="center"/>
51981 <colspec colwidth="6*" align="right"/>
51982 <tbody>
51983 <row>
51984 <entry><option>client_secret</option></entry>
51985 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51986 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51987 <entry>Default: <emphasis>unset</emphasis></entry>
51988 </row>
51989 </tbody>
51990 </tgroup>
51991 </informaltable>
51992 <para>
51993 This option must be set for the authenticator to work as a client. Its value is
51994 expanded and the result used as the secret string when computing the response.
51995 </para>
51996 <para>
51997 <indexterm role="variable">
51998 <primary><varname>$host</varname></primary>
51999 </indexterm>
52000 <indexterm role="variable">
52001 <primary><varname>$host_address</varname></primary>
52002 </indexterm>
52003 Different user names and secrets can be used for different servers by referring
52004 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
52005 expansion string is treated as an indication that this authenticator is not
52006 prepared to handle this case. Exim moves on to the next configured client
52007 authenticator. Any other expansion failure causes Exim to give up trying to
52008 send the message to the current server.
52009 </para>
52010 <para>
52011 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
52012 strings, is:
52013 </para>
52014 <literallayout class="monospaced">
52015 fixed_cram:
52016   driver = cram_md5
52017   public_name = CRAM-MD5
52018   client_name = ph10
52019   client_secret = secret
52020 </literallayout>
52021 <para>
52022 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
52023 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
52024 </para>
52025 </section>
52026 </chapter>
52027
52028 <chapter id="CHID10">
52029 <title>The cyrus_sasl authenticator</title>
52030 <para>
52031 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
52032 <primary><command>cyrus_sasl</command> authenticator</primary>
52033 </indexterm>
52034 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
52035 <primary>authenticators</primary>
52036 <secondary><command>cyrus_sasl</command></secondary>
52037 </indexterm>
52038 <indexterm role="concept">
52039 <primary>Cyrus</primary>
52040 <secondary>SASL library</secondary>
52041 </indexterm>
52042 <indexterm role="concept">
52043 <primary>Kerberos</primary>
52044 </indexterm>
52045 The code for this authenticator was provided by Matthew Byng-Maddick of A L
52046 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
52047 </para>
52048 <para>
52049 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
52050 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
52051 Layer</quote>). This library supports a number of authentication mechanisms,
52052 including PLAIN and LOGIN, but also several others that Exim does not support
52053 directly. In particular, there is support for Kerberos authentication.
52054 </para>
52055 <para>
52056 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
52057 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
52058 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
52059 name of the driver to determine which mechanism to support.
52060 </para>
52061 <para>
52062 Where access to some kind of secret file is required, for example in GSSAPI
52063 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
52064 user, and that the Cyrus SASL library has no way of escalating privileges
52065 by default. You may also find you need to set environment variables,
52066 depending on the driver you are using.
52067 </para>
52068 <para>
52069 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
52070 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
52071 Kerberos, note that because of limitations in the GSSAPI interface,
52072 changing the server keytab might need to be communicated down to the Kerberos
52073 layer independently. The mechanism for doing so is dependent upon the Kerberos
52074 implementation.
52075 </para>
52076 <para>
52077 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
52078 may be set to point to an alternative keytab file. Exim will pass this
52079 variable through from its own inherited environment when started as root or the
52080 Exim user. The keytab file needs to be readable by the Exim user.
52081 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
52082 environment variable.  In practice, for those releases, the Cyrus authenticator
52083 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
52084 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
52085 </para>
52086 <section id="SECID178">
52087 <title>Using cyrus_sasl as a server</title>
52088 <para>
52089 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
52090 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
52091 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
52092 use of this variable for this purpose is now deprecated, as it can lead to
52093 confusion in string expansions that also use numeric variables for other
52094 things.
52095 </para>
52096 <para>
52097 <indexterm role="option">
52098 <primary><option>server_hostname</option></primary>
52099 </indexterm>
52100 </para>
52101 <informaltable frame="all">
52102 <tgroup cols="4" colsep="0" rowsep="0">
52103 <colspec colwidth="8*" align="left"/>
52104 <colspec colwidth="6*" align="center"/>
52105 <colspec colwidth="6*" align="center"/>
52106 <colspec colwidth="6*" align="right"/>
52107 <tbody>
52108 <row>
52109 <entry><option>server_hostname</option></entry>
52110 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52111 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52112 <entry>Default: <emphasis>see below</emphasis></entry>
52113 </row>
52114 </tbody>
52115 </tgroup>
52116 </informaltable>
52117 <para>
52118 This option selects the hostname that is used when communicating with the
52119 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
52120 SASL plug-in what it does with this data.
52121 </para>
52122 <para>
52123 <indexterm role="option">
52124 <primary><option>server_mech</option></primary>
52125 </indexterm>
52126 </para>
52127 <informaltable frame="all">
52128 <tgroup cols="4" colsep="0" rowsep="0">
52129 <colspec colwidth="8*" align="left"/>
52130 <colspec colwidth="6*" align="center"/>
52131 <colspec colwidth="6*" align="center"/>
52132 <colspec colwidth="6*" align="right"/>
52133 <tbody>
52134 <row>
52135 <entry><option>server_mech</option></entry>
52136 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52137 <entry>Type: <emphasis>string</emphasis></entry>
52138 <entry>Default: <emphasis>see below</emphasis></entry>
52139 </row>
52140 </tbody>
52141 </tgroup>
52142 </informaltable>
52143 <para>
52144 This option selects the authentication mechanism this driver should use. The
52145 default is the value of the generic <option>public_name</option> option. This option allows
52146 you to use a different underlying mechanism from the advertised name. For
52147 example:
52148 </para>
52149 <literallayout class="monospaced">
52150 sasl:
52151   driver = cyrus_sasl
52152   public_name = X-ANYTHING
52153   server_mech = CRAM-MD5
52154   server_set_id = $auth1
52155 </literallayout>
52156 <para>
52157 <indexterm role="option">
52158 <primary><option>server_realm</option></primary>
52159 </indexterm>
52160 </para>
52161 <informaltable frame="all">
52162 <tgroup cols="4" colsep="0" rowsep="0">
52163 <colspec colwidth="8*" align="left"/>
52164 <colspec colwidth="6*" align="center"/>
52165 <colspec colwidth="6*" align="center"/>
52166 <colspec colwidth="6*" align="right"/>
52167 <tbody>
52168 <row>
52169 <entry><option>server_realm</option></entry>
52170 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52172 <entry>Default: <emphasis>unset</emphasis></entry>
52173 </row>
52174 </tbody>
52175 </tgroup>
52176 </informaltable>
52177 <para>
52178 This specifies the SASL realm that the server claims to be in.
52179 </para>
52180 <para>
52181 <indexterm role="option">
52182 <primary><option>server_service</option></primary>
52183 </indexterm>
52184 </para>
52185 <informaltable frame="all">
52186 <tgroup cols="4" colsep="0" rowsep="0">
52187 <colspec colwidth="8*" align="left"/>
52188 <colspec colwidth="6*" align="center"/>
52189 <colspec colwidth="6*" align="center"/>
52190 <colspec colwidth="6*" align="right"/>
52191 <tbody>
52192 <row>
52193 <entry><option>server_service</option></entry>
52194 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52195 <entry>Type: <emphasis>string</emphasis></entry>
52196 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
52197 </row>
52198 </tbody>
52199 </tgroup>
52200 </informaltable>
52201 <para>
52202 This is the SASL service that the server claims to implement.
52203 </para>
52204 <para>
52205 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
52206 private options. All you need to do is to specify an appropriate mechanism as
52207 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
52208 PLAIN, you could have two authenticators as follows:
52209 </para>
52210 <literallayout class="monospaced">
52211 sasl_cram_md5:
52212   driver = cyrus_sasl
52213   public_name = CRAM-MD5
52214   server_set_id = $auth1
52215
52216 sasl_plain:
52217   driver = cyrus_sasl
52218   public_name = PLAIN
52219   server_set_id = $auth2
52220 </literallayout>
52221 <para>
52222 Cyrus SASL does implement the LOGIN authentication method, even though it is
52223 not a standard method. It is disabled by default in the source distribution,
52224 but it is present in many binary distributions.
52225 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
52226 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
52227 </para>
52228 </section>
52229 </chapter>
52230
52231 <chapter id="CHAPdovecot">
52232 <title>The dovecot authenticator</title>
52233 <para>
52234 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
52235 <primary><command>dovecot</command> authenticator</primary>
52236 </indexterm>
52237 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
52238 <primary>authenticators</primary>
52239 <secondary><command>dovecot</command></secondary>
52240 </indexterm>
52241 This authenticator is an interface to the authentication facility of the
52242 Dovecot POP/IMAP server, which can support a number of authentication methods.
52243 Note that Dovecot must be configured to use auth-client not auth-userdb.
52244 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
52245 to use the same mechanisms for SMTP authentication. This is a server
52246 authenticator only. There is only one option:
52247 </para>
52248 <para>
52249 <indexterm role="option">
52250 <primary><option>server_socket</option></primary>
52251 </indexterm>
52252 </para>
52253 <informaltable frame="all">
52254 <tgroup cols="4" colsep="0" rowsep="0">
52255 <colspec colwidth="8*" align="left"/>
52256 <colspec colwidth="6*" align="center"/>
52257 <colspec colwidth="6*" align="center"/>
52258 <colspec colwidth="6*" align="right"/>
52259 <tbody>
52260 <row>
52261 <entry><option>server_socket</option></entry>
52262 <entry>Use: <emphasis>dovecot</emphasis></entry>
52263 <entry>Type: <emphasis>string</emphasis></entry>
52264 <entry>Default: <emphasis>unset</emphasis></entry>
52265 </row>
52266 </tbody>
52267 </tgroup>
52268 </informaltable>
52269 <para>
52270 This option must specify the socket that is the interface to Dovecot
52271 authentication. The <option>public_name</option> option must specify an authentication
52272 mechanism that Dovecot is configured to support. You can have several
52273 authenticators for different mechanisms. For example:
52274 </para>
52275 <literallayout class="monospaced">
52276 dovecot_plain:
52277   driver = dovecot
52278   public_name = PLAIN
52279   server_socket = /var/run/dovecot/auth-client
52280   server_set_id = $auth1
52281
52282 dovecot_ntlm:
52283   driver = dovecot
52284   public_name = NTLM
52285   server_socket = /var/run/dovecot/auth-client
52286   server_set_id = $auth1
52287 </literallayout>
52288 <para>
52289 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
52290 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
52291 option is passed in the Dovecot authentication command. If, for a TLS
52292 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
52293 option is passed. When authentication succeeds, the identity of the user
52294 who authenticated is placed in <varname>$auth1</varname>.
52295 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
52296 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
52297 </para>
52298 </chapter>
52299
52300 <chapter id="CHAPgsasl">
52301 <title>The gsasl authenticator</title>
52302 <para>
52303 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
52304 <primary><command>gsasl</command> authenticator</primary>
52305 </indexterm>
52306 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
52307 <primary>authenticators</primary>
52308 <secondary><command>gsasl</command></secondary>
52309 </indexterm>
52310 <indexterm role="concept">
52311 <primary>authentication</primary>
52312 <secondary>GNU SASL</secondary>
52313 </indexterm>
52314 <indexterm role="concept">
52315 <primary>authentication</primary>
52316 <secondary>SASL</secondary>
52317 </indexterm>
52318 <indexterm role="concept">
52319 <primary>authentication</primary>
52320 <secondary>EXTERNAL</secondary>
52321 </indexterm>
52322 <indexterm role="concept">
52323 <primary>authentication</primary>
52324 <secondary>ANONYMOUS</secondary>
52325 </indexterm>
52326 <indexterm role="concept">
52327 <primary>authentication</primary>
52328 <secondary>PLAIN</secondary>
52329 </indexterm>
52330 <indexterm role="concept">
52331 <primary>authentication</primary>
52332 <secondary>LOGIN</secondary>
52333 </indexterm>
52334 <indexterm role="concept">
52335 <primary>authentication</primary>
52336 <secondary>DIGEST-MD5</secondary>
52337 </indexterm>
52338 <indexterm role="concept">
52339 <primary>authentication</primary>
52340 <secondary>CRAM-MD5</secondary>
52341 </indexterm>
52342 <indexterm role="concept">
52343 <primary>authentication</primary>
52344 <secondary>SCRAM-SHA-1</secondary>
52345 </indexterm>
52346 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
52347 library and the mechanisms it provides.  This is new as of the 4.80 release
52348 and there are a few areas where the library does not let Exim smoothly
52349 scale to handle future authentication mechanisms, so no guarantee can be
52350 made that any particular new authentication mechanism will be supported
52351 without code changes in Exim.
52352 </para>
52353 <para>
52354 <indexterm role="option">
52355 <primary><option>server_channelbinding</option></primary>
52356 </indexterm>
52357 </para>
52358 <informaltable frame="all">
52359 <tgroup cols="4" colsep="0" rowsep="0">
52360 <colspec colwidth="8*" align="left"/>
52361 <colspec colwidth="6*" align="center"/>
52362 <colspec colwidth="6*" align="center"/>
52363 <colspec colwidth="6*" align="right"/>
52364 <tbody>
52365 <row>
52366 <entry><option>server_channelbinding</option></entry>
52367 <entry>Use: <emphasis>gsasl</emphasis></entry>
52368 <entry>Type: <emphasis>boolean</emphasis></entry>
52369 <entry>Default: <emphasis>false</emphasis></entry>
52370 </row>
52371 </tbody>
52372 </tgroup>
52373 </informaltable>
52374 <para>
52375 Some authentication mechanisms are able to use external context at both ends
52376 of the session to bind the authentication to that context, and fail the
52377 authentication process if that context differs.  Specifically, some TLS
52378 ciphersuites can provide identifying information about the cryptographic
52379 context.
52380 </para>
52381 <para>
52382 This means that certificate identity and verification becomes a non-issue,
52383 as a man-in-the-middle attack will cause the correct client and server to
52384 see different identifiers and authentication will fail.
52385 </para>
52386 <para>
52387 This is currently only supported when using the GnuTLS library.  This is
52388 only usable by mechanisms which support "channel binding"; at time of
52389 writing, that&#x2019;s the SCRAM family.
52390 </para>
52391 <para>
52392 This defaults off to ensure smooth upgrade across Exim releases, in case
52393 this option causes some clients to start failing.  Some future release
52394 of Exim may switch the default to be true.
52395 </para>
52396 <para>
52397 <indexterm role="option">
52398 <primary><option>server_hostname</option></primary>
52399 </indexterm>
52400 </para>
52401 <informaltable frame="all">
52402 <tgroup cols="4" colsep="0" rowsep="0">
52403 <colspec colwidth="8*" align="left"/>
52404 <colspec colwidth="6*" align="center"/>
52405 <colspec colwidth="6*" align="center"/>
52406 <colspec colwidth="6*" align="right"/>
52407 <tbody>
52408 <row>
52409 <entry><option>server_hostname</option></entry>
52410 <entry>Use: <emphasis>gsasl</emphasis></entry>
52411 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52412 <entry>Default: <emphasis>see below</emphasis></entry>
52413 </row>
52414 </tbody>
52415 </tgroup>
52416 </informaltable>
52417 <para>
52418 This option selects the hostname that is used when communicating with the
52419 library. The default value is <literal>$primary_hostname</literal>.
52420 Some mechanisms will use this data.
52421 </para>
52422 <para>
52423 <indexterm role="option">
52424 <primary><option>server_mech</option></primary>
52425 </indexterm>
52426 </para>
52427 <informaltable frame="all">
52428 <tgroup cols="4" colsep="0" rowsep="0">
52429 <colspec colwidth="8*" align="left"/>
52430 <colspec colwidth="6*" align="center"/>
52431 <colspec colwidth="6*" align="center"/>
52432 <colspec colwidth="6*" align="right"/>
52433 <tbody>
52434 <row>
52435 <entry><option>server_mech</option></entry>
52436 <entry>Use: <emphasis>gsasl</emphasis></entry>
52437 <entry>Type: <emphasis>string</emphasis></entry>
52438 <entry>Default: <emphasis>see below</emphasis></entry>
52439 </row>
52440 </tbody>
52441 </tgroup>
52442 </informaltable>
52443 <para>
52444 This option selects the authentication mechanism this driver should use. The
52445 default is the value of the generic <option>public_name</option> option. This option allows
52446 you to use a different underlying mechanism from the advertised name. For
52447 example:
52448 </para>
52449 <literallayout class="monospaced">
52450 sasl:
52451   driver = gsasl
52452   public_name = X-ANYTHING
52453   server_mech = CRAM-MD5
52454   server_set_id = $auth1
52455 </literallayout>
52456 <para>
52457 <indexterm role="option">
52458 <primary><option>server_password</option></primary>
52459 </indexterm>
52460 </para>
52461 <informaltable frame="all">
52462 <tgroup cols="4" colsep="0" rowsep="0">
52463 <colspec colwidth="8*" align="left"/>
52464 <colspec colwidth="6*" align="center"/>
52465 <colspec colwidth="6*" align="center"/>
52466 <colspec colwidth="6*" align="right"/>
52467 <tbody>
52468 <row>
52469 <entry><option>server_password</option></entry>
52470 <entry>Use: <emphasis>gsasl</emphasis></entry>
52471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52472 <entry>Default: <emphasis>unset</emphasis></entry>
52473 </row>
52474 </tbody>
52475 </tgroup>
52476 </informaltable>
52477 <para>
52478 Various mechanisms need access to the cleartext password on the server, so
52479 that proof-of-possession can be demonstrated on the wire, without sending
52480 the password itself.
52481 </para>
52482 <para>
52483 The data available for lookup varies per mechanism.
52484 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
52485 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
52486 if available, else the empty string.
52487 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
52488 else the empty string.
52489 </para>
52490 <para>
52491 A forced failure will cause authentication to defer.
52492 </para>
52493 <para>
52494 If using this option, it may make sense to set the <option>server_condition</option>
52495 option to be simply "true".
52496 </para>
52497 <para>
52498 <indexterm role="option">
52499 <primary><option>server_realm</option></primary>
52500 </indexterm>
52501 </para>
52502 <informaltable frame="all">
52503 <tgroup cols="4" colsep="0" rowsep="0">
52504 <colspec colwidth="8*" align="left"/>
52505 <colspec colwidth="6*" align="center"/>
52506 <colspec colwidth="6*" align="center"/>
52507 <colspec colwidth="6*" align="right"/>
52508 <tbody>
52509 <row>
52510 <entry><option>server_realm</option></entry>
52511 <entry>Use: <emphasis>gsasl</emphasis></entry>
52512 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52513 <entry>Default: <emphasis>unset</emphasis></entry>
52514 </row>
52515 </tbody>
52516 </tgroup>
52517 </informaltable>
52518 <para>
52519 This specifies the SASL realm that the server claims to be in.
52520 Some mechanisms will use this data.
52521 </para>
52522 <para>
52523 <indexterm role="option">
52524 <primary><option>server_scram_iter</option></primary>
52525 </indexterm>
52526 </para>
52527 <informaltable frame="all">
52528 <tgroup cols="4" colsep="0" rowsep="0">
52529 <colspec colwidth="8*" align="left"/>
52530 <colspec colwidth="6*" align="center"/>
52531 <colspec colwidth="6*" align="center"/>
52532 <colspec colwidth="6*" align="right"/>
52533 <tbody>
52534 <row>
52535 <entry><option>server_scram_iter</option></entry>
52536 <entry>Use: <emphasis>gsasl</emphasis></entry>
52537 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52538 <entry>Default: <emphasis>unset</emphasis></entry>
52539 </row>
52540 </tbody>
52541 </tgroup>
52542 </informaltable>
52543 <para>
52544 This option provides data for the SCRAM family of mechanisms.
52545 <varname>$auth1</varname> is not available at evaluation time.
52546 (This may change, as we receive feedback on use)
52547 </para>
52548 <para>
52549 <indexterm role="option">
52550 <primary><option>server_scram_salt</option></primary>
52551 </indexterm>
52552 </para>
52553 <informaltable frame="all">
52554 <tgroup cols="4" colsep="0" rowsep="0">
52555 <colspec colwidth="8*" align="left"/>
52556 <colspec colwidth="6*" align="center"/>
52557 <colspec colwidth="6*" align="center"/>
52558 <colspec colwidth="6*" align="right"/>
52559 <tbody>
52560 <row>
52561 <entry><option>server_scram_salt</option></entry>
52562 <entry>Use: <emphasis>gsasl</emphasis></entry>
52563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52564 <entry>Default: <emphasis>unset</emphasis></entry>
52565 </row>
52566 </tbody>
52567 </tgroup>
52568 </informaltable>
52569 <para>
52570 This option provides data for the SCRAM family of mechanisms.
52571 <varname>$auth1</varname> is not available at evaluation time.
52572 (This may change, as we receive feedback on use)
52573 </para>
52574 <para>
52575 <indexterm role="option">
52576 <primary><option>server_service</option></primary>
52577 </indexterm>
52578 </para>
52579 <informaltable frame="all">
52580 <tgroup cols="4" colsep="0" rowsep="0">
52581 <colspec colwidth="8*" align="left"/>
52582 <colspec colwidth="6*" align="center"/>
52583 <colspec colwidth="6*" align="center"/>
52584 <colspec colwidth="6*" align="right"/>
52585 <tbody>
52586 <row>
52587 <entry><option>server_service</option></entry>
52588 <entry>Use: <emphasis>gsasl</emphasis></entry>
52589 <entry>Type: <emphasis>string</emphasis></entry>
52590 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
52591 </row>
52592 </tbody>
52593 </tgroup>
52594 </informaltable>
52595 <para>
52596 This is the SASL service that the server claims to implement.
52597 Some mechanisms will use this data.
52598 </para>
52599 <section id="SECTgsaslauthvar">
52600 <title><command>gsasl</command> auth variables</title>
52601 <para>
52602 <indexterm role="variable">
52603 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52604 </indexterm>
52605 These may be set when evaluating specific options, as detailed above.
52606 They will also be set when evaluating <option>server_condition</option>.
52607 </para>
52608 <para>
52609 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
52610 meanings for these variables:
52611 </para>
52612 <itemizedlist>
52613 <listitem>
52614 <para>
52615 <indexterm role="variable">
52616 <primary><varname>$auth1</varname></primary>
52617 </indexterm>
52618 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
52619 </para>
52620 </listitem>
52621 <listitem>
52622 <para>
52623 <indexterm role="variable">
52624 <primary><varname>$auth2</varname></primary>
52625 </indexterm>
52626 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
52627 </para>
52628 </listitem>
52629 <listitem>
52630 <para>
52631 <indexterm role="variable">
52632 <primary><varname>$auth3</varname></primary>
52633 </indexterm>
52634 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
52635 </para>
52636 </listitem>
52637 </itemizedlist>
52638 <para>
52639 On a per-mechanism basis:
52640 </para>
52641 <itemizedlist>
52642 <listitem>
52643 <para>
52644 <indexterm role="concept">
52645 <primary>authentication</primary>
52646 <secondary>EXTERNAL</secondary>
52647 </indexterm>
52648 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
52649 the <option>server_condition</option> option must be present.
52650 </para>
52651 </listitem>
52652 <listitem>
52653 <para>
52654 <indexterm role="concept">
52655 <primary>authentication</primary>
52656 <secondary>ANONYMOUS</secondary>
52657 </indexterm>
52658 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
52659 the <option>server_condition</option> option must be present.
52660 </para>
52661 </listitem>
52662 <listitem>
52663 <para>
52664 <indexterm role="concept">
52665 <primary>authentication</primary>
52666 <secondary>GSSAPI</secondary>
52667 </indexterm>
52668 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
52669 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
52670 the <option>server_condition</option> option must be present.
52671 </para>
52672 </listitem>
52673 </itemizedlist>
52674 <para>
52675 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
52676 identifier; this is analogous to FTP anonymous authentication passing an
52677 email address, or software-identifier@, as the "password".
52678 </para>
52679 <para>
52680 An example showing the password having the realm specified in the callback
52681 and demonstrating a Cyrus SASL to GSASL migration approach is:
52682 </para>
52683 <literallayout class="monospaced">
52684 gsasl_cyrusless_crammd5:
52685   driver = gsasl
52686   public_name = CRAM-MD5
52687   server_realm = imap.example.org
52688   server_password = ${lookup{$auth1:$auth3:userPassword}\
52689                     dbmjz{/etc/sasldb2}{$value}fail}
52690   server_set_id = ${quote:$auth1}
52691   server_condition = yes
52692 </literallayout>
52693 </section>
52694 </chapter>
52695
52696 <chapter id="CHAPheimdalgss">
52697 <title>The heimdal_gssapi authenticator</title>
52698 <para>
52699 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
52700 <primary><command>heimdal_gssapi</command> authenticator</primary>
52701 </indexterm>
52702 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
52703 <primary>authenticators</primary>
52704 <secondary><command>heimdal_gssapi</command></secondary>
52705 </indexterm>
52706 <indexterm role="concept">
52707 <primary>authentication</primary>
52708 <secondary>GSSAPI</secondary>
52709 </indexterm>
52710 <indexterm role="concept">
52711 <primary>authentication</primary>
52712 <secondary>Kerberos</secondary>
52713 </indexterm>
52714 The <command>heimdal_gssapi</command> authenticator provides server integration for the
52715 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
52716 reliably.
52717 </para>
52718 <para>
52719 <indexterm role="option">
52720 <primary><option>server_hostname</option></primary>
52721 </indexterm>
52722 </para>
52723 <informaltable frame="all">
52724 <tgroup cols="4" colsep="0" rowsep="0">
52725 <colspec colwidth="8*" align="left"/>
52726 <colspec colwidth="6*" align="center"/>
52727 <colspec colwidth="6*" align="center"/>
52728 <colspec colwidth="6*" align="right"/>
52729 <tbody>
52730 <row>
52731 <entry><option>server_hostname</option></entry>
52732 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52733 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52734 <entry>Default: <emphasis>see below</emphasis></entry>
52735 </row>
52736 </tbody>
52737 </tgroup>
52738 </informaltable>
52739 <para>
52740 This option selects the hostname that is used, with <option>server_service</option>,
52741 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
52742 identifier.  The default value is <literal>$primary_hostname</literal>.
52743 </para>
52744 <para>
52745 <indexterm role="option">
52746 <primary><option>server_keytab</option></primary>
52747 </indexterm>
52748 </para>
52749 <informaltable frame="all">
52750 <tgroup cols="4" colsep="0" rowsep="0">
52751 <colspec colwidth="8*" align="left"/>
52752 <colspec colwidth="6*" align="center"/>
52753 <colspec colwidth="6*" align="center"/>
52754 <colspec colwidth="6*" align="right"/>
52755 <tbody>
52756 <row>
52757 <entry><option>server_keytab</option></entry>
52758 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52759 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52760 <entry>Default: <emphasis>unset</emphasis></entry>
52761 </row>
52762 </tbody>
52763 </tgroup>
52764 </informaltable>
52765 <para>
52766 If set, then Heimdal will not use the system default keytab (typically
52767 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
52768 The value should be a pathname, with no <quote>file:</quote> prefix.
52769 </para>
52770 <para>
52771 <indexterm role="option">
52772 <primary><option>server_service</option></primary>
52773 </indexterm>
52774 </para>
52775 <informaltable frame="all">
52776 <tgroup cols="4" colsep="0" rowsep="0">
52777 <colspec colwidth="8*" align="left"/>
52778 <colspec colwidth="6*" align="center"/>
52779 <colspec colwidth="6*" align="center"/>
52780 <colspec colwidth="6*" align="right"/>
52781 <tbody>
52782 <row>
52783 <entry><option>server_service</option></entry>
52784 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52786 <entry>Default: <emphasis>smtp</emphasis></entry>
52787 </row>
52788 </tbody>
52789 </tgroup>
52790 </informaltable>
52791 <para>
52792 This option specifies the service identifier used, in conjunction with
52793 <option>server_hostname</option>, for building the identifier for finding credentials
52794 from the keytab.
52795 </para>
52796 <section id="SECTheimdalgssauthvar">
52797 <title><command>heimdal_gssapi</command> auth variables</title>
52798 <para>
52799 Beware that these variables will typically include a realm, thus will appear
52800 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
52801 not verified, so a malicious client can set it to anything.
52802 </para>
52803 <para>
52804 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
52805 Distribution Center.  Note that these are not quite email addresses.
52806 Each identifier is for a role, and so the left-hand-side may include a
52807 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
52808 </para>
52809 <para>
52810 <indexterm role="variable">
52811 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52812 </indexterm>
52813 </para>
52814 <itemizedlist>
52815 <listitem>
52816 <para>
52817 <indexterm role="variable">
52818 <primary><varname>$auth1</varname></primary>
52819 </indexterm>
52820 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
52821 </para>
52822 </listitem>
52823 <listitem>
52824 <para>
52825 <indexterm role="variable">
52826 <primary><varname>$auth2</varname></primary>
52827 </indexterm>
52828 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
52829 authentication.  If that was empty, this will also be set to the
52830 GSS Display Name.
52831 </para>
52832 </listitem>
52833 </itemizedlist>
52834 </section>
52835 </chapter>
52836
52837 <chapter id="CHAPspa">
52838 <title>The spa authenticator</title>
52839 <para>
52840 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
52841 <primary><command>spa</command> authenticator</primary>
52842 </indexterm>
52843 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
52844 <primary>authenticators</primary>
52845 <secondary><command>spa</command></secondary>
52846 </indexterm>
52847 <indexterm role="concept">
52848 <primary>authentication</primary>
52849 <secondary>Microsoft Secure Password</secondary>
52850 </indexterm>
52851 <indexterm role="concept">
52852 <primary>authentication</primary>
52853 <secondary>NTLM</secondary>
52854 </indexterm>
52855 <indexterm role="concept">
52856 <primary>Microsoft Secure Password Authentication</primary>
52857 </indexterm>
52858 <indexterm role="concept">
52859 <primary>NTLM authentication</primary>
52860 </indexterm>
52861 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
52862 Password Authentication</emphasis> mechanism,
52863 which is also sometimes known as NTLM (NT LanMan). The code for client side of
52864 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
52865 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
52866 server side was subsequently contributed by Tom Kistner. The mechanism works as
52867 follows:
52868 </para>
52869 <itemizedlist>
52870 <listitem>
52871 <para>
52872 After the AUTH command has been accepted, the client sends an SPA
52873 authentication request based on the user name and optional domain.
52874 </para>
52875 </listitem>
52876 <listitem>
52877 <para>
52878 The server sends back a challenge.
52879 </para>
52880 </listitem>
52881 <listitem>
52882 <para>
52883 The client builds a challenge response which makes use of the user&#x2019;s password
52884 and sends it to the server, which then accepts or rejects it.
52885 </para>
52886 </listitem>
52887 </itemizedlist>
52888 <para>
52889 Encryption is used to protect the password in transit.
52890 </para>
52891 <section id="SECID179">
52892 <title>Using spa as a server</title>
52893 <para>
52894 <indexterm role="concept">
52895 <primary>options</primary>
52896 <secondary><command>spa</command> authenticator (server)</secondary>
52897 </indexterm>
52898 The <command>spa</command> authenticator has just one server option:
52899 </para>
52900 <para>
52901 <indexterm role="option">
52902 <primary><option>server_password</option></primary>
52903 </indexterm>
52904 </para>
52905 <informaltable frame="all">
52906 <tgroup cols="4" colsep="0" rowsep="0">
52907 <colspec colwidth="8*" align="left"/>
52908 <colspec colwidth="6*" align="center"/>
52909 <colspec colwidth="6*" align="center"/>
52910 <colspec colwidth="6*" align="right"/>
52911 <tbody>
52912 <row>
52913 <entry><option>server_password</option></entry>
52914 <entry>Use: <emphasis>spa</emphasis></entry>
52915 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52916 <entry>Default: <emphasis>unset</emphasis></entry>
52917 </row>
52918 </tbody>
52919 </tgroup>
52920 </informaltable>
52921 <para>
52922 <indexterm role="concept">
52923 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52924 <secondary>in <command>spa</command> authenticator</secondary>
52925 </indexterm>
52926 This option is expanded, and the result must be the cleartext password for the
52927 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
52928 compatibility with previous releases of Exim, the user name is also placed in
52929 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
52930 it can lead to confusion in string expansions that also use numeric variables
52931 for other things. For example:
52932 </para>
52933 <literallayout class="monospaced">
52934 spa:
52935   driver = spa
52936   public_name = NTLM
52937   server_password = \
52938     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
52939 </literallayout>
52940 <para>
52941 If the expansion is forced to fail, authentication fails. Any other expansion
52942 failure causes a temporary error code to be returned.
52943 </para>
52944 </section>
52945 <section id="SECID180">
52946 <title>Using spa as a client</title>
52947 <para>
52948 <indexterm role="concept">
52949 <primary>options</primary>
52950 <secondary><command>spa</command> authenticator (client)</secondary>
52951 </indexterm>
52952 The <command>spa</command> authenticator has the following client options:
52953 </para>
52954 <para>
52955 <indexterm role="option">
52956 <primary><option>client_domain</option></primary>
52957 </indexterm>
52958 </para>
52959 <informaltable frame="all">
52960 <tgroup cols="4" colsep="0" rowsep="0">
52961 <colspec colwidth="8*" align="left"/>
52962 <colspec colwidth="6*" align="center"/>
52963 <colspec colwidth="6*" align="center"/>
52964 <colspec colwidth="6*" align="right"/>
52965 <tbody>
52966 <row>
52967 <entry><option>client_domain</option></entry>
52968 <entry>Use: <emphasis>spa</emphasis></entry>
52969 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52970 <entry>Default: <emphasis>unset</emphasis></entry>
52971 </row>
52972 </tbody>
52973 </tgroup>
52974 </informaltable>
52975 <para>
52976 This option specifies an optional domain for the authentication.
52977 </para>
52978 <para>
52979 <indexterm role="option">
52980 <primary><option>client_password</option></primary>
52981 </indexterm>
52982 </para>
52983 <informaltable frame="all">
52984 <tgroup cols="4" colsep="0" rowsep="0">
52985 <colspec colwidth="8*" align="left"/>
52986 <colspec colwidth="6*" align="center"/>
52987 <colspec colwidth="6*" align="center"/>
52988 <colspec colwidth="6*" align="right"/>
52989 <tbody>
52990 <row>
52991 <entry><option>client_password</option></entry>
52992 <entry>Use: <emphasis>spa</emphasis></entry>
52993 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52994 <entry>Default: <emphasis>unset</emphasis></entry>
52995 </row>
52996 </tbody>
52997 </tgroup>
52998 </informaltable>
52999 <para>
53000 This option specifies the user&#x2019;s password, and must be set.
53001 </para>
53002 <para>
53003 <indexterm role="option">
53004 <primary><option>client_username</option></primary>
53005 </indexterm>
53006 </para>
53007 <informaltable frame="all">
53008 <tgroup cols="4" colsep="0" rowsep="0">
53009 <colspec colwidth="8*" align="left"/>
53010 <colspec colwidth="6*" align="center"/>
53011 <colspec colwidth="6*" align="center"/>
53012 <colspec colwidth="6*" align="right"/>
53013 <tbody>
53014 <row>
53015 <entry><option>client_username</option></entry>
53016 <entry>Use: <emphasis>spa</emphasis></entry>
53017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53018 <entry>Default: <emphasis>unset</emphasis></entry>
53019 </row>
53020 </tbody>
53021 </tgroup>
53022 </informaltable>
53023 <para>
53024 This option specifies the user name, and must be set. Here is an example of a
53025 configuration of this authenticator for use with the mail servers at
53026 <emphasis>msn.com</emphasis>:
53027 </para>
53028 <literallayout class="monospaced">
53029 msn:
53030   driver = spa
53031   public_name = MSN
53032   client_username = msn/msn_username
53033   client_password = msn_plaintext_password
53034   client_domain = DOMAIN_OR_UNSET
53035 </literallayout>
53036 <para>
53037 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
53038 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
53039 </para>
53040 </section>
53041 </chapter>
53042
53043 <chapter id="CHAPtlsauth">
53044 <title>The tls authenticator</title>
53045 <para>
53046 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
53047 <primary><command>tls</command> authenticator</primary>
53048 </indexterm>
53049 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
53050 <primary>authenticators</primary>
53051 <secondary><command>tls</command></secondary>
53052 </indexterm>
53053 <indexterm role="concept">
53054 <primary>authentication</primary>
53055 <secondary>Client Certificate</secondary>
53056 </indexterm>
53057 <indexterm role="concept">
53058 <primary>authentication</primary>
53059 <secondary>X509</secondary>
53060 </indexterm>
53061 <indexterm role="concept">
53062 <primary>Certificate-based authentication</primary>
53063 </indexterm>
53064 The <command>tls</command> authenticator provides server support for
53065 authentication based on client certificates.
53066 </para>
53067 <para>
53068 It is not an SMTP authentication mechanism and is not
53069 advertised by the server as part of the SMTP EHLO response.
53070 It is an Exim authenticator in the sense that it affects
53071 the protocol element of the log line, can be tested for
53072 by the <option>authenticated</option> ACL condition, and can set
53073 the <varname>$authenticated_id</varname> variable.
53074 </para>
53075 <para>
53076 The client must present a verifiable certificate,
53077 for which it must have been requested via the
53078 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
53079 (see <xref linkend="CHAPTLS"/>).
53080 </para>
53081 <para>
53082 If an authenticator of this type is configured it is
53083 run before any SMTP-level communication is done,
53084 and can authenticate the connection.
53085 If it does, SMTP authentication is not offered.
53086 </para>
53087 <para>
53088 A maximum of one authenticator of this type may be present.
53089 </para>
53090 <para>
53091 <indexterm role="concept">
53092 <primary>options</primary>
53093 <secondary><command>tls</command> authenticator (server)</secondary>
53094 </indexterm>
53095 The <command>tls</command> authenticator has three server options:
53096 </para>
53097 <para>
53098 <indexterm role="option">
53099 <primary><option>server_param1</option></primary>
53100 </indexterm>
53101 </para>
53102 <informaltable frame="all">
53103 <tgroup cols="4" colsep="0" rowsep="0">
53104 <colspec colwidth="8*" align="left"/>
53105 <colspec colwidth="6*" align="center"/>
53106 <colspec colwidth="6*" align="center"/>
53107 <colspec colwidth="6*" align="right"/>
53108 <tbody>
53109 <row>
53110 <entry><option>server_param1</option></entry>
53111 <entry>Use: <emphasis>tls</emphasis></entry>
53112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53113 <entry>Default: <emphasis>unset</emphasis></entry>
53114 </row>
53115 </tbody>
53116 </tgroup>
53117 </informaltable>
53118 <para>
53119 <indexterm role="concept">
53120 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
53121 <secondary>in <command>tls</command> authenticator</secondary>
53122 </indexterm>
53123 This option is expanded after the TLS negotiation and
53124 the result is placed in <varname>$auth1</varname>.
53125 If the expansion is forced to fail, authentication fails. Any other expansion
53126 failure causes a temporary error code to be returned.
53127 </para>
53128 <para>
53129 <indexterm role="option">
53130 <primary><option>server_param2</option></primary>
53131 </indexterm>
53132 </para>
53133 <informaltable frame="all">
53134 <tgroup cols="4" colsep="0" rowsep="0">
53135 <colspec colwidth="8*" align="left"/>
53136 <colspec colwidth="6*" align="center"/>
53137 <colspec colwidth="6*" align="center"/>
53138 <colspec colwidth="6*" align="right"/>
53139 <tbody>
53140 <row>
53141 <entry><option>server_param2</option></entry>
53142 <entry>Use: <emphasis>tls</emphasis></entry>
53143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53144 <entry>Default: <emphasis>unset</emphasis></entry>
53145 </row>
53146 </tbody>
53147 </tgroup>
53148 </informaltable>
53149 <para>
53150 <indexterm role="option">
53151 <primary><option>server_param3</option></primary>
53152 </indexterm>
53153 </para>
53154 <informaltable frame="all">
53155 <tgroup cols="4" colsep="0" rowsep="0">
53156 <colspec colwidth="8*" align="left"/>
53157 <colspec colwidth="6*" align="center"/>
53158 <colspec colwidth="6*" align="center"/>
53159 <colspec colwidth="6*" align="right"/>
53160 <tbody>
53161 <row>
53162 <entry><option>server_param3</option></entry>
53163 <entry>Use: <emphasis>tls</emphasis></entry>
53164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53165 <entry>Default: <emphasis>unset</emphasis></entry>
53166 </row>
53167 </tbody>
53168 </tgroup>
53169 </informaltable>
53170 <para>
53171 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
53172 </para>
53173 <para>
53174 <option>server_param1</option> may also be spelled <option>server_param</option>.
53175 </para>
53176 <para>
53177 Example:
53178 </para>
53179 <literallayout class="monospaced">
53180 tls:
53181   driver = tls
53182   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
53183                                     {$tls_in_peercert}}
53184   server_condition =  ${if forany {$auth1} \
53185                             {!= {0} \
53186                                 {${lookup ldap{ldap:///\
53187                          mailname=${quote_ldap_dn:${lc:$item}},\
53188                          ou=users,LDAP_DC?mailid} {$value}{0} \
53189                        }    }   } }
53190   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
53191 </literallayout>
53192 <para>
53193 This accepts a client certificate that is verifiable against any
53194 of your configured trust-anchors
53195 (which usually means the full set of public CAs)
53196 and which has a SAN with a good account name.
53197 Note that the client cert is on the wire in-clear, including the SAN,
53198 whereas a plaintext SMTP AUTH done inside TLS is not.
53199 </para>
53200 <para>
53201 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
53202 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
53203 </para>
53204 <para>
53205 Note that because authentication is traditionally an SMTP operation,
53206 the <option>authenticated</option> ACL condition cannot be used in
53207 a connect- or helo-ACL.
53208 </para>
53209 </chapter>
53210
53211 <chapter id="CHAPTLS">
53212 <title>Encrypted SMTP connections using TLS/SSL</title>
53213 <titleabbrev>Encrypted SMTP connections</titleabbrev>
53214 <para>
53215 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
53216 <primary>encryption</primary>
53217 <secondary>on SMTP connection</secondary>
53218 </indexterm>
53219 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
53220 <primary>SMTP</primary>
53221 <secondary>encryption</secondary>
53222 </indexterm>
53223 <indexterm role="concept">
53224 <primary>TLS</primary>
53225 <secondary>on SMTP connection</secondary>
53226 </indexterm>
53227 <indexterm role="concept">
53228 <primary>OpenSSL</primary>
53229 </indexterm>
53230 <indexterm role="concept">
53231 <primary>GnuTLS</primary>
53232 </indexterm>
53233 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
53234 Sockets Layer), is implemented by making use of the OpenSSL library or the
53235 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
53236 cryptographic code in the Exim distribution itself for implementing TLS. In
53237 order to use this feature you must install OpenSSL or GnuTLS, and then build a
53238 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
53239 You also need to understand the basic concepts of encryption at a managerial
53240 level, and in particular, the way that public keys, private keys, and
53241 certificates are used.
53242 </para>
53243 <para>
53244 RFC 3207 defines how SMTP connections can make use of encryption. Once a
53245 connection is established, the client issues a STARTTLS command. If the
53246 server accepts this, the client and the server negotiate an encryption
53247 mechanism. If the negotiation succeeds, the data that subsequently passes
53248 between them is encrypted.
53249 </para>
53250 <para>
53251 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
53252 and if so, what cipher suite is in use, whether the client supplied a
53253 certificate, and whether or not that certificate was verified. This makes it
53254 possible for an Exim server to deny or accept certain commands based on the
53255 encryption state.
53256 </para>
53257 <para>
53258 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
53259 disrupt TLS connections. You need to turn off SMTP scanning for these products
53260 in order to get TLS to work.
53261 </para>
53262 <section id="SECID284">
53263 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
53264 <para>
53265 <indexterm role="concept">
53266 <primary>submissions protocol</primary>
53267 </indexterm>
53268 <indexterm role="concept">
53269 <primary>ssmtp protocol</primary>
53270 </indexterm>
53271 <indexterm role="concept">
53272 <primary>smtps protocol</primary>
53273 </indexterm>
53274 <indexterm role="concept">
53275 <primary>SMTP</primary>
53276 <secondary>submissions protocol</secondary>
53277 </indexterm>
53278 <indexterm role="concept">
53279 <primary>SMTP</primary>
53280 <secondary>ssmtp protocol</secondary>
53281 </indexterm>
53282 <indexterm role="concept">
53283 <primary>SMTP</primary>
53284 <secondary>smtps protocol</secondary>
53285 </indexterm>
53286 The history of port numbers for TLS in SMTP is a little messy and has been
53287 contentious.  As of RFC 8314, the common practice of using the historically
53288 allocated port 465 for "email submission but with TLS immediately upon connect
53289 instead of using STARTTLS" is officially blessed by the IETF, and recommended
53290 by them in preference to STARTTLS.
53291 </para>
53292 <para>
53293 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
53294 clarity emerged over the dual roles of SMTP, for MX delivery and Email
53295 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
53296 </para>
53297 <para>
53298 This approach was, for a while, officially abandoned when encrypted SMTP was
53299 standardized, but many clients kept using it, even as the TCP port number was
53300 reassigned for other use.
53301 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
53302 this port.
53303 In practice, a number of mail-clients have only ever supported submissions,
53304 not submission with STARTTLS upgrade.
53305 Ideally, offer both submission (587) and submissions (465) service.
53306 </para>
53307 <para>
53308 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
53309 global option. Its value must be a list of port numbers;
53310 the most common use is expected to be:
53311 </para>
53312 <literallayout class="monospaced">
53313 tls_on_connect_ports = 465
53314 </literallayout>
53315 <para>
53316 The port numbers specified by this option apply to all SMTP connections, both
53317 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
53318 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
53319 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
53320 an extra port &ndash; rather, it specifies different behaviour on a port that is
53321 defined elsewhere.
53322 </para>
53323 <para>
53324 There is also a <option>-tls-on-connect</option> command line option. This overrides
53325 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
53326 </para>
53327 </section>
53328 <section id="SECTopenvsgnu">
53329 <title>OpenSSL vs GnuTLS</title>
53330 <para>
53331 <indexterm role="concept">
53332 <primary>TLS</primary>
53333 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
53334 </indexterm>
53335 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
53336 followed later, when the first versions of GnuTLS were released. To build Exim
53337 to use GnuTLS, you need to set
53338 </para>
53339 <literallayout class="monospaced">
53340 USE_GNUTLS=yes
53341 </literallayout>
53342 <para>
53343 in Local/Makefile, in addition to
53344 </para>
53345 <literallayout class="monospaced">
53346 SUPPORT_TLS=yes
53347 </literallayout>
53348 <para>
53349 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
53350 include files and libraries for GnuTLS can be found.
53351 </para>
53352 <para>
53353 There are some differences in usage when using GnuTLS instead of OpenSSL:
53354 </para>
53355 <itemizedlist>
53356 <listitem>
53357 <para>
53358 The <option>tls_verify_certificates</option> option
53359 cannot be the path of a directory
53360 for GnuTLS versions before 3.3.6
53361 (for later versions, or OpenSSL, it can be either).
53362 </para>
53363 </listitem>
53364 <listitem>
53365 <para>
53366 The default value for <option>tls_dhparam</option> differs for historical reasons.
53367 </para>
53368 </listitem>
53369 <listitem>
53370 <para>
53371 <indexterm role="variable">
53372 <primary><varname>$tls_in_peerdn</varname></primary>
53373 </indexterm>
53374 <indexterm role="variable">
53375 <primary><varname>$tls_out_peerdn</varname></primary>
53376 </indexterm>
53377 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
53378 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
53379 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
53380 </para>
53381 </listitem>
53382 <listitem>
53383 <para>
53384 OpenSSL identifies cipher suites using hyphens as separators, for example:
53385 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
53386 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
53387 in a cipher list. To make life simpler, Exim changes underscores to hyphens
53388 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
53389 to handle its own older variants) when processing lists of cipher suites in the
53390 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
53391 option).
53392 </para>
53393 </listitem>
53394 <listitem>
53395 <para>
53396 The <option>tls_require_ciphers</option> options operate differently, as described in the
53397 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
53398 </para>
53399 </listitem>
53400 <listitem>
53401 <para>
53402 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
53403 When using OpenSSL, this option is ignored.
53404 (If an API is found to let OpenSSL be configured in this way,
53405 let the Exim Maintainers know and we&#x2019;ll likely use it).
53406 </para>
53407 </listitem>
53408 <listitem>
53409 <para>
53410 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
53411 main option, it must be ordered to match the <option>tls_certificate</option> list.
53412 </para>
53413 </listitem>
53414 <listitem>
53415 <para>
53416 Some other recently added features may only be available in one or the other.
53417 This should be documented with the feature.  If the documentation does not
53418 explicitly state that the feature is infeasible in the other TLS
53419 implementation, then patches are welcome.
53420 </para>
53421 </listitem>
53422 </itemizedlist>
53423 </section>
53424 <section id="SECTgnutlsparam">
53425 <title>GnuTLS parameter computation</title>
53426 <para>
53427 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
53428 an explicit path; if the latter, then the text about generation still applies,
53429 but not the chosen filename.
53430 By default, as of Exim 4.80 a hard-coded D-H prime is used.
53431 See the documentation of <option>tls_dhparam</option> for more information.
53432 </para>
53433 <para>
53434 GnuTLS uses D-H parameters that may take a substantial amount of time
53435 to compute. It is unreasonable to re-compute them for every TLS session.
53436 Therefore, Exim keeps this data in a file in its spool directory, called
53437 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
53438 of bits requested.
53439 The file is owned by the Exim user and is readable only by
53440 its owner. Every Exim process that start up GnuTLS reads the D-H
53441 parameters from this file. If the file does not exist, the first Exim process
53442 that needs it computes the data and writes it to a temporary file which is
53443 renamed once it is complete. It does not matter if several Exim processes do
53444 this simultaneously (apart from wasting a few resources). Once a file is in
53445 place, new Exim processes immediately start using it.
53446 </para>
53447 <para>
53448 For maximum security, the parameters that are stored in this file should be
53449 recalculated periodically, the frequency depending on your paranoia level.
53450 If you are avoiding using the fixed D-H primes published in RFCs, then you
53451 are concerned about some advanced attacks and will wish to do this; if you do
53452 not regenerate then you might as well stick to the standard primes.
53453 </para>
53454 <para>
53455 Arranging this is easy in principle; just delete the file when you want new
53456 values to be computed. However, there may be a problem. The calculation of new
53457 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
53458 If the system is not very active, <filename>/dev/random</filename> may delay returning data
53459 until enough randomness (entropy) is available. This may cause Exim to hang for
53460 a substantial amount of time, causing timeouts on incoming connections.
53461 </para>
53462 <para>
53463 The solution is to generate the parameters externally to Exim. They are stored
53464 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
53465 generated externally using the <command>certtool</command> command that is part of GnuTLS.
53466 </para>
53467 <para>
53468 To replace the parameters with new ones, instead of deleting the file
53469 and letting Exim re-create it, you can generate new parameters using
53470 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
53471 renaming. The relevant commands are something like this:
53472 </para>
53473 <literallayout class="monospaced">
53474 # ls
53475 [ look for file; assume gnutls-params-2236 is the most recent ]
53476 # rm -f new-params
53477 # touch new-params
53478 # chown exim:exim new-params
53479 # chmod 0600 new-params
53480 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
53481 # openssl dhparam -noout -text -in new-params | head
53482 [ check the first line, make sure it's not more than 2236;
53483   if it is, then go back to the start ("rm") and repeat
53484   until the size generated is at most the size requested ]
53485 # chmod 0400 new-params
53486 # mv new-params gnutls-params-2236
53487 </literallayout>
53488 <para>
53489 If Exim never has to generate the parameters itself, the possibility of
53490 stalling is removed.
53491 </para>
53492 <para>
53493 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
53494 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
53495 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
53496 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
53497 and Exim does so.  This attempt to remove Exim from TLS policy decisions
53498 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
53499 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
53500 which applies to all D-H usage, client or server.  If the value returned by
53501 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
53502 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
53503 limit, which is still much higher than Exim historically used.
53504 </para>
53505 <para>
53506 The filename and bits used will change as the GnuTLS maintainers change the
53507 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
53508 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
53509 2432 bits, while NSS is limited to 2236 bits.
53510 </para>
53511 <para>
53512 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
53513 increase the chance of the generated prime actually being within acceptable
53514 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
53515 procedure above.  There is no sane procedure available to Exim to double-check
53516 the size of the generated prime, so it might still be too large.
53517 </para>
53518 </section>
53519 <section id="SECTreqciphssl">
53520 <title>Requiring specific ciphers in OpenSSL</title>
53521 <para>
53522 <indexterm role="concept">
53523 <primary>TLS</primary>
53524 <secondary>requiring specific ciphers (OpenSSL)</secondary>
53525 </indexterm>
53526 <indexterm role="option">
53527 <primary><option>tls_require_ciphers</option></primary>
53528 <secondary>OpenSSL</secondary>
53529 </indexterm>
53530 There is a function in the OpenSSL library that can be passed a list of cipher
53531 suites before the cipher negotiation takes place. This specifies which ciphers
53532 are acceptable. The list is colon separated and may contain names like
53533 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
53534 directly to this function call.
53535 Many systems will install the OpenSSL manual-pages, so you may have
53536 <emphasis>ciphers(1)</emphasis> available to you.
53537 The following quotation from the OpenSSL
53538 documentation specifies what forms of item are allowed in the cipher string:
53539 </para>
53540 <itemizedlist>
53541 <listitem>
53542 <para>
53543 It can consist of a single cipher suite such as RC4-SHA.
53544 </para>
53545 </listitem>
53546 <listitem>
53547 <para>
53548 It can represent a list of cipher suites containing a certain algorithm,
53549 or cipher suites of a certain type. For example SHA1 represents all
53550 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
53551 SSL v3 algorithms.
53552 </para>
53553 </listitem>
53554 <listitem>
53555 <para>
53556 Lists of cipher suites can be combined in a single cipher string using
53557 the + character. This is used as a logical and operation. For example
53558 SHA1+DES represents all cipher suites containing the SHA1 and the DES
53559 algorithms.
53560 </para>
53561 </listitem>
53562 </itemizedlist>
53563 <para>
53564 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
53565 <literal>-</literal> or <literal>+</literal>.
53566 </para>
53567 <itemizedlist>
53568 <listitem>
53569 <para>
53570 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
53571 ciphers deleted can never reappear in the list even if they are explicitly
53572 stated.
53573 </para>
53574 </listitem>
53575 <listitem>
53576 <para>
53577 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
53578 of the ciphers can be added again by later options.
53579 </para>
53580 </listitem>
53581 <listitem>
53582 <para>
53583 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
53584 option does not add any new ciphers; it just moves matching existing ones.
53585 </para>
53586 </listitem>
53587 </itemizedlist>
53588 <para>
53589 If none of these characters is present, the string is interpreted as
53590 a list of ciphers to be appended to the current preference list. If the list
53591 includes any ciphers already present they will be ignored: that is, they will
53592 not be moved to the end of the list.
53593 </para>
53594 <para>
53595 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
53596 string:
53597 </para>
53598 <literallayout class="monospaced">
53599 # note single-quotes to get ! past any shell history expansion
53600 $ openssl ciphers 'HIGH:!MD5:!SHA1'
53601 </literallayout>
53602 <para>
53603 This example will let the library defaults be permitted on the MX port, where
53604 there&#x2019;s probably no identity verification anyway, but ups the ante on the
53605 submission ports where the administrator might have some influence on the
53606 choice of clients used:
53607 </para>
53608 <literallayout class="monospaced">
53609 # OpenSSL variant; see man ciphers(1)
53610 tls_require_ciphers = ${if =={$received_port}{25}\
53611                            {DEFAULT}\
53612                            {HIGH:!MD5:!SHA1}}
53613 </literallayout>
53614 <para>
53615 This example will prefer ECDSA-authenticated ciphers over RSA ones:
53616 </para>
53617 <literallayout class="monospaced">
53618 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
53619 </literallayout>
53620 </section>
53621 <section id="SECTreqciphgnu">
53622 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
53623 <para>
53624 <indexterm role="concept">
53625 <primary>GnuTLS</primary>
53626 <secondary>specifying parameters for</secondary>
53627 </indexterm>
53628 <indexterm role="concept">
53629 <primary>TLS</primary>
53630 <secondary>specifying ciphers (GnuTLS)</secondary>
53631 </indexterm>
53632 <indexterm role="concept">
53633 <primary>TLS</primary>
53634 <secondary>specifying key exchange methods (GnuTLS)</secondary>
53635 </indexterm>
53636 <indexterm role="concept">
53637 <primary>TLS</primary>
53638 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
53639 </indexterm>
53640 <indexterm role="concept">
53641 <primary>TLS</primary>
53642 <secondary>specifying protocols (GnuTLS)</secondary>
53643 </indexterm>
53644 <indexterm role="concept">
53645 <primary>TLS</primary>
53646 <secondary>specifying priority string (GnuTLS)</secondary>
53647 </indexterm>
53648 <indexterm role="option">
53649 <primary><option>tls_require_ciphers</option></primary>
53650 <secondary>GnuTLS</secondary>
53651 </indexterm>
53652 The GnuTLS library allows the caller to provide a "priority string", documented
53653 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
53654 ciphersuite specification in OpenSSL.
53655 </para>
53656 <para>
53657 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
53658 and controls both protocols and ciphers.
53659 </para>
53660 <para>
53661 The <option>tls_require_ciphers</option> option is available both as an global option,
53662 controlling how Exim behaves as a server, and also as an option of the
53663 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
53664 the value is string expanded.  The resulting string is not an Exim list and
53665 the string is given to the GnuTLS library, so that Exim does not need to be
53666 aware of future feature enhancements of GnuTLS.
53667 </para>
53668 <para>
53669 Documentation of the strings accepted may be found in the GnuTLS manual, under
53670 "Priority strings".  This is online as
53671 <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>,
53672 but beware that this relates to GnuTLS 3, which may be newer than the version
53673 installed on your system.  If you are using GnuTLS 3,
53674 then the example code
53675 <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>
53676 on that site can be used to test a given string.
53677 </para>
53678 <para>
53679 For example:
53680 </para>
53681 <literallayout class="monospaced">
53682 # Disable older versions of protocols
53683 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
53684 </literallayout>
53685 <para>
53686 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
53687 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
53688 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
53689 </para>
53690 <para>
53691 This example will let the library defaults be permitted on the MX port, where
53692 there&#x2019;s probably no identity verification anyway, and lowers security further
53693 by increasing compatibility; but this ups the ante on the submission ports
53694 where the administrator might have some influence on the choice of clients
53695 used:
53696 </para>
53697 <literallayout class="monospaced">
53698 # GnuTLS variant
53699 tls_require_ciphers = ${if =={$received_port}{25}\
53700                            {NORMAL:%COMPAT}\
53701                            {SECURE128}}
53702 </literallayout>
53703 </section>
53704 <section id="SECID182">
53705 <title>Configuring an Exim server to use TLS</title>
53706 <para>
53707 <indexterm role="concept">
53708 <primary>TLS</primary>
53709 <secondary>configuring an Exim server</secondary>
53710 </indexterm>
53711 When Exim has been built with TLS support, it advertises the availability of
53712 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
53713 but not to any others. The default value of this option is *, which means
53714 that STARTTLS is always advertised.  Set it to blank to never advertise;
53715 this is reasonable for systems that want to use TLS only as a client.
53716 </para>
53717 <para>
53718 If STARTTLS is to be used you
53719 need to set some other options in order to make TLS available.
53720 </para>
53721 <para>
53722 If a client issues a STARTTLS command and there is some configuration
53723 problem in the server, the command is rejected with a 454 error. If the client
53724 persists in trying to issue SMTP commands, all except QUIT are rejected
53725 with the error
53726 </para>
53727 <literallayout class="monospaced">
53728 554 Security failure
53729 </literallayout>
53730 <para>
53731 If a STARTTLS command is issued within an existing TLS session, it is
53732 rejected with a 554 error code.
53733 </para>
53734 <para>
53735 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
53736 must be set to match some hosts. The default is * which matches all hosts.
53737 </para>
53738 <para>
53739 If this is all you do, TLS encryption will be enabled but not authentication -
53740 meaning that the peer has no assurance it is actually you he is talking to.
53741 You gain protection from a passive sniffer listening on the wire but not
53742 from someone able to intercept the communication.
53743 </para>
53744 <para>
53745 Further protection requires some further configuration at the server end.
53746 </para>
53747 <para>
53748 To make TLS work you need to set, in the server,
53749 </para>
53750 <literallayout class="monospaced">
53751 tls_certificate = /some/file/name
53752 tls_privatekey = /some/file/name
53753 </literallayout>
53754 <para>
53755 These options are, in fact, expanded strings, so you can make them depend on
53756 the identity of the client that is connected if you wish. The first file
53757 contains the server&#x2019;s X509 certificate, and the second contains the private key
53758 that goes with it. These files need to be
53759 PEM format and readable by the Exim user, and must
53760 always be given as full path names.
53761 The key must not be password-protected.
53762 They can be the same file if both the
53763 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
53764 set, or if its expansion is forced to fail or results in an empty string, this
53765 is assumed to be the case. The certificate file may also contain intermediate
53766 certificates that need to be sent to the client to enable it to authenticate
53767 the server&#x2019;s certificate.
53768 </para>
53769 <para>
53770 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
53771 colon-separated lists of file paths.  Ciphers using given authentication
53772 algorithms require the presence of a suitable certificate to supply the
53773 public-key.  The server selects among the certificates to present to the
53774 client depending on the selected cipher, hence the priority ordering for
53775 ciphers will affect which certificate is used.
53776 </para>
53777 <para>
53778 If you do not understand about certificates and keys, please try to find a
53779 source of this background information, which is not Exim-specific. (There are a
53780 few comments below in section <xref linkend="SECTcerandall"/>.)
53781 </para>
53782 <para>
53783 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
53784 they apply only in the case of a server. If you need to use a certificate in an
53785 Exim client, you must set the options of the same names in an <command>smtp</command>
53786 transport.
53787 </para>
53788 <para>
53789 With just these options, an Exim server will be able to use TLS. It does not
53790 require the client to have a certificate (but see below for how to insist on
53791 this). There is one other option that may be needed in other situations. If
53792 </para>
53793 <literallayout class="monospaced">
53794 tls_dhparam = /some/file/name
53795 </literallayout>
53796 <para>
53797 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
53798 with the parameters contained in the file.
53799 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
53800 available:
53801 </para>
53802 <literallayout class="monospaced">
53803 tls_dhparam = none
53804 </literallayout>
53805 <para>
53806 This may also be set to a string identifying a standard prime to be used for
53807 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
53808 used is <literal>ike23</literal>.  There are a few standard primes available, see the
53809 documentation for <option>tls_dhparam</option> for the complete list.
53810 </para>
53811 <para>
53812 See the command
53813 </para>
53814 <literallayout class="monospaced">
53815 openssl dhparam
53816 </literallayout>
53817 <para>
53818 for a way of generating file data.
53819 </para>
53820 <para>
53821 The strings supplied for these three options are expanded every time a client
53822 host connects. It is therefore possible to use different certificates and keys
53823 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
53824 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
53825 forced to fail, Exim behaves as if the option is not set.
53826 </para>
53827 <para>
53828 <indexterm role="concept">
53829 <primary>cipher</primary>
53830 <secondary>logging</secondary>
53831 </indexterm>
53832 <indexterm role="concept">
53833 <primary>log</primary>
53834 <secondary>TLS cipher</secondary>
53835 </indexterm>
53836 <indexterm role="variable">
53837 <primary><varname>$tls_in_cipher</varname></primary>
53838 </indexterm>
53839 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
53840 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
53841 incoming message (by default &ndash; you can, of course, change this), and it is
53842 also included in the log line that records a message&#x2019;s arrival, keyed by
53843 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
53844 condition can be used to test for specific cipher suites in ACLs.
53845 </para>
53846 <para>
53847 Once TLS has been established, the ACLs that run for subsequent SMTP commands
53848 can check the name of the cipher suite and vary their actions accordingly. The
53849 cipher suite names vary, depending on which TLS library is being used. For
53850 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
53851 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
53852 documentation for more details.
53853 </para>
53854 <para>
53855 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
53856 (again depending on the <option>tls_cipher</option> log selector).
53857 </para>
53858 </section>
53859 <section id="SECID183">
53860 <title>Requesting and verifying client certificates</title>
53861 <para>
53862 <indexterm role="concept">
53863 <primary>certificate</primary>
53864 <secondary>verification of client</secondary>
53865 </indexterm>
53866 <indexterm role="concept">
53867 <primary>TLS</primary>
53868 <secondary>client certificate verification</secondary>
53869 </indexterm>
53870 If you want an Exim server to request a certificate when negotiating a TLS
53871 session with a client, you must set either <option>tls_verify_hosts</option> or
53872 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
53873 apply to all TLS connections. For any host that matches one of these options,
53874 Exim requests a certificate as part of the setup of the TLS session. The
53875 contents of the certificate are verified by comparing it with a list of
53876 expected certificates.
53877 These may be the system default set (depending on library version),
53878 an explicit file or,
53879 depending on library version, a directory, identified by
53880 <option>tls_verify_certificates</option>.
53881 </para>
53882 <para>
53883 A file can contain multiple certificates, concatenated end to end. If a
53884 directory is used
53885 (OpenSSL only),
53886 each certificate must be in a separate file, with a name (or a symbolic link)
53887 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
53888 certificate. You can compute the relevant hash by running the command
53889 </para>
53890 <literallayout class="monospaced">
53891 openssl x509 -hash -noout -in /cert/file
53892 </literallayout>
53893 <para>
53894 where <filename>/cert/file</filename> contains a single certificate.
53895 </para>
53896 <para>
53897 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
53898 what happens if the client does not supply a certificate, or if the certificate
53899 does not match any of the certificates in the collection named by
53900 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
53901 attempt to set up a TLS session is aborted, and the incoming connection is
53902 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
53903 session continues. ACLs that run for subsequent SMTP commands can detect the
53904 fact that no certificate was verified, and vary their actions accordingly. For
53905 example, you can insist on a certificate before accepting a message for
53906 relaying, but not when the message is destined for local delivery.
53907 </para>
53908 <para>
53909 <indexterm role="variable">
53910 <primary><varname>$tls_in_peerdn</varname></primary>
53911 </indexterm>
53912 When a client supplies a certificate (whether it verifies or not), the value of
53913 the Distinguished Name of the certificate is made available in the variable
53914 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
53915 </para>
53916 <para>
53917 <indexterm role="concept">
53918 <primary>log</primary>
53919 <secondary>distinguished name</secondary>
53920 </indexterm>
53921 Because it is often a long text string, it is not included in the log line or
53922 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
53923 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
53924 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
53925 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
53926 </para>
53927 </section>
53928 <section id="SECID184">
53929 <title>Revoked certificates</title>
53930 <para>
53931 <indexterm role="concept">
53932 <primary>TLS</primary>
53933 <secondary>revoked certificates</secondary>
53934 </indexterm>
53935 <indexterm role="concept">
53936 <primary>revocation list</primary>
53937 </indexterm>
53938 <indexterm role="concept">
53939 <primary>certificate</primary>
53940 <secondary>revocation list</secondary>
53941 </indexterm>
53942 <indexterm role="concept">
53943 <primary>OCSP</primary>
53944 <secondary>stapling</secondary>
53945 </indexterm>
53946 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
53947 certificates are revoked. If you have such a list, you can pass it to an Exim
53948 server using the global option called <option>tls_crl</option> and to an Exim client using
53949 an identically named option for the <command>smtp</command> transport. In each case, the value
53950 of the option is expanded and must then be the name of a file that contains a
53951 CRL in PEM format.
53952 The downside is that clients have to periodically re-download a potentially huge
53953 file from every certificate authority they know of.
53954 </para>
53955 <para>
53956 The way with most moving parts at query time is Online Certificate
53957 Status Protocol (OCSP), where the client verifies the certificate
53958 against an OCSP server run by the CA.  This lets the CA track all
53959 usage of the certs.  It requires running software with access to the
53960 private key of the CA, to sign the responses to the OCSP queries.  OCSP
53961 is based on HTTP and can be proxied accordingly.
53962 </para>
53963 <para>
53964 The only widespread OCSP server implementation (known to this writer)
53965 comes as part of OpenSSL and aborts on an invalid request, such as
53966 connecting to the port and then disconnecting.  This requires
53967 re-entering the passphrase each time some random client does this.
53968 </para>
53969 <para>
53970 The third way is OCSP Stapling; in this, the server using a certificate
53971 issued by the CA periodically requests an OCSP proof of validity from
53972 the OCSP server, then serves it up inline as part of the TLS
53973 negotiation.   This approach adds no extra round trips, does not let the
53974 CA track users, scales well with number of certs issued by the CA and is
53975 resilient to temporary OCSP server failures, as long as the server
53976 starts retrying to fetch an OCSP proof some time before its current
53977 proof expires.  The downside is that it requires server support.
53978 </para>
53979 <para>
53980 Unless Exim is built with the support disabled,
53981 or with GnuTLS earlier than version 3.3.16 / 3.4.8
53982 support for OCSP stapling is included.
53983 </para>
53984 <para>
53985 There is a global option called <option>tls_ocsp_file</option>.
53986 The file specified therein is expected to be in DER format, and contain
53987 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
53988 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
53989 contains <literal>tls_in_sni</literal>, as per other TLS options.
53990 </para>
53991 <para>
53992 Exim does not at this time implement any support for fetching a new OCSP
53993 proof.  The burden is on the administrator to handle this, outside of
53994 Exim.  The file specified should be replaced atomically, so that the
53995 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
53996 on each connection, so a new file will be handled transparently on the
53997 next connection.
53998 </para>
53999 <para>
54000 When built with OpenSSL Exim will check for a valid next update timestamp
54001 in the OCSP proof; if not present, or if the proof has expired, it will be
54002 ignored.
54003 </para>
54004 <para>
54005 For the client to be able to verify the stapled OCSP the server must
54006 also supply, in its stapled information, any intermediate
54007 certificates for the chain leading to the OCSP proof from the signer
54008 of the server certificate.  There may be zero or one such. These
54009 intermediate certificates should be added to the server OCSP stapling
54010 file named by <option>tls_ocsp_file</option>.
54011 </para>
54012 <para>
54013 Note that the proof only covers the terminal server certificate,
54014 not any of the chain from CA to it.
54015 </para>
54016 <para>
54017 There is no current way to staple a proof for a client certificate.
54018 </para>
54019 <literallayout class="monospaced">
54020   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
54021   OCSP server is supplied.  The server URL may be included in the
54022   server certificate, if the CA is helpful.
54023
54024   One failure mode seen was the OCSP Signer cert expiring before the end
54025   of validity of the OCSP proof. The checking done by Exim/OpenSSL
54026   noted this as invalid overall, but the re-fetch script did not.
54027 </literallayout>
54028 </section>
54029 <section id="SECID185">
54030 <title>Configuring an Exim client to use TLS</title>
54031 <para>
54032 <indexterm role="concept">
54033 <primary>cipher</primary>
54034 <secondary>logging</secondary>
54035 </indexterm>
54036 <indexterm role="concept">
54037 <primary>log</primary>
54038 <secondary>TLS cipher</secondary>
54039 </indexterm>
54040 <indexterm role="concept">
54041 <primary>log</primary>
54042 <secondary>distinguished name</secondary>
54043 </indexterm>
54044 <indexterm role="concept">
54045 <primary>TLS</primary>
54046 <secondary>configuring an Exim client</secondary>
54047 </indexterm>
54048 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
54049 deliveries as well as to incoming, the latter one causing logging of the
54050 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
54051 within the <command>smtp</command> transport.
54052 </para>
54053 <para>
54054 It is not necessary to set any options to have TLS work in the <command>smtp</command>
54055 transport. If Exim is built with TLS support, and TLS is advertised by a
54056 server, the <command>smtp</command> transport always tries to start a TLS session. However,
54057 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
54058 transport) to a list of server hosts for which TLS should not be used.
54059 </para>
54060 <para>
54061 If you do not want Exim to attempt to send messages unencrypted when an attempt
54062 to set up an encrypted connection fails in any way, you can set
54063 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
54064 those hosts, delivery is always deferred if an encrypted connection cannot be
54065 set up. If there are any other hosts for the address, they are tried in the
54066 usual way.
54067 </para>
54068 <para>
54069 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
54070 the message unencrypted. It always does this if the response to STARTTLS is
54071 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
54072 session after a success response code, what happens is controlled by the
54073 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
54074 delivery to this host is deferred, and other hosts (if available) are tried. If
54075 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
54076 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
54077 negotiation fails, Exim closes the current connection (because it is in an
54078 unknown state), opens a new one to the same host, and then tries the delivery
54079 unencrypted.
54080 </para>
54081 <para>
54082 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
54083 transport provide the client with a certificate, which is passed to the server
54084 if it requests it. If the server is Exim, it will request a certificate only if
54085 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
54086 </para>
54087 <para>
54088 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
54089 specifies a collection of expected server certificates.
54090 These may be
54091 the system default set (depending on library version),
54092 a file,
54093 or (depending on library version) a directory.
54094 The client verifies the server&#x2019;s certificate
54095 against this collection, taking into account any revoked certificates that are
54096 in the list defined by <option>tls_crl</option>.
54097 Failure to verify fails the TLS connection unless either of the
54098 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
54099 </para>
54100 <para>
54101 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
54102 certificate verification to the listed servers.  Verification either must
54103 or need not succeed respectively.
54104 </para>
54105 <para>
54106 The <command>smtp</command> transport has two OCSP-related options:
54107 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
54108 is requested and required for the connection to proceed.  The default
54109 value is empty.
54110 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
54111 a Certificate Status is requested (but not necessarily verified).  The default
54112 value is "*" meaning that requests are made unless configured
54113 otherwise.
54114 </para>
54115 <para>
54116 The host(s) should also be in <option>hosts_require_tls</option>, and
54117 <option>tls_verify_certificates</option> configured for the transport,
54118 for OCSP to be relevant.
54119 </para>
54120 <para>
54121 If
54122 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
54123 list of permitted cipher suites. If either of these checks fails, delivery to
54124 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
54125 alternative hosts, if any.
54126 </para>
54127 <para>
54128  <emphasis role="bold">Note</emphasis>:
54129 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
54130 is operating as a client. Exim does not assume that a server certificate (set
54131 by the global options of the same name) should also be used when operating as a
54132 client.
54133 </para>
54134 <para>
54135 <indexterm role="variable">
54136 <primary><varname>$host</varname></primary>
54137 </indexterm>
54138 <indexterm role="variable">
54139 <primary><varname>$host_address</varname></primary>
54140 </indexterm>
54141 All the TLS options in the <command>smtp</command> transport are expanded before use, with
54142 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
54143 which the client is connected. Forced failure of an expansion causes Exim to
54144 behave as if the relevant option were unset.
54145 </para>
54146 <para>
54147 <indexterm role="variable">
54148 <primary><varname>$tls_out_bits</varname></primary>
54149 </indexterm>
54150 <indexterm role="variable">
54151 <primary><varname>$tls_out_cipher</varname></primary>
54152 </indexterm>
54153 <indexterm role="variable">
54154 <primary><varname>$tls_out_peerdn</varname></primary>
54155 </indexterm>
54156 <indexterm role="variable">
54157 <primary><varname>$tls_out_sni</varname></primary>
54158 </indexterm>
54159 Before an SMTP connection is established, the
54160 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
54161 variables are emptied. (Until the first connection, they contain the values
54162 that were set when the message was received.) If STARTTLS is subsequently
54163 successfully obeyed, these variables are set to the relevant values for the
54164 outgoing connection.
54165 </para>
54166 </section>
54167 <section id="SECTtlssni">
54168 <title>Use of TLS Server Name Indication</title>
54169 <para>
54170 <indexterm role="concept">
54171 <primary>TLS</primary>
54172 <secondary>Server Name Indication</secondary>
54173 </indexterm>
54174 <indexterm role="variable">
54175 <primary><varname>$tls_in_sni</varname></primary>
54176 </indexterm>
54177 <indexterm role="option">
54178 <primary><option>tls_in_sni</option></primary>
54179 </indexterm>
54180 With TLS1.0 or above, there is an extension mechanism by which extra
54181 information can be included at various points in the protocol.  One of these
54182 extensions, documented in RFC 6066 (and before that RFC 4366) is
54183 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
54184 client in the initial handshake, so that the server can examine the servername
54185 within and possibly choose to use different certificates and keys (and more)
54186 for this session.
54187 </para>
54188 <para>
54189 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
54190 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
54191 address.
54192 </para>
54193 <para>
54194 With SMTP to MX, there are the same problems here as in choosing the identity
54195 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
54196 provide the identity which you then cryptographically verify.  So this will
54197 be of limited use in that environment.
54198 </para>
54199 <para>
54200 With SMTP to Submission, there is a well-defined hostname which clients are
54201 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
54202 choose to include this information in the TLS negotiation.  If this becomes
54203 wide-spread, then hosters can choose to present different certificates to
54204 different clients.  Or even negotiate different cipher suites.
54205 </para>
54206 <para>
54207 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
54208 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
54209 nothing more to it.  Choosing a sensible value not derived insecurely is the
54210 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
54211 for the lifetime of the client connection (including during authentication).
54212 </para>
54213 <para>
54214 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
54215 received from a client.
54216 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
54217 </para>
54218 <para>
54219 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
54220 option (prior to expansion) then the following options will be re-expanded
54221 during TLS session handshake, to permit alternative values to be chosen:
54222 </para>
54223 <itemizedlist>
54224 <listitem>
54225 <para>
54226 <option>tls_certificate</option>
54227 </para>
54228 </listitem>
54229 <listitem>
54230 <para>
54231 <option>tls_crl</option>
54232 </para>
54233 </listitem>
54234 <listitem>
54235 <para>
54236 <option>tls_privatekey</option>
54237 </para>
54238 </listitem>
54239 <listitem>
54240 <para>
54241 <option>tls_verify_certificates</option>
54242 </para>
54243 </listitem>
54244 <listitem>
54245 <para>
54246 <option>tls_ocsp_file</option>
54247 </para>
54248 </listitem>
54249 </itemizedlist>
54250 <para>
54251 Great care should be taken to deal with matters of case, various injection
54252 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
54253 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
54254 arbitrary unverified data provided prior to authentication.
54255 Further, the initial certificate is loaded before SNI is arrived, so
54256 an expansion for <option>tls_certificate</option> must have a default which is used
54257 when <varname>$tls_in_sni</varname> is empty.
54258 </para>
54259 <para>
54260 The Exim developers are proceeding cautiously and so far no other TLS options
54261 are re-expanded.
54262 </para>
54263 <para>
54264 When Exim is built against OpenSSL, OpenSSL must have been built with support
54265 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
54266 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
54267 see <literal>-servername</literal> in the output, then OpenSSL has support.
54268 </para>
54269 <para>
54270 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
54271 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
54272 built, then you have SNI support).
54273 </para>
54274 </section>
54275 <section id="SECTmulmessam">
54276 <title>Multiple messages on the same encrypted TCP/IP connection</title>
54277 <para>
54278 <indexterm role="concept">
54279 <primary>multiple SMTP deliveries with TLS</primary>
54280 </indexterm>
54281 <indexterm role="concept">
54282 <primary>TLS</primary>
54283 <secondary>multiple message deliveries</secondary>
54284 </indexterm>
54285 Exim sends multiple messages down the same TCP/IP connection by starting up
54286 an entirely new delivery process for each message, passing the socket from
54287 one process to the next. This implementation does not fit well with the use
54288 of TLS, because there is quite a lot of state information associated with a TLS
54289 connection, not just a socket identification. Passing all the state information
54290 to a new process is not feasible. Consequently, for sending using TLS Exim
54291 starts an additional proxy process for handling the encryption, piping the
54292 unencrypted data stream from and to the delivery processes.
54293 </para>
54294 <para>
54295 An older mode of operation can be enabled on a per-host basis by the
54296 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
54297 this list the proxy process described above is not used; instead Exim
54298 shuts down an existing TLS session being run by the delivery process
54299 before passing the socket to a new process. The new process may then
54300 try to start a new TLS session, and if successful, may try to re-authenticate
54301 if AUTH is in use, before sending the next message.
54302 </para>
54303 <para>
54304 The RFC is not clear as to whether or not an SMTP session continues in clear
54305 after TLS has been shut down, or whether TLS may be restarted again later, as
54306 just described. However, if the server is Exim, this shutdown and
54307 reinitialization works. It is not known which (if any) other servers operate
54308 successfully if the client closes a TLS session and continues with unencrypted
54309 SMTP, but there are certainly some that do not work. For such servers, Exim
54310 should not pass the socket to another process, because the failure of the
54311 subsequent attempt to use it would cause Exim to record a temporary host error,
54312 and delay other deliveries to that host.
54313 </para>
54314 <para>
54315 To test for this case, Exim sends an EHLO command to the server after
54316 closing down the TLS session. If this fails in any way, the connection is
54317 closed instead of being passed to a new delivery process, but no retry
54318 information is recorded.
54319 </para>
54320 <para>
54321 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
54322 <command>smtp</command> transport to match those hosts for which Exim should not pass
54323 connections to new processes if TLS has been used.
54324 </para>
54325 </section>
54326 <section id="SECTcerandall">
54327 <title>Certificates and all that</title>
54328 <para>
54329 <indexterm role="concept">
54330 <primary>certificate</primary>
54331 <secondary>references to discussion</secondary>
54332 </indexterm>
54333 In order to understand fully how TLS works, you need to know about
54334 certificates, certificate signing, and certificate authorities. This is not the
54335 place to give a tutorial, especially as I do not know very much about it
54336 myself. Some helpful introduction can be found in the FAQ for the SSL addition
54337 to Apache, currently at
54338 </para>
54339 <literallayout>
54340 <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>
54341 </literallayout>
54342 <para>
54343 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
54344 links to further files.
54345 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
54346 0-201-61598-3), contains both introductory and more in-depth descriptions.
54347 Some sample programs taken from the book are available from
54348 </para>
54349 <literallayout>
54350 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
54351 </literallayout>
54352 </section>
54353 <section id="SECID186">
54354 <title>Certificate chains</title>
54355 <para>
54356 The file named by <option>tls_certificate</option> may contain more than one
54357 certificate. This is useful in the case where the certificate that is being
54358 sent is validated by an intermediate certificate which the other end does
54359 not have. Multiple certificates must be in the correct order in the file.
54360 First the host&#x2019;s certificate itself, then the first intermediate
54361 certificate to validate the issuer of the host certificate, then the next
54362 intermediate certificate to validate the issuer of the first intermediate
54363 certificate, and so on, until finally (optionally) the root certificate.
54364 The root certificate must already be trusted by the recipient for
54365 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
54366 root certificate along with the rest makes it available for the user to
54367 install if the receiving end is a client MUA that can interact with a user.
54368 </para>
54369 <para>
54370 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
54371 even if your libraries allow loading them for use in Exim when acting as a
54372 server, increasingly clients will not accept such certificates.  The error
54373 diagnostics in such a case can be frustratingly vague.
54374 </para>
54375 </section>
54376 <section id="SECID187">
54377 <title>Self-signed certificates</title>
54378 <para>
54379 <indexterm role="concept">
54380 <primary>certificate</primary>
54381 <secondary>self-signed</secondary>
54382 </indexterm>
54383 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
54384 with OpenSSL, like this:
54385 </para>
54386 <literallayout class="monospaced">
54387 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
54388             -days 9999 -nodes
54389 </literallayout>
54390 <para>
54391 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
54392 delimited and so can be identified independently. The <option>-days</option> option
54393 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
54394 important: if you do not set it, the key is encrypted with a passphrase
54395 that you are prompted for, and any use that is made of the key causes more
54396 prompting for the passphrase. This is not helpful if you are going to use
54397 this certificate and key in an MTA, where prompting is not possible.
54398 </para>
54399 <para>
54400 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
54401 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
54402 the above command might produce a date in the past.  Think carefully about
54403 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
54404 of the certificate or reconsider your platform deployment.  (At time of
54405 writing, reducing the duration is the most likely choice, but the inexorable
54406 progression of time takes us steadily towards an era where this will not
54407 be a sensible resolution).
54408 </para>
54409 <para>
54410 A self-signed certificate made in this way is sufficient for testing, and
54411 may be adequate for all your requirements if you are mainly interested in
54412 encrypting transfers, and not in secure identification.
54413 </para>
54414 <para>
54415 However, many clients require that the certificate presented by the server be a
54416 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
54417 certificate. In this situation, the self-signed certificate described above
54418 must be installed on the client host as a trusted root <emphasis>certification
54419 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
54420 signed with that self-signed certificate.
54421 </para>
54422 <para>
54423 For information on creating self-signed CA certificates and using them to sign
54424 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
54425 Open-source PKI book, available online at
54426 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
54427 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
54428 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
54429 </para>
54430 </section>
54431 <section id="SECDANE" revisionflag="changed">
54432 <title>DANE</title>
54433 <para revisionflag="changed">
54434 <indexterm role="concept">
54435 <primary>DANE</primary>
54436 </indexterm>
54437 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
54438 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
54439 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
54440 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
54441 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
54442 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
54443 </para>
54444 <para revisionflag="changed">
54445 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
54446 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
54447 by (a) is thought to be smaller than that of the set of root CAs.
54448 </para>
54449 <para revisionflag="changed">
54450 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
54451 fail to pass on a server&#x2019;s STARTTLS.
54452 </para>
54453 <para revisionflag="changed">
54454 DANE scales better than having to maintain (and side-channel communicate) copies of server certificates
54455 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
54456 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
54457 </para>
54458 <para revisionflag="changed">
54459 DANE requires a server operator to do three things: 1) run DNSSEC.  This provides assurance to clients
54460 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
54461 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
54462 DNSSEC.
54463 2) add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
54464 3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
54465 </para>
54466 <para revisionflag="changed">
54467 There are no changes to Exim specific to server-side operation of DANE.
54468 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
54469 in <filename>Local/Makefile</filename>.
54470 If it has been included, the macro "_HAVE_DANE" will be defined.
54471 </para>
54472 <para revisionflag="changed">
54473 The TLSA record for the server may have "certificate usage" of DANE-TA(2) or DANE-EE(3).  The latter specifies
54474 the End Entity directly, i.e. the certificate involved is that of the server (and should be the sole one transmitted
54475 during the TLS handshake); this is appropriate for a single system, using a self-signed certificate.
54476 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
54477 well-known one.  A private CA at simplest is just a self-signed certificate which is used to sign
54478 cerver certificates, but running one securely does require careful arrangement.  If a private CA is used
54479 then either all clients must be primed with it, or (probably simpler) the server TLS handshake must transmit
54480 the entire certificate chain from CA to server-certificate.  If a public CA is used then all clients must be primed with it
54481 (losing one advantage of DANE) - but the attack surface is reduced from all public CAs to that single CA.
54482 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
54483 all of which point to a single TLSA record.
54484 </para>
54485 <para revisionflag="changed">
54486 Another approach which should be seriously considered is to use DANE with a certificate
54487 from a public CA, because of another technology, "MTA-STS", described below.
54488 </para>
54489 <para revisionflag="changed">
54490 The TLSA record should have a Selector field of SPKI(1) and a Matching Type field of SHA2-512(2).
54491 </para>
54492 <para revisionflag="changed">
54493 At the time of writing, <emphasis role="bold"><ulink url="https://www.huque.com/bin/gen_tlsa">https://www.huque.com/bin/gen_tlsa</ulink></emphasis>
54494 is useful for quickly generating TLSA records; and commands like
54495 </para>
54496 <literallayout class="monospaced" revisionflag="changed">
54497   openssl x509 -in -pubkey -noout &lt;certificate.pem \
54498   | openssl rsa -outform der -pubin 2&gt;/dev/null \
54499   | openssl sha512 \
54500   | awk '{print $2}'
54501 </literallayout>
54502 <para revisionflag="changed">
54503 are workable for 4th-field hashes.
54504 </para>
54505 <para revisionflag="changed">
54506 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
54507 </para>
54508 <para revisionflag="changed">
54509 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
54510 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
54511 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
54512 </para>
54513 <literallayout class="monospaced" revisionflag="changed">
54514   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
54515                                  {= {4}{$tls_out_tlsa_usage}} } \
54516                          {*}{}}
54517 </literallayout>
54518 <para revisionflag="changed">
54519 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
54520 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
54521 found. If the definition of <option>hosts_request_ocsp</option> includes the
54522 string "tls_out_tlsa_usage", they are re-expanded in time to
54523 control the OCSP request.
54524 </para>
54525 <para revisionflag="changed">
54526 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
54527 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
54528 </para>
54529 <para revisionflag="changed">
54530 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
54531 and <option>dane_require_tls_ciphers</option>.
54532 The require variant will result in failure if the target host is not DNSSEC-secured.
54533 </para>
54534 <para revisionflag="changed">
54535 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
54536 </para>
54537 <para revisionflag="changed">
54538 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using dnssec.
54539 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
54540 will be required for the host.  If it does not, the host will not
54541 be used; there is no fallback to non-DANE or non-TLS.
54542 </para>
54543 <para revisionflag="changed">
54544 If DANE is requested and usable, then the TLS cipher list configuration
54545 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
54546 back to <option>tls_require_ciphers</option> only if that is unset.
54547 This lets you configure "decent crypto" for DANE and "better than nothing
54548 crypto" as the default.  Note though that while GnuTLS lets the string control
54549 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
54550 limited to ciphersuite constraints.
54551 </para>
54552 <para revisionflag="changed">
54553 If DANE is requested and useable (see above) the following transport options are ignored:
54554 </para>
54555 <literallayout class="monospaced" revisionflag="changed">
54556   hosts_require_tls
54557   tls_verify_hosts
54558   tls_try_verify_hosts
54559   tls_verify_certificates
54560   tls_crl
54561   tls_verify_cert_hostnames
54562 </literallayout>
54563 <para revisionflag="changed">
54564 If DANE is not usable, whether requested or not, and CA-anchored
54565 verification evaluation is wanted, the above variables should be set appropriately.
54566 </para>
54567 <para revisionflag="changed">
54568 Currently the <option>dnssec_request_domains</option> must be active and <option>dnssec_require_domains</option> is ignored.
54569 </para>
54570 <para revisionflag="changed">
54571 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
54572 </para>
54573 <para revisionflag="changed">
54574 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
54575 verification succeeded using DANE and "no" otherwise (only useful
54576 in combination with events; see <xref linkend="CHAPevents"/>),
54577 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
54578 </para>
54579 <para revisionflag="changed">
54580 <indexterm role="concept">
54581 <primary>DANE</primary>
54582 <secondary>reporting</secondary>
54583 </indexterm>
54584 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
54585 to achieve DANE-verified connection, if one was either requested and offered, or
54586 required.  This is intended to support TLS-reporting as defined in
54587 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/draft-ietf-uta-smtp-tlsrpt-17">https://tools.ietf.org/html/draft-ietf-uta-smtp-tlsrpt-17</ulink></emphasis>.
54588 The <varname>$event_data</varname> will be one of the Result Types defined in
54589 Section 4.3 of that document.
54590 </para>
54591 <para revisionflag="changed">
54592 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
54593 </para>
54594 <para revisionflag="changed">
54595 DANE is specified in published RFCs and decouples certificate authority trust
54596 selection from a "race to the bottom" of "you must trust everything for mail
54597 to get through".  There is an alternative technology called MTA-STS, which
54598 instead publishes MX trust anchor information on an HTTPS website.  At the
54599 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
54600 Exim has no support for MTA-STS as a client, but Exim mail server operators
54601 can choose to publish information describing their TLS configuration using
54602 MTA-STS to let those clients who do use that protocol derive trust
54603 information.
54604 </para>
54605 <para revisionflag="changed">
54606 The MTA-STS design requires a certificate from a public Certificate Authority
54607 which is recognized by clients sending to you.  That selection is outside your
54608 control.
54609 </para>
54610 <para revisionflag="changed">
54611 The most interoperable course of action is probably to use
54612 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
54613 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
54614 records for DANE clients (such as Exim and Postfix) and to publish anchor
54615 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
54616 domain itself (with caveats around occasionally broken MTA-STS because of
54617 incompatible specification changes prior to reaching RFC status).
54618 </para>
54619 </section>
54620 </chapter>
54621
54622 <chapter id="CHAPACL">
54623 <title>Access control lists</title>
54624 <para>
54625 <indexterm role="concept" id="IIDacl" class="startofrange">
54626 <primary>access control lists (ACLs)</primary>
54627 <secondary>description</secondary>
54628 </indexterm>
54629 <indexterm role="concept">
54630 <primary>control of incoming mail</primary>
54631 </indexterm>
54632 <indexterm role="concept">
54633 <primary>message</primary>
54634 <secondary>controlling incoming</secondary>
54635 </indexterm>
54636 <indexterm role="concept">
54637 <primary>policy control</primary>
54638 <secondary>access control lists</secondary>
54639 </indexterm>
54640 Access Control Lists (ACLs) are defined in a separate section of the run time
54641 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
54642 name, terminated by a colon. Here is a complete ACL section that contains just
54643 one very small ACL:
54644 </para>
54645 <literallayout class="monospaced">
54646 begin acl
54647 small_acl:
54648   accept   hosts = one.host.only
54649 </literallayout>
54650 <para>
54651 You can have as many lists as you like in the ACL section, and the order in
54652 which they appear does not matter. The lists are self-terminating.
54653 </para>
54654 <para>
54655 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
54656 certain SMTP commands. This applies both to incoming TCP/IP connections, and
54657 when a local process submits a message using SMTP by specifying the <option>-bs</option>
54658 option. The most common use is for controlling which recipients are accepted
54659 in incoming messages. In addition, you can define an ACL that is used to check
54660 local non-SMTP messages. The default configuration file contains an example of
54661 a realistic ACL for checking RCPT commands. This is discussed in chapter
54662 <xref linkend="CHAPdefconfil"/>.
54663 </para>
54664 <section id="SECID188">
54665 <title>Testing ACLs</title>
54666 <para>
54667 The <option>-bh</option> command line option provides a way of testing your ACL
54668 configuration locally by running a fake SMTP session with which you interact.
54669 </para>
54670 </section>
54671 <section id="SECID189">
54672 <title>Specifying when ACLs are used</title>
54673 <para>
54674 <indexterm role="concept">
54675 <primary>access control lists (ACLs)</primary>
54676 <secondary>options for specifying</secondary>
54677 </indexterm>
54678 In order to cause an ACL to be used, you have to name it in one of the relevant
54679 options in the main part of the configuration. These options are:
54680 <indexterm role="concept">
54681 <primary>AUTH</primary>
54682 <secondary>ACL for</secondary>
54683 </indexterm>
54684 <indexterm role="concept">
54685 <primary>DATA</primary>
54686 <secondary>ACLs for</secondary>
54687 </indexterm>
54688 <indexterm role="concept">
54689 <primary>ETRN</primary>
54690 <secondary>ACL for</secondary>
54691 </indexterm>
54692 <indexterm role="concept">
54693 <primary>EXPN</primary>
54694 <secondary>ACL for</secondary>
54695 </indexterm>
54696 <indexterm role="concept">
54697 <primary>HELO</primary>
54698 <secondary>ACL for</secondary>
54699 </indexterm>
54700 <indexterm role="concept">
54701 <primary>EHLO</primary>
54702 <secondary>ACL for</secondary>
54703 </indexterm>
54704 <indexterm role="concept">
54705 <primary>DKIM</primary>
54706 <secondary>ACL for</secondary>
54707 </indexterm>
54708 <indexterm role="concept">
54709 <primary>MAIL</primary>
54710 <secondary>ACL for</secondary>
54711 </indexterm>
54712 <indexterm role="concept">
54713 <primary>QUIT, ACL for</primary>
54714 </indexterm>
54715 <indexterm role="concept">
54716 <primary>RCPT</primary>
54717 <secondary>ACL for</secondary>
54718 </indexterm>
54719 <indexterm role="concept">
54720 <primary>STARTTLS, ACL for</primary>
54721 </indexterm>
54722 <indexterm role="concept">
54723 <primary>VRFY</primary>
54724 <secondary>ACL for</secondary>
54725 </indexterm>
54726 <indexterm role="concept">
54727 <primary>SMTP</primary>
54728 <secondary>connection, ACL for</secondary>
54729 </indexterm>
54730 <indexterm role="concept">
54731 <primary>non-SMTP messages</primary>
54732 <secondary>ACLs for</secondary>
54733 </indexterm>
54734 <indexterm role="concept">
54735 <primary>MIME content scanning</primary>
54736 <secondary>ACL for</secondary>
54737 </indexterm>
54738 <indexterm role="concept">
54739 <primary>PRDR</primary>
54740 <secondary>ACL for</secondary>
54741 </indexterm>
54742 </para>
54743 <informaltable frame="none">
54744 <tgroup cols="2" colsep="0" rowsep="0">
54745 <colspec colwidth="140pt" align="left"/>
54746 <colspec colwidth="254pt" align="left"/>
54747 <tbody>
54748 <row>
54749 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
54750 <entry>ACL for non-SMTP messages</entry>
54751 </row>
54752 <row>
54753 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
54754 <entry>ACL for non-SMTP MIME parts</entry>
54755 </row>
54756 <row>
54757 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
54758 <entry>ACL at start of non-SMTP message</entry>
54759 </row>
54760 <row>
54761 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
54762 <entry>ACL for AUTH</entry>
54763 </row>
54764 <row>
54765 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
54766 <entry>ACL for start of SMTP connection</entry>
54767 </row>
54768 <row>
54769 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
54770 <entry>ACL after DATA is complete</entry>
54771 </row>
54772 <row>
54773 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
54774 <entry>ACL for each recipient, after DATA is complete</entry>
54775 </row>
54776 <row>
54777 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
54778 <entry>ACL for each DKIM signer</entry>
54779 </row>
54780 <row>
54781 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
54782 <entry>ACL for ETRN</entry>
54783 </row>
54784 <row>
54785 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
54786 <entry>ACL for EXPN</entry>
54787 </row>
54788 <row>
54789 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
54790 <entry>ACL for HELO or EHLO</entry>
54791 </row>
54792 <row>
54793 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
54794 <entry>ACL for MAIL</entry>
54795 </row>
54796 <row>
54797 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
54798 <entry>ACL for the AUTH parameter of MAIL</entry>
54799 </row>
54800 <row>
54801 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
54802 <entry>ACL for content-scanning MIME parts</entry>
54803 </row>
54804 <row>
54805 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
54806 <entry>ACL for non-QUIT terminations</entry>
54807 </row>
54808 <row>
54809 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
54810 <entry>ACL at start of DATA command</entry>
54811 </row>
54812 <row>
54813 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
54814 <entry>ACL for QUIT</entry>
54815 </row>
54816 <row>
54817 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
54818 <entry>ACL for RCPT</entry>
54819 </row>
54820 <row>
54821 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
54822 <entry>ACL for STARTTLS</entry>
54823 </row>
54824 <row>
54825 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
54826 <entry>ACL for VRFY</entry>
54827 </row>
54828 </tbody>
54829 </tgroup>
54830 </informaltable>
54831 <para>
54832 For example, if you set
54833 </para>
54834 <literallayout class="monospaced">
54835 acl_smtp_rcpt = small_acl
54836 </literallayout>
54837 <para>
54838 the little ACL defined above is used whenever Exim receives a RCPT command
54839 in an SMTP dialogue. The majority of policy tests on incoming messages can be
54840 done when RCPT commands arrive. A rejection of RCPT should cause the
54841 sending MTA to give up on the recipient address contained in the RCPT
54842 command, whereas rejection at other times may cause the client MTA to keep on
54843 trying to deliver the message. It is therefore recommended that you do as much
54844 testing as possible at RCPT time.
54845 </para>
54846 </section>
54847 <section id="SECID190">
54848 <title>The non-SMTP ACLs</title>
54849 <para>
54850 <indexterm role="concept">
54851 <primary>non-SMTP messages</primary>
54852 <secondary>ACLs for</secondary>
54853 </indexterm>
54854 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
54855 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
54856 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
54857 the state of the SMTP connection such as encryption and authentication) are not
54858 relevant and are forbidden in these ACLs. However, the sender and recipients
54859 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
54860 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
54861 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
54862 in any of these ACLs.
54863 </para>
54864 <para>
54865 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
54866 non-SMTP message, before any of the message has been read. (This is the
54867 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
54868 batched SMTP input, it runs after the DATA command has been reached. The
54869 result of this ACL is ignored; it cannot be used to reject a message. If you
54870 really need to, you could set a value in an ACL variable here and reject based
54871 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
54872 controls, and in particular, it can be used to set
54873 </para>
54874 <literallayout class="monospaced">
54875 control = suppress_local_fixups
54876 </literallayout>
54877 <para>
54878 This cannot be used in the other non-SMTP ACLs because by the time they are
54879 run, it is too late.
54880 </para>
54881 <para>
54882 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
54883 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
54884 </para>
54885 <para>
54886 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
54887 kind of rejection is treated as permanent, because there is no way of sending a
54888 temporary error for these kinds of message.
54889 </para>
54890 </section>
54891 <section id="SECID191">
54892 <title>The SMTP connect ACL</title>
54893 <para>
54894 <indexterm role="concept">
54895 <primary>SMTP</primary>
54896 <secondary>connection, ACL for</secondary>
54897 </indexterm>
54898 <indexterm role="option">
54899 <primary><option>smtp_banner</option></primary>
54900 </indexterm>
54901 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
54902 session, after the test specified by <option>host_reject_connection</option> (which is now
54903 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
54904 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
54905 the message override the banner message that is otherwise specified by the
54906 <option>smtp_banner</option> option.
54907 </para>
54908 </section>
54909 <section id="SECID192">
54910 <title>The EHLO/HELO ACL</title>
54911 <para>
54912 <indexterm role="concept">
54913 <primary>EHLO</primary>
54914 <secondary>ACL for</secondary>
54915 </indexterm>
54916 <indexterm role="concept">
54917 <primary>HELO</primary>
54918 <secondary>ACL for</secondary>
54919 </indexterm>
54920 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
54921 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
54922 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
54923 Note that a client may issue more than one EHLO or HELO command in an SMTP
54924 session, and indeed is required to issue a new EHLO or HELO after successfully
54925 setting up encryption following a STARTTLS command.
54926 </para>
54927 <para>
54928 Note also that a deny neither forces the client to go away nor means that
54929 mail will be refused on the connection.  Consider checking for
54930 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
54931 </para>
54932 <para>
54933 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
54934 modifier, the message may not contain more than one line (it will be truncated
54935 at the first newline and a panic logged if it does). Such a message cannot
54936 affect the EHLO options that are listed on the second and subsequent lines of
54937 an EHLO response.
54938 </para>
54939 </section>
54940 <section id="SECID193">
54941 <title>The DATA ACLs</title>
54942 <para>
54943 <indexterm role="concept">
54944 <primary>DATA</primary>
54945 <secondary>ACLs for</secondary>
54946 </indexterm>
54947 Two ACLs are associated with the DATA command, because it is two-stage
54948 command, with two responses being sent to the client.
54949 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
54950 is obeyed. This gives you control after all the RCPT commands, but before
54951 the message itself is received. It offers the opportunity to give a negative
54952 response to the DATA command before the data is transmitted. Header lines
54953 added by MAIL or RCPT ACLs are not visible at this time, but any that
54954 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
54955 </para>
54956 <para>
54957 You cannot test the contents of the message, for example, to verify addresses
54958 in the headers, at RCPT time or when the DATA command is received. Such
54959 tests have to appear in the ACL that is run after the message itself has been
54960 received, before the final response to the DATA command is sent. This is
54961 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
54962 associated with the DATA command.
54963 </para>
54964 <para>
54965 <indexterm role="concept">
54966 <primary>CHUNKING</primary>
54967 <secondary>BDAT command</secondary>
54968 </indexterm>
54969 <indexterm role="concept">
54970 <primary>BDAT</primary>
54971 <secondary>SMTP command</secondary>
54972 </indexterm>
54973 <indexterm role="concept">
54974 <primary>RFC 3030</primary>
54975 <secondary>CHUNKING</secondary>
54976 </indexterm>
54977 If CHUNKING was advertised and a BDAT command sequence is received,
54978 the <option>acl_smtp_predata</option> ACL is not run.
54979 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
54980 the data specified is received.
54981 </para>
54982 <para>
54983 For both of these ACLs, it is not possible to reject individual recipients. An
54984 error response rejects the entire message. Unfortunately, it is known that some
54985 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
54986 before or after the data) correctly &ndash; they keep the message on their queues
54987 and try again later, but that is their problem, though it does waste some of
54988 your resources.
54989 </para>
54990 <para>
54991 The <option>acl_smtp_data</option> ACL is run after
54992 the <option>acl_smtp_data_prdr</option>,
54993 the <option>acl_smtp_dkim</option>
54994 and the <option>acl_smtp_mime</option> ACLs.
54995 </para>
54996 </section>
54997 <section id="SECTDKIMACL">
54998 <title>The SMTP DKIM ACL</title>
54999 <para>
55000 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
55001 enabled (which is the default).
55002 </para>
55003 <para>
55004 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
55005 received, and is executed for each DKIM signature found in a message.  If not
55006 otherwise specified, the default action is to accept.
55007 </para>
55008 <para>
55009 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
55010 </para>
55011 <para>
55012 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
55013 </para>
55014 </section>
55015 <section id="SECID194">
55016 <title>The SMTP MIME ACL</title>
55017 <para>
55018 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
55019 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
55020 </para>
55021 <para>
55022 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
55023 </para>
55024 </section>
55025 <section id="SECTPRDRACL">
55026 <title>The SMTP PRDR ACL</title>
55027 <para>
55028 <indexterm role="concept">
55029 <primary>PRDR</primary>
55030 <secondary>ACL for</secondary>
55031 </indexterm>
55032 <indexterm role="option">
55033 <primary><option>prdr_enable</option></primary>
55034 </indexterm>
55035 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
55036 with PRDR support enabled (which is the default).
55037 It becomes active only when the PRDR feature is negotiated between
55038 client and server for a message, and more than one recipient
55039 has been accepted.
55040 </para>
55041 <para>
55042 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
55043 has been received, and is executed once for each recipient of the message
55044 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
55045 The test may accept, defer or deny for individual recipients.
55046 The <option>acl_smtp_data</option> will still be called after this ACL and
55047 can reject the message overall, even if this ACL has accepted it
55048 for some or all recipients.
55049 </para>
55050 <para>
55051 PRDR may be used to support per-user content filtering.  Without it
55052 one must defer any recipient after the first that has a different
55053 content-filter configuration.  With PRDR, the RCPT-time check
55054 <indexterm role="concept">
55055 <primary>PRDR</primary>
55056 <secondary>variable for</secondary>
55057 </indexterm>
55058 for this can be disabled when the variable <varname>$prdr_requested</varname>
55059 is <quote>yes</quote>.
55060 Any required difference in behaviour of the main DATA-time
55061 ACL should however depend on the PRDR-time ACL having run, as Exim
55062 will avoid doing so in some situations (e.g.  single-recipient mails).
55063 </para>
55064 <para>
55065 See also the <option>prdr_enable</option> global option
55066 and the <option>hosts_try_prdr</option> smtp transport option.
55067 </para>
55068 <para>
55069 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
55070 If the ACL is not defined, processing completes as if
55071 the feature was not requested by the client.
55072 </para>
55073 </section>
55074 <section id="SECTQUITACL">
55075 <title>The QUIT ACL</title>
55076 <para>
55077 <indexterm role="concept">
55078 <primary>QUIT, ACL for</primary>
55079 </indexterm>
55080 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
55081 does not affect the response code to QUIT, which is always 221. Thus, the ACL
55082 does not in fact control any access.
55083 For this reason, it may only accept
55084 or warn as its final result.
55085 </para>
55086 <para>
55087 This ACL can be used for tasks such as custom logging at the end of an SMTP
55088 session. For example, you can use ACL variables in other ACLs to count
55089 messages, recipients, etc., and log the totals at QUIT time using one or
55090 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
55091 </para>
55092 <para>
55093 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
55094 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
55095 </para>
55096 <para>
55097 You do not need to have a final <option>accept</option>, but if you do, you can use a
55098 <option>message</option> modifier to specify custom text that is sent as part of the 221
55099 response to QUIT.
55100 </para>
55101 <para>
55102 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
55103 failure (for example, failure to open a log file, or when Exim is bombing out
55104 because it has detected an unrecoverable error), all SMTP commands from the
55105 client are given temporary error responses until QUIT is received or the
55106 connection is closed. In these special cases, the QUIT ACL does not run.
55107 </para>
55108 </section>
55109 <section id="SECTNOTQUITACL">
55110 <title>The not-QUIT ACL</title>
55111 <para>
55112 <indexterm role="variable">
55113 <primary><varname>$acl_smtp_notquit</varname></primary>
55114 </indexterm>
55115 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
55116 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
55117 trouble, such as being unable to write to its log files, this ACL is not run,
55118 because it might try to do things (such as write to log files) that make the
55119 situation even worse.
55120 </para>
55121 <para>
55122 Like the QUIT ACL, this ACL is provided to make it possible to do customized
55123 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
55124 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
55125 and <option>warn</option>.
55126 </para>
55127 <para>
55128 <indexterm role="variable">
55129 <primary><varname>$smtp_notquit_reason</varname></primary>
55130 </indexterm>
55131 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
55132 to a string that indicates the reason for the termination of the SMTP
55133 connection. The possible values are:
55134 </para>
55135 <informaltable frame="none">
55136 <tgroup cols="2" colsep="0" rowsep="0">
55137 <colspec colwidth="196pt" align="left"/>
55138 <colspec colwidth="254pt" align="left"/>
55139 <tbody>
55140 <row>
55141 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
55142 <entry>Another ACL issued a <option>drop</option> command</entry>
55143 </row>
55144 <row>
55145 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
55146 <entry>Too many unknown or non-mail commands</entry>
55147 </row>
55148 <row>
55149 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
55150 <entry>Timeout while reading SMTP commands</entry>
55151 </row>
55152 <row>
55153 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
55154 <entry>The SMTP connection has been lost</entry>
55155 </row>
55156 <row>
55157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
55158 <entry>Timeout while reading message data</entry>
55159 </row>
55160 <row>
55161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
55162 <entry>The <function>local_scan()</function> function crashed</entry>
55163 </row>
55164 <row>
55165 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
55166 <entry>The <function>local_scan()</function> function timed out</entry>
55167 </row>
55168 <row>
55169 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
55170 <entry>SIGTERM or SIGINT</entry>
55171 </row>
55172 <row>
55173 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
55174 <entry>SMTP synchronization error</entry>
55175 </row>
55176 <row>
55177 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
55178 <entry>TLS failed to start</entry>
55179 </row>
55180 </tbody>
55181 </tgroup>
55182 </informaltable>
55183 <para>
55184 In most cases when an SMTP connection is closed without having received QUIT,
55185 Exim sends an SMTP response message before actually closing the connection.
55186 With the exception of the <literal>acl-drop</literal> case, the default message can be
55187 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
55188 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
55189 used.
55190 </para>
55191 </section>
55192 <section id="SECID195">
55193 <title>Finding an ACL to use</title>
55194 <para>
55195 <indexterm role="concept">
55196 <primary>access control lists (ACLs)</primary>
55197 <secondary>finding which to use</secondary>
55198 </indexterm>
55199 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
55200 you can use different ACLs in different circumstances. For example,
55201 </para>
55202 <literallayout class="monospaced">
55203 acl_smtp_rcpt = ${if ={25}{$interface_port} \
55204                      {acl_check_rcpt} {acl_check_rcpt_submit} }
55205 </literallayout>
55206 <para>
55207 In the default configuration file there are some example settings for
55208 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
55209 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
55210 expansion like this to choose an ACL for MUAs on these ports which is
55211 more appropriate for this purpose than the default ACL on port 25.
55212 </para>
55213 <para>
55214 The expanded string does not have to be the name of an ACL in the
55215 configuration file; there are other possibilities. Having expanded the
55216 string, Exim searches for an ACL as follows:
55217 </para>
55218 <itemizedlist>
55219 <listitem>
55220 <para>
55221 If the string begins with a slash, Exim uses it as a file name, and reads its
55222 contents as an ACL. The lines are processed in the same way as lines in the
55223 Exim configuration file. In particular, continuation lines are supported, blank
55224 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
55225 If the file does not exist or cannot be read, an error occurs (typically
55226 causing a temporary failure of whatever caused the ACL to be run). For example:
55227 </para>
55228 <literallayout class="monospaced">
55229 acl_smtp_data = /etc/acls/\
55230   ${lookup{$sender_host_address}lsearch\
55231   {/etc/acllist}{$value}{default}}
55232 </literallayout>
55233 <para>
55234 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
55235 back to a default if the lookup fails. If an ACL is successfully read from a
55236 file, it is retained in memory for the duration of the Exim process, so that it
55237 can be re-used without having to re-read the file.
55238 </para>
55239 </listitem>
55240 <listitem>
55241 <para>
55242 If the string does not start with a slash, and does not contain any spaces,
55243 Exim searches the ACL section of the configuration for an ACL whose name
55244 matches the string.
55245 </para>
55246 </listitem>
55247 <listitem>
55248 <para>
55249 If no named ACL is found, or if the string contains spaces, Exim parses
55250 the string as an inline ACL. This can save typing in cases where you just
55251 want to have something like
55252 </para>
55253 <literallayout class="monospaced">
55254 acl_smtp_vrfy = accept
55255 </literallayout>
55256 <para>
55257 in order to allow free use of the VRFY command. Such a string may contain
55258 newlines; it is processed in the same way as an ACL that is read from a file.
55259 </para>
55260 </listitem>
55261 </itemizedlist>
55262 </section>
55263 <section id="SECID196">
55264 <title>ACL return codes</title>
55265 <para>
55266 <indexterm role="concept">
55267 <primary>access control lists (ACLs)</primary>
55268 <secondary>return codes</secondary>
55269 </indexterm>
55270 Except for the QUIT ACL, which does not affect the SMTP return code (see
55271 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
55272 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
55273 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
55274 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
55275 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
55276 This also causes a 4<emphasis>xx</emphasis> return code.
55277 </para>
55278 <para>
55279 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
55280 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
55281 submitters of non-SMTP messages.
55282 </para>
55283 <para>
55284 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
55285 has the effect of <quote>accept</quote>, but causes either the entire message or an
55286 individual recipient address to be discarded. In other words, it is a
55287 blackholing facility. Use it with care.
55288 </para>
55289 <para>
55290 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
55291 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
55292 RCPT ACL is to discard just the one recipient address. If there are no
55293 recipients left when the message&#x2019;s data is received, the DATA ACL is not
55294 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
55295 remaining recipients. The <quote>discard</quote> return is not permitted for the
55296 <option>acl_smtp_predata</option> ACL.
55297 </para>
55298 <para>
55299 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
55300 is done on the address and the result determines the SMTP response.
55301 </para>
55302 <para>
55303 <indexterm role="concept">
55304 <primary><function>local_scan()</function> function</primary>
55305 <secondary>when all recipients discarded</secondary>
55306 </indexterm>
55307 The <function>local_scan()</function> function is always run, even if there are no remaining
55308 recipients; it may create new recipients.
55309 </para>
55310 </section>
55311 <section id="SECID197">
55312 <title>Unset ACL options</title>
55313 <para>
55314 <indexterm role="concept">
55315 <primary>access control lists (ACLs)</primary>
55316 <secondary>unset options</secondary>
55317 </indexterm>
55318 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
55319 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
55320 not defined at all. For any defined ACL, the default action when control
55321 reaches the end of the ACL statements is <quote>deny</quote>.
55322 </para>
55323 <para>
55324 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
55325 these two are ACLs that are used only for their side effects. They cannot be
55326 used to accept or reject anything.
55327 </para>
55328 <para>
55329 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
55330 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
55331 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
55332 when the ACL is not defined is <quote>accept</quote>.
55333 </para>
55334 <para>
55335 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
55336 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
55337 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
55338 messages over an SMTP connection. For an example, see the ACL in the default
55339 configuration file.
55340 </para>
55341 </section>
55342 <section id="SECID198">
55343 <title>Data for message ACLs</title>
55344 <para>
55345 <indexterm role="concept">
55346 <primary>access control lists (ACLs)</primary>
55347 <secondary>data for message ACL</secondary>
55348 </indexterm>
55349 <indexterm role="variable">
55350 <primary><varname>$domain</varname></primary>
55351 </indexterm>
55352 <indexterm role="variable">
55353 <primary><varname>$local_part</varname></primary>
55354 </indexterm>
55355 <indexterm role="variable">
55356 <primary><varname>$sender_address</varname></primary>
55357 </indexterm>
55358 <indexterm role="variable">
55359 <primary><varname>$sender_host_address</varname></primary>
55360 </indexterm>
55361 <indexterm role="variable">
55362 <primary><varname>$smtp_command</varname></primary>
55363 </indexterm>
55364 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
55365 that contain information about the host and the message&#x2019;s sender (for example,
55366 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
55367 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
55368 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
55369 is available in <varname>$smtp_command</varname>.
55370 </para>
55371 <para>
55372 When an ACL for the AUTH parameter of MAIL is running, the variables that
55373 contain information about the host are set, but <varname>$sender_address</varname> is not yet
55374 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
55375 how it is used.
55376 </para>
55377 <para>
55378 <indexterm role="variable">
55379 <primary><varname>$message_size</varname></primary>
55380 </indexterm>
55381 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
55382 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
55383 that parameter is not given. The value is updated to the true message size by
55384 the time the final DATA ACL is run (after the message data has been
55385 received).
55386 </para>
55387 <para>
55388 <indexterm role="variable">
55389 <primary><varname>$rcpt_count</varname></primary>
55390 </indexterm>
55391 <indexterm role="variable">
55392 <primary><varname>$recipients_count</varname></primary>
55393 </indexterm>
55394 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
55395 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
55396 accepted, so while an ACL for RCPT is being processed, it contains the number
55397 of previously accepted recipients. At DATA time (for both the DATA ACLs),
55398 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
55399 <varname>$recipients_count</varname> contains the total number of accepted recipients.
55400 </para>
55401 </section>
55402 <section id="SECTdatfornon">
55403 <title>Data for non-message ACLs</title>
55404 <para>
55405 <indexterm role="concept">
55406 <primary>access control lists (ACLs)</primary>
55407 <secondary>data for non-message ACL</secondary>
55408 </indexterm>
55409 <indexterm role="variable">
55410 <primary><varname>$smtp_command_argument</varname></primary>
55411 </indexterm>
55412 <indexterm role="variable">
55413 <primary><varname>$smtp_command</varname></primary>
55414 </indexterm>
55415 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
55416 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
55417 and the entire SMTP command is available in <varname>$smtp_command</varname>.
55418 These variables can be tested using a <option>condition</option> condition. For example,
55419 here is an ACL for use with AUTH, which insists that either the session is
55420 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
55421 does not permit authentication methods that use cleartext passwords on
55422 unencrypted connections.
55423 </para>
55424 <literallayout class="monospaced">
55425 acl_check_auth:
55426   accept encrypted = *
55427   accept condition = ${if eq{${uc:$smtp_command_argument}}\
55428                      {CRAM-MD5}}
55429   deny   message   = TLS encryption or CRAM-MD5 required
55430 </literallayout>
55431 <para>
55432 (Another way of applying this restriction is to arrange for the authenticators
55433 that use cleartext passwords not to be advertised when the connection is not
55434 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
55435 option to do this.)
55436 </para>
55437 </section>
55438 <section id="SECID199">
55439 <title>Format of an ACL</title>
55440 <para>
55441 <indexterm role="concept">
55442 <primary>access control lists (ACLs)</primary>
55443 <secondary>format of</secondary>
55444 </indexterm>
55445 <indexterm role="concept">
55446 <primary>access control lists (ACLs)</primary>
55447 <secondary>verbs, definition of</secondary>
55448 </indexterm>
55449 An individual ACL consists of a number of statements. Each statement starts
55450 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
55451 Modifiers can change the way the verb operates, define error and log messages,
55452 set variables, insert delays, and vary the processing of accepted messages.
55453 </para>
55454 <para>
55455 If all the conditions are met, the verb is obeyed. The same condition may be
55456 used (with different arguments) more than once in the same statement. This
55457 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
55458 example:
55459 </para>
55460 <literallayout class="monospaced">
55461 deny  dnslists = list1.example
55462       dnslists = list2.example
55463 </literallayout>
55464 <para>
55465 If there are no conditions, the verb is always obeyed. Exim stops evaluating
55466 the conditions and modifiers when it reaches a condition that fails. What
55467 happens then depends on the verb (and in one case, on a special modifier). Not
55468 all the conditions make sense at every testing point. For example, you cannot
55469 test a sender address in the ACL that is run for a VRFY command.
55470 </para>
55471 </section>
55472 <section id="SECID200">
55473 <title>ACL verbs</title>
55474 <para>
55475 The ACL verbs are as follows:
55476 </para>
55477 <itemizedlist>
55478 <listitem>
55479 <para>
55480 <indexterm role="concept">
55481 <primary><option>accept</option> ACL verb</primary>
55482 </indexterm>
55483 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
55484 of the conditions are not met, what happens depends on whether <option>endpass</option>
55485 appears among the conditions (for syntax see below). If the failing condition
55486 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
55487 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
55488 check a RCPT command:
55489 </para>
55490 <literallayout class="monospaced">
55491 accept domains = +local_domains
55492        endpass
55493        verify = recipient
55494 </literallayout>
55495 <para>
55496 If the recipient domain does not match the <option>domains</option> condition, control
55497 passes to the next statement. If it does match, the recipient is verified, and
55498 the command is accepted if verification succeeds. However, if verification
55499 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
55500 <option>endpass</option>.
55501 </para>
55502 <para>
55503 The <option>endpass</option> feature has turned out to be confusing to many people, so its
55504 use is not recommended nowadays. It is always possible to rewrite an ACL so
55505 that <option>endpass</option> is not needed, and it is no longer used in the default
55506 configuration.
55507 </para>
55508 <para>
55509 <indexterm role="concept">
55510 <primary><option>message</option> ACL modifier</primary>
55511 <secondary>with <option>accept</option></secondary>
55512 </indexterm>
55513 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
55514 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
55515 (when an <option>accept</option> verb either accepts or passes control to the next
55516 statement), <option>message</option> can be used to vary the message that is sent when an
55517 SMTP command is accepted. For example, in a RCPT ACL you could have:
55518 </para>
55519 <literallayout>
55520 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55521 <literal>        message = OK, I will allow you through today</literal>
55522 </literallayout>
55523 <para>
55524 You can specify an SMTP response code, optionally followed by an <quote>extended
55525 response code</quote> at the start of the message, but the first digit must be the
55526 same as would be sent by default, which is 2 for an <option>accept</option> verb.
55527 </para>
55528 <para>
55529 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
55530 an error message that is used when access is denied. This behaviour is retained
55531 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
55532 of <option>endpass</option>.
55533 </para>
55534 </listitem>
55535 <listitem>
55536 <para>
55537 <indexterm role="concept">
55538 <primary><option>defer</option> ACL verb</primary>
55539 </indexterm>
55540 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
55541 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
55542 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
55543 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
55544 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
55545 be used in any ACL, and even for a recipient it might be a simpler approach.
55546 </para>
55547 </listitem>
55548 <listitem>
55549 <para>
55550 <indexterm role="concept">
55551 <primary><option>deny</option> ACL verb</primary>
55552 </indexterm>
55553 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
55554 the conditions are not met, control is passed to the next ACL statement. For
55555 example,
55556 </para>
55557 <literallayout class="monospaced">
55558 deny dnslists = blackholes.mail-abuse.org
55559 </literallayout>
55560 <para>
55561 rejects commands from hosts that are on a DNS black list.
55562 </para>
55563 </listitem>
55564 <listitem>
55565 <para>
55566 <indexterm role="concept">
55567 <primary><option>discard</option> ACL verb</primary>
55568 </indexterm>
55569 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
55570 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
55571 that are concerned with receiving messages. When all the conditions are true,
55572 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
55573 recipients to be discarded. If it is used in an ACL for RCPT, just the one
55574 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
55575 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
55576 do not appear in the log line when the <option>received_recipients</option> log selector is set.
55577 </para>
55578 <para>
55579 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
55580 its contents are added to the line that is automatically written to the log.
55581 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
55582 </para>
55583 </listitem>
55584 <listitem>
55585 <para>
55586 <indexterm role="concept">
55587 <primary><option>drop</option> ACL verb</primary>
55588 </indexterm>
55589 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
55590 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
55591 </para>
55592 <literallayout class="monospaced">
55593 drop   message   = I don't take more than 20 RCPTs
55594        condition = ${if &gt; {$rcpt_count}{20}}
55595 </literallayout>
55596 <para>
55597 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
55598 The connection is always dropped after sending a 550 response.
55599 </para>
55600 </listitem>
55601 <listitem>
55602 <para>
55603 <indexterm role="concept">
55604 <primary><option>require</option> ACL verb</primary>
55605 </indexterm>
55606 <option>require</option>: If all the conditions are met, control is passed to the next ACL
55607 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
55608 example, when checking a RCPT command,
55609 </para>
55610 <literallayout class="monospaced">
55611 require message = Sender did not verify
55612         verify  = sender
55613 </literallayout>
55614 <para>
55615 passes control to subsequent statements only if the message&#x2019;s sender can be
55616 verified. Otherwise, it rejects the command. Note the positioning of the
55617 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
55618 discussed in section <xref linkend="SECTcondmodproc"/>.
55619 </para>
55620 </listitem>
55621 <listitem>
55622 <para>
55623 <indexterm role="concept">
55624 <primary><option>warn</option> ACL verb</primary>
55625 </indexterm>
55626 <option>warn</option>: If all the conditions are true, a line specified by the
55627 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
55628 to the next ACL statement. If any condition is false, the log line is not
55629 written. If an identical log line is requested several times in the same
55630 message, only one copy is actually written to the log. If you want to force
55631 duplicates to be written, use the <option>logwrite</option> modifier instead.
55632 </para>
55633 <para>
55634 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
55635 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
55636 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
55637 first failing condition. There is more about adding header lines in section
55638 <xref linkend="SECTaddheadacl"/>.
55639 </para>
55640 <para>
55641 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
55642 some sort of defer), the log line specified by <option>log_message</option> is not written.
55643 This does not include the case of a forced failure from a lookup, which
55644 is considered to be a successful completion. After a defer, no further
55645 conditions or modifiers in the <option>warn</option> statement are processed. The incident
55646 is logged, and the ACL continues to be processed, from the next statement
55647 onwards.
55648 </para>
55649 <para>
55650 <indexterm role="variable">
55651 <primary><varname>$acl_verify_message</varname></primary>
55652 </indexterm>
55653 When one of the <option>warn</option> conditions is an address verification that fails, the
55654 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
55655 want this logged, you must set it up explicitly. For example:
55656 </para>
55657 <literallayout class="monospaced">
55658 warn   !verify = sender
55659        log_message = sender verify failed: $acl_verify_message
55660 </literallayout>
55661 </listitem>
55662 </itemizedlist>
55663 <para>
55664 At the end of each ACL there is an implicit unconditional <option>deny</option>.
55665 </para>
55666 <para>
55667 As you can see from the examples above, the conditions and modifiers are
55668 written one to a line, with the first one on the same line as the verb, and
55669 subsequent ones on following lines. If you have a very long condition, you can
55670 continue it onto several physical lines by the usual backslash continuation
55671 mechanism. It is conventional to align the conditions vertically.
55672 </para>
55673 </section>
55674 <section id="SECTaclvariables">
55675 <title>ACL variables</title>
55676 <para>
55677 <indexterm role="concept">
55678 <primary>access control lists (ACLs)</primary>
55679 <secondary>variables</secondary>
55680 </indexterm>
55681 There are some special variables that can be set during ACL processing. They
55682 can be used to pass information between different ACLs, different invocations
55683 of the same ACL in the same SMTP connection, and between ACLs and the routers,
55684 transports, and filters that are used to deliver a message. The names of these
55685 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
55686 an underscore, but the remainder of the name can be any sequence of
55687 alphanumeric characters and underscores that you choose. There is no limit on
55688 the number of ACL variables. The two sets act as follows:
55689 </para>
55690 <itemizedlist>
55691 <listitem>
55692 <para>
55693 The values of those variables whose names begin with <varname>$acl_c</varname> persist
55694 throughout an SMTP connection. They are never reset. Thus, a value that is set
55695 while receiving one message is still available when receiving the next message
55696 on the same SMTP connection.
55697 </para>
55698 </listitem>
55699 <listitem>
55700 <para>
55701 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
55702 while a message is being received. They are reset afterwards. They are also
55703 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
55704 </para>
55705 </listitem>
55706 </itemizedlist>
55707 <para>
55708 When a message is accepted, the current values of all the ACL variables are
55709 preserved with the message and are subsequently made available at delivery
55710 time. The ACL variables are set by a modifier called <option>set</option>. For example:
55711 </para>
55712 <literallayout class="monospaced">
55713 accept hosts = whatever
55714        set acl_m4 = some value
55715 accept authenticated = *
55716        set acl_c_auth = yes
55717 </literallayout>
55718 <para>
55719 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
55720 be set. If you want to set a variable without taking any action, you can use a
55721 <option>warn</option> verb without any other modifiers or conditions.
55722 </para>
55723 <para>
55724 <indexterm role="option">
55725 <primary><option>strict_acl_vars</option></primary>
55726 </indexterm>
55727 What happens if a syntactically valid but undefined ACL variable is
55728 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
55729 false (the default), an empty string is substituted; if it is true, an
55730 error is generated.
55731 </para>
55732 <para>
55733 Versions of Exim before 4.64 have a limited set of numbered variables, but
55734 their names are compatible, so there is no problem with upgrading.
55735 </para>
55736 </section>
55737 <section id="SECTcondmodproc">
55738 <title>Condition and modifier processing</title>
55739 <para>
55740 <indexterm role="concept">
55741 <primary>access control lists (ACLs)</primary>
55742 <secondary>conditions; processing</secondary>
55743 </indexterm>
55744 <indexterm role="concept">
55745 <primary>access control lists (ACLs)</primary>
55746 <secondary>modifiers; processing</secondary>
55747 </indexterm>
55748 An exclamation mark preceding a condition negates its result. For example:
55749 </para>
55750 <literallayout class="monospaced">
55751 deny   domains = *.dom.example
55752       !verify  = recipient
55753 </literallayout>
55754 <para>
55755 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
55756 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
55757 negation can be used on the right-hand side of a condition. For example, these
55758 two statements are equivalent:
55759 </para>
55760 <literallayout class="monospaced">
55761 deny  hosts = !192.168.3.4
55762 deny !hosts =  192.168.3.4
55763 </literallayout>
55764 <para>
55765 However, for many conditions (<option>verify</option> being a good example), only left-hand
55766 side negation of the whole condition is possible.
55767 </para>
55768 <para>
55769 The arguments of conditions and modifiers are expanded. A forced failure
55770 of an expansion causes a condition to be ignored, that is, it behaves as if the
55771 condition is true. Consider these two statements:
55772 </para>
55773 <literallayout class="monospaced">
55774 accept  senders = ${lookup{$host_name}lsearch\
55775                   {/some/file}{$value}fail}
55776 accept  senders = ${lookup{$host_name}lsearch\
55777                   {/some/file}{$value}{}}
55778 </literallayout>
55779 <para>
55780 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
55781 the returned list is searched, but if the lookup fails the behaviour is
55782 different in the two cases. The <option>fail</option> in the first statement causes the
55783 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
55784 therefore succeeds. The second statement, however, generates an empty list when
55785 the lookup fails. No sender can match an empty list, so the condition fails,
55786 and therefore the <option>accept</option> also fails.
55787 </para>
55788 <para>
55789 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
55790 specify actions that are taken as the conditions for a statement are checked;
55791 others specify text for messages that are used when access is denied or a
55792 warning is generated. The <option>control</option> modifier affects the way an incoming
55793 message is handled.
55794 </para>
55795 <para>
55796 The positioning of the modifiers in an ACL statement is important, because the
55797 processing of a verb ceases as soon as its outcome is known. Only those
55798 modifiers that have already been encountered will take effect. For example,
55799 consider this use of the <option>message</option> modifier:
55800 </para>
55801 <literallayout class="monospaced">
55802 require message = Can't verify sender
55803         verify  = sender
55804         message = Can't verify recipient
55805         verify  = recipient
55806         message = This message cannot be used
55807 </literallayout>
55808 <para>
55809 If sender verification fails, Exim knows that the result of the statement is
55810 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
55811 so its text is used as the error message. If sender verification succeeds, but
55812 recipient verification fails, the second message is used. If recipient
55813 verification succeeds, the third message becomes <quote>current</quote>, but is never used
55814 because there are no more conditions to cause failure.
55815 </para>
55816 <para>
55817 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
55818 modifier that is used, because all the conditions must be true for rejection to
55819 happen. Specifying more than one <option>message</option> modifier does not make sense, and
55820 the message can even be specified after all the conditions. For example:
55821 </para>
55822 <literallayout class="monospaced">
55823 deny   hosts = ...
55824       !senders = *@my.domain.example
55825        message = Invalid sender from client host
55826 </literallayout>
55827 <para>
55828 The <quote>deny</quote> result does not happen until the end of the statement is reached,
55829 by which time Exim has set up the message.
55830 </para>
55831 </section>
55832 <section id="SECTACLmodi">
55833 <title>ACL modifiers</title>
55834 <para>
55835 <indexterm role="concept">
55836 <primary>access control lists (ACLs)</primary>
55837 <secondary>modifiers; list of</secondary>
55838 </indexterm>
55839 The ACL modifiers are as follows:
55840 </para>
55841 <variablelist>
55842 <varlistentry>
55843 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55844 <listitem>
55845 <para>
55846 This modifier specifies one or more header lines that are to be added to an
55847 incoming message, assuming, of course, that the message is ultimately
55848 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
55849 </para>
55850 </listitem></varlistentry>
55851 <varlistentry>
55852 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55853 <listitem>
55854 <para>
55855 <indexterm role="concept">
55856 <primary><option>continue</option> ACL modifier</primary>
55857 </indexterm>
55858 <indexterm role="concept">
55859 <primary>database</primary>
55860 <secondary>updating in ACL</secondary>
55861 </indexterm>
55862 This modifier does nothing of itself, and processing of the ACL always
55863 continues with the next condition or modifier. The value of <option>continue</option> is in
55864 the side effects of expanding its argument. Typically this could be used to
55865 update a database. It is really just a syntactic tidiness, to avoid having to
55866 write rather ugly lines like this:
55867 </para>
55868 <literallayout>
55869 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
55870 </literallayout>
55871 <para>
55872 Instead, all you need is
55873 </para>
55874 <literallayout>
55875 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
55876 </literallayout>
55877 </listitem></varlistentry>
55878 <varlistentry>
55879 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55880 <listitem>
55881 <para>
55882 <indexterm role="concept">
55883 <primary><option>control</option> ACL modifier</primary>
55884 </indexterm>
55885 This modifier affects the subsequent processing of the SMTP connection or of an
55886 incoming message that is accepted. The effect of the first type of control
55887 lasts for the duration of the connection, whereas the effect of the second type
55888 lasts only until the current message has been received. The message-specific
55889 controls always apply to the whole message, not to individual recipients,
55890 even if the <option>control</option> modifier appears in a RCPT ACL.
55891 </para>
55892 <para>
55893 As there are now quite a few controls that can be applied, they are described
55894 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
55895 in several different ways. For example:
55896 </para>
55897 <itemizedlist>
55898 <listitem>
55899 <para>
55900 It can be at the end of an <option>accept</option> statement:
55901 </para>
55902 <literallayout class="monospaced">
55903     accept  ...some conditions
55904             control = queue_only
55905 </literallayout>
55906 <para>
55907 In this case, the control is applied when this statement yields <quote>accept</quote>, in
55908 other words, when the conditions are all true.
55909 </para>
55910 </listitem>
55911 <listitem>
55912 <para>
55913 It can be in the middle of an <option>accept</option> statement:
55914 </para>
55915 <literallayout class="monospaced">
55916     accept  ...some conditions...
55917             control = queue_only
55918             ...some more conditions...
55919 </literallayout>
55920 <para>
55921 If the first set of conditions are true, the control is applied, even if the
55922 statement does not accept because one of the second set of conditions is false.
55923 In this case, some subsequent statement must yield <quote>accept</quote> for the control
55924 to be relevant.
55925 </para>
55926 </listitem>
55927 <listitem>
55928 <para>
55929 It can be used with <option>warn</option> to apply the control, leaving the
55930 decision about accepting or denying to a subsequent verb. For
55931 example:
55932 </para>
55933 <literallayout class="monospaced">
55934     warn    ...some conditions...
55935             control = freeze
55936     accept  ...
55937 </literallayout>
55938 <para>
55939 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
55940 <option>logwrite</option>, so it does not add anything to the message and does not write a
55941 log entry.
55942 </para>
55943 </listitem>
55944 <listitem>
55945 <para>
55946 If you want to apply a control unconditionally, you can use it with a
55947 <option>require</option> verb. For example:
55948 </para>
55949 <literallayout class="monospaced">
55950     require  control = no_multiline_responses
55951 </literallayout>
55952 </listitem>
55953 </itemizedlist>
55954 </listitem></varlistentry>
55955 <varlistentry>
55956 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
55957 <listitem>
55958 <para>
55959 <indexterm role="concept">
55960 <primary><option>delay</option> ACL modifier</primary>
55961 </indexterm>
55962 <indexterm role="option">
55963 <primary><option>-bh</option></primary>
55964 </indexterm>
55965 This modifier may appear in any ACL except notquit. It causes Exim to wait for
55966 the time interval before proceeding. However, when testing Exim using the
55967 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
55968 output instead). The time is given in the usual Exim notation, and the delay
55969 happens as soon as the modifier is processed. In an SMTP session, pending
55970 output is flushed before the delay is imposed.
55971 </para>
55972 <para>
55973 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
55974 example:
55975 </para>
55976 <literallayout class="monospaced">
55977 deny    ...some conditions...
55978         delay = 30s
55979 </literallayout>
55980 <para>
55981 The delay happens if all the conditions are true, before the statement returns
55982 <quote>deny</quote>. Compare this with:
55983 </para>
55984 <literallayout class="monospaced">
55985 deny    delay = 30s
55986         ...some conditions...
55987 </literallayout>
55988 <para>
55989 which waits for 30s before processing the conditions. The <option>delay</option> modifier
55990 can also be used with <option>warn</option> and together with <option>control</option>:
55991 </para>
55992 <literallayout class="monospaced">
55993 warn    ...some conditions...
55994         delay = 2m
55995         control = freeze
55996 accept  ...
55997 </literallayout>
55998 <para>
55999 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
56000 responses to several commands are no longer buffered and sent in one packet (as
56001 they would normally be) because all output is flushed before imposing the
56002 delay. This optimization is disabled so that a number of small delays do not
56003 appear to the client as one large aggregated delay that might provoke an
56004 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
56005 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
56006 </para>
56007 </listitem></varlistentry>
56008 <varlistentry>
56009 <term><emphasis role="bold">endpass</emphasis></term>
56010 <listitem>
56011 <para>
56012 <indexterm role="concept">
56013 <primary><option>endpass</option> ACL modifier</primary>
56014 </indexterm>
56015 This modifier, which has no argument, is recognized only in <option>accept</option> and
56016 <option>discard</option> statements. It marks the boundary between the conditions whose
56017 failure causes control to pass to the next statement, and the conditions whose
56018 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
56019 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
56020 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
56021 </para>
56022 </listitem></varlistentry>
56023 <varlistentry>
56024 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56025 <listitem>
56026 <para>
56027 <indexterm role="concept">
56028 <primary><option>log_message</option> ACL modifier</primary>
56029 </indexterm>
56030 This modifier sets up a message that is used as part of the log message if the
56031 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
56032 </para>
56033 <literallayout class="monospaced">
56034 require log_message = wrong cipher suite $tls_in_cipher
56035         encrypted   = DES-CBC3-SHA
56036 </literallayout>
56037 <para>
56038 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
56039 example:
56040 </para>
56041 <literallayout>
56042 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
56043 <literal>        log_message = Discarded $local_part@$domain because...</literal>
56044 </literallayout>
56045 <para>
56046 When access is denied, <option>log_message</option> adds to any underlying error message
56047 that may exist because of a condition failure. For example, while verifying a
56048 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
56049 message.
56050 </para>
56051 <para>
56052 The message may be defined before the conditions to which it applies, because
56053 the string expansion does not happen until Exim decides that access is to be
56054 denied. This means that any variables that are set by the condition are
56055 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
56056 variables are set after a DNS black list lookup succeeds. If the expansion of
56057 <option>log_message</option> fails, or if the result is an empty string, the modifier is
56058 ignored.
56059 </para>
56060 <para>
56061 <indexterm role="variable">
56062 <primary><varname>$acl_verify_message</varname></primary>
56063 </indexterm>
56064 If you want to use a <option>warn</option> statement to log the result of an address
56065 verification, you can use <varname>$acl_verify_message</varname> to include the verification
56066 error message.
56067 </para>
56068 <para>
56069 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
56070 the start of the logged message. If the same warning log message is requested
56071 more than once while receiving  a single email message, only one copy is
56072 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
56073 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
56074 is logged for a successful <option>warn</option> statement.
56075 </para>
56076 <para>
56077 If <option>log_message</option> is not present and there is no underlying error message (for
56078 example, from the failure of address verification), but <option>message</option> is present,
56079 the <option>message</option> text is used for logging rejections. However, if any text for
56080 logging contains newlines, only the first line is logged. In the absence of
56081 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
56082 logging rejections.
56083 </para>
56084 </listitem></varlistentry>
56085 <varlistentry>
56086 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
56087 <listitem>
56088 <para>
56089 <indexterm role="concept">
56090 <primary><option>log_reject_target</option> ACL modifier</primary>
56091 </indexterm>
56092 <indexterm role="concept">
56093 <primary>logging in ACL</primary>
56094 <secondary>specifying which log</secondary>
56095 </indexterm>
56096 This modifier makes it possible to specify which logs are used for messages
56097 about ACL rejections. Its argument is a colon-separated list of words that can
56098 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
56099 may be empty, in which case a rejection is not logged at all. For example, this
56100 ACL fragment writes no logging information when access is denied:
56101 </para>
56102 <literallayout>
56103 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
56104 <literal>     log_reject_target =</literal>
56105 </literallayout>
56106 <para>
56107 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
56108 permanent and temporary rejections. Its effect lasts for the rest of the
56109 current ACL.
56110 </para>
56111 </listitem></varlistentry>
56112 <varlistentry>
56113 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56114 <listitem>
56115 <para>
56116 <indexterm role="concept">
56117 <primary><option>logwrite</option> ACL modifier</primary>
56118 </indexterm>
56119 <indexterm role="concept">
56120 <primary>logging in ACL</primary>
56121 <secondary>immediate</secondary>
56122 </indexterm>
56123 This modifier writes a message to a log file as soon as it is encountered when
56124 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
56125 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
56126 access.) The <option>logwrite</option> modifier can be used to log special incidents in
56127 ACLs. For example:
56128 </para>
56129 <literallayout>
56130 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
56131 <literal>       control  = freeze</literal>
56132 <literal>       logwrite = froze message because ...</literal>
56133 </literallayout>
56134 <para>
56135 By default, the message is written to the main log. However, it may begin
56136 with a colon, followed by a comma-separated list of log names, and then
56137 another colon, to specify exactly which logs are to be written. For
56138 example:
56139 </para>
56140 <literallayout class="monospaced">
56141 logwrite = :main,reject: text for main and reject logs
56142 logwrite = :panic: text for panic log only
56143 </literallayout>
56144 </listitem></varlistentry>
56145 <varlistentry>
56146 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56147 <listitem>
56148 <para>
56149 <indexterm role="concept">
56150 <primary><option>message</option> ACL modifier</primary>
56151 </indexterm>
56152 This modifier sets up a text string that is expanded and used as a response
56153 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
56154 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
56155 there is some complication if <option>endpass</option> is involved; see the description of
56156 <option>accept</option> for details.)
56157 </para>
56158 <para>
56159 The expansion of the message happens at the time Exim decides that the ACL is
56160 to end, not at the time it processes <option>message</option>. If the expansion fails, or
56161 generates an empty string, the modifier is ignored. Here is an example where
56162 <option>message</option> must be specified first, because the ACL ends with a rejection if
56163 the <option>hosts</option> condition fails:
56164 </para>
56165 <literallayout class="monospaced">
56166 require  message = Host not recognized
56167          hosts = 10.0.0.0/8
56168 </literallayout>
56169 <para>
56170 (Once a condition has failed, no further conditions or modifiers are
56171 processed.)
56172 </para>
56173 <para>
56174 <indexterm role="concept">
56175 <primary>SMTP</primary>
56176 <secondary>error codes</secondary>
56177 </indexterm>
56178 <indexterm role="option">
56179 <primary><option>smtp_banner</option></primary>
56180 </indexterm>
56181 For ACLs that are triggered by SMTP commands, the message is returned as part
56182 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
56183 is meaningful only for SMTP, as no message is returned when a non-SMTP message
56184 is accepted. In the case of the connect ACL, accepting with a message modifier
56185 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
56186 accept message may not contain more than one line (otherwise it will be
56187 truncated at the first newline and a panic logged), and it cannot affect the
56188 EHLO options.
56189 </para>
56190 <para>
56191 When SMTP is involved, the message may begin with an overriding response code,
56192 consisting of three digits optionally followed by an <quote>extended response code</quote>
56193 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
56194 </para>
56195 <literallayout class="monospaced">
56196 deny  message = 599 1.2.3 Host not welcome
56197       hosts = 192.168.34.0/24
56198 </literallayout>
56199 <para>
56200 The first digit of the supplied response code must be the same as would be sent
56201 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
56202 access, but for the predata ACL, note that the default success code is 354, not
56203 2<emphasis>xx</emphasis>.
56204 </para>
56205 <para>
56206 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
56207 the message modifier cannot override the 221 response code.
56208 </para>
56209 <para>
56210 The text in a <option>message</option> modifier is literal; any quotes are taken as
56211 literals, but because the string is expanded, backslash escapes are processed
56212 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
56213 response.
56214 </para>
56215 <para>
56216 <indexterm role="variable">
56217 <primary><varname>$acl_verify_message</varname></primary>
56218 </indexterm>
56219 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
56220 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
56221 </para>
56222 <para>
56223 If <option>message</option> is used on a statement that verifies an address, the message
56224 specified overrides any message that is generated by the verification process.
56225 However, the original message is available in the variable
56226 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
56227 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
56228 routers to be passed back as part of the SMTP response, you should either not
56229 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
56230 </para>
56231 <para>
56232 For compatibility with previous releases of Exim, a <option>message</option> modifier that
56233 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
56234 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
56235 all the conditions are true, wherever it appears in an ACL command, whereas
56236 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
56237 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
56238 effect.
56239 </para>
56240 </listitem></varlistentry>
56241 <varlistentry>
56242 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56243 <listitem>
56244 <para>
56245 <indexterm role="concept">
56246 <primary><option>queue</option> ACL modifier</primary>
56247 </indexterm>
56248 <indexterm role="concept">
56249 <primary>named queues</primary>
56250 <secondary>selecting in ACL</secondary>
56251 </indexterm>
56252 This modifier specifies the use of a named queue for spool files
56253 for the message.
56254 It can only be used before the message is received (i.e. not in
56255 the DATA ACL).
56256 This could be used, for example, for known high-volume burst sources
56257 of traffic, or for quarantine of messages.
56258 Separate queue-runner processes will be needed for named queues.
56259 If the text after expansion is empty, the default queue is used.
56260 </para>
56261 </listitem></varlistentry>
56262 <varlistentry>
56263 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56264 <listitem>
56265 <para>
56266 This modifier specifies one or more header names in a colon-separated list
56267  that are to be removed from an incoming message, assuming, of course, that
56268 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
56269 </para>
56270 </listitem></varlistentry>
56271 <varlistentry>
56272 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
56273 <listitem>
56274 <para>
56275 <indexterm role="concept">
56276 <primary><option>set</option> ACL modifier</primary>
56277 </indexterm>
56278 This modifier puts a value into one of the ACL variables (see section
56279 <xref linkend="SECTaclvariables"/>).
56280 </para>
56281 </listitem></varlistentry>
56282 <varlistentry>
56283 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
56284 <listitem>
56285 <para>
56286 <indexterm role="concept">
56287 <primary>UDP communications</primary>
56288 </indexterm>
56289 This modifier sends a UDP packet, for purposes such as statistics
56290 collection or behaviour monitoring. The parameters are expanded, and
56291 the result of the expansion must be a colon-separated list consisting
56292 of a destination server, port number, and the packet contents. The
56293 server can be specified as a host name or IPv4 or IPv6 address. The
56294 separator can be changed with the usual angle bracket syntax. For
56295 example, you might want to collect information on which hosts connect
56296 when:
56297 </para>
56298 <literallayout class="monospaced">
56299 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
56300              $tod_zulu $sender_host_address
56301 </literallayout>
56302 </listitem></varlistentry>
56303 </variablelist>
56304 </section>
56305 <section id="SECTcontrols">
56306 <title>Use of the control modifier</title>
56307 <para>
56308 <indexterm role="concept">
56309 <primary><option>control</option> ACL modifier</primary>
56310 </indexterm>
56311 The <option>control</option> modifier supports the following settings:
56312 </para>
56313 <variablelist>
56314 <varlistentry>
56315 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
56316 <listitem>
56317 <para>
56318 This modifier allows a client host to use the SMTP AUTH command even when it
56319 has not been advertised in response to EHLO. Furthermore, because there are
56320 apparently some really broken clients that do this, Exim will accept AUTH after
56321 HELO (rather than EHLO) when this control is set. It should be used only if you
56322 really need it, and you should limit its use to those broken clients that do
56323 not work without it. For example:
56324 </para>
56325 <literallayout class="monospaced">
56326 warn hosts   = 192.168.34.25
56327      control = allow_auth_unadvertised
56328 </literallayout>
56329 <para>
56330 Normally, when an Exim server receives an AUTH command, it checks the name of
56331 the authentication mechanism that is given in the command to ensure that it
56332 matches an advertised mechanism. When this control is set, the check that a
56333 mechanism has been advertised is bypassed. Any configured mechanism can be used
56334 by the client. This control is permitted only in the connection and HELO ACLs.
56335 </para>
56336 </listitem></varlistentry>
56337 <varlistentry>
56338 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
56339 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
56340 <listitem>
56341 <para>
56342 <indexterm role="concept">
56343 <primary>access control lists (ACLs)</primary>
56344 <secondary>case of local part in</secondary>
56345 </indexterm>
56346 <indexterm role="concept">
56347 <primary>case of local parts</primary>
56348 </indexterm>
56349 <indexterm role="variable">
56350 <primary><varname>$local_part</varname></primary>
56351 </indexterm>
56352 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
56353 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
56354 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
56355 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
56356 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
56357 is encountered.
56358 </para>
56359 <para>
56360 These controls affect only the current recipient. Moreover, they apply only to
56361 local part handling that takes place directly in the ACL (for example, as a key
56362 in lookups). If a test to verify the recipient is obeyed, the case-related
56363 handling of the local part during the verification is controlled by the router
56364 configuration (see the <option>caseful_local_part</option> generic router option).
56365 </para>
56366 <para>
56367 This facility could be used, for example, to add a spam score to local parts
56368 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
56369 spam score:
56370 </para>
56371 <literallayout class="monospaced">
56372 warn  control = caseful_local_part
56373       set acl_m4 = ${eval:\
56374                      $acl_m4 + \
56375                      ${if match{$local_part}{[A-Z]}{1}{0}}\
56376                     }
56377       control = caselower_local_part
56378 </literallayout>
56379 <para>
56380 Notice that we put back the lower cased version afterwards, assuming that
56381 is what is wanted for subsequent tests.
56382 </para>
56383 </listitem></varlistentry>
56384 <varlistentry>
56385 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56386 <listitem>
56387 <para>
56388 <indexterm role="concept">
56389 <primary>access control lists (ACLs)</primary>
56390 <secondary>cutthrough routing</secondary>
56391 </indexterm>
56392 <indexterm role="concept">
56393 <primary>cutthrough</primary>
56394 <secondary>requesting</secondary>
56395 </indexterm>
56396 This option requests delivery be attempted while the item is being received.
56397 </para>
56398 <para>
56399 The option is usable in the RCPT ACL.
56400 If enabled for a message received via smtp and routed to an smtp transport,
56401 and only one transport, interface, destination host and port combination
56402 is used for all recipients of the message,
56403 then the delivery connection is made while the receiving connection is open
56404 and data is copied from one to the other.
56405 </para>
56406 <para>
56407 An attempt to set this option for any recipient but the first
56408 for a mail will be quietly ignored.
56409 If a recipient-verify callout
56410 (with use_sender)
56411 connection is subsequently
56412 requested in the same ACL it is held open and used for
56413 any subsequent recipients and the data,
56414 otherwise one is made after the initial RCPT ACL completes.
56415 </para>
56416 <para>
56417 Note that routers are used in verify mode,
56418 and cannot depend on content of received headers.
56419 Note also that headers cannot be
56420 modified by any of the post-data ACLs (DATA, MIME and DKIM).
56421 Headers may be modified by routers (subject to the above) and transports.
56422 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
56423 rather than the traditional time after the full message is received;
56424 this will affect the timestamp.
56425 </para>
56426 <para>
56427 All the usual ACLs are called; if one results in the message being
56428 rejected, all effort spent in delivery (including the costs on
56429 the ultimate destination) will be wasted.
56430 Note that in the case of data-time ACLs this includes the entire
56431 message body.
56432 </para>
56433 <para>
56434 Cutthrough delivery is not supported via transport-filters or when DKIM signing
56435 of outgoing messages is done, because it sends data to the ultimate destination
56436 before the entire message has been received from the source.
56437 It is not supported for messages received with the SMTP PRDR
56438 or CHUNKING
56439 options in use.
56440 </para>
56441 <para>
56442 Should the ultimate destination system positively accept or reject the mail,
56443 a corresponding indication is given to the source system and nothing is queued.
56444 If the item is successfully delivered in cutthrough mode
56445 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
56446 before the acceptance "&lt;=" line.
56447 </para>
56448 <para>
56449 If there is a temporary error the item is queued for later delivery in the
56450 usual fashion.
56451 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
56452 to the control; the default value is <quote>spool</quote> and the alternate value
56453 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
56454 and does not queue the message.
56455 Note that this is independent of any recipient verify conditions in the ACL.
56456 </para>
56457 <para>
56458 Delivery in this mode avoids the generation of a bounce mail to a
56459 (possibly faked)
56460 sender when the destination system is doing content-scan based rejection.
56461 </para>
56462 </listitem></varlistentry>
56463 <varlistentry>
56464 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56465 <listitem>
56466 <para>
56467 <indexterm role="concept">
56468 <primary>access control lists (ACLs)</primary>
56469 <secondary>enabling debug logging</secondary>
56470 </indexterm>
56471 <indexterm role="concept">
56472 <primary>debugging</primary>
56473 <secondary>enabling from an ACL</secondary>
56474 </indexterm>
56475 This control turns on debug logging, almost as though Exim had been invoked
56476 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
56477 by default called <emphasis>debuglog</emphasis>.
56478 The filename can be adjusted with the <emphasis>tag</emphasis> option, which
56479 may access any variables already defined.  The logging may be adjusted with
56480 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
56481 option.
56482 Logging started this way may be stopped, and the file removed,
56483 with the <emphasis>kill</emphasis> option.
56484 Some examples (which depend on variables that don&#x2019;t exist in all
56485 contexts):
56486 </para>
56487 <literallayout class="monospaced">
56488       control = debug
56489       control = debug/tag=.$sender_host_address
56490       control = debug/opts=+expand+acl
56491       control = debug/tag=.$message_exim_id/opts=+expand
56492       control = debug/kill
56493 </literallayout>
56494 </listitem></varlistentry>
56495 <varlistentry>
56496 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
56497 <listitem>
56498 <para>
56499 <indexterm role="concept">
56500 <primary>disable DKIM verify</primary>
56501 </indexterm>
56502 <indexterm role="concept">
56503 <primary>DKIM</primary>
56504 <secondary>disable verify</secondary>
56505 </indexterm>
56506 This control turns off DKIM verification processing entirely.  For details on
56507 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
56508 </para>
56509 </listitem></varlistentry>
56510 <varlistentry>
56511 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
56512 <listitem>
56513 <para>
56514 <indexterm role="concept">
56515 <primary>access control lists (ACLs)</primary>
56516 <secondary>setting DSCP value</secondary>
56517 </indexterm>
56518 <indexterm role="concept">
56519 <primary>DSCP</primary>
56520 <secondary>inbound</secondary>
56521 </indexterm>
56522 This option causes the DSCP value associated with the socket for the inbound
56523 connection to be adjusted to a given value, given as one of a number of fixed
56524 strings or to numeric value.
56525 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
56526 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
56527 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
56528 </para>
56529 <para>
56530 The outbound packets from Exim will be marked with this value in the header
56531 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
56532 that these values will have any effect, not be stripped by networking
56533 equipment, or do much of anything without cooperation with your Network
56534 Engineer and those of all network operators between the source and destination.
56535 </para>
56536 </listitem></varlistentry>
56537 <varlistentry>
56538 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
56539 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
56540 <listitem>
56541 <para>
56542 <indexterm role="concept">
56543 <primary>SMTP</primary>
56544 <secondary>synchronization checking</secondary>
56545 </indexterm>
56546 <indexterm role="concept">
56547 <primary>synchronization checking in SMTP</primary>
56548 </indexterm>
56549 These controls make it possible to be selective about when SMTP synchronization
56550 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
56551 state of the switch (it is true by default). See the description of this option
56552 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
56553 </para>
56554 <para>
56555 The effect of these two controls lasts for the remainder of the SMTP
56556 connection. They can appear in any ACL except the one for the non-SMTP
56557 messages. The most straightforward place to put them is in the ACL defined by
56558 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
56559 before the first synchronization check. The expected use is to turn off the
56560 synchronization checks for badly-behaved hosts that you nevertheless need to
56561 work with.
56562 </para>
56563 </listitem></varlistentry>
56564 <varlistentry>
56565 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
56566 <listitem>
56567 <para>
56568 <indexterm role="concept">
56569 <primary>fake defer</primary>
56570 </indexterm>
56571 <indexterm role="concept">
56572 <primary>defer, fake</primary>
56573 </indexterm>
56574 This control works in exactly the same way as <option>fakereject</option> (described below)
56575 except that it causes an SMTP 450 response after the message data instead of a
56576 550 response. You must take care when using <option>fakedefer</option> because it causes the
56577 messages to be duplicated when the sender retries. Therefore, you should not
56578 use <option>fakedefer</option> if the message is to be delivered normally.
56579 </para>
56580 </listitem></varlistentry>
56581 <varlistentry>
56582 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
56583 <listitem>
56584 <para>
56585 <indexterm role="concept">
56586 <primary>fake rejection</primary>
56587 </indexterm>
56588 <indexterm role="concept">
56589 <primary>rejection, fake</primary>
56590 </indexterm>
56591 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
56592 words, only when an SMTP message is being received. If Exim accepts the
56593 message, instead the final 250 response, a 550 rejection message is sent.
56594 However, Exim proceeds to deliver the message as normal. The control applies
56595 only to the current message, not to any subsequent ones that may be received in
56596 the same SMTP connection.
56597 </para>
56598 <para>
56599 The text for the 550 response is taken from the <option>control</option> modifier. If no
56600 message is supplied, the following is used:
56601 </para>
56602 <literallayout class="monospaced">
56603 550-Your message has been rejected but is being
56604 550-kept for evaluation.
56605 550-If it was a legitimate message, it may still be
56606 550 delivered to the target recipient(s).
56607 </literallayout>
56608 <para>
56609 This facility should be used with extreme caution.
56610 </para>
56611 </listitem></varlistentry>
56612 <varlistentry>
56613 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
56614 <listitem>
56615 <para>
56616 <indexterm role="concept">
56617 <primary>frozen messages</primary>
56618 <secondary>forcing in ACL</secondary>
56619 </indexterm>
56620 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
56621 other words, only when a message is being received. If the message is accepted,
56622 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
56623 current message, not to any subsequent ones that may be received in the same
56624 SMTP connection.
56625 </para>
56626 <para>
56627 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
56628 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
56629 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
56630 are obeyed for the current message have the <literal>/no_tell</literal> option.
56631 </para>
56632 </listitem></varlistentry>
56633 <varlistentry>
56634 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
56635 <listitem>
56636 <para>
56637 <indexterm role="concept">
56638 <primary>SMTP</primary>
56639 <secondary>output flushing, disabling for delay</secondary>
56640 </indexterm>
56641 Exim normally flushes SMTP output before implementing a delay in an ACL, to
56642 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
56643 use. This control, as long as it is encountered before the <option>delay</option> modifier,
56644 disables such output flushing.
56645 </para>
56646 </listitem></varlistentry>
56647 <varlistentry>
56648 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
56649 <listitem>
56650 <para>
56651 <indexterm role="concept">
56652 <primary>SMTP</primary>
56653 <secondary>output flushing, disabling for callout</secondary>
56654 </indexterm>
56655 Exim normally flushes SMTP output before performing a callout in an ACL, to
56656 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
56657 use. This control, as long as it is encountered before the <option>verify</option> condition
56658 that causes the callout, disables such output flushing.
56659 </para>
56660 </listitem></varlistentry>
56661 <varlistentry>
56662 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
56663 <listitem>
56664 <para>
56665 This control is available when Exim is compiled with the content scanning
56666 extension. Content scanning may require a copy of the current message, or parts
56667 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
56668 or spam scanner. Normally, such copies are deleted when they are no longer
56669 needed. If this control is set, the copies are not deleted. The control applies
56670 only to the current message, not to any subsequent ones that may be received in
56671 the same SMTP connection. It is provided for debugging purposes and is unlikely
56672 to be useful in production.
56673 </para>
56674 </listitem></varlistentry>
56675 <varlistentry>
56676 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
56677 <listitem>
56678 <para>
56679 <indexterm role="concept">
56680 <primary>multiline responses, suppressing</primary>
56681 </indexterm>
56682 This control is permitted for any ACL except the one for non-SMTP messages.
56683 It seems that there are broken clients in use that cannot handle multiline
56684 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
56685 </para>
56686 <para>
56687 If this control is set, multiline SMTP responses from ACL rejections are
56688 suppressed. One way of doing this would have been to put out these responses as
56689 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
56690 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
56691 responses might get close to that. So this facility, which is after all only a
56692 sop to broken clients, is implemented by doing two very easy things:
56693 </para>
56694 <itemizedlist>
56695 <listitem>
56696 <para>
56697 Extra information that is normally output as part of a rejection caused by
56698 sender verification failure is omitted. Only the final line (typically <quote>sender
56699 verification failed</quote>) is sent.
56700 </para>
56701 </listitem>
56702 <listitem>
56703 <para>
56704 If a <option>message</option> modifier supplies a multiline response, only the first
56705 line is output.
56706 </para>
56707 </listitem>
56708 </itemizedlist>
56709 <para>
56710 The setting of the switch can, of course, be made conditional on the
56711 calling host. Its effect lasts until the end of the SMTP connection.
56712 </para>
56713 </listitem></varlistentry>
56714 <varlistentry>
56715 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
56716 <listitem>
56717 <para>
56718 <indexterm role="concept">
56719 <primary>PIPELINING</primary>
56720 <secondary>suppressing advertising</secondary>
56721 </indexterm>
56722 This control turns off the advertising of the PIPELINING extension to SMTP in
56723 the current session. To be useful, it must be obeyed before Exim sends its
56724 response to an EHLO command. Therefore, it should normally appear in an ACL
56725 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
56726 <option>pipelining_advertise_hosts</option>.
56727 </para>
56728 </listitem></varlistentry>
56729 <varlistentry>
56730 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
56731 <listitem>
56732 <para>
56733 <indexterm role="option">
56734 <primary><option>queue_only</option></primary>
56735 </indexterm>
56736 <indexterm role="concept">
56737 <primary>queueing incoming messages</primary>
56738 </indexterm>
56739 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
56740 other words, only when a message is being received. If the message is accepted,
56741 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
56742 runner. No immediate delivery process is started. In other words, it has the
56743 effect as the <option>queue_only</option> global option. However, the control applies only
56744 to the current message, not to any subsequent ones that may be received in the
56745 same SMTP connection.
56746 </para>
56747 </listitem></varlistentry>
56748 <varlistentry>
56749 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56750 <listitem>
56751 <para>
56752 <indexterm role="concept">
56753 <primary>message</primary>
56754 <secondary>submission</secondary>
56755 </indexterm>
56756 <indexterm role="concept">
56757 <primary>submission mode</primary>
56758 </indexterm>
56759 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
56760 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
56761 the current message is a submission from a local MUA. In this case, Exim
56762 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
56763 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
56764 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
56765 late (the message has already been created).
56766 </para>
56767 <para>
56768 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
56769 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
56770 submission mode; the available options for this control are described there.
56771 The control applies only to the current message, not to any subsequent ones
56772 that may be received in the same SMTP connection.
56773 </para>
56774 </listitem></varlistentry>
56775 <varlistentry>
56776 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
56777 <listitem>
56778 <para>
56779 <indexterm role="concept">
56780 <primary>submission fixups, suppressing</primary>
56781 </indexterm>
56782 This control applies to locally submitted (non TCP/IP) messages, and is the
56783 complement of <literal>control = submission</literal>. It disables the fixups that are
56784 normally applied to locally-submitted messages. Specifically:
56785 </para>
56786 <itemizedlist>
56787 <listitem>
56788 <para>
56789 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
56790 dynamic version of <option>local_sender_retain</option>).
56791 </para>
56792 </listitem>
56793 <listitem>
56794 <para>
56795 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
56796 </para>
56797 </listitem>
56798 <listitem>
56799 <para>
56800 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
56801 </para>
56802 </listitem>
56803 </itemizedlist>
56804 <para>
56805 This control may be useful when a remotely-originated message is accepted,
56806 passed to some scanning program, and then re-submitted for delivery. It can be
56807 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
56808 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
56809 data is read.
56810 </para>
56811 <para>
56812 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
56813 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
56814 </para>
56815 </listitem></varlistentry>
56816 <varlistentry>
56817 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
56818 <listitem>
56819 <para>
56820 This control enables conversion of UTF-8 in message addresses
56821 to a-label form.
56822 For details see section <xref linkend="SECTi18nMTA"/>.
56823 </para>
56824 </listitem></varlistentry>
56825 </variablelist>
56826 </section>
56827 <section id="SECTsummesfix">
56828 <title>Summary of message fixup control</title>
56829 <para>
56830 All four possibilities for message fixups can be specified:
56831 </para>
56832 <itemizedlist>
56833 <listitem>
56834 <para>
56835 Locally submitted, fixups applied: the default.
56836 </para>
56837 </listitem>
56838 <listitem>
56839 <para>
56840 Locally submitted, no fixups applied: use
56841 <literal>control = suppress_local_fixups</literal>.
56842 </para>
56843 </listitem>
56844 <listitem>
56845 <para>
56846 Remotely submitted, no fixups applied: the default.
56847 </para>
56848 </listitem>
56849 <listitem>
56850 <para>
56851 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
56852 </para>
56853 </listitem>
56854 </itemizedlist>
56855 </section>
56856 <section id="SECTaddheadacl">
56857 <title>Adding header lines in ACLs</title>
56858 <para>
56859 <indexterm role="concept">
56860 <primary>header lines</primary>
56861 <secondary>adding in an ACL</secondary>
56862 </indexterm>
56863 <indexterm role="concept">
56864 <primary>header lines</primary>
56865 <secondary>position of added lines</secondary>
56866 </indexterm>
56867 <indexterm role="concept">
56868 <primary><option>add_header</option> ACL modifier</primary>
56869 </indexterm>
56870 The <option>add_header</option> modifier can be used to add one or more extra header lines
56871 to an incoming message, as in this example:
56872 </para>
56873 <literallayout class="monospaced">
56874 warn dnslists = sbl.spamhaus.org : \
56875                 dialup.mail-abuse.org
56876      add_header = X-blacklisted-at: $dnslist_domain
56877 </literallayout>
56878 <para>
56879 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
56880 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
56881 receiving a message). The message must ultimately be accepted for
56882 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
56883 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
56884 RCPT ACL).
56885 </para>
56886 <para>
56887 Headers will not be added to the message if the modifier is used in
56888 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
56889 </para>
56890 <para>
56891 Leading and trailing newlines are removed from
56892 the data for the <option>add_header</option> modifier; if it then
56893 contains one or more newlines that
56894 are not followed by a space or a tab, it is assumed to contain multiple header
56895 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
56896 front of any line that is not a valid header line.
56897 </para>
56898 <para>
56899 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
56900 They are added to the message before processing the DATA and MIME ACLs.
56901 However, if an identical header line is requested more than once, only one copy
56902 is actually added to the message. Further header lines may be accumulated
56903 during the DATA and MIME ACLs, after which they are added to the message, again
56904 with duplicates suppressed. Thus, it is possible to add two identical header
56905 lines to an SMTP message, but only if one is added before DATA and one after.
56906 In the case of non-SMTP messages, new headers are accumulated during the
56907 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
56908 message is rejected after DATA or by the non-SMTP ACL, all added header lines
56909 are included in the entry that is written to the reject log.
56910 </para>
56911 <para>
56912 <indexterm role="concept">
56913 <primary>header lines</primary>
56914 <secondary>added; visibility of</secondary>
56915 </indexterm>
56916 Header lines are not visible in string expansions
56917 of message headers
56918 until they are added to the
56919 message. It follows that header lines defined in the MAIL, RCPT, and predata
56920 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
56921 header lines that are added by the DATA or MIME ACLs are not visible in those
56922 ACLs. Because of this restriction, you cannot use header lines as a way of
56923 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
56924 this, you can use ACL variables, as described in section
56925 <xref linkend="SECTaclvariables"/>.
56926 </para>
56927 <para>
56928 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
56929 </para>
56930 <para>
56931 The <option>add_header</option> modifier acts immediately as it is encountered during the
56932 processing of an ACL. Notice the difference between these two cases:
56933 </para>
56934 <literallayout>
56935 <literal>accept add_header = ADDED: some text</literal>
56936 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
56937
56938 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
56939 <literal>       add_header = ADDED: some text</literal>
56940 </literallayout>
56941 <para>
56942 In the first case, the header line is always added, whether or not the
56943 condition is true. In the second case, the header line is added only if the
56944 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
56945 ACL statement. All those that are encountered before a condition fails are
56946 honoured.
56947 </para>
56948 <para>
56949 <indexterm role="concept">
56950 <primary><option>warn</option> ACL verb</primary>
56951 </indexterm>
56952 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
56953 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
56954 effect only if all the conditions are true, even if it appears before some of
56955 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
56956 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
56957 are present on a <option>warn</option> verb, both are processed according to their
56958 specifications.
56959 </para>
56960 <para>
56961 By default, new header lines are added to a message at the end of the existing
56962 header lines. However, you can specify that any particular header line should
56963 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
56964 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
56965 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
56966 </para>
56967 <para>
56968 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
56969 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
56970 header line, respectively. (Header text cannot start with a colon, as there has
56971 to be a header name first.) For example:
56972 </para>
56973 <literallayout class="monospaced">
56974 warn add_header = \
56975        :after_received:X-My-Header: something or other...
56976 </literallayout>
56977 <para>
56978 If more than one header line is supplied in a single <option>add_header</option> modifier,
56979 each one is treated independently and can therefore be placed differently. If
56980 you add more than one line at the start, or after the Received: block, they end
56981 up in reverse order.
56982 </para>
56983 <para>
56984 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
56985 added in an ACL. It does NOT work for header lines that are added in a
56986 system filter or in a router or transport.
56987 </para>
56988 </section>
56989 <section id="SECTremoveheadacl">
56990 <title>Removing header lines in ACLs</title>
56991 <para>
56992 <indexterm role="concept">
56993 <primary>header lines</primary>
56994 <secondary>removing in an ACL</secondary>
56995 </indexterm>
56996 <indexterm role="concept">
56997 <primary>header lines</primary>
56998 <secondary>position of removed lines</secondary>
56999 </indexterm>
57000 <indexterm role="concept">
57001 <primary><option>remove_header</option> ACL modifier</primary>
57002 </indexterm>
57003 The <option>remove_header</option> modifier can be used to remove one or more header lines
57004 from an incoming message, as in this example:
57005 </para>
57006 <literallayout class="monospaced">
57007 warn   message        = Remove internal headers
57008        remove_header  = x-route-mail1 : x-route-mail2
57009 </literallayout>
57010 <para>
57011 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
57012 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
57013 receiving a message). The message must ultimately be accepted for
57014 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
57015 with any ACL verb, including <option>deny</option>, though this is really not useful for
57016 any verb that doesn&#x2019;t result in a delivered message.
57017 </para>
57018 <para>
57019 Headers will not be removed from the message if the modifier is used in
57020 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
57021 </para>
57022 <para>
57023 More than one header can be removed at the same time by using a colon separated
57024 list of header names. The header matching is case insensitive. Wildcards are
57025 not permitted, nor is list expansion performed, so you cannot use hostlists to
57026 create a list of headers, however both connection and message variable expansion
57027 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
57028 </para>
57029 <literallayout class="monospaced">
57030 warn   hosts           = +internal_hosts
57031        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
57032 warn   message         = Remove internal headers
57033        remove_header   = $acl_c_ihdrs
57034 </literallayout>
57035 <para>
57036 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
57037 They are removed from the message before processing the DATA and MIME ACLs.
57038 There is no harm in attempting to remove the same header twice nor is removing
57039 a non-existent header. Further header lines to be removed may be accumulated
57040 during the DATA and MIME ACLs, after which they are removed from the message,
57041 if present. In the case of non-SMTP messages, headers to be removed are
57042 accumulated during the non-SMTP ACLs, and are removed from the message after
57043 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
57044 ACL, there really is no effect because there is no logging of what headers
57045 would have been removed.
57046 </para>
57047 <para>
57048 <indexterm role="concept">
57049 <primary>header lines</primary>
57050 <secondary>removed; visibility of</secondary>
57051 </indexterm>
57052 Header lines are not visible in string expansions until the DATA phase when it
57053 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
57054 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
57055 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
57056 this restriction, you cannot use header lines as a way of controlling data
57057 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
57058 you should instead use ACL variables, as described in section
57059 <xref linkend="SECTaclvariables"/>.
57060 </para>
57061 <para>
57062 The <option>remove_header</option> modifier acts immediately as it is encountered during the
57063 processing of an ACL. Notice the difference between these two cases:
57064 </para>
57065 <literallayout>
57066 <literal>accept remove_header = X-Internal</literal>
57067 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
57068
57069 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
57070 <literal>       remove_header = X-Internal</literal>
57071 </literallayout>
57072 <para>
57073 In the first case, the header line is always removed, whether or not the
57074 condition is true. In the second case, the header line is removed only if the
57075 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
57076 same ACL statement. All those that are encountered before a condition fails
57077 are honoured.
57078 </para>
57079 <para>
57080 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
57081 present during ACL processing. It does NOT remove header lines that are added
57082 in a system filter or in a router or transport.
57083 </para>
57084 </section>
57085 <section id="SECTaclconditions">
57086 <title>ACL conditions</title>
57087 <para>
57088 <indexterm role="concept">
57089 <primary>access control lists (ACLs)</primary>
57090 <secondary>conditions; list of</secondary>
57091 </indexterm>
57092 Some of the conditions listed in this section are available only when Exim is
57093 compiled with the content-scanning extension. They are included here briefly
57094 for completeness. More detailed descriptions can be found in the discussion on
57095 content scanning in chapter <xref linkend="CHAPexiscan"/>.
57096 </para>
57097 <para>
57098 Not all conditions are relevant in all circumstances. For example, testing
57099 senders and recipients does not make sense in an ACL that is being run as the
57100 result of the arrival of an ETRN command, and checks on message headers can be
57101 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
57102 can use the same condition (with different parameters) more than once in the
57103 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
57104 The conditions are as follows:
57105 </para>
57106 <variablelist>
57107 <varlistentry>
57108 <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>
57109 <listitem>
57110 <para>
57111 <indexterm role="concept">
57112 <primary>access control lists (ACLs)</primary>
57113 <secondary>nested</secondary>
57114 </indexterm>
57115 <indexterm role="concept">
57116 <primary>access control lists (ACLs)</primary>
57117 <secondary>indirect</secondary>
57118 </indexterm>
57119 <indexterm role="concept">
57120 <primary>access control lists (ACLs)</primary>
57121 <secondary>arguments</secondary>
57122 </indexterm>
57123 <indexterm role="concept">
57124 <primary><option>acl</option> ACL condition</primary>
57125 </indexterm>
57126 The possible values of the argument are the same as for the
57127 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
57128 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
57129 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
57130 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
57131 condition false. This means that further processing of the <option>warn</option> verb
57132 ceases, but processing of the ACL continues.
57133 </para>
57134 <para>
57135 If the argument is a named ACL, up to nine space-separated optional values
57136 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
57137 and $acl_narg is set to the count of values.
57138 Previous values of these variables are restored after the call returns.
57139 The name and values are expanded separately.
57140 Note that spaces in complex expansions which are used as arguments
57141 will act as argument separators.
57142 </para>
57143 <para>
57144 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
57145 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
57146 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
57147 conditions are tested.
57148 </para>
57149 <para>
57150 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
57151 loops. This condition allows you to use different ACLs in different
57152 circumstances. For example, different ACLs can be used to handle RCPT commands
57153 for different local users or different local domains.
57154 </para>
57155 </listitem></varlistentry>
57156 <varlistentry>
57157 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
57158 <listitem>
57159 <para>
57160 <indexterm role="concept">
57161 <primary><option>authenticated</option> ACL condition</primary>
57162 </indexterm>
57163 <indexterm role="concept">
57164 <primary>authentication</primary>
57165 <secondary>ACL checking</secondary>
57166 </indexterm>
57167 <indexterm role="concept">
57168 <primary>access control lists (ACLs)</primary>
57169 <secondary>testing for authentication</secondary>
57170 </indexterm>
57171 If the SMTP connection is not authenticated, the condition is false. Otherwise,
57172 the name of the authenticator is tested against the list. To test for
57173 authentication by any authenticator, you can set
57174 </para>
57175 <literallayout class="monospaced">
57176 authenticated = *
57177 </literallayout>
57178 </listitem></varlistentry>
57179 <varlistentry>
57180 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
57181 <listitem>
57182 <para>
57183 <indexterm role="concept">
57184 <primary><option>condition</option> ACL condition</primary>
57185 </indexterm>
57186 <indexterm role="concept">
57187 <primary>customizing</primary>
57188 <secondary>ACL condition</secondary>
57189 </indexterm>
57190 <indexterm role="concept">
57191 <primary>access control lists (ACLs)</primary>
57192 <secondary>customized test</secondary>
57193 </indexterm>
57194 <indexterm role="concept">
57195 <primary>access control lists (ACLs)</primary>
57196 <secondary>testing, customized</secondary>
57197 </indexterm>
57198 This feature allows you to make up custom conditions. If the result of
57199 expanding the string is an empty string, the number zero, or one of the strings
57200 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
57201 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
57202 any other value, some error is assumed to have occurred, and the ACL returns
57203 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
57204 ignored. The effect is to treat it as true, whether it is positive or
57205 negative.
57206 </para>
57207 </listitem></varlistentry>
57208 <varlistentry>
57209 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
57210 <listitem>
57211 <para>
57212 <indexterm role="concept">
57213 <primary><option>decode</option> ACL condition</primary>
57214 </indexterm>
57215 This condition is available only when Exim is compiled with the
57216 content-scanning extension, and it is allowed only in the ACL defined by
57217 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
57218 If all goes well, the condition is true. It is false only if there are
57219 problems such as a syntax error or a memory shortage. For more details, see
57220 chapter <xref linkend="CHAPexiscan"/>.
57221 </para>
57222 </listitem></varlistentry>
57223 <varlistentry>
57224 <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>
57225 <listitem>
57226 <para>
57227 <indexterm role="concept">
57228 <primary><option>dnslists</option> ACL condition</primary>
57229 </indexterm>
57230 <indexterm role="concept">
57231 <primary>DNS list</primary>
57232 <secondary>in ACL</secondary>
57233 </indexterm>
57234 <indexterm role="concept">
57235 <primary>black list (DNS)</primary>
57236 </indexterm>
57237 <indexterm role="concept">
57238 <primary>access control lists (ACLs)</primary>
57239 <secondary>testing a DNS list</secondary>
57240 </indexterm>
57241 This condition checks for entries in DNS black lists. These are also known as
57242 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
57243 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
57244 different variants of this condition to describe briefly here. See sections
57245 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
57246 </para>
57247 </listitem></varlistentry>
57248 <varlistentry>
57249 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
57250 <listitem>
57251 <para>
57252 <indexterm role="concept">
57253 <primary><option>domains</option> ACL condition</primary>
57254 </indexterm>
57255 <indexterm role="concept">
57256 <primary>domain</primary>
57257 <secondary>ACL checking</secondary>
57258 </indexterm>
57259 <indexterm role="concept">
57260 <primary>access control lists (ACLs)</primary>
57261 <secondary>testing a recipient domain</secondary>
57262 </indexterm>
57263 <indexterm role="variable">
57264 <primary><varname>$domain_data</varname></primary>
57265 </indexterm>
57266 This condition is relevant only after a RCPT command. It checks that the domain
57267 of the recipient address is in the domain list. If percent-hack processing is
57268 enabled, it is done before this test is done. If the check succeeds with a
57269 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
57270 <option>domains</option> test.
57271 </para>
57272 <para>
57273 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
57274 use <option>domains</option> in a DATA ACL.
57275 </para>
57276 </listitem></varlistentry>
57277 <varlistentry>
57278 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
57279 <listitem>
57280 <para>
57281 <indexterm role="concept">
57282 <primary><option>encrypted</option> ACL condition</primary>
57283 </indexterm>
57284 <indexterm role="concept">
57285 <primary>encryption</primary>
57286 <secondary>checking in an ACL</secondary>
57287 </indexterm>
57288 <indexterm role="concept">
57289 <primary>access control lists (ACLs)</primary>
57290 <secondary>testing for encryption</secondary>
57291 </indexterm>
57292 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
57293 name of the cipher suite in use is tested against the list. To test for
57294 encryption without testing for any specific cipher suite(s), set
57295 </para>
57296 <literallayout class="monospaced">
57297 encrypted = *
57298 </literallayout>
57299 </listitem></varlistentry>
57300 <varlistentry>
57301 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
57302 <listitem>
57303 <para>
57304 <indexterm role="concept">
57305 <primary><option>hosts</option> ACL condition</primary>
57306 </indexterm>
57307 <indexterm role="concept">
57308 <primary>host</primary>
57309 <secondary>ACL checking</secondary>
57310 </indexterm>
57311 <indexterm role="concept">
57312 <primary>access control lists (ACLs)</primary>
57313 <secondary>testing the client host</secondary>
57314 </indexterm>
57315 This condition tests that the calling host matches the host list. If you have
57316 name lookups or wildcarded host names and IP addresses in the same host list,
57317 you should normally put the IP addresses first. For example, you could have:
57318 </para>
57319 <literallayout class="monospaced">
57320 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
57321 </literallayout>
57322 <para>
57323 The lookup in this example uses the host name for its key. This is implied by
57324 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
57325 and it wouldn&#x2019;t matter which way round you had these two items.)
57326 </para>
57327 <para>
57328 The reason for the problem with host names lies in the left-to-right way that
57329 Exim processes lists. It can test IP addresses without doing any DNS lookups,
57330 but when it reaches an item that requires a host name, it fails if it cannot
57331 find a host name to compare with the pattern. If the above list is given in the
57332 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
57333 found, even if its IP address is 10.9.8.7.
57334 </para>
57335 <para>
57336 If you really do want to do the name check first, and still recognize the IP
57337 address even if the name lookup fails, you can rewrite the ACL like this:
57338 </para>
57339 <literallayout class="monospaced">
57340 accept hosts = dbm;/etc/friendly/hosts
57341 accept hosts = 10.9.8.7
57342 </literallayout>
57343 <para>
57344 The default action on failing to find the host name is to assume that the host
57345 is not in the list, so the first <option>accept</option> statement fails. The second
57346 statement can then check the IP address.
57347 </para>
57348 <para>
57349 <indexterm role="variable">
57350 <primary><varname>$host_data</varname></primary>
57351 </indexterm>
57352 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
57353 of the lookup is made available in the <varname>$host_data</varname> variable. This
57354 allows you, for example, to set up a statement like this:
57355 </para>
57356 <literallayout class="monospaced">
57357 deny  hosts = net-lsearch;/some/file
57358 message = $host_data
57359 </literallayout>
57360 <para>
57361 which gives a custom error message for each denied host.
57362 </para>
57363 </listitem></varlistentry>
57364 <varlistentry>
57365 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
57366 <listitem>
57367 <para>
57368 <indexterm role="concept">
57369 <primary><option>local_parts</option> ACL condition</primary>
57370 </indexterm>
57371 <indexterm role="concept">
57372 <primary>local part</primary>
57373 <secondary>ACL checking</secondary>
57374 </indexterm>
57375 <indexterm role="concept">
57376 <primary>access control lists (ACLs)</primary>
57377 <secondary>testing a local part</secondary>
57378 </indexterm>
57379 <indexterm role="variable">
57380 <primary><varname>$local_part_data</varname></primary>
57381 </indexterm>
57382 This condition is relevant only after a RCPT command. It checks that the local
57383 part of the recipient address is in the list. If percent-hack processing is
57384 enabled, it is done before this test. If the check succeeds with a lookup, the
57385 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
57386 the next <option>local_parts</option> test.
57387 </para>
57388 </listitem></varlistentry>
57389 <varlistentry>
57390 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
57391 <listitem>
57392 <para>
57393 <indexterm role="concept">
57394 <primary><option>malware</option> ACL condition</primary>
57395 </indexterm>
57396 <indexterm role="concept">
57397 <primary>access control lists (ACLs)</primary>
57398 <secondary>virus scanning</secondary>
57399 </indexterm>
57400 <indexterm role="concept">
57401 <primary>access control lists (ACLs)</primary>
57402 <secondary>scanning for viruses</secondary>
57403 </indexterm>
57404 This condition is available only when Exim is compiled with the
57405 content-scanning extension. It causes the incoming message to be scanned for
57406 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
57407 </para>
57408 </listitem></varlistentry>
57409 <varlistentry>
57410 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
57411 <listitem>
57412 <para>
57413 <indexterm role="concept">
57414 <primary><option>mime_regex</option> ACL condition</primary>
57415 </indexterm>
57416 <indexterm role="concept">
57417 <primary>access control lists (ACLs)</primary>
57418 <secondary>testing by regex matching</secondary>
57419 </indexterm>
57420 This condition is available only when Exim is compiled with the
57421 content-scanning extension, and it is allowed only in the ACL defined by
57422 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
57423 with any of the regular expressions. For details, see chapter
57424 <xref linkend="CHAPexiscan"/>.
57425 </para>
57426 </listitem></varlistentry>
57427 <varlistentry>
57428 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
57429 <listitem>
57430 <para>
57431 <indexterm role="concept">
57432 <primary>rate limiting</primary>
57433 </indexterm>
57434 This condition can be used to limit the rate at which a user or host submits
57435 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
57436 </para>
57437 </listitem></varlistentry>
57438 <varlistentry>
57439 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
57440 <listitem>
57441 <para>
57442 <indexterm role="concept">
57443 <primary><option>recipients</option> ACL condition</primary>
57444 </indexterm>
57445 <indexterm role="concept">
57446 <primary>recipient</primary>
57447 <secondary>ACL checking</secondary>
57448 </indexterm>
57449 <indexterm role="concept">
57450 <primary>access control lists (ACLs)</primary>
57451 <secondary>testing a recipient</secondary>
57452 </indexterm>
57453 This condition is relevant only after a RCPT command. It checks the entire
57454 recipient address against a list of recipients.
57455 </para>
57456 </listitem></varlistentry>
57457 <varlistentry>
57458 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
57459 <listitem>
57460 <para>
57461 <indexterm role="concept">
57462 <primary><option>regex</option> ACL condition</primary>
57463 </indexterm>
57464 <indexterm role="concept">
57465 <primary>access control lists (ACLs)</primary>
57466 <secondary>testing by regex matching</secondary>
57467 </indexterm>
57468 This condition is available only when Exim is compiled with the
57469 content-scanning extension, and is available only in the DATA, MIME, and
57470 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
57471 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
57472 </para>
57473 </listitem></varlistentry>
57474 <varlistentry>
57475 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
57476 <listitem>
57477 <para>
57478 <indexterm role="concept">
57479 <primary><option>sender_domains</option> ACL condition</primary>
57480 </indexterm>
57481 <indexterm role="concept">
57482 <primary>sender</primary>
57483 <secondary>ACL checking</secondary>
57484 </indexterm>
57485 <indexterm role="concept">
57486 <primary>access control lists (ACLs)</primary>
57487 <secondary>testing a sender domain</secondary>
57488 </indexterm>
57489 <indexterm role="variable">
57490 <primary><varname>$domain</varname></primary>
57491 </indexterm>
57492 <indexterm role="variable">
57493 <primary><varname>$sender_address_domain</varname></primary>
57494 </indexterm>
57495 This condition tests the domain of the sender of the message against the given
57496 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
57497 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
57498 of this condition. This is an exception to the general rule for testing domain
57499 lists. It is done this way so that, if this condition is used in an ACL for a
57500 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
57501 influence the sender checking.
57502 </para>
57503 <para>
57504 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
57505 relaying, because sender addresses are easily, and commonly, forged.
57506 </para>
57507 </listitem></varlistentry>
57508 <varlistentry>
57509 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
57510 <listitem>
57511 <para>
57512 <indexterm role="concept">
57513 <primary><option>senders</option> ACL condition</primary>
57514 </indexterm>
57515 <indexterm role="concept">
57516 <primary>sender</primary>
57517 <secondary>ACL checking</secondary>
57518 </indexterm>
57519 <indexterm role="concept">
57520 <primary>access control lists (ACLs)</primary>
57521 <secondary>testing a sender</secondary>
57522 </indexterm>
57523 This condition tests the sender of the message against the given list. To test
57524 for a bounce message, which has an empty sender, set
57525 </para>
57526 <literallayout class="monospaced">
57527 senders = :
57528 </literallayout>
57529 <para>
57530 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
57531 relaying, because sender addresses are easily, and commonly, forged.
57532 </para>
57533 </listitem></varlistentry>
57534 <varlistentry>
57535 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
57536 <listitem>
57537 <para>
57538 <indexterm role="concept">
57539 <primary><option>spam</option> ACL condition</primary>
57540 </indexterm>
57541 <indexterm role="concept">
57542 <primary>access control lists (ACLs)</primary>
57543 <secondary>scanning for spam</secondary>
57544 </indexterm>
57545 This condition is available only when Exim is compiled with the
57546 content-scanning extension. It causes the incoming message to be scanned by
57547 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
57548 </para>
57549 </listitem></varlistentry>
57550 <varlistentry>
57551 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
57552 <listitem>
57553 <para>
57554 <indexterm role="concept">
57555 <primary><option>verify</option> ACL condition</primary>
57556 </indexterm>
57557 <indexterm role="concept">
57558 <primary>TLS</primary>
57559 <secondary>client certificate verification</secondary>
57560 </indexterm>
57561 <indexterm role="concept">
57562 <primary>certificate</primary>
57563 <secondary>verification of client</secondary>
57564 </indexterm>
57565 <indexterm role="concept">
57566 <primary>access control lists (ACLs)</primary>
57567 <secondary>certificate verification</secondary>
57568 </indexterm>
57569 <indexterm role="concept">
57570 <primary>access control lists (ACLs)</primary>
57571 <secondary>testing a TLS certificate</secondary>
57572 </indexterm>
57573 This condition is true in an SMTP session if the session is encrypted, and a
57574 certificate was received from the client, and the certificate was verified. The
57575 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
57576 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
57577 </para>
57578 </listitem></varlistentry>
57579 <varlistentry>
57580 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
57581 <listitem>
57582 <para>
57583 <indexterm role="concept">
57584 <primary>CSA verification</primary>
57585 </indexterm>
57586 This condition checks whether the sending host (the client) is authorized to
57587 send email. Details of how this works are given in section
57588 <xref linkend="SECTverifyCSA"/>.
57589 </para>
57590 </listitem></varlistentry>
57591 <varlistentry>
57592 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
57593 <listitem>
57594 <para>
57595 <indexterm role="concept">
57596 <primary><option>verify</option> ACL condition</primary>
57597 </indexterm>
57598 <indexterm role="concept">
57599 <primary>access control lists (ACLs)</primary>
57600 <secondary>verifying header names only ASCII</secondary>
57601 </indexterm>
57602 <indexterm role="concept">
57603 <primary>header lines</primary>
57604 <secondary>verifying header names only ASCII</secondary>
57605 </indexterm>
57606 <indexterm role="concept">
57607 <primary>verifying</primary>
57608 <secondary>header names only ASCII</secondary>
57609 </indexterm>
57610 This condition is relevant only in an ACL that is run after a message has been
57611 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57612 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
57613 there are no non-ASCII characters, also excluding control characters.  The
57614 allowable characters are decimal ASCII values 33 through 126.
57615 </para>
57616 <para>
57617 Exim itself will handle headers with non-ASCII characters, but it can cause
57618 problems for downstream applications, so this option will allow their
57619 detection and rejection in the DATA ACL&#x2019;s.
57620 </para>
57621 </listitem></varlistentry>
57622 <varlistentry>
57623 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57624 <listitem>
57625 <para>
57626 <indexterm role="concept">
57627 <primary><option>verify</option> ACL condition</primary>
57628 </indexterm>
57629 <indexterm role="concept">
57630 <primary>access control lists (ACLs)</primary>
57631 <secondary>verifying sender in the header</secondary>
57632 </indexterm>
57633 <indexterm role="concept">
57634 <primary>header lines</primary>
57635 <secondary>verifying the sender in</secondary>
57636 </indexterm>
57637 <indexterm role="concept">
57638 <primary>sender</primary>
57639 <secondary>verifying in header</secondary>
57640 </indexterm>
57641 <indexterm role="concept">
57642 <primary>verifying</primary>
57643 <secondary>sender in header</secondary>
57644 </indexterm>
57645 This condition is relevant only in an ACL that is run after a message has been
57646 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57647 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
57648 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
57649 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
57650 However, an address that appears in one of these headers need not be an address
57651 that accepts bounce messages; only sender addresses in envelopes are required
57652 to accept bounces. Therefore, if you use the callout option on this check, you
57653 might want to arrange for a non-empty address in the MAIL command.
57654 </para>
57655 <para>
57656 Details of address verification and the options are given later, starting at
57657 section <xref linkend="SECTaddressverification"/> (callouts are described in section
57658 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
57659 condition to restrict it to bounce messages only:
57660 </para>
57661 <literallayout class="monospaced">
57662 deny    senders = :
57663         message = A valid sender header is required for bounces
57664        !verify  = header_sender
57665 </literallayout>
57666 </listitem></varlistentry>
57667 <varlistentry>
57668 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
57669 <listitem>
57670 <para>
57671 <indexterm role="concept">
57672 <primary><option>verify</option> ACL condition</primary>
57673 </indexterm>
57674 <indexterm role="concept">
57675 <primary>access control lists (ACLs)</primary>
57676 <secondary>verifying header syntax</secondary>
57677 </indexterm>
57678 <indexterm role="concept">
57679 <primary>header lines</primary>
57680 <secondary>verifying syntax</secondary>
57681 </indexterm>
57682 <indexterm role="concept">
57683 <primary>verifying</primary>
57684 <secondary>header syntax</secondary>
57685 </indexterm>
57686 This condition is relevant only in an ACL that is run after a message has been
57687 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57688 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
57689 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
57690 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
57691 Unqualified addresses (local parts without domains) are
57692 permitted only in locally generated messages and from hosts that match
57693 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
57694 appropriate.
57695 </para>
57696 <para>
57697 Note that this condition is a syntax check only. However, a common spamming
57698 ploy used to be to send syntactically invalid headers such as
57699 </para>
57700 <literallayout class="monospaced">
57701 To: @
57702 </literallayout>
57703 <para>
57704 and this condition can be used to reject such messages, though they are not as
57705 common as they used to be.
57706 </para>
57707 </listitem></varlistentry>
57708 <varlistentry>
57709 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
57710 <listitem>
57711 <para>
57712 <indexterm role="concept">
57713 <primary><option>verify</option> ACL condition</primary>
57714 </indexterm>
57715 <indexterm role="concept">
57716 <primary>access control lists (ACLs)</primary>
57717 <secondary>verifying HELO/EHLO</secondary>
57718 </indexterm>
57719 <indexterm role="concept">
57720 <primary>HELO</primary>
57721 <secondary>verifying</secondary>
57722 </indexterm>
57723 <indexterm role="concept">
57724 <primary>EHLO</primary>
57725 <secondary>verifying</secondary>
57726 </indexterm>
57727 <indexterm role="concept">
57728 <primary>verifying</primary>
57729 <secondary>EHLO</secondary>
57730 </indexterm>
57731 <indexterm role="concept">
57732 <primary>verifying</primary>
57733 <secondary>HELO</secondary>
57734 </indexterm>
57735 This condition is true if a HELO or EHLO command has been received from the
57736 client host, and its contents have been verified. If there has been no previous
57737 attempt to verify the HELO/EHLO contents, it is carried out when this
57738 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
57739 <option>helo_try_verify_hosts</option> options for details of how to request verification
57740 independently of this condition.
57741 </para>
57742 <para>
57743 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
57744 option), this condition is always true.
57745 </para>
57746 </listitem></varlistentry>
57747 <varlistentry>
57748 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
57749 <listitem>
57750 <para>
57751 <indexterm role="concept">
57752 <primary>verifying</primary>
57753 <secondary>not blind</secondary>
57754 </indexterm>
57755 <indexterm role="concept">
57756 <primary>bcc recipients, verifying none</primary>
57757 </indexterm>
57758 This condition checks that there are no blind (bcc) recipients in the message.
57759 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
57760 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
57761 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
57762 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
57763 used only in a DATA or non-SMTP ACL.
57764 </para>
57765 <para>
57766 There are, of course, many legitimate messages that make use of blind (bcc)
57767 recipients. This check should not be used on its own for blocking messages.
57768 </para>
57769 </listitem></varlistentry>
57770 <varlistentry>
57771 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57772 <listitem>
57773 <para>
57774 <indexterm role="concept">
57775 <primary><option>verify</option> ACL condition</primary>
57776 </indexterm>
57777 <indexterm role="concept">
57778 <primary>access control lists (ACLs)</primary>
57779 <secondary>verifying recipient</secondary>
57780 </indexterm>
57781 <indexterm role="concept">
57782 <primary>recipient</primary>
57783 <secondary>verifying</secondary>
57784 </indexterm>
57785 <indexterm role="concept">
57786 <primary>verifying</primary>
57787 <secondary>recipient</secondary>
57788 </indexterm>
57789 <indexterm role="variable">
57790 <primary><varname>$address_data</varname></primary>
57791 </indexterm>
57792 This condition is relevant only after a RCPT command. It verifies the current
57793 recipient. Details of address verification are given later, starting at section
57794 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
57795 of <varname>$address_data</varname> is the last value that was set while routing the address.
57796 This applies even if the verification fails. When an address that is being
57797 verified is redirected to a single address, verification continues with the new
57798 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
57799 value for the child address.
57800 </para>
57801 </listitem></varlistentry>
57802 <varlistentry>
57803 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57804 <listitem>
57805 <para>
57806 <indexterm role="concept">
57807 <primary><option>verify</option> ACL condition</primary>
57808 </indexterm>
57809 <indexterm role="concept">
57810 <primary>access control lists (ACLs)</primary>
57811 <secondary>verifying host reverse lookup</secondary>
57812 </indexterm>
57813 <indexterm role="concept">
57814 <primary>host</primary>
57815 <secondary>verifying reverse lookup</secondary>
57816 </indexterm>
57817 This condition ensures that a verified host name has been looked up from the IP
57818 address of the client host. (This may have happened already if the host name
57819 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
57820 Verification ensures that the host name obtained from a reverse DNS lookup, or
57821 one of its aliases, does, when it is itself looked up in the DNS, yield the
57822 original IP address.
57823 </para>
57824 <para>
57825 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
57826 DNS operation returns a temporary error, the verify condition succeeds.
57827 </para>
57828 <para>
57829 If this condition is used for a locally generated message (that is, when there
57830 is no client host involved), it always succeeds.
57831 </para>
57832 </listitem></varlistentry>
57833 <varlistentry>
57834 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57835 <listitem>
57836 <para>
57837 <indexterm role="concept">
57838 <primary><option>verify</option> ACL condition</primary>
57839 </indexterm>
57840 <indexterm role="concept">
57841 <primary>access control lists (ACLs)</primary>
57842 <secondary>verifying sender</secondary>
57843 </indexterm>
57844 <indexterm role="concept">
57845 <primary>sender</primary>
57846 <secondary>verifying</secondary>
57847 </indexterm>
57848 <indexterm role="concept">
57849 <primary>verifying</primary>
57850 <secondary>sender</secondary>
57851 </indexterm>
57852 This condition is relevant only after a MAIL or RCPT command, or after a
57853 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
57854 the message&#x2019;s sender is empty (that is, this is a bounce message), the
57855 condition is true. Otherwise, the sender address is verified.
57856 </para>
57857 <para>
57858 <indexterm role="variable">
57859 <primary><varname>$address_data</varname></primary>
57860 </indexterm>
57861 <indexterm role="variable">
57862 <primary><varname>$sender_address_data</varname></primary>
57863 </indexterm>
57864 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
57865 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
57866 value can be used in subsequent conditions and modifiers in the same ACL
57867 statement. It does not persist after the end of the current statement. If you
57868 want to preserve the value for longer, you can save it in an ACL variable.
57869 </para>
57870 <para>
57871 Details of verification are given later, starting at section
57872 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
57873 to avoid doing it more than once per message.
57874 </para>
57875 </listitem></varlistentry>
57876 <varlistentry>
57877 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57878 <listitem>
57879 <para>
57880 <indexterm role="concept">
57881 <primary><option>verify</option> ACL condition</primary>
57882 </indexterm>
57883 This is a variation of the previous option, in which a modified address is
57884 verified as a sender.
57885 </para>
57886 <para>
57887 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
57888 (eg. is generated from the received message)
57889 they must be protected from the options parsing by doubling:
57890 </para>
57891 <literallayout class="monospaced">
57892 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
57893 </literallayout>
57894 </listitem></varlistentry>
57895 </variablelist>
57896 </section>
57897 <section id="SECTmorednslists">
57898 <title>Using DNS lists</title>
57899 <para>
57900 <indexterm role="concept">
57901 <primary>DNS list</primary>
57902 <secondary>in ACL</secondary>
57903 </indexterm>
57904 <indexterm role="concept">
57905 <primary>black list (DNS)</primary>
57906 </indexterm>
57907 <indexterm role="concept">
57908 <primary>access control lists (ACLs)</primary>
57909 <secondary>testing a DNS list</secondary>
57910 </indexterm>
57911 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
57912 is on at least one of a number of DNS lists by looking up the inverted IP
57913 address in one or more DNS domains. (Note that DNS list domains are not mail
57914 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
57915 special options instead.) For example, if the calling host&#x2019;s IP
57916 address is 192.168.62.43, and the ACL statement is
57917 </para>
57918 <literallayout class="monospaced">
57919 deny dnslists = blackholes.mail-abuse.org : \
57920                 dialups.mail-abuse.org
57921 </literallayout>
57922 <para>
57923 the following records are looked up:
57924 </para>
57925 <literallayout class="monospaced">
57926 43.62.168.192.blackholes.mail-abuse.org
57927 43.62.168.192.dialups.mail-abuse.org
57928 </literallayout>
57929 <para>
57930 As soon as Exim finds an existing DNS record, processing of the list stops.
57931 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
57932 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
57933 use two separate conditions:
57934 </para>
57935 <literallayout class="monospaced">
57936 deny dnslists = blackholes.mail-abuse.org
57937      dnslists = dialups.mail-abuse.org
57938 </literallayout>
57939 <para>
57940 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
57941 behaves as if the host does not match the list item, that is, as if the DNS
57942 record does not exist. If there are further items in the DNS list, they are
57943 processed.
57944 </para>
57945 <para>
57946 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
57947 (which is the most common usage), because it prevents a DNS failure from
57948 blocking mail. However, you can change this behaviour by putting one of the
57949 following special items in the list:
57950 </para>
57951 <literallayout>
57952 <literal>+include_unknown </literal>   behave as if the item is on the list
57953 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
57954 <literal>+defer_unknown   </literal>   give a temporary error
57955 </literallayout>
57956 <para>
57957 <indexterm role="concept">
57958 <primary><literal>+include_unknown</literal></primary>
57959 </indexterm>
57960 <indexterm role="concept">
57961 <primary><literal>+exclude_unknown</literal></primary>
57962 </indexterm>
57963 <indexterm role="concept">
57964 <primary><literal>+defer_unknown</literal></primary>
57965 </indexterm>
57966 Each of these applies to any subsequent items on the list. For example:
57967 </para>
57968 <literallayout class="monospaced">
57969 deny dnslists = +defer_unknown : foo.bar.example
57970 </literallayout>
57971 <para>
57972 Testing the list of domains stops as soon as a match is found. If you want to
57973 warn for one list and block for another, you can use two different statements:
57974 </para>
57975 <literallayout class="monospaced">
57976 deny  dnslists = blackholes.mail-abuse.org
57977 warn  message  = X-Warn: sending host is on dialups list
57978       dnslists = dialups.mail-abuse.org
57979 </literallayout>
57980 <para>
57981 <indexterm role="concept">
57982 <primary>caching</primary>
57983 <secondary>of dns lookup</secondary>
57984 </indexterm>
57985 <indexterm role="concept">
57986 <primary>DNS</primary>
57987 <secondary>TTL</secondary>
57988 </indexterm>
57989 DNS list lookups are cached by Exim for the duration of the SMTP session
57990 (but limited by the DNS return TTL value),
57991 so a lookup based on the IP address is done at most once for any incoming
57992 connection (assuming long-enough TTL).
57993 Exim does not share information between multiple incoming
57994 connections (but your local name server cache should be active).
57995 </para>
57996 </section>
57997 <section id="SECID201">
57998 <title>Specifying the IP address for a DNS list lookup</title>
57999 <para>
58000 <indexterm role="concept">
58001 <primary>DNS list</primary>
58002 <secondary>keyed by explicit IP address</secondary>
58003 </indexterm>
58004 By default, the IP address that is used in a DNS list lookup is the IP address
58005 of the calling host. However, you can specify another IP address by listing it
58006 after the domain name, introduced by a slash. For example:
58007 </para>
58008 <literallayout class="monospaced">
58009 deny dnslists = black.list.tld/192.168.1.2
58010 </literallayout>
58011 <para>
58012 This feature is not very helpful with explicit IP addresses; it is intended for
58013 use with IP addresses that are looked up, for example, the IP addresses of the
58014 MX hosts or nameservers of an email sender address. For an example, see section
58015 <xref linkend="SECTmulkeyfor"/> below.
58016 </para>
58017 </section>
58018 <section id="SECID202">
58019 <title>DNS lists keyed on domain names</title>
58020 <para>
58021 <indexterm role="concept">
58022 <primary>DNS list</primary>
58023 <secondary>keyed by domain name</secondary>
58024 </indexterm>
58025 There are some lists that are keyed on domain names rather than inverted IP
58026 addresses (see for example the <emphasis>domain based zones</emphasis> link at
58027 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
58028 with these lists. You can change the name that is looked up in a DNS list by
58029 listing it after the domain name, introduced by a slash. For example,
58030 </para>
58031 <literallayout class="monospaced">
58032 deny  message  = Sender's domain is listed at $dnslist_domain
58033       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
58034 </literallayout>
58035 <para>
58036 This particular example is useful only in ACLs that are obeyed after the
58037 RCPT or DATA commands, when a sender address is available. If (for
58038 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
58039 up by this example is
58040 </para>
58041 <literallayout class="monospaced">
58042 tld.example.dsn.rfc-ignorant.org
58043 </literallayout>
58044 <para>
58045 A single <option>dnslists</option> condition can contain entries for both names and IP
58046 addresses. For example:
58047 </para>
58048 <literallayout class="monospaced">
58049 deny dnslists = sbl.spamhaus.org : \
58050                 dsn.rfc-ignorant.org/$sender_address_domain
58051 </literallayout>
58052 <para>
58053 The first item checks the sending host&#x2019;s IP address; the second checks a domain
58054 name. The whole condition is true if either of the DNS lookups succeeds.
58055 </para>
58056 </section>
58057 <section id="SECTmulkeyfor">
58058 <title>Multiple explicit keys for a DNS list</title>
58059 <para>
58060 <indexterm role="concept">
58061 <primary>DNS list</primary>
58062 <secondary>multiple keys for</secondary>
58063 </indexterm>
58064 The syntax described above for looking up explicitly-defined values (either
58065 names or IP addresses) in a DNS blacklist is a simplification. After the domain
58066 name for the DNS list, what follows the slash can in fact be a list of items.
58067 As with all lists in Exim, the default separator is a colon. However, because
58068 this is a sublist within the list of DNS blacklist domains, it is necessary
58069 either to double the separators like this:
58070 </para>
58071 <literallayout class="monospaced">
58072 dnslists = black.list.tld/name.1::name.2
58073 </literallayout>
58074 <para>
58075 or to change the separator character, like this:
58076 </para>
58077 <literallayout class="monospaced">
58078 dnslists = black.list.tld/&lt;;name.1;name.2
58079 </literallayout>
58080 <para>
58081 If an item in the list is an IP address, it is inverted before the DNS
58082 blacklist domain is appended. If it is not an IP address, no inversion
58083 occurs. Consider this condition:
58084 </para>
58085 <literallayout class="monospaced">
58086 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
58087 </literallayout>
58088 <para>
58089 The DNS lookups that occur are:
58090 </para>
58091 <literallayout class="monospaced">
58092 2.1.168.192.black.list.tld
58093 a.domain.black.list.tld
58094 </literallayout>
58095 <para>
58096 Once a DNS record has been found (that matches a specific IP return
58097 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
58098 are done. If there is a temporary DNS error, the rest of the sublist of domains
58099 or IP addresses is tried. A temporary error for the whole dnslists item occurs
58100 only if no other DNS lookup in this sublist succeeds. In other words, a
58101 successful lookup for any of the items in the sublist overrides a temporary
58102 error for a previous item.
58103 </para>
58104 <para>
58105 The ability to supply a list of items after the slash is in some sense just a
58106 syntactic convenience. These two examples have the same effect:
58107 </para>
58108 <literallayout class="monospaced">
58109 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
58110 dnslists = black.list.tld/a.domain::b.domain
58111 </literallayout>
58112 <para>
58113 However, when the data for the list is obtained from a lookup, the second form
58114 is usually much more convenient. Consider this example:
58115 </para>
58116 <literallayout class="monospaced">
58117 deny message  = The mail servers for the domain \
58118                 $sender_address_domain \
58119                 are listed at $dnslist_domain ($dnslist_value); \
58120                 see $dnslist_text.
58121      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
58122                                    ${lookup dnsdb {&gt;|mxh=\
58123                                    $sender_address_domain} }} }
58124 </literallayout>
58125 <para>
58126 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
58127 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
58128 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
58129 of expanding the condition might be something like this:
58130 </para>
58131 <literallayout class="monospaced">
58132 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
58133 </literallayout>
58134 <para>
58135 Thus, this example checks whether or not the IP addresses of the sender
58136 domain&#x2019;s mail servers are on the Spamhaus black list.
58137 </para>
58138 <para>
58139 The key that was used for a successful DNS list lookup is put into the variable
58140 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
58141 </para>
58142 </section>
58143 <section id="SECID203">
58144 <title>Data returned by DNS lists</title>
58145 <para>
58146 <indexterm role="concept">
58147 <primary>DNS list</primary>
58148 <secondary>data returned from</secondary>
58149 </indexterm>
58150 DNS lists are constructed using address records in the DNS. The original RBL
58151 just used the address 127.0.0.1 on the right hand side of each record, but the
58152 RBL+ list and some other lists use a number of values with different meanings.
58153 The values used on the RBL+ list are:
58154 </para>
58155 <literallayout>
58156 127.1.0.1  RBL
58157 127.1.0.2  DUL
58158 127.1.0.3  DUL and RBL
58159 127.1.0.4  RSS
58160 127.1.0.5  RSS and RBL
58161 127.1.0.6  RSS and DUL
58162 127.1.0.7  RSS and DUL and RBL
58163 </literallayout>
58164 <para>
58165 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
58166 different values. Some DNS lists may return more than one address record;
58167 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
58168 </para>
58169 </section>
58170 <section id="SECID204">
58171 <title>Variables set from DNS lists</title>
58172 <para>
58173 <indexterm role="concept">
58174 <primary>expansion</primary>
58175 <secondary>variables, set from DNS list</secondary>
58176 </indexterm>
58177 <indexterm role="concept">
58178 <primary>DNS list</primary>
58179 <secondary>variables set from</secondary>
58180 </indexterm>
58181 <indexterm role="variable">
58182 <primary><varname>$dnslist_domain</varname></primary>
58183 </indexterm>
58184 <indexterm role="variable">
58185 <primary><varname>$dnslist_matched</varname></primary>
58186 </indexterm>
58187 <indexterm role="variable">
58188 <primary><varname>$dnslist_text</varname></primary>
58189 </indexterm>
58190 <indexterm role="variable">
58191 <primary><varname>$dnslist_value</varname></primary>
58192 </indexterm>
58193 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
58194 the name of the overall domain that matched (for example,
58195 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
58196 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
58197 the DNS record. When the key is an IP address, it is not reversed in
58198 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
58199 cases, for example:
58200 </para>
58201 <literallayout class="monospaced">
58202 deny dnslists = spamhaus.example
58203 </literallayout>
58204 <para>
58205 the key is also available in another variable (in this case,
58206 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
58207 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
58208 might generate a dnslists lookup like this:
58209 </para>
58210 <literallayout class="monospaced">
58211 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
58212 </literallayout>
58213 <para>
58214 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
58215 <literal>192.168.6.7</literal> (for example).
58216 </para>
58217 <para>
58218 If more than one address record is returned by the DNS lookup, all the IP
58219 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
58220 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
58221 record. For lists such as RBL+ the TXT record for a merged entry is often not
58222 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
58223 information.
58224 </para>
58225 <para>
58226 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
58227 &ndash; although these appear before the condition in the ACL, they are not
58228 expanded until after it has failed. For example:
58229 </para>
58230 <literallayout class="monospaced">
58231 deny    hosts = !+local_networks
58232         message = $sender_host_address is listed \
58233                   at $dnslist_domain
58234         dnslists = rbl-plus.mail-abuse.example
58235 </literallayout>
58236 </section>
58237 <section id="SECTaddmatcon">
58238 <title>Additional matching conditions for DNS lists</title>
58239 <para>
58240 <indexterm role="concept">
58241 <primary>DNS list</primary>
58242 <secondary>matching specific returned data</secondary>
58243 </indexterm>
58244 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
58245 in order to restrict its action to DNS records with a matching right hand side.
58246 For example,
58247 </para>
58248 <literallayout class="monospaced">
58249 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
58250 </literallayout>
58251 <para>
58252 rejects only those hosts that yield 127.0.0.2. Without this additional data,
58253 any address record is considered to be a match. For the moment, we assume
58254 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
58255 describes how multiple records are handled.
58256 </para>
58257 <para>
58258 More than one IP address may be given for checking, using a comma as a
58259 separator. These are alternatives &ndash; if any one of them matches, the
58260 <option>dnslists</option> condition is true. For example:
58261 </para>
58262 <literallayout class="monospaced">
58263 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
58264 </literallayout>
58265 <para>
58266 If you want to specify a constraining address list and also specify names or IP
58267 addresses to be looked up, the constraining address list must be specified
58268 first. For example:
58269 </para>
58270 <literallayout class="monospaced">
58271 deny dnslists = dsn.rfc-ignorant.org\
58272                 =127.0.0.2/$sender_address_domain
58273 </literallayout>
58274 <para>
58275 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
58276 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
58277 In other words, the listed addresses are used as bit masks. The comparison is
58278 true if all the bits in the mask are present in the address that is being
58279 tested. For example:
58280 </para>
58281 <literallayout class="monospaced">
58282 dnslists = a.b.c&amp;0.0.0.3
58283 </literallayout>
58284 <para>
58285 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
58286 want to test whether one bit or another bit is present (as opposed to both
58287 being present), you must use multiple values. For example:
58288 </para>
58289 <literallayout class="monospaced">
58290 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
58291 </literallayout>
58292 <para>
58293 matches if the final component of the address is an odd number or two times
58294 an odd number.
58295 </para>
58296 </section>
58297 <section id="SECID205">
58298 <title>Negated DNS matching conditions</title>
58299 <para>
58300 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
58301 condition. Whereas
58302 </para>
58303 <literallayout class="monospaced">
58304 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
58305 </literallayout>
58306 <para>
58307 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
58308 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
58309 </para>
58310 <literallayout class="monospaced">
58311 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
58312 </literallayout>
58313 <para>
58314 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
58315 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
58316 words, the result of the test is inverted if an exclamation mark appears before
58317 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
58318 </para>
58319 <para>
58320 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
58321 host, or address list (which is why the syntax is different).
58322 </para>
58323 <para>
58324 If you are using just one list, the negation syntax does not gain you much. The
58325 previous example is precisely equivalent to
58326 </para>
58327 <literallayout class="monospaced">
58328 deny  dnslists = a.b.c
58329      !dnslists = a.b.c=127.0.0.2,127.0.0.3
58330 </literallayout>
58331 <para>
58332 However, if you are using multiple lists, the negation syntax is clearer.
58333 Consider this example:
58334 </para>
58335 <literallayout class="monospaced">
58336 deny  dnslists = sbl.spamhaus.org : \
58337                  list.dsbl.org : \
58338                  dnsbl.njabl.org!=127.0.0.3 : \
58339                  relays.ordb.org
58340 </literallayout>
58341 <para>
58342 Using only positive lists, this would have to be:
58343 </para>
58344 <literallayout class="monospaced">
58345 deny  dnslists = sbl.spamhaus.org : \
58346                  list.dsbl.org
58347 deny  dnslists = dnsbl.njabl.org
58348      !dnslists = dnsbl.njabl.org=127.0.0.3
58349 deny  dnslists = relays.ordb.org
58350 </literallayout>
58351 <para>
58352 which is less clear, and harder to maintain.
58353 </para>
58354 </section>
58355 <section id="SECThanmuldnsrec">
58356 <title>Handling multiple DNS records from a DNS list</title>
58357 <para>
58358 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
58359 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
58360 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
58361 the match to specific results from the DNS lookup, there are two ways in which
58362 the checking can be handled. For example, consider the condition:
58363 </para>
58364 <literallayout class="monospaced">
58365 dnslists = a.b.c=127.0.0.1
58366 </literallayout>
58367 <para>
58368 What happens if the DNS lookup for the incoming IP address yields both
58369 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
58370 condition true because at least one given value was found, or is it false
58371 because at least one of the found values was not listed? And how does this
58372 affect negated conditions? Both possibilities are provided for with the help of
58373 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
58374 </para>
58375 <itemizedlist>
58376 <listitem>
58377 <para>
58378 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
58379 IP addresses matches one of the listed addresses. For the example above, the
58380 condition is true because 127.0.0.1 matches.
58381 </para>
58382 </listitem>
58383 <listitem>
58384 <para>
58385 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
58386 looked up IP addresses matches one of the listed addresses. If the condition is
58387 changed to:
58388 </para>
58389 <literallayout class="monospaced">
58390 dnslists = a.b.c==127.0.0.1
58391 </literallayout>
58392 <para>
58393 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
58394 false because 127.0.0.2 is not listed. You would need to have:
58395 </para>
58396 <literallayout class="monospaced">
58397 dnslists = a.b.c==127.0.0.1,127.0.0.2
58398 </literallayout>
58399 <para>
58400 for the condition to be true.
58401 </para>
58402 </listitem>
58403 </itemizedlist>
58404 <para>
58405 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
58406 the precise opposite of the behaviour above. Thus:
58407 </para>
58408 <itemizedlist>
58409 <listitem>
58410 <para>
58411 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
58412 addresses matches one of the listed addresses. Consider:
58413 </para>
58414 <literallayout class="monospaced">
58415 dnslists = a.b.c!&amp;0.0.0.1
58416 </literallayout>
58417 <para>
58418 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
58419 false because 127.0.0.1 matches.
58420 </para>
58421 </listitem>
58422 <listitem>
58423 <para>
58424 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
58425 looked up IP address that does not match. Consider:
58426 </para>
58427 <literallayout class="monospaced">
58428 dnslists = a.b.c!=&amp;0.0.0.1
58429 </literallayout>
58430 <para>
58431 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
58432 true, because 127.0.0.2 does not match. You would need to have:
58433 </para>
58434 <literallayout class="monospaced">
58435 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
58436 </literallayout>
58437 <para>
58438 for the condition to be false.
58439 </para>
58440 </listitem>
58441 </itemizedlist>
58442 <para>
58443 When the DNS lookup yields only a single IP address, there is no difference
58444 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
58445 </para>
58446 </section>
58447 <section id="SECTmordetinf">
58448 <title>Detailed information from merged DNS lists</title>
58449 <para>
58450 <indexterm role="concept">
58451 <primary>DNS list</primary>
58452 <secondary>information from merged</secondary>
58453 </indexterm>
58454 When the facility for restricting the matching IP values in a DNS list is used,
58455 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
58456 the true reason for rejection. This happens when lists are merged and the IP
58457 address in the A record is used to distinguish them; unfortunately there is
58458 only one TXT record. One way round this is not to use merged lists, but that
58459 can be inefficient because it requires multiple DNS lookups where one would do
58460 in the vast majority of cases when the host of interest is not on any of the
58461 lists.
58462 </para>
58463 <para>
58464 A less inefficient way of solving this problem is available. If
58465 two domain names, comma-separated, are given, the second is used first to
58466 do an initial check, making use of any IP value restrictions that are set.
58467 If there is a match, the first domain is used, without any IP value
58468 restrictions, to get the TXT record. As a byproduct of this, there is also
58469 a check that the IP being tested is indeed on the first list. The first
58470 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
58471 </para>
58472 <literallayout class="monospaced">
58473 reject message  = \
58474          rejected because $sender_host_address is blacklisted \
58475          at $dnslist_domain\n$dnslist_text
58476        dnslists = \
58477          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
58478          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
58479 </literallayout>
58480 <para>
58481 For the first blacklist item, this starts by doing a lookup in
58482 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
58483 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
58484 value, and as long as something is found, it looks for the corresponding TXT
58485 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
58486 The second blacklist item is processed similarly.
58487 </para>
58488 <para>
58489 If you are interested in more than one merged list, the same list must be
58490 given several times, but because the results of the DNS lookups are cached,
58491 the DNS calls themselves are not repeated. For example:
58492 </para>
58493 <literallayout class="monospaced">
58494 reject dnslists = \
58495          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
58496          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
58497          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
58498          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
58499 </literallayout>
58500 <para>
58501 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
58502 values matches (or if no record is found), this is the only lookup that is
58503 done. Only if there is a match is one of the more specific lists consulted.
58504 </para>
58505 </section>
58506 <section id="SECTmorednslistslast">
58507 <title>DNS lists and IPv6</title>
58508 <para>
58509 <indexterm role="concept">
58510 <primary>IPv6</primary>
58511 <secondary>DNS black lists</secondary>
58512 </indexterm>
58513 <indexterm role="concept">
58514 <primary>DNS list</primary>
58515 <secondary>IPv6 usage</secondary>
58516 </indexterm>
58517 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
58518 nibble by nibble. For example, if the calling host&#x2019;s IP address is
58519 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
58520 </para>
58521 <literallayout class="monospaced">
58522 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
58523   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
58524 </literallayout>
58525 <para>
58526 (split over two lines here to fit on the page). Unfortunately, some of the DNS
58527 lists contain wildcard records, intended for IPv4, that interact badly with
58528 IPv6. For example, the DNS entry
58529 </para>
58530 <literallayout class="monospaced">
58531 *.3.some.list.example.    A    127.0.0.1
58532 </literallayout>
58533 <para>
58534 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
58535 Unfortunately, it also matches the entire 3::/4 IPv6 network.
58536 </para>
58537 <para>
58538 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
58539 <option>condition</option> condition, as in this example:
58540 </para>
58541 <literallayout class="monospaced">
58542 deny   condition = ${if isip4{$sender_host_address}}
58543        dnslists  = some.list.example
58544 </literallayout>
58545 <para>
58546 If an explicit key is being used for a DNS lookup and it may be an IPv6
58547 address you should specify alternate list separators for both the outer
58548 (DNS list name) list and inner (lookup keys) list:
58549 </para>
58550 <literallayout class="monospaced">
58551        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
58552 </literallayout>
58553 </section>
58554 <section id="SECTratelimiting">
58555 <title>Rate limiting incoming messages</title>
58556 <para>
58557 <indexterm role="concept">
58558 <primary>rate limiting</primary>
58559 <secondary>client sending</secondary>
58560 </indexterm>
58561 <indexterm role="concept">
58562 <primary>limiting client sending rates</primary>
58563 </indexterm>
58564 <indexterm role="option">
58565 <primary><option>smtp_ratelimit_*</option></primary>
58566 </indexterm>
58567 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
58568 which clients can send email. This is more powerful than the
58569 <option>smtp_ratelimit_*</option> options, because those options control the rate of
58570 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
58571 works across all connections (concurrent and sequential) from the same client
58572 host. The syntax of the <option>ratelimit</option> condition is:
58573 </para>
58574 <literallayout>
58575 <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;
58576 </literallayout>
58577 <para>
58578 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
58579 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
58580 </para>
58581 <para>
58582 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
58583 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
58584 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
58585 of <emphasis>p</emphasis>.
58586 </para>
58587 <para>
58588 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
58589 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
58590 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
58591 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
58592 send in each time interval. It also specifies the number of messages permitted
58593 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
58594 constant, you can allow a client to send more messages in a burst without
58595 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
58596 both small, messages must be sent at an even rate.
58597 </para>
58598 <para>
58599 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
58600 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
58601 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
58602 instructions when it is run with no arguments.
58603 </para>
58604 <para>
58605 The key is used to look up the data for calculating the client&#x2019;s average
58606 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
58607 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
58608 which means Exim computes the sending rate of each client host IP address.
58609 By changing the key you can change how Exim identifies clients for the purpose
58610 of ratelimiting. For example, to limit the sending rate of each authenticated
58611 user, independent of the computer they are sending from, set the key to
58612 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
58613 example, <varname>$authenticated_id</varname> is only meaningful if the client has
58614 authenticated (which you can check with the <option>authenticated</option> ACL condition).
58615 </para>
58616 <para>
58617 The lookup key does not have to identify clients: If you want to limit the
58618 rate at which a recipient receives messages, you can use the key
58619 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
58620 ACL.
58621 </para>
58622 <para>
58623 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
58624 specifies what Exim measures the rate of, for example messages or recipients
58625 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
58626 <option>count=</option> options. You can also control when Exim updates the recorded rate
58627 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
58628 separated by a slash, like the other parameters. They may appear in any order.
58629 </para>
58630 <para>
58631 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
58632 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
58633 stored, so you can alter the configured maximum rate and Exim will still
58634 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
58635 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
58636 behaviour. The lookup key is not affected by changes to the update mode and
58637 the <option>count=</option> option.
58638 </para>
58639 </section>
58640 <section id="ratoptmea">
58641 <title>Ratelimit options for what is being measured</title>
58642 <para>
58643 <indexterm role="concept">
58644 <primary>rate limiting</primary>
58645 <secondary>per_* options</secondary>
58646 </indexterm>
58647 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
58648 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
58649 <option>acl_not_smtp_start</option> ACLs.
58650 </para>
58651 <para>
58652 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
58653 the default if none of the <option>per_*</option> options is specified. It can be used in
58654 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
58655 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
58656 </para>
58657 <para>
58658 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
58659 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
58660 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
58661 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
58662 in its MAIL command, which may be inaccurate or completely missing. You can
58663 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
58664 in kilobytes, megabytes, or gigabytes, respectively.
58665 </para>
58666 <para>
58667 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
58668 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
58669 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
58670 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
58671 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
58672 in either case the rate limiting engine will see a message with many
58673 recipients as a large high-speed burst.
58674 </para>
58675 <para>
58676 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
58677 number of different recipients that the client has sent messages to in the
58678 last time period. That is, if the client repeatedly sends messages to the same
58679 recipient, its measured rate is not increased. This option can only be used in
58680 <option>acl_smtp_rcpt</option>.
58681 </para>
58682 <para>
58683 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
58684 condition is processed. This can be used to limit the rate of any SMTP
58685 command. If it is used in multiple ACLs it can limit the aggregate rate of
58686 multiple different commands.
58687 </para>
58688 <para>
58689 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
58690 measured rate. For example, the <option>per_byte</option> option is equivalent to
58691 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
58692 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
58693 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
58694 </para>
58695 <para>
58696 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
58697 </para>
58698 </section>
58699 <section id="ratoptupd">
58700 <title>Ratelimit update modes</title>
58701 <para>
58702 <indexterm role="concept">
58703 <primary>rate limiting</primary>
58704 <secondary>reading data without updating</secondary>
58705 </indexterm>
58706 You can specify one of three options with the <option>ratelimit</option> condition to
58707 control when its database is updated. This section describes the <option>readonly</option>
58708 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
58709 </para>
58710 <para>
58711 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
58712 previously-computed rate to check against the limit.
58713 </para>
58714 <para>
58715 For example, you can test the client&#x2019;s sending rate and deny it access (when
58716 it is too fast) in the connect ACL. If the client passes this check then it
58717 can go on to send a message, in which case its recorded rate will be updated
58718 in the MAIL ACL. Subsequent connections from the same client will check this
58719 new rate.
58720 </para>
58721 <literallayout class="monospaced">
58722 acl_check_connect:
58723  deny ratelimit = 100 / 5m / readonly
58724     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
58725                   (max $sender_rate_limit)
58726 # ...
58727 acl_check_mail:
58728  warn ratelimit = 100 / 5m / strict
58729     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
58730                   (max $sender_rate_limit)
58731 </literallayout>
58732 <para>
58733 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
58734 processing a message then it may increase the client&#x2019;s measured rate more than
58735 it should. For example, this will happen if you check the <option>per_rcpt</option> option
58736 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
58737 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
58738 multiple update problems by using the <option>readonly</option> option on later ratelimit
58739 checks.
58740 </para>
58741 <para>
58742 The <option>per_*</option> options described above do not make sense in some ACLs. If you
58743 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
58744 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
58745 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
58746 next section) so you must specify the <option>readonly</option> option explicitly.
58747 </para>
58748 </section>
58749 <section id="ratoptfast">
58750 <title>Ratelimit options for handling fast clients</title>
58751 <para>
58752 <indexterm role="concept">
58753 <primary>rate limiting</primary>
58754 <secondary>strict and leaky modes</secondary>
58755 </indexterm>
58756 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
58757 engine can react in two possible ways, depending on the presence of the
58758 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
58759 counter-measures (such as rejecting the message) that may be specified by the
58760 rest of the ACL.
58761 </para>
58762 <para>
58763 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
58764 updated if it is above the limit. The effect of this is that Exim measures the
58765 client&#x2019;s average rate of successfully sent email, which cannot be greater than
58766 the maximum allowed. If the client is over the limit it may suffer some
58767 counter-measures (as specified in the ACL), but it will still be able to send
58768 email at the configured maximum rate, whatever the rate of its attempts. This
58769 is generally the better choice if you have clients that retry automatically.
58770 For example, it does not prevent a sender with an over-aggressive retry rate
58771 from getting any email through.
58772 </para>
58773 <para>
58774 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
58775 updated. The effect of this is that Exim measures the client&#x2019;s average rate
58776 of attempts to send email, which can be much higher than the maximum it is
58777 actually allowed. If the client is over the limit it may be subjected to
58778 counter-measures by the ACL. It must slow down and allow sufficient time to
58779 pass that its computed rate falls below the maximum before it can send email
58780 again. The time (the number of smoothing periods) it must wait and not
58781 attempt to send mail can be calculated with this formula:
58782 </para>
58783 <literallayout class="monospaced">
58784         ln(peakrate/maxrate)
58785 </literallayout>
58786 </section>
58787 <section id="ratoptuniq">
58788 <title>Limiting the rate of different events</title>
58789 <para>
58790 <indexterm role="concept">
58791 <primary>rate limiting</primary>
58792 <secondary>counting unique events</secondary>
58793 </indexterm>
58794 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
58795 rate of different events. For example, the <option>per_addr</option> option uses this
58796 mechanism to count the number of different recipients that the client has
58797 sent messages to in the last time period; it is equivalent to
58798 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
58799 measure the rate that a client uses different sender addresses with the
58800 options <literal>per_mail/unique=$sender_address</literal>.
58801 </para>
58802 <para>
58803 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
58804 has seen for that key. The whole set is thrown away when it is older than the
58805 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
58806 per period. In the <option>leaky</option> update mode, an event that causes the client to
58807 go over the limit is not added to the set, in the same way that the client&#x2019;s
58808 recorded rate is not updated in the same situation.
58809 </para>
58810 <para>
58811 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
58812 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
58813 rate.
58814 </para>
58815 <para>
58816 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
58817 other <option>ratelimit</option> options in order to store the event set. The number of
58818 unique values is potentially as large as the rate limit, so the extra space
58819 required increases with larger limits.
58820 </para>
58821 <para>
58822 The uniqueification is not perfect: there is a small probability that Exim
58823 will think a new event has happened before. If the sender&#x2019;s rate is less than
58824 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
58825 the measured rate can go above the limit, in which case Exim may under-count
58826 events by a significant margin. Fortunately, if the rate is high enough (2.7
58827 times the limit) that the false positive rate goes above 9%, then Exim will
58828 throw away the over-full event set before the measured rate falls below the
58829 limit. Therefore the only harm should be that exceptionally high sending rates
58830 are logged incorrectly; any countermeasures you configure will be as effective
58831 as intended.
58832 </para>
58833 </section>
58834 <section id="useratlim">
58835 <title>Using rate limiting</title>
58836 <para>
58837 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
58838 when the rate limit is exceeded. This might be anything from logging a warning
58839 (for example, while measuring existing sending rates in order to define
58840 policy), through time delays to slow down fast senders, up to rejecting the
58841 message. For example:
58842 </para>
58843 <literallayout class="monospaced">
58844 # Log all senders' rates
58845 warn ratelimit = 0 / 1h / strict
58846      log_message = Sender rate $sender_rate / $sender_rate_period
58847
58848 # Slow down fast senders; note the need to truncate $sender_rate
58849 # at the decimal point.
58850 warn ratelimit = 100 / 1h / per_rcpt / strict
58851      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
58852                    $sender_rate_limit }s
58853
58854 # Keep authenticated users under control
58855 deny authenticated = *
58856      ratelimit = 100 / 1d / strict / $authenticated_id
58857
58858 # System-wide rate limit
58859 defer message = Sorry, too busy. Try again later.
58860      ratelimit = 10 / 1s / $primary_hostname
58861
58862 # Restrict incoming rate from each host, with a default
58863 # set using a macro and special cases looked up in a table.
58864 defer message = Sender rate exceeds $sender_rate_limit \
58865                messages per $sender_rate_period
58866      ratelimit = ${lookup {$sender_host_address} \
58867                    cdb {DB/ratelimits.cdb} \
58868                    {$value} {RATELIMIT} }
58869 </literallayout>
58870 <para>
58871 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
58872 especially with the <option>per_rcpt</option> option, you may suffer from a performance
58873 bottleneck caused by locking on the ratelimit hints database. Apart from
58874 making your ACLs less complicated, you can reduce the problem by using a
58875 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
58876 this means that Exim will lose its hints data after a reboot (including retry
58877 hints, the callout cache, and ratelimit data).
58878 </para>
58879 </section>
58880 <section id="SECTaddressverification">
58881 <title>Address verification</title>
58882 <para>
58883 <indexterm role="concept">
58884 <primary>verifying address</primary>
58885 <secondary>options for</secondary>
58886 </indexterm>
58887 <indexterm role="concept">
58888 <primary>policy control</primary>
58889 <secondary>address verification</secondary>
58890 </indexterm>
58891 Several of the <option>verify</option> conditions described in section
58892 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
58893 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
58894 The verification conditions can be followed by options that modify the
58895 verification process. The options are separated from the keyword and from each
58896 other by slashes, and some of them contain parameters. For example:
58897 </para>
58898 <literallayout class="monospaced">
58899 verify = sender/callout
58900 verify = recipient/defer_ok/callout=10s,defer_ok
58901 </literallayout>
58902 <para>
58903 The first stage of address verification, which always happens, is to run the
58904 address through the routers, in <quote>verify mode</quote>. Routers can detect the
58905 difference between verification and routing for delivery, and their actions can
58906 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
58907 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
58908 The available options are as follows:
58909 </para>
58910 <itemizedlist>
58911 <listitem>
58912 <para>
58913 If the <option>callout</option> option is specified, successful routing to one or more
58914 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
58915 check. Callouts and their sub-options are discussed in the next section.
58916 </para>
58917 </listitem>
58918 <listitem>
58919 <para>
58920 If there is a defer error while doing verification routing, the ACL
58921 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
58922 options, the condition is forced to be true instead. Note that this is a main
58923 verification option as well as a suboption for callouts.
58924 </para>
58925 </listitem>
58926 <listitem>
58927 <para>
58928 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
58929 discusses the reporting of sender address verification failures.
58930 </para>
58931 </listitem>
58932 <listitem>
58933 <para>
58934 The <option>success_on_redirect</option> option causes verification always to succeed
58935 immediately after a successful redirection. By default, if a redirection
58936 generates just one address, that address is also verified. See further
58937 discussion in section <xref linkend="SECTredirwhilveri"/>.
58938 </para>
58939 </listitem>
58940 </itemizedlist>
58941 <para>
58942 <indexterm role="concept">
58943 <primary>verifying address</primary>
58944 <secondary>differentiating failures</secondary>
58945 </indexterm>
58946 <indexterm role="variable">
58947 <primary><varname>$recipient_verify_failure</varname></primary>
58948 </indexterm>
58949 <indexterm role="variable">
58950 <primary><varname>$sender_verify_failure</varname></primary>
58951 </indexterm>
58952 <indexterm role="variable">
58953 <primary><varname>$acl_verify_message</varname></primary>
58954 </indexterm>
58955 After an address verification failure, <varname>$acl_verify_message</varname> contains the
58956 error message that is associated with the failure. It can be preserved by
58957 coding like this:
58958 </para>
58959 <literallayout class="monospaced">
58960 warn  !verify = sender
58961        set acl_m0 = $acl_verify_message
58962 </literallayout>
58963 <para>
58964 If you are writing your own custom rejection message or log message when
58965 denying access, you can use this variable to include information about the
58966 verification failure.
58967 </para>
58968 <para>
58969 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
58970 appropriate) contains one of the following words:
58971 </para>
58972 <itemizedlist>
58973 <listitem>
58974 <para>
58975 <option>qualify</option>: The address was unqualified (no domain), and the message
58976 was neither local nor came from an exempted host.
58977 </para>
58978 </listitem>
58979 <listitem>
58980 <para>
58981 <option>route</option>: Routing failed.
58982 </para>
58983 </listitem>
58984 <listitem>
58985 <para>
58986 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
58987 occurred at or before the MAIL command (that is, on initial
58988 connection, HELO, or MAIL).
58989 </para>
58990 </listitem>
58991 <listitem>
58992 <para>
58993 <option>recipient</option>: The RCPT command in a callout was rejected.
58994 </para>
58995 </listitem>
58996 <listitem>
58997 <para>
58998 <option>postmaster</option>: The postmaster check in a callout was rejected.
58999 </para>
59000 </listitem>
59001 </itemizedlist>
59002 <para>
59003 The main use of these variables is expected to be to distinguish between
59004 rejections of MAIL and rejections of RCPT in callouts.
59005 </para>
59006 </section>
59007 <section id="SECTcallver">
59008 <title>Callout verification</title>
59009 <para>
59010 <indexterm role="concept">
59011 <primary>verifying address</primary>
59012 <secondary>by callout</secondary>
59013 </indexterm>
59014 <indexterm role="concept">
59015 <primary>callout</primary>
59016 <secondary>verification</secondary>
59017 </indexterm>
59018 <indexterm role="concept">
59019 <primary>SMTP</primary>
59020 <secondary>callout verification</secondary>
59021 </indexterm>
59022 For non-local addresses, routing verifies the domain, but is unable to do any
59023 checking of the local part. There are situations where some means of verifying
59024 the local part is desirable. One way this can be done is to make an SMTP
59025 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
59026 a subsequent host for a recipient address, to see if the host accepts the
59027 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
59028 sender address, the callback is not to the client host that is trying to
59029 deliver the message, but to one of the hosts that accepts incoming mail for the
59030 sender&#x2019;s domain.
59031 </para>
59032 <para>
59033 Exim does not do callouts by default. If you want them to happen, you must
59034 request them by setting appropriate options on the <option>verify</option> condition, as
59035 described below. This facility should be used with care, because it can add a
59036 lot of resource usage to the cost of verifying an address. However, Exim does
59037 cache the results of callouts, which helps to reduce the cost. Details of
59038 caching are in section <xref linkend="SECTcallvercache"/>.
59039 </para>
59040 <para>
59041 Recipient callouts are usually used only between hosts that are controlled by
59042 the same administration. For example, a corporate gateway host could use
59043 callouts to check for valid recipients on an internal mailserver. A successful
59044 callout does not guarantee that a real delivery to the address would succeed;
59045 on the other hand, a failing callout does guarantee that a delivery would fail.
59046 </para>
59047 <para>
59048 If the <option>callout</option> option is present on a condition that verifies an address, a
59049 second stage of verification occurs if the address is successfully routed to
59050 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
59051 <command>manualroute</command> router, where the router specifies the hosts. However, if a
59052 router that does not set up hosts routes to an <command>smtp</command> transport with a
59053 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
59054 <option>hosts_override</option> set, its hosts are always used, whether or not the router
59055 supplies a host list.
59056 Callouts are only supported on <command>smtp</command> transports.
59057 </para>
59058 <para>
59059 The port that is used is taken from the transport, if it is specified and is a
59060 remote transport. (For routers that do verification only, no transport need be
59061 specified.) Otherwise, the default SMTP port is used. If a remote transport
59062 specifies an outgoing interface, this is used; otherwise the interface is not
59063 specified. Likewise, the text that is used for the HELO command is taken from
59064 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
59065 <varname>$smtp_active_hostname</varname> is used.
59066 </para>
59067 <para>
59068 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
59069 test whether a bounce message could be delivered to the sender address. The
59070 following SMTP commands are sent:
59071 </para>
59072 <literallayout>
59073 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
59074 <literal>MAIL FROM:&lt;&gt;</literal>
59075 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
59076 <literal>QUIT</literal>
59077 </literallayout>
59078 <para>
59079 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
59080 set to <quote>lmtp</quote>.
59081 </para>
59082 <para>
59083 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
59084 settings.
59085 </para>
59086 <para>
59087 A recipient callout check is similar. By default, it also uses an empty address
59088 for the sender. This default is chosen because most hosts do not make use of
59089 the sender address when verifying a recipient. Using the same address means
59090 that a single cache entry can be used for each recipient. Some sites, however,
59091 do make use of the sender address when verifying. These are catered for by the
59092 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
59093 </para>
59094 <para>
59095 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
59096 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
59097 Exim tries the next host, if any. If there is a problem with all the remote
59098 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
59099 <option>callout</option> option is given, in which case the condition is forced to succeed.
59100 </para>
59101 <para>
59102 <indexterm role="concept">
59103 <primary>SMTP</primary>
59104 <secondary>output flushing, disabling for callout</secondary>
59105 </indexterm>
59106 A callout may take a little time. For this reason, Exim normally flushes SMTP
59107 output before performing a callout in an ACL, to avoid unexpected timeouts in
59108 clients when the SMTP PIPELINING extension is in use. The flushing can be
59109 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
59110 </para>
59111 </section>
59112 <section id="CALLaddparcall">
59113 <title>Additional parameters for callouts</title>
59114 <para>
59115 <indexterm role="concept">
59116 <primary>callout</primary>
59117 <secondary>additional parameters for</secondary>
59118 </indexterm>
59119 The <option>callout</option> option can be followed by an equals sign and a number of
59120 optional parameters, separated by commas. For example:
59121 </para>
59122 <literallayout class="monospaced">
59123 verify = recipient/callout=10s,defer_ok
59124 </literallayout>
59125 <para>
59126 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
59127 separate verify options, is retained for backwards compatibility, but is now
59128 deprecated. The additional parameters for <option>callout</option> are as follows:
59129 </para>
59130 <variablelist>
59131 <varlistentry>
59132 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
59133 <listitem>
59134 <para>
59135 <indexterm role="concept">
59136 <primary>callout</primary>
59137 <secondary>timeout, specifying</secondary>
59138 </indexterm>
59139 This specifies the timeout that applies for the callout attempt to each host.
59140 For example:
59141 </para>
59142 <literallayout class="monospaced">
59143 verify = sender/callout=5s
59144 </literallayout>
59145 <para>
59146 The default is 30 seconds. The timeout is used for each response from the
59147 remote host. It is also used for the initial connection, unless overridden by
59148 the <option>connect</option> parameter.
59149 </para>
59150 </listitem></varlistentry>
59151 <varlistentry>
59152 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
59153 <listitem>
59154 <para>
59155 <indexterm role="concept">
59156 <primary>callout</primary>
59157 <secondary>connection timeout, specifying</secondary>
59158 </indexterm>
59159 This parameter makes it possible to set a different (usually smaller) timeout
59160 for making the SMTP connection. For example:
59161 </para>
59162 <literallayout class="monospaced">
59163 verify = sender/callout=5s,connect=1s
59164 </literallayout>
59165 <para>
59166 If not specified, this timeout defaults to the general timeout value.
59167 </para>
59168 </listitem></varlistentry>
59169 <varlistentry>
59170 <term><emphasis role="bold">defer_ok</emphasis></term>
59171 <listitem>
59172 <para>
59173 <indexterm role="concept">
59174 <primary>callout</primary>
59175 <secondary>defer, action on</secondary>
59176 </indexterm>
59177 When this parameter is present, failure to contact any host, or any other kind
59178 of temporary error, is treated as success by the ACL. However, the cache is not
59179 updated in this circumstance.
59180 </para>
59181 </listitem></varlistentry>
59182 <varlistentry>
59183 <term><emphasis role="bold">fullpostmaster</emphasis></term>
59184 <listitem>
59185 <para>
59186 <indexterm role="concept">
59187 <primary>callout</primary>
59188 <secondary>full postmaster check</secondary>
59189 </indexterm>
59190 This operates like the <option>postmaster</option> option (see below), but if the check for
59191 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
59192 accordance with the specification in RFC 2821. The RFC states that the
59193 unqualified address <emphasis>postmaster</emphasis> should be accepted.
59194 </para>
59195 </listitem></varlistentry>
59196 <varlistentry>
59197 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
59198 <listitem>
59199 <para>
59200 <indexterm role="concept">
59201 <primary>callout</primary>
59202 <secondary>sender when verifying header</secondary>
59203 </indexterm>
59204 When verifying addresses in header lines using the <option>header_sender</option>
59205 verification option, Exim behaves by default as if the addresses are envelope
59206 sender addresses from a message. Callout verification therefore tests to see
59207 whether a bounce message could be delivered, by using an empty address in the
59208 MAIL command. However, it is arguable that these addresses might never be used
59209 as envelope senders, and could therefore justifiably reject bounce messages
59210 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
59211 address to use in the MAIL command. For example:
59212 </para>
59213 <literallayout class="monospaced">
59214 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
59215 </literallayout>
59216 <para>
59217 This parameter is available only for the <option>header_sender</option> verification option.
59218 </para>
59219 </listitem></varlistentry>
59220 <varlistentry>
59221 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
59222 <listitem>
59223 <para>
59224 <indexterm role="concept">
59225 <primary>callout</primary>
59226 <secondary>overall timeout, specifying</secondary>
59227 </indexterm>
59228 This parameter sets an overall timeout for performing a callout verification.
59229 For example:
59230 </para>
59231 <literallayout class="monospaced">
59232 verify = sender/callout=5s,maxwait=30s
59233 </literallayout>
59234 <para>
59235 This timeout defaults to four times the callout timeout for individual SMTP
59236 commands. The overall timeout applies when there is more than one host that can
59237 be tried. The timeout is checked before trying the next host. This prevents
59238 very long delays if there are a large number of hosts and all are timing out
59239 (for example, when network connections are timing out).
59240 </para>
59241 </listitem></varlistentry>
59242 <varlistentry>
59243 <term><emphasis role="bold">no_cache</emphasis></term>
59244 <listitem>
59245 <para>
59246 <indexterm role="concept">
59247 <primary>callout</primary>
59248 <secondary>cache, suppressing</secondary>
59249 </indexterm>
59250 <indexterm role="concept">
59251 <primary>caching callout, suppressing</primary>
59252 </indexterm>
59253 When this parameter is given, the callout cache is neither read nor updated.
59254 </para>
59255 </listitem></varlistentry>
59256 <varlistentry>
59257 <term><emphasis role="bold">postmaster</emphasis></term>
59258 <listitem>
59259 <para>
59260 <indexterm role="concept">
59261 <primary>callout</primary>
59262 <secondary>postmaster; checking</secondary>
59263 </indexterm>
59264 When this parameter is set, a successful callout check is followed by a similar
59265 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
59266 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
59267 the postmaster check is recorded in a cache record; if it is a failure, this is
59268 used to fail subsequent callouts for the domain without a connection being
59269 made, until the cache record expires.
59270 </para>
59271 </listitem></varlistentry>
59272 <varlistentry>
59273 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
59274 <listitem>
59275 <para>
59276 The postmaster check uses an empty sender in the MAIL command by default.
59277 You can use this parameter to do a postmaster check using a different address.
59278 For example:
59279 </para>
59280 <literallayout class="monospaced">
59281 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
59282 </literallayout>
59283 <para>
59284 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
59285 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
59286 </para>
59287 <literallayout class="monospaced">
59288 require  verify = sender/callout=postmaster_mailfrom=
59289 </literallayout>
59290 <para>
59291 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
59292 account of the sender address. It is assumed that either the empty address or
59293 a fixed non-empty address will be used. All that Exim remembers is that the
59294 postmaster check for the domain succeeded or failed.
59295 </para>
59296 </listitem></varlistentry>
59297 <varlistentry>
59298 <term><emphasis role="bold">random</emphasis></term>
59299 <listitem>
59300 <para>
59301 <indexterm role="concept">
59302 <primary>callout</primary>
59303 <secondary><quote>random</quote> check</secondary>
59304 </indexterm>
59305 When this parameter is set, before doing the normal callout check, Exim does a
59306 check for a <quote>random</quote> local part at the same domain. The local part is not
59307 really random &ndash; it is defined by the expansion of the option
59308 <option>callout_random_local_part</option>, which defaults to
59309 </para>
59310 <literallayout class="monospaced">
59311 $primary_hostname-$tod_epoch-testing
59312 </literallayout>
59313 <para>
59314 The idea here is to try to determine whether the remote host accepts all local
59315 parts without checking. If it does, there is no point in doing callouts for
59316 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
59317 a cache record, and used to force the current and subsequent callout checks to
59318 succeed without a connection being made, until the cache record expires.
59319 </para>
59320 </listitem></varlistentry>
59321 <varlistentry>
59322 <term><emphasis role="bold">use_postmaster</emphasis></term>
59323 <listitem>
59324 <para>
59325 <indexterm role="concept">
59326 <primary>callout</primary>
59327 <secondary>sender for recipient check</secondary>
59328 </indexterm>
59329 This parameter applies to recipient callouts only. For example:
59330 </para>
59331 <literallayout class="monospaced">
59332 deny  !verify = recipient/callout=use_postmaster
59333 </literallayout>
59334 <para>
59335 <indexterm role="variable">
59336 <primary><varname>$qualify_domain</varname></primary>
59337 </indexterm>
59338 It causes a non-empty postmaster address to be used in the MAIL command when
59339 performing the callout for the recipient, and also for a <quote>random</quote> check if
59340 that is configured. The local part of the address is <literal>postmaster</literal> and the
59341 domain is the contents of <varname>$qualify_domain</varname>.
59342 </para>
59343 </listitem></varlistentry>
59344 <varlistentry>
59345 <term><emphasis role="bold">use_sender</emphasis></term>
59346 <listitem>
59347 <para>
59348 This option applies to recipient callouts only. For example:
59349 </para>
59350 <literallayout class="monospaced">
59351 require  verify = recipient/callout=use_sender
59352 </literallayout>
59353 <para>
59354 It causes the message&#x2019;s actual sender address to be used in the MAIL
59355 command when performing the callout, instead of an empty address. There is no
59356 need to use this option unless you know that the called hosts make use of the
59357 sender when checking recipients. If used indiscriminately, it reduces the
59358 usefulness of callout caching.
59359 </para>
59360 </listitem></varlistentry>
59361 <varlistentry>
59362 <term><emphasis role="bold">hold</emphasis></term>
59363 <listitem>
59364 <para>
59365 This option applies to recipient callouts only. For example:
59366 </para>
59367 <literallayout class="monospaced">
59368 require  verify = recipient/callout=use_sender,hold
59369 </literallayout>
59370 <para>
59371 It causes the connection to be held open and used for any further recipients
59372 and for eventual delivery (should that be done quickly).
59373 Doing this saves on TCP and SMTP startup costs, and TLS costs also
59374 when that is used for the connections.
59375 The advantage is only gained if there are no callout cache hits
59376 (which could be enforced by the no_cache option),
59377 if the use_sender option is used,
59378 if neither the random nor the use_postmaster option is used,
59379 and if no other callouts intervene.
59380 </para>
59381 </listitem></varlistentry>
59382 </variablelist>
59383 <para>
59384 If you use any of the parameters that set a non-empty sender for the MAIL
59385 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
59386 <option>use_sender</option>), you should think about possible loops. Recipient checking is
59387 usually done between two hosts that are under the same management, and the host
59388 that receives the callouts is not normally configured to do callouts itself.
59389 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
59390 these circumstances.
59391 </para>
59392 <para>
59393 However, if you use a non-empty sender address for a callout to an arbitrary
59394 host, there is the likelihood that the remote host will itself initiate a
59395 callout check back to your host. As it is checking what appears to be a message
59396 sender, it is likely to use an empty address in MAIL, thus avoiding a
59397 callout loop. However, to be on the safe side it would be best to set up your
59398 own ACLs so that they do not do sender verification checks when the recipient
59399 is the address you use for header sender or postmaster callout checking.
59400 </para>
59401 <para>
59402 Another issue to think about when using non-empty senders for callouts is
59403 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
59404 by the sender/recipient combination; thus, for any given recipient, many more
59405 actual callouts are performed than when an empty sender or postmaster is used.
59406 </para>
59407 </section>
59408 <section id="SECTcallvercache">
59409 <title>Callout caching</title>
59410 <para>
59411 <indexterm role="concept">
59412 <primary>hints database</primary>
59413 <secondary>callout cache</secondary>
59414 </indexterm>
59415 <indexterm role="concept">
59416 <primary>callout</primary>
59417 <secondary>cache, description of</secondary>
59418 </indexterm>
59419 <indexterm role="concept">
59420 <primary>caching</primary>
59421 <secondary>callout</secondary>
59422 </indexterm>
59423 Exim caches the results of callouts in order to reduce the amount of resources
59424 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
59425 option. A hints database called <quote>callout</quote> is used for the cache. Two
59426 different record types are used: one records the result of a callout check for
59427 a specific address, and the other records information that applies to the
59428 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
59429 </para>
59430 <para>
59431 When an original callout fails, a detailed SMTP error message is given about
59432 the failure. However, for subsequent failures use the cache data, this message
59433 is not available.
59434 </para>
59435 <para>
59436 The expiry times for negative and positive address cache records are
59437 independent, and can be set by the global options <option>callout_negative_expire</option>
59438 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
59439 </para>
59440 <para>
59441 If a host gives a negative response to an SMTP connection, or rejects any
59442 commands up to and including
59443 </para>
59444 <literallayout class="monospaced">
59445 MAIL FROM:&lt;&gt;
59446 </literallayout>
59447 <para>
59448 (but not including the MAIL command with a non-empty address),
59449 any callout attempt is bound to fail. Exim remembers such failures in a
59450 domain cache record, which it uses to fail callouts for the domain without
59451 making new connections, until the domain record times out. There are two
59452 separate expiry times for domain cache records:
59453 <option>callout_domain_negative_expire</option> (default 3h) and
59454 <option>callout_domain_positive_expire</option> (default 7d).
59455 </para>
59456 <para>
59457 Domain records expire when the negative expiry time is reached if callouts
59458 cannot be made for the domain, or if the postmaster check failed.
59459 Otherwise, they expire when the positive expiry time is reached. This
59460 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
59461 will eventually be noticed.
59462 </para>
59463 <para>
59464 The callout caching mechanism is based on the domain of the address that is
59465 being tested. If the domain routes to several hosts, it is assumed that their
59466 behaviour will be the same.
59467 </para>
59468 </section>
59469 <section id="SECTsenaddver">
59470 <title>Sender address verification reporting</title>
59471 <para>
59472 <indexterm role="concept">
59473 <primary>verifying</primary>
59474 <secondary>suppressing error details</secondary>
59475 </indexterm>
59476 See section <xref linkend="SECTaddressverification"/> for a general discussion of
59477 verification. When sender verification fails in an ACL, the details of the
59478 failure are given as additional output lines before the 550 response to the
59479 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
59480 you might see:
59481 </para>
59482 <literallayout class="monospaced">
59483 MAIL FROM:&lt;xyz@abc.example&gt;
59484 250 OK
59485 RCPT TO:&lt;pqr@def.example&gt;
59486 550-Verification failed for &lt;xyz@abc.example&gt;
59487 550-Called:   192.168.34.43
59488 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
59489 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
59490 550 Sender verification failed
59491 </literallayout>
59492 <para>
59493 If more than one RCPT command fails in the same way, the details are given
59494 only for the first of them. However, some administrators do not want to send
59495 out this much information. You can suppress the details by adding
59496 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
59497 example:
59498 </para>
59499 <literallayout class="monospaced">
59500 verify = sender/no_details
59501 </literallayout>
59502 </section>
59503 <section id="SECTredirwhilveri">
59504 <title>Redirection while verifying</title>
59505 <para>
59506 <indexterm role="concept">
59507 <primary>verifying</primary>
59508 <secondary>redirection while</secondary>
59509 </indexterm>
59510 <indexterm role="concept">
59511 <primary>address redirection</primary>
59512 <secondary>while verifying</secondary>
59513 </indexterm>
59514 A dilemma arises when a local address is redirected by aliasing or forwarding
59515 during verification: should the generated addresses themselves be verified,
59516 or should the successful expansion of the original address be enough to verify
59517 it? By default, Exim takes the following pragmatic approach:
59518 </para>
59519 <itemizedlist>
59520 <listitem>
59521 <para>
59522 When an incoming address is redirected to just one child address, verification
59523 continues with the child address, and if that fails to verify, the original
59524 verification also fails.
59525 </para>
59526 </listitem>
59527 <listitem>
59528 <para>
59529 When an incoming address is redirected to more than one child address,
59530 verification does not continue. A success result is returned.
59531 </para>
59532 </listitem>
59533 </itemizedlist>
59534 <para>
59535 This seems the most reasonable behaviour for the common use of aliasing as a
59536 way of redirecting different local parts to the same mailbox. It means, for
59537 example, that a pair of alias entries of the form
59538 </para>
59539 <literallayout class="monospaced">
59540 A.Wol:   aw123
59541 aw123:   :fail: Gone away, no forwarding address
59542 </literallayout>
59543 <para>
59544 work as expected, with both local parts causing verification failure. When a
59545 redirection generates more than one address, the behaviour is more like a
59546 mailing list, where the existence of the alias itself is sufficient for
59547 verification to succeed.
59548 </para>
59549 <para>
59550 It is possible, however, to change the default behaviour so that all successful
59551 redirections count as successful verifications, however many new addresses are
59552 generated. This is specified by the <option>success_on_redirect</option> verification
59553 option. For example:
59554 </para>
59555 <literallayout class="monospaced">
59556 require verify = recipient/success_on_redirect/callout=10s
59557 </literallayout>
59558 <para>
59559 In this example, verification succeeds if a router generates a new address, and
59560 the callout does not occur, because no address was routed to a remote host.
59561 </para>
59562 <para>
59563 When verification is being tested via the <option>-bv</option> option, the treatment of
59564 redirections is as just described, unless the <option>-v</option> or any debugging option is
59565 also specified. In that case, full verification is done for every generated
59566 address and a report is output for each of them.
59567 </para>
59568 </section>
59569 <section id="SECTverifyCSA">
59570 <title>Client SMTP authorization (CSA)</title>
59571 <para>
59572 <indexterm role="concept">
59573 <primary>CSA</primary>
59574 <secondary>verifying</secondary>
59575 </indexterm>
59576 Client SMTP Authorization is a system that allows a site to advertise
59577 which machines are and are not permitted to send email. This is done by placing
59578 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
59579 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
59580 Authorization checks in Exim are performed by the ACL condition:
59581 </para>
59582 <literallayout class="monospaced">
59583 verify = csa
59584 </literallayout>
59585 <para>
59586 This fails if the client is not authorized. If there is a DNS problem, or if no
59587 valid CSA SRV record is found, or if the client is authorized, the condition
59588 succeeds. These three cases can be distinguished using the expansion variable
59589 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
59590 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
59591 be likely to cause problems for legitimate email.
59592 </para>
59593 <para>
59594 The error messages produced by the CSA code include slightly more
59595 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
59596 looking up the CSA SRV record, or problems looking up the CSA target
59597 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
59598 </para>
59599 <itemizedlist>
59600 <listitem>
59601 <para>
59602 The client&#x2019;s host name is explicitly not authorized.
59603 </para>
59604 </listitem>
59605 <listitem>
59606 <para>
59607 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
59608 </para>
59609 </listitem>
59610 <listitem>
59611 <para>
59612 The client&#x2019;s host name is authorized but it has no valid target IP addresses
59613 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
59614 </para>
59615 </listitem>
59616 <listitem>
59617 <para>
59618 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
59619 that all subdomains must be explicitly authorized.
59620 </para>
59621 </listitem>
59622 </itemizedlist>
59623 <para>
59624 The <option>csa</option> verification condition can take an argument which is the domain to
59625 use for the DNS query. The default is:
59626 </para>
59627 <literallayout class="monospaced">
59628 verify = csa/$sender_helo_name
59629 </literallayout>
59630 <para>
59631 This implementation includes an extension to CSA. If the query domain
59632 is an address literal such as [192.0.2.95], or if it is a bare IP
59633 address, Exim searches for CSA SRV records in the reverse DNS as if
59634 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
59635 meaningful to say:
59636 </para>
59637 <literallayout class="monospaced">
59638 verify = csa/$sender_host_address
59639 </literallayout>
59640 <para>
59641 In fact, this is the check that Exim performs if the client does not say HELO.
59642 This extension can be turned off by setting the main configuration option
59643 <option>dns_csa_use_reverse</option> to be false.
59644 </para>
59645 <para>
59646 If a CSA SRV record is not found for the domain itself, a search
59647 is performed through its parent domains for a record which might be
59648 making assertions about subdomains. The maximum depth of this search is limited
59649 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
59650 default. Exim does not look for CSA SRV records in a top level domain, so the
59651 default settings handle HELO domains as long as seven
59652 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
59653 of legitimate HELO domains.
59654 </para>
59655 <para>
59656 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
59657 direct SRV lookups, this is not sufficient because of the extra parent domain
59658 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
59659 addresses into lookups in the reverse DNS space. The result of a successful
59660 lookup such as:
59661 </para>
59662 <literallayout class="monospaced">
59663 ${lookup dnsdb {csa=$sender_helo_name}}
59664 </literallayout>
59665 <para>
59666 has two space-separated fields: an authorization code and a target host name.
59667 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
59668 authorization required but absent, or <quote>?</quote> for unknown.
59669 </para>
59670 </section>
59671 <section id="SECTverifyPRVS">
59672 <title>Bounce address tag validation</title>
59673 <para>
59674 <indexterm role="concept">
59675 <primary>BATV, verifying</primary>
59676 </indexterm>
59677 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
59678 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
59679 Genuine incoming bounce messages should therefore always be addressed to
59680 recipients that have a valid tag. This scheme is a way of detecting unwanted
59681 bounce messages caused by sender address forgeries (often called <quote>collateral
59682 spam</quote>), because the recipients of such messages do not include valid tags.
59683 </para>
59684 <para>
59685 There are two expansion items to help with the implementation of the BATV
59686 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
59687 the original envelope sender address by using a simple key to add a hash of the
59688 address and some time-based randomizing information. The <option>prvs</option> expansion
59689 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
59690 The syntax of these expansion items is described in section
59691 <xref linkend="SECTexpansionitems"/>.
59692 The validity period on signed addresses is seven days.
59693 </para>
59694 <para>
59695 As an example, suppose the secret per-address keys are stored in an MySQL
59696 database. A query to look up the key for an address could be defined as a macro
59697 like this:
59698 </para>
59699 <literallayout class="monospaced">
59700 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
59701                 WHERE sender='${quote_mysql:$prvscheck_address}'\
59702                 }{$value}}
59703 </literallayout>
59704 <para>
59705 Suppose also that the senders who make use of BATV are defined by an address
59706 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
59707 use this:
59708 </para>
59709 <literallayout class="monospaced">
59710 # Bounces: drop unsigned addresses for BATV senders
59711 deny message = This address does not send an unsigned reverse path
59712      senders = :
59713      recipients = +batv_senders
59714
59715 # Bounces: In case of prvs-signed address, check signature.
59716 deny message = Invalid reverse path signature.
59717      senders = :
59718      condition  = ${prvscheck {$local_part@$domain}\
59719                   {PRVSCHECK_SQL}{1}}
59720      !condition = $prvscheck_result
59721 </literallayout>
59722 <para>
59723 The first statement rejects recipients for bounce messages that are addressed
59724 to plain BATV sender addresses, because it is known that BATV senders do not
59725 send out messages with plain sender addresses. The second statement rejects
59726 recipients that are prvs-signed, but with invalid signatures (either because
59727 the key is wrong, or the signature has timed out).
59728 </para>
59729 <para>
59730 A non-prvs-signed address is not rejected by the second statement, because the
59731 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
59732 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
59733 the first argument is a syntactically valid prvs-signed address, the yield is
59734 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
59735 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
59736 of the checks (empty for failure, <quote>1</quote> for success).
59737 </para>
59738 <para>
59739 There is one more issue you must consider when implementing prvs-signing:
59740 you have to ensure that the routers accept prvs-signed addresses and
59741 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
59742 router to remove the signature with a configuration along these lines:
59743 </para>
59744 <literallayout class="monospaced">
59745 batv_redirect:
59746   driver = redirect
59747   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
59748 </literallayout>
59749 <para>
59750 This works because, if the third argument of <option>prvscheck</option> is empty, the result
59751 of the expansion of a prvs-signed address is the decoded value of the original
59752 address. This router should probably be the first of your routers that handles
59753 local addresses.
59754 </para>
59755 <para>
59756 To create BATV-signed addresses in the first place, a transport of this form
59757 can be used:
59758 </para>
59759 <literallayout class="monospaced">
59760 external_smtp_batv:
59761   driver = smtp
59762   return_path = ${prvs {$return_path} \
59763                        {${lookup mysql{SELECT \
59764                        secret FROM batv_prvs WHERE \
59765                        sender='${quote_mysql:$sender_address}'} \
59766                        {$value}fail}}}
59767 </literallayout>
59768 <para>
59769 If no key can be found for the existing return path, no signing takes place.
59770 </para>
59771 </section>
59772 <section id="SECTrelaycontrol">
59773 <title>Using an ACL to control relaying</title>
59774 <para>
59775 <indexterm role="concept">
59776 <primary>access control lists (ACLs)</primary>
59777 <secondary>relay control</secondary>
59778 </indexterm>
59779 <indexterm role="concept">
59780 <primary>relaying</primary>
59781 <secondary>control by ACL</secondary>
59782 </indexterm>
59783 <indexterm role="concept">
59784 <primary>policy control</primary>
59785 <secondary>relay control</secondary>
59786 </indexterm>
59787 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
59788 delivers it directly to another host as a result of a remote address contained
59789 within it. Redirecting a local address via an alias or forward file and then
59790 passing the message on to another host is not relaying,
59791 <indexterm role="concept">
59792 <primary><quote>percent hack</quote></primary>
59793 </indexterm>
59794 but a redirection as a result of the <quote>percent hack</quote> is.
59795 </para>
59796 <para>
59797 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
59798 A host which is acting as a gateway or an MX backup is concerned with incoming
59799 relaying from arbitrary hosts to a specific set of domains. On the other hand,
59800 a host which is acting as a smart host for a number of clients is concerned
59801 with outgoing relaying from those clients to the Internet at large. Often the
59802 same host is fulfilling both functions,
59803 but in principle these two kinds of relaying are entirely independent. What is
59804 not wanted is the transmission of mail from arbitrary remote hosts through your
59805 system to arbitrary domains.
59806 </para>
59807 <para>
59808 You can implement relay control by means of suitable statements in the ACL that
59809 runs for each RCPT command. For convenience, it is often easiest to use
59810 Exim&#x2019;s named list facility to define the domains and hosts involved. For
59811 example, suppose you want to do the following:
59812 </para>
59813 <itemizedlist>
59814 <listitem>
59815 <para>
59816 Deliver a number of domains to mailboxes on the local host (or process them
59817 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
59818 <emphasis>my.dom2.example</emphasis>.
59819 </para>
59820 </listitem>
59821 <listitem>
59822 <para>
59823 Relay mail for a number of other domains for which you are the secondary MX.
59824 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
59825 </para>
59826 </listitem>
59827 <listitem>
59828 <para>
59829 Relay mail from the hosts on your local LAN, to whatever domains are involved.
59830 Suppose your LAN is 192.168.45.0/24.
59831 </para>
59832 </listitem>
59833 </itemizedlist>
59834 <para>
59835 In the main part of the configuration, you put the following definitions:
59836 </para>
59837 <literallayout class="monospaced">
59838 domainlist local_domains    = my.dom1.example : my.dom2.example
59839 domainlist relay_to_domains = friend1.example : friend2.example
59840 hostlist   relay_from_hosts = 192.168.45.0/24
59841 </literallayout>
59842 <para>
59843 Now you can use these definitions in the ACL that is run for every RCPT
59844 command:
59845 </para>
59846 <literallayout class="monospaced">
59847 acl_check_rcpt:
59848   accept domains = +local_domains : +relay_to_domains
59849   accept hosts   = +relay_from_hosts
59850 </literallayout>
59851 <para>
59852 The first statement accepts any RCPT command that contains an address in
59853 the local or relay domains. For any other domain, control passes to the second
59854 statement, which accepts the command only if it comes from one of the relay
59855 hosts. In practice, you will probably want to make your ACL more sophisticated
59856 than this, for example, by including sender and recipient verification. The
59857 default configuration includes a more comprehensive example, which is described
59858 in chapter <xref linkend="CHAPdefconfil"/>.
59859 </para>
59860 </section>
59861 <section id="SECTcheralcon">
59862 <title>Checking a relay configuration</title>
59863 <para>
59864 <indexterm role="concept">
59865 <primary>relaying</primary>
59866 <secondary>checking control of</secondary>
59867 </indexterm>
59868 You can check the relay characteristics of your configuration in the same way
59869 that you can test any ACL behaviour for an incoming SMTP connection, by using
59870 the <option>-bh</option> option to run a fake SMTP session with which you interact.
59871 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
59872 </para>
59873 </section>
59874 </chapter>
59875
59876 <chapter id="CHAPexiscan">
59877 <title>Content scanning at ACL time</title>
59878 <para>
59879 <indexterm role="concept" id="IIDcosca" class="startofrange">
59880 <primary>content scanning</primary>
59881 <secondary>at ACL time</secondary>
59882 </indexterm>
59883 The extension of Exim to include content scanning at ACL time, formerly known
59884 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
59885 was integrated into the main source for Exim release 4.50, and Tom continues to
59886 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
59887 specification.
59888 </para>
59889 <para>
59890 It is also possible to scan the content of messages at other times. The
59891 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
59892 scanning after all the ACLs have run. A transport filter can be used to scan
59893 messages at delivery time (see the <option>transport_filter</option> option, described in
59894 chapter <xref linkend="CHAPtransportgeneric"/>).
59895 </para>
59896 <para>
59897 If you want to include the ACL-time content-scanning features when you compile
59898 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
59899 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
59900 </para>
59901 <itemizedlist>
59902 <listitem>
59903 <para>
59904 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
59905 for all MIME parts for SMTP and non-SMTP messages, respectively.
59906 </para>
59907 </listitem>
59908 <listitem>
59909 <para>
59910 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
59911 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
59912 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
59913 </para>
59914 </listitem>
59915 <listitem>
59916 <para>
59917 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
59918 of messages, or parts of messages, for debugging purposes.
59919 </para>
59920 </listitem>
59921 <listitem>
59922 <para>
59923 Additional expansion variables that are set in the new ACL and by the new
59924 conditions.
59925 </para>
59926 </listitem>
59927 <listitem>
59928 <para>
59929 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
59930 </para>
59931 </listitem>
59932 </itemizedlist>
59933 <para>
59934 Content-scanning is continually evolving, and new features are still being
59935 added. While such features are still unstable and liable to incompatible
59936 changes, they are made available in Exim by setting options whose names begin
59937 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
59938 this manual. You can find out about them by reading the file called
59939 <filename>doc/experimental.txt</filename>.
59940 </para>
59941 <para>
59942 All the content-scanning facilities work on a MBOX copy of the message that is
59943 temporarily created in a file called:
59944 </para>
59945 <literallayout>
59946 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
59947 </literallayout>
59948 <para>
59949 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
59950 expect an MBOX-like structure inside that file. The file is created when the
59951 first content scanning facility is called. Subsequent calls to content
59952 scanning conditions open the same file again. The directory is recursively
59953 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
59954 </para>
59955 <literallayout class="monospaced">
59956 control = no_mbox_unspool
59957 </literallayout>
59958 <para>
59959 has been encountered. When the MIME ACL decodes files, they are put into the
59960 same directory by default.
59961 </para>
59962 <section id="SECTscanvirus">
59963 <title>Scanning for viruses</title>
59964 <para>
59965 <indexterm role="concept">
59966 <primary>virus scanning</primary>
59967 </indexterm>
59968 <indexterm role="concept">
59969 <primary>content scanning</primary>
59970 <secondary>for viruses</secondary>
59971 </indexterm>
59972 <indexterm role="concept">
59973 <primary>content scanning</primary>
59974 <secondary>the <option>malware</option> condition</secondary>
59975 </indexterm>
59976 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
59977 It supports a <quote>generic</quote> interface to scanners called via the shell, and
59978 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
59979 in memory and thus are much faster.
59980 </para>
59981 <para>
59982 A timeout of 2 minutes is applied to a scanner call (by default);
59983 if it expires then a defer action is taken.
59984 </para>
59985 <para>
59986 <indexterm role="option">
59987 <primary><option>av_scanner</option></primary>
59988 </indexterm>
59989 You can set the <option>av_scanner</option> option in the main part of the configuration
59990 to specify which scanner to use, together with any additional options that
59991 are needed. The basic syntax is as follows:
59992 </para>
59993 <literallayout>
59994 <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>
59995 </literallayout>
59996 <para>
59997 If you do not set <option>av_scanner</option>, it defaults to
59998 </para>
59999 <literallayout class="monospaced">
60000 av_scanner = sophie:/var/run/sophie
60001 </literallayout>
60002 <para>
60003 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
60004 before use.
60005 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
60006 The following scanner types are supported in this release,
60007 though individual ones can be included or not at build time:
60008 </para>
60009 <variablelist>
60010 <varlistentry>
60011 <term><option>avast</option></term>
60012 <listitem>
60013 <para>
60014 <indexterm role="concept">
60015 <primary>virus scanners</primary>
60016 <secondary>avast</secondary>
60017 </indexterm>
60018 This is the scanner daemon of Avast. It has been tested with Avast Core
60019 Security (currently at version 2.2.0).
60020 You can get a trial version at <emphasis role="bold"><ulink url="https://www.avast.com">https://www.avast.com</ulink></emphasis> or for Linux
60021 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
60022 This scanner type takes one option,
60023 which can be either a full path to a UNIX socket,
60024 or host and port specifiers separated by white space.
60025 The host may be a name or an IP address; the port is either a
60026 single number or a pair of numbers with a dash between.
60027 A list of options may follow. These options are interpreted on the
60028 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
60029 the daemon as options before the main scan command.
60030 </para>
60031 <para revisionflag="changed">
60032 <indexterm role="concept">
60033 <primary><literal>pass_unscanned</literal></primary>
60034 <secondary>avast</secondary>
60035 </indexterm>
60036 If <literal>pass_unscanned</literal>
60037 is set, any files the Avast scanner can&#x2019;t scan (e.g.
60038 decompression bombs, or invalid archives) are considered clean. Use with
60039 care.
60040 </para>
60041 <para>
60042 For example:
60043 </para>
60044 <literallayout class="monospaced">
60045 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
60046 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
60047 av_scanner = avast:192.168.2.22 5036
60048 </literallayout>
60049 <para>
60050 If you omit the argument, the default path
60051 <filename>/var/run/avast/scan.sock</filename>
60052 is used.
60053 If you use a remote host,
60054 you need to make Exim&#x2019;s spool directory available to it,
60055 as the scanner is passed a file path, not file contents.
60056 For information about available commands and their options you may use
60057 </para>
60058 <literallayout class="monospaced">
60059 $ socat UNIX:/var/run/avast/scan.sock STDIO:
60060     FLAGS
60061     SENSITIVITY
60062     PACK
60063 </literallayout>
60064 <para>
60065 If the scanner returns a temporary failure (e.g. license issues, or
60066 permission problems), the message is deferred and a paniclog entry is
60067 written.  The usual <literal>defer_ok</literal> option is available.
60068 </para>
60069 </listitem></varlistentry>
60070 <varlistentry>
60071 <term><option>aveserver</option></term>
60072 <listitem>
60073 <para>
60074 <indexterm role="concept">
60075 <primary>virus scanners</primary>
60076 <secondary>Kaspersky</secondary>
60077 </indexterm>
60078 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
60079 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
60080 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
60081 example:
60082 </para>
60083 <literallayout class="monospaced">
60084 av_scanner = aveserver:/var/run/aveserver
60085 </literallayout>
60086 </listitem></varlistentry>
60087 <varlistentry>
60088 <term><option>clamd</option></term>
60089 <listitem>
60090 <para>
60091 <indexterm role="concept">
60092 <primary>virus scanners</primary>
60093 <secondary>clamd</secondary>
60094 </indexterm>
60095 This daemon-type scanner is GPL and free. You can get it at
60096 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
60097 unpack MIME containers, so it used to be recommended to unpack MIME attachments
60098 in the MIME ACL. This is no longer believed to be necessary.
60099 </para>
60100 <para>
60101 The options are a list of server specifiers, which may be
60102 a UNIX socket specification,
60103 a TCP socket specification,
60104 or a (global) option.
60105 </para>
60106 <para>
60107 A socket specification consists of a space-separated list.
60108 For a Unix socket the first element is a full path for the socket,
60109 for a TCP socket the first element is the IP address
60110 and the second a port number,
60111 Any further elements are per-server (non-global) options.
60112 These per-server options are supported:
60113 </para>
60114 <literallayout class="monospaced">
60115 retry=&lt;timespec&gt;  Retry on connect fail
60116 </literallayout>
60117 <para>
60118 The <literal>retry</literal> option specifies a time after which a single retry for
60119 a failed connect is made.  The default is to not retry.
60120 </para>
60121 <para>
60122 If a Unix socket file is specified, only one server is supported.
60123 </para>
60124 <para>
60125 Examples:
60126 </para>
60127 <literallayout class="monospaced">
60128 av_scanner = clamd:/opt/clamd/socket
60129 av_scanner = clamd:192.0.2.3 1234
60130 av_scanner = clamd:192.0.2.3 1234:local
60131 av_scanner = clamd:192.0.2.3 1234 retry=10s
60132 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
60133 </literallayout>
60134 <para>
60135 If the value of av_scanner points to a UNIX socket file or contains the
60136 <literal>local</literal>
60137 option, then the ClamAV interface will pass a filename containing the data
60138 to be scanned, which should normally result in less I/O happening and be
60139 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
60140 Exim does not assume that there is a common filesystem with the remote host.
60141 </para>
60142 <para>
60143 The final example shows that multiple TCP targets can be specified.  Exim will
60144 randomly use one for each incoming email (i.e. it load balances them).  Note
60145 that only TCP targets may be used if specifying a list of scanners; a UNIX
60146 socket cannot be mixed in with TCP targets.  If one of the servers becomes
60147 unavailable, Exim will try the remaining one(s) until it finds one that works.
60148 When a clamd server becomes unreachable, Exim will log a message.  Exim does
60149 not keep track of scanner state between multiple messages, and the scanner
60150 selection is random, so the message will get logged in the mainlog for each
60151 email that the down scanner gets chosen first (message wrapped to be readable):
60152 </para>
60153 <literallayout class="monospaced">
60154 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
60155    clamd: connection to localhost, port 3310 failed
60156    (Connection refused)
60157 </literallayout>
60158 <para>
60159 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
60160 contributing the code for this scanner.
60161 </para>
60162 </listitem></varlistentry>
60163 <varlistentry>
60164 <term><option>cmdline</option></term>
60165 <listitem>
60166 <para>
60167 <indexterm role="concept">
60168 <primary>virus scanners</primary>
60169 <secondary>command line interface</secondary>
60170 </indexterm>
60171 This is the keyword for the generic command line scanner interface. It can be
60172 used to attach virus scanners that are invoked from the shell. This scanner
60173 type takes 3 mandatory options:
60174 </para>
60175 <orderedlist numeration="arabic">
60176 <listitem>
60177 <para>
60178 The full path and name of the scanner binary, with all command line options,
60179 and a placeholder (<literal>%s</literal>) for the directory to scan.
60180 </para>
60181 </listitem>
60182 <listitem>
60183 <para>
60184 A regular expression to match against the STDOUT and STDERR output of the
60185 virus scanner. If the expression matches, a virus was found. You must make
60186 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
60187 the <quote>trigger</quote> expression.
60188 </para>
60189 </listitem>
60190 <listitem>
60191 <para>
60192 Another regular expression, containing exactly one pair of parentheses, to
60193 match the name of the virus found in the scanners output. This is called the
60194 <quote>name</quote> expression.
60195 </para>
60196 </listitem>
60197 </orderedlist>
60198 <para>
60199 For example, Sophos Sweep reports a virus on a line like this:
60200 </para>
60201 <literallayout class="monospaced">
60202 Virus 'W32/Magistr-B' found in file ./those.bat
60203 </literallayout>
60204 <para>
60205 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
60206 name expression, we want to extract the W32/Magistr-B string, so we can match
60207 for the single quotes left and right of it. Altogether, this makes the
60208 configuration setting:
60209 </para>
60210 <literallayout class="monospaced">
60211 av_scanner = cmdline:\
60212              /path/to/sweep -ss -all -rec -archive %s:\
60213              found in file:'(.+)'
60214 </literallayout>
60215 </listitem></varlistentry>
60216 <varlistentry>
60217 <term><option>drweb</option></term>
60218 <listitem>
60219 <para>
60220 <indexterm role="concept">
60221 <primary>virus scanners</primary>
60222 <secondary>DrWeb</secondary>
60223 </indexterm>
60224 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
60225 takes one option,
60226 either a full path to a UNIX socket,
60227 or host and port specifiers separated by white space.
60228 The host may be a name or an IP address; the port is either a
60229 single number or a pair of numbers with a dash between.
60230 For example:
60231 </para>
60232 <literallayout class="monospaced">
60233 av_scanner = drweb:/var/run/drwebd.sock
60234 av_scanner = drweb:192.168.2.20 31337
60235 </literallayout>
60236 <para>
60237 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
60238 is used. Thanks to Alex Miller for contributing the code for this scanner.
60239 </para>
60240 </listitem></varlistentry>
60241 <varlistentry>
60242 <term><option>f-protd</option></term>
60243 <listitem>
60244 <para>
60245 <indexterm role="concept">
60246 <primary>virus scanners</primary>
60247 <secondary>f-protd</secondary>
60248 </indexterm>
60249 The f-protd scanner is accessed via HTTP over TCP.
60250 One argument is taken, being a space-separated hostname and port number
60251 (or port-range).
60252 For example:
60253 </para>
60254 <literallayout class="monospaced">
60255 av_scanner = f-protd:localhost 10200-10204
60256 </literallayout>
60257 <para>
60258 If you omit the argument, the default values shown above are used.
60259 </para>
60260 </listitem></varlistentry>
60261 <varlistentry>
60262 <term><option>f-prot6d</option></term>
60263 <listitem>
60264 <para>
60265 <indexterm role="concept">
60266 <primary>virus scanners</primary>
60267 <secondary>f-prot6d</secondary>
60268 </indexterm>
60269 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
60270 One argument is taken, being a space-separated hostname and port number.
60271 For example:
60272 </para>
60273 <literallayout class="monospaced">
60274 av_scanner = f-prot6d:localhost 10200
60275 </literallayout>
60276 <para>
60277 If you omit the argument, the default values show above are used.
60278 </para>
60279 </listitem></varlistentry>
60280 <varlistentry>
60281 <term><option>fsecure</option></term>
60282 <listitem>
60283 <para>
60284 <indexterm role="concept">
60285 <primary>virus scanners</primary>
60286 <secondary>F-Secure</secondary>
60287 </indexterm>
60288 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
60289 argument which is the path to a UNIX socket. For example:
60290 </para>
60291 <literallayout class="monospaced">
60292 av_scanner = fsecure:/path/to/.fsav
60293 </literallayout>
60294 <para>
60295 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
60296 Thelmen for contributing the code for this scanner.
60297 </para>
60298 </listitem></varlistentry>
60299 <varlistentry>
60300 <term><option>kavdaemon</option></term>
60301 <listitem>
60302 <para>
60303 <indexterm role="concept">
60304 <primary>virus scanners</primary>
60305 <secondary>Kaspersky</secondary>
60306 </indexterm>
60307 This is the scanner daemon of Kaspersky Version 4. This version of the
60308 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
60309 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
60310 For example:
60311 </para>
60312 <literallayout class="monospaced">
60313 av_scanner = kavdaemon:/opt/AVP/AvpCtl
60314 </literallayout>
60315 <para>
60316 The default path is <filename>/var/run/AvpCtl</filename>.
60317 </para>
60318 </listitem></varlistentry>
60319 <varlistentry>
60320 <term><option>mksd</option></term>
60321 <listitem>
60322 <para>
60323 <indexterm role="concept">
60324 <primary>virus scanners</primary>
60325 <secondary>mksd</secondary>
60326 </indexterm>
60327 This is a daemon type scanner that is aimed mainly at Polish users, though some
60328 parts of documentation are now available in English. You can get it at
60329 <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
60330 the maximum number of processes used simultaneously to scan the attachments,
60331 provided that mksd has
60332 been run with at least the same number of child processes. For example:
60333 </para>
60334 <literallayout class="monospaced">
60335 av_scanner = mksd:2
60336 </literallayout>
60337 <para>
60338 You can safely omit this option (the default value is 1).
60339 </para>
60340 </listitem></varlistentry>
60341 <varlistentry>
60342 <term><option>sock</option></term>
60343 <listitem>
60344 <para>
60345 <indexterm role="concept">
60346 <primary>virus scanners</primary>
60347 <secondary>simple socket-connected</secondary>
60348 </indexterm>
60349 This is a general-purpose way of talking to simple scanner daemons
60350 running on the local machine.
60351 There are four options:
60352 an address (which may be an IP address and port, or the path of a Unix socket),
60353 a commandline to send (may include a single %s which will be replaced with
60354 the path to the mail file to be scanned),
60355 an RE to trigger on from the returned data,
60356 and an RE to extract malware_name from the returned data.
60357 For example:
60358 </para>
60359 <literallayout class="monospaced">
60360 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
60361 </literallayout>
60362 <para>
60363 Note that surrounding whitespace is stripped from each option, meaning
60364 there is no way to specify a trailing newline.
60365 The socket specifier and both regular-expressions are required.
60366 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
60367 specify an empty element to get this.
60368 </para>
60369 </listitem></varlistentry>
60370 <varlistentry>
60371 <term><option>sophie</option></term>
60372 <listitem>
60373 <para>
60374 <indexterm role="concept">
60375 <primary>virus scanners</primary>
60376 <secondary>Sophos and Sophie</secondary>
60377 </indexterm>
60378 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
60379 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
60380 for this scanner type is the path to the UNIX socket that Sophie uses for
60381 client communication. For example:
60382 </para>
60383 <literallayout class="monospaced">
60384 av_scanner = sophie:/tmp/sophie
60385 </literallayout>
60386 <para>
60387 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
60388 the option.
60389 </para>
60390 </listitem></varlistentry>
60391 </variablelist>
60392 <para>
60393 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
60394 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
60395 ACL.
60396 </para>
60397 <para>
60398 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
60399 makes it possible to use different scanners. See further below for an example.
60400 The <option>malware</option> condition caches its results, so when you use it multiple times
60401 for the same message, the actual scanning process is only carried out once.
60402 However, using expandable items in <option>av_scanner</option> disables this caching, in
60403 which case each use of the <option>malware</option> condition causes a new scan of the
60404 message.
60405 </para>
60406 <para>
60407 The <option>malware</option> condition takes a right-hand argument that is expanded before
60408 use and taken as a list, slash-separated by default.
60409 The first element can then be one of
60410 </para>
60411 <itemizedlist>
60412 <listitem>
60413 <para>
60414 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
60415 The condition succeeds if a virus was found, and fail otherwise. This is the
60416 recommended usage.
60417 </para>
60418 </listitem>
60419 <listitem>
60420 <para>
60421 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
60422 the condition fails immediately.
60423 </para>
60424 </listitem>
60425 <listitem>
60426 <para>
60427 A regular expression, in which case the message is scanned for viruses. The
60428 condition succeeds if a virus is found and its name matches the regular
60429 expression. This allows you to take special actions on certain types of virus.
60430 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
60431 unless the separator is changed (in the usual way).
60432 </para>
60433 </listitem>
60434 </itemizedlist>
60435 <para>
60436 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
60437 messages even if there is a problem with the virus scanner.
60438 Otherwise, such a problem causes the ACL to defer.
60439 </para>
60440 <para>
60441 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
60442 specify a non-default timeout.  The default is two minutes.
60443 For example:
60444 </para>
60445 <literallayout class="monospaced">
60446 malware = * / defer_ok / tmo=10s
60447 </literallayout>
60448 <para>
60449 A timeout causes the ACL to defer.
60450 </para>
60451 <para>
60452 <indexterm role="variable">
60453 <primary><varname>$callout_address</varname></primary>
60454 </indexterm>
60455 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
60456 is set to record the actual address used.
60457 </para>
60458 <para>
60459 <indexterm role="variable">
60460 <primary><varname>$malware_name</varname></primary>
60461 </indexterm>
60462 When a virus is found, the condition sets up an expansion variable called
60463 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
60464 <option>message</option> modifier that specifies the error returned to the sender, and/or in
60465 logging data.
60466 </para>
60467 <para>
60468 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
60469 imposed by your anti-virus scanner.
60470 </para>
60471 <para>
60472 Here is a very simple scanning example:
60473 </para>
60474 <literallayout class="monospaced">
60475 deny message = This message contains malware ($malware_name)
60476      malware = *
60477 </literallayout>
60478 <para>
60479 The next example accepts messages when there is a problem with the scanner:
60480 </para>
60481 <literallayout class="monospaced">
60482 deny message = This message contains malware ($malware_name)
60483      malware = */defer_ok
60484 </literallayout>
60485 <para>
60486 The next example shows how to use an ACL variable to scan with both sophie and
60487 aveserver. It assumes you have set:
60488 </para>
60489 <literallayout class="monospaced">
60490 av_scanner = $acl_m0
60491 </literallayout>
60492 <para>
60493 in the main Exim configuration.
60494 </para>
60495 <literallayout class="monospaced">
60496 deny message = This message contains malware ($malware_name)
60497      set acl_m0 = sophie
60498      malware = *
60499
60500 deny message = This message contains malware ($malware_name)
60501      set acl_m0 = aveserver
60502      malware = *
60503 </literallayout>
60504 </section>
60505 <section id="SECTscanspamass">
60506 <title>Scanning with SpamAssassin and Rspamd</title>
60507 <para>
60508 <indexterm role="concept">
60509 <primary>content scanning</primary>
60510 <secondary>for spam</secondary>
60511 </indexterm>
60512 <indexterm role="concept">
60513 <primary>spam scanning</primary>
60514 </indexterm>
60515 <indexterm role="concept">
60516 <primary>SpamAssassin</primary>
60517 </indexterm>
60518 <indexterm role="concept">
60519 <primary>Rspamd</primary>
60520 </indexterm>
60521 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
60522 score and a report for the message.
60523 Support is also provided for Rspamd.
60524 </para>
60525 <para>
60526 For more information about installation and configuration of SpamAssassin or
60527 Rspamd refer to their respective websites at
60528 <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>
60529 </para>
60530 <para>
60531 SpamAssassin can be installed with CPAN by running:
60532 </para>
60533 <literallayout class="monospaced">
60534 perl -MCPAN -e 'install Mail::SpamAssassin'
60535 </literallayout>
60536 <para>
60537 SpamAssassin has its own set of configuration files. Please review its
60538 documentation to see how you can tweak it. The default installation should work
60539 nicely, however.
60540 </para>
60541 <para>
60542 <indexterm role="option">
60543 <primary><option>spamd_address</option></primary>
60544 </indexterm>
60545 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
60546 intend to use an instance running on the local host you do not need to set
60547 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
60548 you must set the <option>spamd_address</option> option in the global part of the Exim
60549 configuration as follows (example):
60550 </para>
60551 <literallayout class="monospaced">
60552 spamd_address = 192.168.99.45 387
60553 </literallayout>
60554 <para>
60555 The SpamAssassin protocol relies on a TCP half-close from the client.
60556 If your SpamAssassin client side is running a Linux system with an
60557 iptables firewall, consider setting
60558 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
60559 timeout, Exim uses when waiting for a response from the SpamAssassin
60560 server (currently defaulting to 120s).  With a lower value the Linux
60561 connection tracking may consider your half-closed connection as dead too
60562 soon.
60563 </para>
60564 <para>
60565 To use Rspamd (which by default listens on all local addresses
60566 on TCP port 11333)
60567 you should add <option>variant=rspamd</option> after the address/port pair, for example:
60568 </para>
60569 <literallayout class="monospaced">
60570 spamd_address = 127.0.0.1 11333 variant=rspamd
60571 </literallayout>
60572 <para>
60573 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
60574 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
60575 file name instead of an address/port pair:
60576 </para>
60577 <literallayout class="monospaced">
60578 spamd_address = /var/run/spamd_socket
60579 </literallayout>
60580 <para>
60581 You can have multiple <option>spamd</option> servers to improve scalability. These can
60582 reside on other hardware reachable over the network. To specify multiple
60583 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
60584 option, separated with colons (the separator can be changed in the usual way):
60585 </para>
60586 <literallayout class="monospaced">
60587 spamd_address = 192.168.2.10 783 : \
60588                 192.168.2.11 783 : \
60589                 192.168.2.12 783
60590 </literallayout>
60591 <para>
60592 Up to 32 <option>spamd</option> servers are supported.
60593 When a server fails to respond to the connection attempt, all other
60594 servers are tried until one succeeds. If no server responds, the <option>spam</option>
60595 condition defers.
60596 </para>
60597 <para>
60598 Unix and TCP socket specifications may be mixed in any order.
60599 Each element of the list is a list itself, space-separated by default
60600 and changeable in the usual way; take care to not double the separator.
60601 </para>
60602 <para>
60603 For TCP socket specifications a host name or IP (v4 or v6, but
60604 subject to list-separator quoting rules) address can be used,
60605 and the port can be one or a dash-separated pair.
60606 In the latter case, the range is tried in strict order.
60607 </para>
60608 <para>
60609 Elements after the first for Unix sockets, or second for TCP socket,
60610 are options.
60611 The supported options are:
60612 </para>
60613 <literallayout class="monospaced">
60614 pri=&lt;priority&gt;      Selection priority
60615 weight=&lt;value&gt;      Selection bias
60616 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
60617 retry=&lt;timespec&gt;    Retry on connect fail
60618 tmo=&lt;timespec&gt;      Connection time limit
60619 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
60620 </literallayout>
60621 <para>
60622 The <literal>pri</literal> option specifies a priority for the server within the list,
60623 higher values being tried first.
60624 The default priority is 1.
60625 </para>
60626 <para>
60627 The <literal>weight</literal> option specifies a selection bias.
60628 Within a priority set
60629 servers are queried in a random fashion, weighted by this value.
60630 The default value for selection bias is 1.
60631 </para>
60632 <para>
60633 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
60634 in the local time zone; each element being one or more digits.
60635 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
60636 characters, may be omitted and will be taken as zero.
60637 </para>
60638 <para>
60639 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
60640 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
60641 </para>
60642 <para>
60643 The <literal>tmo</literal> option specifies an overall timeout for communication.
60644 The default value is two minutes.
60645 </para>
60646 <para>
60647 The <literal>retry</literal> option specifies a time after which a single retry for
60648 a failed connect is made.
60649 The default is to not retry.
60650 </para>
60651 <para>
60652 The <option>spamd_address</option> variable is expanded before use if it starts with
60653 a dollar sign. In this case, the expansion may return a string that is
60654 used as the list so that multiple spamd servers can be the result of an
60655 expansion.
60656 </para>
60657 <para>
60658 <indexterm role="variable">
60659 <primary><varname>$callout_address</varname></primary>
60660 </indexterm>
60661 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
60662 is set to record the actual address used.
60663 </para>
60664 </section>
60665 <section id="SECID206">
60666 <title>Calling SpamAssassin from an Exim ACL</title>
60667 <para>
60668 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
60669 </para>
60670 <literallayout class="monospaced">
60671 deny message = This message was classified as SPAM
60672      spam = joe
60673 </literallayout>
60674 <para>
60675 The right-hand side of the <option>spam</option> condition specifies a name. This is
60676 relevant if you have set up multiple SpamAssassin profiles. If you do not want
60677 to scan using a specific profile, but rather use the SpamAssassin system-wide
60678 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
60679 Rspamd does not use this setting. However, you must put something on the
60680 right-hand side.
60681 </para>
60682 <para>
60683 The name allows you to use per-domain or per-user antispam profiles in
60684 principle, but this is not straightforward in practice, because a message may
60685 have multiple recipients, not necessarily all in the same domain. Because the
60686 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
60687 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
60688 are not set.
60689 Careful enforcement of single-recipient messages
60690 (e.g. by responding with defer in the recipient ACL for all recipients
60691 after the first),
60692 or the use of PRDR,
60693 <indexterm role="concept">
60694 <primary>PRDR</primary>
60695 <secondary>use for per-user SpamAssassin profiles</secondary>
60696 </indexterm>
60697 are needed to use this feature.
60698 </para>
60699 <para>
60700 The right-hand side of the <option>spam</option> condition is expanded before being used, so
60701 you can put lookups or conditions there. When the right-hand side evaluates to
60702 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
60703 </para>
60704 <para>
60705 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
60706 large ones may cause significant performance degradation. As most spam messages
60707 are quite small, it is recommended that you do not scan the big ones. For
60708 example:
60709 </para>
60710 <literallayout class="monospaced">
60711 deny message = This message was classified as SPAM
60712      condition = ${if &lt; {$message_size}{10K}}
60713      spam = nobody
60714 </literallayout>
60715 <para>
60716 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
60717 SpamAssassin profile has been matched or exceeded. If you want to use the
60718 <option>spam</option> condition for its side effects (see the variables below), you can make
60719 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
60720 </para>
60721 <para>
60722 <indexterm role="concept">
60723 <primary>spam scanning</primary>
60724 <secondary>returned variables</secondary>
60725 </indexterm>
60726 When the <option>spam</option> condition is run, it sets up a number of expansion
60727 variables.
60728 Except for <varname>$spam_report</varname>,
60729 these variables are saved with the received message so are
60730 available for use at delivery time.
60731 </para>
60732 <variablelist>
60733 <varlistentry>
60734 <term><varname>$spam_score</varname></term>
60735 <listitem>
60736 <para>
60737 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
60738 for inclusion in log or reject messages.
60739 </para>
60740 </listitem></varlistentry>
60741 <varlistentry>
60742 <term><varname>$spam_score_int</varname></term>
60743 <listitem>
60744 <para>
60745 The spam score of the message, multiplied by ten, as an integer value. For
60746 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
60747 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
60748 The integer value is useful for numeric comparisons in conditions.
60749 </para>
60750 </listitem></varlistentry>
60751 <varlistentry>
60752 <term><varname>$spam_bar</varname></term>
60753 <listitem>
60754 <para>
60755 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
60756 integer part of the spam score value. A spam score of 4.4 would have a
60757 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
60758 headers, since MUAs can match on such strings. The maximum length of the
60759 spam bar is 50 characters.
60760 </para>
60761 </listitem></varlistentry>
60762 <varlistentry>
60763 <term><varname>$spam_report</varname></term>
60764 <listitem>
60765 <para>
60766 A multiline text table, containing the full SpamAssassin report for the
60767 message. Useful for inclusion in headers or reject messages.
60768 This variable is only usable in a DATA-time ACL.
60769 Beware that SpamAssassin may return non-ASCII characters, especially
60770 when running in country-specific locales, which are not legal
60771 unencoded in headers.
60772 </para>
60773 </listitem></varlistentry>
60774 <varlistentry>
60775 <term><varname>$spam_action</varname></term>
60776 <listitem>
60777 <para>
60778 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
60779 spam score versus threshold.
60780 For Rspamd, the recommended action.
60781 </para>
60782 </listitem></varlistentry>
60783 </variablelist>
60784 <para>
60785 The <option>spam</option> condition caches its results unless expansion in
60786 spamd_address was used. If you call it again with the same user name, it
60787 does not scan again, but rather returns the same values as before.
60788 </para>
60789 <para>
60790 The <option>spam</option> condition returns DEFER if there is any error while running
60791 the message through SpamAssassin or if the expansion of spamd_address
60792 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
60793 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
60794 spam condition, like this:
60795 </para>
60796 <literallayout class="monospaced">
60797 deny message = This message was classified as SPAM
60798      spam    = joe/defer_ok
60799 </literallayout>
60800 <para>
60801 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
60802 </para>
60803 <para>
60804 Here is a longer, commented example of the use of the <option>spam</option>
60805 condition:
60806 </para>
60807 <literallayout class="monospaced">
60808 # put headers in all messages (no matter if spam or not)
60809 warn  spam = nobody:true
60810       add_header = X-Spam-Score: $spam_score ($spam_bar)
60811       add_header = X-Spam-Report: $spam_report
60812
60813 # add second subject line with *SPAM* marker when message
60814 # is over threshold
60815 warn  spam = nobody
60816       add_header = Subject: *SPAM* $h_Subject:
60817
60818 # reject spam at high scores (&gt; 12)
60819 deny  message = This message scored $spam_score spam points.
60820       spam = nobody:true
60821       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
60822 </literallayout>
60823 </section>
60824 <section id="SECTscanmimepart">
60825 <title>Scanning MIME parts</title>
60826 <para>
60827 <indexterm role="concept">
60828 <primary>content scanning</primary>
60829 <secondary>MIME parts</secondary>
60830 </indexterm>
60831 <indexterm role="concept">
60832 <primary>MIME content scanning</primary>
60833 </indexterm>
60834 <indexterm role="option">
60835 <primary><option>acl_smtp_mime</option></primary>
60836 </indexterm>
60837 <indexterm role="option">
60838 <primary><option>acl_not_smtp_mime</option></primary>
60839 </indexterm>
60840 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
60841 each MIME part of an SMTP message, including multipart types, in the sequence
60842 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
60843 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
60844 options may both refer to the same ACL if you want the same processing in both
60845 cases.
60846 </para>
60847 <para>
60848 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
60849 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
60850 the case of a non-SMTP message. However, a MIME ACL is called only if the
60851 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
60852 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
60853 result code is sent to the client. In the case of an SMTP message, the
60854 <option>acl_smtp_data</option> ACL is not called when this happens.
60855 </para>
60856 <para>
60857 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
60858 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
60859 condition to match against the raw MIME part. You can also use the
60860 <option>mime_regex</option> condition to match against the decoded MIME part (see section
60861 <xref linkend="SECTscanregex"/>).
60862 </para>
60863 <para>
60864 At the start of a MIME ACL, a number of variables are set from the header
60865 information for the relevant MIME part. These are described below. The contents
60866 of the MIME part are not by default decoded into a disk file except for MIME
60867 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
60868 part into a disk file, you can use the <option>decode</option> condition. The general
60869 syntax is:
60870 </para>
60871 <literallayout>
60872 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
60873 </literallayout>
60874 <para>
60875 The right hand side is expanded before use. After expansion,
60876 the value can be:
60877 </para>
60878 <orderedlist numeration="arabic">
60879 <listitem>
60880 <para>
60881 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
60882 </para>
60883 </listitem>
60884 <listitem>
60885 <para>
60886 The string <quote>default</quote>. In that case, the file is put in the temporary
60887 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
60888 a sequential file name consisting of the message id and a sequence number. The
60889 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
60890 </para>
60891 </listitem>
60892 <listitem>
60893 <para>
60894 A full path name starting with a slash. If the full name is an existing
60895 directory, it is used as a replacement for the default directory. The filename
60896 is then sequentially assigned. If the path does not exist, it is used as
60897 the full path and file name.
60898 </para>
60899 </listitem>
60900 <listitem>
60901 <para>
60902 If the string does not start with a slash, it is used as the
60903 filename, and the default path is then used.
60904 </para>
60905 </listitem>
60906 </orderedlist>
60907 <para>
60908 The <option>decode</option> condition normally succeeds. It is only false for syntax
60909 errors or unusual circumstances such as memory shortages. You can easily decode
60910 a file with its original, proposed filename using
60911 </para>
60912 <literallayout class="monospaced">
60913 decode = $mime_filename
60914 </literallayout>
60915 <para>
60916 However, you should keep in mind that <varname>$mime_filename</varname> might contain
60917 anything. If you place files outside of the default path, they are not
60918 automatically unlinked.
60919 </para>
60920 <para>
60921 For RFC822 attachments (these are messages attached to messages, with a
60922 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
60923 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
60924 variable is set (see below). Attached messages are always decoded to disk
60925 before being checked, and the files are unlinked once the check is done.
60926 </para>
60927 <para>
60928 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
60929 used to match regular expressions against raw and decoded MIME parts,
60930 respectively. They are described in section <xref linkend="SECTscanregex"/>.
60931 </para>
60932 <para>
60933 <indexterm role="concept">
60934 <primary>MIME content scanning</primary>
60935 <secondary>returned variables</secondary>
60936 </indexterm>
60937 The following list describes all expansion variables that are
60938 available in the MIME ACL:
60939 </para>
60940 <variablelist>
60941 <varlistentry>
60942 <term><varname>$mime_boundary</varname></term>
60943 <listitem>
60944 <para>
60945 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
60946 have a boundary string, which is stored in this variable. If the current part
60947 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
60948 contains the empty string.
60949 </para>
60950 </listitem></varlistentry>
60951 <varlistentry>
60952 <term><varname>$mime_charset</varname></term>
60953 <listitem>
60954 <para>
60955 This variable contains the character set identifier, if one was found in the
60956 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
60957 </para>
60958 <literallayout class="monospaced">
60959 us-ascii
60960 gb2312 (Chinese)
60961 iso-8859-1
60962 </literallayout>
60963 <para>
60964 Please note that this value is not normalized, so you should do matches
60965 case-insensitively.
60966 </para>
60967 </listitem></varlistentry>
60968 <varlistentry>
60969 <term><varname>$mime_content_description</varname></term>
60970 <listitem>
60971 <para>
60972 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
60973 header. It can contain a human-readable description of the parts content. Some
60974 implementations repeat the filename for attachments here, but they are usually
60975 only used for display purposes.
60976 </para>
60977 </listitem></varlistentry>
60978 <varlistentry>
60979 <term><varname>$mime_content_disposition</varname></term>
60980 <listitem>
60981 <para>
60982 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
60983 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
60984 </para>
60985 </listitem></varlistentry>
60986 <varlistentry>
60987 <term><varname>$mime_content_id</varname></term>
60988 <listitem>
60989 <para>
60990 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
60991 This is a unique ID that can be used to reference a part from another part.
60992 </para>
60993 </listitem></varlistentry>
60994 <varlistentry>
60995 <term><varname>$mime_content_size</varname></term>
60996 <listitem>
60997 <para>
60998 This variable is set only after the <option>decode</option> modifier (see above) has been
60999 successfully run. It contains the size of the decoded part in kilobytes. The
61000 size is always rounded up to full kilobytes, so only a completely empty part
61001 has a <varname>$mime_content_size</varname> of zero.
61002 </para>
61003 </listitem></varlistentry>
61004 <varlistentry>
61005 <term><varname>$mime_content_transfer_encoding</varname></term>
61006 <listitem>
61007 <para>
61008 This variable contains the normalized content of the
61009 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
61010 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
61011 </para>
61012 </listitem></varlistentry>
61013 <varlistentry>
61014 <term><varname>$mime_content_type</varname></term>
61015 <listitem>
61016 <para>
61017 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
61018 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
61019 are some examples of popular MIME types, as they may appear in this variable:
61020 </para>
61021 <literallayout class="monospaced">
61022 text/plain
61023 text/html
61024 application/octet-stream
61025 image/jpeg
61026 audio/midi
61027 </literallayout>
61028 <para>
61029 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
61030 empty string.
61031 </para>
61032 </listitem></varlistentry>
61033 <varlistentry>
61034 <term><varname>$mime_decoded_filename</varname></term>
61035 <listitem>
61036 <para>
61037 This variable is set only after the <option>decode</option> modifier (see above) has been
61038 successfully run. It contains the full path and file name of the file
61039 containing the decoded data.
61040 </para>
61041 </listitem></varlistentry>
61042 </variablelist>
61043 <para>
61044 <indexterm role="concept">
61045 <primary>RFC 2047</primary>
61046 </indexterm>
61047 </para>
61048 <variablelist>
61049 <varlistentry>
61050 <term><varname>$mime_filename</varname></term>
61051 <listitem>
61052 <para>
61053 This is perhaps the most important of the MIME variables. It contains a
61054 proposed filename for an attachment, if one was found in either the
61055 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
61056 RFC2047
61057 or RFC2231
61058 decoded, but no additional sanity checks are done.
61059  If no filename was
61060 found, this variable contains the empty string.
61061 </para>
61062 </listitem></varlistentry>
61063 <varlistentry>
61064 <term><varname>$mime_is_coverletter</varname></term>
61065 <listitem>
61066 <para>
61067 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
61068 attached data. It can be used to clamp down on flashy or unnecessarily encoded
61069 content in the cover letter, while not restricting attachments at all.
61070 </para>
61071 <para>
61072 The variable contains 1 (true) for a MIME part believed to be part of the
61073 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
61074 follows:
61075 </para>
61076 <orderedlist numeration="arabic">
61077 <listitem>
61078 <para>
61079 The outermost MIME part of a message is always a cover letter.
61080 </para>
61081 </listitem>
61082 <listitem>
61083 <para>
61084 If a multipart/alternative or multipart/related MIME part is a cover letter,
61085 so are all MIME subparts within that multipart.
61086 </para>
61087 </listitem>
61088 <listitem>
61089 <para>
61090 If any other multipart is a cover letter, the first subpart is a cover letter,
61091 and the rest are attachments.
61092 </para>
61093 </listitem>
61094 <listitem>
61095 <para>
61096 All parts contained within an attachment multipart are attachments.
61097 </para>
61098 </listitem>
61099 </orderedlist>
61100 <para>
61101 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
61102 alternative plain text), while allowing HTML files to be attached. HTML
61103 coverletter mail attached to non-HTML coverletter mail will also be allowed:
61104 </para>
61105 <literallayout class="monospaced">
61106 deny message = HTML mail is not accepted here
61107 !condition = $mime_is_rfc822
61108 condition = $mime_is_coverletter
61109 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
61110 </literallayout>
61111 </listitem></varlistentry>
61112 <varlistentry>
61113 <term><varname>$mime_is_multipart</varname></term>
61114 <listitem>
61115 <para>
61116 This variable has the value 1 (true) when the current part has the main type
61117 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
61118 Since multipart entities only serve as containers for other parts, you may not
61119 want to carry out specific actions on them.
61120 </para>
61121 </listitem></varlistentry>
61122 <varlistentry>
61123 <term><varname>$mime_is_rfc822</varname></term>
61124 <listitem>
61125 <para>
61126 This variable has the value 1 (true) if the current part is not a part of the
61127 checked message itself, but part of an attached message. Attached message
61128 decoding is fully recursive.
61129 </para>
61130 </listitem></varlistentry>
61131 <varlistentry>
61132 <term><varname>$mime_part_count</varname></term>
61133 <listitem>
61134 <para>
61135 This variable is a counter that is raised for each processed MIME part. It
61136 starts at zero for the very first part (which is usually a multipart). The
61137 counter is per-message, so it is reset when processing RFC822 attachments (see
61138 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
61139 complete, so you can use it in the DATA ACL to determine the number of MIME
61140 parts of a message. For non-MIME messages, this variable contains the value -1.
61141 </para>
61142 </listitem></varlistentry>
61143 </variablelist>
61144 </section>
61145 <section id="SECTscanregex">
61146 <title>Scanning with regular expressions</title>
61147 <para>
61148 <indexterm role="concept">
61149 <primary>content scanning</primary>
61150 <secondary>with regular expressions</secondary>
61151 </indexterm>
61152 <indexterm role="concept">
61153 <primary>regular expressions</primary>
61154 <secondary>content scanning with</secondary>
61155 </indexterm>
61156 You can specify your own custom regular expression matches on the full body of
61157 the message, or on individual MIME parts.
61158 </para>
61159 <para>
61160 The <option>regex</option> condition takes one or more regular expressions as arguments and
61161 matches them against the full message (when called in the DATA ACL) or a raw
61162 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
61163 linewise, with a maximum line length of 32K characters. That means you cannot
61164 have multiline matches with the <option>regex</option> condition.
61165 </para>
61166 <para>
61167 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
61168 to 32K of decoded content (the whole content at once, not linewise). If the
61169 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
61170 is decoded automatically when <option>mime_regex</option> is executed (using default path
61171 and filename values). If the decoded data is larger than  32K, only the first
61172 32K characters are checked.
61173 </para>
61174 <para>
61175 The regular expressions are passed as a colon-separated list. To include a
61176 literal colon, you must double it. Since the whole right-hand side string is
61177 expanded before being used, you must also escape dollar signs and backslashes
61178 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
61179 Here is a simple example that contains two regular expressions:
61180 </para>
61181 <literallayout class="monospaced">
61182 deny message = contains blacklisted regex ($regex_match_string)
61183      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
61184 </literallayout>
61185 <para>
61186 The conditions returns true if any one of the regular expressions matches. The
61187 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
61188 matching regular expression.
61189 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
61190 are set to any substrings captured by the regular expression.
61191 </para>
61192 <para>
61193 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
61194 CPU-intensive.
61195 </para>
61196 <para>
61197 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
61198 </para>
61199 </section>
61200 </chapter>
61201
61202 <chapter id="CHAPlocalscan">
61203 <title>Adding a local scan function to Exim</title>
61204 <titleabbrev>Local scan function</titleabbrev>
61205 <para>
61206 <indexterm role="concept" id="IIDlosca" class="startofrange">
61207 <primary><function>local_scan()</function> function</primary>
61208 <secondary>description of</secondary>
61209 </indexterm>
61210 <indexterm role="concept">
61211 <primary>customizing</primary>
61212 <secondary>input scan using C function</secondary>
61213 </indexterm>
61214 <indexterm role="concept">
61215 <primary>policy control</primary>
61216 <secondary>by local scan function</secondary>
61217 </indexterm>
61218 In these days of email worms, viruses, and ever-increasing spam, some sites
61219 want to apply a lot of checking to messages before accepting them.
61220 </para>
61221 <para>
61222 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
61223 passing messages to external virus and spam scanning software. You can also do
61224 a certain amount in Exim itself through string expansions and the <option>condition</option>
61225 condition in the ACL that runs after the SMTP DATA command or the ACL for
61226 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
61227 </para>
61228 <para>
61229 To allow for further customization to a site&#x2019;s own requirements, there is the
61230 possibility of linking Exim with a private message scanning function, written
61231 in C. If you want to run code that is written in something other than C, you
61232 can of course use a little C stub to call it.
61233 </para>
61234 <para>
61235 The local scan function is run once for every incoming message, at the point
61236 when Exim is just about to accept the message.
61237 It can therefore be used to control non-SMTP messages from local processes as
61238 well as messages arriving via SMTP.
61239 </para>
61240 <para>
61241 Exim applies a timeout to calls of the local scan function, and there is an
61242 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
61243 Zero means <quote>no timeout</quote>.
61244 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
61245 before calling the local scan function, so that the most common types of crash
61246 are caught. If the timeout is exceeded or one of those signals is caught, the
61247 incoming message is rejected with a temporary error if it is an SMTP message.
61248 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
61249 code. The incident is logged on the main and reject logs.
61250 </para>
61251 <section id="SECID207">
61252 <title>Building Exim to use a local scan function</title>
61253 <para>
61254 <indexterm role="concept">
61255 <primary><function>local_scan()</function> function</primary>
61256 <secondary>building Exim to use</secondary>
61257 </indexterm>
61258 To make use of the local scan function feature, you must tell Exim where your
61259 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
61260 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
61261 directory, so you might set
61262 </para>
61263 <literallayout class="monospaced">
61264 LOCAL_SCAN_SOURCE=Local/local_scan.c
61265 </literallayout>
61266 <para>
61267 for example. The function must be called <function>local_scan()</function>. It is called by
61268 Exim after it has received a message, when the success return code is about to
61269 be sent. This is after all the ACLs have been run. The return code from your
61270 function controls whether the message is actually accepted or not. There is a
61271 commented template function (that just accepts the message) in the file
61272 _src/local_scan.c_.
61273 </para>
61274 <para>
61275 If you want to make use of Exim&#x2019;s run time configuration file to set options
61276 for your <function>local_scan()</function> function, you must also set
61277 </para>
61278 <literallayout class="monospaced">
61279 LOCAL_SCAN_HAS_OPTIONS=yes
61280 </literallayout>
61281 <para>
61282 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
61283 </para>
61284 </section>
61285 <section id="SECTapiforloc">
61286 <title>API for local_scan()</title>
61287 <para>
61288 <indexterm role="concept">
61289 <primary><function>local_scan()</function> function</primary>
61290 <secondary>API description</secondary>
61291 </indexterm>
61292 You must include this line near the start of your code:
61293 </para>
61294 <literallayout class="monospaced">
61295 #include "local_scan.h"
61296 </literallayout>
61297 <para>
61298 This header file defines a number of variables and other values, and the
61299 prototype for the function itself. Exim is coded to use unsigned char values
61300 almost exclusively, and one of the things this header defines is a shorthand
61301 for <literal>unsigned char</literal> called <literal>uschar</literal>.
61302 It also contains the following macro definitions, to simplify casting character
61303 strings and pointers to character strings:
61304 </para>
61305 <literallayout class="monospaced">
61306 #define CS   (char *)
61307 #define CCS  (const char *)
61308 #define CSS  (char **)
61309 #define US   (unsigned char *)
61310 #define CUS  (const unsigned char *)
61311 #define USS  (unsigned char **)
61312 </literallayout>
61313 <para>
61314 The function prototype for <function>local_scan()</function> is:
61315 </para>
61316 <literallayout class="monospaced">
61317 extern int local_scan(int fd, uschar **return_text);
61318 </literallayout>
61319 <para>
61320 The arguments are as follows:
61321 </para>
61322 <itemizedlist>
61323 <listitem>
61324 <para>
61325 <option>fd</option> is a file descriptor for the file that contains the body of the message
61326 (the -D file). The file is open for reading and writing, but updating it is not
61327 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
61328 </para>
61329 <para>
61330 The descriptor is positioned at character 19 of the file, which is the first
61331 character of the body itself, because the first 19 characters are the message
61332 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
61333 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
61334 case this changes in some future version.
61335 </para>
61336 </listitem>
61337 <listitem>
61338 <para>
61339 <option>return_text</option> is an address which you can use to return a pointer to a text
61340 string at the end of the function. The value it points to on entry is NULL.
61341 </para>
61342 </listitem>
61343 </itemizedlist>
61344 <para>
61345 The function must return an <option>int</option> value which is one of the following macros:
61346 </para>
61347 <variablelist>
61348 <varlistentry>
61349 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
61350 <listitem>
61351 <para>
61352 <indexterm role="variable">
61353 <primary><varname>$local_scan_data</varname></primary>
61354 </indexterm>
61355 The message is accepted. If you pass back a string of text, it is saved with
61356 the message, and made available in the variable <varname>$local_scan_data</varname>. No
61357 newlines are permitted (if there are any, they are turned into spaces) and the
61358 maximum length of text is 1000 characters.
61359 </para>
61360 </listitem></varlistentry>
61361 <varlistentry>
61362 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
61363 <listitem>
61364 <para>
61365 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
61366 queued without immediate delivery, and is frozen.
61367 </para>
61368 </listitem></varlistentry>
61369 <varlistentry>
61370 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
61371 <listitem>
61372 <para>
61373 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
61374 queued without immediate delivery.
61375 </para>
61376 </listitem></varlistentry>
61377 <varlistentry>
61378 <term><literal>LOCAL_SCAN_REJECT</literal></term>
61379 <listitem>
61380 <para>
61381 The message is rejected; the returned text is used as an error message which is
61382 passed back to the sender and which is also logged. Newlines are permitted &ndash;
61383 they cause a multiline response for SMTP rejections, but are converted to
61384 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
61385 used.
61386 </para>
61387 </listitem></varlistentry>
61388 <varlistentry>
61389 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
61390 <listitem>
61391 <para>
61392 The message is temporarily rejected; the returned text is used as an error
61393 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
61394 problem</quote> is used.
61395 </para>
61396 </listitem></varlistentry>
61397 <varlistentry>
61398 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
61399 <listitem>
61400 <para>
61401 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
61402 message is not written to the reject log. It has the effect of unsetting the
61403 <option>rejected_header</option> log selector for just this rejection. If
61404 <option>rejected_header</option> is already unset (see the discussion of the
61405 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
61406 same as LOCAL_SCAN_REJECT.
61407 </para>
61408 </listitem></varlistentry>
61409 <varlistentry>
61410 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
61411 <listitem>
61412 <para>
61413 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
61414 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
61415 </para>
61416 </listitem></varlistentry>
61417 </variablelist>
61418 <para>
61419 If the message is not being received by interactive SMTP, rejections are
61420 reported by writing to <option>stderr</option> or by sending an email, as configured by the
61421 <option>-oe</option> command line options.
61422 </para>
61423 </section>
61424 <section id="SECTconoptloc">
61425 <title>Configuration options for local_scan()</title>
61426 <para>
61427 <indexterm role="concept">
61428 <primary><function>local_scan()</function> function</primary>
61429 <secondary>configuration options</secondary>
61430 </indexterm>
61431 It is possible to have option settings in the main configuration file
61432 that set values in static variables in the <function>local_scan()</function> module. If you
61433 want to do this, you must have the line
61434 </para>
61435 <literallayout class="monospaced">
61436 LOCAL_SCAN_HAS_OPTIONS=yes
61437 </literallayout>
61438 <para>
61439 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
61440 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
61441 file, you must define static variables to hold the option values, and a table
61442 to define them.
61443 </para>
61444 <para>
61445 The table must be a vector called <option>local_scan_options</option>, of type
61446 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
61447 and a pointer to the variable that holds the value. The entries must appear in
61448 alphabetical order. Following <option>local_scan_options</option> you must also define a
61449 variable called <option>local_scan_options_count</option> that contains the number of
61450 entries in the table. Here is a short example, showing two kinds of option:
61451 </para>
61452 <literallayout class="monospaced">
61453 static int my_integer_option = 42;
61454 static uschar *my_string_option = US"a default string";
61455
61456 optionlist local_scan_options[] = {
61457   { "my_integer", opt_int,       &amp;my_integer_option },
61458   { "my_string",  opt_stringptr, &amp;my_string_option }
61459 };
61460
61461 int local_scan_options_count =
61462   sizeof(local_scan_options)/sizeof(optionlist);
61463 </literallayout>
61464 <para>
61465 The values of the variables can now be changed from Exim&#x2019;s runtime
61466 configuration file by including a local scan section as in this example:
61467 </para>
61468 <literallayout class="monospaced">
61469 begin local_scan
61470 my_integer = 99
61471 my_string = some string of text...
61472 </literallayout>
61473 <para>
61474 The available types of option data are as follows:
61475 </para>
61476 <variablelist>
61477 <varlistentry>
61478 <term><emphasis role="bold">opt_bool</emphasis></term>
61479 <listitem>
61480 <para>
61481 This specifies a boolean (true/false) option. The address should point to a
61482 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
61483 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
61484 whether such a variable has been set at all, you can initialize it to
61485 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
61486 values.)
61487 </para>
61488 </listitem></varlistentry>
61489 <varlistentry>
61490 <term><emphasis role="bold">opt_fixed</emphasis></term>
61491 <listitem>
61492 <para>
61493 This specifies a fixed point number, such as is used for load averages.
61494 The address should point to a variable of type <literal>int</literal>. The value is stored
61495 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
61496 </para>
61497 </listitem></varlistentry>
61498 <varlistentry>
61499 <term><emphasis role="bold">opt_int</emphasis></term>
61500 <listitem>
61501 <para>
61502 This specifies an integer; the address should point to a variable of type
61503 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
61504 Exim.
61505 </para>
61506 </listitem></varlistentry>
61507 <varlistentry>
61508 <term><emphasis role="bold">opt_mkint</emphasis></term>
61509 <listitem>
61510 <para>
61511 This is the same as <option>opt_int</option>, except that when such a value is output in a
61512 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
61513 printed with the suffix K or M.
61514 </para>
61515 </listitem></varlistentry>
61516 <varlistentry>
61517 <term><emphasis role="bold">opt_octint</emphasis></term>
61518 <listitem>
61519 <para>
61520 This also specifies an integer, but the value is always interpreted as an
61521 octal integer, whether or not it starts with the digit zero, and it is
61522 always output in octal.
61523 </para>
61524 </listitem></varlistentry>
61525 <varlistentry>
61526 <term><emphasis role="bold">opt_stringptr</emphasis></term>
61527 <listitem>
61528 <para>
61529 This specifies a string value; the address must be a pointer to a
61530 variable that points to a string (for example, of type <literal>uschar *</literal>).
61531 </para>
61532 </listitem></varlistentry>
61533 <varlistentry>
61534 <term><emphasis role="bold">opt_time</emphasis></term>
61535 <listitem>
61536 <para>
61537 This specifies a time interval value. The address must point to a variable of
61538 type <literal>int</literal>. The value that is placed there is a number of seconds.
61539 </para>
61540 </listitem></varlistentry>
61541 </variablelist>
61542 <para>
61543 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
61544 out the values of all the <function>local_scan()</function> options.
61545 </para>
61546 </section>
61547 <section id="SECID208">
61548 <title>Available Exim variables</title>
61549 <para>
61550 <indexterm role="concept">
61551 <primary><function>local_scan()</function> function</primary>
61552 <secondary>available Exim variables</secondary>
61553 </indexterm>
61554 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
61555 are the only ones that are guaranteed to be maintained from release to release.
61556 Note, however, that you can obtain the value of any Exim expansion variable,
61557 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
61558 C variables are as follows:
61559 </para>
61560 <variablelist>
61561 <varlistentry>
61562 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
61563 <listitem>
61564 <para>
61565 This variable contains the number of lines in the message&#x2019;s body.
61566 It is not valid if the <option>spool_files_wireformat</option> option is used.
61567 </para>
61568 </listitem></varlistentry>
61569 <varlistentry>
61570 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
61571 <listitem>
61572 <para>
61573 This variable contains the number of binary zero bytes in the message&#x2019;s body.
61574 It is not valid if the <option>spool_files_wireformat</option> option is used.
61575 </para>
61576 </listitem></varlistentry>
61577 <varlistentry>
61578 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
61579 <listitem>
61580 <para>
61581 This variable is set to zero when no debugging is taking place. Otherwise, it
61582 is a bitmap of debugging selectors. Two bits are identified for use in
61583 <function>local_scan()</function>; they are defined as macros:
61584 </para>
61585 <itemizedlist>
61586 <listitem>
61587 <para>
61588 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
61589 testing option that is not privileged &ndash; any caller may set it. All the
61590 other selector bits can be set only by admin users.
61591 </para>
61592 </listitem>
61593 <listitem>
61594 <para>
61595 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
61596 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
61597 of debugging bits.
61598 </para>
61599 </listitem>
61600 </itemizedlist>
61601 <para>
61602 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
61603 selected, you should use code like this:
61604 </para>
61605 <literallayout class="monospaced">
61606 if ((debug_selector &amp; D_local_scan) != 0)
61607   debug_printf("xxx", ...);
61608 </literallayout>
61609 </listitem></varlistentry>
61610 <varlistentry>
61611 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
61612 <listitem>
61613 <para>
61614 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
61615 variable <option>expand_string_message</option> contains the error message, zero-terminated.
61616 </para>
61617 </listitem></varlistentry>
61618 <varlistentry>
61619 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
61620 <listitem>
61621 <para>
61622 A pointer to a chain of header lines. The <option>header_line</option> structure is
61623 discussed below.
61624 </para>
61625 </listitem></varlistentry>
61626 <varlistentry>
61627 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
61628 <listitem>
61629 <para>
61630 A pointer to the last of the header lines.
61631 </para>
61632 </listitem></varlistentry>
61633 <varlistentry>
61634 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
61635 <listitem>
61636 <para>
61637 The value of the <option>headers_charset</option> configuration option.
61638 </para>
61639 </listitem></varlistentry>
61640 <varlistentry>
61641 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
61642 <listitem>
61643 <para>
61644 This variable is TRUE during a host checking session that is initiated by the
61645 <option>-bh</option> command line option.
61646 </para>
61647 </listitem></varlistentry>
61648 <varlistentry>
61649 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
61650 <listitem>
61651 <para>
61652 The IP address of the interface that received the message, as a string. This
61653 is NULL for locally submitted messages.
61654 </para>
61655 </listitem></varlistentry>
61656 <varlistentry>
61657 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
61658 <listitem>
61659 <para>
61660 The port on which this message was received. When testing with the <option>-bh</option>
61661 command line option, the value of this variable is -1 unless a port has been
61662 specified via the <option>-oMi</option> option.
61663 </para>
61664 </listitem></varlistentry>
61665 <varlistentry>
61666 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
61667 <listitem>
61668 <para>
61669 This variable contains Exim&#x2019;s message id for the incoming message (the value of
61670 <varname>$message_exim_id</varname>) as a zero-terminated string.
61671 </para>
61672 </listitem></varlistentry>
61673 <varlistentry>
61674 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
61675 <listitem>
61676 <para>
61677 The name of the protocol by which the message was received.
61678 </para>
61679 </listitem></varlistentry>
61680 <varlistentry>
61681 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
61682 <listitem>
61683 <para>
61684 The number of accepted recipients.
61685 </para>
61686 </listitem></varlistentry>
61687 <varlistentry>
61688 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
61689 <listitem>
61690 <para>
61691 <indexterm role="concept">
61692 <primary>recipient</primary>
61693 <secondary>adding in local scan</secondary>
61694 </indexterm>
61695 <indexterm role="concept">
61696 <primary>recipient</primary>
61697 <secondary>removing in local scan</secondary>
61698 </indexterm>
61699 The list of accepted recipients, held in a vector of length
61700 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
61701 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
61702 below). You can delete recipients by removing them from the vector and
61703 adjusting the value in <option>recipients_count</option>. In particular, by setting
61704 <option>recipients_count</option> to zero you remove all recipients. If you then return the
61705 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
61706 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
61707 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
61708 </para>
61709 </listitem></varlistentry>
61710 <varlistentry>
61711 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
61712 <listitem>
61713 <para>
61714 The envelope sender address. For bounce messages this is the empty string.
61715 </para>
61716 </listitem></varlistentry>
61717 <varlistentry>
61718 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
61719 <listitem>
61720 <para>
61721 The IP address of the sending host, as a string. This is NULL for
61722 locally-submitted messages.
61723 </para>
61724 </listitem></varlistentry>
61725 <varlistentry>
61726 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
61727 <listitem>
61728 <para>
61729 The name of the authentication mechanism that was used, or NULL if the message
61730 was not received over an authenticated SMTP connection.
61731 </para>
61732 </listitem></varlistentry>
61733 <varlistentry>
61734 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
61735 <listitem>
61736 <para>
61737 The name of the sending host, if known.
61738 </para>
61739 </listitem></varlistentry>
61740 <varlistentry>
61741 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
61742 <listitem>
61743 <para>
61744 The port on the sending host.
61745 </para>
61746 </listitem></varlistentry>
61747 <varlistentry>
61748 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
61749 <listitem>
61750 <para>
61751 This variable is TRUE for all SMTP input, including BSMTP.
61752 </para>
61753 </listitem></varlistentry>
61754 <varlistentry>
61755 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
61756 <listitem>
61757 <para>
61758 This variable is TRUE for BSMTP input.
61759 </para>
61760 </listitem></varlistentry>
61761 <varlistentry>
61762 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
61763 <listitem>
61764 <para>
61765 The contents of this variable control which pool of memory is used for new
61766 requests. See section <xref linkend="SECTmemhanloc"/> for details.
61767 </para>
61768 </listitem></varlistentry>
61769 </variablelist>
61770 </section>
61771 <section id="SECID209">
61772 <title>Structure of header lines</title>
61773 <para>
61774 The <option>header_line</option> structure contains the members listed below.
61775 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
61776 (see below). You can cause header lines to be ignored (deleted) by setting
61777 their type to *.
61778 </para>
61779 <variablelist>
61780 <varlistentry>
61781 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
61782 <listitem>
61783 <para>
61784 A pointer to the next header line, or NULL for the last line.
61785 </para>
61786 </listitem></varlistentry>
61787 <varlistentry>
61788 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
61789 <listitem>
61790 <para>
61791 A code identifying certain headers that Exim recognizes. The codes are printing
61792 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
61793 Notice in particular that any header line whose type is * is not transmitted
61794 with the message. This flagging is used for header lines that have been
61795 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
61796 lines.) Effectively, * means <quote>deleted</quote>.
61797 </para>
61798 </listitem></varlistentry>
61799 <varlistentry>
61800 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
61801 <listitem>
61802 <para>
61803 The number of characters in the header line, including the terminating and any
61804 internal newlines.
61805 </para>
61806 </listitem></varlistentry>
61807 <varlistentry>
61808 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
61809 <listitem>
61810 <para>
61811 A pointer to the text of the header. It always ends with a newline, followed by
61812 a zero byte. Internal newlines are preserved.
61813 </para>
61814 </listitem></varlistentry>
61815 </variablelist>
61816 </section>
61817 <section id="SECID210">
61818 <title>Structure of recipient items</title>
61819 <para>
61820 The <option>recipient_item</option> structure contains these members:
61821 </para>
61822 <variablelist>
61823 <varlistentry>
61824 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
61825 <listitem>
61826 <para>
61827 This is a pointer to the recipient address as it was received.
61828 </para>
61829 </listitem></varlistentry>
61830 <varlistentry>
61831 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
61832 <listitem>
61833 <para>
61834 This is used in later Exim processing when top level addresses are created by
61835 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
61836 and must always contain -1 at this stage.
61837 </para>
61838 </listitem></varlistentry>
61839 <varlistentry>
61840 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
61841 <listitem>
61842 <para>
61843 If this value is not NULL, bounce messages caused by failing to deliver to the
61844 recipient are sent to the address it contains. In other words, it overrides the
61845 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
61846 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
61847 an unqualified address, Exim qualifies it using the domain from
61848 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
61849 is NULL for all recipients.
61850 </para>
61851 </listitem></varlistentry>
61852 </variablelist>
61853 </section>
61854 <section id="SECID211">
61855 <title>Available Exim functions</title>
61856 <para>
61857 <indexterm role="concept">
61858 <primary><function>local_scan()</function> function</primary>
61859 <secondary>available Exim functions</secondary>
61860 </indexterm>
61861 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
61862 These are the only ones that are guaranteed to be maintained from release to
61863 release:
61864 </para>
61865 <variablelist>
61866 <varlistentry>
61867 <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>
61868 <listitem>
61869 <para>
61870 This function creates a child process that runs the command specified by
61871 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
61872 be NULL if no environment variables are to be passed. A new umask is supplied
61873 for the process in <option>newumask</option>.
61874 </para>
61875 <para>
61876 Pipes to the standard input and output of the new process are set up
61877 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
61878 standard error is cloned to the standard output. If there are any file
61879 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
61880 argument is TRUE, the new process is made into a process group leader.
61881 </para>
61882 <para>
61883 The function returns the pid of the new process, or -1 if things go wrong.
61884 </para>
61885 </listitem></varlistentry>
61886 <varlistentry>
61887 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
61888 <listitem>
61889 <para>
61890 This function waits for a child process to terminate, or for a timeout (in
61891 seconds) to expire. A timeout value of zero means wait as long as it takes. The
61892 return value is as follows:
61893 </para>
61894 <itemizedlist>
61895 <listitem>
61896 <para>
61897 &gt;= 0
61898 </para>
61899 <para>
61900 The process terminated by a normal exit and the value is the process
61901 ending status.
61902 </para>
61903 </listitem>
61904 <listitem>
61905 <para>
61906 &lt; 0 and &gt; &ndash;256
61907 </para>
61908 <para>
61909 The process was terminated by a signal and the value is the negation of the
61910 signal number.
61911 </para>
61912 </listitem>
61913 <listitem>
61914 <para>
61915 &ndash;256
61916 </para>
61917 <para>
61918 The process timed out.
61919 </para>
61920 </listitem>
61921 <listitem>
61922 <para>
61923 &ndash;257
61924 </para>
61925 <para>
61926 The was some other error in wait(); <option>errno</option> is still set.
61927 </para>
61928 </listitem>
61929 </itemizedlist>
61930 </listitem></varlistentry>
61931 <varlistentry>
61932 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
61933 <listitem>
61934 <para>
61935 This function provide you with a means of submitting a new message to
61936 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
61937 want, but this packages it all up for you.) The function creates a pipe,
61938 forks a subprocess that is running
61939 </para>
61940 <literallayout class="monospaced">
61941 exim -t -oem -oi -f &lt;&gt;
61942 </literallayout>
61943 <para>
61944 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
61945 that is connected to the standard input. The yield of the function is the PID
61946 of the subprocess. You can then write a message to the file descriptor, with
61947 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
61948 </para>
61949 <para>
61950 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
61951 finish and to collect its ending status. A timeout value of zero is usually
61952 fine in this circumstance. Unless you have made a mistake with the recipient
61953 addresses, you should get a return code of zero.
61954 </para>
61955 </listitem></varlistentry>
61956 <varlistentry>
61957 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
61958 <listitem>
61959 <para>
61960 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
61961 that it runs is:
61962 </para>
61963 <literallayout>
61964 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
61965 </literallayout>
61966 <para>
61967 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
61968 </para>
61969 </listitem></varlistentry>
61970 <varlistentry>
61971 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
61972 <listitem>
61973 <para>
61974 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
61975 output is written to the standard error stream. If no debugging is selected,
61976 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
61977 conditional on the <literal>local_scan</literal> debug selector by coding like this:
61978 </para>
61979 <literallayout class="monospaced">
61980 if ((debug_selector &amp; D_local_scan) != 0)
61981   debug_printf("xxx", ...);
61982 </literallayout>
61983 </listitem></varlistentry>
61984 <varlistentry>
61985 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
61986 <listitem>
61987 <para>
61988 This is an interface to Exim&#x2019;s string expansion code. The return value is the
61989 expanded string, or NULL if there was an expansion failure.
61990 The C variable <option>expand_string_message</option> contains an error message after an
61991 expansion failure. If expansion does not change the string, the return value is
61992 the pointer to the input string. Otherwise, the return value points to a new
61993 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
61994 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
61995 </para>
61996 </listitem></varlistentry>
61997 <varlistentry>
61998 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
61999 <listitem>
62000 <para>
62001 This function allows you to an add additional header line at the end of the
62002 existing ones. The first argument is the type, and should normally be a space
62003 character. The second argument is a format string and any number of
62004 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
62005 if you want, and you must ensure that the string ends with a newline.
62006 </para>
62007 </listitem></varlistentry>
62008 <varlistentry>
62009 <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>
62010 <listitem>
62011 <para>
62012 This function adds a new header line at a specified point in the header
62013 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
62014 </para>
62015 <para>
62016 If <option>name</option> is NULL, the new header is added at the end of the chain if
62017 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
62018 NULL, the header lines are searched for the first non-deleted header that
62019 matches the name. If one is found, the new header is added before it if
62020 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
62021 found header and any adjacent subsequent ones with the same name (even if
62022 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
62023 option controls where the header is added. If it is true, addition is at the
62024 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
62025 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
62026 </para>
62027 <literallayout class="monospaced">
62028 header_add_at_position(TRUE, US"Received", TRUE,
62029   ' ', "X-xxx: ...");
62030 </literallayout>
62031 <para>
62032 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
62033 there may not be if <option>received_header_text</option> expands to an empty string.
62034 </para>
62035 </listitem></varlistentry>
62036 <varlistentry>
62037 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
62038 <listitem>
62039 <para>
62040 This function removes header lines. If <option>occurrence</option> is zero or negative, all
62041 occurrences of the header are removed. If occurrence is greater than zero, that
62042 particular instance of the header is removed. If no header(s) can be found that
62043 match the specification, the function does nothing.
62044 </para>
62045 </listitem></varlistentry>
62046 <varlistentry>
62047 <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>
62048 <listitem>
62049 <para>
62050 This function tests whether the given header has the given name. It is not just
62051 a string comparison, because white space is permitted between the name and the
62052 colon. If the <option>notdel</option> argument is true, a false return is forced for all
62053 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
62054 </para>
62055 <literallayout class="monospaced">
62056 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
62057 </literallayout>
62058 </listitem></varlistentry>
62059 <varlistentry>
62060 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
62061 <listitem>
62062 <para>
62063 <indexterm role="concept">
62064 <primary>base64 encoding</primary>
62065 <secondary>functions for <function>local_scan()</function> use</secondary>
62066 </indexterm>
62067 This function base64-encodes a string, which is passed by address and length.
62068 The text may contain bytes of any value, including zero. The result is passed
62069 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
62070 zero-terminated.
62071 </para>
62072 </listitem></varlistentry>
62073 <varlistentry>
62074 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
62075 <listitem>
62076 <para>
62077 This function decodes a base64-encoded string. Its arguments are a
62078 zero-terminated base64-encoded string and the address of a variable that is set
62079 to point to the result, which is in dynamic memory. The length of the decoded
62080 string is the yield of the function. If the input is invalid base64 data, the
62081 yield is -1. A zero byte is added to the end of the output string to make it
62082 easy to interpret as a C string (assuming it contains no zeros of its own). The
62083 added zero byte is not included in the returned count.
62084 </para>
62085 </listitem></varlistentry>
62086 <varlistentry>
62087 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
62088 <listitem>
62089 <para>
62090 This function checks for a match in a domain list. Domains are always
62091 matched caselessly. The return value is one of the following:
62092 </para>
62093 <literallayout>
62094 <literal>OK     </literal> match succeeded
62095 <literal>FAIL   </literal> match failed
62096 <literal>DEFER  </literal> match deferred
62097 </literallayout>
62098 <para>
62099 DEFER is usually caused by some kind of lookup defer, such as the
62100 inability to contact a database.
62101 </para>
62102 </listitem></varlistentry>
62103 <varlistentry>
62104 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
62105 <listitem>
62106 <para>
62107 This function checks for a match in a local part list. The third argument
62108 controls case-sensitivity. The return values are as for
62109 <emphasis>lss_match_domain()</emphasis>.
62110 </para>
62111 </listitem></varlistentry>
62112 <varlistentry>
62113 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
62114 <listitem>
62115 <para>
62116 This function checks for a match in an address list. The third argument
62117 controls the case-sensitivity of the local part match. The domain is always
62118 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
62119 </para>
62120 </listitem></varlistentry>
62121 <varlistentry>
62122 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
62123 <listitem>
62124 <para>
62125 This function checks for a match in a host list. The most common usage is
62126 expected to be
62127 </para>
62128 <literallayout class="monospaced">
62129 lss_match_host(sender_host_name, sender_host_address, ...)
62130 </literallayout>
62131 <para>
62132 <indexterm role="variable">
62133 <primary><varname>$sender_host_address</varname></primary>
62134 </indexterm>
62135 An empty address field matches an empty item in the host list. If the host name
62136 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
62137 looked up if a host name is required to match an item in the list. The return
62138 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
62139 returns ERROR in the case when it had to look up a host name, but the lookup
62140 failed.
62141 </para>
62142 </listitem></varlistentry>
62143 <varlistentry>
62144 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
62145 <listitem>
62146 <para>
62147 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
62148 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
62149 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
62150 them. It specifies to which log or logs the message is written. The remaining
62151 arguments are a format and relevant insertion arguments. The string should not
62152 contain any newlines, not even at the end.
62153 </para>
62154 </listitem></varlistentry>
62155 <varlistentry>
62156 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
62157 <listitem>
62158 <para>
62159 This function adds an additional recipient to the message. The first argument
62160 is the recipient address. If it is unqualified (has no domain), it is qualified
62161 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
62162 </para>
62163 <para>
62164 This function does not allow you to specify a private <option>errors_to</option> address (as
62165 described with the structure of <option>recipient_item</option> above), because it pre-dates
62166 the addition of that field to the structure. However, it is easy to add such a
62167 value afterwards. For example:
62168 </para>
62169 <literallayout class="monospaced">
62170  receive_add_recipient(US"monitor@mydom.example", -1);
62171  recipients_list[recipients_count-1].errors_to =
62172    US"postmaster@mydom.example";
62173 </literallayout>
62174 </listitem></varlistentry>
62175 <varlistentry>
62176 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
62177 <listitem>
62178 <para>
62179 This is a convenience function to remove a named recipient from the list of
62180 recipients. It returns true if a recipient was removed, and false if no
62181 matching recipient could be found. The argument must be a complete email
62182 address.
62183 </para>
62184 </listitem></varlistentry>
62185 </variablelist>
62186 <para>
62187 <indexterm role="concept">
62188 <primary>RFC 2047</primary>
62189 </indexterm>
62190 </para>
62191 <variablelist>
62192 <varlistentry>
62193 <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>
62194 <listitem>
62195 <para>
62196 This function decodes strings that are encoded according to RFC 2047. Typically
62197 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
62198 from the Q or B encoding into a byte-string. Then, if provided with the name of
62199 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
62200 made  to translate the result to the named character set. If this fails, the
62201 binary string is returned with an error message.
62202 </para>
62203 <para>
62204 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
62205 maximum MIME word length is enforced. The third argument is the target
62206 encoding, or NULL if no translation is wanted.
62207 </para>
62208 <para>
62209 <indexterm role="concept">
62210 <primary>binary zero</primary>
62211 <secondary>in RFC 2047 decoding</secondary>
62212 </indexterm>
62213 <indexterm role="concept">
62214 <primary>RFC 2047</primary>
62215 <secondary>binary zero in</secondary>
62216 </indexterm>
62217 If a binary zero is encountered in the decoded string, it is replaced by the
62218 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
62219 not be 0 because header lines are handled as zero-terminated strings.
62220 </para>
62221 <para>
62222 The function returns the result of processing the string, zero-terminated; if
62223 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
62224 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
62225 </para>
62226 <para>
62227 If an error is encountered, the function returns NULL and uses the <option>error</option>
62228 argument to return an error message. The variable pointed to by <option>error</option> is
62229 set to NULL if there is no error; it may be set non-NULL even when the function
62230 returns a non-NULL value if decoding was successful, but there was a problem
62231 with translation.
62232 </para>
62233 </listitem></varlistentry>
62234 <varlistentry>
62235 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
62236 <listitem>
62237 <para>
62238 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
62239 below.
62240 </para>
62241 </listitem></varlistentry>
62242 <varlistentry>
62243 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
62244 <listitem>
62245 <para>
62246 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
62247 output stream. You should use this function only when there is an SMTP output
62248 stream, that is, when the incoming message is being received via interactive
62249 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
62250 is FALSE. If you want to test for an incoming message from another host (as
62251 opposed to a local process that used the <option>-bs</option> command line option), you can
62252 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
62253 is involved.
62254 </para>
62255 <para>
62256 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
62257 output function, so it can be used for all forms of SMTP connection.
62258 </para>
62259 <para>
62260 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
62261 must start with an appropriate response code: 550 if you are going to return
62262 LOCAL_SCAN_REJECT, 451 if you are going to return
62263 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
62264 initial lines of a multi-line response, the code must be followed by a hyphen
62265 to indicate that the line is not the final response line. You must also ensure
62266 that the lines you write terminate with CRLF. For example:
62267 </para>
62268 <literallayout class="monospaced">
62269 smtp_printf("550-this is some extra info\r\n");
62270 return LOCAL_SCAN_REJECT;
62271 </literallayout>
62272 <para>
62273 Note that you can also create multi-line responses by including newlines in
62274 the data returned via the <option>return_text</option> argument. The added value of using
62275 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
62276 multiple output lines.
62277 </para>
62278 <para>
62279 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
62280 does not automatically flush pending output, and therefore does not test
62281 the state of the stream. (In the main code of Exim, flushing and error
62282 detection is done when Exim is ready for the next SMTP input command.) If
62283 you want to flush the output and check for an error (for example, the
62284 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
62285 arguments. It flushes the output stream, and returns a non-zero value if there
62286 is an error.
62287 </para>
62288 </listitem></varlistentry>
62289 <varlistentry>
62290 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
62291 <listitem>
62292 <para>
62293 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
62294 chunk of memory whose size is given by the argument. Exim bombs out if it ever
62295 runs out of memory. See the next section for a discussion of memory handling.
62296 </para>
62297 </listitem></varlistentry>
62298 <varlistentry>
62299 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
62300 <listitem>
62301 <para>
62302 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
62303 permanent pool. See the next section for a discussion of memory handling.
62304 </para>
62305 </listitem></varlistentry>
62306 <varlistentry>
62307 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
62308 <listitem>
62309 <para>
62310 See below.
62311 </para>
62312 </listitem></varlistentry>
62313 <varlistentry>
62314 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
62315 <listitem>
62316 <para>
62317 See below.
62318 </para>
62319 </listitem></varlistentry>
62320 <varlistentry>
62321 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
62322 <listitem>
62323 <para>
62324 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
62325 The first makes a copy of an entire string. The second copies up to a maximum
62326 number of characters, indicated by the second argument. The third uses a format
62327 and insertion arguments to create a new string. In each case, the result is a
62328 pointer to a new string in the current memory pool. See the next section for
62329 more discussion.
62330 </para>
62331 </listitem></varlistentry>
62332 </variablelist>
62333 </section>
62334 <section id="SECTmemhanloc">
62335 <title>More about Exim&#x2019;s memory handling</title>
62336 <para>
62337 <indexterm role="concept">
62338 <primary><function>local_scan()</function> function</primary>
62339 <secondary>memory handling</secondary>
62340 </indexterm>
62341 No function is provided for freeing memory, because that is never needed.
62342 The dynamic memory that Exim uses when receiving a message is automatically
62343 recycled if another message is received by the same process (this applies only
62344 to incoming SMTP connections &ndash; other input methods can supply only one
62345 message at a time). After receiving the last message, a reception process
62346 terminates.
62347 </para>
62348 <para>
62349 Because it is recycled, the normal dynamic memory cannot be used for holding
62350 data that must be preserved over a number of incoming messages on the same SMTP
62351 connection. However, Exim in fact uses two pools of dynamic memory; the second
62352 one is not recycled, and can be used for this purpose.
62353 </para>
62354 <para>
62355 If you want to allocate memory that remains available for subsequent messages
62356 in the same SMTP connection, you should set
62357 </para>
62358 <literallayout class="monospaced">
62359 store_pool = POOL_PERM
62360 </literallayout>
62361 <para>
62362 before calling the function that does the allocation. There is no need to
62363 restore the value if you do not need to; however, if you do want to revert to
62364 the normal pool, you can either restore the previous value of <option>store_pool</option> or
62365 set it explicitly to POOL_MAIN.
62366 </para>
62367 <para>
62368 The pool setting applies to all functions that get dynamic memory, including
62369 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
62370 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
62371 block of memory from the permanent pool while preserving the value of
62372 <option>store_pool</option>.
62373 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
62374 </para>
62375 </section>
62376 </chapter>
62377
62378 <chapter id="CHAPsystemfilter">
62379 <title>System-wide message filtering</title>
62380 <para>
62381 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
62382 <primary>filter</primary>
62383 <secondary>system filter</secondary>
62384 </indexterm>
62385 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
62386 <primary>filtering all mail</primary>
62387 </indexterm>
62388 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
62389 <primary>system filter</primary>
62390 </indexterm>
62391 The previous chapters (on ACLs and the local scan function) describe checks
62392 that can be applied to messages before they are accepted by a host. There is
62393 also a mechanism for checking messages once they have been received, but before
62394 they are delivered. This is called the <emphasis>system filter</emphasis>.
62395 </para>
62396 <para>
62397 The system filter operates in a similar manner to users&#x2019; filter files, but it
62398 is run just once per message (however many recipients the message has).
62399 It should not normally be used as a substitute for routing, because <option>deliver</option>
62400 commands in a system router provide new envelope recipient addresses.
62401 The system filter must be an Exim filter. It cannot be a Sieve filter.
62402 </para>
62403 <para>
62404 The system filter is run at the start of a delivery attempt, before any routing
62405 is done. If a message fails to be completely delivered at the first attempt,
62406 the system filter is run again at the start of every retry.
62407 If you want your filter to do something only once per message, you can make use
62408 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
62409 prevent it happening on retries.
62410 </para>
62411 <para>
62412 <indexterm role="variable">
62413 <primary><varname>$domain</varname></primary>
62414 </indexterm>
62415 <indexterm role="variable">
62416 <primary><varname>$local_part</varname></primary>
62417 </indexterm>
62418 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
62419 specific to individual recipient addresses, such as <varname>$local_part</varname> and
62420 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
62421 you want to run a centrally-specified filter for each recipient address
62422 independently, you can do so by setting up a suitable <command>redirect</command> router, as
62423 described in section <xref linkend="SECTperaddfil"/> below.
62424 </para>
62425 <section id="SECID212">
62426 <title>Specifying a system filter</title>
62427 <para>
62428 <indexterm role="concept">
62429 <primary>uid (user id)</primary>
62430 <secondary>system filter</secondary>
62431 </indexterm>
62432 <indexterm role="concept">
62433 <primary>gid (group id)</primary>
62434 <secondary>system filter</secondary>
62435 </indexterm>
62436 The name of the file that contains the system filter must be specified by
62437 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
62438 other than root, you must also set <option>system_filter_user</option> and
62439 <option>system_filter_group</option> as appropriate. For example:
62440 </para>
62441 <literallayout class="monospaced">
62442 system_filter = /etc/mail/exim.filter
62443 system_filter_user = exim
62444 </literallayout>
62445 <para>
62446 If a system filter generates any deliveries directly to files or pipes (via the
62447 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
62448 specified by setting <option>system_filter_file_transport</option> and
62449 <option>system_filter_pipe_transport</option>, respectively. Similarly,
62450 <option>system_filter_reply_transport</option> must be set to handle any messages generated
62451 by the <option>reply</option> command.
62452 </para>
62453 </section>
62454 <section id="SECID213">
62455 <title>Testing a system filter</title>
62456 <para>
62457 You can run simple tests of a system filter in the same way as for a user
62458 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
62459 are permitted only in system filters are recognized.
62460 </para>
62461 <para>
62462 If you want to test the combined effect of a system filter and a user filter,
62463 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
62464 </para>
62465 </section>
62466 <section id="SECID214">
62467 <title>Contents of a system filter</title>
62468 <para>
62469 The language used to specify system filters is the same as for users&#x2019; filter
62470 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
62471 mail filtering</emphasis>. However, there are some additional features that are
62472 available only in system filters; these are described in subsequent sections.
62473 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
62474 they cause errors.
62475 </para>
62476 <para>
62477 <indexterm role="concept">
62478 <primary>frozen messages</primary>
62479 <secondary>manual thaw; testing in filter</secondary>
62480 </indexterm>
62481 There are two special conditions which, though available in users&#x2019; filter
62482 files, are designed for use in system filters. The condition <option>first_delivery</option>
62483 is true only for the first attempt at delivering a message, and
62484 <option>manually_thawed</option> is true only if the message has been frozen, and
62485 subsequently thawed by an admin user. An explicit forced delivery counts as a
62486 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
62487 </para>
62488 <para>
62489 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
62490 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
62491 succeed, it will not be tried again.
62492 If you want Exim to retry an unseen delivery until it succeeds, you should
62493 arrange to set it up every time the filter runs.
62494 </para>
62495 <para>
62496 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
62497 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
62498 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
62499 to which users&#x2019; filter files can refer.
62500 </para>
62501 </section>
62502 <section id="SECID215">
62503 <title>Additional variable for system filters</title>
62504 <para>
62505 <indexterm role="variable">
62506 <primary><varname>$recipients</varname></primary>
62507 </indexterm>
62508 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
62509 of the message (separated by commas and white space), is available in system
62510 filters. It is not available in users&#x2019; filters for privacy reasons.
62511 </para>
62512 </section>
62513 <section id="SECID216">
62514 <title>Defer, freeze, and fail commands for system filters</title>
62515 <para>
62516 <indexterm role="concept">
62517 <primary>freezing messages</primary>
62518 </indexterm>
62519 <indexterm role="concept">
62520 <primary>message</primary>
62521 <secondary>freezing</secondary>
62522 </indexterm>
62523 <indexterm role="concept">
62524 <primary>message</primary>
62525 <secondary>forced failure</secondary>
62526 </indexterm>
62527 <indexterm role="concept">
62528 <primary><option>fail</option></primary>
62529 <secondary>in system filter</secondary>
62530 </indexterm>
62531 <indexterm role="concept">
62532 <primary><option>freeze</option> in system filter</primary>
62533 </indexterm>
62534 <indexterm role="concept">
62535 <primary><option>defer</option> in system filter</primary>
62536 </indexterm>
62537 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
62538 always available in system filters, but are not normally enabled in users&#x2019;
62539 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
62540 for the <command>redirect</command> router.) These commands can optionally be followed by the
62541 word <option>text</option> and a string containing an error message, for example:
62542 </para>
62543 <literallayout class="monospaced">
62544 fail text "this message looks like spam to me"
62545 </literallayout>
62546 <para>
62547 The keyword <option>text</option> is optional if the next character is a double quote.
62548 </para>
62549 <para>
62550 The <option>defer</option> command defers delivery of the original recipients of the
62551 message. The <option>fail</option> command causes all the original recipients to be failed,
62552 and a bounce message to be created. The <option>freeze</option> command suspends all
62553 delivery attempts for the original recipients. In all cases, any new deliveries
62554 that are specified by the filter are attempted as normal after the filter has
62555 run.
62556 </para>
62557 <para>
62558 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
62559 not manually frozen since. This means that automatic freezing by a system
62560 filter can be used as a way of checking out suspicious messages. If a message
62561 is found to be all right, manually unfreezing it allows it to be delivered.
62562 </para>
62563 <para>
62564 <indexterm role="concept">
62565 <primary>log</primary>
62566 <secondary><option>fail</option> command log line</secondary>
62567 </indexterm>
62568 <indexterm role="concept">
62569 <primary><option>fail</option></primary>
62570 <secondary>log line; reducing</secondary>
62571 </indexterm>
62572 The text given with a fail command is used as part of the bounce message as
62573 well as being written to the log. If the message is quite long, this can fill
62574 up a lot of log space when such failures are common. To reduce the size of the
62575 log message, Exim interprets the text in a special way if it starts with the
62576 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
62577 strings is written to the log, and the rest of the text is used in the bounce
62578 message. For example:
62579 </para>
62580 <literallayout class="monospaced">
62581 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
62582      because it contains attachments that we are \
62583      not prepared to receive."
62584 </literallayout>
62585 <para>
62586 <indexterm role="concept">
62587 <primary>loop</primary>
62588 <secondary>caused by <option>fail</option></secondary>
62589 </indexterm>
62590 Take great care with the <option>fail</option> command when basing the decision to fail on
62591 the contents of the message, because the bounce message will of course include
62592 the contents of the original message and will therefore trigger the <option>fail</option>
62593 command again (causing a mail loop) unless steps are taken to prevent this.
62594 Testing the <option>error_message</option> condition is one way to prevent this. You could
62595 use, for example
62596 </para>
62597 <literallayout class="monospaced">
62598 if $message_body contains "this is spam" and not error_message
62599 then fail text "spam is not wanted here" endif
62600 </literallayout>
62601 <para>
62602 though of course that might let through unwanted bounce messages. The
62603 alternative is clever checking of the body and/or headers to detect bounces
62604 generated by the filter.
62605 </para>
62606 <para>
62607 The interpretation of a system filter file ceases after a
62608 <option>defer</option>,
62609 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
62610 set up earlier in the filter file are honoured, so you can use a sequence such
62611 as
62612 </para>
62613 <literallayout class="monospaced">
62614 mail ...
62615 freeze
62616 </literallayout>
62617 <para>
62618 to send a specified message when the system filter is freezing (or deferring or
62619 failing) a message. The normal deliveries for the message do not, of course,
62620 take place.
62621 </para>
62622 </section>
62623 <section id="SECTaddremheasys">
62624 <title>Adding and removing headers in a system filter</title>
62625 <para>
62626 <indexterm role="concept">
62627 <primary>header lines</primary>
62628 <secondary>adding; in system filter</secondary>
62629 </indexterm>
62630 <indexterm role="concept">
62631 <primary>header lines</primary>
62632 <secondary>removing; in system filter</secondary>
62633 </indexterm>
62634 <indexterm role="concept">
62635 <primary>filter</primary>
62636 <secondary>header lines; adding/removing</secondary>
62637 </indexterm>
62638 Two filter commands that are available only in system filters are:
62639 </para>
62640 <literallayout class="monospaced">
62641 headers add &lt;string&gt;
62642 headers remove &lt;string&gt;
62643 </literallayout>
62644 <para>
62645 The argument for the <option>headers add</option> is a string that is expanded and then
62646 added to the end of the message&#x2019;s headers. It is the responsibility of the
62647 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
62648 space is ignored, and if the string is otherwise empty, or if the expansion is
62649 forced to fail, the command has no effect.
62650 </para>
62651 <para>
62652 You can use <quote>\n</quote> within the string, followed by white space, to specify
62653 continued header lines. More than one header may be added in one command by
62654 including <quote>\n</quote> within the string without any following white space. For
62655 example:
62656 </para>
62657 <literallayout class="monospaced">
62658 headers add "X-header-1: ....\n  \
62659              continuation of X-header-1 ...\n\
62660              X-header-2: ...."
62661 </literallayout>
62662 <para>
62663 Note that the header line continuation white space after the first newline must
62664 be placed before the backslash that continues the input string, because white
62665 space after input continuations is ignored.
62666 </para>
62667 <para>
62668 The argument for <option>headers remove</option> is a colon-separated list of header names.
62669 This command applies only to those headers that are stored with the message;
62670 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
62671 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
62672 header with the same name, they are all removed.
62673 </para>
62674 <para>
62675 The <option>headers</option> command in a system filter makes an immediate change to the set
62676 of header lines that was received with the message (with possible additions
62677 from ACL processing). Subsequent commands in the system filter operate on the
62678 modified set, which also forms the basis for subsequent message delivery.
62679 Unless further modified during routing or transporting, this set of headers is
62680 used for all recipients of the message.
62681 </para>
62682 <para>
62683 During routing and transporting, the variables that refer to the contents of
62684 header lines refer only to those lines that are in this set. Thus, header lines
62685 that are added by a system filter are visible to users&#x2019; filter files and to all
62686 routers and transports. This contrasts with the manipulation of header lines by
62687 routers and transports, which is not immediate, but which instead is saved up
62688 until the message is actually being written (see section
62689 <xref linkend="SECTheadersaddrem"/>).
62690 </para>
62691 <para>
62692 If the message is not delivered at the first attempt, header lines that were
62693 added by the system filter are stored with the message, and so are still
62694 present at the next delivery attempt. Header lines that were removed are still
62695 present, but marked <quote>deleted</quote> so that they are not transported with the
62696 message. For this reason, it is usual to make the <option>headers</option> command
62697 conditional on <option>first_delivery</option> so that the set of header lines is not
62698 modified more than once.
62699 </para>
62700 <para>
62701 Because header modification in a system filter acts immediately, you have to
62702 use an indirect approach if you want to modify the contents of a header line.
62703 For example:
62704 </para>
62705 <literallayout class="monospaced">
62706 headers add "Old-Subject: $h_subject:"
62707 headers remove "Subject"
62708 headers add "Subject: new subject (was: $h_old-subject:)"
62709 headers remove "Old-Subject"
62710 </literallayout>
62711 </section>
62712 <section id="SECID217">
62713 <title>Setting an errors address in a system filter</title>
62714 <para>
62715 <indexterm role="concept">
62716 <primary>envelope sender</primary>
62717 </indexterm>
62718 In a system filter, if a <option>deliver</option> command is followed by
62719 </para>
62720 <literallayout class="monospaced">
62721 errors_to &lt;some address&gt;
62722 </literallayout>
62723 <para>
62724 in order to change the envelope sender (and hence the error reporting) for that
62725 delivery, any address may be specified. (In a user filter, only the current
62726 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
62727 might use
62728 </para>
62729 <literallayout class="monospaced">
62730 unseen deliver monitor@spying.example errors_to root@local.example
62731 </literallayout>
62732 <para>
62733 to take a copy which would not be sent back to the normal error reporting
62734 address if its delivery failed.
62735 </para>
62736 </section>
62737 <section id="SECTperaddfil">
62738 <title>Per-address filtering</title>
62739 <para>
62740 <indexterm role="variable">
62741 <primary><varname>$domain</varname></primary>
62742 </indexterm>
62743 <indexterm role="variable">
62744 <primary><varname>$local_part</varname></primary>
62745 </indexterm>
62746 In contrast to the system filter, which is run just once per message for each
62747 delivery attempt, it is also possible to set up a system-wide filtering
62748 operation that runs once for each recipient address. In this case, variables
62749 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
62750 filter file could be made dependent on them. This is an example of a router
62751 which implements such a filter:
62752 </para>
62753 <literallayout class="monospaced">
62754 central_filter:
62755   check_local_user
62756   driver = redirect
62757   domains = +local_domains
62758   file = /central/filters/$local_part
62759   no_verify
62760   allow_filter
62761   allow_freeze
62762 </literallayout>
62763 <para>
62764 The filter is run in a separate process under its own uid. Therefore, either
62765 <option>check_local_user</option> must be set (as above), in which case the filter is run as
62766 the local user, or the <option>user</option> option must be used to specify which user to
62767 use. If both are set, <option>user</option> overrides.
62768 </para>
62769 <para>
62770 Care should be taken to ensure that none of the commands in the filter file
62771 specify a significant delivery if the message is to go on to be delivered to
62772 its intended recipient. The router will not then claim to have dealt with the
62773 address, so it will be passed on to subsequent routers to be delivered in the
62774 normal way.
62775 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
62776 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
62777 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
62778 </para>
62779 </section>
62780 </chapter>
62781
62782 <chapter id="CHAPmsgproc">
62783 <title>Message processing</title>
62784 <para>
62785 <indexterm role="concept" id="IIDmesproc" class="startofrange">
62786 <primary>message</primary>
62787 <secondary>general processing</secondary>
62788 </indexterm>
62789 Exim performs various transformations on the sender and recipient addresses of
62790 all messages that it handles, and also on the messages&#x2019; header lines. Some of
62791 these are optional and configurable, while others always take place. All of
62792 this processing, except rewriting as a result of routing, and the addition or
62793 removal of header lines while delivering, happens when a message is received,
62794 before it is placed on Exim&#x2019;s queue.
62795 </para>
62796 <para>
62797 Some of the automatic processing takes place by default only for
62798 <quote>locally-originated</quote> messages. This adjective is used to describe messages
62799 that are not received over TCP/IP, but instead are passed to an Exim process on
62800 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
62801 set up by the <option>-bs</option> command line option.
62802 </para>
62803 <para>
62804 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
62805 or ::1) are not considered to be locally-originated. Exim does not treat the
62806 loopback interface specially in any way.
62807 </para>
62808 <para>
62809 If you want the loopback interface to be treated specially, you must ensure
62810 that there are appropriate entries in your ACLs.
62811 </para>
62812 <section id="SECTsubmodnon">
62813 <title>Submission mode for non-local messages</title>
62814 <para>
62815 <indexterm role="concept">
62816 <primary>message</primary>
62817 <secondary>submission</secondary>
62818 </indexterm>
62819 <indexterm role="concept">
62820 <primary>submission mode</primary>
62821 </indexterm>
62822 Processing that happens automatically for locally-originated messages (unless
62823 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
62824 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
62825 state. Submission mode is set by the modifier
62826 </para>
62827 <literallayout class="monospaced">
62828 control = submission
62829 </literallayout>
62830 <para>
62831 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
62832 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
62833 a local submission, and is normally used when the source of the message is
62834 known to be an MUA running on a client host (as opposed to an MTA). For
62835 example, to set submission mode for messages originating on the IPv4 loopback
62836 interface, you could include the following in the MAIL ACL:
62837 </para>
62838 <literallayout class="monospaced">
62839 warn  hosts = 127.0.0.1
62840       control = submission
62841 </literallayout>
62842 <para>
62843 <indexterm role="concept">
62844 <primary><option>sender_retain</option> submission option</primary>
62845 </indexterm>
62846 There are some options that can be used when setting submission mode. A slash
62847 is used to separate options. For example:
62848 </para>
62849 <literallayout class="monospaced">
62850 control = submission/sender_retain
62851 </literallayout>
62852 <para>
62853 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
62854 true and <option>local_from_check</option> false for the current incoming message. The first
62855 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
62856 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
62857 authenticated sender. With this setting, Exim still fixes up messages by adding
62858 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
62859 attempt to check sender authenticity in header lines.
62860 </para>
62861 <para>
62862 When <option>sender_retain</option> is not set, a submission mode setting may specify a
62863 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
62864 example:
62865 </para>
62866 <literallayout class="monospaced">
62867 control = submission/domain=some.domain
62868 </literallayout>
62869 <para>
62870 The domain may be empty. How this value is used is described in sections
62871 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
62872 that allows you to specify the user&#x2019;s full name for inclusion in a created
62873 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
62874 </para>
62875 <literallayout class="monospaced">
62876 accept authenticated = *
62877        control = submission/domain=wonderland.example/\
62878                             name=${lookup {$authenticated_id} \
62879                                    lsearch {/etc/exim/namelist}}
62880 </literallayout>
62881 <para>
62882 Because the name may contain any characters, including slashes, the <option>name</option>
62883 option must be given last. The remainder of the string is used as the name. For
62884 the example above, if <filename>/etc/exim/namelist</filename> contains:
62885 </para>
62886 <literallayout class="monospaced">
62887 bigegg:  Humpty Dumpty
62888 </literallayout>
62889 <para>
62890 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
62891 line would be:
62892 </para>
62893 <literallayout class="monospaced">
62894 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
62895 </literallayout>
62896 <para>
62897 <indexterm role="concept">
62898 <primary>return path</primary>
62899 <secondary>in submission mode</secondary>
62900 </indexterm>
62901 By default, submission mode forces the return path to the same address as is
62902 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
62903 specified, the return path is also left unchanged.
62904 </para>
62905 <para>
62906 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
62907 ACL. This means that any sender checks performed before the fix-ups use the
62908 untrusted sender address specified by the user, not the trusted sender address
62909 specified by submission mode. Although this might be slightly unexpected, it
62910 does mean that you can configure ACL checks to spot that a user is trying to
62911 spoof another&#x2019;s address.
62912 </para>
62913 </section>
62914 <section id="SECTlineendings">
62915 <title>Line endings</title>
62916 <para>
62917 <indexterm role="concept">
62918 <primary>line endings</primary>
62919 </indexterm>
62920 <indexterm role="concept">
62921 <primary>carriage return</primary>
62922 </indexterm>
62923 <indexterm role="concept">
62924 <primary>linefeed</primary>
62925 </indexterm>
62926 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
62927 linefeed) is the line ending for messages transmitted over the Internet using
62928 SMTP over TCP/IP. However, within individual operating systems, different
62929 conventions are used. For example, Unix-like systems use just LF, but others
62930 use CRLF or just CR.
62931 </para>
62932 <para>
62933 Exim was designed for Unix-like systems, and internally, it stores messages
62934 using the system&#x2019;s convention of a single LF as a line terminator. When
62935 receiving a message, all line endings are translated to this standard format.
62936 Originally, it was thought that programs that passed messages directly to an
62937 MTA within an operating system would use that system&#x2019;s convention. Experience
62938 has shown that this is not the case; for example, there are Unix applications
62939 that use CRLF in this circumstance. For this reason, and for compatibility with
62940 other MTAs, the way Exim handles line endings for all messages is now as
62941 follows:
62942 </para>
62943 <itemizedlist>
62944 <listitem>
62945 <para>
62946 LF not preceded by CR is treated as a line ending.
62947 </para>
62948 </listitem>
62949 <listitem>
62950 <para>
62951 CR is treated as a line ending; if it is immediately followed by LF, the LF
62952 is ignored.
62953 </para>
62954 </listitem>
62955 <listitem>
62956 <para>
62957 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
62958 nor a local message in the state where a line containing only a dot is a
62959 terminator.
62960 </para>
62961 </listitem>
62962 <listitem>
62963 <para>
62964 If a bare CR is encountered within a header line, an extra space is added after
62965 the line terminator so as not to end the header line. The reasoning behind this
62966 is that bare CRs in header lines are most likely either to be mistakes, or
62967 people trying to play silly games.
62968 </para>
62969 </listitem>
62970 <listitem>
62971 <para>
62972 If the first header line received in a message ends with CRLF, a subsequent
62973 bare LF in a header line is treated in the same way as a bare CR in a header
62974 line.
62975 </para>
62976 </listitem>
62977 </itemizedlist>
62978 </section>
62979 <section id="SECID218">
62980 <title>Unqualified addresses</title>
62981 <para>
62982 <indexterm role="concept">
62983 <primary>unqualified addresses</primary>
62984 </indexterm>
62985 <indexterm role="concept">
62986 <primary>address</primary>
62987 <secondary>qualification</secondary>
62988 </indexterm>
62989 By default, Exim expects every envelope address it receives from an external
62990 host to be fully qualified. Unqualified addresses cause negative responses to
62991 SMTP commands. However, because SMTP is used as a means of transporting
62992 messages from MUAs running on personal workstations, there is sometimes a
62993 requirement to accept unqualified addresses from specific hosts or IP networks.
62994 </para>
62995 <para>
62996 Exim has two options that separately control which hosts may send unqualified
62997 sender or recipient addresses in SMTP commands, namely
62998 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
62999 cases, if an unqualified address is accepted, it is qualified by adding the
63000 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
63001 </para>
63002 <para>
63003 <indexterm role="option">
63004 <primary><option>qualify_domain</option></primary>
63005 </indexterm>
63006 <indexterm role="option">
63007 <primary><option>qualify_recipient</option></primary>
63008 </indexterm>
63009 Unqualified addresses in header lines are automatically qualified for messages
63010 that are locally originated, unless the <option>-bnq</option> option is given on the command
63011 line. For messages received over SMTP, unqualified addresses in header lines
63012 are qualified only if unqualified addresses are permitted in SMTP commands. In
63013 other words, such qualification is also controlled by
63014 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
63015 </para>
63016 </section>
63017 <section id="SECID219">
63018 <title>The UUCP From line</title>
63019 <para>
63020 <indexterm role="concept">
63021 <primary><quote>From</quote> line</primary>
63022 </indexterm>
63023 <indexterm role="concept">
63024 <primary>UUCP</primary>
63025 <secondary><quote>From</quote> line</secondary>
63026 </indexterm>
63027 <indexterm role="concept">
63028 <primary>sender</primary>
63029 <secondary>address</secondary>
63030 </indexterm>
63031 <indexterm role="option">
63032 <primary><option>uucp_from_pattern</option></primary>
63033 </indexterm>
63034 <indexterm role="option">
63035 <primary><option>uucp_from_sender</option></primary>
63036 </indexterm>
63037 <indexterm role="concept">
63038 <primary>envelope sender</primary>
63039 </indexterm>
63040 <indexterm role="concept">
63041 <primary>Sendmail compatibility</primary>
63042 <secondary><quote>From</quote> line</secondary>
63043 </indexterm>
63044 Messages that have come from UUCP (and some other applications) often begin
63045 with a line containing the envelope sender and a timestamp, following the word
63046 <quote>From</quote>. Examples of two common formats are:
63047 </para>
63048 <literallayout class="monospaced">
63049 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
63050 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
63051 </literallayout>
63052 <para>
63053 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
63054 Exim recognizes such lines at the start of messages that are submitted to it
63055 via the command line (that is, on the standard input). It does not recognize
63056 such lines in incoming SMTP messages, unless the sending host matches
63057 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
63058 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
63059 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
63060 default value matches the two common cases shown above and puts the address
63061 that follows <quote>From</quote> into <varname>$1</varname>.
63062 </para>
63063 <para>
63064 <indexterm role="concept">
63065 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
63066 <secondary>in <quote>From </quote> line handling</secondary>
63067 </indexterm>
63068 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
63069 a trusted user, the message&#x2019;s sender address is constructed by expanding the
63070 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
63071 then parsed as an RFC 2822 address. If there is no domain, the local part is
63072 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
63073 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
63074 </para>
63075 <para>
63076 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
63077 sender address is not changed. This is also the case for incoming SMTP messages
63078 that are permitted to contain <quote>From</quote> lines.
63079 </para>
63080 <para>
63081 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
63082 treated as a data line that starts the body of the message, as it is not valid
63083 as a header line. This also happens if a <quote>From</quote> line is present in an
63084 incoming SMTP message from a source that is not permitted to send them.
63085 </para>
63086 </section>
63087 <section id="SECID220">
63088 <title>Resent- header lines</title>
63089 <para>
63090 <indexterm role="concept">
63091 <primary><option>Resent-</option> header lines</primary>
63092 </indexterm>
63093 <indexterm role="concept">
63094 <primary>header lines</primary>
63095 <secondary>Resent-</secondary>
63096 </indexterm>
63097 RFC 2822 makes provision for sets of header lines starting with the string
63098 <literal>Resent-</literal> to be added to a message when it is resent by the original
63099 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
63100 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
63101 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
63102 </para>
63103 <blockquote>
63104 <para>
63105 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
63106 processing of replies or other such automatic actions on messages.</emphasis>
63107 </para>
63108 </blockquote>
63109 <para>
63110 This leaves things a bit vague as far as other processing actions such as
63111 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
63112 follows:
63113 </para>
63114 <itemizedlist>
63115 <listitem>
63116 <para>
63117 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
63118 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
63119 </para>
63120 </listitem>
63121 <listitem>
63122 <para>
63123 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
63124 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
63125 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
63126 </para>
63127 </listitem>
63128 <listitem>
63129 <para>
63130 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
63131 also removed.
63132 </para>
63133 </listitem>
63134 <listitem>
63135 <para>
63136 For a locally-submitted message,
63137 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
63138 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
63139 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
63140 included in log lines in this case.
63141 </para>
63142 </listitem>
63143 <listitem>
63144 <para>
63145 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
63146 <option>Resent-</option> header lines are present.
63147 </para>
63148 </listitem>
63149 </itemizedlist>
63150 </section>
63151 <section id="SECID221">
63152 <title>The Auto-Submitted: header line</title>
63153 <para>
63154 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
63155 includes the header line:
63156 </para>
63157 <literallayout class="monospaced">
63158 Auto-Submitted: auto-replied
63159 </literallayout>
63160 </section>
63161 <section id="SECID222">
63162 <title>The Bcc: header line</title>
63163 <para>
63164 <indexterm role="concept">
63165 <primary><emphasis>Bcc:</emphasis> header line</primary>
63166 </indexterm>
63167 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
63168 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
63169 extracting its addresses). If <option>-t</option> is not present on the command line, any
63170 existing <emphasis>Bcc:</emphasis> is not removed.
63171 </para>
63172 </section>
63173 <section id="SECID223">
63174 <title>The Date: header line</title>
63175 <para>
63176 <indexterm role="concept">
63177 <primary><emphasis>Date:</emphasis> header line</primary>
63178 </indexterm>
63179 <indexterm role="concept">
63180 <primary>header lines</primary>
63181 <secondary>Date:</secondary>
63182 </indexterm>
63183 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
63184 Exim adds one, using the current date and time, unless the
63185 <option>suppress_local_fixups</option> control has been specified.
63186 </para>
63187 </section>
63188 <section id="SECID224">
63189 <title>The Delivery-date: header line</title>
63190 <para>
63191 <indexterm role="concept">
63192 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
63193 </indexterm>
63194 <indexterm role="option">
63195 <primary><option>delivery_date_remove</option></primary>
63196 </indexterm>
63197 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
63198 set. Exim can be configured to add them to the final delivery of messages. (See
63199 the generic <option>delivery_date_add</option> transport option.) They should not be present
63200 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
63201 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
63202 messages.
63203 </para>
63204 </section>
63205 <section id="SECID225">
63206 <title>The Envelope-to: header line</title>
63207 <para>
63208 <indexterm role="concept">
63209 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
63210 </indexterm>
63211 <indexterm role="concept">
63212 <primary>header lines</primary>
63213 <secondary>Envelope-to:</secondary>
63214 </indexterm>
63215 <indexterm role="option">
63216 <primary><option>envelope_to_remove</option></primary>
63217 </indexterm>
63218 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
63219 Exim can be configured to add them to the final delivery of messages. (See the
63220 generic <option>envelope_to_add</option> transport option.) They should not be present in
63221 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
63222 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
63223 messages.
63224 </para>
63225 </section>
63226 <section id="SECTthefrohea">
63227 <title>The From: header line</title>
63228 <para>
63229 <indexterm role="concept">
63230 <primary><emphasis>From:</emphasis> header line</primary>
63231 </indexterm>
63232 <indexterm role="concept">
63233 <primary>header lines</primary>
63234 <secondary>From:</secondary>
63235 </indexterm>
63236 <indexterm role="concept">
63237 <primary>Sendmail compatibility</primary>
63238 <secondary><quote>From</quote> line</secondary>
63239 </indexterm>
63240 <indexterm role="concept">
63241 <primary>message</primary>
63242 <secondary>submission</secondary>
63243 </indexterm>
63244 <indexterm role="concept">
63245 <primary>submission mode</primary>
63246 </indexterm>
63247 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
63248 adds one if either of the following conditions is true:
63249 </para>
63250 <itemizedlist>
63251 <listitem>
63252 <para>
63253 The envelope sender address is not empty (that is, this is not a bounce
63254 message). The added header line copies the envelope sender address.
63255 </para>
63256 </listitem>
63257 <listitem>
63258 <para>
63259 <indexterm role="variable">
63260 <primary><varname>$authenticated_id</varname></primary>
63261 </indexterm>
63262 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
63263 </para>
63264 <orderedlist numeration="arabic">
63265 <listitem>
63266 <para>
63267 <indexterm role="variable">
63268 <primary><varname>$qualify_domain</varname></primary>
63269 </indexterm>
63270 If no domain is specified by the submission control, the local part is
63271 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
63272 </para>
63273 </listitem>
63274 <listitem>
63275 <para>
63276 If a non-empty domain is specified by the submission control, the local
63277 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
63278 </para>
63279 </listitem>
63280 <listitem>
63281 <para>
63282 If an empty domain is specified by the submission control,
63283 <varname>$authenticated_id</varname> is assumed to be the complete address.
63284 </para>
63285 </listitem>
63286 </orderedlist>
63287 </listitem>
63288 </itemizedlist>
63289 <para>
63290 A non-empty envelope sender takes precedence.
63291 </para>
63292 <para>
63293 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
63294 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
63295 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
63296 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
63297 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
63298 <option>unknown_login</option> configuration option). The address is qualified with
63299 <option>qualify_domain</option>.
63300 </para>
63301 <para>
63302 For compatibility with Sendmail, if an incoming, non-SMTP message has a
63303 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
63304 user, this is replaced by an address containing the user&#x2019;s login name and full
63305 name as described in section <xref linkend="SECTconstr"/>.
63306 </para>
63307 </section>
63308 <section id="SECID226">
63309 <title>The Message-ID: header line</title>
63310 <para>
63311 <indexterm role="concept">
63312 <primary><emphasis>Message-ID:</emphasis> header line</primary>
63313 </indexterm>
63314 <indexterm role="concept">
63315 <primary>header lines</primary>
63316 <secondary>Message-ID:</secondary>
63317 </indexterm>
63318 <indexterm role="concept">
63319 <primary>message</primary>
63320 <secondary>submission</secondary>
63321 </indexterm>
63322 <indexterm role="option">
63323 <primary><option>message_id_header_text</option></primary>
63324 </indexterm>
63325 If a locally-generated or submission-mode incoming message does not contain a
63326 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
63327 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
63328 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
63329 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
63330 message id, preceded by the letter E to ensure it starts with a letter, and
63331 followed by @ and the primary host name. Additional information can be included
63332 in this header line by setting the <option>message_id_header_text</option> and/or
63333 <option>message_id_header_domain</option> options.
63334 </para>
63335 </section>
63336 <section id="SECID227">
63337 <title>The Received: header line</title>
63338 <para>
63339 <indexterm role="concept">
63340 <primary><emphasis>Received:</emphasis> header line</primary>
63341 </indexterm>
63342 <indexterm role="concept">
63343 <primary>header lines</primary>
63344 <secondary>Received:</secondary>
63345 </indexterm>
63346 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
63347 contents are defined by the <option>received_header_text</option> configuration option, and
63348 Exim automatically adds a semicolon and a timestamp to the configured string.
63349 </para>
63350 <para>
63351 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
63352 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
63353 line is the time that the message started to be received. This is the value
63354 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
63355 </para>
63356 <para>
63357 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
63358 changed to the time of acceptance, which is (apart from a small delay while the
63359 -H spool file is written) the earliest time at which delivery could start.
63360 </para>
63361 </section>
63362 <section id="SECID228">
63363 <title>The References: header line</title>
63364 <para>
63365 <indexterm role="concept">
63366 <primary><emphasis>References:</emphasis> header line</primary>
63367 </indexterm>
63368 <indexterm role="concept">
63369 <primary>header lines</primary>
63370 <secondary>References:</secondary>
63371 </indexterm>
63372 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
63373 header line. This is constructed according to the rules that are described in
63374 section 3.64 of RFC 2822 (which states that replies should contain such a
63375 header line), and section 3.14 of RFC 3834 (which states that automatic
63376 responses are not different in this respect). However, because some mail
63377 processing software does not cope well with very long header lines, no more
63378 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
63379 incoming message. If there are more than 12, the first one and then the final
63380 11 are copied, before adding the message ID of the incoming message.
63381 </para>
63382 </section>
63383 <section id="SECID229">
63384 <title>The Return-path: header line</title>
63385 <para>
63386 <indexterm role="concept">
63387 <primary><emphasis>Return-path:</emphasis> header line</primary>
63388 </indexterm>
63389 <indexterm role="concept">
63390 <primary>header lines</primary>
63391 <secondary>Return-path:</secondary>
63392 </indexterm>
63393 <indexterm role="option">
63394 <primary><option>return_path_remove</option></primary>
63395 </indexterm>
63396 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
63397 it does the final delivery of messages. (See the generic <option>return_path_add</option>
63398 transport option.) Therefore, they should not be present in messages in
63399 transit. If the <option>return_path_remove</option> configuration option is set (the
63400 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
63401 </para>
63402 </section>
63403 <section id="SECTthesenhea">
63404 <title>The Sender: header line</title>
63405 <para>
63406 <indexterm role="concept">
63407 <primary><emphasis>Sender:</emphasis> header line</primary>
63408 </indexterm>
63409 <indexterm role="concept">
63410 <primary>message</primary>
63411 <secondary>submission</secondary>
63412 </indexterm>
63413 <indexterm role="concept">
63414 <primary>header lines</primary>
63415 <secondary>Sender:</secondary>
63416 </indexterm>
63417 For a locally-originated message from an untrusted user, Exim may remove an
63418 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
63419 these actions by setting the <option>local_sender_retain</option> option true, the
63420 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
63421 control setting.
63422 </para>
63423 <para>
63424 When a local message is received from an untrusted user and
63425 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
63426 control has not been set, a check is made to see if the address given in the
63427 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
63428 that is expected has the login name as the local part and the value of
63429 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
63430 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
63431 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
63432 line is added to the message.
63433 </para>
63434 <para>
63435 If you set <option>local_from_check</option> false, this checking does not occur. However,
63436 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
63437 <option>local_sender_retain</option> to be true. It is not possible to set both of these
63438 options true at the same time.
63439 </para>
63440 <para>
63441 <indexterm role="concept">
63442 <primary>submission mode</primary>
63443 </indexterm>
63444 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
63445 received over TCP/IP or for messages submitted by trusted users. However, when
63446 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
63447 not specified on the submission control, the following processing takes place:
63448 </para>
63449 <para>
63450 <indexterm role="variable">
63451 <primary><varname>$authenticated_id</varname></primary>
63452 </indexterm>
63453 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
63454 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
63455 created as follows:
63456 </para>
63457 <itemizedlist>
63458 <listitem>
63459 <para>
63460 <indexterm role="variable">
63461 <primary><varname>$qualify_domain</varname></primary>
63462 </indexterm>
63463 If no domain is specified by the submission control, the local part is
63464 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
63465 </para>
63466 </listitem>
63467 <listitem>
63468 <para>
63469 If a non-empty domain is specified by the submission control, the local part
63470 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
63471 </para>
63472 </listitem>
63473 <listitem>
63474 <para>
63475 If an empty domain is specified by the submission control,
63476 <varname>$authenticated_id</varname> is assumed to be the complete address.
63477 </para>
63478 </listitem>
63479 </itemizedlist>
63480 <para>
63481 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
63482 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
63483 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
63484 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
63485 </para>
63486 <para>
63487 <indexterm role="concept">
63488 <primary>return path</primary>
63489 <secondary>created from <emphasis>Sender:</emphasis></secondary>
63490 </indexterm>
63491 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
63492 the message (the envelope sender address) is changed to be the same address,
63493 except in the case of submission mode when <option>sender_retain</option> is specified.
63494 </para>
63495 </section>
63496 <section id="SECTheadersaddrem">
63497 <title>Adding and removing header lines in routers and transports</title>
63498 <para>
63499 <indexterm role="concept">
63500 <primary>header lines</primary>
63501 <secondary>adding; in router or transport</secondary>
63502 </indexterm>
63503 <indexterm role="concept">
63504 <primary>header lines</primary>
63505 <secondary>removing; in router or transport</secondary>
63506 </indexterm>
63507 When a message is delivered, the addition and removal of header lines can be
63508 specified in a system filter, or on any of the routers and transports that
63509 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
63510 modifying headers in a system filter. Header lines can also be added in an ACL
63511 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
63512 </para>
63513 <para>
63514 In contrast to what happens in a system filter, header modifications that are
63515 specified on routers and transports apply only to the particular recipient
63516 addresses that are being processed by those routers and transports. These
63517 changes do not actually take place until a copy of the message is being
63518 transported. Therefore, they do not affect the basic set of header lines, and
63519 they do not affect the values of the variables that refer to header lines.
63520 </para>
63521 <para>
63522 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
63523 the transport cannot refer to the modified header lines, because such
63524 expansions all occur before the message is actually transported.
63525 </para>
63526 <para>
63527 For both routers and transports, the argument of a <option>headers_add</option>
63528 option must be in the form of one or more RFC 2822 header lines, separated by
63529 newlines (coded as <quote>\n</quote>). For example:
63530 </para>
63531 <literallayout class="monospaced">
63532 headers_add = X-added-header: added by $primary_hostname\n\
63533               X-added-second: another added header line
63534 </literallayout>
63535 <para>
63536 Exim does not check the syntax of these added header lines.
63537 </para>
63538 <para>
63539 Multiple <option>headers_add</option> options for a single router or transport can be
63540 specified; the values will append to a single list of header lines.
63541 Each header-line is separately expanded.
63542 </para>
63543 <para>
63544 The argument of a <option>headers_remove</option> option must consist of a colon-separated
63545 list of header names. This is confusing, because header names themselves are
63546 often terminated by colons. In this case, the colons are the list separators,
63547 not part of the names. For example:
63548 </para>
63549 <literallayout class="monospaced">
63550 headers_remove = return-receipt-to:acknowledge-to
63551 </literallayout>
63552 <para>
63553 Multiple <option>headers_remove</option> options for a single router or transport can be
63554 specified; the arguments will append to a single header-names list.
63555 Each item is separately expanded.
63556 Note that colons in complex expansions which are used to
63557 form all or part of a <option>headers_remove</option> list
63558 will act as list separators.
63559 </para>
63560 <para>
63561 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
63562 items are expanded at routing time,
63563 and then associated with all addresses that are
63564 accepted by that router, and also with any new addresses that it generates. If
63565 an address passes through several routers as a result of aliasing or
63566 forwarding, the changes are cumulative.
63567 </para>
63568 <para>
63569 <indexterm role="option">
63570 <primary><option>unseen</option></primary>
63571 </indexterm>
63572 However, this does not apply to multiple routers that result from the use of
63573 the <option>unseen</option> option. Any header modifications that were specified by the
63574 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
63575 </para>
63576 <para>
63577 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
63578 settings cannot be delivered together in a batch, so a transport is always
63579 dealing with a set of addresses that have the same header-processing
63580 requirements.
63581 </para>
63582 <para>
63583 The transport starts by writing the original set of header lines that arrived
63584 with the message, possibly modified by the system filter. As it writes out
63585 these lines, it consults the list of header names that were attached to the
63586 recipient address(es) by <option>headers_remove</option> options in routers, and it also
63587 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
63588 names are on either of these lists are not written out. If there are multiple
63589 instances of any listed header, they are all skipped.
63590 </para>
63591 <para>
63592 After the remaining original header lines have been written, new header
63593 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
63594 the order in which they were attached to the address. These are followed by any
63595 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
63596 </para>
63597 <para>
63598 This way of handling header line modifications in routers and transports has
63599 the following consequences:
63600 </para>
63601 <itemizedlist>
63602 <listitem>
63603 <para>
63604 The original set of header lines, possibly modified by the system filter,
63605 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
63606 to it, at all times.
63607 </para>
63608 </listitem>
63609 <listitem>
63610 <para>
63611 Header lines that are added by a router&#x2019;s
63612 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
63613 expansion syntax in subsequent routers or the transport.
63614 </para>
63615 </listitem>
63616 <listitem>
63617 <para>
63618 Conversely, header lines that are specified for removal by <option>headers_remove</option>
63619 in a router remain visible to subsequent routers and the transport.
63620 </para>
63621 </listitem>
63622 <listitem>
63623 <para>
63624 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
63625 a later router or by a transport.
63626 </para>
63627 </listitem>
63628 <listitem>
63629 <para>
63630 An added header can refer to the contents of an original header that is to be
63631 removed, even it has the same name as the added header. For example:
63632 </para>
63633 <literallayout class="monospaced">
63634 headers_remove = subject
63635 headers_add = Subject: new subject (was: $h_subject:)
63636 </literallayout>
63637 </listitem>
63638 </itemizedlist>
63639 <para>
63640 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
63641 for a <command>redirect</command> router that has the <option>one_time</option> option set.
63642 </para>
63643 </section>
63644 <section id="SECTconstr">
63645 <title>Constructed addresses</title>
63646 <para>
63647 <indexterm role="concept">
63648 <primary>address</primary>
63649 <secondary>constructed</secondary>
63650 </indexterm>
63651 <indexterm role="concept">
63652 <primary>constructed address</primary>
63653 </indexterm>
63654 When Exim constructs a sender address for a locally-generated message, it uses
63655 the form
63656 </para>
63657 <literallayout>
63658 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
63659 </literallayout>
63660 <para>
63661 For example:
63662 </para>
63663 <literallayout class="monospaced">
63664 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
63665 </literallayout>
63666 <para>
63667 The user name is obtained from the <option>-F</option> command line option if set, or
63668 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
63669 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
63670 ampersand character, this is replaced by the login name with the first letter
63671 upper cased, as is conventional in a number of operating systems. See the
63672 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
63673 The <option>unknown_username</option> option can be used to specify user names in cases when
63674 there is no password file entry.
63675 </para>
63676 <para>
63677 <indexterm role="concept">
63678 <primary>RFC 2047</primary>
63679 </indexterm>
63680 In all cases, the user name is made to conform to RFC 2822 by quoting all or
63681 parts of it if necessary. In addition, if it contains any non-printing
63682 characters, it is encoded as described in RFC 2047, which defines a way of
63683 including non-ASCII characters in header lines. The value of the
63684 <option>headers_charset</option> option specifies the name of the encoding that is used (the
63685 characters are assumed to be in this encoding). The setting of
63686 <option>print_topbitchars</option> controls whether characters with the top bit set (that
63687 is, with codes greater than 127) count as printing characters or not.
63688 </para>
63689 </section>
63690 <section id="SECID230">
63691 <title>Case of local parts</title>
63692 <para>
63693 <indexterm role="concept">
63694 <primary>case of local parts</primary>
63695 </indexterm>
63696 <indexterm role="concept">
63697 <primary>local part</primary>
63698 <secondary>case of</secondary>
63699 </indexterm>
63700 RFC 2822 states that the case of letters in the local parts of addresses cannot
63701 be assumed to be non-significant. Exim preserves the case of local parts of
63702 addresses, but by default it uses a lower-cased form when it is routing,
63703 because on most Unix systems, usernames are in lower case and case-insensitive
63704 routing is required. However, any particular router can be made to use the
63705 original case for local parts by setting the <option>caseful_local_part</option> generic
63706 router option.
63707 </para>
63708 <para>
63709 <indexterm role="concept">
63710 <primary>mixed-case login names</primary>
63711 </indexterm>
63712 If you must have mixed-case user names on your system, the best way to proceed,
63713 assuming you want case-independent handling of incoming email, is to set up
63714 your first router to convert incoming local parts in your domains to the
63715 correct case by means of a file lookup. For example:
63716 </para>
63717 <literallayout class="monospaced">
63718 correct_case:
63719   driver = redirect
63720   domains = +local_domains
63721   data = ${lookup{$local_part}cdb\
63722               {/etc/usercased.cdb}{$value}fail}\
63723               @$domain
63724 </literallayout>
63725 <para>
63726 For this router, the local part is forced to lower case by the default action
63727 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
63728 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
63729 on any subsequent routers which process your domains, they will operate on
63730 local parts with the correct case in a case-sensitive manner.
63731 </para>
63732 </section>
63733 <section id="SECID231">
63734 <title>Dots in local parts</title>
63735 <para>
63736 <indexterm role="concept">
63737 <primary>dot</primary>
63738 <secondary>in local part</secondary>
63739 </indexterm>
63740 <indexterm role="concept">
63741 <primary>local part</primary>
63742 <secondary>dots in</secondary>
63743 </indexterm>
63744 RFC 2822 forbids empty components in local parts. That is, an unquoted local
63745 part may not begin or end with a dot, nor have two consecutive dots in the
63746 middle. However, it seems that many MTAs do not enforce this, so Exim permits
63747 empty components for compatibility.
63748 </para>
63749 </section>
63750 <section id="SECID232">
63751 <title>Rewriting addresses</title>
63752 <para>
63753 <indexterm role="concept">
63754 <primary>rewriting</primary>
63755 <secondary>addresses</secondary>
63756 </indexterm>
63757 Rewriting of sender and recipient addresses, and addresses in headers, can
63758 happen automatically, or as the result of configuration options, as described
63759 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
63760 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
63761 </para>
63762 <para>
63763 Automatic rewriting includes qualification, as mentioned above. The other case
63764 in which it can happen is when an incomplete non-local domain is given. The
63765 routing process may cause this to be expanded into the full domain name. For
63766 example, a header such as
63767 </para>
63768 <literallayout class="monospaced">
63769 To: hare@teaparty
63770 </literallayout>
63771 <para>
63772 might get rewritten as
63773 </para>
63774 <literallayout class="monospaced">
63775 To: hare@teaparty.wonderland.fict.example
63776 </literallayout>
63777 <para>
63778 Rewriting as a result of routing is the one kind of message processing that
63779 does not happen at input time, as it cannot be done until the address has
63780 been routed.
63781 </para>
63782 <para>
63783 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
63784 addresses have been routed, in case any of the headers get changed as a
63785 result of routing. However, doing this in practice would hold up many
63786 deliveries for unreasonable amounts of time, just because one address could not
63787 immediately be routed. Exim therefore does not delay other deliveries when
63788 routing of one or more addresses is deferred.
63789 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
63790 </para>
63791 </section>
63792 </chapter>
63793
63794 <chapter id="CHAPSMTP">
63795 <title>SMTP processing</title>
63796 <para>
63797 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
63798 <primary>SMTP</primary>
63799 <secondary>processing details</secondary>
63800 </indexterm>
63801 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
63802 <primary>LMTP</primary>
63803 <secondary>processing details</secondary>
63804 </indexterm>
63805 Exim supports a number of different ways of using the SMTP protocol, and its
63806 LMTP variant, which is an interactive protocol for transferring messages into a
63807 closed mail store application. This chapter contains details of how SMTP is
63808 processed. For incoming mail, the following are available:
63809 </para>
63810 <itemizedlist>
63811 <listitem>
63812 <para>
63813 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
63814 </para>
63815 </listitem>
63816 <listitem>
63817 <para>
63818 SMTP over the standard input and output (the <option>-bs</option> option);
63819 </para>
63820 </listitem>
63821 <listitem>
63822 <para>
63823 Batched SMTP on the standard input (the <option>-bS</option> option).
63824 </para>
63825 </listitem>
63826 </itemizedlist>
63827 <para>
63828 For mail delivery, the following are available:
63829 </para>
63830 <itemizedlist>
63831 <listitem>
63832 <para>
63833 SMTP over TCP/IP (the <command>smtp</command> transport);
63834 </para>
63835 </listitem>
63836 <listitem>
63837 <para>
63838 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
63839 <quote>lmtp</quote>);
63840 </para>
63841 </listitem>
63842 <listitem>
63843 <para>
63844 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
63845 transport);
63846 </para>
63847 </listitem>
63848 <listitem>
63849 <para>
63850 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
63851 the <option>use_bsmtp</option> option set).
63852 </para>
63853 </listitem>
63854 </itemizedlist>
63855 <para>
63856 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
63857 stored in or read from files (or pipes), in a format in which SMTP commands are
63858 used to contain the envelope information.
63859 </para>
63860 <section id="SECToutSMTPTCP">
63861 <title>Outgoing SMTP and LMTP over TCP/IP</title>
63862 <para>
63863 <indexterm role="concept">
63864 <primary>SMTP</primary>
63865 <secondary>outgoing over TCP/IP</secondary>
63866 </indexterm>
63867 <indexterm role="concept">
63868 <primary>outgoing SMTP over TCP/IP</primary>
63869 </indexterm>
63870 <indexterm role="concept">
63871 <primary>LMTP</primary>
63872 <secondary>over TCP/IP</secondary>
63873 </indexterm>
63874 <indexterm role="concept">
63875 <primary>outgoing LMTP over TCP/IP</primary>
63876 </indexterm>
63877 <indexterm role="concept">
63878 <primary>EHLO</primary>
63879 </indexterm>
63880 <indexterm role="concept">
63881 <primary>HELO</primary>
63882 </indexterm>
63883 <indexterm role="concept">
63884 <primary>SIZE option on MAIL command</primary>
63885 </indexterm>
63886 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
63887 The <option>protocol</option> option selects which protocol is to be used, but the actual
63888 processing is the same in both cases.
63889 </para>
63890 <para>
63891 If, in response to its EHLO command, Exim is told that the SIZE
63892 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
63893 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
63894 <option>size_addition</option> option (default 1024) to allow for additions to the message
63895 such as per-transport header lines, or changes made in a
63896 <indexterm role="concept">
63897 <primary>transport</primary>
63898 <secondary>filter</secondary>
63899 </indexterm>
63900 <indexterm role="concept">
63901 <primary>filter</primary>
63902 <secondary>transport filter</secondary>
63903 </indexterm>
63904 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
63905 suppressed.
63906 </para>
63907 <para>
63908 If the remote server advertises support for PIPELINING, Exim uses the
63909 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
63910 required for the transaction.
63911 </para>
63912 <para>
63913 If the remote server advertises support for the STARTTLS command, and Exim
63914 was built to support TLS encryption, it tries to start a TLS session unless the
63915 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
63916 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
63917 is called for verification.
63918 </para>
63919 <para>
63920 If the remote server advertises support for the AUTH command, Exim scans
63921 the authenticators configuration for any suitable client settings, as described
63922 in chapter <xref linkend="CHAPSMTPAUTH"/>.
63923 </para>
63924 <para>
63925 <indexterm role="concept">
63926 <primary>carriage return</primary>
63927 </indexterm>
63928 <indexterm role="concept">
63929 <primary>linefeed</primary>
63930 </indexterm>
63931 Responses from the remote host are supposed to be terminated by CR followed by
63932 LF. However, there are known to be hosts that do not send CR characters, so in
63933 order to be able to interwork with such hosts, Exim treats LF on its own as a
63934 line terminator.
63935 </para>
63936 <para>
63937 If a message contains a number of different addresses, all those with the same
63938 characteristics (for example, the same envelope sender) that resolve to the
63939 same set of hosts, in the same order, are sent in a single SMTP transaction,
63940 even if they are for different domains, unless there are more than the setting
63941 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
63942 they are split into groups containing no more than <option>max_rcpt</option>s addresses
63943 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
63944 in parallel sessions. The order of hosts with identical MX values is not
63945 significant when checking whether addresses can be batched in this way.
63946 </para>
63947 <para>
63948 When the <command>smtp</command> transport suffers a temporary failure that is not
63949 message-related, Exim updates its transport-specific database, which contains
63950 records indexed by host name that remember which messages are waiting for each
63951 particular host. It also updates the retry database with new retry times.
63952 </para>
63953 <para>
63954 <indexterm role="concept">
63955 <primary>hints database</primary>
63956 <secondary>retry keys</secondary>
63957 </indexterm>
63958 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
63959 a multi-homed host is broken, it will soon be skipped most of the time.
63960 See the next section for more detail about error handling.
63961 </para>
63962 <para>
63963 <indexterm role="concept">
63964 <primary>SMTP</primary>
63965 <secondary>passed connection</secondary>
63966 </indexterm>
63967 <indexterm role="concept">
63968 <primary>SMTP</primary>
63969 <secondary>batching over TCP/IP</secondary>
63970 </indexterm>
63971 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
63972 looks in the hints database for the transport to see if there are any queued
63973 messages waiting for the host to which it is connected. If it finds one, it
63974 creates a new Exim process using the <option>-MC</option> option (which can only be used by
63975 a process running as root or the Exim user) and passes the TCP/IP socket to it
63976 so that it can deliver another message using the same socket. The new process
63977 does only those deliveries that are routed to the connected host, and may in
63978 turn pass the socket on to a third process, and so on.
63979 </para>
63980 <para>
63981 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
63982 limit the number of messages sent down a single TCP/IP connection.
63983 </para>
63984 <para>
63985 <indexterm role="concept">
63986 <primary>asterisk</primary>
63987 <secondary>after IP address</secondary>
63988 </indexterm>
63989 The second and subsequent messages delivered down an existing connection are
63990 identified in the main log by the addition of an asterisk after the closing
63991 square bracket of the IP address.
63992 </para>
63993 </section>
63994 <section id="SECToutSMTPerr">
63995 <title>Errors in outgoing SMTP</title>
63996 <para>
63997 <indexterm role="concept">
63998 <primary>error</primary>
63999 <secondary>in outgoing SMTP</secondary>
64000 </indexterm>
64001 <indexterm role="concept">
64002 <primary>SMTP</primary>
64003 <secondary>errors in outgoing</secondary>
64004 </indexterm>
64005 <indexterm role="concept">
64006 <primary>host</primary>
64007 <secondary>error</secondary>
64008 </indexterm>
64009 Three different kinds of error are recognized for outgoing SMTP: host errors,
64010 message errors, and recipient errors.
64011 </para>
64012 <variablelist>
64013 <varlistentry>
64014 <term><emphasis role="bold">Host errors</emphasis></term>
64015 <listitem>
64016 <para>
64017 A host error is not associated with a particular message or with a
64018 particular recipient of a message. The host errors are:
64019 </para>
64020 <itemizedlist>
64021 <listitem>
64022 <para>
64023 Connection refused or timed out,
64024 </para>
64025 </listitem>
64026 <listitem>
64027 <para>
64028 Any error response code on connection,
64029 </para>
64030 </listitem>
64031 <listitem>
64032 <para>
64033 Any error response code to EHLO or HELO,
64034 </para>
64035 </listitem>
64036 <listitem>
64037 <para>
64038 Loss of connection at any time, except after <quote>.</quote>,
64039 </para>
64040 </listitem>
64041 <listitem>
64042 <para>
64043 I/O errors at any time,
64044 </para>
64045 </listitem>
64046 <listitem>
64047 <para>
64048 Timeouts during the session, other than in response to MAIL, RCPT or
64049 the <quote>.</quote> at the end of the data.
64050 </para>
64051 </listitem>
64052 </itemizedlist>
64053 <para>
64054 For a host error, a permanent error response on connection, or in response to
64055 EHLO, causes all addresses routed to the host to be failed. Any other host
64056 error causes all addresses to be deferred, and retry data to be created for the
64057 host. It is not tried again, for any message, until its retry time arrives. If
64058 the current set of addresses are not all delivered in this run (to some
64059 alternative host), the message is added to the list of those waiting for this
64060 host, so if it is still undelivered when a subsequent successful delivery is
64061 made to the host, it will be sent down the same SMTP connection.
64062 </para>
64063 </listitem></varlistentry>
64064 <varlistentry>
64065 <term><emphasis role="bold">Message errors</emphasis></term>
64066 <listitem>
64067 <para>
64068 <indexterm role="concept">
64069 <primary>message</primary>
64070 <secondary>error</secondary>
64071 </indexterm>
64072 A message error is associated with a particular message when sent to a
64073 particular host, but not with a particular recipient of the message. The
64074 message errors are:
64075 </para>
64076 <itemizedlist>
64077 <listitem>
64078 <para>
64079 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
64080 the data,
64081 </para>
64082 </listitem>
64083 <listitem>
64084 <para>
64085 Timeout after MAIL,
64086 </para>
64087 </listitem>
64088 <listitem>
64089 <para>
64090 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
64091 timeout after the DATA command itself is treated as a host error, as is loss of
64092 connection at any other time.
64093 </para>
64094 </listitem>
64095 </itemizedlist>
64096 <para>
64097 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
64098 to be failed, and a delivery error report to be returned to the sender. A
64099 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
64100 addresses to be deferred. Retry data is not created for the host, but instead,
64101 a retry record for the combination of host plus message id is created. The
64102 message is not added to the list of those waiting for this host. This ensures
64103 that the failing message will not be sent to this host again until the retry
64104 time arrives. However, other messages that are routed to the host are not
64105 affected, so if it is some property of the message that is causing the error,
64106 it will not stop the delivery of other mail.
64107 </para>
64108 <para>
64109 If the remote host specified support for the SIZE parameter in its response
64110 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
64111 over-large message will cause a message error because the error arrives as a
64112 response to MAIL.
64113 </para>
64114 </listitem></varlistentry>
64115 <varlistentry>
64116 <term><emphasis role="bold">Recipient errors</emphasis></term>
64117 <listitem>
64118 <para>
64119 <indexterm role="concept">
64120 <primary>recipient</primary>
64121 <secondary>error</secondary>
64122 </indexterm>
64123 A recipient error is associated with a particular recipient of a message. The
64124 recipient errors are:
64125 </para>
64126 <itemizedlist>
64127 <listitem>
64128 <para>
64129 Any error response to RCPT,
64130 </para>
64131 </listitem>
64132 <listitem>
64133 <para>
64134 Timeout after RCPT.
64135 </para>
64136 </listitem>
64137 </itemizedlist>
64138 <para>
64139 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
64140 recipient address to be failed, and a bounce message to be returned to the
64141 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
64142 address to be deferred, and routing retry data to be created for it. This is
64143 used to delay processing of the address in subsequent queue runs, until its
64144 routing retry time arrives. This applies to all messages, but because it
64145 operates only in queue runs, one attempt will be made to deliver a new message
64146 to the failing address before the delay starts to operate. This ensures that,
64147 if the failure is really related to the message rather than the recipient
64148 (<quote>message too big for this recipient</quote> is a possible example), other messages
64149 have a chance of getting delivered. If a delivery to the address does succeed,
64150 the retry information gets cleared, so all stuck messages get tried again, and
64151 the retry clock is reset.
64152 </para>
64153 <para>
64154 The message is not added to the list of those waiting for this host. Use of the
64155 host for other messages is unaffected, and except in the case of a timeout,
64156 other recipients are processed independently, and may be successfully delivered
64157 in the current SMTP session. After a timeout it is of course impossible to
64158 proceed with the session, so all addresses get deferred. However, those other
64159 than the one that failed do not suffer any subsequent retry delays. Therefore,
64160 if one recipient is causing trouble, the others have a chance of getting
64161 through when a subsequent delivery attempt occurs before the failing
64162 recipient&#x2019;s retry time.
64163 </para>
64164 </listitem></varlistentry>
64165 </variablelist>
64166 <para>
64167 In all cases, if there are other hosts (or IP addresses) available for the
64168 current set of addresses (for example, from multiple MX records), they are
64169 tried in this run for any undelivered addresses, subject of course to their
64170 own retry data. In other words, recipient error retry data does not take effect
64171 until the next delivery attempt.
64172 </para>
64173 <para>
64174 Some hosts have been observed to give temporary error responses to every
64175 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
64176 would be nice if such circumstances could be recognized, and defer data for the
64177 host itself created, but this is not possible within the current Exim design.
64178 What actually happens is that retry data for every (host, message) combination
64179 is created.
64180 </para>
64181 <para>
64182 The reason that timeouts after MAIL and RCPT are treated specially is that
64183 these can sometimes arise as a result of the remote host&#x2019;s verification
64184 procedures. Exim makes this assumption, and treats them as if a temporary error
64185 response had been received. A timeout after <quote>.</quote> is treated specially because
64186 it is known that some broken implementations fail to recognize the end of the
64187 message if the last character of the last line is a binary zero. Thus, it is
64188 helpful to treat this case as a message error.
64189 </para>
64190 <para>
64191 Timeouts at other times are treated as host errors, assuming a problem with the
64192 host, or the connection to it. If a timeout after MAIL, RCPT,
64193 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
64194 the timeout is likely to occur at some other point in the dialogue, causing it
64195 then to be treated as a host error.
64196 </para>
64197 <para>
64198 There is experimental evidence that some MTAs drop the connection after the
64199 terminating <quote>.</quote> if they do not like the contents of the message for some
64200 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
64201 should be given. That is why Exim treats this case as a message rather than a
64202 host error, in order not to delay other messages to the same host.
64203 </para>
64204 </section>
64205 <section id="SECID233">
64206 <title>Incoming SMTP messages over TCP/IP</title>
64207 <para>
64208 <indexterm role="concept">
64209 <primary>SMTP</primary>
64210 <secondary>incoming over TCP/IP</secondary>
64211 </indexterm>
64212 <indexterm role="concept">
64213 <primary>incoming SMTP over TCP/IP</primary>
64214 </indexterm>
64215 <indexterm role="concept">
64216 <primary>inetd</primary>
64217 </indexterm>
64218 <indexterm role="concept">
64219 <primary>daemon</primary>
64220 </indexterm>
64221 Incoming SMTP messages can be accepted in one of two ways: by running a
64222 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
64223 <filename>/etc/inetd.conf</filename> should be like this:
64224 </para>
64225 <literallayout class="monospaced">
64226 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
64227 </literallayout>
64228 <para>
64229 Exim distinguishes between this case and the case of a locally running user
64230 agent using the <option>-bs</option> option by checking whether or not the standard input is
64231 a socket. When it is, either the port must be privileged (less than 1024), or
64232 the caller must be root or the Exim user. If any other user passes a socket
64233 with an unprivileged port number, Exim prints a message on the standard error
64234 stream and exits with an error code.
64235 </para>
64236 <para>
64237 By default, Exim does not make a log entry when a remote host connects or
64238 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
64239 unexpected. It can be made to write such log entries by setting the
64240 <option>smtp_connection</option> log selector.
64241 </para>
64242 <para>
64243 <indexterm role="concept">
64244 <primary>carriage return</primary>
64245 </indexterm>
64246 <indexterm role="concept">
64247 <primary>linefeed</primary>
64248 </indexterm>
64249 Commands from the remote host are supposed to be terminated by CR followed by
64250 LF. However, there are known to be hosts that do not send CR characters. In
64251 order to be able to interwork with such hosts, Exim treats LF on its own as a
64252 line terminator.
64253 Furthermore, because common code is used for receiving messages from all
64254 sources, a CR on its own is also interpreted as a line terminator. However, the
64255 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
64256 </para>
64257 <para>
64258 <indexterm role="concept">
64259 <primary>EHLO</primary>
64260 <secondary>invalid data</secondary>
64261 </indexterm>
64262 <indexterm role="concept">
64263 <primary>HELO</primary>
64264 <secondary>invalid data</secondary>
64265 </indexterm>
64266 One area that sometimes gives rise to problems concerns the EHLO or
64267 HELO commands. Some clients send syntactically invalid versions of these
64268 commands, which Exim rejects by default. (This is nothing to do with verifying
64269 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
64270 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
64271 match the broken hosts that send invalid commands.
64272 </para>
64273 <para>
64274 <indexterm role="concept">
64275 <primary>SIZE option on MAIL command</primary>
64276 </indexterm>
64277 <indexterm role="concept">
64278 <primary>MAIL</primary>
64279 <secondary>SIZE option</secondary>
64280 </indexterm>
64281 The amount of disk space available is checked whenever SIZE is received on
64282 a MAIL command, independently of whether <option>message_size_limit</option> or
64283 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
64284 false. A temporary error is given if there is not enough space. If
64285 <option>check_spool_space</option> is set, the check is for that amount of space plus the
64286 value given with SIZE, that is, it checks that the addition of the incoming
64287 message will not reduce the space below the threshold.
64288 </para>
64289 <para>
64290 When a message is successfully received, Exim includes the local message id in
64291 its response to the final <quote>.</quote> that terminates the data. If the remote host
64292 logs this text it can help with tracing what has happened to a message.
64293 </para>
64294 <para>
64295 The Exim daemon can limit the number of simultaneous incoming connections it is
64296 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
64297 number of simultaneous incoming connections from a single remote host (see the
64298 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
64299 rejected using the SMTP temporary error code 421.
64300 </para>
64301 <para>
64302 The Exim daemon does not rely on the SIGCHLD signal to detect when a
64303 subprocess has finished, as this can get lost at busy times. Instead, it looks
64304 for completed subprocesses every time it wakes up. Provided there are other
64305 things happening (new incoming calls, starts of queue runs), completed
64306 processes will be noticed and tidied away. On very quiet systems you may
64307 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
64308 it will be noticed when the daemon next wakes up.
64309 </para>
64310 <para>
64311 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
64312 and can also be set up to reject SMTP calls from non-reserved hosts at times of
64313 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
64314 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
64315 applies in both the daemon and <emphasis>inetd</emphasis> cases.
64316 </para>
64317 <para>
64318 Exim normally starts a delivery process for each message received, though this
64319 can be varied by means of the <option>-odq</option> command line option and the
64320 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
64321 number of simultaneously running delivery processes started in this way from
64322 SMTP input can be limited by the <option>smtp_accept_queue</option> and
64323 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
64324 subsequently received messages are just put on the input queue without starting
64325 a delivery process.
64326 </para>
64327 <para>
64328 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
64329 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
64330 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
64331 handled by an entirely independent Exim process. Control by load average is,
64332 however, available with <emphasis>inetd</emphasis>.
64333 </para>
64334 <para>
64335 Exim can be configured to verify addresses in incoming SMTP commands as they
64336 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
64337 to rewrite addresses at this time &ndash; before any syntax checking is done. See
64338 section <xref linkend="SECTrewriteS"/>.
64339 </para>
64340 <para>
64341 Exim can also be configured to limit the rate at which a client host submits
64342 MAIL and RCPT commands in a single SMTP session. See the
64343 <option>smtp_ratelimit_hosts</option> option.
64344 </para>
64345 </section>
64346 <section id="SECID234">
64347 <title>Unrecognized SMTP commands</title>
64348 <para>
64349 <indexterm role="concept">
64350 <primary>SMTP</primary>
64351 <secondary>unrecognized commands</secondary>
64352 </indexterm>
64353 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
64354 commands during a single SMTP connection, it drops the connection after sending
64355 the error response to the last command. The default value for
64356 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
64357 abuse that subvert web servers into making connections to SMTP ports; in these
64358 circumstances, a number of non-SMTP lines are sent first.
64359 </para>
64360 </section>
64361 <section id="SECID235">
64362 <title>Syntax and protocol errors in SMTP commands</title>
64363 <para>
64364 <indexterm role="concept">
64365 <primary>SMTP</primary>
64366 <secondary>syntax errors</secondary>
64367 </indexterm>
64368 <indexterm role="concept">
64369 <primary>SMTP</primary>
64370 <secondary>protocol errors</secondary>
64371 </indexterm>
64372 A syntax error is detected if an SMTP command is recognized, but there is
64373 something syntactically wrong with its data, for example, a malformed email
64374 address in a RCPT command. Protocol errors include invalid command
64375 sequencing such as RCPT before MAIL. If Exim receives more than
64376 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
64377 drops the connection after sending the error response to the last command. The
64378 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
64379 broken clients that loop sending bad commands (yes, it has been seen).
64380 </para>
64381 </section>
64382 <section id="SECID236">
64383 <title>Use of non-mail SMTP commands</title>
64384 <para>
64385 <indexterm role="concept">
64386 <primary>SMTP</primary>
64387 <secondary>non-mail commands</secondary>
64388 </indexterm>
64389 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
64390 DATA. Exim counts such commands, and drops the connection if there are too
64391 many of them in a single SMTP session. This action catches some
64392 denial-of-service attempts and things like repeated failing AUTHs, or a mad
64393 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
64394 defines what <quote>too many</quote> means. Its default value is 10.
64395 </para>
64396 <para>
64397 When a new message is expected, one occurrence of RSET is not counted. This
64398 allows a client to send one RSET between messages (this is not necessary,
64399 but some clients do it). Exim also allows one uncounted occurrence of HELO
64400 or EHLO, and one occurrence of STARTTLS between messages. After
64401 starting up a TLS session, another EHLO is expected, and so it too is not
64402 counted.
64403 </para>
64404 <para>
64405 The first occurrence of AUTH in a connection, or immediately following
64406 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
64407 RCPT, DATA, and QUIT are counted.
64408 </para>
64409 <para>
64410 You can control which hosts are subject to the limit set by
64411 <option>smtp_accept_max_nonmail</option> by setting
64412 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
64413 the limit apply to all hosts. This option means that you can exclude any
64414 specific badly-behaved hosts that you have to live with.
64415 </para>
64416 </section>
64417 <section id="SECID237">
64418 <title>The VRFY and EXPN commands</title>
64419 <para>
64420 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
64421 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
64422 appropriate) in order to decide whether the command should be accepted or not.
64423 </para>
64424 <para>
64425 <indexterm role="concept">
64426 <primary>VRFY</primary>
64427 <secondary>processing</secondary>
64428 </indexterm>
64429 When no ACL is defined for VRFY, or if it rejects without
64430 setting an explicit response code, the command is accepted
64431 (with a 252 SMTP response code)
64432 in order to support awkward clients that do a VRFY before every RCPT.
64433 When VRFY is accepted, it runs exactly the same code as when Exim is
64434 called with the <option>-bv</option> option, and returns 250/451/550
64435 SMTP response codes.
64436 </para>
64437 <para>
64438 <indexterm role="concept">
64439 <primary>EXPN</primary>
64440 <secondary>processing</secondary>
64441 </indexterm>
64442 If no ACL for EXPN is defined, the command is rejected.
64443 When EXPN is accepted, a single-level expansion of the address is done.
64444 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
64445 than a verification (the <option>-bv</option> option). If an unqualified local part is given
64446 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
64447 of VRFY and EXPN commands are logged on the main and reject logs, and
64448 VRFY verification failures are logged on the main log for consistency with
64449 RCPT failures.
64450 </para>
64451 </section>
64452 <section id="SECTETRN">
64453 <title>The ETRN command</title>
64454 <para>
64455 <indexterm role="concept">
64456 <primary>ETRN</primary>
64457 <secondary>processing</secondary>
64458 </indexterm>
64459 RFC 1985 describes an SMTP command called ETRN that is designed to
64460 overcome the security problems of the TURN command (which has fallen into
64461 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
64462 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
64463 should be accepted or not. If no ACL is defined, the command is rejected.
64464 </para>
64465 <para>
64466 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
64467 delivery to certain hosts. As Exim does not organize its message queue by host,
64468 the only form of ETRN that is supported by default is the one where the
64469 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
64470 specific to the SMTP server. A valid ETRN command causes a run of Exim with
64471 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
64472 argument. For example,
64473 </para>
64474 <literallayout class="monospaced">
64475 ETRN #brigadoon
64476 </literallayout>
64477 <para>
64478 runs the command
64479 </para>
64480 <literallayout class="monospaced">
64481 exim -R brigadoon
64482 </literallayout>
64483 <para>
64484 which causes a delivery attempt on all messages with undelivered addresses
64485 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
64486 default), Exim prevents the simultaneous execution of more than one queue run
64487 for the same argument string as a result of an ETRN command. This stops
64488 a misbehaving client from starting more than one queue runner at once.
64489 </para>
64490 <para>
64491 <indexterm role="concept">
64492 <primary>hints database</primary>
64493 <secondary>ETRN serialization</secondary>
64494 </indexterm>
64495 Exim implements the serialization by means of a hints database in which a
64496 record is written whenever a process is started by ETRN, and deleted when
64497 the process completes. However, Exim does not keep the SMTP session waiting for
64498 the ETRN process to complete. Once ETRN is accepted, the client is sent
64499 a <quote>success</quote> return code. Obviously there is scope for hints records to get
64500 left lying around if there is a system or program crash. To guard against this,
64501 Exim ignores any records that are more than six hours old.
64502 </para>
64503 <para>
64504 <indexterm role="option">
64505 <primary><option>smtp_etrn_command</option></primary>
64506 </indexterm>
64507 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
64508 used. This specifies a command that is run whenever ETRN is received,
64509 whatever the form of its argument. For
64510 example:
64511 </para>
64512 <literallayout class="monospaced">
64513 smtp_etrn_command = /etc/etrn_command $domain \
64514                     $sender_host_address
64515 </literallayout>
64516 <para>
64517 <indexterm role="variable">
64518 <primary><varname>$domain</varname></primary>
64519 </indexterm>
64520 The string is split up into arguments which are independently expanded. The
64521 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
64522 and no syntax checking is done on the contents of this argument. Exim does not
64523 wait for the command to complete, so its status code is not checked. Exim runs
64524 under its own uid and gid when receiving incoming SMTP, so it is not possible
64525 for it to change them before running the command.
64526 </para>
64527 </section>
64528 <section id="SECID238">
64529 <title>Incoming local SMTP</title>
64530 <para>
64531 <indexterm role="concept">
64532 <primary>SMTP</primary>
64533 <secondary>local incoming</secondary>
64534 </indexterm>
64535 Some user agents use SMTP to pass messages to their local MTA using the
64536 standard input and output, as opposed to passing the envelope on the command
64537 line and writing the message to the standard input. This is supported by the
64538 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
64539 messages over TCP/IP (including the use of ACLs), except that the envelope
64540 sender given in a MAIL command is ignored unless the caller is trusted. In
64541 an ACL you can detect this form of SMTP input by testing for an empty host
64542 identification. It is common to have this as the first line in the ACL that
64543 runs for RCPT commands:
64544 </para>
64545 <literallayout class="monospaced">
64546 accept hosts = :
64547 </literallayout>
64548 <para>
64549 This accepts SMTP messages from local processes without doing any other tests.
64550 </para>
64551 </section>
64552 <section id="SECTbatchSMTP">
64553 <title>Outgoing batched SMTP</title>
64554 <para>
64555 <indexterm role="concept">
64556 <primary>SMTP</primary>
64557 <secondary>batched outgoing</secondary>
64558 </indexterm>
64559 <indexterm role="concept">
64560 <primary>batched SMTP output</primary>
64561 </indexterm>
64562 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
64563 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
64564 be output in BSMTP format. No SMTP responses are possible for this form of
64565 delivery. All it is doing is using SMTP commands as a way of transmitting the
64566 envelope along with the message.
64567 </para>
64568 <para>
64569 The message is written to the file or pipe preceded by the SMTP commands
64570 MAIL and RCPT, and followed by a line containing a single dot. Lines in
64571 the message that start with a dot have an extra dot added. The SMTP command
64572 HELO is not normally used. If it is required, the <option>message_prefix</option> option
64573 can be used to specify it.
64574 </para>
64575 <para>
64576 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
64577 one recipient address at a time by default. However, you can arrange for them
64578 to handle several addresses at once by setting the <option>batch_max</option> option. When
64579 this is done for BSMTP, messages may contain multiple RCPT commands. See
64580 chapter <xref linkend="CHAPbatching"/> for more details.
64581 </para>
64582 <para>
64583 <indexterm role="variable">
64584 <primary><varname>$host</varname></primary>
64585 </indexterm>
64586 When one or more addresses are routed to a BSMTP transport by a router that
64587 sets up a host list, the name of the first host on the list is available to the
64588 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
64589 router:
64590 </para>
64591 <literallayout class="monospaced">
64592 begin routers
64593 route_append:
64594   driver = manualroute
64595   transport = smtp_appendfile
64596   route_list = domain.example  batch.host.example
64597
64598 begin transports
64599 smtp_appendfile:
64600   driver = appendfile
64601   directory = /var/bsmtp/$host
64602   batch_max = 1000
64603   use_bsmtp
64604   user = exim
64605 </literallayout>
64606 <para>
64607 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
64608 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
64609 message (unless there are more than 1000 recipients).
64610 </para>
64611 </section>
64612 <section id="SECTincomingbatchedSMTP">
64613 <title>Incoming batched SMTP</title>
64614 <para>
64615 <indexterm role="concept">
64616 <primary>SMTP</primary>
64617 <secondary>batched incoming</secondary>
64618 </indexterm>
64619 <indexterm role="concept">
64620 <primary>batched SMTP input</primary>
64621 </indexterm>
64622 The <option>-bS</option> command line option causes Exim to accept one or more messages by
64623 reading SMTP on the standard input, but to generate no responses. If the caller
64624 is trusted, the senders in the MAIL commands are believed; otherwise the
64625 sender is always the caller of Exim. Unqualified senders and receivers are not
64626 rejected (there seems little point) but instead just get qualified. HELO
64627 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
64628 as NOOP; QUIT quits.
64629 </para>
64630 <para>
64631 Minimal policy checking is done for BSMTP input. Only the non-SMTP
64632 ACL is run in the same way as for non-SMTP local input.
64633 </para>
64634 <para>
64635 If an error is detected while reading a message, including a missing <quote>.</quote> at
64636 the end, Exim gives up immediately. It writes details of the error to the
64637 standard output in a stylized way that the calling program should be able to
64638 make some use of automatically, for example:
64639 </para>
64640 <literallayout class="monospaced">
64641 554 Unexpected end of file
64642 Transaction started in line 10
64643 Error detected in line 14
64644 </literallayout>
64645 <para>
64646 It writes a more verbose version, for human consumption, to the standard error
64647 file, for example:
64648 </para>
64649 <literallayout class="monospaced">
64650 An error was detected while processing a file of BSMTP input.
64651 The error message was:
64652
64653 501 '&gt;' missing at end of address
64654
64655 The SMTP transaction started in line 10.
64656 The error was detected in line 12.
64657 The SMTP command at fault was:
64658
64659 rcpt to:&lt;malformed@in.com.plete
64660
64661 1 previous message was successfully processed.
64662 The rest of the batch was abandoned.
64663 </literallayout>
64664 <para>
64665 The return code from Exim is zero only if there were no errors. It is 1 if some
64666 messages were accepted before an error was detected, and 2 if no messages were
64667 accepted.
64668 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
64669 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
64670 </para>
64671 </section>
64672 </chapter>
64673
64674 <chapter id="CHAPemsgcust">
64675 <title>Customizing bounce and warning messages</title>
64676 <titleabbrev>Customizing messages</titleabbrev>
64677 <para>
64678 When a message fails to be delivered, or remains on the queue for more than a
64679 configured amount of time, Exim sends a message to the original sender, or
64680 to an alternative configured address. The text of these messages is built into
64681 the code of Exim, but it is possible to change it, either by adding a single
64682 string, or by replacing each of the paragraphs by text supplied in a file.
64683 </para>
64684 <para>
64685 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
64686 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
64687 option. Exim also adds the line
64688 </para>
64689 <literallayout class="monospaced">
64690 Auto-Submitted: auto-generated
64691 </literallayout>
64692 <para>
64693 to all warning and bounce messages,
64694 </para>
64695 <section id="SECID239">
64696 <title>Customizing bounce messages</title>
64697 <para>
64698 <indexterm role="concept">
64699 <primary>customizing</primary>
64700 <secondary>bounce message</secondary>
64701 </indexterm>
64702 <indexterm role="concept">
64703 <primary>bounce message</primary>
64704 <secondary>customizing</secondary>
64705 </indexterm>
64706 If <option>bounce_message_text</option> is set, its contents are included in the default
64707 message immediately after <quote>This message was created automatically by mail
64708 delivery software.</quote> The string is not expanded. It is not used if
64709 <option>bounce_message_file</option> is set.
64710 </para>
64711 <para>
64712 When <option>bounce_message_file</option> is set, it must point to a template file for
64713 constructing error messages. The file consists of a series of text items,
64714 separated by lines consisting of exactly four asterisks. If the file cannot be
64715 opened, default text is used and a message is written to the main and panic
64716 logs. If any text item in the file is empty, default text is used for that
64717 item.
64718 </para>
64719 <para>
64720 <indexterm role="variable">
64721 <primary><varname>$bounce_recipient</varname></primary>
64722 </indexterm>
64723 <indexterm role="variable">
64724 <primary><varname>$bounce_return_size_limit</varname></primary>
64725 </indexterm>
64726 Each item of text that is read from the file is expanded, and there are two
64727 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
64728 the recipient of an error message while it is being created, and
64729 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
64730 option, rounded to a whole number.
64731 </para>
64732 <para>
64733 The items must appear in the file in the following order:
64734 </para>
64735 <itemizedlist>
64736 <listitem>
64737 <para>
64738 The first item is included in the headers, and should include at least a
64739 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
64740 </para>
64741 </listitem>
64742 <listitem>
64743 <para>
64744 The second item forms the start of the error message. After it, Exim lists the
64745 failing addresses with their error messages.
64746 </para>
64747 </listitem>
64748 <listitem>
64749 <para>
64750 The third item is used to introduce any text from pipe transports that is to be
64751 returned to the sender. It is omitted if there is no such text.
64752 </para>
64753 </listitem>
64754 <listitem>
64755 <para>
64756 The fourth, fifth and sixth items will be ignored and may be empty.
64757 The fields exist for back-compatibility
64758 </para>
64759 </listitem>
64760 </itemizedlist>
64761 <para>
64762 The default state (<option>bounce_message_file</option> unset) is equivalent to the
64763 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
64764 other lines have been split in order to fit them on the page:
64765 </para>
64766 <literallayout class="monospaced">
64767 Subject: Mail delivery failed
64768   ${if eq{$sender_address}{$bounce_recipient}
64769   {: returning message to sender}}
64770 ****
64771 This message was created automatically by mail delivery software.
64772
64773 A message ${if eq{$sender_address}{$bounce_recipient}
64774   {that you sent }{sent by
64775
64776 &lt;$sender_address&gt;
64777
64778 }}could not be delivered to all of its recipients.
64779 This is a permanent error. The following address(es) failed:
64780 ****
64781 The following text was generated during the delivery attempt(s):
64782 ****
64783 ------ This is a copy of the message, including all the headers.
64784   ------
64785 ****
64786 ------ The body of the message is $message_size characters long;
64787   only the first
64788 ------ $bounce_return_size_limit or so are included here.
64789 ****
64790 </literallayout>
64791 </section>
64792 <section id="SECTcustwarn">
64793 <title>Customizing warning messages</title>
64794 <para>
64795 <indexterm role="concept">
64796 <primary>customizing</primary>
64797 <secondary>warning message</secondary>
64798 </indexterm>
64799 <indexterm role="concept">
64800 <primary>warning of delay</primary>
64801 <secondary>customizing the message</secondary>
64802 </indexterm>
64803 The option <option>warn_message_file</option> can be pointed at a template file for use when
64804 warnings about message delays are created. In this case there are only three
64805 text sections:
64806 </para>
64807 <itemizedlist>
64808 <listitem>
64809 <para>
64810 The first item is included in the headers, and should include at least a
64811 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
64812 </para>
64813 </listitem>
64814 <listitem>
64815 <para>
64816 The second item forms the start of the warning message. After it, Exim lists
64817 the delayed addresses.
64818 </para>
64819 </listitem>
64820 <listitem>
64821 <para>
64822 The third item then ends the message.
64823 </para>
64824 </listitem>
64825 </itemizedlist>
64826 <para>
64827 The default state is equivalent to the following file, except that some lines
64828 have been split here, in order to fit them on the page:
64829 </para>
64830 <literallayout class="monospaced">
64831 Subject: Warning: message $message_exim_id delayed
64832   $warn_message_delay
64833 ****
64834 This message was created automatically by mail delivery software.
64835
64836 A message ${if eq{$sender_address}{$warn_message_recipients}
64837 {that you sent }{sent by
64838
64839 &lt;$sender_address&gt;
64840
64841 }}has not been delivered to all of its recipients after
64842 more than $warn_message_delay on the queue on $primary_hostname.
64843
64844 The message identifier is:     $message_exim_id
64845 The subject of the message is: $h_subject
64846 The date of the message is:    $h_date
64847
64848 The following address(es) have not yet been delivered:
64849 ****
64850 No action is required on your part. Delivery attempts will
64851 continue for some time, and this warning may be repeated at
64852 intervals if the message remains undelivered. Eventually the
64853 mail delivery software will give up, and when that happens,
64854 the message will be returned to you.
64855 </literallayout>
64856 <para>
64857 <indexterm role="variable">
64858 <primary><varname>$warn_message_delay</varname></primary>
64859 </indexterm>
64860 <indexterm role="variable">
64861 <primary><varname>$warn_message_recipients</varname></primary>
64862 </indexterm>
64863 However, in the default state the subject and date lines are omitted if no
64864 appropriate headers exist. During the expansion of this file,
64865 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
64866 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
64867 of recipients for the warning message. There may be more than one if there are
64868 multiple addresses with different <option>errors_to</option> settings on the routers that
64869 handled them.
64870 </para>
64871 </section>
64872 </chapter>
64873
64874 <chapter id="CHAPcomconreq">
64875 <title>Some common configuration settings</title>
64876 <para>
64877 This chapter discusses some configuration settings that seem to be fairly
64878 common. More examples and discussion can be found in the Exim book.
64879 </para>
64880 <section id="SECID240">
64881 <title>Sending mail to a smart host</title>
64882 <para>
64883 <indexterm role="concept">
64884 <primary>smart host</primary>
64885 <secondary>example router</secondary>
64886 </indexterm>
64887 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
64888 should replace the default <command>dnslookup</command> router with a router which does the
64889 routing explicitly:
64890 </para>
64891 <literallayout class="monospaced">
64892 send_to_smart_host:
64893   driver = manualroute
64894   route_list = !+local_domains smart.host.name
64895   transport = remote_smtp
64896 </literallayout>
64897 <para>
64898 You can use the smart host&#x2019;s IP address instead of the name if you wish.
64899 If you are using Exim only to submit messages to a smart host, and not for
64900 receiving incoming messages, you can arrange for it to do the submission
64901 synchronously by setting the <option>mua_wrapper</option> option (see chapter
64902 <xref linkend="CHAPnonqueueing"/>).
64903 </para>
64904 </section>
64905 <section id="SECTmailinglists">
64906 <title>Using Exim to handle mailing lists</title>
64907 <para>
64908 <indexterm role="concept">
64909 <primary>mailing lists</primary>
64910 </indexterm>
64911 Exim can be used to run simple mailing lists, but for large and/or complicated
64912 requirements, the use of additional specialized mailing list software such as
64913 Majordomo or Mailman is recommended.
64914 </para>
64915 <para>
64916 The <command>redirect</command> router can be used to handle mailing lists where each list
64917 is maintained in a separate file, which can therefore be managed by an
64918 independent manager. The <option>domains</option> router option can be used to run these
64919 lists in a separate domain from normal mail. For example:
64920 </para>
64921 <literallayout class="monospaced">
64922 lists:
64923   driver = redirect
64924   domains = lists.example
64925   file = /usr/lists/$local_part
64926   forbid_pipe
64927   forbid_file
64928   errors_to = $local_part-request@lists.example
64929   no_more
64930 </literallayout>
64931 <para>
64932 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
64933 in that domain, it looks for a file that matches the local part. If there is no
64934 such file, the router declines, but because <option>no_more</option> is set, no subsequent
64935 routers are tried, and so the whole delivery fails.
64936 </para>
64937 <para>
64938 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
64939 expanded into a file name or a pipe delivery, which is usually inappropriate in
64940 a mailing list.
64941 </para>
64942 <para>
64943 <indexterm role="option">
64944 <primary><option>errors_to</option></primary>
64945 </indexterm>
64946 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
64947 taken from a mailing list are to be sent to the given address rather than the
64948 original sender of the message. However, before acting on this, Exim verifies
64949 the error address, and ignores it if verification fails.
64950 </para>
64951 <para>
64952 For example, using the configuration above, mail sent to
64953 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
64954 <filename>/usr/lists/dicts</filename>, with error reports directed to
64955 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
64956 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
64957 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
64958 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
64959 or <option>local_part_suffix</option> options) to handle addresses of the form
64960 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
64961 </para>
64962 </section>
64963 <section id="SECID241">
64964 <title>Syntax errors in mailing lists</title>
64965 <para>
64966 <indexterm role="concept">
64967 <primary>mailing lists</primary>
64968 <secondary>syntax errors in</secondary>
64969 </indexterm>
64970 If an entry in redirection data contains a syntax error, Exim normally defers
64971 delivery of the original address. That means that a syntax error in a mailing
64972 list holds up all deliveries to the list. This may not be appropriate when a
64973 list is being maintained automatically from data supplied by users, and the
64974 addresses are not rigorously checked.
64975 </para>
64976 <para>
64977 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
64978 entries that fail to parse, noting the incident in the log. If in addition
64979 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
64980 whenever a broken address is skipped. It is usually appropriate to set
64981 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
64982 </para>
64983 </section>
64984 <section id="SECID242">
64985 <title>Re-expansion of mailing lists</title>
64986 <para>
64987 <indexterm role="concept">
64988 <primary>mailing lists</primary>
64989 <secondary>re-expansion of</secondary>
64990 </indexterm>
64991 Exim remembers every individual address to which a message has been delivered,
64992 in order to avoid duplication, but it normally stores only the original
64993 recipient addresses with a message. If all the deliveries to a mailing list
64994 cannot be done at the first attempt, the mailing list is re-expanded when the
64995 delivery is next tried. This means that alterations to the list are taken into
64996 account at each delivery attempt, so addresses that have been added to
64997 the list since the message arrived will therefore receive a copy of the
64998 message, even though it pre-dates their subscription.
64999 </para>
65000 <para>
65001 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
65002 on the <command>redirect</command> router. If this is done, any addresses generated by the
65003 router that fail to deliver at the first attempt are added to the message as
65004 <quote>top level</quote> addresses, and the parent address that generated them is marked
65005 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
65006 subsequent delivery attempts. The disadvantage of this is that if any of the
65007 failing addresses are incorrect, correcting them in the file has no effect on
65008 pre-existing messages.
65009 </para>
65010 <para>
65011 The original top-level address is remembered with each of the generated
65012 addresses, and is output in any log messages. However, any intermediate parent
65013 addresses are not recorded. This makes a difference to the log only if the
65014 <option>all_parents</option> selector is set, but for mailing lists there is normally only
65015 one level of expansion anyway.
65016 </para>
65017 </section>
65018 <section id="SECID243">
65019 <title>Closed mailing lists</title>
65020 <para>
65021 <indexterm role="concept">
65022 <primary>mailing lists</primary>
65023 <secondary>closed</secondary>
65024 </indexterm>
65025 The examples so far have assumed open mailing lists, to which anybody may
65026 send mail. It is also possible to set up closed lists, where mail is accepted
65027 from specified senders only. This is done by making use of the generic
65028 <option>senders</option> option to restrict the router that handles the list.
65029 </para>
65030 <para>
65031 The following example uses the same file as a list of recipients and as a list
65032 of permitted senders. It requires three routers:
65033 </para>
65034 <literallayout class="monospaced">
65035 lists_request:
65036   driver = redirect
65037   domains = lists.example
65038   local_part_suffix = -request
65039   file = /usr/lists/$local_part$local_part_suffix
65040   no_more
65041
65042 lists_post:
65043   driver = redirect
65044   domains = lists.example
65045   senders = ${if exists {/usr/lists/$local_part}\
65046              {lsearch;/usr/lists/$local_part}{*}}
65047   file = /usr/lists/$local_part
65048   forbid_pipe
65049   forbid_file
65050   errors_to = $local_part-request@lists.example
65051   no_more
65052
65053 lists_closed:
65054   driver = redirect
65055   domains = lists.example
65056   allow_fail
65057   data = :fail: $local_part@lists.example is a closed mailing list
65058 </literallayout>
65059 <para>
65060 All three routers have the same <option>domains</option> setting, so for any other domains,
65061 they are all skipped. The first router runs only if the local part ends in
65062 <option>-request</option>. It handles messages to the list manager(s) by means of an open
65063 mailing list.
65064 </para>
65065 <para>
65066 The second router runs only if the <option>senders</option> precondition is satisfied. It
65067 checks for the existence of a list that corresponds to the local part, and then
65068 checks that the sender is on the list by means of a linear search. It is
65069 necessary to check for the existence of the file before trying to search it,
65070 because otherwise Exim thinks there is a configuration error. If the file does
65071 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
65072 means that the router runs, but because there is no list, declines, and
65073 <option>no_more</option> ensures that no further routers are run. The address fails with an
65074 <quote>unrouteable address</quote> error.
65075 </para>
65076 <para>
65077 The third router runs only if the second router is skipped, which happens when
65078 a mailing list exists, but the sender is not on it. This router forcibly fails
65079 the address, giving a suitable error message.
65080 </para>
65081 </section>
65082 <section id="SECTverp">
65083 <title>Variable Envelope Return Paths (VERP)</title>
65084 <para>
65085 <indexterm role="concept">
65086 <primary>VERP</primary>
65087 </indexterm>
65088 <indexterm role="concept">
65089 <primary>Variable Envelope Return Paths</primary>
65090 </indexterm>
65091 <indexterm role="concept">
65092 <primary>envelope sender</primary>
65093 </indexterm>
65094 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;
65095 are a way of helping mailing list administrators discover which subscription
65096 address is the cause of a particular delivery failure. The idea is to encode
65097 the original recipient address in the outgoing envelope sender address, so that
65098 if the message is forwarded by another host and then subsequently bounces, the
65099 original recipient can be extracted from the recipient address of the bounce.
65100 </para>
65101 <para>
65102 <indexterm role="option">
65103 <primary><option>errors_to</option></primary>
65104 </indexterm>
65105 <indexterm role="option">
65106 <primary><option>return_path</option></primary>
65107 </indexterm>
65108 Envelope sender addresses can be modified by Exim using two different
65109 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
65110 list examples), or the <option>return_path</option> option on a transport. The second of
65111 these is effective only if the message is successfully delivered to another
65112 host; it is not used for errors detected on the local host (see the description
65113 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
65114 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
65115 </para>
65116 <literallayout class="monospaced">
65117 verp_smtp:
65118   driver = smtp
65119   max_rcpt = 1
65120   return_path = \
65121     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
65122       {$1-request+$local_part=$domain@your.dom.example}fail}
65123 </literallayout>
65124 <para>
65125 This has the effect of rewriting the return path (envelope sender) on outgoing
65126 SMTP messages, if the local part of the original return path ends in
65127 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
65128 local part and domain of the recipient into the return path. Suppose, for
65129 example, that a message whose return path has been set to
65130 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
65131 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
65132 rewritten as
65133 </para>
65134 <literallayout class="monospaced">
65135 somelist-request+subscriber=other.dom.example@your.dom.example
65136 </literallayout>
65137 <para>
65138 <indexterm role="variable">
65139 <primary><varname>$local_part</varname></primary>
65140 </indexterm>
65141 For this to work, you must tell Exim to send multiple copies of messages that
65142 have more than one recipient, so that each copy has just one recipient. This is
65143 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
65144 might be sent to several different recipients in the same domain, in which case
65145 <varname>$local_part</varname> is not available in the transport, because it is not unique.
65146 </para>
65147 <para>
65148 Unless your host is doing nothing but mailing list deliveries, you should
65149 probably use a separate transport for the VERP deliveries, so as not to use
65150 extra resources in making one-per-recipient copies for other deliveries. This
65151 can easily be done by expanding the <option>transport</option> option in the router:
65152 </para>
65153 <literallayout class="monospaced">
65154 dnslookup:
65155   driver = dnslookup
65156   domains = ! +local_domains
65157   transport = \
65158     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
65159       {verp_smtp}{remote_smtp}}
65160   no_more
65161 </literallayout>
65162 <para>
65163 If you want to change the return path using <option>errors_to</option> in a router instead
65164 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
65165 routers that handle mailing list addresses. This will ensure that all delivery
65166 errors, including those detected on the local host, are sent to the VERP
65167 address.
65168 </para>
65169 <para>
65170 On a host that does no local deliveries and has no manual routing, only the
65171 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
65172 SMTP deliveries. Every mailing list recipient has its own return path value,
65173 and so Exim must hand them to the transport one at a time. Here is an example
65174 of a <command>dnslookup</command> router that implements VERP:
65175 </para>
65176 <literallayout class="monospaced">
65177 verp_dnslookup:
65178   driver = dnslookup
65179   domains = ! +local_domains
65180   transport = remote_smtp
65181   errors_to = \
65182     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
65183      {$1-request+$local_part=$domain@your.dom.example}fail}
65184   no_more
65185 </literallayout>
65186 <para>
65187 Before you start sending out messages with VERPed return paths, you must also
65188 configure Exim to accept the bounce messages that come back to those paths.
65189 Typically this is done by setting a <option>local_part_suffix</option> option for a
65190 router, and using this to route the messages to wherever you want to handle
65191 them.
65192 </para>
65193 <para>
65194 The overhead incurred in using VERP depends very much on the size of the
65195 message, the number of recipient addresses that resolve to the same remote
65196 host, and the speed of the connection over which the message is being sent. If
65197 a lot of addresses resolve to the same host and the connection is slow, sending
65198 a separate copy of the message for each address may take substantially longer
65199 than sending a single copy with many recipients (for which VERP cannot be
65200 used).
65201 </para>
65202 </section>
65203 <section id="SECTvirtualdomains">
65204 <title>Virtual domains</title>
65205 <para>
65206 <indexterm role="concept">
65207 <primary>virtual domains</primary>
65208 </indexterm>
65209 <indexterm role="concept">
65210 <primary>domain</primary>
65211 <secondary>virtual</secondary>
65212 </indexterm>
65213 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
65214 meanings:
65215 </para>
65216 <itemizedlist>
65217 <listitem>
65218 <para>
65219 A domain for which there are no real mailboxes; all valid local parts are
65220 aliases for other email addresses. Common examples are organizational
65221 top-level domains and <quote>vanity</quote> domains.
65222 </para>
65223 </listitem>
65224 <listitem>
65225 <para>
65226 One of a number of independent domains that are all handled by the same host,
65227 with mailboxes on that host, but where the mailbox owners do not necessarily
65228 have login accounts on that host.
65229 </para>
65230 </listitem>
65231 </itemizedlist>
65232 <para>
65233 The first usage is probably more common, and does seem more <quote>virtual</quote> than
65234 the second. This kind of domain can be handled in Exim with a straightforward
65235 aliasing router. One approach is to create a separate alias file for each
65236 virtual domain. Exim can test for the existence of the alias file to determine
65237 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
65238 to a router of this form:
65239 </para>
65240 <literallayout class="monospaced">
65241 virtual:
65242   driver = redirect
65243   domains = dsearch;/etc/mail/virtual
65244   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
65245   no_more
65246 </literallayout>
65247 <para>
65248 The <option>domains</option> option specifies that the router is to be skipped, unless there
65249 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
65250 domain that is being processed. When the router runs, it looks up the local
65251 part in the file to find a new address (or list of addresses). The <option>no_more</option>
65252 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
65253 string), Exim gives up on the address without trying any subsequent routers.
65254 </para>
65255 <para>
65256 This one router can handle all the virtual domains because the alias file names
65257 follow a fixed pattern. Permissions can be arranged so that appropriate people
65258 can edit the different alias files. A successful aliasing operation results in
65259 a new envelope recipient address, which is then routed from scratch.
65260 </para>
65261 <para>
65262 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
65263 way. One approach is to create a file for each domain containing a list of
65264 valid local parts, and use it in a router like this:
65265 </para>
65266 <literallayout class="monospaced">
65267 my_domains:
65268   driver = accept
65269   domains = dsearch;/etc/mail/domains
65270   local_parts = lsearch;/etc/mail/domains/$domain
65271   transport = my_mailboxes
65272 </literallayout>
65273 <para>
65274 The address is accepted if there is a file for the domain, and the local part
65275 can be found in the file. The <option>domains</option> option is used to check for the
65276 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
65277 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
65278 because that option is tested after <option>local_parts</option>. The transport is as
65279 follows:
65280 </para>
65281 <literallayout class="monospaced">
65282 my_mailboxes:
65283   driver = appendfile
65284   file = /var/mail/$domain/$local_part
65285   user = mail
65286 </literallayout>
65287 <para>
65288 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
65289 required, to specify which uid is to be used for writing to the mailboxes.
65290 </para>
65291 <para>
65292 The configuration shown here is just one example of how you might support this
65293 requirement. There are many other ways this kind of configuration can be set
65294 up, for example, by using a database instead of separate files to hold all the
65295 information about the domains.
65296 </para>
65297 </section>
65298 <section id="SECTmulbox">
65299 <title>Multiple user mailboxes</title>
65300 <para>
65301 <indexterm role="concept">
65302 <primary>multiple mailboxes</primary>
65303 </indexterm>
65304 <indexterm role="concept">
65305 <primary>mailbox</primary>
65306 <secondary>multiple</secondary>
65307 </indexterm>
65308 <indexterm role="concept">
65309 <primary>local part</primary>
65310 <secondary>prefix</secondary>
65311 </indexterm>
65312 <indexterm role="concept">
65313 <primary>local part</primary>
65314 <secondary>suffix</secondary>
65315 </indexterm>
65316 Heavy email users often want to operate with multiple mailboxes, into which
65317 incoming mail is automatically sorted. A popular way of handling this is to
65318 allow users to use multiple sender addresses, so that replies can easily be
65319 identified. Users are permitted to add prefixes or suffixes to their local
65320 parts for this purpose. The wildcard facility of the generic router options
65321 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
65322 example, consider this router:
65323 </para>
65324 <literallayout class="monospaced">
65325 userforward:
65326   driver = redirect
65327   check_local_user
65328   file = $home/.forward
65329   local_part_suffix = -*
65330   local_part_suffix_optional
65331   allow_filter
65332 </literallayout>
65333 <para>
65334 <indexterm role="variable">
65335 <primary><varname>$local_part_suffix</varname></primary>
65336 </indexterm>
65337 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
65338 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
65339 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
65340 </para>
65341 <literallayout class="monospaced">
65342 if $local_part_suffix contains -special then
65343 save /home/$local_part/Mail/special
65344 endif
65345 </literallayout>
65346 <para>
65347 If the filter file does not exist, or does not deal with such addresses, they
65348 fall through to subsequent routers, and, assuming no subsequent use of the
65349 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
65350 control over which suffixes are valid.
65351 </para>
65352 <para>
65353 Alternatively, a suffix can be used to trigger the use of a different
65354 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
65355 another MTA:
65356 </para>
65357 <literallayout class="monospaced">
65358 userforward:
65359   driver = redirect
65360   check_local_user
65361   file = $home/.forward$local_part_suffix
65362   local_part_suffix = -*
65363   local_part_suffix_optional
65364   allow_filter
65365 </literallayout>
65366 <para>
65367 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
65368 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
65369 does not exist, or does not deal with the address, it is passed on to
65370 subsequent routers, which could, if required, look for an unqualified
65371 <filename>.forward</filename> file to use as a default.
65372 </para>
65373 </section>
65374 <section id="SECID244">
65375 <title>Simplified vacation processing</title>
65376 <para>
65377 <indexterm role="concept">
65378 <primary>vacation processing</primary>
65379 </indexterm>
65380 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
65381 a pipe command in a <filename>.forward</filename> file
65382 (see section <xref linkend="SECTspecitredli"/> for syntax details).
65383 This is prone to error by inexperienced users. There are two features of Exim
65384 that can be used to make this process simpler for users:
65385 </para>
65386 <itemizedlist>
65387 <listitem>
65388 <para>
65389 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
65390 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
65391 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
65392 <filename>.forward</filename> file are then much simpler. For example:
65393 </para>
65394 <literallayout class="monospaced">
65395 spqr, vacation-spqr
65396 </literallayout>
65397 </listitem>
65398 <listitem>
65399 <para>
65400 The <option>require_files</option> generic router option can be used to trigger a
65401 vacation delivery by checking for the existence of a certain file in the
65402 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
65403 ensure that the original delivery also proceeds. In this case, all the user has
65404 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
65405 message.
65406 </para>
65407 </listitem>
65408 </itemizedlist>
65409 <para>
65410 Another advantage of both these methods is that they both work even when the
65411 use of arbitrary pipes by users is locked out.
65412 </para>
65413 </section>
65414 <section id="SECID245">
65415 <title>Taking copies of mail</title>
65416 <para>
65417 <indexterm role="concept">
65418 <primary>message</primary>
65419 <secondary>copying every</secondary>
65420 </indexterm>
65421 Some installations have policies that require archive copies of all messages to
65422 be made. A single copy of each message can easily be taken by an appropriate
65423 command in a system filter, which could, for example, use a different file for
65424 each day&#x2019;s messages.
65425 </para>
65426 <para>
65427 There is also a shadow transport mechanism that can be used to take copies of
65428 messages that are successfully delivered by local transports, one copy per
65429 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
65430 notification of delivery by sites that insist on doing such things.
65431 </para>
65432 </section>
65433 <section id="SECID246">
65434 <title>Intermittently connected hosts</title>
65435 <para>
65436 <indexterm role="concept">
65437 <primary>intermittently connected hosts</primary>
65438 </indexterm>
65439 It has become quite common (because it is cheaper) for hosts to connect to the
65440 Internet periodically rather than remain connected all the time. The normal
65441 arrangement is that mail for such hosts accumulates on a system that is
65442 permanently connected.
65443 </para>
65444 <para>
65445 Exim was designed for use on permanently connected hosts, and so it is not
65446 particularly well-suited to use in an intermittently connected environment.
65447 Nevertheless there are some features that can be used.
65448 </para>
65449 </section>
65450 <section id="SECID247">
65451 <title>Exim on the upstream server host</title>
65452 <para>
65453 It is tempting to arrange for incoming mail for the intermittently connected
65454 host to remain on Exim&#x2019;s queue until the client connects. However, this
65455 approach does not scale very well. Two different kinds of waiting message are
65456 being mixed up in the same queue &ndash; those that cannot be delivered because of
65457 some temporary problem, and those that are waiting for their destination host
65458 to connect. This makes it hard to manage the queue, as well as wasting
65459 resources, because each queue runner scans the entire queue.
65460 </para>
65461 <para>
65462 A better approach is to separate off those messages that are waiting for an
65463 intermittently connected host. This can be done by delivering these messages
65464 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
65465 format, from where they are transmitted by other software when their
65466 destination connects. This makes it easy to collect all the mail for one host
65467 in a single directory, and to apply local timeout rules on a per-message basis
65468 if required.
65469 </para>
65470 <para>
65471 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
65472 you are doing this, you should configure Exim with a long retry period for the
65473 intermittent host. For example:
65474 </para>
65475 <literallayout class="monospaced">
65476 cheshire.wonderland.fict.example    *   F,5d,24h
65477 </literallayout>
65478 <para>
65479 This stops a lot of failed delivery attempts from occurring, but Exim remembers
65480 which messages it has queued up for that host. Once the intermittent host comes
65481 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
65482 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
65483 causes all the queued up messages to be delivered, often down a single SMTP
65484 connection. While the host remains connected, any new messages get delivered
65485 immediately.
65486 </para>
65487 <para>
65488 If the connecting hosts do not have fixed IP addresses, that is, if a host is
65489 issued with a different IP address each time it connects, Exim&#x2019;s retry
65490 mechanisms on the holding host get confused, because the IP address is normally
65491 used as part of the key string for holding retry information. This can be
65492 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
65493 Since this has disadvantages for permanently connected hosts, it is best to
65494 arrange a separate transport for the intermittently connected ones.
65495 </para>
65496 </section>
65497 <section id="SECID248">
65498 <title>Exim on the intermittently connected client host</title>
65499 <para>
65500 The value of <option>smtp_accept_queue_per_connection</option> should probably be
65501 increased, or even set to zero (that is, disabled) on the intermittently
65502 connected host, so that all incoming messages down a single connection get
65503 delivered immediately.
65504 </para>
65505 <para>
65506 <indexterm role="concept">
65507 <primary>SMTP</primary>
65508 <secondary>passed connection</secondary>
65509 </indexterm>
65510 <indexterm role="concept">
65511 <primary>SMTP</primary>
65512 <secondary>multiple deliveries</secondary>
65513 </indexterm>
65514 <indexterm role="concept">
65515 <primary>multiple SMTP deliveries</primary>
65516 </indexterm>
65517 Mail waiting to be sent from an intermittently connected host will probably
65518 not have been routed, because without a connection DNS lookups are not
65519 possible. This means that if a normal queue run is done at connection time,
65520 each message is likely to be sent in a separate SMTP session. This can be
65521 avoided by starting the queue run with a command line option beginning with
65522 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
65523 first pass, routing is done but no deliveries take place. The second pass is a
65524 normal queue run; since all the messages have been previously routed, those
65525 destined for the same host are likely to get sent as multiple deliveries in a
65526 single SMTP connection.
65527 </para>
65528 </section>
65529 </chapter>
65530
65531 <chapter id="CHAPnonqueueing">
65532 <title>Using Exim as a non-queueing client</title>
65533 <titleabbrev>Exim as a non-queueing client</titleabbrev>
65534 <para>
65535 <indexterm role="concept">
65536 <primary>client, non-queueing</primary>
65537 </indexterm>
65538 <indexterm role="concept">
65539 <primary>smart host</primary>
65540 <secondary>suppressing queueing</secondary>
65541 </indexterm>
65542 On a personal computer, it is a common requirement for all
65543 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
65544 configured to operate that way, for all the popular operating systems.
65545 However, there are some MUAs for Unix-like systems that cannot be so
65546 configured: they submit messages using the command line interface of
65547 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
65548 messages this way.
65549 </para>
65550 <para>
65551 If the personal computer runs continuously, there is no problem, because it can
65552 run a conventional MTA that handles delivery to the smart host, and deal with
65553 any delays via its queueing mechanism. However, if the computer does not run
65554 continuously or runs different operating systems at different times, queueing
65555 email is not desirable.
65556 </para>
65557 <para>
65558 There is therefore a requirement for something that can provide the
65559 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
65560 any queueing or retrying facilities. Furthermore, the delivery to the smart
65561 host should be synchronous, so that if it fails, the sending MUA is immediately
65562 informed. In other words, we want something that extends an MUA that submits
65563 to a local MTA via the command line so that it behaves like one that submits
65564 to a remote smart host using TCP/SMTP.
65565 </para>
65566 <para>
65567 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
65568 that do this job. However, people have found them to be lacking in various
65569 ways. For instance, you might want to allow aliasing and forwarding to be done
65570 before sending a message to the smart host.
65571 </para>
65572 <para>
65573 Exim already had the necessary infrastructure for doing this job. Just a few
65574 tweaks were needed to make it behave as required, though it is somewhat of an
65575 overkill to use a fully-featured MTA for this purpose.
65576 </para>
65577 <para>
65578 <indexterm role="option">
65579 <primary><option>mua_wrapper</option></primary>
65580 </indexterm>
65581 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
65582 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
65583 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
65584 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
65585 compatible router and transport configuration. Typically there will be just one
65586 router and one transport, sending everything to a smart host.
65587 </para>
65588 <para>
65589 When run in MUA wrapping mode, the behaviour of Exim changes in the
65590 following ways:
65591 </para>
65592 <itemizedlist>
65593 <listitem>
65594 <para>
65595 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
65596 In other words, the only way to submit messages is via the command line.
65597 </para>
65598 </listitem>
65599 <listitem>
65600 <para>
65601 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
65602 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
65603 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
65604 does not finish until the delivery attempt is complete. If the delivery is
65605 successful, a zero return code is given.
65606 </para>
65607 </listitem>
65608 <listitem>
65609 <para>
65610 Address redirection is permitted, but the final routing for all addresses must
65611 be to the same remote transport, and to the same list of hosts. Furthermore,
65612 the return address (envelope sender) must be the same for all recipients, as
65613 must any added or deleted header lines. In other words, it must be possible to
65614 deliver the message in a single SMTP transaction, however many recipients there
65615 are.
65616 </para>
65617 </listitem>
65618 <listitem>
65619 <para>
65620 If these conditions are not met, or if routing any address results in a
65621 failure or defer status, or if Exim is unable to deliver all the recipients
65622 successfully to one of the smart hosts, delivery of the entire message fails.
65623 </para>
65624 </listitem>
65625 <listitem>
65626 <para>
65627 Because no queueing is allowed, all failures are treated as permanent; there
65628 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
65629 smart host. Furthermore, because only a single yes/no response can be given to
65630 the caller, it is not possible to deliver to some recipients and not others. If
65631 there is an error (temporary or permanent) for any recipient, all are failed.
65632 </para>
65633 </listitem>
65634 <listitem>
65635 <para>
65636 If more than one smart host is listed, Exim will try another host after a
65637 connection failure or a timeout, in the normal way. However, if this kind of
65638 failure happens for all the hosts, the delivery fails.
65639 </para>
65640 </listitem>
65641 <listitem>
65642 <para>
65643 When delivery fails, an error message is written to the standard error stream
65644 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
65645 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
65646 are ever generated.
65647 </para>
65648 </listitem>
65649 <listitem>
65650 <para>
65651 No retry data is maintained, and any retry rules are ignored.
65652 </para>
65653 </listitem>
65654 <listitem>
65655 <para>
65656 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
65657 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
65658 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
65659 </para>
65660 </listitem>
65661 </itemizedlist>
65662 <para>
65663 The overall effect is that Exim makes a single synchronous attempt to deliver
65664 the message, failing if there is any kind of problem. Because no local
65665 deliveries are done and no daemon can be run, Exim does not need root
65666 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
65667 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
65668 the advantages and disadvantages of running without root privilege.
65669 </para>
65670 </chapter>
65671
65672 <chapter id="CHAPlog">
65673 <title>Log files</title>
65674 <para>
65675 <indexterm role="concept" id="IIDloggen" class="startofrange">
65676 <primary>log</primary>
65677 <secondary>general description</secondary>
65678 </indexterm>
65679 <indexterm role="concept">
65680 <primary>log</primary>
65681 <secondary>types of</secondary>
65682 </indexterm>
65683 Exim writes three different logs, referred to as the main log, the reject log,
65684 and the panic log:
65685 </para>
65686 <itemizedlist>
65687 <listitem>
65688 <para>
65689 <indexterm role="concept">
65690 <primary>main log</primary>
65691 </indexterm>
65692 The main log records the arrival of each message and each delivery in a single
65693 line in each case. The format is as compact as possible, in an attempt to keep
65694 down the size of log files. Two-character flag sequences make it easy to pick
65695 out these lines. A number of other events are recorded in the main log. Some of
65696 them are optional, in which case the <option>log_selector</option> option controls whether
65697 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
65698 analysis of main log files, is provided in the Exim distribution (see section
65699 <xref linkend="SECTmailstat"/>).
65700 </para>
65701 </listitem>
65702 <listitem>
65703 <para>
65704 <indexterm role="concept">
65705 <primary>reject log</primary>
65706 </indexterm>
65707 The reject log records information from messages that are rejected as a result
65708 of a configuration option (that is, for policy reasons).
65709 The first line of each rejection is a copy of the line that is also written to
65710 the main log. Then, if the message&#x2019;s header has been read at the time the log
65711 is written, its contents are written to this log. Only the original header
65712 lines are available; header lines added by ACLs are not logged. You can use the
65713 reject log to check that your policy controls are working correctly; on a busy
65714 host this may be easier than scanning the main log for rejection messages. You
65715 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
65716 false.
65717 </para>
65718 </listitem>
65719 <listitem>
65720 <para>
65721 <indexterm role="concept">
65722 <primary>panic log</primary>
65723 </indexterm>
65724 <indexterm role="concept">
65725 <primary>system log</primary>
65726 </indexterm>
65727 When certain serious errors occur, Exim writes entries to its panic log. If the
65728 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
65729 are usually written to the main log as well, but can get lost amid the mass of
65730 other entries. The panic log should be empty under normal circumstances. It is
65731 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
65732 regularly, in order to become aware of any problems. When Exim cannot open its
65733 panic log, it tries as a last resort to write to the system log (syslog). This
65734 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
65735 message itself is written at priority LOG_CRIT.
65736 </para>
65737 </listitem>
65738 </itemizedlist>
65739 <para>
65740 Every log line starts with a timestamp, in the format shown in the following
65741 example. Note that many of the examples shown in this chapter are line-wrapped.
65742 In the log file, this would be all on one line:
65743 </para>
65744 <literallayout class="monospaced">
65745 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
65746   by QUIT
65747 </literallayout>
65748 <para>
65749 By default, the timestamps are in the local timezone. There are two
65750 ways of changing this:
65751 </para>
65752 <itemizedlist>
65753 <listitem>
65754 <para>
65755 You can set the <option>timezone</option> option to a different time zone; in particular, if
65756 you set
65757 </para>
65758 <literallayout class="monospaced">
65759 timezone = UTC
65760 </literallayout>
65761 <para>
65762 the timestamps will be in UTC (aka GMT).
65763 </para>
65764 </listitem>
65765 <listitem>
65766 <para>
65767 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
65768 example:
65769 </para>
65770 <literallayout class="monospaced">
65771 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
65772 </literallayout>
65773 </listitem>
65774 </itemizedlist>
65775 <para>
65776 <indexterm role="concept">
65777 <primary>log</primary>
65778 <secondary>process ids in</secondary>
65779 </indexterm>
65780 <indexterm role="concept">
65781 <primary>pid (process id)</primary>
65782 <secondary>in log lines</secondary>
65783 </indexterm>
65784 Exim does not include its process id in log lines by default, but you can
65785 request that it does so by specifying the <literal>pid</literal> log selector (see section
65786 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
65787 brackets, immediately after the time and date.
65788 </para>
65789 <section id="SECTwhelogwri">
65790 <title>Where the logs are written</title>
65791 <para>
65792 <indexterm role="concept">
65793 <primary>log</primary>
65794 <secondary>destination</secondary>
65795 </indexterm>
65796 <indexterm role="concept">
65797 <primary>log</primary>
65798 <secondary>to file</secondary>
65799 </indexterm>
65800 <indexterm role="concept">
65801 <primary>log</primary>
65802 <secondary>to syslog</secondary>
65803 </indexterm>
65804 <indexterm role="concept">
65805 <primary>syslog</primary>
65806 </indexterm>
65807 The logs may be written to local files, or to syslog, or both. However, it
65808 should be noted that many syslog implementations use UDP as a transport, and
65809 are therefore unreliable in the sense that messages are not guaranteed to
65810 arrive at the loghost, nor is the ordering of messages necessarily maintained.
65811 It has also been reported that on large log files (tens of megabytes) you may
65812 need to tweak syslog to prevent it syncing the file with each write &ndash; on
65813 Linux this has been seen to make syslog take 90% plus of CPU time.
65814 </para>
65815 <para>
65816 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
65817 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
65818 configuration. This latter string is expanded, so it can contain, for example,
65819 references to the host name:
65820 </para>
65821 <literallayout class="monospaced">
65822 log_file_path = /var/log/$primary_hostname/exim_%slog
65823 </literallayout>
65824 <para>
65825 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
65826 rather than at run time, because then the setting is available right from the
65827 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
65828 before it has read the configuration file (for example, an error in the
65829 configuration file) it will not use the path you want, and may not be able to
65830 log at all.
65831 </para>
65832 <para>
65833 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
65834 list, currently limited to at most two items. This is one option where the
65835 facility for changing a list separator may not be used. The list must always be
65836 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
65837 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
65838 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
65839 implying the use of a default path.
65840 </para>
65841 <para>
65842 When Exim encounters an empty item in the list, it searches the list defined by
65843 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
65844 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
65845 mean <quote>use the path specified at build time</quote>. It no such item exists, log
65846 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
65847 equivalent to the setting:
65848 </para>
65849 <literallayout class="monospaced">
65850 log_file_path = $spool_directory/log/%slog
65851 </literallayout>
65852 <para>
65853 If you do not specify anything at build time or run time,
65854 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
65855 that is where the logs are written.
65856 </para>
65857 <para>
65858 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
65859 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
65860 </para>
65861 <para>
65862 Here are some examples of possible settings:
65863 </para>
65864 <literallayout>
65865 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
65866 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
65867 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
65868 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
65869 </literallayout>
65870 <para>
65871 If there are more than two paths in the list, the first is used and a panic
65872 error is logged.
65873 </para>
65874 </section>
65875 <section id="SECID285">
65876 <title>Logging to local files that are periodically <quote>cycled</quote></title>
65877 <para>
65878 <indexterm role="concept">
65879 <primary>log</primary>
65880 <secondary>cycling local files</secondary>
65881 </indexterm>
65882 <indexterm role="concept">
65883 <primary>cycling logs</primary>
65884 </indexterm>
65885 <indexterm role="concept">
65886 <primary><emphasis>exicyclog</emphasis></primary>
65887 </indexterm>
65888 <indexterm role="concept">
65889 <primary>log</primary>
65890 <secondary>local files; writing to</secondary>
65891 </indexterm>
65892 Some operating systems provide centralized and standardized methods for cycling
65893 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
65894 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
65895 main and reject logs each time it is called. The maximum number of old logs to
65896 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
65897 </para>
65898 <para>
65899 An Exim delivery process opens the main log when it first needs to write to it,
65900 and it keeps the file open in case subsequent entries are required &ndash; for
65901 example, if a number of different deliveries are being done for the same
65902 message. However, remote SMTP deliveries can take a long time, and this means
65903 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
65904 something similar is being used to rename log files on a regular basis. To
65905 ensure that a switch of log files is noticed as soon as possible, Exim calls
65906 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
65907 does not exist, or its inode has changed, the old file is closed and Exim
65908 tries to open the main log from scratch. Thus, an old log file may remain open
65909 for quite some time, but no Exim processes should write to it once it has been
65910 renamed.
65911 </para>
65912 </section>
65913 <section id="SECTdatlogfil">
65914 <title>Datestamped log files</title>
65915 <para>
65916 <indexterm role="concept">
65917 <primary>log</primary>
65918 <secondary>datestamped files</secondary>
65919 </indexterm>
65920 Instead of cycling the main and reject log files by renaming them
65921 periodically, some sites like to use files whose names contain a datestamp,
65922 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
65923 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
65924 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
65925 point where the datestamp is required. For example:
65926 </para>
65927 <literallayout class="monospaced">
65928 log_file_path = /var/spool/exim/log/%slog-%D
65929 log_file_path = /var/log/exim-%s-%D.log
65930 log_file_path = /var/spool/exim/log/%D-%slog
65931 log_file_path = /var/log/exim/%s.%M
65932 </literallayout>
65933 <para>
65934 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
65935 examples of names generated by the above examples:
65936 </para>
65937 <literallayout class="monospaced">
65938 /var/spool/exim/log/mainlog-20021225
65939 /var/log/exim-reject-20021225.log
65940 /var/spool/exim/log/20021225-mainlog
65941 /var/log/exim/main.200212
65942 </literallayout>
65943 <para>
65944 When this form of log file is specified, Exim automatically switches to new
65945 files at midnight. It does not make any attempt to compress old logs; you
65946 will need to write your own script if you require this. You should not
65947 run <emphasis>exicyclog</emphasis> with this form of logging.
65948 </para>
65949 <para>
65950 The location of the panic log is also determined by <option>log_file_path</option>, but it
65951 is not datestamped, because rotation of the panic log does not make sense.
65952 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
65953 the string. In addition, if it immediately follows a slash, a following
65954 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
65955 character is removed. Thus, the four examples above would give these panic
65956 log names:
65957 </para>
65958 <literallayout class="monospaced">
65959 /var/spool/exim/log/paniclog
65960 /var/log/exim-panic.log
65961 /var/spool/exim/log/paniclog
65962 /var/log/exim/panic
65963 </literallayout>
65964 </section>
65965 <section id="SECID249">
65966 <title>Logging to syslog</title>
65967 <para>
65968 <indexterm role="concept">
65969 <primary>log</primary>
65970 <secondary>syslog; writing to</secondary>
65971 </indexterm>
65972 The use of syslog does not change what Exim logs or the format of its messages,
65973 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
65974 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
65975 that, the same strings are written to syslog as to log files. The syslog
65976 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
65977 by default, but you can change these by setting the <option>syslog_facility</option> and
65978 <option>syslog_processname</option> options, respectively. If Exim was compiled with
65979 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
65980 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
65981 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
65982 the time and host name to each line.
65983 The three log streams are mapped onto syslog priorities as follows:
65984 </para>
65985 <itemizedlist>
65986 <listitem>
65987 <para>
65988 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
65989 </para>
65990 </listitem>
65991 <listitem>
65992 <para>
65993 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
65994 </para>
65995 </listitem>
65996 <listitem>
65997 <para>
65998 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
65999 </para>
66000 </listitem>
66001 </itemizedlist>
66002 <para>
66003 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
66004 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
66005 these are routed by syslog to the same place. You can suppress this duplication
66006 by setting <option>syslog_duplication</option> false.
66007 </para>
66008 <para>
66009 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
66010 entries contain multiple lines when headers are included. To cope with both
66011 these cases, entries written to syslog are split into separate <function>syslog()</function>
66012 calls at each internal newline, and also after a maximum of
66013 870 data characters. (This allows for a total syslog line length of 1024, when
66014 additions such as timestamps are added.) If you are running a syslog
66015 replacement that can handle lines longer than the 1024 characters allowed by
66016 RFC 3164, you should set
66017 </para>
66018 <literallayout class="monospaced">
66019 SYSLOG_LONG_LINES=yes
66020 </literallayout>
66021 <para>
66022 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
66023 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
66024 </para>
66025 <para>
66026 To make it easy to re-assemble split lines later, each component of a split
66027 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;]
66028 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
66029 components in the entry. The / delimiter is used when the line was split
66030 because it was too long; if it was split because of an internal newline, the \
66031 delimiter is used. For example, supposing the length limit to be 50 instead of
66032 870, the following would be the result of a typical rejection message to
66033 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
66034 name, and pid as added by syslog:
66035 </para>
66036 <literallayout class="monospaced">
66037 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
66038 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
66039 [3/5]  when scanning for sender: missing or malformed lo
66040 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
66041 [5/5] mple&gt;)
66042 </literallayout>
66043 <para>
66044 The same error might cause the following lines to be written to <quote>rejectlog</quote>
66045 (LOG_NOTICE):
66046 </para>
66047 <literallayout class="monospaced">
66048 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
66049 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
66050 [3/18] er when scanning for sender: missing or malformed
66051 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
66052 [5\18] .example&gt;)
66053 [6\18] Recipients: ph10@some.domain.cam.example
66054 [7\18] P Received: from [127.0.0.1] (ident=ph10)
66055 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
66056 [9\18]        id 16RdAL-0006pc-00
66057 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
66058 [11\18] 09:43 +0100
66059 [12\18] F From: &lt;&gt;
66060 [13\18]   Subject: this is a test header
66061 [18\18]   X-something: this is another header
66062 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
66063 [16\18] le&gt;
66064 [17\18] B Bcc:
66065 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
66066 </literallayout>
66067 <para>
66068 Log lines that are neither too long nor contain newlines are written to syslog
66069 without modification.
66070 </para>
66071 <para>
66072 If only syslog is being used, the Exim monitor is unable to provide a log tail
66073 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
66074 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
66075 where it is.
66076 </para>
66077 </section>
66078 <section id="SECID250">
66079 <title>Log line flags</title>
66080 <para>
66081 One line is written to the main log for each message received, and for each
66082 successful, unsuccessful, and delayed delivery. These lines can readily be
66083 picked out by the distinctive two-character flags that immediately follow the
66084 timestamp. The flags are:
66085 </para>
66086 <literallayout>
66087 <literal>&lt;=</literal>     message arrival
66088 <literal>(=</literal>     message fakereject
66089 <literal>=&gt;</literal>     normal message delivery
66090 <literal>-&gt;</literal>     additional address in same delivery
66091 <literal>&gt;&gt;</literal>     cutthrough message delivery
66092 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
66093 <literal>**</literal>     delivery failed; address bounced
66094 <literal>==</literal>     delivery deferred; temporary problem
66095 </literallayout>
66096 </section>
66097 <section id="SECID251">
66098 <title>Logging message reception</title>
66099 <para>
66100 <indexterm role="concept">
66101 <primary>log</primary>
66102 <secondary>reception line</secondary>
66103 </indexterm>
66104 The format of the single-line entry in the main log that is written for every
66105 message received is shown in the basic example below, which is split over
66106 several lines in order to fit it on the page:
66107 </para>
66108 <literallayout class="monospaced">
66109 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
66110   H=mailer.fict.example [192.168.123.123] U=exim
66111   P=smtp S=5678 id=&lt;incoming message id&gt;
66112 </literallayout>
66113 <para>
66114 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
66115 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
66116 generated, this is followed by an item of the form
66117 </para>
66118 <literallayout class="monospaced">
66119 R=&lt;message id&gt;
66120 </literallayout>
66121 <para>
66122 which is a reference to the message that caused the bounce to be sent.
66123 </para>
66124 <para>
66125 <indexterm role="concept">
66126 <primary>HELO</primary>
66127 </indexterm>
66128 <indexterm role="concept">
66129 <primary>EHLO</primary>
66130 </indexterm>
66131 For messages from other hosts, the H and U fields identify the remote host and
66132 record the RFC 1413 identity of the user that sent the message, if one was
66133 received. The number given in square brackets is the IP address of the sending
66134 host. If there is a single, unparenthesized  host name in the H field, as
66135 above, it has been verified to correspond to the IP address (see the
66136 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
66137 by the remote host in the SMTP HELO or EHLO command, and has not been
66138 verified. If verification yields a different name to that given for HELO or
66139 EHLO, the verified name appears first, followed by the HELO or EHLO
66140 name in parentheses.
66141 </para>
66142 <para>
66143 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
66144 without brackets, in the HELO or EHLO command, leading to entries in
66145 the log containing text like these examples:
66146 </para>
66147 <literallayout class="monospaced">
66148 H=(10.21.32.43) [192.168.8.34]
66149 H=([10.21.32.43]) [192.168.8.34]
66150 </literallayout>
66151 <para>
66152 This can be confusing. Only the final address in square brackets can be relied
66153 on.
66154 </para>
66155 <para>
66156 For locally generated messages (that is, messages not received over TCP/IP),
66157 the H field is omitted, and the U field contains the login name of the caller
66158 of Exim.
66159 </para>
66160 <para>
66161 <indexterm role="concept">
66162 <primary>authentication</primary>
66163 <secondary>logging</secondary>
66164 </indexterm>
66165 <indexterm role="concept">
66166 <primary>AUTH</primary>
66167 <secondary>logging</secondary>
66168 </indexterm>
66169 For all messages, the P field specifies the protocol used to receive the
66170 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
66171 of incoming SMTP messages, the value indicates whether or not any SMTP
66172 extensions (ESMTP), encryption, or authentication were used. If the SMTP
66173 session was encrypted, there is an additional X field that records the cipher
66174 suite that was used.
66175 </para>
66176 <para>
66177 <indexterm role="concept">
66178 <primary>log</primary>
66179 <secondary>protocol</secondary>
66180 </indexterm>
66181 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
66182 hosts that have authenticated themselves using the SMTP AUTH command. The first
66183 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
66184 there is an additional item A= followed by the name of the authenticator that
66185 was used. If an authenticated identification was set up by the authenticator&#x2019;s
66186 <option>server_set_id</option> option, this is logged too, separated by a colon from the
66187 authenticator name.
66188 </para>
66189 <para>
66190 <indexterm role="concept">
66191 <primary>size</primary>
66192 <secondary>of message</secondary>
66193 </indexterm>
66194 The id field records the existing message id, if present. The size of the
66195 received message is given by the S field. When the message is delivered,
66196 headers may be removed or added, so that the size of delivered copies of the
66197 message may not correspond with this value (and indeed may be different to each
66198 other).
66199 </para>
66200 <para>
66201 The <option>log_selector</option> option can be used to request the logging of additional
66202 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
66203 </para>
66204 </section>
66205 <section id="SECID252">
66206 <title>Logging deliveries</title>
66207 <para>
66208 <indexterm role="concept">
66209 <primary>log</primary>
66210 <secondary>delivery line</secondary>
66211 </indexterm>
66212 The format of the single-line entry in the main log that is written for every
66213 delivery is shown in one of the examples below, for local and remote
66214 deliveries, respectively. Each example has been split into multiple lines in order
66215 to fit it on the page:
66216 </para>
66217 <literallayout class="monospaced">
66218 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
66219   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
66220 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
66221   monk@holistic.fict.example R=dnslookup T=remote_smtp
66222   H=holistic.fict.example [192.168.234.234]
66223 </literallayout>
66224 <para>
66225 For ordinary local deliveries, the original address is given in angle brackets
66226 after the final delivery address, which might be a pipe or a file. If
66227 intermediate address(es) exist between the original and the final address, the
66228 last of these is given in parentheses after the final address. The R and T
66229 fields record the router and transport that were used to process the address.
66230 </para>
66231 <para>
66232 If SMTP AUTH was used for the delivery there is an additional item A=
66233 followed by the name of the authenticator that was used.
66234 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
66235 option, this is logged too, separated by a colon from the authenticator name.
66236 </para>
66237 <para>
66238 If a shadow transport was run after a successful local delivery, the log line
66239 for the successful delivery has an item added on the end, of the form
66240 </para>
66241 <literallayout>
66242 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
66243 </literallayout>
66244 <para>
66245 If the shadow transport did not succeed, the error message is put in
66246 parentheses afterwards.
66247 </para>
66248 <para>
66249 <indexterm role="concept">
66250 <primary>asterisk</primary>
66251 <secondary>after IP address</secondary>
66252 </indexterm>
66253 When more than one address is included in a single delivery (for example, two
66254 SMTP RCPT commands in one transaction) the second and subsequent addresses are
66255 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
66256 down a single SMTP connection, an asterisk follows the IP address in the log
66257 lines for the second and subsequent messages.
66258 When two or more messages are delivered down a single TLS connection, the
66259 DNS and some TLS-related information logged for the first message delivered
66260 will not be present in the log lines for the second and subsequent messages.
66261 TLS cipher information is still available.
66262 </para>
66263 <para>
66264 <indexterm role="concept">
66265 <primary>delivery</primary>
66266 <secondary>cutthrough; logging</secondary>
66267 </indexterm>
66268 <indexterm role="concept">
66269 <primary>cutthrough</primary>
66270 <secondary>logging</secondary>
66271 </indexterm>
66272 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
66273 line precedes the reception line, since cutthrough waits for a possible
66274 rejection from the destination in case it can reject the sourced item.
66275 </para>
66276 <para>
66277 The generation of a reply message by a filter file gets logged as a
66278 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
66279 </para>
66280 <para>
66281 The <option>log_selector</option> option can be used to request the logging of additional
66282 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
66283 </para>
66284 </section>
66285 <section id="SECID253">
66286 <title>Discarded deliveries</title>
66287 <para>
66288 <indexterm role="concept">
66289 <primary>discarded messages</primary>
66290 </indexterm>
66291 <indexterm role="concept">
66292 <primary>message</primary>
66293 <secondary>discarded</secondary>
66294 </indexterm>
66295 <indexterm role="concept">
66296 <primary>delivery</primary>
66297 <secondary>discarded; logging</secondary>
66298 </indexterm>
66299 When a message is discarded as a result of the command <quote>seen finish</quote> being
66300 obeyed in a filter file which generates no deliveries, a log entry of the form
66301 </para>
66302 <literallayout class="monospaced">
66303 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
66304   &lt;low.club@bridge.example&gt; R=userforward
66305 </literallayout>
66306 <para>
66307 is written, to record why no deliveries are logged. When a message is discarded
66308 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
66309 </para>
66310 <literallayout class="monospaced">
66311 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
66312   &lt;hole@nowhere.example&gt; R=blackhole_router
66313 </literallayout>
66314 </section>
66315 <section id="SECID254">
66316 <title>Deferred deliveries</title>
66317 <para>
66318 When a delivery is deferred, a line of the following form is logged:
66319 </para>
66320 <literallayout class="monospaced">
66321 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
66322   R=dnslookup T=smtp defer (146): Connection refused
66323 </literallayout>
66324 <para>
66325 In the case of remote deliveries, the error is the one that was given for the
66326 last IP address that was tried. Details of individual SMTP failures are also
66327 written to the log, so the above line would be preceded by something like
66328 </para>
66329 <literallayout class="monospaced">
66330 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
66331   mail1.endrest.example [192.168.239.239]: Connection refused
66332 </literallayout>
66333 <para>
66334 When a deferred address is skipped because its retry time has not been reached,
66335 a message is written to the log, but this can be suppressed by setting an
66336 appropriate value in <option>log_selector</option>.
66337 </para>
66338 </section>
66339 <section id="SECID255">
66340 <title>Delivery failures</title>
66341 <para>
66342 <indexterm role="concept">
66343 <primary>delivery</primary>
66344 <secondary>failure; logging</secondary>
66345 </indexterm>
66346 If a delivery fails because an address cannot be routed, a line of the
66347 following form is logged:
66348 </para>
66349 <literallayout class="monospaced">
66350 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
66351   &lt;jim@trek99.example&gt;: unknown mail domain
66352 </literallayout>
66353 <para>
66354 If a delivery fails at transport time, the router and transport are shown, and
66355 the response from the remote host is included, as in this example:
66356 </para>
66357 <literallayout class="monospaced">
66358 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
66359   R=dnslookup T=remote_smtp: SMTP error from remote mailer
66360   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
66361   pbmail3.py.example [192.168.63.111]: 553 5.3.0
66362   &lt;ace400@pb.example&gt;...Addressee unknown
66363 </literallayout>
66364 <para>
66365 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
66366 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
66367 disabling PIPELINING. The log lines for all forms of delivery failure are
66368 flagged with <literal>**</literal>.
66369 </para>
66370 </section>
66371 <section id="SECID256">
66372 <title>Fake deliveries</title>
66373 <para>
66374 <indexterm role="concept">
66375 <primary>delivery</primary>
66376 <secondary>fake; logging</secondary>
66377 </indexterm>
66378 If a delivery does not actually take place because the <option>-N</option> option has been
66379 used to suppress it, a normal delivery line is written to the log, except that
66380 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
66381 </para>
66382 </section>
66383 <section id="SECID257">
66384 <title>Completion</title>
66385 <para>
66386 A line of the form
66387 </para>
66388 <literallayout class="monospaced">
66389 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
66390 </literallayout>
66391 <para>
66392 is written to the main log when a message is about to be removed from the spool
66393 at the end of its processing.
66394 </para>
66395 </section>
66396 <section id="SECID258">
66397 <title>Summary of Fields in Log Lines</title>
66398 <para>
66399 <indexterm role="concept">
66400 <primary>log</primary>
66401 <secondary>summary of fields</secondary>
66402 </indexterm>
66403 A summary of the field identifiers that are used in log lines is shown in
66404 the following table:
66405 </para>
66406 <literallayout>
66407 <literal>A   </literal>        authenticator name (and optional id and sender)
66408 <literal>C   </literal>        SMTP confirmation on delivery
66409 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
66410 <literal>CV  </literal>        certificate verification status
66411 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
66412 <literal>DKIM</literal>        domain verified in incoming message
66413 <literal>DN  </literal>        distinguished name from peer certificate
66414 <literal>DS  </literal>        DNSSEC secured lookups
66415 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
66416 <literal>F   </literal>        sender address (on delivery lines)
66417 <literal>H   </literal>        host name and IP address
66418 <literal>I   </literal>        local interface used
66419 <literal>K   </literal>        CHUNKING extension used
66420 <literal>id  </literal>        message id for incoming message
66421 <literal>M8S </literal>        8BITMIME status for incoming message
66422 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
66423 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
66424 <literal>PRDR</literal>        PRDR extension used
66425 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
66426 <literal>Q   </literal>        alternate queue name
66427 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
66428 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
66429 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
66430 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
66431 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
66432 <literal>S   </literal>        size of message in bytes
66433 <literal>SNI </literal>        server name indication from TLS client hello
66434 <literal>ST  </literal>        shadow transport name
66435 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
66436 <literal>TFO </literal>        connection took advantage of TCP Fast Open
66437 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
66438 <literal>U   </literal>        local user or RFC 1413 identity
66439 <literal>X   </literal>        TLS cipher suite
66440 </literallayout>
66441 </section>
66442 <section id="SECID259">
66443 <title>Other log entries</title>
66444 <para>
66445 Various other types of log entry are written from time to time. Most should be
66446 self-explanatory. Among the more common are:
66447 </para>
66448 <itemizedlist>
66449 <listitem>
66450 <para>
66451 <indexterm role="concept">
66452 <primary>retry</primary>
66453 <secondary>time not reached</secondary>
66454 </indexterm>
66455 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
66456 during routing or local delivery, and the time to retry has not yet arrived.
66457 This message is not written to an individual message log file unless it happens
66458 during the first delivery attempt.
66459 </para>
66460 </listitem>
66461 <listitem>
66462 <para>
66463 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
66464 temporary errors during remote delivery, and the retry time has not yet arrived
66465 for any of the hosts to which it is routed.
66466 </para>
66467 </listitem>
66468 <listitem>
66469 <para>
66470 <indexterm role="concept">
66471 <primary>spool directory</primary>
66472 <secondary>file locked</secondary>
66473 </indexterm>
66474 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
66475 some other Exim process is already working on the message. This can be quite
66476 common if queue running processes are started at frequent intervals. The
66477 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
66478 doing.
66479 </para>
66480 </listitem>
66481 <listitem>
66482 <para>
66483 <indexterm role="concept">
66484 <primary>error</primary>
66485 <secondary>ignored</secondary>
66486 </indexterm>
66487 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
66488 message:
66489 </para>
66490 <orderedlist numeration="arabic">
66491 <listitem>
66492 <para>
66493 Exim failed to deliver a bounce message whose age was greater than
66494 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
66495 </para>
66496 </listitem>
66497 <listitem>
66498 <para>
66499 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
66500 failed. The delivery was discarded.
66501 </para>
66502 </listitem>
66503 <listitem>
66504 <para>
66505 A delivery set up by a router configured with
66506 </para>
66507 <literallayout class="monospaced">
66508     errors_to = &lt;&gt;
66509 </literallayout>
66510 <para>
66511 failed. The delivery was discarded.
66512 </para>
66513 </listitem>
66514 </orderedlist>
66515 </listitem>
66516 <listitem>
66517 <para revisionflag="changed">
66518 <indexterm role="concept">
66519 <primary>DKIM</primary>
66520 <secondary>log line</secondary>
66521 </indexterm>
66522 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
66523 logging and the message has a DKIM signature header.
66524 </para>
66525 </listitem>
66526 </itemizedlist>
66527 </section>
66528 <section id="SECTlogselector">
66529 <title>Reducing or increasing what is logged</title>
66530 <para>
66531 <indexterm role="concept">
66532 <primary>log</primary>
66533 <secondary>selectors</secondary>
66534 </indexterm>
66535 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
66536 default logging, or you can request additional logging. The value of
66537 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
66538 example:
66539 </para>
66540 <literallayout class="monospaced">
66541 log_selector = +arguments -retry_defer
66542 </literallayout>
66543 <para>
66544 The list of optional log items is in the following table, with the default
66545 selection marked by asterisks:
66546 </para>
66547 <literallayout>
66548 <literal> 8bitmime                   </literal>  received 8BITMIME status
66549 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
66550 <literal> address_rewrite            </literal>  address rewriting
66551 <literal> all_parents                </literal>  all parents in =&gt; lines
66552 <literal> arguments                  </literal>  command line arguments
66553 <literal>*connection_reject          </literal>  connection rejections
66554 <literal>*delay_delivery             </literal>  immediate delivery delayed
66555 <literal> deliver_time               </literal>  time taken to perform delivery
66556 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
66557 <literal>*dkim                       </literal>  DKIM verified domain on &lt;= lines
66558 <literal> dkim_verbose               </literal>  separate full DKIM verification result line, per signature
66559 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
66560 <literal> dnssec                     </literal>  DNSSEC secured lookups
66561 <literal>*etrn                       </literal>  ETRN commands
66562 <literal>*host_lookup_failed         </literal>  as it says
66563 <literal> ident_timeout              </literal>  timeout for ident connection
66564 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
66565 <literal> incoming_port              </literal>  remote port on &lt;= lines
66566 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
66567 <literal> millisec                   </literal>  millisecond timestamps and RT,QT,DT,D times
66568 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
66569 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
66570 <literal>*queue_run                  </literal>  start and end queue runs
66571 <literal> queue_time                 </literal>  time on queue for one recipient
66572 <literal> queue_time_overall         </literal>  time on queue for whole message
66573 <literal> pid                        </literal>  Exim process id
66574 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
66575 <literal> receive_time               </literal>  time taken to receive message
66576 <literal> received_recipients        </literal>  recipients on &lt;= lines
66577 <literal> received_sender            </literal>  sender on &lt;= lines
66578 <literal>*rejected_header            </literal>  header contents on reject log
66579 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
66580 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
66581 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
66582 <literal>*sender_verify_fail         </literal>  sender verification failures
66583 <literal>*size_reject                </literal>  rejection because too big
66584 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
66585 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
66586 <literal> smtp_connection            </literal>  incoming SMTP connections
66587 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
66588 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
66589 <literal> smtp_no_mail               </literal>  session with no MAIL commands
66590 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
66591 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
66592 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
66593 <literal>*tls_certificate_verified   </literal>  certificate verification status
66594 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
66595 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
66596 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
66597 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
66598
66599 <literal> all                        </literal>  all of the above
66600 </literallayout>
66601 <para>
66602 See also the <option>slow_lookup_log</option> main configuration option,
66603 section <xref linkend="SECID99"/>
66604 </para>
66605 <para>
66606 More details on each of these items follows:
66607 </para>
66608 <itemizedlist>
66609 <listitem>
66610 <para>
66611 <indexterm role="concept">
66612 <primary>8BITMIME</primary>
66613 </indexterm>
66614 <indexterm role="concept">
66615 <primary>log</primary>
66616 <secondary>8BITMIME</secondary>
66617 </indexterm>
66618 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
66619 which may help in tracking down interoperability issues with ancient MTAs
66620 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
66621 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
66622 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
66623 </para>
66624 </listitem>
66625 <listitem>
66626 <para>
66627 <indexterm role="concept">
66628 <primary><option>warn</option> ACL verb</primary>
66629 <secondary>log when skipping</secondary>
66630 </indexterm>
66631 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
66632 its conditions cannot be evaluated, a log line to this effect is written if
66633 this log selector is set.
66634 </para>
66635 </listitem>
66636 <listitem>
66637 <para>
66638 <indexterm role="concept">
66639 <primary>log</primary>
66640 <secondary>rewriting</secondary>
66641 </indexterm>
66642 <indexterm role="concept">
66643 <primary>rewriting</primary>
66644 <secondary>logging</secondary>
66645 </indexterm>
66646 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
66647 rewrites, but not to rewrites in filters run as an unprivileged user (because
66648 such users cannot access the log).
66649 </para>
66650 </listitem>
66651 <listitem>
66652 <para>
66653 <indexterm role="concept">
66654 <primary>log</primary>
66655 <secondary>full parentage</secondary>
66656 </indexterm>
66657 <option>all_parents</option>: Normally only the original and final addresses are logged on
66658 delivery lines; with this selector, intermediate parents are given in
66659 parentheses between them.
66660 </para>
66661 </listitem>
66662 <listitem>
66663 <para>
66664 <indexterm role="concept">
66665 <primary>log</primary>
66666 <secondary>Exim arguments</secondary>
66667 </indexterm>
66668 <indexterm role="concept">
66669 <primary>Exim arguments, logging</primary>
66670 </indexterm>
66671 <option>arguments</option>: This causes Exim to write the arguments with which it was called
66672 to the main log, preceded by the current working directory. This is a debugging
66673 feature, added to make it easier to find out how certain MUAs call
66674 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
66675 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
66676 that are empty or that contain white space are quoted. Non-printing characters
66677 are shown as escape sequences. This facility cannot log unrecognized arguments,
66678 because the arguments are checked before the configuration file is read. The
66679 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
66680 between the caller and Exim.
66681 </para>
66682 </listitem>
66683 <listitem>
66684 <para>
66685 <indexterm role="concept">
66686 <primary>log</primary>
66687 <secondary>connection rejections</secondary>
66688 </indexterm>
66689 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
66690 connection is rejected, for whatever reason.
66691 </para>
66692 </listitem>
66693 <listitem>
66694 <para>
66695 <indexterm role="concept">
66696 <primary>log</primary>
66697 <secondary>delayed delivery</secondary>
66698 </indexterm>
66699 <indexterm role="concept">
66700 <primary>delayed delivery, logging</primary>
66701 </indexterm>
66702 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
66703 started for an incoming message because the load is too high or too many
66704 messages were received on one connection. Logging does not occur if no delivery
66705 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
66706 </para>
66707 </listitem>
66708 <listitem>
66709 <para>
66710 <indexterm role="concept">
66711 <primary>log</primary>
66712 <secondary>delivery duration</secondary>
66713 </indexterm>
66714 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
66715 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
66716 If millisecond logging is enabled, short times will be shown with greater
66717 precision, eg. <literal>DT=0.304s</literal>.
66718 </para>
66719 </listitem>
66720 <listitem>
66721 <para>
66722 <indexterm role="concept">
66723 <primary>log</primary>
66724 <secondary>message size on delivery</secondary>
66725 </indexterm>
66726 <indexterm role="concept">
66727 <primary>size</primary>
66728 <secondary>of message</secondary>
66729 </indexterm>
66730 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
66731 the <quote>=&gt;</quote> line, tagged with S=.
66732 </para>
66733 </listitem>
66734 <listitem>
66735 <para revisionflag="changed">
66736 <indexterm role="concept">
66737 <primary>log</primary>
66738 <secondary>DKIM verification</secondary>
66739 </indexterm>
66740 <indexterm role="concept">
66741 <primary>DKIM</primary>
66742 <secondary>verification logging</secondary>
66743 </indexterm>
66744 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
66745 verifies successfully a tag of DKIM is added, with one of the verified domains.
66746 </para>
66747 </listitem>
66748 <listitem>
66749 <para revisionflag="changed">
66750 <indexterm role="concept">
66751 <primary>log</primary>
66752 <secondary>DKIM verification</secondary>
66753 </indexterm>
66754 <indexterm role="concept">
66755 <primary>DKIM</primary>
66756 <secondary>verification logging</secondary>
66757 </indexterm>
66758 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
66759 </para>
66760 </listitem>
66761 <listitem>
66762 <para>
66763 <indexterm role="concept">
66764 <primary>log</primary>
66765 <secondary>dnslist defer</secondary>
66766 </indexterm>
66767 <indexterm role="concept">
66768 <primary>DNS list</primary>
66769 <secondary>logging defer</secondary>
66770 </indexterm>
66771 <indexterm role="concept">
66772 <primary>black list (DNS)</primary>
66773 </indexterm>
66774 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
66775 DNS black list suffers a temporary error.
66776 </para>
66777 </listitem>
66778 <listitem>
66779 <para>
66780 <indexterm role="concept">
66781 <primary>log</primary>
66782 <secondary>dnssec</secondary>
66783 </indexterm>
66784 <indexterm role="concept">
66785 <primary>dnssec</primary>
66786 <secondary>logging</secondary>
66787 </indexterm>
66788 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
66789 dns lookups gave secure results a tag of DS is added.
66790 For acceptance this covers the reverse and forward lookups for host name verification.
66791 It does not cover helo-name verification.
66792 For delivery this covers the SRV, MX, A and/or AAAA lookups.
66793 </para>
66794 </listitem>
66795 <listitem>
66796 <para>
66797 <indexterm role="concept">
66798 <primary>log</primary>
66799 <secondary>ETRN commands</secondary>
66800 </indexterm>
66801 <indexterm role="concept">
66802 <primary>ETRN</primary>
66803 <secondary>logging</secondary>
66804 </indexterm>
66805 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
66806 is run to determine whether or not it is actually accepted. An invalid ETRN
66807 command, or one received within a message transaction is not logged by this
66808 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
66809 </para>
66810 </listitem>
66811 <listitem>
66812 <para>
66813 <indexterm role="concept">
66814 <primary>log</primary>
66815 <secondary>host lookup failure</secondary>
66816 </indexterm>
66817 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
66818 any addresses, or when a lookup of an IP address fails to find a host name, a
66819 log line is written. This logging does not apply to direct DNS lookups when
66820 routing email addresses, but it does apply to <quote>byname</quote> lookups.
66821 </para>
66822 </listitem>
66823 <listitem>
66824 <para>
66825 <indexterm role="concept">
66826 <primary>log</primary>
66827 <secondary>ident timeout</secondary>
66828 </indexterm>
66829 <indexterm role="concept">
66830 <primary>RFC 1413</primary>
66831 <secondary>logging timeout</secondary>
66832 </indexterm>
66833 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
66834 client&#x2019;s ident port times out.
66835 </para>
66836 </listitem>
66837 <listitem>
66838 <para>
66839 <indexterm role="concept">
66840 <primary>log</primary>
66841 <secondary>incoming interface</secondary>
66842 </indexterm>
66843 <indexterm role="concept">
66844 <primary>log</primary>
66845 <secondary>local interface</secondary>
66846 </indexterm>
66847 <indexterm role="concept">
66848 <primary>log</primary>
66849 <secondary>local address and port</secondary>
66850 </indexterm>
66851 <indexterm role="concept">
66852 <primary>TCP/IP</primary>
66853 <secondary>logging local address and port</secondary>
66854 </indexterm>
66855 <indexterm role="concept">
66856 <primary>interface</primary>
66857 <secondary>logging</secondary>
66858 </indexterm>
66859 <option>incoming_interface</option>: The interface on which a message was received is added
66860 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
66861 followed by a colon and the port number. The local interface and port are also
66862 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, to
66863 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
66864 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
66865 </para>
66866 </listitem>
66867 <listitem>
66868 <para>
66869 <indexterm role="concept">
66870 <primary>log</primary>
66871 <secondary>incoming proxy address</secondary>
66872 </indexterm>
66873 <indexterm role="concept">
66874 <primary>proxy</primary>
66875 <secondary>logging proxy address</secondary>
66876 </indexterm>
66877 <indexterm role="concept">
66878 <primary>TCP/IP</primary>
66879 <secondary>logging proxy address</secondary>
66880 </indexterm>
66881 <option>proxy</option>: The internal (closest to the system running Exim) IP address
66882 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
66883 on a proxied connection
66884 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
66885 See <xref linkend="SECTproxyInbound"/> for more information.
66886 </para>
66887 </listitem>
66888 <listitem>
66889 <para>
66890 <indexterm role="concept">
66891 <primary>log</primary>
66892 <secondary>incoming remote port</secondary>
66893 </indexterm>
66894 <indexterm role="concept">
66895 <primary>port</primary>
66896 <secondary>logging remote</secondary>
66897 </indexterm>
66898 <indexterm role="concept">
66899 <primary>TCP/IP</primary>
66900 <secondary>logging incoming remote port</secondary>
66901 </indexterm>
66902 <indexterm role="variable">
66903 <primary><varname>$sender_fullhost</varname></primary>
66904 </indexterm>
66905 <indexterm role="variable">
66906 <primary><varname>$sender_rcvhost</varname></primary>
66907 </indexterm>
66908 <option>incoming_port</option>: The remote port number from which a message was received is
66909 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
66910 in square brackets, and separated from it by a colon. This is implemented by
66911 changing the value that is put in the <varname>$sender_fullhost</varname> and
66912 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
66913 important with the widening use of NAT (see RFC 2505).
66914 </para>
66915 </listitem>
66916 <listitem>
66917 <para>
66918 <indexterm role="concept">
66919 <primary>log</primary>
66920 <secondary>dropped connection</secondary>
66921 </indexterm>
66922 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
66923 connection is unexpectedly dropped.
66924 </para>
66925 </listitem>
66926 <listitem>
66927 <para>
66928 <indexterm role="concept">
66929 <primary>log</primary>
66930 <secondary>millisecond timestamps</secondary>
66931 </indexterm>
66932 <indexterm role="concept">
66933 <primary>millisecond</primary>
66934 <secondary>logging</secondary>
66935 </indexterm>
66936 <indexterm role="concept">
66937 <primary>timestamps</primary>
66938 <secondary>millisecond, in logs</secondary>
66939 </indexterm>
66940 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
66941 appended to the seconds value.
66942 </para>
66943 </listitem>
66944 <listitem>
66945 <para>
66946 <indexterm role="concept">
66947 <primary>log</primary>
66948 <secondary>outgoing interface</secondary>
66949 </indexterm>
66950 <indexterm role="concept">
66951 <primary>log</primary>
66952 <secondary>local interface</secondary>
66953 </indexterm>
66954 <indexterm role="concept">
66955 <primary>log</primary>
66956 <secondary>local address and port</secondary>
66957 </indexterm>
66958 <indexterm role="concept">
66959 <primary>TCP/IP</primary>
66960 <secondary>logging local address and port</secondary>
66961 </indexterm>
66962 <indexterm role="concept">
66963 <primary>interface</primary>
66964 <secondary>logging</secondary>
66965 </indexterm>
66966 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
66967 interface on which a message was sent is added to delivery lines as an I= tag
66968 followed by IP address in square brackets. You can disable this by turning
66969 off the <option>outgoing_interface</option> option.
66970 </para>
66971 </listitem>
66972 <listitem>
66973 <para>
66974 <indexterm role="concept">
66975 <primary>log</primary>
66976 <secondary>outgoing remote port</secondary>
66977 </indexterm>
66978 <indexterm role="concept">
66979 <primary>port</primary>
66980 <secondary>logging outgoing remote</secondary>
66981 </indexterm>
66982 <indexterm role="concept">
66983 <primary>TCP/IP</primary>
66984 <secondary>logging outgoing remote port</secondary>
66985 </indexterm>
66986 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
66987 containing =&gt; tags) following the IP address.
66988 The local port is also added if <option>incoming_interface</option> and
66989 <option>outgoing_interface</option> are both enabled.
66990 This option is not included in the default setting, because for most ordinary
66991 configurations, the remote port number is always 25 (the SMTP port), and the
66992 local port is a random ephemeral port.
66993 </para>
66994 </listitem>
66995 <listitem>
66996 <para>
66997 <indexterm role="concept">
66998 <primary>log</primary>
66999 <secondary>process ids in</secondary>
67000 </indexterm>
67001 <indexterm role="concept">
67002 <primary>pid (process id)</primary>
67003 <secondary>in log lines</secondary>
67004 </indexterm>
67005 <option>pid</option>: The current process id is added to every log line, in square brackets,
67006 immediately after the time and date.
67007 </para>
67008 </listitem>
67009 <listitem>
67010 <para>
67011 <indexterm role="concept">
67012 <primary>log</primary>
67013 <secondary>queue run</secondary>
67014 </indexterm>
67015 <indexterm role="concept">
67016 <primary>queue runner</primary>
67017 <secondary>logging</secondary>
67018 </indexterm>
67019 <option>queue_run</option>: The start and end of every queue run are logged.
67020 </para>
67021 </listitem>
67022 <listitem>
67023 <para>
67024 <indexterm role="concept">
67025 <primary>log</primary>
67026 <secondary>queue time</secondary>
67027 </indexterm>
67028 <option>queue_time</option>: The amount of time the message has been in the queue on the
67029 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
67030 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
67031 includes reception time as well as the delivery time for the current address.
67032 This means that it may be longer than the difference between the arrival and
67033 delivery log line times, because the arrival log line is not written until the
67034 message has been successfully received.
67035 If millisecond logging is enabled, short times will be shown with greater
67036 precision, eg. <literal>QT=1.578s</literal>.
67037 </para>
67038 </listitem>
67039 <listitem>
67040 <para>
67041 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
67042 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
67043 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
67044 message, so it includes reception time as well as the total delivery time.
67045 </para>
67046 </listitem>
67047 <listitem>
67048 <para revisionflag="changed">
67049 <indexterm role="concept">
67050 <primary>log</primary>
67051 <secondary>receive duration</secondary>
67052 </indexterm>
67053 <option>receive_time</option>: For each message, the amount of real time it has taken to
67054 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
67055 If millisecond logging is enabled, short times will be shown with greater
67056 precision, eg. <literal>RT=0.204s</literal>.
67057 </para>
67058 </listitem>
67059 <listitem>
67060 <para>
67061 <indexterm role="concept">
67062 <primary>log</primary>
67063 <secondary>recipients</secondary>
67064 </indexterm>
67065 <option>received_recipients</option>: The recipients of a message are listed in the main log
67066 as soon as the message is received. The list appears at the end of the log line
67067 that is written when a message is received, preceded by the word <quote>for</quote>. The
67068 addresses are listed after they have been qualified, but before any rewriting
67069 has taken place.
67070 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
67071 in the list.
67072 </para>
67073 </listitem>
67074 <listitem>
67075 <para>
67076 <indexterm role="concept">
67077 <primary>log</primary>
67078 <secondary>sender reception</secondary>
67079 </indexterm>
67080 <option>received_sender</option>: The unrewritten original sender of a message is added to
67081 the end of the log line that records the message&#x2019;s arrival, after the word
67082 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
67083 </para>
67084 </listitem>
67085 <listitem>
67086 <para>
67087 <indexterm role="concept">
67088 <primary>log</primary>
67089 <secondary>header lines for rejection</secondary>
67090 </indexterm>
67091 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
67092 rejection is written to the reject log, the complete header is added to the
67093 log. Header logging can be turned off individually for messages that are
67094 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
67095 </para>
67096 </listitem>
67097 <listitem>
67098 <para>
67099 <indexterm role="concept">
67100 <primary>log</primary>
67101 <secondary>retry defer</secondary>
67102 </indexterm>
67103 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
67104 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
67105 message is always omitted from individual message logs after the first delivery
67106 attempt.
67107 </para>
67108 </listitem>
67109 <listitem>
67110 <para>
67111 <indexterm role="concept">
67112 <primary>log</primary>
67113 <secondary>return path</secondary>
67114 </indexterm>
67115 <option>return_path_on_delivery</option>: The return path that is being transmitted with
67116 the message is included in delivery and bounce lines, using the tag P=.
67117 This is omitted if no delivery actually happens, for example, if routing fails,
67118 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
67119 </para>
67120 </listitem>
67121 <listitem>
67122 <para>
67123 <indexterm role="concept">
67124 <primary>log</primary>
67125 <secondary>sender on delivery</secondary>
67126 </indexterm>
67127 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
67128 and bounce line, tagged by F= (for <quote>from</quote>).
67129 This is the original sender that was received with the message; it is not
67130 necessarily the same as the outgoing return path.
67131 </para>
67132 </listitem>
67133 <listitem>
67134 <para>
67135 <indexterm role="concept">
67136 <primary>log</primary>
67137 <secondary>sender verify failure</secondary>
67138 </indexterm>
67139 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
67140 gives details of a sender verification failure is not written. Log lines for
67141 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
67142 detail is lost.
67143 </para>
67144 </listitem>
67145 <listitem>
67146 <para>
67147 <indexterm role="concept">
67148 <primary>log</primary>
67149 <secondary>size rejection</secondary>
67150 </indexterm>
67151 <option>size_reject</option>: A log line is written whenever a message is rejected because
67152 it is too big.
67153 </para>
67154 </listitem>
67155 <listitem>
67156 <para>
67157 <indexterm role="concept">
67158 <primary>log</primary>
67159 <secondary>frozen messages; skipped</secondary>
67160 </indexterm>
67161 <indexterm role="concept">
67162 <primary>frozen messages</primary>
67163 <secondary>logging skipping</secondary>
67164 </indexterm>
67165 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
67166 queue run because it is frozen or because another process is already delivering
67167 it.
67168 <indexterm role="concept">
67169 <primary><quote>spool file is locked</quote></primary>
67170 </indexterm>
67171 The message that is written is <quote>spool file is locked</quote>.
67172 </para>
67173 </listitem>
67174 <listitem>
67175 <para>
67176 <indexterm role="concept">
67177 <primary>log</primary>
67178 <secondary>smtp confirmation</secondary>
67179 </indexterm>
67180 <indexterm role="concept">
67181 <primary>SMTP</primary>
67182 <secondary>logging confirmation</secondary>
67183 </indexterm>
67184 <indexterm role="concept">
67185 <primary>LMTP</primary>
67186 <secondary>logging confirmation</secondary>
67187 </indexterm>
67188 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
67189 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
67190 A number of MTAs (including Exim) return an identifying string in this
67191 response.
67192 </para>
67193 </listitem>
67194 <listitem>
67195 <para>
67196 <indexterm role="concept">
67197 <primary>log</primary>
67198 <secondary>SMTP connections</secondary>
67199 </indexterm>
67200 <indexterm role="concept">
67201 <primary>SMTP</primary>
67202 <secondary>logging connections</secondary>
67203 </indexterm>
67204 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
67205 established or closed, unless the connection is from a host that matches
67206 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
67207 only when the closure is unexpected.) This applies to connections from local
67208 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
67209 dropped in the middle of a message, a log line is always written, whether or
67210 not this selector is set, but otherwise nothing is written at the start and end
67211 of connections unless this selector is enabled.
67212 </para>
67213 <para>
67214 For TCP/IP connections to an Exim daemon, the current number of connections is
67215 included in the log message for each new connection, but note that the count is
67216 reset if the daemon is restarted.
67217 Also, because connections are closed (and the closure is logged) in
67218 subprocesses, the count may not include connections that have been closed but
67219 whose termination the daemon has not yet noticed. Thus, while it is possible to
67220 match up the opening and closing of connections in the log, the value of the
67221 logged counts may not be entirely accurate.
67222 </para>
67223 </listitem>
67224 <listitem>
67225 <para>
67226 <indexterm role="concept">
67227 <primary>log</primary>
67228 <secondary>SMTP transaction; incomplete</secondary>
67229 </indexterm>
67230 <indexterm role="concept">
67231 <primary>SMTP</primary>
67232 <secondary>logging incomplete transactions</secondary>
67233 </indexterm>
67234 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
67235 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
67236 and the message sender plus any accepted recipients are included in the log
67237 line. This can provide evidence of dictionary attacks.
67238 </para>
67239 </listitem>
67240 <listitem>
67241 <para>
67242 <indexterm role="concept">
67243 <primary>log</primary>
67244 <secondary>non-MAIL SMTP sessions</secondary>
67245 </indexterm>
67246 <indexterm role="concept">
67247 <primary>MAIL</primary>
67248 <secondary>logging session without</secondary>
67249 </indexterm>
67250 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
67251 connection terminates without having issued a MAIL command. This includes both
67252 the case when the connection is dropped, and the case when QUIT is used. It
67253 does not include cases where the connection is rejected right at the start (by
67254 an ACL, or because there are too many connections, or whatever). These cases
67255 already have their own log lines.
67256 </para>
67257 <para>
67258 The log line that is written contains the identity of the client in the usual
67259 way, followed by D= and a time, which records the duration of the connection.
67260 If the connection was authenticated, this fact is logged exactly as it is for
67261 an incoming message, with an A= item. If the connection was encrypted, CV=,
67262 DN=, and X= items may appear as they do for an incoming message, controlled by
67263 the same logging options.
67264 </para>
67265 <para>
67266 Finally, if any SMTP commands were issued during the connection, a C= item
67267 is added to the line, listing the commands that were used. For example,
67268 </para>
67269 <literallayout class="monospaced">
67270 C=EHLO,QUIT
67271 </literallayout>
67272 <para>
67273 shows that the client issued QUIT straight after EHLO. If there were fewer
67274 than 20 commands, they are all listed. If there were more than 20 commands,
67275 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
67276 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
67277 have been aborted before 20 non-mail commands are processed.
67278 </para>
67279 </listitem>
67280 <listitem>
67281 <para>
67282 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
67283 colon-separated, is appended to the A= item for a message arrival or delivery
67284 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
67285 was accepted or used.
67286 </para>
67287 </listitem>
67288 <listitem>
67289 <para>
67290 <indexterm role="concept">
67291 <primary>log</primary>
67292 <secondary>SMTP protocol error</secondary>
67293 </indexterm>
67294 <indexterm role="concept">
67295 <primary>SMTP</primary>
67296 <secondary>logging protocol error</secondary>
67297 </indexterm>
67298 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
67299 encountered. Exim does not have perfect detection of all protocol errors
67300 because of transmission delays and the use of pipelining. If PIPELINING has
67301 been advertised to a client, an Exim server assumes that the client will use
67302 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
67303 received after rejecting MAIL) as protocol errors.
67304 </para>
67305 </listitem>
67306 <listitem>
67307 <para>
67308 <indexterm role="concept">
67309 <primary>SMTP</primary>
67310 <secondary>logging syntax errors</secondary>
67311 </indexterm>
67312 <indexterm role="concept">
67313 <primary>SMTP</primary>
67314 <secondary>syntax errors; logging</secondary>
67315 </indexterm>
67316 <indexterm role="concept">
67317 <primary>SMTP</primary>
67318 <secondary>unknown command; logging</secondary>
67319 </indexterm>
67320 <indexterm role="concept">
67321 <primary>log</primary>
67322 <secondary>unknown SMTP command</secondary>
67323 </indexterm>
67324 <indexterm role="concept">
67325 <primary>log</primary>
67326 <secondary>SMTP syntax error</secondary>
67327 </indexterm>
67328 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
67329 encountered. An unrecognized command is treated as a syntax error. For an
67330 external connection, the host identity is given; for an internal connection
67331 using <option>-bs</option> the sender identification (normally the calling user) is given.
67332 </para>
67333 </listitem>
67334 <listitem>
67335 <para>
67336 <indexterm role="concept">
67337 <primary>log</primary>
67338 <secondary>subject</secondary>
67339 </indexterm>
67340 <indexterm role="concept">
67341 <primary>subject, logging</primary>
67342 </indexterm>
67343 <option>subject</option>: The subject of the message is added to the arrival log line,
67344 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
67345 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
67346 specifies whether characters with values greater than 127 should be logged
67347 unchanged, or whether they should be rendered as escape sequences.
67348 </para>
67349 </listitem>
67350 <listitem>
67351 <para>
67352 <indexterm role="concept">
67353 <primary>log</primary>
67354 <secondary>certificate verification</secondary>
67355 </indexterm>
67356 <indexterm role="concept">
67357 <primary>log</primary>
67358 <secondary>DANE</secondary>
67359 </indexterm>
67360 <indexterm role="concept">
67361 <primary>DANE</primary>
67362 <secondary>logging</secondary>
67363 </indexterm>
67364 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
67365 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
67366 verified
67367 </para>
67368 <para revisionflag="changed">
67369 using a CA trust anchor,
67370 <literal>CA=dane</literal> if using a DNS trust anchor,
67371 </para>
67372 <para>
67373 and <literal>CV=no</literal> if not.
67374 </para>
67375 </listitem>
67376 <listitem>
67377 <para>
67378 <indexterm role="concept">
67379 <primary>log</primary>
67380 <secondary>TLS cipher</secondary>
67381 </indexterm>
67382 <indexterm role="concept">
67383 <primary>TLS</primary>
67384 <secondary>logging cipher</secondary>
67385 </indexterm>
67386 <option>tls_cipher</option>: When a message is sent or received over an encrypted
67387 connection, the cipher suite used is added to the log line, preceded by X=.
67388 </para>
67389 </listitem>
67390 <listitem>
67391 <para>
67392 <indexterm role="concept">
67393 <primary>log</primary>
67394 <secondary>TLS peer DN</secondary>
67395 </indexterm>
67396 <indexterm role="concept">
67397 <primary>TLS</primary>
67398 <secondary>logging peer DN</secondary>
67399 </indexterm>
67400 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
67401 connection, and a certificate is supplied by the remote host, the peer DN is
67402 added to the log line, preceded by DN=.
67403 </para>
67404 </listitem>
67405 <listitem>
67406 <para>
67407 <indexterm role="concept">
67408 <primary>log</primary>
67409 <secondary>TLS SNI</secondary>
67410 </indexterm>
67411 <indexterm role="concept">
67412 <primary>TLS</primary>
67413 <secondary>logging SNI</secondary>
67414 </indexterm>
67415 <option>tls_sni</option>: When a message is received over an encrypted connection, and
67416 the remote host provided the Server Name Indication extension, the SNI is
67417 added to the log line, preceded by SNI=.
67418 </para>
67419 </listitem>
67420 <listitem>
67421 <para>
67422 <indexterm role="concept">
67423 <primary>log</primary>
67424 <secondary>DNS failure in list</secondary>
67425 </indexterm>
67426 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
67427 result of a list match is failure because a DNS lookup failed.
67428 </para>
67429 </listitem>
67430 </itemizedlist>
67431 </section>
67432 <section id="SECID260">
67433 <title>Message log</title>
67434 <para>
67435 <indexterm role="concept">
67436 <primary>message</primary>
67437 <secondary>log file for</secondary>
67438 </indexterm>
67439 <indexterm role="concept">
67440 <primary>log</primary>
67441 <secondary>message log; description of</secondary>
67442 </indexterm>
67443 <indexterm role="concept">
67444 <primary><filename>msglog</filename> directory</primary>
67445 </indexterm>
67446 <indexterm role="option">
67447 <primary><option>preserve_message_logs</option></primary>
67448 </indexterm>
67449 In addition to the general log files, Exim writes a log file for each message
67450 that it handles. The names of these per-message logs are the message ids, and
67451 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
67452 message log contains copies of the log lines that apply to the message. This
67453 makes it easier to inspect the status of an individual message without having
67454 to search the main log. A message log is deleted when processing of the message
67455 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
67456 only with great care because they can fill up your disk very quickly.
67457 </para>
67458 <para>
67459 On a heavily loaded system, it may be desirable to disable the use of
67460 per-message logs, in order to reduce disk I/O. This can be done by setting the
67461 <option>message_logs</option> option false.
67462 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
67463 </para>
67464 </section>
67465 </chapter>
67466
67467 <chapter id="CHAPutils">
67468 <title>Exim utilities</title>
67469 <para>
67470 <indexterm role="concept" id="IIDutils" class="startofrange">
67471 <primary>utilities</primary>
67472 </indexterm>
67473 A number of utility scripts and programs are supplied with Exim and are
67474 described in this chapter. There is also the Exim Monitor, which is covered in
67475 the next chapter. The utilities described here are:
67476 </para>
67477 <informaltable frame="none">
67478 <tgroup cols="3" colsep="0" rowsep="0">
67479 <colspec colwidth="7*" align="left"/>
67480 <colspec colwidth="15*" align="left"/>
67481 <colspec colwidth="40*" align="left"/>
67482 <tbody>
67483 <row>
67484 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
67485 <entry><emphasis>exiwhat</emphasis></entry>
67486 <entry>list what Exim processes are doing</entry>
67487 </row>
67488 <row>
67489 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
67490 <entry><emphasis>exiqgrep</emphasis></entry>
67491 <entry>grep the queue</entry>
67492 </row>
67493 <row>
67494 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
67495 <entry><emphasis>exiqsumm</emphasis></entry>
67496 <entry>summarize the queue</entry>
67497 </row>
67498 <row>
67499 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
67500 <entry><emphasis>exigrep</emphasis></entry>
67501 <entry>search the main log</entry>
67502 </row>
67503 <row>
67504 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
67505 <entry><emphasis>exipick</emphasis></entry>
67506 <entry>select messages on various criteria</entry>
67507 </row>
67508 <row>
67509 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
67510 <entry><emphasis>exicyclog</emphasis></entry>
67511 <entry>cycle (rotate) log files</entry>
67512 </row>
67513 <row>
67514 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
67515 <entry><emphasis>eximstats</emphasis></entry>
67516 <entry>extract statistics from the log</entry>
67517 </row>
67518 <row>
67519 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
67520 <entry><emphasis>exim_checkaccess</emphasis></entry>
67521 <entry>check address acceptance from given IP</entry>
67522 </row>
67523 <row>
67524 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
67525 <entry><emphasis>exim_dbmbuild</emphasis></entry>
67526 <entry>build a DBM file</entry>
67527 </row>
67528 <row>
67529 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
67530 <entry><emphasis>exinext</emphasis></entry>
67531 <entry>extract retry information</entry>
67532 </row>
67533 <row>
67534 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
67535 <entry><emphasis>exim_dumpdb</emphasis></entry>
67536 <entry>dump a hints database</entry>
67537 </row>
67538 <row>
67539 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
67540 <entry><emphasis>exim_tidydb</emphasis></entry>
67541 <entry>clean up a hints database</entry>
67542 </row>
67543 <row>
67544 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
67545 <entry><emphasis>exim_fixdb</emphasis></entry>
67546 <entry>patch a hints database</entry>
67547 </row>
67548 <row>
67549 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
67550 <entry><emphasis>exim_lock</emphasis></entry>
67551 <entry>lock a mailbox file</entry>
67552 </row>
67553 </tbody>
67554 </tgroup>
67555 </informaltable>
67556 <para>
67557 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
67558 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
67559 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
67560 </para>
67561 <section id="SECTfinoutwha">
67562 <title>Finding out what Exim processes are doing (exiwhat)</title>
67563 <para>
67564 <indexterm role="concept">
67565 <primary><emphasis>exiwhat</emphasis></primary>
67566 </indexterm>
67567 <indexterm role="concept">
67568 <primary>process, querying</primary>
67569 </indexterm>
67570 <indexterm role="concept">
67571 <primary>SIGUSR1</primary>
67572 </indexterm>
67573 On operating systems that can restart a system call after receiving a signal
67574 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
67575 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
67576 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
67577 processes it can find, having first emptied the file. It then waits for one
67578 second to allow the Exim processes to react before displaying the results. In
67579 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
67580 send the signal to the Exim processes, so it is normally run as root.
67581 </para>
67582 <para>
67583 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
67584 use by system administrators. It is not sensible, for example, to set up a
67585 script that sends SIGUSR1 signals to Exim processes at short intervals.
67586 </para>
67587 <para>
67588 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
67589 varies in different operating systems. Not only are different options used,
67590 but the format of the output is different. For this reason, there are some
67591 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
67592 it doesn&#x2019;t seem to be working for you, check the following compile-time
67593 options:
67594 </para>
67595 <literallayout>
67596 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
67597 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
67598 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
67599 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
67600 </literallayout>
67601 <para>
67602 An example of typical output from <emphasis>exiwhat</emphasis> is
67603 </para>
67604 <literallayout class="monospaced">
67605 164 daemon: -q1h, listening on port 25
67606 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
67607 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
67608   [10.19.42.42] (editor@ref.example)
67609 10592 handling incoming call from [192.168.243.242]
67610 10628 accepting a local non-SMTP message
67611 </literallayout>
67612 <para>
67613 The first number in the output line is the process number. The third line has
67614 been split here, in order to fit it on the page.
67615 </para>
67616 </section>
67617 <section id="SECTgreptheque">
67618 <title>Selective queue listing (exiqgrep)</title>
67619 <para>
67620 <indexterm role="concept">
67621 <primary><emphasis>exiqgrep</emphasis></primary>
67622 </indexterm>
67623 <indexterm role="concept">
67624 <primary>queue</primary>
67625 <secondary>grepping</secondary>
67626 </indexterm>
67627 This utility is a Perl script contributed by Matt Hubbard. It runs
67628 </para>
67629 <literallayout class="monospaced">
67630 exim -bpu
67631 </literallayout>
67632 <para>
67633 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
67634 </para>
67635 <literallayout class="monospaced">
67636 exim -bp
67637 </literallayout>
67638 <para>
67639 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
67640 contain alternate exim configuration the queue management might be using.
67641 </para>
67642 <para>
67643 to obtain a queue listing, and then greps the output to select messages
67644 that match given criteria. The following selection options are available:
67645 </para>
67646 <variablelist>
67647 <varlistentry>
67648 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
67649 <listitem>
67650 <para>
67651 Match the sender address using a case-insensitive search. The field that is
67652 tested is enclosed in angle brackets, so you can test for bounce messages with
67653 </para>
67654 <literallayout class="monospaced">
67655 exiqgrep -f '^&lt;&gt;$'
67656 </literallayout>
67657 </listitem></varlistentry>
67658 <varlistentry>
67659 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
67660 <listitem>
67661 <para>
67662 Match a recipient address using a case-insensitive search. The field that is
67663 tested is not enclosed in angle brackets.
67664 </para>
67665 </listitem></varlistentry>
67666 <varlistentry>
67667 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
67668 <listitem>
67669 <para>
67670 Match against the size field.
67671 </para>
67672 </listitem></varlistentry>
67673 <varlistentry>
67674 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
67675 <listitem>
67676 <para>
67677 Match messages that are younger than the given time.
67678 </para>
67679 </listitem></varlistentry>
67680 <varlistentry>
67681 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
67682 <listitem>
67683 <para>
67684 Match messages that are older than the given time.
67685 </para>
67686 </listitem></varlistentry>
67687 <varlistentry>
67688 <term><emphasis role="bold">-z</emphasis></term>
67689 <listitem>
67690 <para>
67691 Match only frozen messages.
67692 </para>
67693 </listitem></varlistentry>
67694 <varlistentry>
67695 <term><emphasis role="bold">-x</emphasis></term>
67696 <listitem>
67697 <para>
67698 Match only non-frozen messages.
67699 </para>
67700 </listitem></varlistentry>
67701 </variablelist>
67702 <para>
67703 The following options control the format of the output:
67704 </para>
67705 <variablelist>
67706 <varlistentry>
67707 <term><emphasis role="bold">-c</emphasis></term>
67708 <listitem>
67709 <para>
67710 Display only the count of matching messages.
67711 </para>
67712 </listitem></varlistentry>
67713 <varlistentry>
67714 <term><emphasis role="bold">-l</emphasis></term>
67715 <listitem>
67716 <para>
67717 Long format &ndash; display the full message information as output by Exim. This is
67718 the default.
67719 </para>
67720 </listitem></varlistentry>
67721 <varlistentry>
67722 <term><emphasis role="bold">-i</emphasis></term>
67723 <listitem>
67724 <para>
67725 Display message ids only.
67726 </para>
67727 </listitem></varlistentry>
67728 <varlistentry>
67729 <term><emphasis role="bold">-b</emphasis></term>
67730 <listitem>
67731 <para>
67732 Brief format &ndash; one line per message.
67733 </para>
67734 </listitem></varlistentry>
67735 <varlistentry>
67736 <term><emphasis role="bold">-R</emphasis></term>
67737 <listitem>
67738 <para>
67739 Display messages in reverse order.
67740 </para>
67741 </listitem></varlistentry>
67742 <varlistentry>
67743 <term><emphasis role="bold">-a</emphasis></term>
67744 <listitem>
67745 <para>
67746 Include delivered recipients in queue listing.
67747 </para>
67748 </listitem></varlistentry>
67749 </variablelist>
67750 <para>
67751 There is one more option, <option>-h</option>, which outputs a list of options.
67752 </para>
67753 </section>
67754 <section id="SECTsumtheque">
67755 <title>Summarizing the queue (exiqsumm)</title>
67756 <para>
67757 <indexterm role="concept">
67758 <primary><emphasis>exiqsumm</emphasis></primary>
67759 </indexterm>
67760 <indexterm role="concept">
67761 <primary>queue</primary>
67762 <secondary>summary</secondary>
67763 </indexterm>
67764 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
67765 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
67766 running a command such as
67767 </para>
67768 <literallayout class="monospaced">
67769 exim -bp | exiqsumm
67770 </literallayout>
67771 <para>
67772 The output consists of one line for each domain that has messages waiting for
67773 it, as in the following example:
67774 </para>
67775 <literallayout class="monospaced">
67776 3   2322   74m   66m  msn.com.example
67777 </literallayout>
67778 <para>
67779 Each line lists the number of pending deliveries for a domain, their total
67780 volume, and the length of time that the oldest and the newest messages have
67781 been waiting. Note that the number of pending deliveries is greater than the
67782 number of messages when messages have more than one recipient.
67783 </para>
67784 <para>
67785 A summary line is output at the end. By default the output is sorted on the
67786 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
67787 the output to be sorted by oldest message and by count of messages,
67788 respectively. There are also three options that split the messages for each
67789 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
67790 separates frozen messages, and <option>-s</option> separates messages according to their
67791 sender.
67792 </para>
67793 <para>
67794 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
67795 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
67796 generated by aliasing or forwarding are included (unless the <option>one_time</option>
67797 option of the <command>redirect</command> router has been used to convert them into <quote>top
67798 level</quote> addresses).
67799 </para>
67800 </section>
67801 <section id="SECTextspeinf">
67802 <title>Extracting specific information from the log (exigrep)</title>
67803 <para>
67804 <indexterm role="concept">
67805 <primary><emphasis>exigrep</emphasis></primary>
67806 </indexterm>
67807 <indexterm role="concept">
67808 <primary>log</primary>
67809 <secondary>extracts; grepping for</secondary>
67810 </indexterm>
67811 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
67812 files for entries that match a given pattern. When it finds a match, it
67813 extracts all the log entries for the relevant message, not just those that
67814 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
67815 given message, or all mail for a given user, or for a given host, for example.
67816 The input files can be in Exim log format or syslog format.
67817 If a matching log line is not associated with a specific message, it is
67818 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
67819 </para>
67820 <literallayout>
67821 <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>
67822 </literallayout>
67823 <para>
67824 If no log file names are given on the command line, the standard input is read.
67825 </para>
67826 <para>
67827 The <option>-t</option> argument specifies a number of seconds. It adds an additional
67828 condition for message selection. Messages that are complete are shown only if
67829 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
67830 </para>
67831 <para>
67832 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
67833 makes it case-sensitive. This may give a performance improvement when searching
67834 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
67835 option; with <option>-I</option> they do not. In both cases it is possible to change the
67836 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
67837 </para>
67838 <para>
67839 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
67840 pattern as standing for themselves. Otherwise the pattern must be a Perl
67841 regular expression.
67842 </para>
67843 <para>
67844 The <option>-v</option> option inverts the matching condition. That is, a line is selected
67845 if it does <emphasis>not</emphasis> match the pattern.
67846 </para>
67847 <para>
67848 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
67849 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
67850 normally.
67851 </para>
67852 <para>
67853 Example of <option>-M</option>:
67854 user_a sends a message to user_b, which generates a bounce back to user_b. If
67855 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
67856 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
67857 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
67858 when searching for <quote>user_a</quote> will show both messages since the bounce is
67859 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
67860 search term.
67861 </para>
67862 <para>
67863 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
67864 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
67865 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
67866 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
67867 autodetection of some well known compression extensions.
67868 </para>
67869 </section>
67870 <section id="SECTexipick">
67871 <title>Selecting messages by various criteria (exipick)</title>
67872 <para>
67873 <indexterm role="concept">
67874 <primary><emphasis>exipick</emphasis></primary>
67875 </indexterm>
67876 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
67877 lists messages from the queue according to a variety of criteria. For details
67878 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
67879 the <option>--help</option> option.
67880 </para>
67881 </section>
67882 <section id="SECTcyclogfil">
67883 <title>Cycling log files (exicyclog)</title>
67884 <para>
67885 <indexterm role="concept">
67886 <primary>log</primary>
67887 <secondary>cycling local files</secondary>
67888 </indexterm>
67889 <indexterm role="concept">
67890 <primary>cycling logs</primary>
67891 </indexterm>
67892 <indexterm role="concept">
67893 <primary><emphasis>exicyclog</emphasis></primary>
67894 </indexterm>
67895 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
67896 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
67897 you are using log files with datestamps in their names (see section
67898 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
67899 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
67900 There are two command line options for <emphasis>exicyclog</emphasis>:
67901 </para>
67902 <itemizedlist>
67903 <listitem>
67904 <para>
67905 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
67906 default that is set when Exim is built. The default default is 10.
67907 </para>
67908 </listitem>
67909 <listitem>
67910 <para>
67911 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
67912 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
67913 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
67914 configuration.
67915 </para>
67916 </listitem>
67917 </itemizedlist>
67918 <para>
67919 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
67920 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
67921 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
67922 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
67923 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
67924 logs are handled similarly.
67925 </para>
67926 <para>
67927 If the limit is greater than 99, the script uses 3-digit numbers such as
67928 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
67929 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
67930 any existing log files.
67931 </para>
67932 <para>
67933 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
67934 the end are deleted. All files with numbers greater than 01 are compressed,
67935 using a compression command which is configured by the COMPRESS_COMMAND
67936 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
67937 root <option>crontab</option> entry of the form
67938 </para>
67939 <literallayout class="monospaced">
67940 1 0 * * * su exim -c /usr/exim/bin/exicyclog
67941 </literallayout>
67942 <para>
67943 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
67944 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
67945 </para>
67946 </section>
67947 <section id="SECTmailstat">
67948 <title>Mail statistics (eximstats)</title>
67949 <para>
67950 <indexterm role="concept">
67951 <primary>statistics</primary>
67952 </indexterm>
67953 <indexterm role="concept">
67954 <primary><emphasis>eximstats</emphasis></primary>
67955 </indexterm>
67956 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
67957 information from log files. The output is either plain text, or HTML.
67958 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
67959 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
67960 </para>
67961 <para>
67962 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
67963 latest version is the result of some extensive revision by Steve Campbell. A
67964 lot of information is given by default, but there are options for suppressing
67965 various parts of it. Following any options, the arguments to the script are a
67966 list of files, which should be main log files. For example:
67967 </para>
67968 <literallayout class="monospaced">
67969 eximstats -nr /var/spool/exim/log/mainlog.01
67970 </literallayout>
67971 <para>
67972 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
67973 messages received from or delivered to various hosts. The information is sorted
67974 both by message count and by volume, and the top fifty hosts in each category
67975 are listed on the standard output. Similar information, based on email
67976 addresses or domains instead of hosts can be requested by means of various
67977 options. For messages delivered and received locally, similar statistics are
67978 also produced per user.
67979 </para>
67980 <para>
67981 The output also includes total counts and statistics about delivery errors, and
67982 histograms showing the number of messages received and deliveries made in each
67983 hour of the day. A delivery with more than one address in its envelope (for
67984 example, an SMTP transaction with more than one RCPT command) is counted
67985 as a single delivery by <emphasis>eximstats</emphasis>.
67986 </para>
67987 <para>
67988 Though normally more deliveries than receipts are reported (as messages may
67989 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
67990 messages received than delivered, even though the queue is empty at the start
67991 and end of the period in question. If an incoming message contains no valid
67992 recipients, no deliveries are recorded for it. A bounce message is handled as
67993 an entirely separate message.
67994 </para>
67995 <para>
67996 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
67997 of messages received and deliveries made, and the number of hosts involved in
67998 each case. It also outputs the number of messages that were delayed (that is,
67999 not completely delivered at the first attempt), and the number that had at
68000 least one address that failed.
68001 </para>
68002 <para>
68003 The remainder of the output is in sections that can be independently disabled
68004 or modified by various options. It consists of a summary of deliveries by
68005 transport, histograms of messages received and delivered per time interval
68006 (default per hour), information about the time messages spent on the queue,
68007 a list of relayed messages, lists of the top fifty sending hosts, local
68008 senders, destination hosts, and destination local users by count and by volume,
68009 and a list of delivery errors that occurred.
68010 </para>
68011 <para>
68012 The relay information lists messages that were actually relayed, that is, they
68013 came from a remote host and were directly delivered to some other remote host,
68014 without being processed (for example, for aliasing or forwarding) locally.
68015 </para>
68016 <para>
68017 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
68018 outputs. These are documented in the Perl script itself, and can be extracted
68019 by running the command <command>perldoc</command> on the script. For example:
68020 </para>
68021 <literallayout class="monospaced">
68022 perldoc /usr/exim/bin/eximstats
68023 </literallayout>
68024 </section>
68025 <section id="SECTcheckaccess">
68026 <title>Checking access policy (exim_checkaccess)</title>
68027 <para>
68028 <indexterm role="concept">
68029 <primary><emphasis>exim_checkaccess</emphasis></primary>
68030 </indexterm>
68031 <indexterm role="concept">
68032 <primary>policy control</primary>
68033 <secondary>checking access</secondary>
68034 </indexterm>
68035 <indexterm role="concept">
68036 <primary>checking access</primary>
68037 </indexterm>
68038 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
68039 debugging output, in order to check what Exim is doing when it is applying
68040 policy controls to incoming SMTP mail. However, not everybody is sufficiently
68041 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
68042 sometimes you just want to answer the question <quote>Does this address have
68043 access?</quote> without bothering with any further details.
68044 </para>
68045 <para>
68046 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
68047 two arguments, an IP address and an email address:
68048 </para>
68049 <literallayout class="monospaced">
68050 exim_checkaccess 10.9.8.7 A.User@a.domain.example
68051 </literallayout>
68052 <para>
68053 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
68054 given email address would be accepted in a RCPT command in a TCP/IP
68055 connection from the host with the given IP address. The output of the utility
68056 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
68057 </para>
68058 <literallayout class="monospaced">
68059 Rejected:
68060 550 Relay not permitted
68061 </literallayout>
68062 <para>
68063 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
68064 for the MAIL command, but you can change this by providing additional
68065 options. These are passed directly to the Exim command. For example, to specify
68066 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
68067 you can use:
68068 </para>
68069 <literallayout class="monospaced">
68070 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
68071                  -f himself@there.example
68072 </literallayout>
68073 <para>
68074 Note that these additional Exim command line items must be given after the two
68075 mandatory arguments.
68076 </para>
68077 <para>
68078 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
68079 while running its checks. You can run checks that include callouts by using
68080 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
68081 </para>
68082 </section>
68083 <section id="SECTdbmbuild">
68084 <title>Making DBM files (exim_dbmbuild)</title>
68085 <para>
68086 <indexterm role="concept">
68087 <primary>DBM</primary>
68088 <secondary>building dbm files</secondary>
68089 </indexterm>
68090 <indexterm role="concept">
68091 <primary>building DBM files</primary>
68092 </indexterm>
68093 <indexterm role="concept">
68094 <primary><emphasis>exim_dbmbuild</emphasis></primary>
68095 </indexterm>
68096 <indexterm role="concept">
68097 <primary>lower casing</primary>
68098 </indexterm>
68099 <indexterm role="concept">
68100 <primary>binary zero</primary>
68101 <secondary>in lookup key</secondary>
68102 </indexterm>
68103 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
68104 the format used by the <command>lsearch</command> lookup (see section
68105 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
68106 names as keys and the remainder of the information as data. The lower-casing
68107 can be prevented by calling the program with the <option>-nolc</option> option.
68108 </para>
68109 <para>
68110 A terminating zero is included as part of the key string. This is expected by
68111 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
68112 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
68113 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
68114 files.
68115 </para>
68116 <para>
68117 The program requires two arguments: the name of the input file (which can be a
68118 single hyphen to indicate the standard input), and the name of the output file.
68119 It creates the output under a temporary name, and then renames it if all went
68120 well.
68121 </para>
68122 <para>
68123 <indexterm role="concept">
68124 <primary>USE_DB</primary>
68125 </indexterm>
68126 If the native DB interface is in use (USE_DB is set in a compile-time
68127 configuration file &ndash; this is common in free versions of Unix) the two file
68128 names must be different, because in this mode the Berkeley DB functions create
68129 a single output file using exactly the name given. For example,
68130 </para>
68131 <literallayout class="monospaced">
68132 exim_dbmbuild /etc/aliases /etc/aliases.db
68133 </literallayout>
68134 <para>
68135 reads the system alias file and creates a DBM version of it in
68136 <filename>/etc/aliases.db</filename>.
68137 </para>
68138 <para>
68139 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
68140 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
68141 environment, the suffixes are added to the second argument of
68142 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
68143 when the Berkeley functions are used in compatibility mode (though this is not
68144 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
68145 </para>
68146 <para>
68147 If a duplicate key is encountered, the program outputs a warning, and when it
68148 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
68149 option is used. By default, only the first of a set of duplicates is used &ndash;
68150 this makes it compatible with <command>lsearch</command> lookups. There is an option
68151 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
68152 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
68153 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
68154 return code is 2.
68155 </para>
68156 </section>
68157 <section id="SECTfinindret">
68158 <title>Finding individual retry times (exinext)</title>
68159 <para>
68160 <indexterm role="concept">
68161 <primary>retry</primary>
68162 <secondary>times</secondary>
68163 </indexterm>
68164 <indexterm role="concept">
68165 <primary><emphasis>exinext</emphasis></primary>
68166 </indexterm>
68167 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
68168 fish specific information out of the retry database. Given a mail domain (or a
68169 complete address), it looks up the hosts for that domain, and outputs any retry
68170 information for the hosts or for the domain. At present, the retry information
68171 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
68172 output. For example:
68173 </para>
68174 <literallayout class="monospaced">
68175 $ exinext piglet@milne.fict.example
68176 kanga.milne.example:192.168.8.1 error 146: Connection refused
68177   first failed: 21-Feb-1996 14:57:34
68178   last tried:   21-Feb-1996 14:57:34
68179   next try at:  21-Feb-1996 15:02:34
68180 roo.milne.example:192.168.8.3 error 146: Connection refused
68181   first failed: 20-Jan-1996 13:12:08
68182   last tried:   21-Feb-1996 11:42:03
68183   next try at:  21-Feb-1996 19:42:03
68184   past final cutoff time
68185 </literallayout>
68186 <para>
68187 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
68188 will give any retry information for that local part in your default domain.
68189 A message id can be used to obtain retry information pertaining to a specific
68190 message. This exists only when an attempt to deliver a message to a remote host
68191 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
68192 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
68193 run very often.
68194 </para>
68195 <para>
68196 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
68197 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
68198 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
68199 configuration file, and the second sets macros for use within the configuration
68200 file. These features are mainly to help in testing, but might also be useful in
68201 environments where more than one configuration file is in use.
68202 </para>
68203 </section>
68204 <section id="SECThindatmai">
68205 <title>Hints database maintenance</title>
68206 <para>
68207 <indexterm role="concept">
68208 <primary>hints database</primary>
68209 <secondary>maintenance</secondary>
68210 </indexterm>
68211 <indexterm role="concept">
68212 <primary>maintaining Exim&#x2019;s hints database</primary>
68213 </indexterm>
68214 Three utility programs are provided for maintaining the DBM files that Exim
68215 uses to contain its delivery hint information. Each program requires two
68216 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
68217 second is the name of the database it is to operate on. These are as follows:
68218 </para>
68219 <itemizedlist>
68220 <listitem>
68221 <para>
68222 <emphasis>retry</emphasis>: the database of retry information
68223 </para>
68224 </listitem>
68225 <listitem>
68226 <para>
68227 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
68228 for remote hosts
68229 </para>
68230 </listitem>
68231 <listitem>
68232 <para>
68233 <emphasis>callout</emphasis>: the callout cache
68234 </para>
68235 </listitem>
68236 <listitem>
68237 <para>
68238 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
68239 </para>
68240 </listitem>
68241 <listitem>
68242 <para>
68243 <emphasis>misc</emphasis>: other hints data
68244 </para>
68245 </listitem>
68246 </itemizedlist>
68247 <para>
68248 The <emphasis>misc</emphasis> database is used for
68249 </para>
68250 <itemizedlist>
68251 <listitem>
68252 <para>
68253 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
68254 </para>
68255 </listitem>
68256 <listitem>
68257 <para>
68258 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
68259 <command>smtp</command> transport)
68260 </para>
68261 </listitem>
68262 <listitem>
68263 <para>
68264 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
68265 in a transport)
68266 </para>
68267 </listitem>
68268 </itemizedlist>
68269 </section>
68270 <section id="SECID261">
68271 <title>exim_dumpdb</title>
68272 <para>
68273 <indexterm role="concept">
68274 <primary><emphasis>exim_dumpdb</emphasis></primary>
68275 </indexterm>
68276 The entire contents of a database are written to the standard output by the
68277 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
68278 spool and database names. For example, to dump the retry database:
68279 </para>
68280 <literallayout class="monospaced">
68281 exim_dumpdb /var/spool/exim retry
68282 </literallayout>
68283 <para>
68284 Two lines of output are produced for each entry:
68285 </para>
68286 <literallayout class="monospaced">
68287 T:mail.ref.example:192.168.242.242 146 77 Connection refused
68288 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
68289 </literallayout>
68290 <para>
68291 The first item on the first line is the key of the record. It starts with one
68292 of the letters R, or T, depending on whether it refers to a routing or
68293 transport retry. For a local delivery, the next part is the local address; for
68294 a remote delivery it is the name of the remote host, followed by its failing IP
68295 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
68296 transport). If the remote port is not the standard one (port 25), it is added
68297 to the IP address. Then there follows an error code, an additional error code,
68298 and a textual description of the error.
68299 </para>
68300 <para>
68301 The three times on the second line are the time of first failure, the time of
68302 the last delivery attempt, and the computed time for the next attempt. The line
68303 ends with an asterisk if the cutoff time for the last retry rule has been
68304 exceeded.
68305 </para>
68306 <para>
68307 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
68308 consists of a host name followed by a list of ids for messages that are or were
68309 waiting to be delivered to that host. If there are a very large number for any
68310 one host, continuation records, with a sequence number added to the host name,
68311 may be seen. The data in these records is often out of date, because a message
68312 may be routed to several alternative hosts, and Exim makes no effort to keep
68313 cross-references.
68314 </para>
68315 </section>
68316 <section id="SECID262">
68317 <title>exim_tidydb</title>
68318 <para>
68319 <indexterm role="concept">
68320 <primary><emphasis>exim_tidydb</emphasis></primary>
68321 </indexterm>
68322 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
68323 database. If run with no options, it removes all records that are more than 30
68324 days old. The age is calculated from the date and time that the record was last
68325 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
68326 since the first delivery failure. Information about a host that has been down
68327 for more than 30 days will remain in the database, provided that the record is
68328 updated sufficiently often.
68329 </para>
68330 <para>
68331 The cutoff date can be altered by means of the <option>-t</option> option, which must be
68332 followed by a time. For example, to remove all records older than a week from
68333 the retry database:
68334 </para>
68335 <literallayout class="monospaced">
68336 exim_tidydb -t 7d /var/spool/exim retry
68337 </literallayout>
68338 <para>
68339 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
68340 message ids. In the former these appear as data in records keyed by host &ndash;
68341 they were messages that were waiting for that host &ndash; and in the latter they
68342 are the keys for retry information for messages that have suffered certain
68343 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
68344 message ids in database records are those of messages that are still on the
68345 queue. Message ids for messages that no longer exist are removed from
68346 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
68347 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
68348 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
68349 whenever it removes information from the database.
68350 </para>
68351 <para>
68352 Certain records are automatically removed by Exim when they are no longer
68353 needed, but others are not. For example, if all the MX hosts for a domain are
68354 down, a retry record is created for each one. If the primary MX host comes back
68355 first, its record is removed when Exim successfully delivers to it, but the
68356 records for the others remain because Exim has not tried to use those hosts.
68357 </para>
68358 <para>
68359 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
68360 hints databases. You should do this at a quiet time of day, because it requires
68361 a database to be locked (and therefore inaccessible to Exim) while it does its
68362 work. Removing records from a DBM file does not normally make the file smaller,
68363 but all the common DBM libraries are able to re-use the space that is released.
68364 After an initial phase of increasing in size, the databases normally reach a
68365 point at which they no longer get any bigger, as long as they are regularly
68366 tidied.
68367 </para>
68368 <para>
68369 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
68370 databases is likely to keep on increasing.
68371 </para>
68372 </section>
68373 <section id="SECID263">
68374 <title>exim_fixdb</title>
68375 <para>
68376 <indexterm role="concept">
68377 <primary><emphasis>exim_fixdb</emphasis></primary>
68378 </indexterm>
68379 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
68380 Its main use is for testing Exim, but it might also be occasionally useful for
68381 getting round problems in a live system. It has no options, and its interface
68382 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
68383 key of a database record can then be entered, and the data for that record is
68384 displayed.
68385 </para>
68386 <para>
68387 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
68388 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
68389 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
68390 data for individual fields can be changed by typing the field number followed
68391 by new data, for example:
68392 </para>
68393 <literallayout class="monospaced">
68394 &gt; 4 951102:1000
68395 </literallayout>
68396 <para>
68397 resets the time of the next delivery attempt. Time values are given as a
68398 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
68399 used as optional separators.
68400 </para>
68401 </section>
68402 <section id="SECTmailboxmaint">
68403 <title>Mailbox maintenance (exim_lock)</title>
68404 <para>
68405 <indexterm role="concept">
68406 <primary>mailbox</primary>
68407 <secondary>maintenance</secondary>
68408 </indexterm>
68409 <indexterm role="concept">
68410 <primary><emphasis>exim_lock</emphasis></primary>
68411 </indexterm>
68412 <indexterm role="concept">
68413 <primary>locking mailboxes</primary>
68414 </indexterm>
68415 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
68416 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
68417 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
68418 a user agent while investigating a problem. The utility requires the name of
68419 the file as its first argument. If the locking is successful, the second
68420 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
68421 second argument, the value of the SHELL environment variable is used; if this
68422 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
68423 is unlocked and the utility ends. The following options are available:
68424 </para>
68425 <variablelist>
68426 <varlistentry>
68427 <term><option>-fcntl</option></term>
68428 <listitem>
68429 <para>
68430 Use <function>fcntl()</function> locking on the open mailbox.
68431 </para>
68432 </listitem></varlistentry>
68433 <varlistentry>
68434 <term><option>-flock</option></term>
68435 <listitem>
68436 <para>
68437 Use <function>flock()</function> locking on the open mailbox, provided the operating system
68438 supports it.
68439 </para>
68440 </listitem></varlistentry>
68441 <varlistentry>
68442 <term><option>-interval</option></term>
68443 <listitem>
68444 <para>
68445 This must be followed by a number, which is a number of seconds; it sets the
68446 interval to sleep between retries (default 3).
68447 </para>
68448 </listitem></varlistentry>
68449 <varlistentry>
68450 <term><option>-lockfile</option></term>
68451 <listitem>
68452 <para>
68453 Create a lock file before opening the mailbox.
68454 </para>
68455 </listitem></varlistentry>
68456 <varlistentry>
68457 <term><option>-mbx</option></term>
68458 <listitem>
68459 <para>
68460 Lock the mailbox using MBX rules.
68461 </para>
68462 </listitem></varlistentry>
68463 <varlistentry>
68464 <term><option>-q</option></term>
68465 <listitem>
68466 <para>
68467 Suppress verification output.
68468 </para>
68469 </listitem></varlistentry>
68470 <varlistentry>
68471 <term><option>-retries</option></term>
68472 <listitem>
68473 <para>
68474 This must be followed by a number; it sets the number of times to try to get
68475 the lock (default 10).
68476 </para>
68477 </listitem></varlistentry>
68478 <varlistentry>
68479 <term><option>-restore_time</option></term>
68480 <listitem>
68481 <para>
68482 This option causes <option>exim_lock</option> to restore the modified and read times to the
68483 locked file before exiting. This allows you to access a locked mailbox (for
68484 example, to take a backup copy) without disturbing the times that the user
68485 subsequently sees.
68486 </para>
68487 </listitem></varlistentry>
68488 <varlistentry>
68489 <term><option>-timeout</option></term>
68490 <listitem>
68491 <para>
68492 This must be followed by a number, which is a number of seconds; it sets a
68493 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
68494 default), a non-blocking call is used.
68495 </para>
68496 </listitem></varlistentry>
68497 <varlistentry>
68498 <term><option>-v</option></term>
68499 <listitem>
68500 <para>
68501 Generate verbose output.
68502 </para>
68503 </listitem></varlistentry>
68504 </variablelist>
68505 <para>
68506 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
68507 default is to create a lock file and also to use <function>fcntl()</function> locking on the
68508 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
68509 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
68510 requires that the directory containing the file be writeable. Locking by lock
68511 file does not last for ever; Exim assumes that a lock file is expired if it is
68512 more than 30 minutes old.
68513 </para>
68514 <para>
68515 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
68516 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
68517 to be taken out on the open mailbox, and an exclusive lock on the file
68518 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
68519 number of the mailbox file. When the locking is released, if an exclusive lock
68520 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
68521 </para>
68522 <para>
68523 The default output contains verification of the locking that takes place. The
68524 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
68525 suppresses all output except error messages.
68526 </para>
68527 <para>
68528 A command such as
68529 </para>
68530 <literallayout class="monospaced">
68531 exim_lock /var/spool/mail/spqr
68532 </literallayout>
68533 <para>
68534 runs an interactive shell while the file is locked, whereas
68535 </para>
68536 <literallayout>
68537 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
68538 &lt;<emphasis>some commands</emphasis>&gt;
68539 <literal>End</literal>
68540 </literallayout>
68541 <para>
68542 runs a specific non-interactive sequence of commands while the file is locked,
68543 suppressing all verification output. A single command can be run by a command
68544 such as
68545 </para>
68546 <literallayout class="monospaced">
68547 exim_lock -q /var/spool/mail/spqr \
68548   "cp /var/spool/mail/spqr /some/where"
68549 </literallayout>
68550 <para>
68551 Note that if a command is supplied, it must be entirely contained within the
68552 second argument &ndash; hence the quotes.
68553 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
68554 </para>
68555 </section>
68556 </chapter>
68557
68558 <chapter id="CHAPeximon">
68559 <title>The Exim monitor</title>
68560 <para>
68561 <indexterm role="concept" id="IIDeximon" class="startofrange">
68562 <primary>Exim monitor</primary>
68563 <secondary>description</secondary>
68564 </indexterm>
68565 <indexterm role="concept">
68566 <primary>X-windows</primary>
68567 </indexterm>
68568 <indexterm role="concept">
68569 <primary><emphasis>eximon</emphasis></primary>
68570 </indexterm>
68571 <indexterm role="concept">
68572 <primary>Local/eximon.conf</primary>
68573 </indexterm>
68574 <indexterm role="concept">
68575 <primary><filename>exim_monitor/EDITME</filename></primary>
68576 </indexterm>
68577 The Exim monitor is an application which displays in an X window information
68578 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
68579 perform certain operations on messages from this GUI interface; however all
68580 such facilities are also available from the command line, and indeed, the
68581 monitor itself makes use of the command line to perform any actions requested.
68582 </para>
68583 <section id="SECID264">
68584 <title>Running the monitor</title>
68585 <para>
68586 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
68587 script that sets up a number of environment variables, and then runs the
68588 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
68589 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
68590 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
68591 parameters are for.
68592 </para>
68593 <para>
68594 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
68595 a particular invocation by setting up environment variables of the same names,
68596 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
68597 </para>
68598 <literallayout class="monospaced">
68599 EXIMON_LOG_DEPTH=400 eximon
68600 </literallayout>
68601 <para>
68602 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
68603 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
68604 overrides the Exim log file configuration. This makes it possible to have
68605 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
68606 syslog messages are routed to a file on the local host.
68607 </para>
68608 <para>
68609 X resources can be used to change the appearance of the window in the normal
68610 way. For example, a resource setting of the form
68611 </para>
68612 <literallayout class="monospaced">
68613 Eximon*background: gray94
68614 </literallayout>
68615 <para>
68616 changes the colour of the background to light grey rather than white. The
68617 stripcharts are drawn with both the data lines and the reference lines in
68618 black. This means that the reference lines are not visible when on top of the
68619 data. However, their colour can be changed by setting a resource called
68620 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
68621 For example, if your X server is running Unix, you could set up lighter
68622 reference lines in the stripcharts by obeying
68623 </para>
68624 <literallayout class="monospaced">
68625 xrdb -merge &lt;&lt;End
68626 Eximon*highlight: gray
68627 End
68628 </literallayout>
68629 <para>
68630 <indexterm role="concept">
68631 <primary>admin user</primary>
68632 </indexterm>
68633 In order to see the contents of messages on the queue, and to operate on them,
68634 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
68635 </para>
68636 <para>
68637 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
68638 contain X11 resource parameters interpreted by the X11 library.  In addition,
68639 if the first parameter starts with the string "gdb" then it is removed and the
68640 binary is invoked under gdb (the parameter is used as the gdb command-name, so
68641 versioned variants of gdb can be invoked).
68642 </para>
68643 <para>
68644 The monitor&#x2019;s window is divided into three parts. The first contains one or
68645 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
68646 main log file, and the third is a display of the queue of messages awaiting
68647 delivery, with two more action buttons. The following sections describe these
68648 different parts of the display.
68649 </para>
68650 </section>
68651 <section id="SECID265">
68652 <title>The stripcharts</title>
68653 <para>
68654 <indexterm role="concept">
68655 <primary>stripchart</primary>
68656 </indexterm>
68657 The first stripchart is always a count of messages on the queue. Its name can
68658 be configured by setting QUEUE_STRIPCHART_NAME in the
68659 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
68660 configuration script by regular expression matches on log file entries, making
68661 it possible to display, for example, counts of messages delivered to certain
68662 hosts or using certain transports. The supplied defaults display counts of
68663 received and delivered messages, and of local and SMTP deliveries. The default
68664 period between stripchart updates is one minute; this can be adjusted by a
68665 parameter in the <filename>Local/eximon.conf</filename> file.
68666 </para>
68667 <para>
68668 The stripchart displays rescale themselves automatically as the value they are
68669 displaying changes. There are always 10 horizontal lines in each chart; the
68670 title string indicates the value of each division when it is greater than one.
68671 For example, <quote>x2</quote> means that each division represents a value of 2.
68672 </para>
68673 <para>
68674 It is also possible to have a stripchart which shows the percentage fullness of
68675 a particular disk partition, which is useful when local deliveries are confined
68676 to a single partition.
68677 </para>
68678 <para>
68679 <indexterm role="concept">
68680 <primary><option>statvfs</option> function</primary>
68681 </indexterm>
68682 This relies on the availability of the <function>statvfs()</function> function or equivalent in
68683 the operating system. Most, but not all versions of Unix that support Exim have
68684 this. For this particular stripchart, the top of the chart always represents
68685 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
68686 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
68687 <filename>Local/eximon.conf</filename> file.
68688 </para>
68689 </section>
68690 <section id="SECID266">
68691 <title>Main action buttons</title>
68692 <para>
68693 <indexterm role="concept">
68694 <primary>size</primary>
68695 <secondary>of monitor window</secondary>
68696 </indexterm>
68697 <indexterm role="concept">
68698 <primary>Exim monitor</primary>
68699 <secondary>window size</secondary>
68700 </indexterm>
68701 <indexterm role="concept">
68702 <primary>window size</primary>
68703 </indexterm>
68704 Below the stripcharts there is an action button for quitting the monitor. Next
68705 to this is another button marked <quote>Size</quote>. They are placed here so that
68706 shrinking the window to its default minimum size leaves just the queue count
68707 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
68708 the window to expand to its maximum size, unless it is already at the maximum,
68709 in which case it is reduced to its minimum.
68710 </para>
68711 <para>
68712 When expanding to the maximum, if the window cannot be fully seen where it
68713 currently is, it is moved back to where it was the last time it was at full
68714 size. When it is expanding from its minimum size, the old position is
68715 remembered, and next time it is reduced to the minimum it is moved back there.
68716 </para>
68717 <para>
68718 The idea is that you can keep a reduced window just showing one or two
68719 stripcharts at a convenient place on your screen, easily expand it to show
68720 the full window when required, and just as easily put it back to what it was.
68721 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
68722 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
68723 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
68724 </para>
68725 <para>
68726 Normally, the monitor starts up with the window at its full size, but it can be
68727 built so that it starts up with the window at its smallest size, by setting
68728 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
68729 </para>
68730 </section>
68731 <section id="SECID267">
68732 <title>The log display</title>
68733 <para>
68734 <indexterm role="concept">
68735 <primary>log</primary>
68736 <secondary>tail of; in monitor</secondary>
68737 </indexterm>
68738 The second section of the window is an area in which a display of the tail of
68739 the main log is maintained.
68740 To save space on the screen, the timestamp on each log line is shortened by
68741 removing the date and, if <option>log_timezone</option> is set, the timezone.
68742 The log tail is not available when the only destination for logging data is
68743 syslog, unless the syslog lines are routed to a local file whose name is passed
68744 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
68745 </para>
68746 <para>
68747 The log sub-window has a scroll bar at its lefthand side which can be used to
68748 move back to look at earlier text, and the up and down arrow keys also have a
68749 scrolling effect. The amount of log that is kept depends on the setting of
68750 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
68751 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
68752 much more efficient than throwing it away line by line. The sub-window also has
68753 a horizontal scroll bar for accessing the ends of long log lines. This is the
68754 only means of horizontal scrolling; the right and left arrow keys are not
68755 available. Text can be cut from this part of the window using the mouse in the
68756 normal way. The size of this subwindow is controlled by parameters in the
68757 configuration file <filename>Local/eximon.conf</filename>.
68758 </para>
68759 <para>
68760 Searches of the text in the log window can be carried out by means of the ^R
68761 and ^S keystrokes, which default to a reverse and a forward search,
68762 respectively. The search covers only the text that is displayed in the window.
68763 It cannot go further back up the log.
68764 </para>
68765 <para>
68766 The point from which the search starts is indicated by a caret marker. This is
68767 normally at the end of the text in the window, but can be positioned explicitly
68768 by pointing and clicking with the left mouse button, and is moved automatically
68769 by a successful search. If new text arrives in the window when it is scrolled
68770 back, the caret remains where it is, but if the window is not scrolled back,
68771 the caret is moved to the end of the new text.
68772 </para>
68773 <para>
68774 Pressing ^R or ^S pops up a window into which the search text can be typed.
68775 There are buttons for selecting forward or reverse searching, for carrying out
68776 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
68777 happens and the window remains so that further searches can be done. If the
68778 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
68779 ^C is typed the search is cancelled.
68780 </para>
68781 <para>
68782 The searching facility is implemented using the facilities of the Athena text
68783 widget. By default this pops up a window containing both <quote>search</quote> and
68784 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
68785 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
68786 However, the linkers in BSDI and HP-UX seem unable to handle an externally
68787 provided version of <option>TextPop</option> when the remaining parts of the text widget
68788 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
68789 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
68790 on these systems, at the expense of having unwanted items in the search popup
68791 window.
68792 </para>
68793 </section>
68794 <section id="SECID268">
68795 <title>The queue display</title>
68796 <para>
68797 <indexterm role="concept">
68798 <primary>queue</primary>
68799 <secondary>display in monitor</secondary>
68800 </indexterm>
68801 The bottom section of the monitor window contains a list of all messages that
68802 are on the queue, which includes those currently being received or delivered,
68803 as well as those awaiting delivery. The size of this subwindow is controlled by
68804 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
68805 at which it is updated is controlled by another parameter in the same file &ndash;
68806 the default is 5 minutes, since queue scans can be quite expensive. However,
68807 there is an <quote>Update</quote> action button just above the display which can be used
68808 to force an update of the queue display at any time.
68809 </para>
68810 <para>
68811 When a host is down for some time, a lot of pending mail can build up for it,
68812 and this can make it hard to deal with other messages on the queue. To help
68813 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
68814 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
68815 type anything in here and press <quote>Return</quote>, the text is added to a chain of
68816 such texts, and if every undelivered address in a message matches at least one
68817 of the texts, the message is not displayed.
68818 </para>
68819 <para>
68820 If there is an address that does not match any of the texts, all the addresses
68821 are displayed as normal. The matching happens on the ends of addresses so, for
68822 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
68823 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
68824 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
68825 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
68826 a hide request is automatically cancelled after one hour.
68827 </para>
68828 <para>
68829 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
68830 else to the monitor window. For this reason, if you want to cut text from the
68831 queue display to use in the dialogue box, you have to do the cutting before
68832 pressing the <quote>Hide</quote> button.
68833 </para>
68834 <para>
68835 The queue display contains, for each unhidden queued message, the length of
68836 time it has been on the queue, the size of the message, the message id, the
68837 message sender, and the first undelivered recipient, all on one line. If it is
68838 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
68839 recipient to which the message has not yet been delivered, subsequent ones are
68840 listed on additional lines, up to a maximum configured number, following which
68841 an ellipsis is displayed. Recipients that have already received the message are
68842 not shown.
68843 </para>
68844 <para>
68845 <indexterm role="concept">
68846 <primary>frozen messages</primary>
68847 <secondary>display</secondary>
68848 </indexterm>
68849 If a message is frozen, an asterisk is displayed at the left-hand side.
68850 </para>
68851 <para>
68852 The queue display has a vertical scroll bar, and can also be scrolled by means
68853 of the arrow keys. Text can be cut from it using the mouse in the normal way.
68854 The text searching facilities, as described above for the log window, are also
68855 available, but the caret is always moved to the end of the text when the queue
68856 display is updated.
68857 </para>
68858 </section>
68859 <section id="SECID269">
68860 <title>The queue menu</title>
68861 <para>
68862 <indexterm role="concept">
68863 <primary>queue</primary>
68864 <secondary>menu in monitor</secondary>
68865 </indexterm>
68866 If the <option>shift</option> key is held down and the left button is clicked when the mouse
68867 pointer is over the text for any message, an action menu pops up, and the first
68868 line of the queue display for the message is highlighted. This does not affect
68869 any selected text.
68870 </para>
68871 <para>
68872 If you want to use some other event for popping up the menu, you can set the
68873 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
68874 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
68875 value set in this parameter is a standard X event description. For example, to
68876 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
68877 </para>
68878 <literallayout class="monospaced">
68879 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
68880 </literallayout>
68881 <para>
68882 The title of the menu is the message id, and it contains entries which act as
68883 follows:
68884 </para>
68885 <itemizedlist>
68886 <listitem>
68887 <para>
68888 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
68889 in a new text window.
68890 </para>
68891 </listitem>
68892 <listitem>
68893 <para>
68894 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
68895 information and headers is displayed in a new text window. See chapter
68896 <xref linkend="CHAPspool"/> for a description of the format of spool files.
68897 </para>
68898 </listitem>
68899 <listitem>
68900 <para>
68901 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
68902 displayed in a new text window. There is a default limit of 20,000 bytes to the
68903 amount of data displayed. This can be changed by setting the BODY_MAX
68904 option at compile time, or the EXIMON_BODY_MAX option at run time.
68905 </para>
68906 </listitem>
68907 <listitem>
68908 <para>
68909 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
68910 delivery of the message. This causes an automatic thaw if the message is
68911 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
68912 a new text window. The delivery is run in a separate process, to avoid holding
68913 up the monitor while the delivery proceeds.
68914 </para>
68915 </listitem>
68916 <listitem>
68917 <para>
68918 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
68919 that the message be frozen.
68920 </para>
68921 </listitem>
68922 <listitem>
68923 <para>
68924 <indexterm role="concept">
68925 <primary>thawing messages</primary>
68926 </indexterm>
68927 <indexterm role="concept">
68928 <primary>unfreezing messages</primary>
68929 </indexterm>
68930 <indexterm role="concept">
68931 <primary>frozen messages</primary>
68932 <secondary>thawing</secondary>
68933 </indexterm>
68934 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
68935 that the message be thawed.
68936 </para>
68937 </listitem>
68938 <listitem>
68939 <para>
68940 <indexterm role="concept">
68941 <primary>delivery</primary>
68942 <secondary>forcing failure</secondary>
68943 </indexterm>
68944 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
68945 that Exim gives up trying to deliver the message. A bounce message is generated
68946 for any remaining undelivered addresses.
68947 </para>
68948 </listitem>
68949 <listitem>
68950 <para>
68951 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
68952 that the message be deleted from the system without generating a bounce
68953 message.
68954 </para>
68955 </listitem>
68956 <listitem>
68957 <para>
68958 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
68959 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
68960 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
68961 Otherwise it must be entered as a fully qualified address. Pressing RETURN
68962 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
68963 additional recipient be added to the message, unless the entry box is empty, in
68964 which case no action is taken.
68965 </para>
68966 </listitem>
68967 <listitem>
68968 <para>
68969 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
68970 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
68971 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
68972 Otherwise it must be entered as a fully qualified address. Pressing RETURN
68973 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
68974 recipient address as already delivered, unless the entry box is empty, in which
68975 case no action is taken.
68976 </para>
68977 </listitem>
68978 <listitem>
68979 <para>
68980 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
68981 mark all recipient addresses as already delivered.
68982 </para>
68983 </listitem>
68984 <listitem>
68985 <para>
68986 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
68987 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
68988 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
68989 in which case no action is taken. If you want to set an empty sender (as in
68990 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
68991 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
68992 the address is qualified with that domain.
68993 </para>
68994 </listitem>
68995 </itemizedlist>
68996 <para>
68997 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
68998 other cases when a call to Exim is made, if there is any output from Exim (in
68999 particular, if the command fails) a window containing the command and the
69000 output is displayed. Otherwise, the results of the action are normally apparent
69001 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
69002 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
69003 if no output is generated.
69004 </para>
69005 <para>
69006 The queue display is automatically updated for actions such as freezing and
69007 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
69008 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
69009 force an update of the display after one of these actions.
69010 </para>
69011 <para>
69012 In any text window that is displayed as result of a menu action, the normal
69013 cut-and-paste facility is available, and searching can be carried out using ^R
69014 and ^S, as described above for the log tail window.
69015 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
69016 </para>
69017 </section>
69018 </chapter>
69019
69020 <chapter id="CHAPsecurity">
69021 <title>Security considerations</title>
69022 <para>
69023 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
69024 <primary>security</primary>
69025 <secondary>discussion of</secondary>
69026 </indexterm>
69027 This chapter discusses a number of issues concerned with security, some of
69028 which are also covered in other parts of this manual.
69029 </para>
69030 <para>
69031 For reasons that this author does not understand, some people have promoted
69032 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
69033 existence of this chapter in the documentation. However, the intent of the
69034 chapter is simply to describe the way Exim works in relation to certain
69035 security concerns, not to make any specific claims about the effectiveness of
69036 its security as compared with other MTAs.
69037 </para>
69038 <para>
69039 What follows is a description of the way Exim is supposed to be. Best efforts
69040 have been made to try to ensure that the code agrees with the theory, but an
69041 absence of bugs can never be guaranteed. Any that are reported will get fixed
69042 as soon as possible.
69043 </para>
69044 <section id="SECID286">
69045 <title>Building a more <quote>hardened</quote> Exim</title>
69046 <para>
69047 <indexterm role="concept">
69048 <primary>security</primary>
69049 <secondary>build-time features</secondary>
69050 </indexterm>
69051 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
69052 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
69053 Exim administrator who does not have the root password, or by someone who has
69054 penetrated the Exim (but not the root) account. These options are as follows:
69055 </para>
69056 <itemizedlist>
69057 <listitem>
69058 <para>
69059 ALT_CONFIG_PREFIX can be set to a string that is required to match the
69060 start of any file names used with the <option>-C</option> option. When it is set, these file
69061 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
69062 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
69063 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
69064 default setting for <option>ALT_CONFIG_PREFIX</option>.
69065 </para>
69066 <para>
69067 If the permitted configuration files are confined to a directory to
69068 which only root has access, this guards against someone who has broken
69069 into the Exim account from running a privileged Exim with an arbitrary
69070 configuration file, and using it to break into other accounts.
69071 </para>
69072 </listitem>
69073 <listitem>
69074 <para>
69075 If a non-trusted configuration file (i.e. not the default configuration file
69076 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
69077 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
69078 the next item), then root privilege is retained only if the caller of Exim is
69079 root. This locks out the possibility of testing a configuration using <option>-C</option>
69080 right through message reception and delivery, even if the caller is root. The
69081 reception works, but by that time, Exim is running as the Exim user, so when
69082 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
69083 privilege to be lost. However, root can test reception and delivery using two
69084 separate commands.
69085 </para>
69086 </listitem>
69087 <listitem>
69088 <para>
69089 The WHITELIST_D_MACROS build option declares some macros to be safe to override
69090 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
69091 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
69092 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
69093 the restrictive side.  Requiring build-time selection of safe macros is onerous
69094 but this option is intended solely as a transition mechanism to permit
69095 previously-working configurations to continue to work after release 4.73.
69096 </para>
69097 </listitem>
69098 <listitem>
69099 <para>
69100 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
69101 is disabled.
69102 </para>
69103 </listitem>
69104 <listitem>
69105 <para>
69106 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
69107 never to be used for any deliveries. This is like the <option>never_users</option> runtime
69108 option, but it cannot be overridden; the runtime option adds additional users
69109 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
69110 is permitted to modify the runtime file from using Exim as a way to get root.
69111 </para>
69112 </listitem>
69113 </itemizedlist>
69114 </section>
69115 <section id="SECID270">
69116 <title>Root privilege</title>
69117 <para>
69118 <indexterm role="concept">
69119 <primary>setuid</primary>
69120 </indexterm>
69121 <indexterm role="concept">
69122 <primary>root privilege</primary>
69123 </indexterm>
69124 The Exim binary is normally setuid to root, which means that it gains root
69125 privilege (runs as root) when it starts execution. In some special cases (for
69126 example, when the daemon is not in use and there are no local deliveries), it
69127 may be possible to run Exim setuid to some user other than root. This is
69128 discussed in the next section. However, in most installations, root privilege
69129 is required for two things:
69130 </para>
69131 <itemizedlist>
69132 <listitem>
69133 <para>
69134 To set up a socket connected to the standard SMTP port (25) when initialising
69135 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
69136 not required.
69137 </para>
69138 </listitem>
69139 <listitem>
69140 <para>
69141 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
69142 perform local deliveries as the receiving user or as specified in the
69143 configuration.
69144 </para>
69145 </listitem>
69146 </itemizedlist>
69147 <para>
69148 It is not necessary to be root to do any of the other things Exim does, such as
69149 receiving messages and delivering them externally over SMTP, and it is
69150 obviously more secure if Exim does not run as root except when necessary.
69151 For this reason, a user and group for Exim to use must be defined in
69152 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
69153 group</quote>. Their values can be changed by the run time configuration, though this
69154 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
69155 <emphasis>mail</emphasis> or another user name altogether.
69156 </para>
69157 <para>
69158 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
69159 abdication; the process cannot regain root afterwards. Prior to release 4.00,
69160 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
69161 </para>
69162 <para>
69163 After a new Exim process has interpreted its command line options, it changes
69164 uid and gid in the following cases:
69165 </para>
69166 <itemizedlist>
69167 <listitem>
69168 <para>
69169 <indexterm role="option">
69170 <primary><option>-C</option></primary>
69171 </indexterm>
69172 <indexterm role="option">
69173 <primary><option>-D</option></primary>
69174 </indexterm>
69175 If the <option>-C</option> option is used to specify an alternate configuration file, or if
69176 the <option>-D</option> option is used to define macro values for the configuration, and the
69177 calling process is not running as root, the uid and gid are changed to those of
69178 the calling process.
69179 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
69180 option may not be used at all.
69181 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
69182 can be supplied if the calling process is running as root, the Exim run-time
69183 user or CONFIGURE_OWNER, if defined.
69184 </para>
69185 </listitem>
69186 <listitem>
69187 <para>
69188 <indexterm role="option">
69189 <primary><option>-be</option></primary>
69190 </indexterm>
69191 <indexterm role="option">
69192 <primary><option>-bf</option></primary>
69193 </indexterm>
69194 <indexterm role="option">
69195 <primary><option>-bF</option></primary>
69196 </indexterm>
69197 If the expansion test option (<option>-be</option>) or one of the filter testing options
69198 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
69199 calling process.
69200 </para>
69201 </listitem>
69202 <listitem>
69203 <para>
69204 If the process is not a daemon process or a queue runner process or a delivery
69205 process or a process for testing address routing (started with <option>-bt</option>), the
69206 uid and gid are changed to the Exim user and group. This means that Exim always
69207 runs under its own uid and gid when receiving messages. This also applies when
69208 testing address verification
69209 <indexterm role="option">
69210 <primary><option>-bv</option></primary>
69211 </indexterm>
69212 <indexterm role="option">
69213 <primary><option>-bh</option></primary>
69214 </indexterm>
69215 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
69216 option).
69217 </para>
69218 </listitem>
69219 <listitem>
69220 <para>
69221 For a daemon, queue runner, delivery, or address testing process, the uid
69222 remains as root at this stage, but the gid is changed to the Exim group.
69223 </para>
69224 </listitem>
69225 </itemizedlist>
69226 <para>
69227 The processes that initially retain root privilege behave as follows:
69228 </para>
69229 <itemizedlist>
69230 <listitem>
69231 <para>
69232 A daemon process changes the gid to the Exim group and the uid to the Exim
69233 user after setting up one or more listening sockets. The <function>initgroups()</function>
69234 function is called, so that if the Exim user is in any additional groups, they
69235 will be used during message reception.
69236 </para>
69237 </listitem>
69238 <listitem>
69239 <para>
69240 A queue runner process retains root privilege throughout its execution. Its
69241 job is to fork a controlled sequence of delivery processes.
69242 </para>
69243 </listitem>
69244 <listitem>
69245 <para>
69246 A delivery process retains root privilege throughout most of its execution,
69247 but any actual deliveries (that is, the transports themselves) are run in
69248 subprocesses which always change to a non-root uid and gid. For local
69249 deliveries this is typically the uid and gid of the owner of the mailbox; for
69250 remote deliveries, the Exim uid and gid are used. Once all the delivery
69251 subprocesses have been run, a delivery process changes to the Exim uid and gid
69252 while doing post-delivery tidying up such as updating the retry database and
69253 generating bounce and warning messages.
69254 </para>
69255 <para>
69256 While the recipient addresses in a message are being routed, the delivery
69257 process runs as root. However, if a user&#x2019;s filter file has to be processed,
69258 this is done in a subprocess that runs under the individual user&#x2019;s uid and
69259 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
69260 </para>
69261 </listitem>
69262 <listitem>
69263 <para>
69264 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
69265 the routing is done in the same environment as a message delivery.
69266 </para>
69267 </listitem>
69268 </itemizedlist>
69269 </section>
69270 <section id="SECTrunexiwitpri">
69271 <title>Running Exim without privilege</title>
69272 <para>
69273 <indexterm role="concept">
69274 <primary>privilege, running without</primary>
69275 </indexterm>
69276 <indexterm role="concept">
69277 <primary>unprivileged running</primary>
69278 </indexterm>
69279 <indexterm role="concept">
69280 <primary>root privilege</primary>
69281 <secondary>running without</secondary>
69282 </indexterm>
69283 Some installations like to run Exim in an unprivileged state for more of its
69284 operation, for added security. Support for this mode of operation is provided
69285 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
69286 gid are changed to the Exim user and group at the start of a delivery process
69287 (and also queue runner and address testing processes). This means that address
69288 routing is no longer run as root, and the deliveries themselves cannot change
69289 to any other uid.
69290 </para>
69291 <para>
69292 <indexterm role="concept">
69293 <primary>SIGHUP</primary>
69294 </indexterm>
69295 <indexterm role="concept">
69296 <primary>daemon</primary>
69297 <secondary>restarting</secondary>
69298 </indexterm>
69299 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
69300 that the daemon can still be started in the usual way, and it can respond
69301 correctly to SIGHUP because the re-invocation regains root privilege.
69302 </para>
69303 <para>
69304 An alternative approach is to make Exim setuid to the Exim user and also setgid
69305 to the Exim group. If you do this, the daemon must be started from a root
69306 process. (Calling Exim from a root process makes it behave in the way it does
69307 when it is setuid root.) However, the daemon cannot restart itself after a
69308 SIGHUP signal because it cannot regain privilege.
69309 </para>
69310 <para>
69311 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
69312 stops Exim from trying to re-invoke itself to do a delivery after a message has
69313 been received. Such a re-invocation is a waste of resources because it has no
69314 effect.
69315 </para>
69316 <para>
69317 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
69318 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
69319 to the Exim user seems a clean approach, but there is one complication:
69320 </para>
69321 <para>
69322 In this style of operation, Exim is running with the real uid and gid set to
69323 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
69324 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
69325 that is, the real uid/gid should be reset to the effective values so as to
69326 discard any privileges that the caller may have. While some operating systems
69327 have a function that permits this action for a non-root effective uid, quite a
69328 number of them do not. Because of this lack of standardization, Exim does not
69329 address this problem at this time.
69330 </para>
69331 <para>
69332 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
69333 is to keep the Exim binary setuid to root, and to set
69334 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
69335 be used in the most straightforward way.
69336 </para>
69337 <para>
69338 If you configure Exim not to run delivery processes as root, there are a
69339 number of restrictions on what you can do:
69340 </para>
69341 <itemizedlist>
69342 <listitem>
69343 <para>
69344 You can deliver only as the Exim user/group. You should  explicitly use the
69345 <option>user</option> and <option>group</option> options to override routers or local transports that
69346 normally deliver as the recipient. This makes sure that configurations that
69347 work in this mode function the same way in normal mode. Any implicit or
69348 explicit specification of another user causes an error.
69349 </para>
69350 </listitem>
69351 <listitem>
69352 <para>
69353 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
69354 not worthwhile to include them in the configuration.
69355 </para>
69356 </listitem>
69357 <listitem>
69358 <para>
69359 Users who wish to use <filename>.forward</filename> would have to make their home directory and
69360 the file itself accessible to the Exim user. Pipe and append-to-file entries,
69361 and their equivalents in Exim filters, cannot be used. While they could be
69362 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
69363 </para>
69364 </listitem>
69365 <listitem>
69366 <para>
69367 Unless the local user mailboxes are all owned by the Exim user (possible in
69368 some POP3 or IMAP-only environments):
69369 </para>
69370 <orderedlist numeration="arabic">
69371 <listitem>
69372 <para>
69373 They must be owned by the Exim group and be writeable by that group. This
69374 implies you must set <option>mode</option> in the appendfile configuration, as well as the
69375 mode of the mailbox files themselves.
69376 </para>
69377 </listitem>
69378 <listitem>
69379 <para>
69380 You must set <option>no_check_owner</option>, since most or all of the files will not be
69381 owned by the Exim user.
69382 </para>
69383 </listitem>
69384 <listitem>
69385 <para>
69386 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
69387 on a newly created mailbox when unprivileged. This also implies that new
69388 mailboxes need to be created manually.
69389 </para>
69390 </listitem>
69391 </orderedlist>
69392 </listitem>
69393 </itemizedlist>
69394 <para>
69395 These restrictions severely restrict what can be done in local deliveries.
69396 However, there are no restrictions on remote deliveries. If you are running a
69397 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
69398 gives more security at essentially no cost.
69399 </para>
69400 <para>
69401 If you are using the <option>mua_wrapper</option> facility (see chapter
69402 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
69403 </para>
69404 </section>
69405 <section id="SECID271">
69406 <title>Delivering to local files</title>
69407 <para>
69408 Full details of the checks applied by <command>appendfile</command> before it writes to a file
69409 are given in chapter <xref linkend="CHAPappendfile"/>.
69410 </para>
69411 </section>
69412 <section id="SECTsecconslocalcmds">
69413 <title>Running local commands</title>
69414 <para>
69415 <indexterm role="concept">
69416 <primary>security</primary>
69417 <secondary>local commands</secondary>
69418 </indexterm>
69419 <indexterm role="concept">
69420 <primary>security</primary>
69421 <secondary>command injection attacks</secondary>
69422 </indexterm>
69423 There are a number of ways in which an administrator can configure Exim to run
69424 commands based upon received, untrustworthy, data. Further, in some
69425 configurations a user who can control a <filename>.forward</filename> file can also arrange to
69426 run commands. Configuration to check includes, but is not limited to:
69427 </para>
69428 <itemizedlist>
69429 <listitem>
69430 <para>
69431 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
69432 injection may be possible with this option present. It is dangerous and should
69433 be used only with considerable caution. Consider constraints which whitelist
69434 allowed characters in a variable which is to be used in a pipe transport that
69435 has <option>use_shell</option> enabled.
69436 </para>
69437 </listitem>
69438 <listitem>
69439 <para>
69440 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
69441 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
69442 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
69443 hub to which ordinary users do not have shell access, but home directories are
69444 NFS mounted (for instance) then administrators should review the list of these
69445 forbid options available, and should bear in mind that the options that may
69446 need forbidding can change as new features are added between releases.
69447 </para>
69448 </listitem>
69449 <listitem>
69450 <para>
69451 The <option>${run...}</option> expansion item does not use a shell by default, but
69452 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
69453 Such invocations should be viewed with prejudicial suspicion.
69454 </para>
69455 </listitem>
69456 <listitem>
69457 <para>
69458 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
69459 taint checking might apply to their usage.
69460 </para>
69461 </listitem>
69462 <listitem>
69463 <para>
69464 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
69465 administrators are well advised to view its use with suspicion, in case (for
69466 instance) it allows a local-part to contain embedded Exim directives.
69467 </para>
69468 </listitem>
69469 <listitem>
69470 <para>
69471 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
69472 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
69473 each can reference arbitrary lists and files, rather than just being a list
69474 of opaque strings.
69475 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
69476 real-world security vulnerabilities caused by its use with untrustworthy data
69477 injected in, for SQL injection attacks.
69478 Consider the use of the <option>inlisti</option> expansion condition instead.
69479 </para>
69480 </listitem>
69481 </itemizedlist>
69482 </section>
69483 <section id="SECTsecconfdata">
69484 <title>Trust in configuration data</title>
69485 <para>
69486 <indexterm role="concept">
69487 <primary>security</primary>
69488 <secondary>data sources</secondary>
69489 </indexterm>
69490 <indexterm role="concept">
69491 <primary>security</primary>
69492 <secondary>regular expressions</secondary>
69493 </indexterm>
69494 <indexterm role="concept">
69495 <primary>regular expressions</primary>
69496 <secondary>security</secondary>
69497 </indexterm>
69498 <indexterm role="concept">
69499 <primary>PCRE</primary>
69500 <secondary>security</secondary>
69501 </indexterm>
69502 If configuration data for Exim can come from untrustworthy sources, there
69503 are some issues to be aware of:
69504 </para>
69505 <itemizedlist>
69506 <listitem>
69507 <para>
69508 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
69509 </para>
69510 </listitem>
69511 <listitem>
69512 <para>
69513 Letting untrusted data provide a regular expression is unwise.
69514 </para>
69515 </listitem>
69516 <listitem>
69517 <para>
69518 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
69519 data may result in pathological behaviour within PCRE.  Be aware of what
69520 "backtracking" means and consider options for being more strict with a regular
69521 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
69522 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
69523 possessive quantifiers or just not using regular expressions against untrusted
69524 data.
69525 </para>
69526 </listitem>
69527 <listitem>
69528 <para>
69529 It can be important to correctly use <option>${quote:...}</option>,
69530 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
69531 items to ensure that data is correctly constructed.
69532 </para>
69533 </listitem>
69534 <listitem>
69535 <para>
69536 Some lookups might return multiple results, even though normal usage is only
69537 expected to yield one result.
69538 </para>
69539 </listitem>
69540 </itemizedlist>
69541 </section>
69542 <section id="SECID272">
69543 <title>IPv4 source routing</title>
69544 <para>
69545 <indexterm role="concept">
69546 <primary>source routing</primary>
69547 <secondary>in IP packets</secondary>
69548 </indexterm>
69549 <indexterm role="concept">
69550 <primary>IP source routing</primary>
69551 </indexterm>
69552 Many operating systems suppress IP source-routed packets in the kernel, but
69553 some cannot be made to do this, so Exim does its own check. It logs incoming
69554 IPv4 source-routed TCP calls, and then drops them. Things are all different in
69555 IPv6. No special checking is currently done.
69556 </para>
69557 </section>
69558 <section id="SECID273">
69559 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
69560 <para>
69561 Support for these SMTP commands is disabled by default. If required, they can
69562 be enabled by defining suitable ACLs.
69563 </para>
69564 </section>
69565 <section id="SECID274">
69566 <title>Privileged users</title>
69567 <para>
69568 <indexterm role="concept">
69569 <primary>trusted users</primary>
69570 </indexterm>
69571 <indexterm role="concept">
69572 <primary>admin user</primary>
69573 </indexterm>
69574 <indexterm role="concept">
69575 <primary>privileged user</primary>
69576 </indexterm>
69577 <indexterm role="concept">
69578 <primary>user</primary>
69579 <secondary>trusted</secondary>
69580 </indexterm>
69581 <indexterm role="concept">
69582 <primary>user</primary>
69583 <secondary>admin</secondary>
69584 </indexterm>
69585 Exim recognizes two sets of users with special privileges. Trusted users are
69586 able to submit new messages to Exim locally, but supply their own sender
69587 addresses and information about a sending host. For other users submitting
69588 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
69589 permit a remote host to be specified.
69590 </para>
69591 <para>
69592 <indexterm role="option">
69593 <primary><option>-f</option></primary>
69594 </indexterm>
69595 However, an untrusted user is permitted to use the <option>-f</option> command line option
69596 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
69597 message should not cause an error report. This affects the message&#x2019;s envelope,
69598 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
69599 permitted to use specific forms of address with the <option>-f</option> option by setting
69600 the <option>untrusted_set_sender</option> option.
69601 </para>
69602 <para>
69603 Trusted users are used to run processes that receive mail messages from some
69604 other mail domain and pass them on to Exim for delivery either locally, or over
69605 the Internet. Exim trusts a caller that is running as root, as the Exim user,
69606 as any user listed in the <option>trusted_users</option> configuration option, or under any
69607 group listed in the <option>trusted_groups</option> option.
69608 </para>
69609 <para>
69610 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
69611 can freeze or thaw messages, cause them to be returned to their senders, remove
69612 them entirely, or modify them in various ways. In addition, admin users can run
69613 the Exim monitor and see all the information it is capable of providing, which
69614 includes the contents of files on the spool.
69615 </para>
69616 <para>
69617 <indexterm role="option">
69618 <primary><option>-M</option></primary>
69619 </indexterm>
69620 <indexterm role="option">
69621 <primary><option>-q</option></primary>
69622 </indexterm>
69623 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
69624 delivery of messages on its queue is restricted to admin users. This
69625 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
69626 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
69627 queue is also restricted to admin users. This restriction can be relaxed by
69628 setting <option>no_queue_list_requires_admin</option>.
69629 </para>
69630 <para>
69631 Exim recognizes an admin user if the calling process is running as root or as
69632 the Exim user or if any of the groups associated with the calling process is
69633 the Exim group. It is not necessary actually to be running under the Exim
69634 group. However, if admin users who are not root or the Exim user are to access
69635 the contents of files on the spool via the Exim monitor (which runs
69636 unprivileged), Exim must be built to allow group read access to its spool
69637 files.
69638 </para>
69639 <para>
69640 By default, regular users are trusted to perform basic testing and
69641 introspection commands, as themselves.  This setting can be tightened by
69642 setting the <option>commandline_checks_require_admin</option> option.
69643 This affects most of the checking options,
69644 such as <option>-be</option> and anything else <option>-b*</option>.
69645 </para>
69646 </section>
69647 <section id="SECID275">
69648 <title>Spool files</title>
69649 <para>
69650 <indexterm role="concept">
69651 <primary>spool directory</primary>
69652 <secondary>files</secondary>
69653 </indexterm>
69654 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
69655 set to the Exim group. The mode for spool files is defined in the
69656 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
69657 any user who is a member of the Exim group can access these files.
69658 </para>
69659 </section>
69660 <section id="SECID276">
69661 <title>Use of argv[0]</title>
69662 <para>
69663 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
69664 of specific strings, Exim assumes certain options. For example, calling Exim
69665 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
69666 to calling it with the option <option>-bS</option>. There are no security implications in
69667 this.
69668 </para>
69669 </section>
69670 <section id="SECID277">
69671 <title>Use of %f formatting</title>
69672 <para>
69673 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
69674 are actually stored in integer variables as 1000 times the load average.
69675 Consequently, their range is limited and so therefore is the length of the
69676 converted output.
69677 </para>
69678 </section>
69679 <section id="SECID278">
69680 <title>Embedded Exim path</title>
69681 <para>
69682 Exim uses its own path name, which is embedded in the code, only when it needs
69683 to re-exec in order to regain root privilege. Therefore, it is not root when it
69684 does so. If some bug allowed the path to get overwritten, it would lead to an
69685 arbitrary program&#x2019;s being run as exim, not as root.
69686 </para>
69687 </section>
69688 <section id="SECTdynmoddir">
69689 <title>Dynamic module directory</title>
69690 <para>
69691 Any dynamically loadable modules must be installed into the directory
69692 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
69693 loading it.
69694 </para>
69695 </section>
69696 <section id="SECID279">
69697 <title>Use of sprintf()</title>
69698 <para>
69699 <indexterm role="concept">
69700 <primary><function>sprintf()</function></primary>
69701 </indexterm>
69702 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
69703 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
69704 The intermediate formatting is done into a large fixed buffer by a function
69705 that runs through the format string itself, and checks the length of each
69706 conversion before performing it, thus preventing buffer overruns.
69707 </para>
69708 <para>
69709 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
69710 the output buffer is known to be sufficiently long to contain the converted
69711 string.
69712 </para>
69713 </section>
69714 <section id="SECID280">
69715 <title>Use of debug_printf() and log_write()</title>
69716 <para>
69717 Arbitrary strings are passed to both these functions, but they do their
69718 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
69719 the format string itself, and checks the length of each conversion.
69720 </para>
69721 </section>
69722 <section id="SECID281">
69723 <title>Use of strcat() and strcpy()</title>
69724 <para>
69725 These are used only in cases where the output buffer is known to be large
69726 enough to hold the result.
69727 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
69728 </para>
69729 </section>
69730 </chapter>
69731
69732 <chapter id="CHAPspool">
69733 <title>Format of spool files</title>
69734 <para>
69735 <indexterm role="concept" id="IIDforspo1" class="startofrange">
69736 <primary>format</primary>
69737 <secondary>spool files</secondary>
69738 </indexterm>
69739 <indexterm role="concept" id="IIDforspo2" class="startofrange">
69740 <primary>spool directory</primary>
69741 <secondary>format of files</secondary>
69742 </indexterm>
69743 <indexterm role="concept" id="IIDforspo3" class="startofrange">
69744 <primary>spool files</primary>
69745 <secondary>format of</secondary>
69746 </indexterm>
69747 <indexterm role="concept">
69748 <primary>spool files</primary>
69749 <secondary>editing</secondary>
69750 </indexterm>
69751 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
69752 followed by -D and -H, respectively. The data portion of the message is kept in
69753 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
69754 kept in the -H file, whose format is described in this chapter. Each of these
69755 two files contains the final component of its own name as its first line. This
69756 is insurance against disk crashes where the directory is lost but the files
69757 themselves are recoverable.
69758 </para>
69759 <para>
69760 Some people are tempted into editing -D files in order to modify messages. You
69761 need to be extremely careful if you do this; it is not recommended and you are
69762 on your own if you do it. Here are some of the pitfalls:
69763 </para>
69764 <itemizedlist>
69765 <listitem>
69766 <para>
69767 You must ensure that Exim does not try to deliver the message while you are
69768 fiddling with it. The safest way is to take out a write lock on the -D file,
69769 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
69770 place, the lock will be retained. If you write a new file and rename it, the
69771 lock will be lost at the instant of rename.
69772 </para>
69773 </listitem>
69774 <listitem>
69775 <para>
69776 <indexterm role="variable">
69777 <primary><varname>$body_linecount</varname></primary>
69778 </indexterm>
69779 If you change the number of lines in the file, the value of
69780 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
69781 cause incomplete transmission of messages or undeliverable messages.
69782 </para>
69783 </listitem>
69784 <listitem>
69785 <para>
69786 If the message is in MIME format, you must take care not to break it.
69787 </para>
69788 </listitem>
69789 <listitem>
69790 <para>
69791 If the message is cryptographically signed, any change will invalidate the
69792 signature.
69793 </para>
69794 </listitem>
69795 </itemizedlist>
69796 <para>
69797 All in all, modifying -D files is fraught with danger.
69798 </para>
69799 <para>
69800 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
69801 its subdirectories when <option>split_spool_directory</option> is set). These are journal
69802 files, used to record addresses to which the message has been delivered during
69803 the course of a delivery attempt. If there are still undelivered recipients at
69804 the end, the -H file is updated, and the -J file is deleted. If, however, there
69805 is some kind of crash (for example, a power outage) before this happens, the -J
69806 file remains in existence. When Exim next processes the message, it notices the
69807 -J file and uses it to update the -H file before starting the next delivery
69808 attempt.
69809 </para>
69810 <para>
69811 Files whose names end with -K or .eml may also be seen in the spool.
69812 These are temporaries used for DKIM or malware processing, when that is used.
69813 They should be tidied up by normal operations; any old ones are probably
69814 relics of crashes and can be removed.
69815 </para>
69816 <section id="SECID282">
69817 <title>Format of the -H file</title>
69818 <para>
69819 <indexterm role="concept">
69820 <primary>uid (user id)</primary>
69821 <secondary>in spool file</secondary>
69822 </indexterm>
69823 <indexterm role="concept">
69824 <primary>gid (group id)</primary>
69825 <secondary>in spool file</secondary>
69826 </indexterm>
69827 The second line of the -H file contains the login name for the uid of the
69828 process that called Exim to read the message, followed by the numerical uid and
69829 gid. For a locally generated message, this is normally the user who sent the
69830 message. For a message received over TCP/IP via the daemon, it is
69831 normally the Exim user.
69832 </para>
69833 <para>
69834 The third line of the file contains the address of the message&#x2019;s sender as
69835 transmitted in the envelope, contained in angle brackets. The sender address is
69836 empty for bounce messages. For incoming SMTP mail, the sender address is given
69837 in the MAIL command. For locally generated mail, the sender address is
69838 created by Exim from the login name of the current user and the configured
69839 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
69840 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
69841 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
69842 </para>
69843 <para>
69844 The fourth line contains two numbers. The first is the time that the message
69845 was received, in the conventional Unix form &ndash; the number of seconds since the
69846 start of the epoch. The second number is a count of the number of messages
69847 warning of delayed delivery that have been sent to the sender.
69848 </para>
69849 <para>
69850 There follow a number of lines starting with a hyphen. These can appear in any
69851 order, and are omitted when not relevant:
69852 </para>
69853 <variablelist>
69854 <varlistentry>
69855 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69856 <listitem>
69857 <para>
69858 This item is obsolete, and is not generated from Exim release 4.61 onwards;
69859 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
69860 recognized, to provide backward compatibility. In the old format, a line of
69861 this form is present for every ACL variable that is not empty. The number
69862 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
69863 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
69864 the data string for the variable. The string itself starts at the beginning of
69865 the next line, and is followed by a newline character. It may contain internal
69866 newlines.
69867 </para>
69868 </listitem></varlistentry>
69869 <varlistentry>
69870 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69871 <listitem>
69872 <para>
69873 A line of this form is present for every ACL connection variable that is
69874 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
69875 The length is the length of the data string for the variable. The string itself
69876 starts at the beginning of the next line, and is followed by a newline
69877 character. It may contain internal newlines.
69878 </para>
69879 </listitem></varlistentry>
69880 <varlistentry>
69881 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69882 <listitem>
69883 <para>
69884 A line of this form is present for every ACL message variable that is defined.
69885 Note that there is a space between <option>-aclm</option> and the rest of the name. The
69886 length is the length of the data string for the variable. The string itself
69887 starts at the beginning of the next line, and is followed by a newline
69888 character. It may contain internal newlines.
69889 </para>
69890 </listitem></varlistentry>
69891 <varlistentry>
69892 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
69893 <listitem>
69894 <para>
69895 This is present if, when the message was received over SMTP, the value of
69896 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
69897 </para>
69898 </listitem></varlistentry>
69899 <varlistentry>
69900 <term><option>-allow_unqualified_recipient</option></term>
69901 <listitem>
69902 <para>
69903 This is present if unqualified recipient addresses are permitted in header
69904 lines (to stop such addresses from being qualified if rewriting occurs at
69905 transport time). Local messages that were input using <option>-bnq</option> and remote
69906 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
69907 </para>
69908 </listitem></varlistentry>
69909 <varlistentry>
69910 <term><option>-allow_unqualified_sender</option></term>
69911 <listitem>
69912 <para>
69913 This is present if unqualified sender addresses are permitted in header lines
69914 (to stop such addresses from being qualified if rewriting occurs at transport
69915 time). Local messages that were input using <option>-bnq</option> and remote messages from
69916 hosts that match <option>sender_unqualified_hosts</option> set this flag.
69917 </para>
69918 </listitem></varlistentry>
69919 <varlistentry>
69920 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69921 <listitem>
69922 <para>
69923 The id information for a message received on an authenticated SMTP connection
69924 &ndash; the value of the <varname>$authenticated_id</varname> variable.
69925 </para>
69926 </listitem></varlistentry>
69927 <varlistentry>
69928 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
69929 <listitem>
69930 <para>
69931 The address of an authenticated sender &ndash; the value of the
69932 <varname>$authenticated_sender</varname> variable.
69933 </para>
69934 </listitem></varlistentry>
69935 <varlistentry>
69936 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
69937 <listitem>
69938 <para>
69939 This records the number of lines in the body of the message, and is
69940 present unless <option>-spool_file_wireformat</option> is.
69941 </para>
69942 </listitem></varlistentry>
69943 <varlistentry>
69944 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
69945 <listitem>
69946 <para>
69947 This records the number of binary zero bytes in the body of the message, and is
69948 present if the number is greater than zero.
69949 </para>
69950 </listitem></varlistentry>
69951 <varlistentry>
69952 <term><option>-deliver_firsttime</option></term>
69953 <listitem>
69954 <para>
69955 This is written when a new message is first added to the spool. When the spool
69956 file is updated after a deferral, it is omitted.
69957 </para>
69958 </listitem></varlistentry>
69959 <varlistentry>
69960 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
69961 <listitem>
69962 <para>
69963 <indexterm role="concept">
69964 <primary>frozen messages</primary>
69965 <secondary>spool data</secondary>
69966 </indexterm>
69967 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
69968 </para>
69969 </listitem></varlistentry>
69970 <varlistentry>
69971 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69972 <listitem>
69973 <para>
69974 This records the host name as specified by a remote host in a HELO or EHLO
69975 command.
69976 </para>
69977 </listitem></varlistentry>
69978 <varlistentry>
69979 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
69980 <listitem>
69981 <para>
69982 This records the IP address of the host from which the message was received and
69983 the remote port number that was used. It is omitted for locally generated
69984 messages.
69985 </para>
69986 </listitem></varlistentry>
69987 <varlistentry>
69988 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69989 <listitem>
69990 <para>
69991 If the message was received on an authenticated SMTP connection, this records
69992 the name of the authenticator &ndash; the value of the
69993 <varname>$sender_host_authenticated</varname> variable.
69994 </para>
69995 </listitem></varlistentry>
69996 <varlistentry>
69997 <term><option>-host_lookup_failed</option></term>
69998 <listitem>
69999 <para>
70000 This is present if an attempt to look up the sending host&#x2019;s name from its IP
70001 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
70002 </para>
70003 </listitem></varlistentry>
70004 <varlistentry>
70005 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70006 <listitem>
70007 <para>
70008 <indexterm role="concept">
70009 <primary>reverse DNS lookup</primary>
70010 </indexterm>
70011 <indexterm role="concept">
70012 <primary>DNS</primary>
70013 <secondary>reverse lookup</secondary>
70014 </indexterm>
70015 This records the name of the remote host from which the message was received,
70016 if the host name was looked up from the IP address when the message was being
70017 received. It is not present if no reverse lookup was done.
70018 </para>
70019 </listitem></varlistentry>
70020 <varlistentry>
70021 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70022 <listitem>
70023 <para>
70024 For locally submitted messages, this records the login of the originating user,
70025 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
70026 ident value. For messages received over TCP/IP, this records the ident string
70027 supplied by the remote host, if any.
70028 </para>
70029 </listitem></varlistentry>
70030 <varlistentry>
70031 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
70032 <listitem>
70033 <para>
70034 This records the IP address of the local interface and the port number through
70035 which a message was received from a remote host. It is omitted for locally
70036 generated messages.
70037 </para>
70038 </listitem></varlistentry>
70039 <varlistentry>
70040 <term><option>-local</option></term>
70041 <listitem>
70042 <para>
70043 The message is from a local sender.
70044 </para>
70045 </listitem></varlistentry>
70046 <varlistentry>
70047 <term><option>-localerror</option></term>
70048 <listitem>
70049 <para>
70050 The message is a locally-generated bounce message.
70051 </para>
70052 </listitem></varlistentry>
70053 <varlistentry>
70054 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
70055 <listitem>
70056 <para>
70057 This records the data string that was returned by the <function>local_scan()</function> function
70058 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
70059 variable. It is omitted if no data was returned.
70060 </para>
70061 </listitem></varlistentry>
70062 <varlistentry>
70063 <term><option>-manual_thaw</option></term>
70064 <listitem>
70065 <para>
70066 The message was frozen but has been thawed manually, that is, by an explicit
70067 Exim command rather than via the auto-thaw process.
70068 </para>
70069 </listitem></varlistentry>
70070 <varlistentry>
70071 <term><option>-N</option></term>
70072 <listitem>
70073 <para>
70074 A testing delivery process was started using the <option>-N</option> option to suppress any
70075 actual deliveries, but delivery was deferred. At any further delivery attempts,
70076 <option>-N</option> is assumed.
70077 </para>
70078 </listitem></varlistentry>
70079 <varlistentry>
70080 <term><option>-received_protocol</option></term>
70081 <listitem>
70082 <para>
70083 This records the value of the <varname>$received_protocol</varname> variable, which contains
70084 the name of the protocol by which the message was received.
70085 </para>
70086 </listitem></varlistentry>
70087 <varlistentry>
70088 <term><option>-sender_set_untrusted</option></term>
70089 <listitem>
70090 <para>
70091 The envelope sender of this message was set by an untrusted local caller (used
70092 to ensure that the caller is displayed in queue listings).
70093 </para>
70094 </listitem></varlistentry>
70095 <varlistentry>
70096 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
70097 <listitem>
70098 <para>
70099 If a message was scanned by SpamAssassin, this is present. It records the value
70100 of <varname>$spam_score_int</varname>.
70101 </para>
70102 </listitem></varlistentry>
70103 <varlistentry>
70104 <term><option>-spool_file_wireformat</option></term>
70105 <listitem>
70106 <para>
70107 The -D file for this message is in wire-format (for ESMTP CHUNKING)
70108 rather than Unix-format.
70109 The line-ending is CRLF rather than newline.
70110 There is still, however, no leading-dot-stuffing.
70111 </para>
70112 </listitem></varlistentry>
70113 <varlistentry>
70114 <term><option>-tls_certificate_verified</option></term>
70115 <listitem>
70116 <para>
70117 A TLS certificate was received from the client that sent this message, and the
70118 certificate was verified by the server.
70119 </para>
70120 </listitem></varlistentry>
70121 <varlistentry>
70122 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
70123 <listitem>
70124 <para>
70125 When the message was received over an encrypted connection, this records the
70126 name of the cipher suite that was used.
70127 </para>
70128 </listitem></varlistentry>
70129 <varlistentry>
70130 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
70131 <listitem>
70132 <para>
70133 When the message was received over an encrypted connection, and a certificate
70134 was received from the client, this records the Distinguished Name from that
70135 certificate.
70136 </para>
70137 </listitem></varlistentry>
70138 </variablelist>
70139 <para>
70140 Following the options there is a list of those addresses to which the message
70141 is not to be delivered. This set of addresses is initialized from the command
70142 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
70143 is set; otherwise it starts out empty. Whenever a successful delivery is made,
70144 the address is added to this set. The addresses are kept internally as a
70145 balanced binary tree, and it is a representation of that tree which is written
70146 to the spool file. If an address is expanded via an alias or forward file, the
70147 original address is added to the tree when deliveries to all its child
70148 addresses are complete.
70149 </para>
70150 <para>
70151 If the tree is empty, there is a single line in the spool file containing just
70152 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
70153 Y or N, followed by an address. The address is the value for the node of the
70154 tree, and the letters indicate whether the node has a left branch and/or a
70155 right branch attached to it, respectively. If branches exist, they immediately
70156 follow. Here is an example of a three-node tree:
70157 </para>
70158 <literallayout class="monospaced">
70159 YY darcy@austen.fict.example
70160 NN alice@wonderland.fict.example
70161 NN editor@thesaurus.ref.example
70162 </literallayout>
70163 <para>
70164 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
70165 This is a simple list, preceded by a count. It includes all the original
70166 recipients of the message, including those to whom the message has already been
70167 delivered. In the simplest case, the list contains one address per line. For
70168 example:
70169 </para>
70170 <literallayout class="monospaced">
70171 4
70172 editor@thesaurus.ref.example
70173 darcy@austen.fict.example
70174 rdo@foundation
70175 alice@wonderland.fict.example
70176 </literallayout>
70177 <para>
70178 However, when a child address has been added to the top-level addresses as a
70179 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
70180 line is of the following form:
70181 </para>
70182 <literallayout>
70183 &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;
70184 </literallayout>
70185 <para>
70186 The 01 flag bit indicates the presence of the three other fields that follow
70187 the top-level address. Other bits may be used in future to support additional
70188 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
70189 original parent of the <quote>one time</quote> address. The first two fields are the
70190 envelope sender that is associated with this address and its length. If the
70191 length is zero, there is no special envelope sender (there are then two space
70192 characters in the line). A non-empty field can arise from a <command>redirect</command> router
70193 that has an <option>errors_to</option> setting.
70194 </para>
70195 <para>
70196 A blank line separates the envelope and status information from the headers
70197 which follow. A header may occupy several lines of the file, and to save effort
70198 when reading it in, each header is preceded by a number and an identifying
70199 character. The number is the number of characters in the header, including any
70200 embedded newlines and the terminating newline. The character is one of the
70201 following:
70202 </para>
70203 <informaltable frame="none">
70204 <tgroup cols="2" colsep="0" rowsep="0">
70205 <colspec colwidth="50pt" align="left"/>
70206 <colspec colwidth="254pt" align="left"/>
70207 <tbody>
70208 <row>
70209 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
70210 <entry>header in which Exim has no special interest</entry>
70211 </row>
70212 <row>
70213 <entry><literal>B</literal></entry>
70214 <entry><emphasis>Bcc:</emphasis> header</entry>
70215 </row>
70216 <row>
70217 <entry><literal>C</literal></entry>
70218 <entry><emphasis>Cc:</emphasis> header</entry>
70219 </row>
70220 <row>
70221 <entry><literal>F</literal></entry>
70222 <entry><emphasis>From:</emphasis> header</entry>
70223 </row>
70224 <row>
70225 <entry><literal>I</literal></entry>
70226 <entry><emphasis>Message-id:</emphasis> header</entry>
70227 </row>
70228 <row>
70229 <entry><literal>P</literal></entry>
70230 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
70231 </row>
70232 <row>
70233 <entry><literal>R</literal></entry>
70234 <entry><emphasis>Reply-To:</emphasis> header</entry>
70235 </row>
70236 <row>
70237 <entry><literal>S</literal></entry>
70238 <entry><emphasis>Sender:</emphasis> header</entry>
70239 </row>
70240 <row>
70241 <entry><literal>T</literal></entry>
70242 <entry><emphasis>To:</emphasis> header</entry>
70243 </row>
70244 <row>
70245 <entry><literal>*</literal></entry>
70246 <entry>replaced or deleted header</entry>
70247 </row>
70248 </tbody>
70249 </tgroup>
70250 </informaltable>
70251 <para>
70252 Deleted or replaced (rewritten) headers remain in the spool file for debugging
70253 purposes. They are not transmitted when the message is delivered. Here is a
70254 typical set of headers:
70255 </para>
70256 <literallayout class="monospaced">
70257 111P Received: by hobbit.fict.example with local (Exim 4.00)
70258 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
70259 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
70260 038* X-rewrote-sender: bb@hobbit.fict.example
70261 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
70262 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
70263 099* To: alice@wonderland.fict.example, rdo@foundation,
70264 darcy@austen.fict.example, editor@thesaurus.ref.example
70265 104T To: alice@wonderland.fict.example, rdo@foundation.example,
70266 darcy@austen.fict.example, editor@thesaurus.ref.example
70267 038  Date: Fri, 11 May 2001 10:28:59 +0100
70268 </literallayout>
70269 <para>
70270 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
70271 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
70272 unqualified domain <emphasis>foundation</emphasis>.
70273 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
70274 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
70275 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
70276 </para>
70277 </section>
70278 <section id="SECID282a">
70279 <title>Format of the -D file</title>
70280 <para>
70281 The data file is traditionally in Unix-standard format: lines are ended with
70282 an ASCII newline character.
70283 However, when the <option>spool_wireformat</option> main option is used some -D files
70284 can have an alternate format.
70285 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
70286 The -D file lines (not including the first name-component line) are
70287 suitable for direct copying to the wire when transmitting using the
70288 ESMTP CHUNKING option, meaning lower processing overhead.
70289 Lines are terminated with an ASCII CRLF pair.
70290 There is no dot-stuffing (and no dot-termination).
70291 </para>
70292 </section>
70293 </chapter>
70294
70295 <chapter id="CHAPdkim">
70296 <title>DKIM and SPF</title>
70297 <titleabbrev>DKIM and SPF Support</titleabbrev>
70298 <para>
70299 <indexterm role="concept">
70300 <primary>DKIM</primary>
70301 </indexterm>
70302 </para>
70303 <section id="SECDKIM">
70304 <title>DKIM (DomainKeys Identified Mail)</title>
70305 <para>
70306 DKIM is a mechanism by which messages sent by some entity can be provably
70307 linked to a domain which that entity controls.  It permits reputation to
70308 be tracked on a per-domain basis, rather than merely upon source IP address.
70309 DKIM is documented in RFC 6376.
70310 </para>
70311 <para revisionflag="changed">
70312 As DKIM relies on the message being unchanged in transit, messages handled
70313 by a mailing-list (which traditionally adds to the message) will not match
70314 any original DKIM signature.
70315 </para>
70316 <para>
70317 DKIM support is compiled into Exim by default if TLS support is present.
70318 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
70319 </para>
70320 <para>
70321 Exim&#x2019;s DKIM implementation allows for
70322 </para>
70323 <orderedlist numeration="arabic">
70324 <listitem>
70325 <para>
70326 Signing outgoing messages: This function is implemented in the SMTP transport.
70327 It can co-exist with all other Exim features
70328 (including transport filters)
70329 except cutthrough delivery.
70330 </para>
70331 </listitem>
70332 <listitem>
70333 <para>
70334 Verifying signatures in incoming messages: This is implemented by an additional
70335 ACL (acl_smtp_dkim), which can be called several times per message, with
70336 different signature contexts.
70337 </para>
70338 </listitem>
70339 </orderedlist>
70340 <para>
70341 In typical Exim style, the verification implementation does not include any
70342 default "policy". Instead it enables you to build your own policy using
70343 Exim&#x2019;s standard controls.
70344 </para>
70345 <para revisionflag="changed">
70346 Please note that verification of DKIM signatures in incoming mail is turned
70347 on by default for logging (in the &lt;= line) purposes.
70348 </para>
70349 <para revisionflag="changed">
70350 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
70351 When set, for each signature in incoming email,
70352 exim will log a line displaying the most important signature details, and the
70353 signature status. Here is an example (with line-breaks added for clarity):
70354 </para>
70355 <literallayout class="monospaced" revisionflag="changed">
70356 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
70357     d=facebookmail.com s=q1-2009b
70358     c=relaxed/relaxed a=rsa-sha1
70359     i=@facebookmail.com t=1252484542 [verification succeeded]
70360 </literallayout>
70361 <para>
70362 You might want to turn off DKIM verification processing entirely for internal
70363 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
70364 control modifier. This should typically be done in the RCPT ACL, at points
70365 where you accept mail from relay sources (internal hosts or authenticated
70366 senders).
70367 </para>
70368 </section>
70369 <section id="SECDKIMSIGN">
70370 <title>Signing outgoing messages</title>
70371 <para>
70372 <indexterm role="concept">
70373 <primary>DKIM</primary>
70374 <secondary>signing</secondary>
70375 </indexterm>
70376 </para>
70377 <para revisionflag="changed">
70378 For signing to be usable you must have published a DKIM record in DNS.
70379 Note that RFC 8301 says:
70380 </para>
70381 <literallayout class="monospaced" revisionflag="changed">
70382 rsa-sha1 MUST NOT be used for signing or verifying.
70383
70384 Signers MUST use RSA keys of at least 1024 bits for all keys.
70385 Signers SHOULD use RSA keys of at least 2048 bits.
70386 </literallayout>
70387 <para revisionflag="changed">
70388 Note also that the key content (the &#x2019;p=&#x2019; field)
70389 in the DNS record is different between RSA and EC keys;
70390 for the former it is the base64 of the ASN.1 for the RSA public key
70391 (equivalent to the private-key .pem with the header/trailer stripped)
70392 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
70393 </para>
70394 <para>
70395 Signing is enabled by setting private options on the SMTP transport.
70396 These options take (expandable) strings as arguments.
70397 </para>
70398 <para>
70399 <indexterm role="option">
70400 <primary><option>unset</option></primary>
70401 </indexterm>
70402 </para>
70403 <informaltable frame="all">
70404 <tgroup cols="4" colsep="0" rowsep="0">
70405 <colspec colwidth="8*" align="left"/>
70406 <colspec colwidth="6*" align="center"/>
70407 <colspec colwidth="6*" align="center"/>
70408 <colspec colwidth="6*" align="right"/>
70409 <tbody>
70410 <row>
70411 <entry><option>dkim_domain</option></entry>
70412 <entry>Use: <emphasis>smtp</emphasis></entry>
70413 <entry>Type: <emphasis>string</emphasis></entry>
70414 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
70415 </row>
70416 </tbody>
70417 </tgroup>
70418 </informaltable>
70419 <para>
70420 The domain(s) you want to sign with.
70421 After expansion, this can be a list.
70422 Each element in turn is put into the <option>$dkim_domain</option> expansion variable
70423 while expanding the remaining signing options.
70424 If it is empty after expansion, DKIM signing is not done,
70425 and no error will result even if <option>dkim_strict</option> is set.
70426 </para>
70427 <para>
70428 <indexterm role="option">
70429 <primary><option>unset</option></primary>
70430 </indexterm>
70431 </para>
70432 <informaltable frame="all">
70433 <tgroup cols="4" colsep="0" rowsep="0">
70434 <colspec colwidth="8*" align="left"/>
70435 <colspec colwidth="6*" align="center"/>
70436 <colspec colwidth="6*" align="center"/>
70437 <colspec colwidth="6*" align="right"/>
70438 <tbody>
70439 <row>
70440 <entry><option>dkim_selector</option></entry>
70441 <entry>Use: <emphasis>smtp</emphasis></entry>
70442 <entry>Type: <emphasis>string</emphasis></entry>
70443 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
70444 </row>
70445 </tbody>
70446 </tgroup>
70447 </informaltable>
70448 <para>
70449 This sets the key selector string.
70450 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
70451 Each element in turn is put in the expansion
70452 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
70453 option along with <option>$dkim_domain</option>.
70454 If the option is empty after expansion, DKIM signing is not done for this domain,
70455 and no error will result even if <option>dkim_strict</option> is set.
70456 </para>
70457 <para>
70458 <indexterm role="option">
70459 <primary><option>dkim_private_key</option></primary>
70460 </indexterm>
70461 </para>
70462 <informaltable frame="all">
70463 <tgroup cols="4" colsep="0" rowsep="0">
70464 <colspec colwidth="8*" align="left"/>
70465 <colspec colwidth="6*" align="center"/>
70466 <colspec colwidth="6*" align="center"/>
70467 <colspec colwidth="6*" align="right"/>
70468 <tbody>
70469 <row>
70470 <entry><option>dkim_private_key</option></entry>
70471 <entry>Use: <emphasis>smtp</emphasis></entry>
70472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70473 <entry>Default: <emphasis>unset</emphasis></entry>
70474 </row>
70475 </tbody>
70476 </tgroup>
70477 </informaltable>
70478 <para>
70479 This sets the private key to use.
70480 You can use the <option>$dkim_domain</option> and
70481 <option>$dkim_selector</option> expansion variables to determine the private key to use.
70482 The result can either
70483 </para>
70484 <itemizedlist>
70485 <listitem>
70486 <para>
70487 be a valid RSA private key in ASCII armor (.pem file), including line breaks
70488 </para>
70489 </listitem>
70490 <listitem>
70491 <para revisionflag="changed">
70492 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
70493 be a valid Ed25519 private key (same format as above)
70494 </para>
70495 </listitem>
70496 <listitem>
70497 <para>
70498 start with a slash, in which case it is treated as a file that contains
70499 the private key
70500 </para>
70501 </listitem>
70502 <listitem>
70503 <para>
70504 be "0", "false" or the empty string, in which case the message will not
70505 be signed. This case will not result in an error, even if <option>dkim_strict</option>
70506 is set.
70507 </para>
70508 </listitem>
70509 </itemizedlist>
70510 <para revisionflag="changed">
70511 To generate keys under OpenSSL:
70512 </para>
70513 <literallayout class="monospaced" revisionflag="changed">
70514 openssl genrsa -out dkim_rsa.private 2048
70515 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
70516 </literallayout>
70517 <para revisionflag="changed">
70518 Take the base-64 lines from the output of the second command, concatenated,
70519 for the DNS TXT record.
70520 See section 3.6 of RFC6376 for the record specification.
70521 </para>
70522 <para revisionflag="changed">
70523 Under GnuTLS:
70524 </para>
70525 <literallayout class="monospaced" revisionflag="changed">
70526 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
70527 certtool --load-privkey=dkim_rsa.private --pubkey-info
70528 </literallayout>
70529 <para revisionflag="changed">
70530 Note that RFC 8301 says:
70531 </para>
70532 <literallayout class="monospaced" revisionflag="changed">
70533 Signers MUST use RSA keys of at least 1024 bits for all keys.
70534 Signers SHOULD use RSA keys of at least 2048 bits.
70535 </literallayout>
70536 <para revisionflag="changed">
70537 Support for EC keys is being developed under
70538 <emphasis role="bold"><ulink url="https://datatracker.ietf.org/doc/draft-ietf-dcrup-dkim-crypto/">https://datatracker.ietf.org/doc/draft-ietf-dcrup-dkim-crypto/</ulink></emphasis>.
70539 They are considerably smaller than RSA keys for equivalent protection.
70540 As they are a recent development, users should consider dual-signing
70541 (by setting a list of selectors, and an expansion for this option)
70542 for some transition period.
70543 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
70544 for EC keys.
70545 </para>
70546 <para revisionflag="changed">
70547 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
70548 </para>
70549 <literallayout class="monospaced" revisionflag="changed">
70550 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
70551 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
70552 </literallayout>
70553 <para revisionflag="changed">
70554 To produce the required public key value for a DNS record:
70555 </para>
70556 <literallayout class="monospaced" revisionflag="changed">
70557 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
70558 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
70559 </literallayout>
70560 <para revisionflag="changed">
70561 Note that the format
70562 of Ed25519 keys in DNS has not yet been decided; this release supports
70563 both of the leading candidates at this time, a future release will
70564 probably drop support for whichever proposal loses.
70565 </para>
70566 <para>
70567 <indexterm role="option">
70568 <primary><option>dkim_hash</option></primary>
70569 </indexterm>
70570 </para>
70571 <informaltable frame="all">
70572 <tgroup cols="4" colsep="0" rowsep="0">
70573 <colspec colwidth="8*" align="left"/>
70574 <colspec colwidth="6*" align="center"/>
70575 <colspec colwidth="6*" align="center"/>
70576 <colspec colwidth="6*" align="right"/>
70577 <tbody>
70578 <row>
70579 <entry><option>dkim_hash</option></entry>
70580 <entry>Use: <emphasis>smtp</emphasis></entry>
70581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70582 <entry>Default: <emphasis>sha256</emphasis></entry>
70583 </row>
70584 </tbody>
70585 </tgroup>
70586 </informaltable>
70587 <para revisionflag="changed">
70588 Can be set to any one of the supported hash methods, which are:
70589 </para>
70590 <itemizedlist revisionflag="changed">
70591 <listitem>
70592 <para revisionflag="changed">
70593 <literal>sha1</literal> &ndash; should not be used, is old and insecure
70594 </para>
70595 </listitem>
70596 <listitem>
70597 <para revisionflag="changed">
70598 <literal>sha256</literal> &ndash; the default
70599 </para>
70600 </listitem>
70601 <listitem>
70602 <para revisionflag="changed">
70603 <literal>sha512</literal> &ndash; possibly more secure but less well supported
70604 </para>
70605 </listitem>
70606 </itemizedlist>
70607 <para revisionflag="changed">
70608 Note that RFC 8301 says:
70609 </para>
70610 <literallayout class="monospaced" revisionflag="changed">
70611 rsa-sha1 MUST NOT be used for signing or verifying.
70612 </literallayout>
70613 <para>
70614 <indexterm role="option">
70615 <primary><option>dkim_identity</option></primary>
70616 </indexterm>
70617 </para>
70618 <informaltable frame="all">
70619 <tgroup cols="4" colsep="0" rowsep="0">
70620 <colspec colwidth="8*" align="left"/>
70621 <colspec colwidth="6*" align="center"/>
70622 <colspec colwidth="6*" align="center"/>
70623 <colspec colwidth="6*" align="right"/>
70624 <tbody>
70625 <row>
70626 <entry><option>dkim_identity</option></entry>
70627 <entry>Use: <emphasis>smtp</emphasis></entry>
70628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70629 <entry>Default: <emphasis>unset</emphasis></entry>
70630 </row>
70631 </tbody>
70632 </tgroup>
70633 </informaltable>
70634 <para>
70635 If set after expansion, the value is used to set an "i=" tag in
70636 the signing header.  The DKIM standards restrict the permissible
70637 syntax of this optional tag to a mail address, with possibly-empty
70638 local part, an @, and a domain identical to or subdomain of the "d="
70639 tag value.  Note that Exim does not check the value.
70640 </para>
70641 <para>
70642 <indexterm role="option">
70643 <primary><option>dkim_canon</option></primary>
70644 </indexterm>
70645 </para>
70646 <informaltable frame="all">
70647 <tgroup cols="4" colsep="0" rowsep="0">
70648 <colspec colwidth="8*" align="left"/>
70649 <colspec colwidth="6*" align="center"/>
70650 <colspec colwidth="6*" align="center"/>
70651 <colspec colwidth="6*" align="right"/>
70652 <tbody>
70653 <row>
70654 <entry><option>dkim_canon</option></entry>
70655 <entry>Use: <emphasis>smtp</emphasis></entry>
70656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70657 <entry>Default: <emphasis>unset</emphasis></entry>
70658 </row>
70659 </tbody>
70660 </tgroup>
70661 </informaltable>
70662 <para>
70663 This option sets the canonicalization method used when signing a message.
70664 The DKIM RFC currently supports two methods: "simple" and "relaxed".
70665 The option defaults to "relaxed" when unset. Note: the current implementation
70666 only supports using the same canonicalization method for both headers and body.
70667 </para>
70668 <para>
70669 <indexterm role="option">
70670 <primary><option>dkim_strict</option></primary>
70671 </indexterm>
70672 </para>
70673 <informaltable frame="all">
70674 <tgroup cols="4" colsep="0" rowsep="0">
70675 <colspec colwidth="8*" align="left"/>
70676 <colspec colwidth="6*" align="center"/>
70677 <colspec colwidth="6*" align="center"/>
70678 <colspec colwidth="6*" align="right"/>
70679 <tbody>
70680 <row>
70681 <entry><option>dkim_strict</option></entry>
70682 <entry>Use: <emphasis>smtp</emphasis></entry>
70683 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70684 <entry>Default: <emphasis>unset</emphasis></entry>
70685 </row>
70686 </tbody>
70687 </tgroup>
70688 </informaltable>
70689 <para>
70690 This  option  defines  how  Exim  behaves  when  signing a message that
70691 should be signed fails for some reason.  When the expansion evaluates to
70692 either "1" or "true", Exim will defer. Otherwise Exim will send the message
70693 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
70694 variables here.
70695 </para>
70696 <para>
70697 <indexterm role="option">
70698 <primary><option>dkim_sign_headers</option></primary>
70699 </indexterm>
70700 </para>
70701 <informaltable frame="all">
70702 <tgroup cols="4" colsep="0" rowsep="0">
70703 <colspec colwidth="8*" align="left"/>
70704 <colspec colwidth="6*" align="center"/>
70705 <colspec colwidth="6*" align="center"/>
70706 <colspec colwidth="6*" align="right"/>
70707 <tbody>
70708 <row>
70709 <entry><option>dkim_sign_headers</option></entry>
70710 <entry>Use: <emphasis>smtp</emphasis></entry>
70711 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
70712 <entry>Default: <emphasis>see below</emphasis></entry>
70713 </row>
70714 </tbody>
70715 </tgroup>
70716 </informaltable>
70717 <para>
70718 If set, this option must expand to a colon-separated
70719 list of header names.
70720 Headers with these names, or the absence or such a header, will be included
70721 in the message signature.
70722 When unspecified, the header names listed in RFC4871 will be used,
70723 whether or not each header is present in the message.
70724 The default list is available for the expansion in the macro
70725 "_DKIM_SIGN_HEADERS".
70726 </para>
70727 <para>
70728 If a name is repeated, multiple headers by that name (or the absence thereof)
70729 will be signed.  The textually later headers in the headers part of the
70730 message are signed first, if there are multiples.
70731 </para>
70732 <para>
70733 A name can be prefixed with either an &#x2019;=&#x2019; or a &#x2019;+&#x2019; character.
70734 If an &#x2019;=&#x2019; prefix is used, all headers that are present with this name
70735 will be signed.
70736 If a &#x2019;+&#x2019; prefix if used, all headers that are present with this name
70737 will be signed, and one signature added for a missing header with the
70738 name will be appended.
70739 </para>
70740 </section>
70741 <section id="SECDKIMVFY">
70742 <title>Verifying DKIM signatures in incoming mail</title>
70743 <para>
70744 <indexterm role="concept">
70745 <primary>DKIM</primary>
70746 <secondary>verification</secondary>
70747 </indexterm>
70748 </para>
70749 <para>
70750 Verification of DKIM signatures in SMTP incoming email is implemented via the
70751 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
70752 syntactically(!) correct signature in the incoming message.
70753 A missing ACL definition defaults to accept.
70754 If any ACL call does not accept, the message is not accepted.
70755 If a cutthrough delivery was in progress for the message, that is
70756 summarily dropped (having wasted the transmission effort).
70757 </para>
70758 <para>
70759 To evaluate the signature in the ACL a large number of expansion variables
70760 containing the signature status and its details are set up during the
70761 runtime of the ACL.
70762 </para>
70763 <para revisionflag="changed">
70764 <indexterm role="concept">
70765 <primary>authentication</primary>
70766 <secondary>expansion item</secondary>
70767 </indexterm>
70768 Performing verification sets up information used by the
70769 <varname>$authresults</varname> expansion item.
70770 </para>
70771 <para>
70772 Calling the ACL only for existing signatures is not sufficient to build
70773 more advanced policies. For that reason, the global option
70774 <option>dkim_verify_signers</option>, and a global expansion variable
70775 <option>$dkim_signers</option> exist.
70776 </para>
70777 <para>
70778 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
70779 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
70780 called. It is expanded when the message has been received. At this point,
70781 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
70782 list of signer domains and identities for the message. When
70783 <option>dkim_verify_signers</option> is not specified in the main configuration,
70784 it defaults as:
70785 </para>
70786 <literallayout class="monospaced">
70787 dkim_verify_signers = $dkim_signers
70788 </literallayout>
70789 <para>
70790 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
70791 DKIM signature in the message. Current DKIM verifiers may want to explicitly
70792 call the ACL for known domains or identities. This would be achieved as follows:
70793 </para>
70794 <literallayout class="monospaced">
70795 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
70796 </literallayout>
70797 <para>
70798 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
70799 and "ebay.com", plus all domains and identities that have signatures in the message.
70800 You can also be more creative in constructing your policy. For example:
70801 </para>
70802 <literallayout class="monospaced">
70803 dkim_verify_signers = $sender_address_domain:$dkim_signers
70804 </literallayout>
70805 <para>
70806 If a domain or identity is listed several times in the (expanded) value of
70807 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
70808 </para>
70809 <para>
70810 If multiple signatures match a domain (or identity), the ACL is called once
70811 for each matching signature.
70812 </para>
70813 <para>
70814 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
70815 available (from most to least important):
70816 </para>
70817 <variablelist>
70818 <varlistentry>
70819 <term><option>$dkim_cur_signer</option></term>
70820 <listitem>
70821 <para>
70822 The signer that is being evaluated in this ACL run. This can be a domain or
70823 an identity. This is one of the list items from the expanded main option
70824 <option>dkim_verify_signers</option> (see above).
70825 </para>
70826 </listitem></varlistentry>
70827 <varlistentry>
70828 <term><option>$dkim_verify_status</option></term>
70829 <listitem>
70830 <para>
70831 Within the DKIM ACL,
70832 a string describing the general status of the signature. One of
70833 </para>
70834 <itemizedlist>
70835 <listitem>
70836 <para>
70837 <option>none</option>: There is no signature in the message for the current domain or
70838 identity (as reflected by <option>$dkim_cur_signer</option>).
70839 </para>
70840 </listitem>
70841 <listitem>
70842 <para>
70843 <option>invalid</option>: The signature could not be verified due to a processing error.
70844 More detail is available in <option>$dkim_verify_reason</option>.
70845 </para>
70846 </listitem>
70847 <listitem>
70848 <para>
70849 <option>fail</option>: Verification of the signature failed.  More detail is
70850 available in <option>$dkim_verify_reason</option>.
70851 </para>
70852 </listitem>
70853 <listitem>
70854 <para>
70855 <option>pass</option>: The signature passed verification. It is valid.
70856 </para>
70857 </listitem>
70858 </itemizedlist>
70859 <para>
70860 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
70861 This might, for instance, be done to enforce a policy restriction on
70862 hash-method or key-size:
70863 </para>
70864 <literallayout class="monospaced">
70865   warn condition       = ${if eq {$dkim_verify_status}{pass}}
70866        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
70867        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
70868                                   {&lt; {$dkim_key_length}{1024}}}}
70869        logwrite        = NOTE: forcing DKIM verify fail (was pass)
70870        set dkim_verify_status = fail
70871        set dkim_verify_reason = hash too weak or key too short
70872 </literallayout>
70873 <para>
70874 After all the DKIM ACL runs have completed, the value becomes a
70875 colon-separated list of the values after each run.
70876 </para>
70877 </listitem></varlistentry>
70878 <varlistentry>
70879 <term><option>$dkim_verify_reason</option></term>
70880 <listitem>
70881 <para>
70882 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
70883 "fail" or "invalid". One of
70884 </para>
70885 <itemizedlist>
70886 <listitem>
70887 <para>
70888 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
70889 key for the domain could not be retrieved. This may be a temporary problem.
70890 </para>
70891 </listitem>
70892 <listitem>
70893 <para>
70894 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
70895 record for the domain is syntactically invalid.
70896 </para>
70897 </listitem>
70898 <listitem>
70899 <para>
70900 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
70901 body hash does not match the one specified in the signature header. This
70902 means that the message body was modified in transit.
70903 </para>
70904 </listitem>
70905 <listitem>
70906 <para>
70907 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
70908 could not be verified. This may mean that headers were modified,
70909 re-written or otherwise changed in a way which is incompatible with
70910 DKIM verification. It may of course also mean that the signature is forged.
70911 </para>
70912 </listitem>
70913 </itemizedlist>
70914 <para>
70915 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
70916 </para>
70917 </listitem></varlistentry>
70918 <varlistentry>
70919 <term><option>$dkim_domain</option></term>
70920 <listitem>
70921 <para>
70922 The signing domain. IMPORTANT: This variable is only populated if there is
70923 an actual signature in the message for the current domain or identity (as
70924 reflected by <option>$dkim_cur_signer</option>).
70925 </para>
70926 </listitem></varlistentry>
70927 <varlistentry>
70928 <term><option>$dkim_identity</option></term>
70929 <listitem>
70930 <para>
70931 The signing identity, if present. IMPORTANT: This variable is only populated
70932 if there is an actual signature in the message for the current domain or
70933 identity (as reflected by <option>$dkim_cur_signer</option>).
70934 </para>
70935 </listitem></varlistentry>
70936 <varlistentry>
70937 <term><option>$dkim_selector</option></term>
70938 <listitem>
70939 <para>
70940 The key record selector string.
70941 </para>
70942 </listitem></varlistentry>
70943 <varlistentry>
70944 <term><option>$dkim_algo</option></term>
70945 <listitem>
70946 <para>
70947 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
70948 </para>
70949 <para revisionflag="changed">
70950 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
70951 may also be &#x2019;ed25519-sha256&#x2019;.
70952 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
70953 for EC keys.
70954 </para>
70955 <para revisionflag="changed">
70956 Note that RFC 8301 says:
70957 </para>
70958 <literallayout class="monospaced" revisionflag="changed">
70959 rsa-sha1 MUST NOT be used for signing or verifying.
70960
70961 DKIM signatures identified as having been signed with historic
70962 algorithms (currently, rsa-sha1) have permanently failed evaluation
70963 </literallayout>
70964 <para revisionflag="changed">
70965 To enforce this you must have a DKIM ACL which checks this variable
70966 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
70967 </para>
70968 </listitem></varlistentry>
70969 <varlistentry>
70970 <term><option>$dkim_canon_body</option></term>
70971 <listitem>
70972 <para>
70973 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
70974 </para>
70975 </listitem></varlistentry>
70976 <varlistentry>
70977 <term><option>$dkim_canon_headers</option></term>
70978 <listitem>
70979 <para>
70980 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
70981 </para>
70982 </listitem></varlistentry>
70983 <varlistentry>
70984 <term><option>$dkim_copiedheaders</option></term>
70985 <listitem>
70986 <para>
70987 A transcript of headers and their values which are included in the signature
70988 (copied from the &#x2019;z=&#x2019; tag of the signature).
70989 Note that RFC6376 requires that verification fail if the From: header is
70990 not included in the signature.  Exim does not enforce this; sites wishing
70991 strict enforcement should code the check explicitly.
70992 </para>
70993 </listitem></varlistentry>
70994 <varlistentry>
70995 <term><option>$dkim_bodylength</option></term>
70996 <listitem>
70997 <para>
70998 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
70999 limit was set by the signer, "9999999999999" is returned. This makes sure
71000 that this variable always expands to an integer value.
71001 </para>
71002 </listitem></varlistentry>
71003 <varlistentry>
71004 <term><option>$dkim_created</option></term>
71005 <listitem>
71006 <para>
71007 UNIX timestamp reflecting the date and time when the signature was created.
71008 When this was not specified by the signer, "0" is returned.
71009 </para>
71010 </listitem></varlistentry>
71011 <varlistentry>
71012 <term><option>$dkim_expires</option></term>
71013 <listitem>
71014 <para>
71015 UNIX timestamp reflecting the date and time when the signer wants the
71016 signature to be treated as "expired". When this was not specified by the
71017 signer, "9999999999999" is returned. This makes it possible to do useful
71018 integer size comparisons against this value.
71019 </para>
71020 <para revisionflag="changed">
71021 Note that Exim does not check this value.
71022 </para>
71023 </listitem></varlistentry>
71024 <varlistentry>
71025 <term><option>$dkim_headernames</option></term>
71026 <listitem>
71027 <para>
71028 A colon-separated list of names of headers included in the signature.
71029 </para>
71030 </listitem></varlistentry>
71031 <varlistentry>
71032 <term><option>$dkim_key_testing</option></term>
71033 <listitem>
71034 <para>
71035 "1" if the key record has the "testing" flag set, "0" if not.
71036 </para>
71037 </listitem></varlistentry>
71038 <varlistentry>
71039 <term><option>$dkim_key_nosubdomains</option></term>
71040 <listitem>
71041 <para>
71042 "1" if the key record forbids subdomaining, "0" otherwise.
71043 </para>
71044 </listitem></varlistentry>
71045 <varlistentry>
71046 <term><option>$dkim_key_srvtype</option></term>
71047 <listitem>
71048 <para>
71049 Service type (tag s=) from the key record. Defaults to "*" if not specified
71050 in the key record.
71051 </para>
71052 </listitem></varlistentry>
71053 <varlistentry>
71054 <term><option>$dkim_key_granularity</option></term>
71055 <listitem>
71056 <para>
71057 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
71058 in the key record.
71059 </para>
71060 </listitem></varlistentry>
71061 <varlistentry>
71062 <term><option>$dkim_key_notes</option></term>
71063 <listitem>
71064 <para>
71065 Notes from the key record (tag n=).
71066 </para>
71067 </listitem></varlistentry>
71068 <varlistentry>
71069 <term><option>$dkim_key_length</option></term>
71070 <listitem>
71071 <para>
71072 Number of bits in the key.
71073 </para>
71074 <para revisionflag="changed">
71075 Note that RFC 8301 says:
71076 </para>
71077 <literallayout class="monospaced" revisionflag="changed">
71078 Verifiers MUST NOT consider signatures using RSA keys of
71079 less than 1024 bits as valid signatures.
71080 </literallayout>
71081 <para revisionflag="changed">
71082 To enforce this you must have a DKIM ACL which checks this variable
71083 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
71084 As EC keys are much smaller, the check should only do this for RSA keys.
71085 </para>
71086 </listitem></varlistentry>
71087 </variablelist>
71088 <para>
71089 In addition, two ACL conditions are provided:
71090 </para>
71091 <variablelist>
71092 <varlistentry>
71093 <term><option>dkim_signers</option></term>
71094 <listitem>
71095 <para>
71096 ACL condition that checks a colon-separated list of domains or identities
71097 for a match against the domain or identity that the ACL is currently verifying
71098 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
71099 verb to a group of domains or identities. For example:
71100 </para>
71101 <literallayout class="monospaced">
71102 # Warn when Mail purportedly from GMail has no gmail signature
71103 warn log_message = GMail sender without gmail.com DKIM signature
71104      sender_domains = gmail.com
71105      dkim_signers = gmail.com
71106      dkim_status = none
71107 </literallayout>
71108 <para>
71109 Note that the above does not check for a total lack of DKIM signing;
71110 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
71111 </para>
71112 </listitem></varlistentry>
71113 <varlistentry>
71114 <term><option>dkim_status</option></term>
71115 <listitem>
71116 <para>
71117 ACL condition that checks a colon-separated list of possible DKIM verification
71118 results against the actual result of verification. This is typically used
71119 to restrict an ACL verb to a list of verification outcomes, for example:
71120 </para>
71121 <literallayout class="monospaced">
71122 deny message = Mail from Paypal with invalid/missing signature
71123      sender_domains = paypal.com:paypal.de
71124      dkim_signers = paypal.com:paypal.de
71125      dkim_status = none:invalid:fail
71126 </literallayout>
71127 <para>
71128 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
71129 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
71130 for more information of what they mean.
71131 </para>
71132 </listitem></varlistentry>
71133 </variablelist>
71134 </section>
71135 <section id="SECSPF" revisionflag="changed">
71136 <title>SPF (Sender Policy Framework)</title>
71137 <para revisionflag="changed">
71138 <indexterm role="concept">
71139 <primary>SPF</primary>
71140 <secondary>verification</secondary>
71141 </indexterm>
71142 </para>
71143 <para revisionflag="changed">
71144 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
71145 messages with its domain in the envelope from, documented by RFC 7208.
71146 For more information on SPF see <emphasis role="bold"><ulink url="http://www.openspf.org">http://www.openspf.org</ulink></emphasis>.
71147 </para>
71148 <para revisionflag="changed">
71149 Messages sent by a system not authorised will fail checking of such assertions.
71150 This includes retransmissions done by traditional forwarders.
71151 </para>
71152 <para revisionflag="changed">
71153 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
71154 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
71155 <emphasis role="bold"><ulink url="http://www.libspf2.org/">http://www.libspf2.org/</ulink></emphasis>.
71156 There is no Exim involvement in the transmission of messages;
71157 publishing certain DNS records is all that is required.
71158 </para>
71159 <para revisionflag="changed">
71160 For verification, an ACL condition and an expansion lookup are provided.
71161 </para>
71162 <para revisionflag="changed">
71163 <indexterm role="concept">
71164 <primary>authentication</primary>
71165 <secondary>expansion item</secondary>
71166 </indexterm>
71167 Performing verification sets up information used by the
71168 <varname>$authresults</varname> expansion item.
71169 </para>
71170 <para>
71171 <indexterm role="concept">
71172 <primary>SPF</primary>
71173 <secondary>ACL condition</secondary>
71174 </indexterm>
71175 <indexterm role="concept">
71176 <primary>ACL</primary>
71177 <secondary>spf condition</secondary>
71178 </indexterm>
71179 The ACL condition "spf" can be used at or after the MAIL ACL.
71180 It takes as an argument a list of strings giving the outcome of the SPF check,
71181 and will succeed for any matching outcome.
71182 Valid strings are:
71183 </para>
71184 <variablelist>
71185 <varlistentry>
71186 <term><option>pass</option></term>
71187 <listitem>
71188 <para>
71189 The SPF check passed, the sending host is positively verified by SPF.
71190 </para>
71191 </listitem></varlistentry>
71192 <varlistentry>
71193 <term><option>fail</option></term>
71194 <listitem>
71195 <para>
71196 The SPF check failed, the sending host is NOT allowed to send mail for the
71197 domain in the envelope-from address.
71198 </para>
71199 </listitem></varlistentry>
71200 <varlistentry>
71201 <term><option>softfail</option></term>
71202 <listitem>
71203 <para>
71204 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
71205 is a forgery.
71206 </para>
71207 </listitem></varlistentry>
71208 <varlistentry>
71209 <term><option>none</option></term>
71210 <listitem>
71211 <para>
71212 The queried domain does not publish SPF records.
71213 </para>
71214 </listitem></varlistentry>
71215 <varlistentry>
71216 <term><option>neutral</option></term>
71217 <listitem>
71218 <para>
71219 The SPF check returned a "neutral" state.  This means the queried domain has
71220 published a SPF record, but wants to allow outside servers to send mail under
71221 its domain as well.  This should be treated like "none".
71222 </para>
71223 </listitem></varlistentry>
71224 <varlistentry>
71225 <term><option>permerror</option></term>
71226 <listitem>
71227 <para>
71228 This indicates a syntax error in the SPF record of the queried domain.
71229 You may deny messages when this occurs.
71230 </para>
71231 </listitem></varlistentry>
71232 <varlistentry>
71233 <term><option>temperror</option></term>
71234 <listitem>
71235 <para>
71236 This indicates a temporary error during all processing, including Exim&#x2019;s
71237 SPF processing.  You may defer messages when this occurs.
71238 </para>
71239 </listitem></varlistentry>
71240 </variablelist>
71241 <para>
71242 You can prefix each string with an exclamation mark to  invert
71243 its meaning,  for example  "!fail" will  match all  results but
71244 "fail".  The  string  list is  evaluated  left-to-right,  in a
71245 short-circuit fashion.
71246 </para>
71247 <para>
71248 Example:
71249 </para>
71250 <literallayout class="monospaced">
71251 deny spf = fail
71252      message = $sender_host_address is not allowed to send mail from \
71253                ${if def:sender_address_domain \
71254                     {$sender_address_domain}{$sender_helo_name}}.  \
71255                Please see http://www.openspf.org/Why?scope=\
71256                ${if def:sender_address_domain {mfrom}{helo}};\
71257                identity=${if def:sender_address_domain \
71258                              {$sender_address}{$sender_helo_name}};\
71259                ip=$sender_host_address
71260 </literallayout>
71261 <para>
71262 When the spf condition has run, it sets up several expansion
71263 variables:
71264 </para>
71265 <para>
71266 <indexterm role="concept">
71267 <primary>SPF</primary>
71268 <secondary>verification variables</secondary>
71269 </indexterm>
71270 </para>
71271 <variablelist>
71272 <varlistentry>
71273 <term><varname>$spf_header_comment</varname></term>
71274 <listitem>
71275 <para>
71276 <indexterm role="variable">
71277 <primary><varname>$spf_header_comment</varname></primary>
71278 </indexterm>
71279   This contains a human-readable string describing the outcome
71280   of the SPF check. You can add it to a custom header or use
71281   it for logging purposes.
71282 </para>
71283 </listitem></varlistentry>
71284 <varlistentry>
71285 <term><varname>$spf_received</varname></term>
71286 <listitem>
71287 <para>
71288 <indexterm role="variable">
71289 <primary><varname>$spf_received</varname></primary>
71290 </indexterm>
71291   This contains a complete Received-SPF: header that can be
71292   added to the message. Please note that according to the SPF
71293   draft, this header must be added at the top of the header
71294   list. Please see section 10 on how you can do this.
71295 </para>
71296 <para>
71297   Note: in case of "Best-guess" (see below), the convention is
71298   to put this string in a header called X-SPF-Guess: instead.
71299 </para>
71300 </listitem></varlistentry>
71301 <varlistentry>
71302 <term><varname>$spf_result</varname></term>
71303 <listitem>
71304 <para>
71305 <indexterm role="variable">
71306 <primary><varname>$spf_result</varname></primary>
71307 </indexterm>
71308   This contains the outcome of the SPF check in string form,
71309   one of pass, fail, softfail, none, neutral, permerror or
71310   temperror.
71311 </para>
71312 </listitem></varlistentry>
71313 <varlistentry>
71314 <term><varname>$spf_result_guessed</varname></term>
71315 <listitem>
71316 <para>
71317 <indexterm role="variable">
71318 <primary><varname>$spf_result_guessed</varname></primary>
71319 </indexterm>
71320   This boolean is true only if a best-guess operation was used
71321   and required in order to obtain a result.
71322 </para>
71323 </listitem></varlistentry>
71324 <varlistentry>
71325 <term><varname>$spf_smtp_comment</varname></term>
71326 <listitem>
71327 <para>
71328 <indexterm role="variable">
71329 <primary><varname>$spf_smtp_comment</varname></primary>
71330 </indexterm>
71331   This contains a string that can be used in a SMTP response
71332   to the calling party. Useful for "fail".
71333 </para>
71334 </listitem></varlistentry>
71335 </variablelist>
71336 <para>
71337 <indexterm role="concept">
71338 <primary>SPF</primary>
71339 <secondary>ACL condition</secondary>
71340 </indexterm>
71341 <indexterm role="concept">
71342 <primary>ACL</primary>
71343 <secondary>spf_guess condition</secondary>
71344 </indexterm>
71345 <indexterm role="concept">
71346 <primary>SPF</primary>
71347 <secondary>best guess</secondary>
71348 </indexterm>
71349 In addition to SPF, you can also perform checks for so-called
71350 "Best-guess".  Strictly speaking, "Best-guess" is not standard
71351 SPF, but it is supported by the same framework that enables SPF
71352 capability.
71353 Refer to <emphasis role="bold"><ulink url="http://www.openspf.org/FAQ/Best_guess_record">http://www.openspf.org/FAQ/Best_guess_record</ulink></emphasis>
71354 for a description of what it means.
71355 </para>
71356 <para>
71357 To access this feature, simply use the spf_guess condition in place
71358 of the spf one.  For example:
71359 </para>
71360 <literallayout class="monospaced">
71361 deny spf_guess = fail
71362      message = $sender_host_address doesn't look trustworthy to me
71363 </literallayout>
71364 <para>
71365 In case you decide to reject messages based on this check, you
71366 should note that although it uses the same framework, "Best-guess"
71367 is not SPF, and therefore you should not mention SPF at all in your
71368 reject message.
71369 </para>
71370 <para>
71371 When the spf_guess condition has run, it sets up the same expansion
71372 variables as when spf condition is run, described above.
71373 </para>
71374 <para>
71375 Additionally, since Best-guess is not standardized, you may redefine
71376 what "Best-guess" means to you by redefining the main configuration
71377 <option>spf_guess</option> option.
71378 For example, the following:
71379 </para>
71380 <literallayout class="monospaced">
71381 spf_guess = v=spf1 a/16 mx/16 ptr ?all
71382 </literallayout>
71383 <para>
71384 would relax host matching rules to a broader network range.
71385 </para>
71386 <para>
71387 <indexterm role="concept">
71388 <primary>SPF</primary>
71389 <secondary>lookup expansion</secondary>
71390 </indexterm>
71391 <indexterm role="concept">
71392 <primary>lookup</primary>
71393 <secondary>spf</secondary>
71394 </indexterm>
71395 A lookup expansion is also available. It takes an email
71396 address as the key and an IP address as the database:
71397 </para>
71398 <literallayout class="monospaced">
71399   ${lookup {username@domain} spf {ip.ip.ip.ip}}
71400 </literallayout>
71401 <para>
71402 The lookup will return the same result strings as can appear in
71403 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
71404 Currently, only IPv4 addresses are supported.
71405 </para>
71406 </section>
71407 </chapter>
71408
71409 <chapter id="CHAPproxies">
71410 <title>Proxies</title>
71411 <titleabbrev>Proxy support</titleabbrev>
71412 <para>
71413 <indexterm role="concept">
71414 <primary>proxy support</primary>
71415 </indexterm>
71416 <indexterm role="concept">
71417 <primary>proxy</primary>
71418 <secondary>access via</secondary>
71419 </indexterm>
71420 </para>
71421 <para>
71422 A proxy is an intermediate system through which communication is passed.
71423 Proxies may provide a security, availability or load-distribution function.
71424 </para>
71425 <section id="SECTproxyInbound">
71426 <title>Inbound proxies</title>
71427 <para>
71428 <indexterm role="concept">
71429 <primary>proxy</primary>
71430 <secondary>inbound</secondary>
71431 </indexterm>
71432 <indexterm role="concept">
71433 <primary>proxy</primary>
71434 <secondary>server side</secondary>
71435 </indexterm>
71436 <indexterm role="concept">
71437 <primary>proxy</primary>
71438 <secondary>Proxy protocol</secondary>
71439 </indexterm>
71440 <indexterm role="concept">
71441 <primary>Proxy protocol</primary>
71442 <secondary>proxy</secondary>
71443 </indexterm>
71444 </para>
71445 <para>
71446 Exim has support for receiving inbound SMTP connections via a proxy
71447 that uses <quote>Proxy Protocol</quote> to speak to it.
71448 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
71449 in Local/Makefile.
71450 </para>
71451 <para>
71452 It was built on specifications from:
71453 (<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>).
71454 That URL was revised in May 2014 to version 2 spec:
71455 (<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>).
71456 </para>
71457 <para>
71458 The purpose of this facility is so that an application load balancer,
71459 such as HAProxy, can sit in front of several Exim servers
71460 to distribute load.
71461 Exim uses the local protocol communication with the proxy to obtain
71462 the remote SMTP system IP address and port information.
71463 There is no logging if a host passes or
71464 fails Proxy Protocol negotiation, but it can easily be determined and
71465 recorded in an ACL (example is below).
71466 </para>
71467 <para>
71468 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
71469 main configuration option to a hostlist; connections from these
71470 hosts will use Proxy Protocol.
71471 Exim supports both version 1 and version 2 of the Proxy Protocol and
71472 automatically determines which version is in use.
71473 </para>
71474 <para>
71475 The Proxy Protocol header is the first data received on a TCP connection
71476 and is inserted before any TLS-on-connect handshake from the client; Exim
71477 negotiates TLS between Exim-as-server and the remote client, not between
71478 Exim and the proxy server.
71479 </para>
71480 <para>
71481 The following expansion variables are usable
71482 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
71483 of the proxy):
71484 </para>
71485 <literallayout>
71486 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
71487 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
71488 <emphasis>proxy_local_address      </emphasis> IP of proxy server inbound or IP of local interface of proxy
71489 <emphasis>proxy_local_port         </emphasis> Port of proxy server inbound or Port on local interface of proxy
71490 <emphasis>proxy_session            </emphasis> boolean: SMTP connection via proxy
71491 </literallayout>
71492 <para>
71493 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
71494 there was a protocol error.
71495 </para>
71496 <para>
71497 Since the real connections are all coming from the proxy, and the
71498 per host connection tracking is done before Proxy Protocol is
71499 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
71500 handle all of the parallel volume you expect per inbound proxy.
71501 With the option set so high, you lose the ability
71502 to protect your server from many connections from one IP.
71503 In order to prevent your server from overload, you
71504 need to add a per connection ratelimit to your connect ACL.
71505 A possible solution is:
71506 </para>
71507 <literallayout>
71508   # Set max number of connections per host
71509   LIMIT   = 5
71510   # Or do some kind of IP lookup in a flat file or database
71511   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
71512
71513   defer   message        = Too many connections from this IP right now
71514           ratelimit      = LIMIT / 5s / per_conn / strict
71515 </literallayout>
71516 </section>
71517 <section id="SECTproxySOCKS">
71518 <title>Outbound proxies</title>
71519 <para>
71520 <indexterm role="concept">
71521 <primary>proxy</primary>
71522 <secondary>outbound</secondary>
71523 </indexterm>
71524 <indexterm role="concept">
71525 <primary>proxy</primary>
71526 <secondary>client side</secondary>
71527 </indexterm>
71528 <indexterm role="concept">
71529 <primary>proxy</primary>
71530 <secondary>SOCKS</secondary>
71531 </indexterm>
71532 <indexterm role="concept">
71533 <primary>SOCKS</primary>
71534 <secondary>proxy</secondary>
71535 </indexterm>
71536 Exim has support for sending outbound SMTP via a proxy
71537 using a protocol called SOCKS5 (defined by RFC1928).
71538 The support can be optionally included by defining SUPPORT_SOCKS=yes in
71539 Local/Makefile.
71540 </para>
71541 <para>
71542 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
71543 on an smtp transport.
71544 The option value is expanded and should then be a list
71545 (colon-separated by default) of proxy specifiers.
71546 Each proxy specifier is a list
71547 (space-separated by default) where the initial element
71548 is an IP address and any subsequent elements are options.
71549 </para>
71550 <para>
71551 Options are a string &lt;name&gt;=&lt;value&gt;.
71552 The list of options is in the following table:
71553 </para>
71554 <literallayout>
71555 <emphasis>auth   </emphasis> authentication method
71556 <emphasis>name   </emphasis> authentication username
71557 <emphasis>pass   </emphasis> authentication password
71558 <emphasis>port   </emphasis> tcp port
71559 <emphasis>tmo    </emphasis> connection timeout
71560 <emphasis>pri    </emphasis> priority
71561 <emphasis>weight </emphasis> selection bias
71562 </literallayout>
71563 <para>
71564 More details on each of these options follows:
71565 </para>
71566 <itemizedlist>
71567 <listitem>
71568 <para>
71569 <indexterm role="concept">
71570 <primary>authentication</primary>
71571 <secondary>to proxy</secondary>
71572 </indexterm>
71573 <indexterm role="concept">
71574 <primary>proxy</primary>
71575 <secondary>authentication</secondary>
71576 </indexterm>
71577 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
71578 Using <quote>name</quote> selects username/password authentication per RFC 1929
71579 for access to the proxy.
71580 Default is <quote>none</quote>.
71581 </para>
71582 </listitem>
71583 <listitem>
71584 <para>
71585 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
71586 Default is empty.
71587 </para>
71588 </listitem>
71589 <listitem>
71590 <para>
71591 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
71592 Default is empty.
71593 </para>
71594 </listitem>
71595 <listitem>
71596 <para>
71597 <option>port</option>: the TCP port number to use for the connection to the proxy.
71598 Default is 1080.
71599 </para>
71600 </listitem>
71601 <listitem>
71602 <para>
71603 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
71604 Default is 5.
71605 </para>
71606 </listitem>
71607 <listitem>
71608 <para>
71609 <option>pri</option>: specifies a priority for the proxy within the list,
71610 higher values being tried first.
71611 The default priority is 1.
71612 </para>
71613 </listitem>
71614 <listitem>
71615 <para>
71616 <option>weight</option>: specifies a selection bias.
71617 Within a priority set servers are queried in a random fashion,
71618 weighted by this value.
71619 The default value for selection bias is 1.
71620 </para>
71621 </listitem>
71622 </itemizedlist>
71623 <para>
71624 Proxies from the list are tried according to their priority
71625 and weight settings until one responds.  The timeout for the
71626 overall connection applies to the set of proxied attempts.
71627 </para>
71628 </section>
71629 <section id="SECTproxyLog">
71630 <title>Logging</title>
71631 <para>
71632 To log the (local) IP of a proxy in the incoming or delivery logline,
71633 add <quote>+proxy</quote> to the <option>log_selector</option> option.
71634 This will add a component tagged with <quote>PRX=</quote> to the line.
71635 </para>
71636 </section>
71637 </chapter>
71638
71639 <chapter id="CHAPi18n">
71640 <title>Internationalisation</title>
71641 <titleabbrev>Internationalisation"</titleabbrev>
71642 <para>
71643 <indexterm role="concept">
71644 <primary>internationalisation</primary>
71645 <secondary>email address</secondary>
71646 </indexterm>
71647 <indexterm role="concept">
71648 <primary>EAI</primary>
71649 </indexterm>
71650 <indexterm role="concept">
71651 <primary>i18n</primary>
71652 </indexterm>
71653 <indexterm role="concept">
71654 <primary>utf8</primary>
71655 <secondary>mail name handling</secondary>
71656 </indexterm>
71657 </para>
71658 <para>
71659 Exim has support for Internationalised mail names.
71660 To include this it must be built with SUPPORT_I18N and the libidn library.
71661 Standards supported are RFCs 2060, 5890, 6530 and 6533.
71662 </para>
71663 <para>
71664 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
71665 instead of it) then IDNA2008 is supported; this adds an extra library
71666 requirement, upon libidn2.
71667 </para>
71668 <section id="SECTi18nMTA">
71669 <title>MTA operations</title>
71670 <para>
71671 <indexterm role="concept">
71672 <primary>SMTPUTF8</primary>
71673 <secondary>ESMTP option</secondary>
71674 </indexterm>
71675 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
71676 a host list.  If this matches the sending host and
71677 accept_8bitmime is true (the default) then the ESMTP option
71678 SMTPUTF8 will be advertised.
71679 </para>
71680 <para>
71681 If the sender specifies the SMTPUTF8 option on a MAIL command
71682 international handling for the message is enabled and
71683 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
71684 </para>
71685 <para>
71686 The option <option>allow_utf8_domains</option> is set to true for this
71687 message. All DNS lookups are converted to a-label form
71688 whatever the setting of <option>allow_utf8_domains</option>
71689 when Exim is built with SUPPORT_I18N.
71690 </para>
71691 <para>
71692 Both localparts and domain are maintained as the original
71693 UTF-8 form internally; any comparison or regular-expression use will
71694 require appropriate care.  Filenames created, eg. by
71695 the appendfile transport, will have UTF-8 names.
71696 </para>
71697 <para>
71698 HELO names sent by the smtp transport will have any UTF-8
71699 components expanded to a-label form,
71700 and any certificate name checks will be done using the a-label
71701 form of the name.
71702 </para>
71703 <para>
71704 <indexterm role="concept">
71705 <primary>log</primary>
71706 <secondary>protocol</secondary>
71707 </indexterm>
71708 <indexterm role="concept">
71709 <primary>SMTPUTF8</primary>
71710 <secondary>logging</secondary>
71711 </indexterm>
71712 <indexterm role="concept">
71713 <primary>i18n</primary>
71714 <secondary>logging</secondary>
71715 </indexterm>
71716 Log lines and Received-by: header lines will acquire a "utf8"
71717 prefix on the protocol element, eg. utf8esmtp.
71718 </para>
71719 <para>
71720 The following expansion operators can be used:
71721 </para>
71722 <literallayout class="monospaced">
71723 ${utf8_domain_to_alabel:str}
71724 ${utf8_domain_from_alabel:str}
71725 ${utf8_localpart_to_alabel:str}
71726 ${utf8_localpart_from_alabel:str}
71727 </literallayout>
71728 <para>
71729 <indexterm role="concept">
71730 <primary>utf8</primary>
71731 <secondary>address downconversion</secondary>
71732 </indexterm>
71733 <indexterm role="concept">
71734 <primary>i18n</primary>
71735 <secondary>utf8 address downconversion</secondary>
71736 </indexterm>
71737 </para>
71738 <para revisionflag="changed">
71739 The RCPT ACL
71740 </para>
71741 <para>
71742 may use the following modifier:
71743 </para>
71744 <literallayout>
71745 control = utf8_downconvert
71746 control = utf8_downconvert/&lt;value&gt;
71747 </literallayout>
71748 <para>
71749 This sets a flag requiring that addresses are converted to
71750 a-label form before smtp delivery, for use in a
71751 Message Submission Agent context.
71752 If a value is appended it may be:
71753 </para>
71754 <literallayout>
71755 <literal>1  </literal> (default) mandatory downconversion
71756 <literal>0  </literal> no downconversion
71757 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
71758 </literallayout>
71759 <para>
71760 If mua_wrapper is set, the utf8_downconvert control
71761 is initially set to -1.
71762 </para>
71763 <para>
71764 There is no explicit support for VRFY and EXPN.
71765 Configurations supporting these should inspect
71766 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
71767 </para>
71768 <para>
71769 There is no support for LMTP on Unix sockets.
71770 Using the "lmtp" protocol option on an smtp transport,
71771 for LMTP over TCP, should work as expected.
71772 </para>
71773 <para>
71774 There is no support for DSN unitext handling,
71775 and no provision for converting logging from or to UTF-8.
71776 </para>
71777 </section>
71778 <section id="SECTi18nMDA">
71779 <title>MDA operations</title>
71780 <para>
71781 To aid in constructing names suitable for IMAP folders
71782 the following expansion operator can be used:
71783 </para>
71784 <literallayout class="monospaced">
71785 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
71786 </literallayout>
71787 <para>
71788 The string is converted from the charset specified by
71789 the "headers charset" command (in a filter file)
71790 or <option>headers_charset</option> main configuration option (otherwise),
71791 to the
71792 modified UTF-7 encoding specified by RFC 2060,
71793 with the following exception: All occurrences of &lt;sep&gt;
71794 (which has to be a single character)
71795 are replaced with periods ("."), and all periods and slashes that are not
71796 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
71797 </para>
71798 <para>
71799 The third argument can be omitted, defaulting to an empty string.
71800 The second argument can be omitted, defaulting to "/".
71801 </para>
71802 <para>
71803 This is the encoding used by Courier for Maildir names on disk, and followed
71804 by many other IMAP servers.
71805 </para>
71806 <para>
71807 Examples:
71808 </para>
71809 <literallayout>
71810 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
71811 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
71812 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
71813 </literallayout>
71814 <para>
71815 Note that the source charset setting is vital, and also that characters
71816 must be representable in UTF-16.
71817 </para>
71818 </section>
71819 </chapter>
71820
71821 <chapter id="CHAPevents">
71822 <title>Events</title>
71823 <titleabbrev>Events</titleabbrev>
71824 <para>
71825 <indexterm role="concept">
71826 <primary>events</primary>
71827 </indexterm>
71828 </para>
71829 <para>
71830 The events mechanism in Exim can be used to intercept processing at a number
71831 of points.  It was originally invented to give a way to do customised logging
71832 actions (for example, to a database) but can also be used to modify some
71833 processing actions.
71834 </para>
71835 <para>
71836 Most installations will never need to use Events.
71837 The support can be left out of a build by defining DISABLE_EVENT=yes
71838 in <filename>Local/Makefile</filename>.
71839 </para>
71840 <para>
71841 There are two major classes of events: main and transport.
71842 The main configuration option <option>event_action</option> controls reception events;
71843 a transport option <option>event_action</option> controls delivery events.
71844 </para>
71845 <para>
71846 Both options are a string which is expanded when the event fires.
71847 An example might look like:
71848 <indexterm role="concept">
71849 <primary>logging</primary>
71850 <secondary>custom</secondary>
71851 </indexterm>
71852 </para>
71853 <literallayout class="monospaced">
71854 event_action = ${if eq {msg:delivery}{$event_name} \
71855 {${lookup pgsql {SELECT * FROM record_Delivery( \
71856     '${quote_pgsql:$sender_address_domain}',\
71857     '${quote_pgsql:${lc:$sender_address_local_part}}', \
71858     '${quote_pgsql:$domain}', \
71859     '${quote_pgsql:${lc:$local_part}}', \
71860     '${quote_pgsql:$host_address}', \
71861     '${quote_pgsql:${lc:$host}}', \
71862     '${quote_pgsql:$message_exim_id}')}} \
71863 } {}}
71864 </literallayout>
71865 <para>
71866 Events have names which correspond to the point in process at which they fire.
71867 The name is placed in the variable <varname>$event_name</varname> and the event action
71868 expansion must check this, as it will be called for every possible event type.
71869 </para>
71870 <para>
71871 The current list of events is:
71872 </para>
71873 <literallayout>
71874 <literal>dane:fail              after    transport  </literal> per connection
71875 <literal>msg:complete           after    main       </literal> per message
71876 <literal>msg:delivery           after    transport  </literal> per recipient
71877 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
71878 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
71879 <literal>msg:host:defer         after    transport  </literal> per attempt
71880 <literal>msg:fail:delivery      after    transport  </literal> per recipient
71881 <literal>msg:fail:internal      after    main       </literal> per recipient
71882 <literal>tcp:connect            before   transport  </literal> per connection
71883 <literal>tcp:close              after    transport  </literal> per connection
71884 <literal>tls:cert               before   both       </literal> per certificate in verification chain
71885 <literal>smtp:connect           after    transport  </literal> per connection
71886 </literallayout>
71887 <para>
71888 New event types may be added in future.
71889 </para>
71890 <para>
71891 The event name is a colon-separated list, defining the type of
71892 event in a tree of possibilities.  It may be used as a list
71893 or just matched on as a whole.  There will be no spaces in the name.
71894 </para>
71895 <para>
71896 The second column in the table above describes whether the event fires
71897 before or after the action is associates with.  Those which fire before
71898 can be used to affect that action (more on this below).
71899 </para>
71900 <para>
71901 The third column in the table above says what section of the configuration
71902 should define the event action.
71903 </para>
71904 <para>
71905 An additional variable, <varname>$event_data</varname>, is filled with information varying
71906 with the event type:
71907 </para>
71908 <literallayout>
71909 <literal>dane:fail            </literal> failure reason
71910 <literal>msg:delivery         </literal> smtp confirmation message
71911 <literal>msg:rcpt:host:defer  </literal> error string
71912 <literal>msg:rcpt:defer       </literal> error string
71913 <literal>msg:host:defer       </literal> error string
71914 <literal>tls:cert             </literal> verification chain depth
71915 <literal>smtp:connect         </literal> smtp banner
71916 </literallayout>
71917 <para>
71918 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
71919 </para>
71920 <para>
71921 For complex operations an ACL expansion can be used in <option>event_action</option>
71922 however due to the multiple contexts that Exim operates in during
71923 the course of its processing:
71924 </para>
71925 <itemizedlist>
71926 <listitem>
71927 <para>
71928 variables set in transport events will not be visible outside that
71929 transport call
71930 </para>
71931 </listitem>
71932 <listitem>
71933 <para>
71934 acl_m variables in a server context are lost on a new connection,
71935 and after smtp helo/ehlo/mail/starttls/rset commands
71936 </para>
71937 </listitem>
71938 </itemizedlist>
71939 <para>
71940 Using an ACL expansion with the logwrite modifier can be
71941 a useful way of writing to the main log.
71942 </para>
71943 <para>
71944 The expansion of the event_action option should normally
71945 return an empty string.  Should it return anything else the
71946 following will be forced:
71947 </para>
71948 <literallayout>
71949 <literal>tcp:connect      </literal>  do not connect
71950 <literal>tls:cert         </literal>  refuse verification
71951 <literal>smtp:connect     </literal>  close connection
71952 </literallayout>
71953 <para>
71954 All other message types ignore the result string, and
71955 no other use is made of it.
71956 </para>
71957 <para>
71958 For a tcp:connect event, if the connection is being made to a proxy
71959 then the address and port variables will be that of the proxy and not
71960 the target system.
71961 </para>
71962 <para>
71963 For tls:cert events, if GnuTLS is in use this will trigger only per
71964 chain element received on the connection.
71965 For OpenSSL it will trigger for every chain element including those
71966 loaded locally.
71967 </para>
71968 </chapter>
71969
71970 <chapter id="CHID13">
71971 <title>Adding new drivers or lookup types</title>
71972 <titleabbrev>Adding drivers or lookups</titleabbrev>
71973 <para>
71974 <indexterm role="concept">
71975 <primary>adding drivers</primary>
71976 </indexterm>
71977 <indexterm role="concept">
71978 <primary>new drivers, adding</primary>
71979 </indexterm>
71980 <indexterm role="concept">
71981 <primary>drivers</primary>
71982 <secondary>adding new</secondary>
71983 </indexterm>
71984 The following actions have to be taken in order to add a new router, transport,
71985 authenticator, or lookup type to Exim:
71986 </para>
71987 <orderedlist numeration="arabic">
71988 <listitem>
71989 <para>
71990 Choose a name for the driver or lookup type that does not conflict with any
71991 existing name; I will use <quote>newdriver</quote> in what follows.
71992 </para>
71993 </listitem>
71994 <listitem>
71995 <para>
71996 Add to <filename>src/EDITME</filename> the line:
71997 </para>
71998 <literallayout>
71999 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
72000 </literallayout>
72001 <para>
72002 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
72003 code is not to be included in the binary by default, comment this line out. You
72004 should also add any relevant comments about the driver or lookup type.
72005 </para>
72006 </listitem>
72007 <listitem>
72008 <para>
72009 Add to <filename>src/config.h.defaults</filename> the line:
72010 </para>
72011 <literallayout class="monospaced">
72012 #define &lt;type&gt;_NEWDRIVER
72013 </literallayout>
72014 </listitem>
72015 <listitem>
72016 <para>
72017 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
72018 and create a table entry as is done for all the other drivers and lookup types.
72019 </para>
72020 </listitem>
72021 <listitem>
72022 <para>
72023 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
72024 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
72025 Add your <literal>NEWDRIVER</literal> to that list.
72026 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
72027 simple form that most lookups have.
72028 </para>
72029 </listitem>
72030 <listitem>
72031 <para>
72032 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
72033 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
72034 driver or lookup type and add it to the definition of OBJ.
72035 </para>
72036 </listitem>
72037 <listitem>
72038 <para>
72039 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
72040 <filename>src</filename>.
72041 </para>
72042 </listitem>
72043 <listitem>
72044 <para>
72045 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
72046 as for other drivers and lookups.
72047 </para>
72048 </listitem>
72049 </orderedlist>
72050 <para>
72051 Then all you need to do is write the code! A good way to start is to make a
72052 proforma by copying an existing module of the same type, globally changing all
72053 occurrences of the name, and cutting out most of the code. Note that any
72054 options you create must be listed in alphabetical order, because the tables are
72055 searched using a binary chop procedure.
72056 </para>
72057 <para>
72058 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
72059 the interface that is expected.
72060 </para>
72061 <?sdop
72062   format="newpage"
72063   foot_right_recto="&chaptertitle;"
72064   foot_right_verso="&chaptertitle;"
72065 ?>
72066 </chapter>
72067
72068 <index role="option">
72069 <title>Options index</title>
72070 </index>
72071
72072 <index role="variable">
72073 <title>Variables index</title>
72074 </index>
72075
72076 <index role="concept">
72077 <title>Concept index</title>
72078 </index>
72079
72080 </book>