X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/2b965a652edced91a1af8bb36a33d493f721db7d..c04cf318cb6c0ea42d2c3e37262ac68f282fdbe4:/doc/doc-docbook/spec.xfpt diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 6bf8bc75c..29214e3e1 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -1,26 +1,59 @@ -. $Cambridge: exim/doc/doc-docbook/spec.xfpt,v 1.4 2006/05/22 17:43:09 fanf2 Exp $ -. . ///////////////////////////////////////////////////////////////////////////// . This is the primary source of the Exim Manual. It is an xfpt document that is . converted into DocBook XML for subsequent conversion into printing and online . formats. The markup used herein is "standard" xfpt markup, with some extras. . The markup is summarized in a file called Markup.txt. +. +. WARNING: When you use the .new macro, make sure it appears *before* any +. adjacent index items; otherwise you get an empty "paragraph" which causes +. unwanted vertical space. . ///////////////////////////////////////////////////////////////////////////// .include stdflags .include stdmacs + +. ///////////////////////////////////////////////////////////////////////////// +. This outputs the standard DocBook boilerplate. +. ///////////////////////////////////////////////////////////////////////////// + .docbook + +. ///////////////////////////////////////////////////////////////////////////// +. These lines are processing instructions for the Simple DocBook Processor that +. Philip Hazel has developed as a less cumbersome way of making PostScript and +. PDFs than using xmlto and fop. They will be ignored by all other XML +. processors. +. ///////////////////////////////////////////////////////////////////////////// + +.literal xml + +.literal off + +. ///////////////////////////////////////////////////////////////////////////// +. This generate the outermost element that wraps then entire document. +. ///////////////////////////////////////////////////////////////////////////// + .book . ///////////////////////////////////////////////////////////////////////////// -. These definitions set some parameters and save some typing. Remember that -. the element must also be updated for each new edition. +. These definitions set some parameters and save some typing. +. Update the Copyright year (only) when changing content. . ///////////////////////////////////////////////////////////////////////////// +.set previousversion "4.80" +.include ./local_params + .set ACL "access control lists (ACLs)" -.set previousversion "4.61" -.set version "4.62" +.set I "    " +.macro copyyear +2012 +.endmacro . ///////////////////////////////////////////////////////////////////////////// . Additional xfpt markup used by this document, over and above the default @@ -38,11 +71,18 @@ .flag &!? "‡" . --- A macro for an Exim option definition heading, generating a one-line -. --- table with four columns. +. --- table with four columns. For cases when the option name is given with +. --- a space, so that it can be split, a fifth argument is used for the +. --- index entry. .macro option -.oindex "$1" -.itable all 0 0 4 8* left 5* center 5* center 6* right +.arg 5 +.oindex "&%$5%&" +.endarg +.arg -5 +.oindex "&%$1%&" +.endarg +.itable all 0 0 4 8* left 6* center 6* center 6* right .row "&%$1%&" "Use: &'$2'&" "Type: &'$3'&" "Default: &'$4'&" .endtable .endmacro @@ -51,14 +91,32 @@ . --- is suitable for the many tables at the start of the main options chapter; . --- the small number of other 2-column tables override it. -.macro table2 190pt 260pt +.macro table2 196pt 254pt .itable none 0 0 2 $1 left $2 left .endmacro -. --- Macros for the concept and option index entries. For a "range" style of -. --- entry, use .scindex for the start and .ecindex for the end. The first -. --- argument of .scindex and the only argument of .ecindex must be the ID -. --- that ties them together. +. --- A macro that generates .row, but puts &I; at the start of the first +. --- argument, thus indenting it. Assume a minimum of two arguments, and +. --- allow up to four arguments, which is as many as we'll ever need. + +.macro irow +.arg 4 +.row "&I;$1" "$2" "$3" "$4" +.endarg +.arg -4 +.arg 3 +.row "&I;$1" "$2" "$3" +.endarg +.arg -3 +.row "&I;$1" "$2" +.endarg +.endarg +.endmacro + +. --- Macros for option, variable, and concept index entries. For a "range" +. --- style of entry, use .scindex for the start and .ecindex for the end. The +. --- first argument of .scindex and the only argument of .ecindex must be the +. --- ID that ties them together. .macro cindex && @@ -91,8 +149,17 @@ && .endmacro +.macro vindex +&& +&&$1&& +.arg 2 +&&$2&& +.endarg +&& +.endmacro + .macro index -.echo "** Don't use .index; use .cindex or .oindex" +.echo "** Don't use .index; use .cindex or .oindex or .vindex" .endmacro . //////////////////////////////////////////////////////////////////////////// @@ -106,17 +173,23 @@ Specification of the Exim Mail Transfer Agent The Exim MTA -27 April 2006 -PhilipHazel -PH -University of Cambridge Computing Service -
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England
+ +.fulldate + +EximMaintainers +EM - 4.62 - 27 April 2006 - PH + +.version + + +.fulldate + + EM -2006University of Cambridge + +.copyyear + University of Cambridge
.literal off @@ -127,10 +200,10 @@ . at the top level, so we have to put the .chapter directive first. . ///////////////////////////////////////////////////////////////////////////// -.chapter "Introduction" +.chapter "Introduction" "CHID1" .literal xml - + $1, $2, etc. numerical variables @@ -191,7 +264,7 @@ maximum - limit + limit monitor @@ -300,10 +373,12 @@ systems. I am grateful to them all. The distribution now contains a file called contributors. -.section "Exim documentation" +.section "Exim documentation" "SECID1" +. Keep this example change bar when updating the documentation! + .new .cindex "documentation" -This edition of the Exim specification applies to version &version; of Exim. +This edition of the Exim specification applies to version &version() of Exim. Substantive changes from the &previousversion; edition are marked in some renditions of the document; this paragraph is so marked if the rendition is capable of showing a change indicator. @@ -321,7 +396,7 @@ very wide interest. .cindex "books about Exim" An &"easier"& discussion of Exim which provides more in-depth explanatory, introductory, and tutorial material can be found in a book entitled &'The Exim -SMTP Mail Server'&, published by UIT Cambridge +SMTP Mail Server'& (second edition, 2007), published by UIT Cambridge (&url(http://www.uit.co.uk/exim-book/)). This book also contains a chapter that gives a general introduction to SMTP and @@ -332,9 +407,7 @@ published by O'Reilly, covers Exim 3, and many things have changed in Exim 4.) .cindex "Debian" "information sources" If you are using a Debian distribution of Exim, you will find information about Debian-specific features in the file -.display -&_/usr/share/doc/exim4-base/README.Debian_& -.endd +&_/usr/share/doc/exim4-base/README.Debian_&. The command &(man update-exim.conf)& is another source of Debian-specific information. @@ -366,8 +439,6 @@ directory are: .row &_exim.8_& "a man page of Exim's command line options" .row &_experimental.txt_& "documentation of experimental features" .row &_filter.txt_& "specification of the filter language" -.row &_pcrepattern.txt_& "specification of PCRE regular expressions" -.row &_pcretest.txt_& "specification of the PCRE testing program" .row &_Exim3.upgrade_& "upgrade notes from release 2 to release 3" .row &_Exim4.upgrade_& "upgrade notes from release 3 to release 4" .endtable @@ -378,7 +449,7 @@ available in other formats (HTML, PostScript, PDF, and Texinfo). Section -.section "FTP and web sites" +.section "FTP and web sites" "SECID2" .cindex "web site" .cindex "FTP site" The primary site for Exim source distributions is currently the University of @@ -391,45 +462,55 @@ Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge. .cindex "wiki" .cindex "FAQ" As well as Exim distribution tar files, the Exim web site contains a number of -differently formatted versions of the documentation, including the FAQ in both -text and HTML formats. The HTML version comes with a keyword-in-context index. -A recent addition to the online information is the Exim wiki -(&url(http://www.exim.org/eximwiki/)). We hope that this will make it easier -for Exim users to contribute examples, tips, and know-how for the benefit of -others. +differently formatted versions of the documentation. A recent addition to the +online information is the Exim wiki (&url(http://wiki.exim.org)), +which contains what used to be a separate FAQ, as well as various other +examples, tips, and know-how that have been contributed by Exim users. + +.cindex Bugzilla +An Exim Bugzilla exists at &url(http://bugs.exim.org). You can use +this to report bugs, and also to add items to the wish list. Please search +first to check that you are not duplicating a previous entry. -.section "Mailing lists" +.section "Mailing lists" "SECID3" .cindex "mailing lists" "for Exim users" -The following are the three main Exim mailing lists: +The following Exim mailing lists exist: .table2 140pt -.row &'exim-users@exim.org'& "general discussion list" -.row &'exim-dev@exim.org'& "discussion of bugs, enhancements, etc." -.row &'exim-announce@exim.org'& "moderated, low volume announcements list" +.row &'exim-announce@exim.org'& "Moderated, low volume announcements list" +.row &'exim-users@exim.org'& "General discussion list" +.row &'exim-dev@exim.org'& "Discussion of bugs, enhancements, etc." +.row &'exim-cvs@exim.org'& "Automated commit messages from the VCS" .endtable You can subscribe to these lists, change your existing subscriptions, and view or search the archives via the mailing lists link on the Exim home page. .cindex "Debian" "mailing list for" If you are using a Debian distribution of Exim, you may wish to subscribe to -the Debian-specific mailing list &'pkg-exim4-users@lists.alioth.debian.org'&. +the Debian-specific mailing list &'pkg-exim4-users@lists.alioth.debian.org'& +via this web page: +.display +&url(http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users) +.endd +Please ask Debian-specific questions on this list and not on the general Exim +lists. -.section "Exim training" +.section "Exim training" "SECID4" .cindex "training courses" -From time to time (approximately annually at the time of writing), training -courses are run by the author of Exim in Cambridge, UK. Details of any -forthcoming courses can be found on the web site -&url(http://www-tus.csx.cam.ac.uk/courses/exim/). +Training courses in Cambridge (UK) used to be run annually by the author of +Exim, before he retired. At the time of writing, there are no plans to run +further Exim courses in Cambridge. However, if that changes, relevant +information will be posted at &url(http://www-tus.csx.cam.ac.uk/courses/exim/). - -.section "Bug reports" +.section "Bug reports" "SECID5" .cindex "bug reports" .cindex "reporting bugs" -Reports of obvious bugs should be emailed to &'bugs@exim.org'&. However, if you -are unsure whether some behaviour is a bug or not, the best thing to do is to -post a message to the &'exim-dev'& mailing list and have it discussed. +Reports of obvious bugs can be emailed to &'bugs@exim.org'& or reported +via the Bugzilla (&url(http://bugs.exim.org)). However, if you are unsure +whether some behaviour is a bug or not, the best thing to do is to post a +message to the &'exim-dev'& mailing list and have it discussed. @@ -463,13 +544,26 @@ The &_.bz2_& file is usually a lot smaller than the &_.gz_& file. .cindex "distribution" "signing details" .cindex "distribution" "public key" .cindex "public key for signed distribution" -The distributions are currently signed with Philip Hazel's GPG key. The -corresponding public key is available from a number of keyservers, and there is -also a copy in the file &_Public-Key_&. The signatures for the tar bundles are -in: +.new +The distributions will be PGP signed by an individual key of the Release +Coordinator. This key will have a uid containing an email address in the +&'exim.org'& domain and will have signatures from other people, including +other Exim maintainers. We expect that the key will be in the "strong set" of +PGP keys. There should be a trust path to that key from Nigel Metheringham's +PGP key, a version of which can be found in the release directory in the file +&_nigel-pubkey.asc_&. All keys used will be available in public keyserver pools, +such as &'pool.sks-keyservers.net'&. + +At time of last update, releases were being made by Phil Pennock and signed with +key &'0x403043153903637F'&, although that key is expected to be replaced in 2013. +A trust path from Nigel's key to Phil's can be observed at +&url(https://www.security.spodhuis.org/exim-trustpath). +.wen + +The signatures for the tar bundles are in: .display -&_exim-n.nn.tar.gz.sig_& -&_exim-n.nn.tar.bz2.sig_& +&_exim-n.nn.tar.gz.asc_& +&_exim-n.nn.tar.bz2.asc_& .endd For each released version, the log of changes is made separately available in a separate file in the directory &_ChangeLogs_& so that it is possible to @@ -487,37 +581,9 @@ inside the &_exim4_& directory of the FTP site: .endd These tar files contain only the &_doc_& directory, not the complete distribution, and are also available in &_.bz2_& as well as &_.gz_& forms. -.cindex "FAQ" -The FAQ is available for downloading in two different formats in these files: -.display -&_exim4/FAQ.txt.gz_& -&_exim4/FAQ.html.tar.gz_& -.endd -The first of these is a single ASCII file that can be searched with a text -editor. The second is a directory of HTML files, normally accessed by starting -at &_index.html_&. The HTML version of the FAQ (which is also included in the -HTML documentation tarbundle) includes a keyword-in-context index, which is -often the most convenient way of finding your way around. - - -.section "Wish list" -.cindex "wish list" -A wish list is maintained, containing ideas for new features that have been -submitted. From time to time the file is exported to the ftp site into the file -&_exim4/WishList_&. Items are removed from the list if they get implemented. - -.section "Contributed material" -.cindex "contributed material" -At the ftp site, there is a directory called &_Contrib_& that contains -miscellaneous files contributed to the Exim community by Exim users. There is -also a collection of contributed configuration examples in -&_exim4/config.samples.tar.gz_&. These samples are referenced from the FAQ. - - - -.section "Limitations" +.section "Limitations" "SECID6" .ilist .cindex "limitations of Exim" .cindex "bang paths" "not handled by Exim" @@ -557,7 +623,7 @@ a number of common scanners are provided. .endlist -.section "Run time configuration" +.section "Run time configuration" "SECID7" Exim's run time configuration is held in a single text file that is divided into a number of sections. The entries in this file consist of keywords and values, in the style of Smail 3 configuration files. A default configuration @@ -565,7 +631,7 @@ file which is suitable for simple online installations is provided in the distribution, and is described in chapter &<>& below. -.section "Calling interface" +.section "Calling interface" "SECID8" .cindex "Sendmail compatibility" "command line interface" Like many MTAs, Exim has adopted the Sendmail command line interface so that it can be a straight replacement for &_/usr/lib/sendmail_& or @@ -585,7 +651,7 @@ interface to Exim's command line administration options. -.section "Terminology" +.section "Terminology" "SECID9" .cindex "terminology definitions" .cindex "body of message" "definition of" The &'body'& of a message is the actual data that the sender wants to transmit. @@ -615,7 +681,7 @@ The word &'domain'& is sometimes used to mean all but the first component of a host's name. It is &'not'& used in that sense here, where it normally refers to the part of an email address following the @ sign. -.cindex "envelope" "definition of" +.cindex "envelope, definition of" .cindex "sender" "definition of" A message in transit has an associated &'envelope'&, as well as a header and a body. The envelope contains a sender address (to which bounce messages should @@ -624,7 +690,7 @@ sender or the recipients of a message usually mean the addresses in the envelope. An MTA uses these addresses for delivery, and for returning bounce messages, not the addresses that appear in the header lines. -.cindex "message header" "definition of" +.cindex "message" "header, definition of" .cindex "header section" "definition of" The &'header'& of a message is the first part of a message's text, consisting of a number of lines, each of which has a name such as &'From:'&, &'To:'&, @@ -639,7 +705,7 @@ part of an email address that precedes the @ sign. The part that follows the @ sign is called the &'domain'& or &'mail domain'&. .cindex "local delivery" "definition of" -.cindex "remote delivery" "definition of" +.cindex "remote delivery, definition of" The terms &'local delivery'& and &'remote delivery'& are used to distinguish delivery to a file or a pipe on the local host from delivery by SMTP over TCP/IP to another host. As far as Exim is concerned, all hosts other than the @@ -676,21 +742,22 @@ the Exim documentation, &"spool"& is always used in the first sense. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "Incorporated code" +.chapter "Incorporated code" "CHID2" .cindex "incorporated code" .cindex "regular expressions" "library" .cindex "PCRE" +.cindex "OpenDMARC" A number of pieces of external code are included in the Exim distribution. .ilist -Regular expressions are supported in the main Exim program and in the Exim -monitor using the freely-distributable PCRE library, copyright © -University of Cambridge. The source is distributed in the directory -&_src/pcre_&. However, this is a cut-down version of PCRE. If you want to use -the PCRE library in other programs, you should obtain and install the full -version from &url(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre). -.next -.cindex "cdb" "acknowledgement" +Regular expressions are supported in the main Exim program and in the +Exim monitor using the freely-distributable PCRE library, copyright +© University of Cambridge. The source to PCRE is no longer shipped with +Exim, so you will need to use the version of PCRE shipped with your system, +or obtain and install the full version of the library from +&url(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre). +.next +.cindex "cdb" "acknowledgment" Support for the cdb (Constant DataBase) lookup method is provided by code contributed by Nigel Metheringham of (at the time he contributed it) Planet Online Ltd. The implementation is completely contained within the code of Exim. @@ -704,12 +771,11 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This code implements Dan Bernstein's Constant DataBase (cdb) spec. Information, the spec and sample code for cdb can be obtained from -&url(http://www.pobox.com/~djb/cdb.html). This implementation borrows some -code from Dan Bernstein's implementation (which has no license restrictions -applied to it). +&url(http://www.pobox.com/~djb/cdb.html). This implementation borrows +some code from Dan Bernstein's implementation (which has no license +restrictions applied to it). .endblockquote .next .cindex "SPA authentication" @@ -774,7 +840,7 @@ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .endblockquote .next -.cindex "Exim monitor" "acknowledgement" +.cindex "Exim monitor" "acknowledgment" .cindex "X-windows" .cindex "Athena" The Exim Monitor program, which is an X-Window application, includes @@ -805,10 +871,18 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .endblockquote +.next +.cindex "opendmarc" "acknowledgment" +The DMARC implementation uses the OpenDMARC library which is Copyrighted by +The Trusted Domain Project. Portions of Exim source which use OpenDMARC +derived code are indicated in the respective source files. The full OpenDMARC +license is provided in the LICENSE.opendmarc file contained in the distributed +source code. + .next Many people have contributed code fragments, some large, some small, that were not covered by any specific licence requirements. It is assumed that the -contributors are happy to see their code incoporated into Exim under the GPL. +contributors are happy to see their code incorporated into Exim under the GPL. .endlist @@ -818,11 +892,11 @@ contributors are happy to see their code incoporated into Exim under the GPL. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "How Exim receives and delivers mail" "" &&& +.chapter "How Exim receives and delivers mail" "CHID11" &&& "Receiving and delivering mail" -.section "Overall philosophy" +.section "Overall philosophy" "SECID10" .cindex "design philosophy" Exim is designed to work efficiently on systems that are permanently connected to the Internet and are handling a general mix of mail. In such circumstances, @@ -832,7 +906,7 @@ it does try to send several messages in a single SMTP connection after a host has been down, and it also maintains per-host retry information. -.section "Policy control" +.section "Policy control" "SECID11" .cindex "policy control" "overview" Policy controls are now an important feature of MTAs that are connected to the Internet. Perhaps their most important job is to stop MTAs being abused as @@ -861,7 +935,7 @@ spam scanning software. The result of such a scan is passed back to the ACL, which can then use it to decide what to do with the message. .next When a message has been received, either from a remote host or from the local -host, but before the final acknowledgement has been sent, a locally supplied C +host, but before the final acknowledgment has been sent, a locally supplied C function called &[local_scan()]& can be run to inspect the message and decide whether to accept it or not (see chapter &<>&). If the message is accepted, the list of recipients can be modified by the function. @@ -877,7 +951,7 @@ runs at the start of every delivery process. -.section "User filters" +.section "User filters" "SECID12" .cindex "filter" "introduction" .cindex "Sieve filter" In a conventional Exim configuration, users are able to run private filters by @@ -935,7 +1009,7 @@ received the message. .next There are two different possibilities for the final two characters: .olist -.cindex "&%localhost_number%&" +.oindex "&%localhost_number%&" If &%localhost_number%& is not set, this value is the fractional part of the time of reception, normally in units of 1/2000 of a second, but for systems that must use base 36 instead of base 62 (because of case-insensitive file @@ -954,7 +1028,7 @@ pid, it is guaranteed that the time will be different. In most cases, the clock will already have ticked while the message was being received. -.section "Receiving mail" +.section "Receiving mail" "SECID13" .cindex "receiving mail" .cindex "message" "reception" The only way Exim can receive mail from another host is using SMTP over @@ -987,7 +1061,7 @@ in the same way as connections from other hosts. .endlist -.cindex "message sender" "constructed by Exim" +.cindex "message sender, constructed by Exim" .cindex "sender" "constructed by Exim" In the three cases that do not involve TCP/IP, the sender address is constructed from the login name of the user that called Exim and a default @@ -1020,7 +1094,7 @@ message is received. -.section "Handling an incoming message" +.section "Handling an incoming message" "SECID14" .cindex "spool directory" "files that hold a message" .cindex "file" "how a message is held" When Exim accepts a message, it writes two files in its spool directory. The @@ -1035,10 +1109,10 @@ By default all these message files are held in a single directory called not perform very well if the number of files in a directory gets large; to improve performance in such cases, the &%split_spool_directory%& option can be used. This causes Exim to split up the input files into 62 sub-directories -whose names are single letters or digits. &new("When this is done, the queue is +whose names are single letters or digits. When this is done, the queue is processed one sub-directory at a time instead of all at once, which can improve overall performance even when there are not enough files in each directory to -affect file system performance.") +affect file system performance. The envelope information consists of the address of the message's sender and the addresses of the recipients. This information is entirely separate from @@ -1061,7 +1135,7 @@ delivered (see chapters &<>& and -.section "Life of a message" +.section "Life of a message" "SECID15" .cindex "message" "life of" .cindex "message" "frozen" A message remains in the spool directory until it is completely delivered to @@ -1078,8 +1152,8 @@ corrected, and can also freeze individual messages by hand if necessary. In addition, an administrator can force a delivery error, causing a bounce message to be sent. -.cindex "&%timeout_frozen_after%&" -.cindex "&%ignore_bounce_errors_after%&" +.oindex "&%timeout_frozen_after%&" +.oindex "&%ignore_bounce_errors_after%&" There are options called &%ignore_bounce_errors_after%& and &%timeout_frozen_after%&, which discard frozen messages after a certain time. The first applies only to frozen bounces, the second to any frozen messages. @@ -1186,7 +1260,7 @@ the address is bounced. -.section "Processing an address for verification" +.section "Processing an address for verification" "SECID16" .cindex "router" "for verification" .cindex "verifying address" "overview" As well as being used to decide how to deliver to an address, Exim's routers @@ -1221,7 +1295,7 @@ the following: &'accept'&: The router accepts the address, and either assigns it to a transport, or generates one or more &"child"& addresses. Processing the original address ceases, -.cindex "&%unseen%& option" +.oindex "&%unseen%&" unless the &%unseen%& option is set on the router. This option can be used to set up multiple deliveries with different routing (for example, for keeping archive copies of messages). When &%unseen%& is set, the address is @@ -1272,16 +1346,20 @@ when the relevant conditions are met. The &(redirect)& router has a &"fail"& facility for this purpose. -.section "Duplicate addresses" +.section "Duplicate addresses" "SECID17" .cindex "case of local parts" -.cindex "address duplicate" "discarding" +.cindex "address duplicate, discarding" +.cindex "duplicate addresses" Once routing is complete, Exim scans the addresses that are assigned to local and remote transports, and discards any duplicates that it finds. During this -check, local parts are treated as case-sensitive. +check, local parts are treated as case-sensitive. This happens only when +actually delivering a message; when testing routers with &%-bt%&, all the +routed addresses are shown. + .section "Router preconditions" "SECTrouprecon" -.cindex "router preconditions" "order of processing" +.cindex "router" "preconditions, order of processing" .cindex "preconditions" "order of processing" The preconditions that are tested for each router are listed below, in the order in which they are tested. The individual configuration options are @@ -1303,6 +1381,8 @@ Setting the &%verify%& option actually sets two options, &%verify_sender%& and &%verify_recipient%&, which independently control the use of the router for sender and recipient verification. You can set these options directly if you want a router to be used for only one type of verification. +Note that cutthrough delivery is classed as a recipient verification +for this purpose. .next If the &%address_test%& option is set false, the router is skipped when Exim is run with the &%-bt%& option to test an address routing. This can be helpful @@ -1312,6 +1392,7 @@ having to simulate the effect of the scanner. .next Routers can be designated for use only when verifying an address, as opposed to routing it for delivery. The &%verify_only%& option controls this. +Again, cutthrough delibery counts as a verification. .next Individual routers can be explicitly skipped when running the routers to check an address given in the SMTP EXPN command (see the &%expn%& option). @@ -1319,9 +1400,9 @@ check an address given in the SMTP EXPN command (see the &%expn%& option). If the &%domains%& option is set, the domain of the address must be in the set of domains that it defines. .next -.cindex "&$local_part_prefix$&" -.cindex "&$local_part$&" -.cindex "&$local_part_suffix$&" +.vindex "&$local_part_prefix$&" +.vindex "&$local_part$&" +.vindex "&$local_part_suffix$&" If the &%local_parts%& option is set, the local part of the address must be in the set of local parts that it defines. If &%local_part_prefix%& or &%local_part_suffix%& is in use, the prefix or suffix is removed from the local @@ -1330,9 +1411,9 @@ that include affixes, you can do so by using a &%condition%& option (see below) that uses the variables &$local_part$&, &$local_part_prefix$&, and &$local_part_suffix$& as necessary. .next -.cindex "&$local_user_uid$&" -.cindex "&$local_user_gid$&" -.cindex "&$home$&" +.vindex "&$local_user_uid$&" +.vindex "&$local_user_gid$&" +.vindex "&$home$&" If the &%check_local_user%& option is set, the local part must be the name of an account on the local host. If this check succeeds, the uid and gid of the local user are placed in &$local_user_uid$& and &$local_user_gid$& and the @@ -1368,7 +1449,7 @@ example, &_.procmailrc_&). -.section "Delivery in detail" +.section "Delivery in detail" "SECID18" .cindex "delivery" "in detail" When a message is to be delivered, the sequence of events is as follows: @@ -1460,7 +1541,7 @@ deleted, though the message log can optionally be preserved if required. -.section "Retry mechanism" +.section "Retry mechanism" "SECID19" .cindex "delivery" "retry mechanism" .cindex "retry" "description of mechanism" .cindex "queue runner" @@ -1483,7 +1564,7 @@ as permanent. -.section "Temporary delivery failure" +.section "Temporary delivery failure" "SECID20" .cindex "delivery" "temporary failure" There are many reasons why a message may not be immediately deliverable to a particular address. Failure to connect to a remote machine (because it, or the @@ -1498,7 +1579,6 @@ If a host is unreachable for a period of time, a number of messages may be waiting for it by the time it recovers, and sending them in a single SMTP connection is clearly beneficial. Whenever a delivery to a remote host is deferred, - .cindex "hints database" Exim makes a note in its hints database, and whenever a successful SMTP delivery has happened, it looks to see if any other messages are waiting @@ -1508,8 +1588,7 @@ one connection. - -.section "Permanent delivery failure" +.section "Permanent delivery failure" "SECID21" .cindex "delivery" "permanent failure" .cindex "bounce message" "when generated" When a message cannot be delivered to some or all of its intended recipients, a @@ -1537,7 +1616,7 @@ of the list. -.section "Failures to deliver bounce messages" +.section "Failures to deliver bounce messages" "SECID22" .cindex "bounce message" "failure to deliver" If a bounce message (either locally generated or received from a remote host) itself suffers a permanent delivery failure, the message is left on the queue, @@ -1553,35 +1632,36 @@ for only a short time (see &%timeout_frozen_after%& and . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "Building and installing Exim" +.chapter "Building and installing Exim" "CHID3" .scindex IIDbuex "building Exim" -.section "Unpacking" -Exim is distributed as a gzipped or bzipped tar file which, when upacked, +.section "Unpacking" "SECID23" +Exim is distributed as a gzipped or bzipped tar file which, when unpacked, creates a directory with the name of the current release (for example, -&_exim-&version;_&) into which the following files are placed: +&_exim-&version()_&) into which the following files are placed: .table2 140pt -.row &_ACKNOWLEDGMENTS_& "contains some acknowledgments" -.row &_CHANGES_& "contains a reference to where changes are documented" -.row &_LICENCE_& "the GNU General Public Licence" -.row &_Makefile_& "top-level make file" -.row &_NOTICE_& "conditions for the use of Exim" -.row &_README_& "list of files, directories and simple build &&& - instructions" +.irow &_ACKNOWLEDGMENTS_& "contains some acknowledgments" +.irow &_CHANGES_& "contains a reference to where changes are &&& + documented" +.irow &_LICENCE_& "the GNU General Public Licence" +.irow &_Makefile_& "top-level make file" +.irow &_NOTICE_& "conditions for the use of Exim" +.irow &_README_& "list of files, directories and simple build &&& + instructions" .endtable Other files whose names begin with &_README_& may also be present. The following subdirectories are created: .table2 140pt -.row &_Local_& "an empty directory for local configuration files" -.row &_OS_& "OS-specific files" -.row &_doc_& "documentation files" -.row &_exim_monitor_& "source files for the Exim monitor" -.row &_scripts_& "scripts used in the build process" -.row &_src_& "remaining source files" -.row &_util_& "independent utilities" +.irow &_Local_& "an empty directory for local configuration files" +.irow &_OS_& "OS-specific files" +.irow &_doc_& "documentation files" +.irow &_exim_monitor_& "source files for the Exim monitor" +.irow &_scripts_& "scripts used in the build process" +.irow &_src_& "remaining source files" +.irow &_util_& "independent utilities" .endtable The main utility programs are contained in the &_src_& directory, and are built @@ -1589,7 +1669,7 @@ with the Exim binary. The &_util_& directory contains a few optional scripts that may be useful to some sites. -.section "Multiple machine architectures and operating systems" +.section "Multiple machine architectures and operating systems" "SECID24" .cindex "building Exim" "multiple OS/architectures" The building process for Exim is arranged to make it easy to build binaries for a number of different architectures and operating systems from the same set of @@ -1603,6 +1683,21 @@ architecture and operating system for itself, but the defaults can be overridden if necessary. +.section "PCRE library" "SECTpcre" +.cindex "PCRE library" +Exim no longer has an embedded PCRE library as the vast majority of +modern systems include PCRE as a system library, although you may need +to install the PCRE or PCRE development package for your operating +system. If your system has a normal PCRE installation the Exim build +process will need no further configuration. If the library or the +headers are in an unusual location you will need to either set the PCRE_LIBS +and INCLUDE directives appropriately, +or set PCRE_CONFIG=yes to use the installed &(pcre-config)& command. +If your operating system has no +PCRE support then you will need to obtain and build the current PCRE +from &url(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/). +More information on PCRE is available at &url(http://www.pcre.org/). + .section "DBM libraries" "SECTdb" .cindex "DBM libraries" "discussion of" .cindex "hints database" "DBM files used for" @@ -1612,9 +1707,9 @@ databases. Unfortunately, there are a number of DBM libraries in existence, and different operating systems often have different ones installed. .cindex "Solaris" "DBM library for" -.cindex "IRIX" "DBM library for" -.cindex "BSD" "DBM library for" -.cindex "Linux" "DBM library for" +.cindex "IRIX, DBM library for" +.cindex "BSD, DBM library for" +.cindex "Linux, DBM library for" If you are using Solaris, IRIX, one of the modern BSD systems, or a modern Linux distribution, the DBM configuration should happen automatically, and you may be able to ignore this section. Otherwise, you may have to learn more than @@ -1626,7 +1721,7 @@ via the &'ndbm'& interface, and this is what Exim expects by default. Free versions of Unix seem to vary in what they contain as standard. In particular, some early versions of Linux have no default DBM library, and different distributors have chosen to bundle different libraries with their packaged -versions. However, the more recent releases seem to have standardised on the +versions. However, the more recent releases seem to have standardized on the Berkeley DB library. Different DBM libraries have different conventions for naming the files they @@ -1705,7 +1800,7 @@ file &_doc/dbm.discuss.txt_& in the Exim distribution. -.section "Pre-building configuration" +.section "Pre-building configuration" "SECID25" .cindex "building Exim" "pre-building configuration" .cindex "configuration for building Exim" .cindex "&_Local/Makefile_&" @@ -1745,7 +1840,7 @@ chapter &<>&. .cindex "&_Local/eximon.conf_&" -.cindex "_exim_monitor/EDITME_" +.cindex "&_exim_monitor/EDITME_&" If you are going to build the Exim monitor, a similar configuration process is required. The file &_exim_monitor/EDITME_& must be edited appropriately for your installation and saved under the name &_Local/eximon.conf_&. If you are @@ -1761,7 +1856,7 @@ do this. -.section "Support for iconv()" +.section "Support for iconv()" "SECID26" .cindex "&[iconv()]& support" .cindex "RFC 2047" The contents of header lines in messages may be encoded according to the rules @@ -1812,6 +1907,12 @@ SUPPORT_TLS=yes TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto TLS_INCLUDE=-I/usr/local/openssl/include/ .endd +.cindex "pkg-config" "OpenSSL" +If you have &'pkg-config'& available, then instead you can just use: +.code +SUPPORT_TLS=yes +USE_OPENSSL_PC=openssl +.endd .cindex "USE_GNUTLS" If GnuTLS is installed, you should set .code @@ -1827,6 +1928,14 @@ USE_GNUTLS=yes TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt TLS_INCLUDE=-I/usr/gnu/include .endd +.cindex "pkg-config" "GnuTLS" +If you have &'pkg-config'& available, then instead you can just use: +.code +SUPPORT_TLS=yes +USE_GNUTLS=yes +USE_GNUTLS_PC=gnutls +.endd + You do not need to set TLS_INCLUDE if the relevant directory is already specified in INCLUDE. Details of how to configure Exim to make use of TLS are given in chapter &<>&. @@ -1834,9 +1943,12 @@ given in chapter &<>&. -.section "Use of tcpwrappers" -.cindex "tcpwrappers" "building Exim to support" +.section "Use of tcpwrappers" "SECID27" + +.cindex "tcpwrappers, building Exim to support" .cindex "USE_TCP_WRAPPERS" +.cindex "TCP_WRAPPERS_DAEMON_NAME" +.cindex "tcp_wrappers_daemon_name" Exim can be linked with the &'tcpwrappers'& library in order to check incoming SMTP calls using the &'tcpwrappers'& control files. This may be a convenient alternative to Exim's own checking facilities for installations that are @@ -1851,19 +1963,21 @@ USE_TCP_WRAPPERS=yes CFLAGS=-O -I/usr/local/include EXTRALIBS_EXIM=-L/usr/local/lib -lwrap .endd -in &_Local/Makefile_&. The name to use in the &'tcpwrappers'& control files is -&"exim"&. For example, the line +in &_Local/Makefile_&. The daemon name to use in the &'tcpwrappers'& control +files is &"exim"&. For example, the line .code exim : LOCAL 192.168.1. .friendly.domain.example .endd in your &_/etc/hosts.allow_& file allows connections from the local host, from the subnet 192.168.1.0/24, and from all hosts in &'friendly.domain.example'&. -All other connections are denied. Consult the &'tcpwrappers'& documentation for +All other connections are denied. The daemon name used by &'tcpwrappers'& +can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in +&_Local/Makefile_&, or by setting tcp_wrappers_daemon_name in the +configure file. Consult the &'tcpwrappers'& documentation for further details. - -.section "Including support for IPv6" +.section "Including support for IPv6" "SECID28" .cindex "IPv6" "including support for" Exim contains code for use on systems that have IPv6 support. Setting &`HAVE_IPV6=YES`& in &_Local/Makefile_& causes the IPv6 code to be included; @@ -1872,7 +1986,7 @@ where the IPv6 support is not fully integrated into the normal include and library files. Two different types of DNS record for handling IPv6 addresses have been -defined. AAAA records (analagous to A records for IPv4) are in use, and are +defined. AAAA records (analogous to A records for IPv4) are in use, and are currently seen as the mainstream. Another record type called A6 was proposed as better than AAAA because it had more flexibility. However, it was felt to be over-complex, and its status was reduced to &"experimental"&. It is not known @@ -1882,7 +1996,37 @@ support has not been tested for some time. -.section "The building process" +.section "Dynamically loaded lookup module support" "SECTdynamicmodules" +.cindex "lookup modules" +.cindex "dynamic modules" +.cindex ".so building" +On some platforms, Exim supports not compiling all lookup types directly into +the main binary, instead putting some into external modules which can be loaded +on demand. +This permits packagers to build Exim with support for lookups with extensive +library dependencies without requiring all users to install all of those +dependencies. +Most, but not all, lookup types can be built this way. + +Set &`LOOKUP_MODULE_DIR`& to the directory into which the modules will be +installed; Exim will only load modules from that directory, as a security +measure. You will need to set &`CFLAGS_DYNAMIC`& if not already defined +for your OS; see &_OS/Makefile-Linux_& for an example. +Some other requirements for adjusting &`EXTRALIBS`& may also be necessary, +see &_src/EDITME_& for details. + +Then, for each module to be loaded dynamically, define the relevant +&`LOOKUP_`&<&'lookup_type'&> flags to have the value "2" instead of "yes". +For example, this will build in lsearch but load sqlite and mysql support +on demand: +.code +LOOKUP_LSEARCH=yes +LOOKUP_SQLITE=2 +LOOKUP_MYSQL=2 +.endd + + +.section "The building process" "SECID29" .cindex "build directory" Once &_Local/Makefile_& (and &_Local/eximon.conf_&, if required) have been created, run &'make'& at the top level. It determines the architecture and @@ -1910,7 +2054,7 @@ FAQ, where some common problems are covered. -.section 'Output from &"make"&' +.section 'Output from &"make"&' "SECID283" The output produced by the &'make'& process for compile lines is often very unreadable, because these lines can be very long. For this reason, the normal output is suppressed by default, and instead output similar to that which @@ -1922,12 +2066,12 @@ FULLECHO='' make -e .endd The value of FULLECHO defaults to &"@"&, the flag character that suppresses command reflection in &'make'&. When you ask for the full output, it is -given in addition to the the short output. +given in addition to the short output. .section "Overriding build-time options for Exim" "SECToverride" -.cindex "build-time options" "overriding" +.cindex "build-time options, overriding" The main make file that is created at the beginning of the building process consists of the concatenation of a number of files which set configuration values, followed by a fixed set of &'make'& instructions. If a value is set @@ -2019,6 +2163,26 @@ files or libraries are required. When a lookup type is not included in the binary, attempts to configure Exim to use it cause run time configuration errors. +.cindex "pkg-config" "lookups" +.cindex "pkg-config" "authenticators" +Many systems now use a tool called &'pkg-config'& to encapsulate information +about how to compile against a library; Exim has some initial support for +being able to use pkg-config for lookups and authenticators. For any given +makefile variable which starts &`LOOKUP_`& or &`AUTH_`&, you can add a new +variable with the &`_PC`& suffix in the name and assign as the value the +name of the package to be queried. The results of querying via the +&'pkg-config'& command will be added to the appropriate Makefile variables +with &`+=`& directives, so your version of &'make'& will need to support that +syntax. For instance: +.code +LOOKUP_SQLITE=yes +LOOKUP_SQLITE_PC=sqlite3 +AUTH_GSASL=yes +AUTH_GSASL_PC=libgsasl +AUTH_HEIMDAL_GSSAPI=yes +AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi +.endd + .cindex "Perl" "including support for" Exim can be linked with an embedded Perl interpreter, allowing Perl subroutines to be called during string expansion. To enable this facility, @@ -2028,7 +2192,7 @@ EXIM_PERL=perl.o must be defined in &_Local/Makefile_&. Details of this facility are given in chapter &<>&. -.cindex "X11 libraries" "location of" +.cindex "X11 libraries, location of" The location of the X11 libraries is something that varies a lot between operating systems, and there may be different versions of X11 to cope with. Exim itself makes no use of X11, but if you are compiling the Exim @@ -2070,7 +2234,7 @@ necessary to touch the associated non-optional file (that is, &_Local/Makefile_& or &_Local/eximon.conf_&) before rebuilding. -.section "OS-specific header files" +.section "OS-specific header files" "SECID30" .cindex "&_os.h_&" .cindex "building Exim" "OS-specific C header files" The &_OS_& directory contains a number of files with names of the form @@ -2081,8 +2245,8 @@ are porting Exim to a new operating system. -.section "Overriding build-time options for the monitor" -.cindex "building Eximon" "overriding default options" +.section "Overriding build-time options for the monitor" "SECID31" +.cindex "building Eximon" A similar process is used for overriding things when building the Exim monitor, where the files that are involved are .display @@ -2103,7 +2267,7 @@ LOG_DEPTH at run time. .ecindex IIDbuex -.section "Installing Exim binaries and scripts" +.section "Installing Exim binaries and scripts" "SECID32" .cindex "installing Exim" .cindex "BIN_DIRECTORY" The command &`make install`& runs the &(exim_install)& script with no @@ -2162,16 +2326,15 @@ but this usage is deprecated. .cindex "installing Exim" "what is not installed" Running &'make install'& does not copy the Exim 4 conversion script -&'convert4r4'&, or the &'pcretest'& test program. You will probably run the -first of these only once (if you are upgrading from Exim 3), and the second -isn't really part of Exim. None of the documentation files in the &_doc_& +&'convert4r4'&. You will probably run this only once if you are +upgrading from Exim 3. None of the documentation files in the &_doc_& directory are copied, except for the info files when you have set INFO_DIRECTORY, as described in section &<>& below. For the utility programs, old versions are renamed by adding the suffix &_.O_& to their names. The Exim binary itself, however, is handled differently. It is installed under a name that includes the version number and the compile number, -for example &_exim-&version;-1_&. The script then arranges for a symbolic link +for example &_exim-&version()-1_&. The script then arranges for a symbolic link called &_exim_& to point to the binary. If you are updating a previous version of Exim, the script takes care to ensure that the name &_exim_& is never absent from the directory (as seen by other processes). @@ -2228,7 +2391,7 @@ install`& automatically builds the info files and installs them. -.section "Setting up the spool directory" +.section "Setting up the spool directory" "SECID33" .cindex "spool directory" "creating" When it starts up, Exim tries to create its spool directory if it does not exist. The Exim uid and gid are used for the owner and group of the spool @@ -2238,7 +2401,7 @@ necessary. -.section "Testing" +.section "Testing" "SECID34" .cindex "testing" "installation" Having installed Exim, you can check that the run time configuration file is syntactically valid by running the following command, which assumes that the @@ -2319,7 +2482,7 @@ that Exim uses can be altered, in order to keep it entirely clear of the production version. -.section "Replacing another MTA with Exim" +.section "Replacing another MTA with Exim" "SECID35" .cindex "replacing another MTA" Building and installing Exim for the first time does not of itself put it in general use. The name by which the system's MTA is called by mail user agents @@ -2333,7 +2496,7 @@ a symbolic link to the &'exim'& binary. It is a good idea to remove any setuid privilege and executable status from the old MTA. It is then necessary to stop and restart the mailer daemon, if one is running. -.cindex "FreeBSD" "MTA indirection" +.cindex "FreeBSD, MTA indirection" .cindex "&_/etc/mail/mailer.conf_&" Some operating systems have introduced alternative ways of switching MTAs. For example, if you are running FreeBSD, you need to edit the file @@ -2359,7 +2522,7 @@ use of Exim's filtering capabilities, you should make the document entitled -.section "Upgrading Exim" +.section "Upgrading Exim" "SECID36" .cindex "upgrading Exim" If you are already running Exim on your host, building and installing a new version automatically makes it available to MUAs, or any other programs that @@ -2372,7 +2535,7 @@ configuration file. -.section "Stopping the Exim daemon on Solaris" +.section "Stopping the Exim daemon on Solaris" "SECID37" .cindex "Solaris" "stopping Exim on" The standard command for stopping the mailer daemon on Solaris is .code @@ -2409,7 +2572,7 @@ combinations of options do not make sense, and provoke an error if used. The form of the arguments depends on which options are set. -.section "Setting options by program name" +.section "Setting options by program name" "SECID38" .cindex "&'mailq'&" If Exim is called under the name &'mailq'&, it behaves as if the option &%-bp%& were present before any other options. @@ -2454,7 +2617,7 @@ EXIM_GROUP in &_Local/Makefile_& or set by the &%exim_user%& and &%exim_group%& options. These do not necessarily have to use the name &"exim"&. .ilist -.cindex "trusted user" "definition of" +.cindex "trusted users" "definition of" .cindex "user" "trusted definition of" The trusted users are root, the Exim user, any user listed in the &%trusted_users%& configuration option, and any user whose current group or any @@ -2512,8 +2675,14 @@ getting root. There is further discussion of this issue at the start of chapter -.section "Command line options" -The command options are described in alphabetical order below. +.section "Command line options" "SECID39" +Exim's command line options are described in alphabetical order below. If none +of the options that specifies a specific action (such as starting the daemon or +a queue runner, or testing an address, or receiving a message in a specific +format, or listing the queue) are present, and there is at least one argument +on the command line, &%-bm%& (accept a local message on the standard input, +with the arguments specifying the recipients) is assumed. Otherwise, Exim +outputs a brief message about itself and exits. . //////////////////////////////////////////////////////////////////////////// . Insert a stylized XML comment here, to identify the start of the command line @@ -2540,6 +2709,20 @@ This option causes Exim to output a few sentences stating what it is. The same output is generated if the Exim binary is called with no options and no arguments. +.vitem &%--version%& +.oindex "&%--version%&" +This option is an alias for &%-bV%& and causes version information to be +displayed. + +.new +.vitem &%-Ac%& &&& + &%-Am%& +.oindex "&%-Ac%&" +.oindex "&%-Am%&" +These options are used by Sendmail for selecting configuration files and are +ignored by Exim. +.wen + .vitem &%-B%&<&'type'&> .oindex "&%-B%&" .cindex "8-bit characters" @@ -2550,7 +2733,7 @@ clean; it ignores this option. .vitem &%-bd%& .oindex "&%-bd%&" .cindex "daemon" -.cindex "SMTP listener" +.cindex "SMTP" "listener" .cindex "queue runner" This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually the &%-bd%& option is combined with the &%-q%&<&'time'&> option, to specify @@ -2581,10 +2764,11 @@ used to specify a path on the command line if a pid file is required. The SIGHUP signal .cindex "SIGHUP" -can be used to cause the daemon to re-exec itself. This should be done whenever -Exim's configuration file, or any file that is incorporated into it by means of -the &%.include%& facility, is changed, and also whenever a new version of Exim -is installed. It is not necessary to do this when other files that are +.cindex "daemon" "restarting" +can be used to cause the daemon to re-execute itself. This should be done +whenever Exim's configuration file, or any file that is incorporated into it by +means of the &%.include%& facility, is changed, and also whenever a new version +of Exim is installed. It is not necessary to do this when other files that are referenced from the configuration (for example, alias files) are changed, because these are reread each time they are used. @@ -2613,14 +2797,32 @@ continuations. As in Exim's run time configuration, white space at the start of continuation lines is ignored. Each argument or data line is passed through the string expansion mechanism, and the result is output. Variable values from the configuration file (for example, &$qualify_domain$&) are available, but no -message-specific values (such as &$domain$&) are set, because no message is -being processed. +message-specific values (such as &$sender_domain$&) are set, because no message +is being processed (but see &%-bem%& and &%-Mset%&). &*Note*&: If you use this mechanism to test lookups, and you change the data files or databases you are using, you must exit and restart Exim before trying the same lookup again. Otherwise, because each Exim process caches the results of lookups, you will just get the same result as before. +.vitem &%-bem%&&~<&'filename'&> +.oindex "&%-bem%&" +.cindex "testing" "string expansion" +.cindex "expansion" "testing" +This option operates like &%-be%& except that it must be followed by the name +of a file. For example: +.code +exim -bem /tmp/testmessage +.endd +The file is read as a message (as if receiving a locally-submitted non-SMTP +message) before any of the test expansions are done. Thus, message-specific +variables such as &$message_size$& and &$header_from:$& are available. However, +no &'Received:'& header is added to the message. If the &%-t%& option is set, +recipients are read from the headers in the normal way, and are shown in the +&$recipients$& variable. Note that recipients cannot be given on the command +line, because further arguments are taken as strings to expand (just like +&%-be%&). + .vitem &%-bF%&&~<&'filename'&> .oindex "&%-bF%&" .cindex "system filter" "testing" @@ -2668,7 +2870,7 @@ separate document entitled &'Exim's interfaces to mail filtering'&. When testing a filter file, .cindex "&""From""& line" .cindex "envelope sender" -.cindex "&%-f%& option" "for filter testing" +.oindex "&%-f%&" "for filter testing" the envelope sender can be set by the &%-f%& option, or by a &"From&~"& line at the start of the test message. Various parameters that would normally be taken from the envelope recipient address of the message @@ -2677,7 +2879,7 @@ options). .vitem &%-bfd%&&~<&'domain'&> .oindex "&%-bfd%&" -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" This sets the domain of the recipient address when a filter file is being tested by means of the &%-bf%& option. The default is the value of &$qualify_domain$&. @@ -2730,9 +2932,10 @@ test your relay controls using &%-bh%&. &*Warning 1*&: .cindex "RFC 1413" -You cannot test features of the configuration that rely on -ident (RFC 1413) callouts. These cannot be done when testing using -&%-bh%& because there is no incoming SMTP connection. +You can test features of the configuration that rely on ident (RFC 1413) +information by using the &%-oMt%& option. However, Exim cannot actually perform +an ident callout when testing using &%-bh%& because there is no incoming SMTP +connection. &*Warning 2*&: Address verification callouts (see section &<>&) are also skipped when testing using &%-bh%&. If you want these callouts to @@ -2741,12 +2944,19 @@ occur, use &%-bhc%& instead. Messages supplied during the testing session are discarded, and nothing is written to any of the real log files. There may be pauses when DNS (and other) lookups are taking place, and of course these may time out. The &%-oMi%& option -can be used to specify a specific IP interface and port if this is important. +can be used to specify a specific IP interface and port if this is important, +and &%-oMaa%& and &%-oMai%& can be used to set parameters as if the SMTP +session were authenticated. The &'exim_checkaccess'& utility is a &"packaged"& version of &%-bh%& whose output just states whether a given recipient address from a given host is acceptable or not. See section &<>&. +Features such as authentication and encryption, where the client input is not +plain text, cannot easily be tested with &%-bh%&. Instead, you should use a +specialized SMTP test program such as +&url(http://jetmore.org/john/code/#swaks,swaks). + .vitem &%-bhc%&&~<&'IP&~address'&> .oindex "&%-bhc%&" This option operates in the same way as &%-bh%&, except that address @@ -2772,11 +2982,39 @@ use the &'exim_dbmbuild'& utility, or some other means, to rebuild alias files if this is required. If the &%bi_command%& option is not set, calling Exim with &%-bi%& is a no-op. +.new +. // Keep :help first, then the rest in alphabetical order +.vitem &%-bI:help%& +.oindex "&%-bI:help%&" +.cindex "querying exim information" +We shall provide various options starting &`-bI:`& for querying Exim for +information. The output of many of these will be intended for machine +consumption. This one is not. The &%-bI:help%& option asks Exim for a +synopsis of supported options beginning &`-bI:`&. Use of any of these +options shall cause Exim to exit after producing the requested output. + +.vitem &%-bI:dscp%& +.oindex "&%-bI:dscp%&" +.cindex "DSCP" "values" +This option causes Exim to emit an alphabetically sorted list of all +recognised DSCP names. + +.vitem &%-bI:sieve%& +.oindex "&%-bI:sieve%&" +.cindex "Sieve filter" "capabilities" +This option causes Exim to emit an alphabetically sorted list of all supported +Sieve protocol extensions on stdout, one per line. This is anticipated to be +useful for ManageSieve (RFC 5804) implementations, in providing that protocol's +&`SIEVE`& capability response line. As the precise list may depend upon +compile-time build options, which this option will adapt to, this is the only +way to guarantee a correct response. +.wen + .vitem &%-bm%& .oindex "&%-bm%&" .cindex "local message reception" This option runs an Exim receiving process that accepts an incoming, -locally-generated message on the current input. The recipients are given as the +locally-generated message on the standard input. The recipients are given as the command arguments (except when &%-t%& is also present &-- see below). Each argument can be a comma-separated list of RFC 2822 addresses. This is the default option for selecting the overall action of an Exim call; it is assumed @@ -2812,16 +3050,35 @@ authoritative specification of the format of this line. Exim recognizes it by matching against the regular expression defined by the &%uucp_from_pattern%& option, which can be changed if necessary. -The -.cindex "&%-f%& option" "overriding &""From""& line" -specified sender is treated as if it were given as the argument to the +.oindex "&%-f%&" "overriding &""From""& line" +The specified sender is treated as if it were given as the argument to the &%-f%& option, but if a &%-f%& option is also present, its argument is used in preference to the address taken from the message. The caller of Exim must be a trusted user for the sender of a message to be set in this way. +.vitem &%-bmalware%&&~<&'filename'&> +.oindex "&%-bmalware%&" +.cindex "testing", "malware" +.cindex "malware scan test" +This debugging option causes Exim to scan the given file, +using the malware scanning framework. The option of &%av_scanner%& influences +this option, so if &%av_scanner%&'s value is dependent upon an expansion then +the expansion should have defaults which apply to this invocation. ACLs are +not invoked, so if &%av_scanner%& references an ACL variable then that variable +will never be populated and &%-bmalware%& will fail. + +Exim will have changed working directory before resolving the filename, so +using fully qualified pathnames is advisable. Exim will be running as the Exim +user when it tries to open the file, rather than as the invoking user. +This option requires admin privileges. + +The &%-bmalware%& option will not be extended to be more generally useful, +there are better tools for file-scanning. This option exists to help +administrators verify their Exim and AV scanner configuration. + .vitem &%-bnq%& .oindex "&%-bnq%&" -.cindex "address qualification" "suppressing" +.cindex "address qualification, suppressing" By default, Exim automatically qualifies unqualified addresses (those without domains) that appear in messages that are submitted locally (that is, not over TCP/IP). This qualification applies both to addresses in @@ -2852,6 +3109,9 @@ arguments, for example: .code exim -bP qualify_domain hold_domains .endd +.cindex "hiding configuration option values" +.cindex "configuration options" "hiding value of" +.cindex "options" "hiding value of" However, any option setting that is preceded by the word &"hide"& in the configuration file is not shown in full, except to an admin user. For other users, the output is as in this example: @@ -2863,6 +3123,12 @@ configuration file is output. If a list of configuration files was supplied, the value that is output here is the name of the file that was actually used. +.new +.cindex "options" "hiding name of" +If the &%-n%& flag is given, then for most modes of &%-bP%& operation the +name will not be output. +.wen + .cindex "daemon" "process id (pid)" .cindex "pid (process id)" "of daemon" If &%log_file_path%& or &%pid_file_path%& are given, the names of the @@ -2880,6 +3146,7 @@ local part) and outputs what it finds. .cindex "options" "router &-- extracting" .cindex "options" "transport &-- extracting" +.cindex "options" "authenticator &-- extracting" If one of the words &%router%&, &%transport%&, or &%authenticator%& is given, followed by the name of an appropriate driver instance, the option settings for that driver are output. For example: @@ -2893,6 +3160,11 @@ using one of the words &%router_list%&, &%transport_list%&, or settings can be obtained by using &%routers%&, &%transports%&, or &%authenticators%&. +.cindex "options" "macro &-- extracting" +If invoked by an admin user, then &%macro%&, &%macro_list%& and &%macros%& +are available, similarly to the drivers. Because macros are sometimes used +for storing passwords, this option is restricted. +The output format is one item per line. .vitem &%-bp%& .oindex "&%-bp%&" @@ -3075,10 +3347,10 @@ the listening daemon. .cindex "testing" "addresses" .cindex "address" "testing" This option runs Exim in address testing mode, in which each argument is taken -as an address to be tested for deliverability. The results are written to the -standard output. If a test fails, and the caller is not an admin user, no -details of the failure are output, because these might contain sensitive -information such as usernames and passwords for database lookups. +as a recipient address to be tested for deliverability. The results are +written to the standard output. If a test fails, and the caller is not an admin +user, no details of the failure are output, because these might contain +sensitive information such as usernames and passwords for database lookups. If no arguments are given, Exim runs in an interactive manner, prompting with a right angle bracket for addresses to be tested. @@ -3094,16 +3366,21 @@ written to the standard output. However, any router that has genuine routing tests if your first router passes everything to a scanner program. -The .cindex "return code" "for &%-bt%&" -return code is 2 if any address failed outright; it is 1 if no address +The return code is 2 if any address failed outright; it is 1 if no address failed outright but at least one could not be resolved for some reason. Return code 0 is given only when all addresses succeed. +.cindex "duplicate addresses" +&*Note*&: When actually delivering a message, Exim removes duplicate recipient +addresses after routing is complete, so that only one delivery takes place. +This does not happen when testing with &%-bt%&; the full results of routing are +always shown. + &*Warning*&: &%-bt%& can only do relatively simple testing. If any of the routers in the configuration makes any tests on the sender address of a message, -.cindex "&%-f%& option" "for address testing" +.oindex "&%-f%&" "for address testing" you can use the &%-f%& option to set an appropriate sender when running &%-bt%& tests. Without it, the sender is assumed to be the calling user at the default qualifying domain. However, if you have set up (for example) routers @@ -3113,10 +3390,10 @@ doing such tests. .vitem &%-bV%& .oindex "&%-bV%&" -.cindex "version number of Exim" "verifying" +.cindex "version number of Exim" This option causes Exim to write the current version number, compilation number, and compilation date of the &'exim'& binary to the standard output. -It also lists the DBM library this is being used, the optional modules (such as +It also lists the DBM library that is being used, the optional modules (such as specific lookup types), the drivers that are included in the binary, and the name of the run time configuration file that is in use. @@ -3133,10 +3410,11 @@ dynamic testing facilities. .cindex "verifying address" "using &%-bv%&" .cindex "address" "verification" This option runs Exim in address verification mode, in which each argument is -taken as an address to be verified. During normal operation, verification +taken as a recipient address to be verified by the routers. (This does +not involve any verification callouts). During normal operation, verification happens mostly as a consequence processing a &%verify%& condition in an ACL -(see chapter &<>&). If you want to test an entire ACL, see the &%-bh%& -option. +(see chapter &<>&). If you want to test an entire ACL, possibly +including callouts, see the &%-bh%& and &%-bhc%& options. If verification fails, and the caller is not an admin user, no details of the failure are output, because these might contain sensitive information such as @@ -3157,10 +3435,15 @@ address, &%-bvs%& should be used. If the &%-v%& option is not set, the output consists of a single line for each address, stating whether it was verified or not, and giving a reason in the -latter case. Otherwise, more details are given of how the address has been -handled, and in the case of address redirection, all the generated addresses -are also considered. Without &%-v%&, generating more than one address by -redirection causes verification to end successfully. +latter case. Without &%-v%&, generating more than one address by redirection +causes verification to end successfully, without considering the generated +addresses. However, if just one address is generated, processing continues, +and the generated address must verify successfully for the overall verification +to succeed. + +When &%-v%& is set, more details are given of how the address has been handled, +and in the case of address redirection, all the generated addresses are also +considered. Verification may succeed for some and fail for others. The .cindex "return code" "for &%-bv%&" @@ -3179,6 +3462,23 @@ This option acts like &%-bv%&, but verifies the address as a sender rather than a recipient address. This affects any rewriting and qualification that might happen. +.vitem &%-bw%& +.oindex "&%-bw%&" +.cindex "daemon" +.cindex "inetd" +.cindex "inetd" "wait mode" +This option runs Exim as a daemon, awaiting incoming SMTP connections, +similarly to the &%-bd%& option. All port specifications on the command-line +and in the configuration file are ignored. Queue-running may not be specified. + +In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is +listening for connections. This permits the system to start up and have +inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for +each port only when the first connection is received. + +If the option is given as &%-bw%&<&'time'&> then the time is a timeout, after +which the daemon will exit, which should cause inetd to listen once more. + .vitem &%-C%&&~<&'filelist'&> .oindex "&%-C%&" .cindex "configuration file" "alternate" @@ -3191,25 +3491,23 @@ name, but it can be a colon-separated list of names. In this case, the first file that exists is used. Failure to open an existing file stops Exim from proceeding any further along the list, and an error is generated. -When this option is used by a caller other than root or the Exim user, and the -list is different from the compiled-in list, Exim gives up its root privilege -immediately, and runs with the real and effective uid and gid set to those of -the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in -&_Local/Makefile_&, root privilege is retained for &%-C%& only if the caller of -Exim is root. - -That is, the Exim user is no longer privileged in this regard. This build-time -option is not set by default in the Exim source distribution tarbundle. -However, if you are using a &"packaged"& version of Exim (source or binary), -the packagers might have enabled it. - -Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a -configuration using &%-C%& right through message reception and delivery, even -if the caller is root. The reception works, but by that time, Exim is running -as the Exim user, so when it re-executes to regain privilege for the delivery, -the use of &%-C%& causes privilege to be lost. However, root can test reception -and delivery using two separate commands (one to put a message on the queue, -using &%-odq%&, and another to do the delivery, using &%-M%&). +When this option is used by a caller other than root, and the list is different +from the compiled-in list, Exim gives up its root privilege immediately, and +runs with the real and effective uid and gid set to those of the caller. +However, if a TRUSTED_CONFIG_LIST file is defined in &_Local/Makefile_&, that +file contains a list of full pathnames, one per line, for configuration files +which are trusted. Root privilege is retained for any configuration file so +listed, as long as the caller is the Exim user (or the user specified in the +CONFIGURE_OWNER option, if any), and as long as the configuration file is +not writeable by inappropriate users or groups. + +Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a +configuration using &%-C%& right through message reception and delivery, +even if the caller is root. The reception works, but by that time, Exim is +running as the Exim user, so when it re-executes to regain privilege for the +delivery, the use of &%-C%& causes privilege to be lost. However, root can +test reception and delivery using two separate commands (one to put a message +on the queue, using &%-odq%&, and another to do the delivery, using &%-M%&). If ALT_CONFIG_PREFIX is defined &_in Local/Makefile_&, it specifies a prefix string with which any file named in a &%-C%& command line option @@ -3230,6 +3528,7 @@ caller is privileged, or unless it is an exotic configuration that does not require privilege. No check is made on the owner or group of the files specified by this option. + .vitem &%-D%&<&'macro'&>=<&'value'&> .oindex "&%-D%&" .cindex "macro" "setting on command line" @@ -3239,6 +3538,14 @@ unprivileged caller, it causes Exim to give up its root privilege. If DISABLE_D_OPTION is defined in &_Local/Makefile_&, the use of &%-D%& is completely disabled, and its use causes an immediate error exit. +If WHITELIST_D_MACROS is defined in &_Local/Makefile_& then it should be a +colon-separated list of macros which are considered safe and, if &%-D%& only +supplies macros from this list, and the values are acceptable, then Exim will +not give up root privilege if the caller is root, the Exim run-time user, or +the CONFIGURE_OWNER, if set. This is a transition mechanism and is expected +to be removed in the future. Acceptable values for the macros satisfy the +regexp: &`^[A-Za-z0-9_/.-]*$`& + The entire option (including equals sign if present) must all be within one command line item. &%-D%& can be used to set the value of a macro to the empty string, in which case the equals sign is optional. These two commands are @@ -3255,6 +3562,7 @@ exim '-D ABC = something' ... .endd &%-D%& may be repeated up to 10 times on a command line. + .vitem &%-d%&<&'debug&~options'&> .oindex "&%-d%&" .cindex "debugging" "list of selectors" @@ -3262,14 +3570,18 @@ exim '-D ABC = something' ... This option causes debugging information to be written to the standard error stream. It is restricted to admin users because debugging output may show database queries that contain password information. Also, the details of users' -filter files should be protected. When &%-d%& is used, &%-v%& is assumed. If -&%-d%& is given on its own, a lot of standard debugging data is output. This -can be reduced, or increased to include some more rarely needed information, by -directly following &%-d%& with a string made up of names preceded by plus or -minus characters. These add or remove sets of debugging data, respectively. For -example, &%-d+filter%& adds filter debugging, whereas &%-d-all+filter%& selects -only filter debugging. Note that no spaces are allowed in the debug setting. -The available debugging categories are: +filter files should be protected. If a non-admin user uses &%-d%&, Exim +writes an error message to the standard error stream and exits with a non-zero +return code. + +When &%-d%& is used, &%-v%& is assumed. If &%-d%& is given on its own, a lot of +standard debugging data is output. This can be reduced, or increased to include +some more rarely needed information, by directly following &%-d%& with a string +made up of names preceded by plus or minus characters. These add or remove sets +of debugging data, respectively. For example, &%-d+filter%& adds filter +debugging, whereas &%-d-all+filter%& selects only filter debugging. Note that +no spaces are allowed in the debug setting. The available debugging categories +are: .display &`acl `& ACL interpretation &`auth `& authenticators @@ -3311,8 +3623,8 @@ is included, an awful lot of output that is very rarely of interest is generated, so it now has to be explicitly requested. However, &`-all`& does turn everything off. -.cindex "resolver" "debugging output" -.cindex "DNS resolver" "debugging output" +.cindex "resolver, debugging output" +.cindex "DNS resolver, debugging output" The &`resolver`& option produces output only if the DNS resolver was compiled with DEBUG enabled. This is not the case in some operating systems. Also, unfortunately, debugging output from the DNS resolver is written to stdout @@ -3377,7 +3689,7 @@ between &%-F%& and the <&'string'&> is optional. .oindex "&%-f%&" .cindex "sender" "address" .cindex "address" "sender" -.cindex "trusted user" +.cindex "trusted users" .cindex "envelope sender" .cindex "user" "trusted" This option sets the address of the envelope sender of a locally-generated @@ -3419,8 +3731,19 @@ if &%-f%& is also present, it overrides &"From&~"&. .vitem &%-G%& .oindex "&%-G%&" -.cindex "Sendmail compatibility" "&%-G%& option ignored" -This is a Sendmail option which is ignored by Exim. +.cindex "submission fixups, suppressing (command-line)" +.new +This option is equivalent to an ACL applying: +.code +control = suppress_local_fixups +.endd +for every message received. Note that Sendmail will complain about such +bad formatting, where Exim silently just does not fix it up. This may change +in future. + +As this affects audit information, the caller must be a trusted user to use +this option. +.wen .vitem &%-h%&&~<&'number'&> .oindex "&%-h%&" @@ -3432,12 +3755,25 @@ headers.) .vitem &%-i%& .oindex "&%-i%&" .cindex "Solaris" "&'mail'& command" -.cindex "dot in incoming" "non-SMTP message" +.cindex "dot" "in incoming non-SMTP message" This option, which has the same effect as &%-oi%&, specifies that a dot on a line by itself should not terminate an incoming, non-SMTP message. I can find no documentation for this option in Solaris 2.4 Sendmail, but the &'mailx'& command in Solaris 2.4 uses it. See also &%-ti%&. +.new +.vitem &%-L%&&~<&'tag'&> +.oindex "&%-L%&" +.cindex "syslog" "process name; set with flag" +This option is equivalent to setting &%syslog_processname%& in the config +file and setting &%log_file_path%& to &`syslog`&. +Its use is restricted to administrators. The configuration file has to be +read and parsed, to determine access rights, before this is set and takes +effect, so early configuration file errors will not honour this flag. + +The tag should not be longer than 32 characters. +.wen + .vitem &%-M%&&~<&'message&~id'&>&~<&'message&~id'&>&~... .oindex "&%-M%&" .cindex "forcing delivery" @@ -3598,6 +3934,18 @@ the messages are active, their status is not altered. This option can be used only by an admin user or by the user who originally caused the message to be placed on the queue. +.vitem &%-Mset%&&~<&'message&~id'&> +.oindex "&%-Mset%& +.cindex "testing" "string expansion" +.cindex "expansion" "testing" +This option is useful only in conjunction with &%-be%& (that is, when testing +string expansions). Exim loads the given message from its spool before doing +the test expansions, thus setting message-specific variables such as +&$message_size$& and the header variables. The &$recipients$& variable is made +available. This feature is provided to make it easier to test expansions that +make use of these variables. However, this option can be used only by an admin +user. See also &%-bem%&. + .vitem &%-Mt%&&~<&'message&~id'&>&~<&'message&~id'&>&~... .oindex "&%-Mt%&" .cindex "thawing messages" @@ -3616,6 +3964,14 @@ by an admin user. This option causes the contents of the message body (-D) spool file to be written to the standard output. This option can be used only by an admin user. +.vitem &%-Mvc%&&~<&'message&~id'&> +.oindex "&%-Mvc%&" +.cindex "message" "listing in RFC 2822 format" +.cindex "listing" "message in RFC 2822 format" +This option causes a copy of the complete message (header lines plus body) to +be written to the standard output in RFC 2822 format. This option can be used +only by an admin user. + .vitem &%-Mvh%&&~<&'message&~id'&> .oindex "&%-Mvh%&" .cindex "listing" "message headers" @@ -3658,9 +4014,9 @@ for that message. .vitem &%-n%& .oindex "&%-n%&" -.cindex "Sendmail compatibility" "&%-n%& option ignored" -This option is interpreted by Sendmail to mean &"no aliasing"&. It is ignored -by Exim. +This option is interpreted by Sendmail to mean &"no aliasing"&. +For normal modes of operation, it is ignored by Exim. +When combined with &%-bP%& it suppresses the name of an option from being output. .vitem &%-O%&&~<&'data'&> .oindex "&%-O%&" @@ -3774,8 +4130,8 @@ message. Provided this error message is successfully sent, the Exim receiving process exits with a return code of zero. If not, the return code is 2 if the problem -is that the original message has no recipients, or 1 any other error. This is -the default &%-oe%&&'x'& option if Exim is called as &'rmail'&. +is that the original message has no recipients, or 1 for any other error. +This is the default &%-oe%&&'x'& option if Exim is called as &'rmail'&. .vitem &%-oem%& .oindex "&%-oem%&" @@ -3807,7 +4163,7 @@ effect as &%-oem%&. .vitem &%-oi%& .oindex "&%-oi%&" -.cindex "dot in incoming" "non-SMTP message" +.cindex "dot" "in incoming non-SMTP message" This option, which has the same effect as &%-i%&, specifies that a dot on a line by itself should not terminate an incoming, non-SMTP message. Otherwise, a single dot does terminate, though Exim does no special processing for other @@ -3820,7 +4176,7 @@ This option is treated as synonymous with &%-oi%&. .vitem &%-oMa%&&~<&'host&~address'&> .oindex "&%-oMa%&" -.cindex "sender host address" "specifying for local message" +.cindex "sender" "host address, specifying for local message" A number of options starting with &%-oM%& can be used to set values associated with remote hosts on locally-submitted messages (that is, messages not received over TCP/IP). These options can be used by any caller in conjunction with the @@ -3838,56 +4194,63 @@ followed by a colon and the port number: exim -bs -oMa [10.9.8.7]:1234 .endd The IP address is placed in the &$sender_host_address$& variable, and the -port, if present, in &$sender_host_port$&. +port, if present, in &$sender_host_port$&. If both &%-oMa%& and &%-bh%& +are present on the command line, the sender host IP address is taken from +whichever one is last. .vitem &%-oMaa%&&~<&'name'&> .oindex "&%-oMaa%&" -.cindex "authentication name" "specifying for local message" +.cindex "authentication" "name, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMaa%& option sets the value of &$sender_host_authenticated$& (the authenticator name). See chapter &<>& for a discussion of SMTP authentication. +This option can be used with &%-bh%& and &%-bs%& to set up an +authenticated SMTP session without actually using the SMTP AUTH command. .vitem &%-oMai%&&~<&'string'&> .oindex "&%-oMai%&" -.cindex "authentication id" "specifying for local message" +.cindex "authentication" "id, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMai%& option sets the value of &$authenticated_id$& (the id that was authenticated). -This overrides the default value (the caller's login id) for messages from -local sources. See chapter &<>& for a discussion of authenticated -ids. +This overrides the default value (the caller's login id, except with &%-bh%&, +where there is no default) for messages from local sources. See chapter +&<>& for a discussion of authenticated ids. .vitem &%-oMas%&&~<&'address'&> .oindex "&%-oMas%&" -.cindex "authentication sender" "specifying for local message" +.cindex "authentication" "sender, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMas%& option sets the authenticated sender value in &$authenticated_sender$&. It overrides the sender address that is created from the caller's login id for -messages from local sources. See chapter &<>& for a discussion of -authenticated senders. +messages from local sources, except when &%-bh%& is used, when there is no +default. For both &%-bh%& and &%-bs%&, an authenticated sender that is +specified on a MAIL command overrides this value. See chapter +&<>& for a discussion of authenticated senders. .vitem &%-oMi%&&~<&'interface&~address'&> .oindex "&%-oMi%&" -.cindex "interface address" "specifying for local message" +.cindex "interface" "address, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMi%& option sets the IP interface address value. A port number may be included, using the same syntax as for &%-oMa%&. The interface address is placed in -&$interface_address$& and the port number, if present, in &$interface_port$&. +&$received_ip_address$& and the port number, if present, in &$received_port$&. .vitem &%-oMr%&&~<&'protocol&~name'&> .oindex "&%-oMr%&" -.cindex "protocol" "incoming &-- specifying for local message" -.cindex "&$received_protocol$&" +.cindex "protocol, specifying for local message" +.vindex "&$received_protocol$&" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMr%& option sets the received protocol value that is stored in -&$received_protocol$&. However, this applies only when &%-bs%& is not used. For -interactive SMTP input (&%-bs%&), the protocol is always &"local-"& followed by -one of the standard SMTP protocol names (see the description of -&$received_protocol$& in section &<>&). For &%-bS%& (batch SMTP) -however, the protocol can be set by &%-oMr%&. +&$received_protocol$&. However, it does not apply (and is ignored) when &%-bh%& +or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard +SMTP protocol names (see the description of &$received_protocol$& in section +&<>&). For &%-bs%&, the protocol is always &"local-"& followed by +one of those same names. For &%-bS%& (batched SMTP) however, the protocol can +be set by &%-oMr%&. .vitem &%-oMs%&&~<&'host&~name'&> .oindex "&%-oMs%&" -.cindex "sender host name" "specifying for local message" +.cindex "sender" "host name, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMs%& option sets the sender host name in &$sender_host_name$&. When this option is present, Exim does not attempt to look up a host name from an IP address; it @@ -3895,10 +4258,11 @@ uses the name it is given. .vitem &%-oMt%&&~<&'ident&~string'&> .oindex "&%-oMt%&" -.cindex "sender ident string" "specifying for local message" +.cindex "sender" "ident string, specifying for local message" See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMt%& option sets the sender ident value in &$sender_ident$&. The default setting for -local callers is the login id of the calling process. +local callers is the login id of the calling process, except when &%-bh%& is +used, when there is no default. .vitem &%-om%& .oindex "&%-om%&" @@ -3934,7 +4298,7 @@ described in section &<>&. .vitem &%-os%&&~<&'time'&> .oindex "&%-os%&" .cindex "timeout" "for SMTP input" -.cindex "SMTP timeout" "input" +.cindex "SMTP" "input timeout" This option sets a timeout value for incoming SMTP messages. The timeout applies to each SMTP command and block of data. The value can also be set by the &%smtp_receive_timeout%& option; it defaults to 5 minutes. The format used @@ -3980,7 +4344,7 @@ For compatibility with Sendmail, this option is equivalent to It sets the incoming protocol and host name (for trusted callers). The host name and its colon can be omitted when only the protocol is to be set. Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer -to embedded Perl. It is therefore impossible to set a protocol value of &`p`& +to embedded Perl. It is therefore impossible to set a protocol value of &`d`& or &`s`& using this option (but that does not seem a real limitation). .vitem &%-q%& @@ -4142,14 +4506,24 @@ address containing the given string, which is checked in a case-independent way. If the <&'rsflags'&> start with &'r'&, <&'string'&> is interpreted as a regular expression; otherwise it is a literal string. -Once a message is selected, all its addresses are processed. For the first -selected message, Exim overrides any retry information and forces a delivery -attempt for each undelivered address. This means that if delivery of any -address in the first message is successful, any existing retry information is -deleted, and so delivery attempts for that address in subsequently selected -messages (which are processed without forcing) will run. However, if delivery -of any address does not succeed, the retry information is updated, and in -subsequently selected messages, the failing address will be skipped. +If you want to do periodic queue runs for messages with specific recipients, +you can combine &%-R%& with &%-q%& and a time value. For example: +.code +exim -q25m -R @special.domain.example +.endd +This example does a queue run for messages with recipients in the given domain +every 25 minutes. Any additional flags that are specified with &%-q%& are +applied to each queue run. + +Once a message is selected for delivery by this mechanism, all its addresses +are processed. For the first selected message, Exim overrides any retry +information and forces a delivery attempt for each undelivered address. This +means that if delivery of any address in the first message is successful, any +existing retry information is deleted, and so delivery attempts for that +address in subsequently selected messages (which are processed without forcing) +will run. However, if delivery of any address does not succeed, the retry +information is updated, and in subsequently selected messages, the failing +address will be skipped. .cindex "frozen messages" "forcing delivery" If the <&'rsflags'&> contain &'f'& or &'ff'&, the delivery forcing applies to @@ -4177,7 +4551,7 @@ has &'f'& or &'ff'& in its flags, the associated action is taken. .vitem &%-Tqt%&&~<&'times'&> .oindex "&%-Tqt%&" -This an option that is exclusively for use by the Exim testing suite. It is not +This is an option that is exclusively for use by the Exim testing suite. It is not recognized when Exim is run normally. It allows for the setting up of explicit &"queue times"& so that various warning/retry features can be tested. @@ -4261,6 +4635,13 @@ AIX uses &%-x%& for a private purpose (&"mail from a local mail program has National Language Support extended characters in the body of the mail item"&). It sets &%-x%& when calling the MTA from its &%mail%& command. Exim ignores this option. + +.new +.vitem &%-X%&&~<&'logfile'&> +.oindex "&%-X%&" +This option is interpreted by Sendmail to cause debug information to be sent +to the named file. It is ignored by Exim. +.wen .endlist .ecindex IIDclo1 @@ -4319,17 +4700,21 @@ existing file in the list. .cindex "configuration file" "ownership" .cindex "ownership" "configuration file" The run time configuration file must be owned by root or by the user that is -specified at compile time by the EXIM_USER option, or by the user that is specified at compile time by the CONFIGURE_OWNER option (if set). The -configuration file must not be world-writeable or group-writeable, unless its -group is the one specified at compile time by the EXIM_GROUP option or by the +configuration file must not be world-writeable, or group-writeable unless its +group is the root group or the one specified at compile time by the CONFIGURE_GROUP option. &*Warning*&: In a conventional configuration, where the Exim binary is setuid to root, anybody who is able to edit the run time configuration file has an -easy way to run commands as root. If you make your mail administrators members -of the Exim group, but do not trust them with root, make sure that the run time -configuration is not group writeable. +easy way to run commands as root. If you specify a user or group in the +CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users +who are members of that group will trivially be able to obtain root privileges. + +Up to Exim version 4.72, the run time configuration file was also permitted to +be writeable by the Exim user and/or group. That has been changed in Exim 4.73 +since it offered a simple privilege escalation for any attacker who managed to +compromise the Exim user account. A default configuration file, which will work correctly in simple situations, is provided in the file &_src/configure.default_&. If CONFIGURE_FILE @@ -4341,25 +4726,28 @@ configuration. -.section "Using a different configuration file" +.section "Using a different configuration file" "SECID40" .cindex "configuration file" "alternate" A one-off alternate configuration can be specified by the &%-C%& command line option, which may specify a single file or a list of files. However, when -&%-C%& is used, Exim gives up its root privilege, unless called by root or the -Exim user (or unless the argument for &%-C%& is identical to the built-in value -from CONFIGURE_FILE). &%-C%& is useful mainly for checking the syntax of -configuration files before installing them. No owner or group checks are done -on a configuration file specified by &%-C%&. - -The privileged use of &%-C%& by the Exim user can be locked out by setting -ALT_CONFIG_ROOT_ONLY in &_Local/Makefile_& when building Exim. However, -if you do this, you also lock out the possibility of testing a -configuration using &%-C%& right through message reception and delivery, even -if the caller is root. The reception works, but by that time, Exim is running -as the Exim user, so when it re-execs to regain privilege for the delivery, the -use of &%-C%& causes privilege to be lost. However, root can test reception and -delivery using two separate commands (one to put a message on the queue, using -&%-odq%&, and another to do the delivery, using &%-M%&). +&%-C%& is used, Exim gives up its root privilege, unless called by root (or +unless the argument for &%-C%& is identical to the built-in value from +CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller +is the Exim user or the user specified in the CONFIGURE_OWNER setting. &%-C%& +is useful mainly for checking the syntax of configuration files before +installing them. No owner or group checks are done on a configuration file +specified by &%-C%&, if root privilege has been dropped. + +Even the Exim user is not trusted to specify an arbitrary configuration file +with the &%-C%& option to be used with root privileges, unless that file is +listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of +testing a configuration using &%-C%& right through message reception and +delivery, even if the caller is root. The reception works, but by that time, +Exim is running as the Exim user, so when it re-execs to regain privilege for +the delivery, the use of &%-C%& causes privilege to be lost. However, root +can test reception and delivery using two separate commands (one to put a +message on the queue, using &%-odq%&, and another to do the delivery, using +&%-M%&). If ALT_CONFIG_PREFIX is defined &_in Local/Makefile_&, it specifies a prefix string with which any file named in a &%-C%& command line option must @@ -4374,6 +4762,16 @@ non-privileged user causes Exim to discard its root privilege. If DISABLE_D_OPTION is defined in &_Local/Makefile_&, the use of &%-D%& is completely disabled, and its use causes an immediate error exit. +The WHITELIST_D_MACROS option in &_Local/Makefile_& permits the binary builder +to declare certain macro names trusted, such that root privilege will not +necessarily be discarded. +WHITELIST_D_MACROS defines a colon-separated list of macros which are +considered safe and, if &%-D%& only supplies macros from this list, and the +values are acceptable, then Exim will not give up root privilege if the caller +is root, the Exim run-time user, or the CONFIGURE_OWNER, if set. This is a +transition mechanism and is expected to be removed in the future. Acceptable +values for the macros satisfy the regexp: &`^[A-Za-z0-9_/.-]*$`& + Some sites may wish to use the same Exim binary on different machines that share a file system, but to use different configuration files on each machine. If CONFIGURE_FILE_USE_NODE is defined in &_Local/Makefile_&, Exim first @@ -4398,30 +4796,38 @@ is introduced by the word &"begin"& followed by the name of the part. The optional parts are: .ilist -&'ACL'&: Access control lists for controlling incoming SMTP mail. +&'ACL'&: Access control lists for controlling incoming SMTP mail (see chapter +&<>&). .next .cindex "AUTH" "configuration" &'authenticators'&: Configuration settings for the authenticator drivers. These are concerned with the SMTP AUTH command (see chapter &<>&). .next &'routers'&: Configuration settings for the router drivers. Routers process -addresses and determine how the message is to be delivered. +addresses and determine how the message is to be delivered (see chapters +&<>&&--&<>&). .next &'transports'&: Configuration settings for the transport drivers. Transports -define mechanisms for copying messages to destinations. +define mechanisms for copying messages to destinations (see chapters +&<>&&--&<>&). .next -&'retry'&: Retry rules, for use when a message cannot be immediately delivered. +&'retry'&: Retry rules, for use when a message cannot be delivered immediately. +If there is no retry section, or if it is empty (that is, no retry rules are +defined), Exim will not retry deliveries. In this situation, temporary errors +are treated the same as permanent errors. Retry rules are discussed in chapter +&<>&. .next &'rewrite'&: Global address rewriting rules, for use when a message arrives and -when new addresses are generated during delivery. +when new addresses are generated during delivery. Rewriting is discussed in +chapter &<>&. .next &'local_scan'&: Private options for the &[local_scan()]& function. If you want to use this feature, you must set .code LOCAL_SCAN_HAS_OPTIONS=yes .endd -in &_Local/Makefile_& before building Exim. Full details of the -&[local_scan()]& facility are given in chapter &<>&. +in &_Local/Makefile_& before building Exim. Details of the &[local_scan()]& +facility are given in chapter &<>&. .endlist .cindex "configuration file" "leading white space in" @@ -4453,11 +4859,11 @@ described. -.section "File inclusions in the configuration file" +.section "File inclusions in the configuration file" "SECID41" .cindex "inclusions in configuration file" .cindex "configuration file" "including other files" -.cindex ".include in configuration file" -.cindex ".include_if_exists in configuration file" +.cindex "&`.include`& in configuration file" +.cindex "&`.include_if_exists`& in configuration file" You can include other files inside Exim's run time configuration file by using this syntax: .display @@ -4506,7 +4912,7 @@ Macros may also be defined between router, transport, authenticator, or ACL definitions. They may not, however, be defined within an individual driver or ACL, or in the &%local_scan%&, retry, or rewrite sections of the configuration. -.section "Macro substitution" +.section "Macro substitution" "SECID42" Once a macro is defined, all subsequent lines in the file (and any included files) are scanned for the macro name; if there are several macros, the line is scanned for each in turn, in the order in which the macros are defined. The @@ -4526,7 +4932,7 @@ line is ignored. A macro at the start of a line may turn the line into a comment line or a &`.include`& line. -.section "Redefining macros" +.section "Redefining macros" "SECID43" Once defined, the value of a macro can be redefined later in the configuration (or in an included file). Redefinition is specified by using &'=='& instead of &'='&. For example: @@ -4547,7 +4953,7 @@ MAC == MAC and something added This can be helpful in situations where the configuration file is built from a number of other files. -.section "Overriding macro values" +.section "Overriding macro values" "SECID44" The values set for macros in the configuration file can be overridden by the &%-D%& command line option, but Exim gives up its root privilege when &%-D%& is used, unless called by root or the Exim user. A definition on the command line @@ -4556,13 +4962,13 @@ file to be ignored. -.section "Example of macro usage" +.section "Example of macro usage" "SECID45" As an example of macro usage, consider a configuration where aliases are looked up in a MySQL database. It helps to keep the file less cluttered if long strings such as SQL statements are defined separately as macros, for example: .code ALIAS_QUERY = select mailbox from user where \ - login=${quote_mysql:$local_part}; + login='${quote_mysql:$local_part}'; .endd This can then be used in a &(redirect)& router setting like this: .code @@ -4573,9 +4979,9 @@ address lists. In Exim 4 these are handled better by named lists &-- see section &<>&. -.section "Conditional skips in the configuration file" +.section "Conditional skips in the configuration file" "SECID46" .cindex "configuration file" "conditional skips" -.cindex ".ifdef" +.cindex "&`.ifdef`&" You can use the directives &`.ifdef`&, &`.ifndef`&, &`.elifdef`&, &`.elifndef`&, &`.else`&, and &`.endif`& to dynamically include or exclude portions of the configuration file. The processing happens whenever the file is @@ -4618,6 +5024,9 @@ space) and then the value. For example: .code qualify_domain = mydomain.example.com .endd +.cindex "hiding configuration option values" +.cindex "configuration options" "hiding value of" +.cindex "options" "hiding value of" Some option settings may contain sensitive data, for example, passwords for accessing databases. To stop non-admin users from using the &%-bP%& command line option to read these values, you can precede the option settings with the @@ -4636,7 +5045,7 @@ The following sections describe the syntax used for the different data types that are found in option settings. -.section "Boolean options" +.section "Boolean options" "SECID47" .cindex "format" "boolean" .cindex "boolean configuration values" .oindex "&%no_%&&'xxx'&" @@ -4662,51 +5071,51 @@ You can use whichever syntax you prefer. -.section "Integer values" +.section "Integer values" "SECID48" .cindex "integer configuration values" .cindex "format" "integer" -If an integer data item starts with the characters &"0x"&, the remainder of it -is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it -starts with the digit 0, and decimal if not. If an integer value is followed by -the letter K, it is multiplied by 1024; if it is followed by the letter M, it -is multiplied by 1024x1024. - -When the values of integer option settings are output, values which are an -exact multiple of 1024 or 1024x1024 are -sometimes, but not always, -printed using the letters K and M. The printing style is independent of the -actual input format that was used. +If an option's type is given as &"integer"&, the value can be given in decimal, +hexadecimal, or octal. If it starts with a digit greater than zero, a decimal +number is assumed. Otherwise, it is treated as an octal number unless it starts +with the characters &"0x"&, in which case the remainder is interpreted as a +hexadecimal number. + +If an integer value is followed by the letter K, it is multiplied by 1024; if +it is followed by the letter M, it is multiplied by 1024x1024. When the values +of integer option settings are output, values which are an exact multiple of +1024 or 1024x1024 are sometimes, but not always, printed using the letters K +and M. The printing style is independent of the actual input format that was +used. -.section "Octal integer values" +.section "Octal integer values" "SECID49" .cindex "integer format" .cindex "format" "octal integer" -The value of an option specified as an octal integer is always interpreted in -octal, whether or not it starts with the digit zero. Such options are always -output in octal. +If an option's type is given as &"octal integer"&, its value is always +interpreted as an octal number, whether or not it starts with the digit zero. +Such options are always output in octal. - -.section "Fixed point number values" +.section "Fixed point numbers" "SECID50" .cindex "fixed point configuration values" .cindex "format" "fixed point" -A fixed point number consists of a decimal integer, optionally followed by a -decimal point and up to three further digits. +If an option's type is given as &"fixed-point"&, its value must be a decimal +integer, optionally followed by a decimal point and up to three further digits. -.section "Time interval values" "SECTtimeformat" +.section "Time intervals" "SECTtimeformat" .cindex "time interval" "specifying in configuration" .cindex "format" "time interval" A time interval is specified as a sequence of numbers, each followed by one of the following letters, with no intervening white space: -.table2 50pt -.row &~&%s%& seconds -.row &~&%m%& minutes -.row &~&%h%& hours -.row &~&%d%& days -.row &~&%w%& weeks +.table2 30pt +.irow &%s%& seconds +.irow &%m%& minutes +.irow &%h%& hours +.irow &%d%& days +.irow &%w%& weeks .endtable For example, &"3h50m"& specifies 3 hours and 50 minutes. The values of time @@ -4718,16 +5127,16 @@ is perfectly acceptable, for example, to specify &"90m"& instead of &"1h30m"&. .section "String values" "SECTstrings" .cindex "string" "format of configuration values" .cindex "format" "string" -If a string data item does not start with a double-quote character, it is taken -as consisting of the remainder of the line plus any continuation lines, -starting at the first character after any leading white space, with trailing -white space removed, and with no interpretation of the characters in the -string. Because Exim removes comment lines (those beginning with #) at an early -stage, they can appear in the middle of a multi-line string. The following -settings are therefore equivalent: +If an option's type is specified as &"string"&, the value can be specified with +or without double-quotes. If it does not start with a double-quote, the value +consists of the remainder of the line plus any continuation lines, starting at +the first character after any leading white space, with trailing white space +removed, and with no interpretation of the characters in the string. Because +Exim removes comment lines (those beginning with #) at an early stage, they can +appear in the middle of a multi-line string. The following two settings are +therefore equivalent: .code trusted_users = uucp:mail - trusted_users = uucp:\ # This comment line is ignored mail @@ -4739,12 +5148,12 @@ double-quote, and any backslash characters other than those used for line continuation are interpreted as escape characters, as follows: .table2 100pt -.row &~&`\\`& "single backslash" -.row &~&`\n`& "newline" -.row &~&`\r`& "carriage return" -.row &~&`\t`& "tab" -.row "&~&`\`&<&'octal digits'&>" "up to 3 octal digits specify one character" -.row "&~&`\x`&<&'hex digits'&>" "up to 2 hexadecimal digits specify one &&& +.irow &`\\`& "single backslash" +.irow &`\n`& "newline" +.irow &`\r`& "carriage return" +.irow &`\t`& "tab" +.irow "&`\`&<&'octal digits'&>" "up to 3 octal digits specify one character" +.irow "&`\x`&<&'hex digits'&>" "up to 2 hexadecimal digits specify one &&& character" .endtable @@ -4759,8 +5168,7 @@ in order to continue lines, so you may come across older configuration files and examples that apparently quote unnecessarily. -.section "Expanded strings" -.cindex "string expansion" "definition of" +.section "Expanded strings" "SECID51" .cindex "expansion" "definition of" Some strings in the configuration file are subjected to &'string expansion'&, by which means various parts of the string may be changed according to the @@ -4772,10 +5180,10 @@ backslashes that are required for that reason must be doubled if they are within a quoted configuration string. -.section "User and group names" +.section "User and group names" "SECID52" .cindex "user name" "format of" .cindex "format" "user name" -.cindex "group" "name format" +.cindex "groups" "name format" .cindex "format" "group name" User and group names are specified as strings, using the syntax described above, but the strings are interpreted specially. A user or group name must @@ -4786,7 +5194,7 @@ either consist entirely of digits, or be a name that can be looked up using the .section "List construction" "SECTlistconstruct" .cindex "list" "syntax of in configuration" .cindex "format" "list item in configuration" -.cindex "string list" "definition" +.cindex "string" "list, definition of" The data for some configuration options is a list of items, with colon as the default separator. Many of these options are shown with type &"string list"& in the descriptions later in this document. Others are listed as &"domain list"&, @@ -4812,6 +5220,7 @@ list items, it is not ignored when parsing the list. The space after the first colon in the example above is necessary. If it were not there, the list would be interpreted as the two items 127.0.0.1:: and 1. +.section "Changing list separators" "SECID53" .cindex "list separator" "changing" .cindex "IPv6" "addresses in lists" Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was @@ -4826,6 +5235,30 @@ This facility applies to all lists, with the exception of the list in &%log_file_path%&. It is recommended that the use of non-colon separators be confined to circumstances where they really are needed. +.cindex "list separator" "newline as" +.cindex "newline" "as list separator" +It is also possible to use newline and other control characters (those with +code values less than 32, plus DEL) as separators in lists. Such separators +must be provided literally at the time the list is processed. For options that +are string-expanded, you can write the separator using a normal escape +sequence. This will be processed by the expander before the string is +interpreted as a list. For example, if a newline-separated list of domains is +generated by a lookup, you can process it directly by a line such as this: +.code +domains = <\n ${lookup mysql{.....}} +.endd +This avoids having to change the list separator in such data. You are unlikely +to want to use a control character as a separator in an option that is not +expanded, because the value is literal text. However, it can be done by giving +the value in quotes. For example: +.code +local_interfaces = "<\n 127.0.0.1 \n ::1" +.endd +Unlike printing character separators, which can be included in list items by +doubling, it is not possible to include a control character as data when it is +set as the separator. Two such characters in succession are interpreted as +enclosing an empty list item. + .section "Empty items in lists" "SECTempitelis" @@ -4958,7 +5391,7 @@ mentioned at all in the default configuration. -.section "Main configuration settings" +.section "Main configuration settings" "SECTdefconfmain" The main (global) configuration option settings must always come first in the file. The first thing you'll see in the file, after some initial comments, is the line @@ -4972,7 +5405,7 @@ it is unset, Exim uses the &[uname()]& system function to obtain the host name. The first three non-comment configuration lines are as follows: .code -domainlist local_domains = @ +domainlist local_domains = @ domainlist relay_to_domains = hostlist relay_from_hosts = 127.0.0.1 .endd @@ -5034,6 +5467,42 @@ content-scanning extension. The first specifies the interface to the virus scanner, and the second specifies the interface to SpamAssassin. Further details are given in chapter &<>&. +Three more commented-out option settings follow: +.code +# tls_advertise_hosts = * +# tls_certificate = /etc/ssl/exim.crt +# tls_privatekey = /etc/ssl/exim.pem +.endd +These are example settings that can be used when Exim is compiled with +support for TLS (aka SSL) as described in section &<>&. The +first one specifies the list of clients that are allowed to use TLS when +connecting to this server; in this case the wildcard means all clients. The +other options specify where Exim should find its TLS certificate and private +key, which together prove the server's identity to any clients that connect. +More details are given in chapter &<>&. + +Another two commented-out option settings follow: +.code +# daemon_smtp_ports = 25 : 465 : 587 +# tls_on_connect_ports = 465 +.endd +.cindex "port" "465 and 587" +.cindex "port" "for message submission" +.cindex "message" "submission, ports for" +.cindex "ssmtp protocol" +.cindex "smtps protocol" +.cindex "SMTP" "ssmtp protocol" +.cindex "SMTP" "smtps protocol" +These options provide better support for roaming users who wish to use this +server for message submission. They are not much use unless you have turned on +TLS (as described in the previous paragraph) and authentication (about which +more in section &<>&). The usual SMTP port 25 is often blocked +on end-user networks, so RFC 4409 specifies that message submission should use +port 587 instead. However some software (notably Microsoft Outlook) cannot be +configured to use port 587 correctly, so these settings also enable the +non-standard &"smtps"& (aka &"ssmtp"&) port 465 (see section +&<>&). + Two more commented-out options settings follow: .code # qualify_domain = @@ -5089,12 +5558,10 @@ unreachable. The next two lines are concerned with &'ident'& callbacks, as defined by RFC 1413 (hence their names): -.new .code rfc1413_hosts = * rfc1413_query_timeout = 5s .endd -.wen These settings cause Exim to make ident callbacks for all incoming SMTP calls. You can limit the hosts to which these calls are made, or change the timeout that is used. If you set the timeout to zero, all ident calls are disabled. @@ -5142,7 +5609,7 @@ bounce message ever lasts a week. -.section "ACL configuration" +.section "ACL configuration" "SECID54" .cindex "default" "ACLs" .cindex "&ACL;" "default configuration" In the default configuration, the ACL section follows the main configuration. @@ -5275,51 +5742,46 @@ accept authenticated = * This statement accepts the address if the client host has authenticated itself. Submission mode is again specified, on the grounds that such messages are most likely to come from MUAs. The default configuration does not define any -authenticators, which means that no client can in fact authenticate. You will -need to add authenticator definitions if you want to make use of this ACL -statement. +authenticators, though it does include some nearly complete commented-out +examples described in &<>&. This means that no client can in +fact authenticate until you complete the authenticator definitions. +.code +require message = relay not permitted + domains = +local_domains : +relay_to_domains +.endd +This statement rejects the address if its domain is neither a local domain nor +one of the domains for which this host is a relay. +.code +require verify = recipient +.endd +This statement requires the recipient address to be verified; if verification +fails, the address is rejected. .code # deny message = rejected because $sender_host_address \ # is in a black list at $dnslist_domain\n\ # $dnslist_text # dnslists = black.list.example # -# warn message = X-Warning: $sender_host_address is \ -# in a black list at $dnslist_domain +# warn dnslists = black.list.example +# add_header = X-Warning: $sender_host_address is in \ +# a black list at $dnslist_domain # log_message = found in $dnslist_domain -# dnslists = black.list.example .endd These commented-out lines are examples of how you could configure Exim to check sending hosts against a DNS black list. The first statement rejects messages -from blacklisted hosts, whereas the second merely inserts a warning header +from blacklisted hosts, whereas the second just inserts a warning header line. .code -accept domains = +local_domains - endpass - verify = recipient -.endd -This statement accepts the incoming recipient address if its domain is one of -the local domains, but only if the address can be verified. Verification of -local addresses normally checks both the local part and the domain. The -&%endpass%& line needs some explanation: if the condition above &%endpass%& -fails, that is, if the address is not in a local domain, control is passed to -the next ACL statement. However, if the condition below &%endpass%& fails, that -is, if a recipient in a local domain cannot be verified, access is denied and -the recipient is rejected. -.code -accept domains = +relay_to_domains - endpass - verify = recipient +# require verify = csa .endd -This statement accepts the incoming recipient address if its domain is one of -the domains for which this host is a relay, but again, only if the address can -be verified. +This commented-out line is an example of how you could turn on client SMTP +authorization (CSA) checking. Such checks do DNS lookups for special SRV +records. .code -deny message = relay not permitted +accept .endd -The final statement denies access, giving a specific error message. Reaching -the end of the ACL also causes access to be denied, but with the generic -message &"administrative prohibition"&. +The final statement in the first ACL unconditionally accepts any recipient +address that has successfully passed all the previous tests. .code acl_check_data: .endd @@ -5353,7 +5815,7 @@ accept This final line in the DATA ACL accepts the message unconditionally. -.section "Router configuration" +.section "Router configuration" "SECID55" .cindex "default" "routers" .cindex "routers" "default" The router configuration comes next in the default configuration, introduced @@ -5464,7 +5926,7 @@ namely: # local_part_suffix = +* : -* # local_part_suffix_optional .endd -.cindex "&$local_part_suffix$&" +.vindex "&$local_part_suffix$&" show how you can specify the recognition of local part suffixes. If the first is uncommented, a suffix beginning with either a plus or a minus sign, followed by any sequence of characters, is removed from the local part and placed in the @@ -5529,7 +5991,7 @@ routers, so the address is bounced. The commented suffix settings fulfil the same purpose as they do for the &(userforward)& router. -.section "Transport configuration" +.section "Transport configuration" "SECID56" .cindex "default" "transports" .cindex "transports" "default" Transports define mechanisms for actually delivering messages. They operate @@ -5593,7 +6055,7 @@ filter files. -.section "Default retry rule" +.section "Default retry rule" "SECID57" .cindex "retry" "default rule" .cindex "default" "retry rule" The retry section of the configuration file contains rules which affect the way @@ -5612,9 +6074,12 @@ This causes any temporarily failing address to be retried every 15 minutes for 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address is not delivered after 4 days of temporary failure, it is bounced. +If the retry section is removed from the configuration, or is empty (that is, +if no retry rules are defined), Exim will not retry deliveries. This turns +temporary errors into permanent errors. -.section "Rewriting configuration" +.section "Rewriting configuration" "SECID58" The rewriting section of the configuration, introduced by .code begin rewrite @@ -5624,14 +6089,56 @@ rewriting rules in the default configuration file. -.section "Authenticators configuration" +.section "Authenticators configuration" "SECTdefconfauth" .cindex "AUTH" "configuration" The authenticators section of the configuration, introduced by .code begin authenticators .endd -defines mechanisms for the use of the SMTP AUTH command. No authenticators -are specified in the default configuration file. +defines mechanisms for the use of the SMTP AUTH command. The default +configuration file contains two commented-out example authenticators +which support plaintext username/password authentication using the +standard PLAIN mechanism and the traditional but non-standard LOGIN +mechanism, with Exim acting as the server. PLAIN and LOGIN are enough +to support most MUA software. + +The example PLAIN authenticator looks like this: +.code +#PLAIN: +# driver = plaintext +# server_set_id = $auth2 +# server_prompts = : +# server_condition = Authentication is not yet configured +# server_advertise_condition = ${if def:tls_in_cipher } +.endd +And the example LOGIN authenticator looks like this: +.code +#LOGIN: +# driver = plaintext +# server_set_id = $auth1 +# server_prompts = <| Username: | Password: +# server_condition = Authentication is not yet configured +# server_advertise_condition = ${if def:tls_in_cipher } +.endd + +The &%server_set_id%& option makes Exim remember the authenticated username +in &$authenticated_id$&, which can be used later in ACLs or routers. The +&%server_prompts%& option configures the &(plaintext)& authenticator so +that it implements the details of the specific authentication mechanism, +i.e. PLAIN or LOGIN. The &%server_advertise_condition%& setting controls +when Exim offers authentication to clients; in the examples, this is only +when TLS or SSL has been started, so to enable the authenticators you also +need to add support for TLS as described in section &<>&. + +The &%server_condition%& setting defines how to verify that the username and +password are correct. In the examples it just produces an error message. +To make the authenticators work, you can use a string expansion +expression like one of the examples in chapter &<>&. + +Beware that the sequence of the parameters to PLAIN and LOGIN differ; the +usercode and password are in different positions. +Chapter &<>& covers both. + .ecindex IIDconfiwal @@ -5651,13 +6158,11 @@ Jeffrey Friedl's &'Mastering Regular Expressions'&, which is published by O'Reilly (see &url(http://www.oreilly.com/catalog/regex2/)). The documentation for the syntax and semantics of the regular expressions that -are supported by PCRE is included in plain text in the file -&_doc/pcrepattern.txt_& in the Exim distribution, and also in the HTML -tarbundle of Exim documentation. It describes in detail the features of the -regular expressions that PCRE supports, so no further description is included -here. The PCRE functions are called from Exim using the default option settings -(that is, with no PCRE options set), except that the PCRE_CASELESS option is -set when the matching is required to be case-insensitive. +are supported by PCRE is included in the PCRE distribution, and no further +description is included here. The PCRE functions are called from Exim using +the default option settings (that is, with no PCRE options set), except that +the PCRE_CASELESS option is set when the matching is required to be +case-insensitive. In most cases, when a regular expression is required in an Exim configuration, it has to start with a circumflex, in order to distinguish it from plain text @@ -5696,53 +6201,12 @@ $ is needed because string expansion also interprets dollar characters. -.section "Testing regular expressions" -.cindex "testing" "regular expressions" -.cindex "regular expressions" "testing" -.cindex "&'pcretest'&" -A program called &'pcretest'& forms part of the PCRE distribution and is built -with PCRE during the process of building Exim. It is primarily intended for -testing PCRE itself, but it can also be used for experimenting with regular -expressions. After building Exim, the binary can be found in the build -directory (it is not installed anywhere automatically). There is documentation -of various options in &_doc/pcretest.txt_&, but for simple testing, none are -needed. This is the output of a sample run of &'pcretest'&: -.display -&` re> `&&*&`/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/`&*& -&`data> `&&*&`x@y.ac.uk`&*& -&` 0: x@y.ac.uk`& -&` 1: x`& -&` 2: ac`& -&`data> `&&*&`x@y.ac.kr`&*& -&`No match`& -&`data> `&&*&`x@y.edu.com`&*& -&`No match`& -&`data> `&&*&`x@y.edu.co`&*& -&` 0: x@y.edu.co`& -&` 1: x`& -&` 2: edu`& -.endd -Input typed by the user is shown in bold face. After the &"re>"& prompt, a -regular expression enclosed in delimiters is expected. If this compiles without -error, &"data>"& prompts are given for strings against which the expression is -matched. An empty data line causes a new regular expression to be read. If the -match is successful, the captured substring values (that is, what would be in -the variables &$0$&, &$1$&, &$2$&, etc.) are shown. The above example tests for -an email address whose domain ends with either &"ac"& or &"edu"& followed by a -two-character top-level domain that is not &"kr"&. The local part is captured -in &$1$& and the &"ac"& or &"edu"& in &$2$&. - - - - - - . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// .chapter "File and database lookups" "CHAPfdlookup" .scindex IIDfidalo1 "file" "lookups" -.scindex IIDfidalo2 "database lookups" +.scindex IIDfidalo2 "database" "lookups" .cindex "lookup" "description of" Exim can be configured to look up data in files or databases as it processes messages. Two different kinds of syntax are used: @@ -5768,7 +6232,7 @@ if you have read the other two first. If you are reading this for the first time, be aware that some of it will make a lot more sense after you have read chapters &<>& and &<>&. -.section "Examples of different lookup syntax" +.section "Examples of different lookup syntax" "SECID60" It is easy to confuse the two different kinds of lookup, especially as the lists that may contain the second kind are always expanded before being processed as lists. Therefore, they may also contain lookups of the first kind. @@ -5813,7 +6277,7 @@ available. Any of them can be used in any part of the configuration where a lookup is permitted. -.section "Lookup types" +.section "Lookup types" "SECID61" .cindex "lookup" "types of" .cindex "single-key lookup" "definition of" Two different types of data lookup are implemented: @@ -5855,7 +6319,7 @@ The following single-key lookup types are implemented: &(cdb)&: The given file is searched as a Constant DataBase file, using the key string without a terminating binary zero. The cdb format is designed for indexed files that are read frequently and never updated, except by total -re-creation. As such, it is particulary suitable for large files containing +re-creation. As such, it is particularly suitable for large files containing aliases or other indexed data referenced by an MTA. Information about cdb can be found in several places: .display @@ -5884,12 +6348,23 @@ the DB_UNKNOWN option. This enables it to handle any of the types of database that the library supports, and can be useful for accessing DBM files created by other applications. (For earlier DB versions, DB_HASH is always used.) .next +.cindex "lookup" "dbmjz" +.cindex "lookup" "dbm &-- embedded NULs" +.cindex "sasldb2" +.cindex "dbmjz lookup type" +&(dbmjz)&: This is the same as &(dbm)&, except that the lookup key is +interpreted as an Exim list; the elements of the list are joined together with +ASCII NUL characters to form the lookup key. An example usage would be to +authenticate incoming SMTP calls using the passwords from Cyrus SASL's +&_/etc/sasldb2_& file with the &(gsasl)& authenticator or Exim's own +&(cram_md5)& authenticator. +.next .cindex "lookup" "dbmnz" .cindex "lookup" "dbm &-- terminating zero" .cindex "binary zero" "in lookup key" .cindex "Courier" .cindex "&_/etc/userdbshadow.dat_&" -.cindex "dmbnz lookup type" +.cindex "dbmnz lookup type" &(dbmnz)&: This is the same as &(dbm)&, except that a terminating binary zero is not included in the key that is passed to the DBM library. You may need this if you want to look up data in files that are created by or shared with some @@ -5901,10 +6376,12 @@ by default, but has an option to omit them (see section &<>&). .next .cindex "lookup" "dsearch" .cindex "dsearch lookup type" -&(dsearch)&: The given file must be a directory; this is searched for a file -whose name is the key. The key may not contain any forward slash characters. -The result of a successful lookup is the name of the file. An example of how -this lookup can be used to support virtual domains is given in section +&(dsearch)&: The given file must be a directory; this is searched for an entry +whose name is the key by calling the &[lstat()]& function. The key may not +contain any forward slash characters. If &[lstat()]& succeeds, the result of +the lookup is the name of the entry, which may be a file, directory, +symbolic link, or any other kind of directory entry. An example of how this +lookup can be used to support virtual domains is given in section &<>&. .next .cindex "lookup" "iplsearch" @@ -5916,7 +6393,7 @@ IPv6 addresses must be enclosed in quotes to prevent the first internal colon being interpreted as a key terminator. For example: .code 1.2.3.4: data for 1.2.3.4 -192.168.0.0/16 data for 192.168.0.0/16 +192.168.0.0/16: data for 192.168.0.0/16 "abcd::cdab": data for abcd::cdab "abcd:abcd::/32" data for abcd:abcd::/32 .endd @@ -5933,16 +6410,19 @@ lookup types support only literal keys. &*Warning 2*&: In a host list, you must always use &(net-iplsearch)& so that the implicit key is the host's IP address rather than its name (see section &<>&). - .next .cindex "linear search" .cindex "lookup" "lsearch" .cindex "lsearch lookup type" +.cindex "case sensitivity" "in lsearch lookup" &(lsearch)&: The given file is a text file that is searched linearly for a line beginning with the search key, terminated by a colon or white space or the -end of the line. The first occurrence that is found in the file is used. White -space between the key and the colon is permitted. The remainder of the line, -with leading and trailing white space removed, is the data. This can be +end of the line. The search is case-insensitive; that is, upper and lower case +letters are treated as the same. The first occurrence of the key that is found +in the file is used. + +White space between the key and the colon is permitted. The remainder of the +line, with leading and trailing white space removed, is the data. This can be continued onto subsequent lines by starting them with any amount of white space, but only a single space character is included in the data at such a junction. If the data begins with a colon, the key must be terminated by a @@ -5986,8 +6466,10 @@ the file may be wildcarded. The difference between these two lookup types is that for &(wildlsearch)&, each key in the file is string-expanded before being used, whereas for &(nwildlsearch)&, no expansion takes place. -Like &(lsearch)&, the testing is done case-insensitively. The following forms -of wildcard are recognized: +.cindex "case sensitivity" "in (n)wildlsearch lookup" +Like &(lsearch)&, the testing is done case-insensitively. However, keys in the +file that are regular expressions can be made case-sensitive by the use of +&`(-i)`& within the pattern. The following forms of wildcard are recognized: . ==== As this is a nested list, any displays it contains must be indented . ==== as otherwise they are too far to the left. @@ -6010,6 +6492,13 @@ string-expanded, the equivalent entry is: .code ^\d+\.a\.b data for .a.b .endd +The case-insensitive flag is set at the start of compiling the regular +expression, but it can be turned off by using &`(-i)`& at an appropriate point. +For example, to make the entire pattern case-sensitive: +.code + ^(?-i)\d+\.a\.b data for .a.b +.endd + If the regular expression contains white space or colon characters, you must either quote it (see &(lsearch)& above), or represent these characters in other ways. For example, &`\s`& can be used for white space and &`\x3A`& for a @@ -6043,7 +6532,7 @@ lookup types support only literal keys. .endlist ilist -.section "Query-style lookup types" +.section "Query-style lookup types" "SECID62" .cindex "lookup" "query-style types" .cindex "query-style lookup" "list of types" The supported query-style lookup types are listed below. Further details about @@ -6056,9 +6545,9 @@ many of them are given in later sections. are given in the supplied query. The resulting data is the contents of the records. See section &<>&. .next -.cindex "Interbase lookup type" -.cindex "lookup" "Interbase" -&(ibase)&: This does a lookup in an Interbase database. +.cindex "InterBase lookup type" +.cindex "lookup" "InterBase" +&(ibase)&: This does a lookup in an InterBase database. .next .cindex "LDAP" "lookup type" .cindex "lookup" "LDAP" @@ -6112,12 +6601,13 @@ not likely to be useful in normal operation. .next .cindex "whoson lookup type" .cindex "lookup" "whoson" -&(whoson)&: &'Whoson'& (&url(http://whoson.sourceforge.net)) is a proposed -Internet protocol that allows Internet server programs to check whether a -particular (dynamically allocated) IP address is currently allocated to a known -(trusted) user and, optionally, to obtain the identity of the said user. In -Exim, this can be used to implement &"POP before SMTP"& checking using ACL -statements such as +&(whoson)&: &'Whoson'& (&url(http://whoson.sourceforge.net)) is a protocol that +allows a server to check whether a particular (dynamically allocated) IP +address is currently allocated to a known (trusted) user and, optionally, to +obtain the identity of the said user. For SMTP servers, &'Whoson'& was popular +at one time for &"POP before SMTP"& authentication, but that approach has been +superseded by SMTP authentication. In Exim, &'Whoson'& can be used to implement +&"POP before SMTP"& checking using ACL statements such as .code require condition = \ ${lookup whoson {$sender_host_address}{yes}{no}} @@ -6130,7 +6620,7 @@ one of the fixed strings &"yes"& or &"no"&. -.section "Temporary errors in lookups" +.section "Temporary errors in lookups" "SECID63" .cindex "lookup" "temporary error in" Lookup functions can return temporary error codes if the lookup cannot be completed. For example, an SQL or LDAP database might be unavailable. For this @@ -6153,6 +6643,10 @@ or may give up altogether. In this context, a &"default value"& is a value specified by the administrator that is to be used if a lookup fails. +&*Note:*& This section applies only to single-key lookups. For query-style +lookups, the facilities of the query language must be used. An attempt to +specify a default for a query-style lookup provokes an error. + If &"*"& is added to a single-key lookup type (for example, &%lsearch*%&) and the initial lookup fails, the key &"*"& is looked up in the file to provide a default value. See also the section on partial matching below. @@ -6293,7 +6787,7 @@ subject key is always followed by a dot. -.section "Lookup caching" +.section "Lookup caching" "SECID64" .cindex "lookup" "caching" .cindex "caching" "lookup data" Exim caches all lookup results in order to avoid needless repetition of @@ -6315,7 +6809,7 @@ complete. -.section "Quoting lookup data" +.section "Quoting lookup data" "SECID65" .cindex "lookup" "quoting" .cindex "quoting" "in lookups" When data from an incoming message is included in a query-style lookup, there @@ -6358,12 +6852,12 @@ an expansion string could contain: ${lookup dnsdb{mx=a.b.example}{$value}fail} .endd If the lookup succeeds, the result is placed in &$value$&, which in this case -is used on its own as the result. If the lookup succeeds, the &`fail`& keyword -causes a &'forced expansion failure'& &-- see section &<>& for -an explanation of what this means. +is used on its own as the result. If the lookup does not succeed, the +&`fail`& keyword causes a &'forced expansion failure'& &-- see section +&<>& for an explanation of what this means. -The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and, -when Exim is compiled with IPv6 support, AAAA (and A6 if that is also +The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, and TXT, +and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also configured). If no type is given, TXT is assumed. When the type is PTR, the data can be an IP address, written as normal; inversion and the addition of &%in-addr.arpa%& or &%ip6.arpa%& happens automatically. For example: @@ -6391,7 +6885,22 @@ ${lookup dnsdb{>: a=host1.example}} It is permitted to specify a space as the separator character. Further white space is ignored. -.section "Pseudo dnsdb record types" +.cindex "TXT record" "in &(dnsdb)& lookup" +.cindex "SPF record" "in &(dnsdb)& lookup" +For TXT records with multiple items of data, only the first item is returned, +unless a separator for them is specified using a comma after the separator +character followed immediately by the TXT record item separator. To concatenate +items without a separator, use a semicolon instead. For SPF records the +default behaviour is to concatenate multiple items without using a separator. +.code +${lookup dnsdb{>\n,: txt=a.b.example}} +${lookup dnsdb{>\n; txt=a.b.example}} +${lookup dnsdb{spf=example.org}} +.endd +It is permitted to specify a space as the separator character. Further +white space is ignored. + +.section "Pseudo dnsdb record types" "SECID66" .cindex "MX record" "in &(dnsdb)& lookup" By default, both the preference value and the host name are returned for each MX record, separated by a space. If you want only host names, you can use @@ -6402,7 +6911,7 @@ ${lookup dnsdb{mxh=a.b.example}} In this case, the preference values are omitted, and just the host names are returned. -.cindex "name server" "for enclosing domain" +.cindex "name server for enclosing domain" Another pseudo-type is ZNS (for &"zone NS"&). It performs a lookup for NS records on the given domain, but if none are found, it removes the first component of the domain name, and tries again. This process continues until NS @@ -6438,8 +6947,16 @@ has two space-separated fields: an authorization code and a target host name. The authorization code can be &"Y"& for yes, &"N"& for no, &"X"& for explicit authorization required but absent, or &"?"& for unknown. +.cindex "A+" "in &(dnsdb)& lookup" +The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA +and then an A lookup. All results are returned; defer processing +(see below) is handled separately for each lookup. Example: +.code +${lookup dnsdb {>; a+=$sender_helo_name}} +.endd + -.section "Multiple dnsdb lookups" +.section "Multiple dnsdb lookups" "SECID67" In the previous sections, &(dnsdb)& lookups for a single domain are described. However, you can specify a list of domains or IP addresses in a single &(dnsdb)& lookup. The list is specified in the normal Exim way, with colon as @@ -6479,7 +6996,7 @@ yields some data, the lookup succeeds. .section "More about LDAP" "SECTldap" -.cindex "LDAP lookup" +.cindex "LDAP" "lookup, more about" .cindex "lookup" "LDAP" .cindex "Solaris" "LDAP" The original LDAP implementation came from the University of Michigan; this has @@ -6535,8 +7052,12 @@ The URL may begin with &`ldap`& or &`ldaps`& if your LDAP library supports secure (encrypted) LDAP connections. The second of these ensures that an encrypted TLS connection is used. +With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular +LDAP connections, rather than the SSL-on-connect &`ldaps`&. +See the &%ldap_start_tls%& option. + -.section "LDAP quoting" +.section "LDAP quoting" "SECID68" .cindex "LDAP" "quoting" Two levels of quoting are required in LDAP queries, the first for LDAP itself and the second because the LDAP query is represented as a URL. Furthermore, @@ -6593,7 +7114,7 @@ There are some further comments about quoting in the section on LDAP authentication below. -.section "LDAP connections" +.section "LDAP connections" "SECID69" .cindex "LDAP" "connections" The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP is in use, via a Unix domain socket. The example given above does not specify @@ -6613,7 +7134,7 @@ Errors which cause the next server to be tried are connection failures, bind failures, and timeouts. For each server name in the list, a port number can be given. The standard way -of specifing a host and port is to use a colon separator (RFC 1738). Because +of specifying a host and port is to use a colon separator (RFC 1738). Because &%ldap_default_servers%& is a colon-separated list, such colons have to be doubled. For example .code @@ -6667,7 +7188,7 @@ Using &`ldapi`& with no host or path in the query, and no setting of -.section "LDAP authentication and control information" +.section "LDAP authentication and control information" "SECID70" .cindex "LDAP" "authentication" The LDAP URL syntax provides no way of passing authentication and other control information to the server. To make this possible, the URL in an LDAP query may @@ -6680,11 +7201,14 @@ them. The following names are recognized: &`NETTIME `& set a timeout for a network operation &`USER `& set the DN, for authenticating the LDAP bind &`PASS `& set the password, likewise +&`REFERRALS `& set the referrals parameter &`SIZE `& set the limit for the number of entries returned &`TIME `& set the maximum waiting time for a query .endd The value of the DEREFERENCE parameter must be one of the words &"never"&, -&"searching"&, &"finding"&, or &"always"&. +&"searching"&, &"finding"&, or &"always"&. The value of the REFERRALS parameter +must be &"follow"& (the default) or &"nofollow"&. The latter stops the LDAP +library from trying to follow referrals issued by the LDAP server. The name CONNECT is an obsolete name for NETTIME, retained for backwards compatibility. This timeout (specified as a number of seconds) is @@ -6748,7 +7272,7 @@ SMTP authentication. See the &%ldapauth%& expansion string condition in chapter -.section "Format of data returned by LDAP" +.section "Format of data returned by LDAP" "SECID71" .cindex "LDAP" "returned data formats" The &(ldapdn)& lookup type returns the Distinguished Name from a single entry as a sequence of values, for example @@ -6830,7 +7354,15 @@ operator is to double any quote characters within the text. .section "SQL lookups" "SECTsql" .cindex "SQL lookup types" -Exim can support lookups in Interbase, MySQL, Oracle, PostgreSQL, and SQLite +.cindex "MySQL" "lookup type" +.cindex "PostgreSQL lookup type" +.cindex "lookup" "MySQL" +.cindex "lookup" "PostgreSQL" +.cindex "Oracle" "lookup type" +.cindex "lookup" "Oracle" +.cindex "InterBase lookup type" +.cindex "lookup" "InterBase" +Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite databases. Queries for these databases contain SQL statements, so an example might be .code @@ -6857,22 +7389,25 @@ If the result of the query yields more than one row, it is all concatenated, with a newline between the data for each row. -.section "More about MySQL, PostgreSQL, Oracle, and Interbase" +.section "More about MySQL, PostgreSQL, Oracle, and InterBase" "SECID72" .cindex "MySQL" "lookup type" .cindex "PostgreSQL lookup type" .cindex "lookup" "MySQL" .cindex "lookup" "PostgreSQL" .cindex "Oracle" "lookup type" .cindex "lookup" "Oracle" -.cindex "Interbase lookup type" -.cindex "lookup" "Interbase" -If any MySQL, PostgreSQL, Oracle, or Interbase lookups are used, the +.cindex "InterBase lookup type" +.cindex "lookup" "InterBase" +If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the &%mysql_servers%&, &%pgsql_servers%&, &%oracle_servers%&, or &%ibase_servers%& option (as appropriate) must be set to a colon-separated list of server -information. Each item in the list is a slash-separated list of four items: -host name, database name, user name, and password. In the case of Oracle, the -host name field is used for the &"service name"&, and the database name field -is not used and should be empty. For example: +information. +(For MySQL and PostgreSQL only, the global option need not be set if all +queries contain their own server information &-- see section +&<>&.) Each item in the list is a slash-separated list of four +items: host name, database name, user name, and password. In the case of +Oracle, the host name field is used for the &"service name"&, and the database +name field is not used and should be empty. For example: .code hide oracle_servers = oracle.plc.example//userx/abcdwxyz .endd @@ -6885,8 +7420,10 @@ hide mysql_servers = localhost/users/root/secret:\ .endd For MySQL and PostgreSQL, a host may be specified as <&'name'&>:<&'port'&> but because this is a colon-separated list, the colon has to be doubled. For each -query, these parameter groups are tried in order until a connection and a query -succeeds. +query, these parameter groups are tried in order until a connection is made and +a query is successfully processed. The result of a query may be that no data is +found, but that is still a successful query. In other words, the list of +servers provides a backup facility, not a list of different places to look. The &%quote_mysql%&, &%quote_pgsql%&, and &%quote_oracle%& expansion operators convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b @@ -6896,8 +7433,48 @@ addition, escapes the percent and underscore characters. This cannot be done for MySQL because these escapes are not recognized in contexts where these characters are not special. +.section "Specifying the server in the query" "SECTspeserque" +For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase), +it is possible to specify a list of servers with an individual query. This is +done by starting the query with +.display +&`servers=`&&'server1:server2:server3:...'&&`;`& +.endd +Each item in the list may take one of two forms: +.olist +If it contains no slashes it is assumed to be just a host name. The appropriate +global option (&%mysql_servers%& or &%pgsql_servers%&) is searched for a host +of the same name, and the remaining parameters (database, user, password) are +taken from there. +.next +If it contains any slashes, it is taken as a complete parameter set. +.endlist +The list of servers is used in exactly the same way as the global list. +Once a connection to a server has happened and a query has been +successfully executed, processing of the lookup ceases. + +This feature is intended for use in master/slave situations where updates +are occurring and you want to update the master rather than a slave. If the +master is in the list as a backup for reading, you might have a global setting +like this: +.code +mysql_servers = slave1/db/name/pw:\ + slave2/db/name/pw:\ + master/db/name/pw +.endd +In an updating lookup, you could then write: +.code +${lookup mysql{servers=master; UPDATE ...} } +.endd +That query would then be sent only to the master server. If, on the other hand, +the master is not to be used for reading, and so is not present in the global +option, you can still update it by a query of this form: +.code +${lookup pgsql{servers=master/db/name/pw; UPDATE ...} } +.endd + -.section "Special MySQL features" +.section "Special MySQL features" "SECID73" For MySQL, an empty host name or the use of &"localhost"& in &%mysql_servers%& causes a connection to the server on the local host by means of a Unix domain socket. An alternate socket can be specified in parentheses. The full syntax of @@ -6920,7 +7497,7 @@ anything (for example, setting a field to the value it already has), the result is zero because no rows are affected. -.section "Special PostgreSQL features" +.section "Special PostgreSQL features" "SECID74" PostgreSQL lookups can also use Unix domain socket connections to the database. This is usually faster and costs less CPU time than a TCP/IP connection. However it can be used only if the mail server runs on the same machine as the @@ -6939,7 +7516,7 @@ affected. .section "More about SQLite" "SECTsqlite" .cindex "lookup" "SQLite" -.cindex "SQLite lookup type" +.cindex "sqlite lookup type" SQLite is different to the other SQL lookups because a file name is required in addition to the SQL query. An SQLite database is a single file, and there is no daemon as in the other SQL databases. The interface to Exim requires the name @@ -6952,7 +7529,7 @@ ${lookup sqlite {/some/thing/sqlitedb \ .endd In a list, the syntax is similar. For example: .code -domainlist relay_domains = sqlite;/some/thing/sqlitedb \ +domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \ select * from relays where ip='$sender_host_address'; .endd The only character affected by the &%quote_sqlite%& operator is a single @@ -6989,7 +7566,7 @@ general facilities that apply to all four kinds of list. -.section "Expansion of lists" +.section "Expansion of lists" "SECID75" .cindex "expansion" "of lists" Each list is expanded as a single string before it is used. The result of expansion must be a list, possibly containing empty items, which is split up @@ -7019,7 +7596,7 @@ senders based on the receiving domain. -.section "Negated items in lists" +.section "Negated items in lists" "SECID76" .cindex "list" "negation" .cindex "negation" "in lists" Items in a list may be positive or negative. Negative items are indicated by a @@ -7034,13 +7611,13 @@ subject is not in the set. If the end of the list is reached without the subject having matched any of the patterns, it is in the set if the last item was a negative one, but not if it was a positive one. For example, the list in .code -domainlist relay_domains = !a.b.c : *.b.c +domainlist relay_to_domains = !a.b.c : *.b.c .endd matches any domain ending in &'.b.c'& except for &'a.b.c'&. Domains that match neither &'a.b.c'& nor &'*.b.c'& do not match, because the last item in the list is positive. However, if the setting were .code -domainlist relay_domains = !a.b.c +domainlist relay_to_domains = !a.b.c .endd then all domains other than &'a.b.c'& would match because the last item in the list is negative. In other words, a list that ends with a negative item behaves @@ -7094,7 +7671,7 @@ any domain matching &`*.b.c`& is not. -.section "An lsearch file is not an out-of-line list" +.section "An lsearch file is not an out-of-line list" "SECID77" As will be described in the sections that follow, lookups can be used in lists to provide indexed methods of checking list membership. There has been some confusion about the way &(lsearch)& lookups work in lists. Because @@ -7105,7 +7682,8 @@ always fixed strings, just as for any other single-key lookup type. If you want to use a file to contain wild-card patterns that form part of a list, just give the file name on its own, without a search type, as described -in the previous section. +in the previous section. You could also use the &(wildlsearch)& or +&(nwildlsearch)&, but there is no advantage in doing this. @@ -7143,7 +7721,7 @@ the words &%domainlist%&, &%hostlist%&, &%addresslist%&, or &%localpartlist%&, respectively. Then there follows the name that you are defining, followed by an equals sign and the list itself. For example: .code -hostlist relay_hosts = 192.168.23.0/24 : my.friend.example +hostlist relay_from_hosts = 192.168.23.0/24 : my.friend.example addresslist bad_senders = cdb;/etc/badsenders .endd A named list may refer to other named lists: @@ -7188,7 +7766,7 @@ hosts. The default configuration is set up like this. -.section "Named lists compared with macros" +.section "Named lists compared with macros" "SECID78" .cindex "list" "named compared with macro" .cindex "macro" "compared with named list" At first sight, named lists might seem to be no different from macros in the @@ -7214,7 +7792,7 @@ auth_advertise_hosts = !host1 : !host2 .endd -.section "Named list caching" +.section "Named list caching" "SECID79" .cindex "list" "caching of named" .cindex "caching" "named lists" While processing a message, Exim caches the result of checking a named list if @@ -7252,7 +7830,7 @@ The following types of item may appear in domain lists: .ilist .cindex "primary host name" .cindex "host name" "matched in domain list" -.cindex "&%primary_hostname%&" +.oindex "&%primary_hostname%&" .cindex "domain list" "matching primary host name" .cindex "@ in a domain list" If a pattern consists of a single @ character, it matches the local host name, @@ -7263,9 +7841,11 @@ differ only in their names. .cindex "@[] in a domain list" .cindex "domain list" "matching local IP interfaces" .cindex "domain literal" -If a pattern consists of the string &`@[]`& it matches any local IP interface -address, enclosed in square brackets, as in an email address that contains a -domain literal. +If a pattern consists of the string &`@[]`& it matches an IP address enclosed +in square brackets (as in an email address that contains a domain literal), but +only if that IP address is recognized as local for email routing purposes. The +&%local_interfaces%& and &%extra_local_interfaces%& options can be used to +control which of a host's several IP addresses are treated as local. In today's Internet, the use of domain literals is controversial. .next .cindex "@mx_any" @@ -7274,7 +7854,7 @@ In today's Internet, the use of domain literals is controversial. .cindex "domain list" "matching MX pointers to local host" If a pattern consists of the string &`@mx_any`& it matches any domain that has an MX record pointing to the local host or to any host that is listed in -.cindex "&%hosts_treat_as_local%&" +.oindex "&%hosts_treat_as_local%&" &%hosts_treat_as_local%&. The items &`@mx_primary`& and &`@mx_secondary`& are similar, except that the first matches only when a primary MX target is the local host, and the second only when no primary MX target is the local host, @@ -7333,8 +7913,10 @@ list item such as &`*key.ex`& matches &'donkey.ex'& as well as If a pattern starts with a circumflex character, it is treated as a regular expression, and matched against the domain using a regular expression matching function. The circumflex is treated as part of the regular expression. -References to descriptions of the syntax of regular expressions are given in -chapter &<>&. +Email domains are case-independent, so this regular expression match is by +default case-independent, but you can make it case-dependent by starting it +with &`(?-i)`&. References to descriptions of the syntax of regular expressions +are given in chapter &<>&. &*Warning*&: Because domain lists are expanded before being processed, you must escape any backslash and dollar characters in the regular expression, or @@ -7383,7 +7965,7 @@ pattern must be an appropriate query for the lookup type, as described in chapter &<>&. For example: .code hold_domains = mysql;select domain from holdlist \ - where domain = '$domain'; + where domain = '${quote_mysql:$domain}'; .endd In most cases, the data that is looked up is not used (so for an SQL query, for example, it doesn't matter what field you select). Exim is interested only in @@ -7428,7 +8010,7 @@ You need to be particularly careful with this when single-key lookups are involved, to ensure that the right value is being used as the key. -.section "Special host list patterns" +.section "Special host list patterns" "SECID80" .cindex "empty item in hosts list" .cindex "host list" "empty string in" If a host list item is the empty string, it matches only when no remote host is @@ -7575,13 +8157,25 @@ The IP address of the subject host is masked using <&'number'&> as the mask length. A textual string is constructed from the masked value, followed by the mask, and this is used as the lookup key. For example, if the host's IP address is 192.168.34.6, the key that is looked up for the above example is -&"192.168.34.0/24"&. IPv6 addresses are converted to a text value using lower -case letters and dots as separators instead of the more usual colon, because -colon is the key terminator in &(lsearch)& files. Full, unabbreviated IPv6 +&"192.168.34.0/24"&. + +When an IPv6 address is converted to a string, dots are normally used instead +of colons, so that keys in &(lsearch)& files need not contain colons (which +terminate &(lsearch)& keys). This was implemented some time before the ability +to quote keys was made available in &(lsearch)& files. However, the more +recently implemented &(iplsearch)& files do require colons in IPv6 keys +(notated using the quoting facility) so as to distinguish them from IPv4 keys. +For this reason, when the lookup type is &(iplsearch)&, IPv6 addresses are +converted using colons and not dots. In all cases, full, unabbreviated IPv6 addresses are always used. -&*Warning*&: Specifing &%net32-%& (for an IPv4 address) or &%net128-%& (for an -IPv6 address) is not the same as specifing just &%net-%& without a number. In +Ideally, it would be nice to tidy up this anomalous situation by changing to +colons in all cases, given that quoting is now available for &(lsearch)&. +However, this would be an incompatible change that might break some existing +configurations. + +&*Warning*&: Specifying &%net32-%& (for an IPv4 address) or &%net128-%& (for an +IPv6 address) is not the same as specifying just &%net-%& without a number. In the former case the key strings include the mask value, whereas in the latter case the IP address is used on its own. @@ -7594,7 +8188,7 @@ case the IP address is used on its own. There are several types of pattern that require Exim to know the name of the remote host. These are either wildcard patterns or lookups by name. (If a complete hostname is given without any wildcarding, it is used to find an IP -address to match against, as described in the section &<>& +address to match against, as described in section &<>& above.) If the remote host name is not already known when Exim encounters one of these @@ -7611,7 +8205,12 @@ against host names is not as common as matching against IP addresses. By default, in order to find a host name, Exim first does a reverse DNS lookup; if no name is found in the DNS, the system function (&[gethostbyaddr()]& or &[getipnodebyaddr()]& if available) is tried. The order in which these lookups -are done can be changed by setting the &%host_lookup_order%& option. +are done can be changed by setting the &%host_lookup_order%& option. For +security, once Exim has found one or more names, it looks up the IP addresses +for these names and compares them with the IP address that it started with. +Only those names whose IP addresses match are accepted. Any other names are +discarded. If no names are left, Exim behaves as if the host name cannot be +found. In the most common case there is only one name and one IP address. There are some options that control what happens if a host name cannot be found. These are described in section &<>& below. @@ -7632,7 +8231,11 @@ expression. .cindex "regular expressions" "in host list" .cindex "host list" "regular expression in" If the item starts with &"^"& it is taken to be a regular expression which is -matched against the host name. For example, +matched against the host name. Host names are case-independent, so this regular +expression match is by default case-independent, but you can make it +case-dependent by starting it with &`(?-i)`&. References to descriptions of the +syntax of regular expressions are given in chapter &<>&. For +example, .code ^(a|b)\.c\.d$ .endd @@ -7654,12 +8257,15 @@ required. .section "Behaviour when an IP address or name cannot be found" "SECTbehipnot" -.cindex "host" "lookup failures" +.cindex "host" "lookup failures, permanent" While processing a host list, Exim may need to look up an IP address from a name (see section &<>&), or it may need to look up a host name from an IP address (see section &<>&). In either case, the behaviour when it fails to find the information it is seeking is the same. +&*Note*&: This section applies to permanent lookup failures. It does &'not'& +apply to temporary DNS errors, whose handling is described in the next section. + .cindex "&`+include_unknown`&" .cindex "&`+ignore_unknown`&" By default, Exim behaves as if the host does not match the list. This may not @@ -7693,15 +8299,23 @@ Both &`+include_unknown`& and &`+ignore_unknown`& may appear in the same list. The effect of each one lasts until the next, or until the end of the list. -&*Note*&: This section applies to permanent lookup failures. It does &'not'& -apply to temporary DNS errors. They always cause a defer action (except when -&%dns_again_means_nonexist%& converts them into permanent errors). + +.section "Temporary DNS errors when looking up host information" &&& + "SECTtemdnserr" +.cindex "host" "lookup failures, temporary" +.cindex "&`+include_defer`&" +.cindex "&`+ignore_defer`&" +A temporary DNS lookup failure normally causes a defer action (except when +&%dns_again_means_nonexist%& converts it into a permanent error). However, +host lists can include &`+ignore_defer`& and &`+include_defer`&, analagous to +&`+ignore_unknown`& and &`+include_unknown`&, as described in the previous +section. These options should be used with care, probably only in non-critical +host lists such as whitelists. .section "Host list patterns for single-key lookups by host name" &&& "SECThoslispatnamsk" -.cindex "host" "lookup failures" .cindex "unknown host name" .cindex "host list" "matching host name" If a pattern is of the form @@ -7712,7 +8326,7 @@ for example .code dbm;/host/accept/list .endd -a single-key lookup is performend, using the host name as its key. If the +a single-key lookup is performed, using the host name as its key. If the lookup succeeds, the host matches the item. The actual data that is looked up is not used. @@ -7725,7 +8339,7 @@ lookup, both using the same file. -.section "Host list patterns for query-style lookups" +.section "Host list patterns for query-style lookups" "SECID81" If a pattern is of the form .display <&'query-style-search-type'&>;<&'query'&> @@ -7743,7 +8357,7 @@ use masked IP addresses in database queries, you can use the &%mask%& expansion operator. If the query contains a reference to &$sender_host_name$&, Exim automatically -looks up the host name if has not already done so. (See section +looks up the host name if it has not already done so. (See section &<>& for comments on finding host names.) Historical note: prior to release 4.30, Exim would always attempt to find a @@ -7943,7 +8557,7 @@ but the separating colon must still be included at line breaks. White space surrounding the colons is ignored. For example: .code aol.com: spammer1 : spammer2 : ^[0-9]+$ : -spammer3 : spammer4 + spammer3 : spammer4 .endd As in all colon-separated lists in Exim, a colon can be included in an item by doubling. @@ -8055,6 +8669,13 @@ start of a portion of the string that is interpreted and replaced as described below in section &<>& onwards. Backslash is used as an escape character, as described in the following section. +Whether a string is expanded depends upon the context. Usually this is solely +dependent upon the option for which a value is sought; in this documentation, +options for which string expansion is performed are marked with † after +the data type. ACL rules always expand strings. A couple of expansion +conditions do not expand some of the brace-delimited branches, for security +reasons. + .section "Literal text in expanded strings" "SECTlittext" @@ -8079,7 +8700,7 @@ string. -.section "Character escape sequences in expanded strings" +.section "Character escape sequences in expanded strings" "SECID82" .cindex "expansion" "escape sequences" A backslash followed by one of the letters &"n"&, &"r"&, or &"t"& in an expanded string is recognized as an escape sequence for the character newline, @@ -8093,10 +8714,10 @@ in. Their interpretation in expansions as well is useful for unquoted strings, and for other cases such as looked-up strings that are then expanded. -.section "Testing string expansions" +.section "Testing string expansions" "SECID83" .cindex "expansion" "testing" .cindex "testing" "string expansion" -.cindex "&%-be%& option" +.oindex "&%-be%&" Many expansions can be tested by calling Exim with the &%-be%& option. This takes the command arguments, or lines from the standard input if there are no arguments, runs them through the string expansion code, and writes the results @@ -8110,6 +8731,21 @@ Exim gives up its root privilege when it is called with the &%-be%& option, and instead runs under the uid and gid it was called with, to prevent users from using &%-be%& for reading files to which they do not have access. +.oindex "&%-bem%&" +If you want to test expansions that include variables whose values are taken +from a message, there are two other options that can be used. The &%-bem%& +option is like &%-be%& except that it is followed by a file name. The file is +read as a message before doing the test expansions. For example: +.code +exim -bem /tmp/test.message '$h_subject:' +.endd +The &%-Mset%& option is used in conjunction with &%-be%& and is followed by an +Exim message identifier. For example: +.code +exim -be -Mset 1GrA8W-0004WS-LQ '$recipients' +.endd +This loads the message from Exim's spool before doing the test expansions, and +is therefore restricted to admin users. .section "Forced expansion failure" "SECTforexpfai" @@ -8162,6 +8798,27 @@ below. The operator notation is used for simple expansion items that have just one argument, because it reduces the number of braces and therefore makes the string easier to understand. +.vitem &*$bheader_*&<&'header&~name'&>&*:*&&~or&~&*$bh_*&<&'header&~name'&>&*:*& +This item inserts &"basic"& header lines. It is described with the &%header%& +expansion item below. + + +.vitem "&*${acl{*&<&'name'&>&*}{*&<&'arg'&>&*}...}*&" +.cindex "expansion" "calling an acl" +.cindex "&%acl%&" "call from expansion" +The name and zero to nine argument strings are first expanded separately. The expanded +arguments are assigned to the variables &$acl_arg1$& to &$acl_arg9$& in order. +Any unused are made empty. The variable &$acl_narg$& is set to the number of +arguments. The named ACL (see chapter &<>&) is called +and may use the variables; if another acl expansion is used the values +are restored after it returns. If the ACL sets +a value using a "message =" modifier and returns accept or deny, the value becomes +the result of the expansion. +If no message is set and the ACL returns accept or deny +the expansion result is an empty string. +If the ACL returns defer the result is a forced-fail. Otherwise the expansion fails. + + .vitem "&*${dlfunc{*&<&'file'&>&*}{*&<&'function'&>&*}{*&<&'arg'&>&*}&&& {*&<&'arg'&>&*}...}*&" .cindex &%dlfunc%& @@ -8211,7 +8868,7 @@ form: .display <&'key1'&> = <&'value1'&> <&'key2'&> = <&'value2'&> ... .endd -.cindex "&$value$&" +.vindex "&$value$&" where the equals signs and spaces (but not both) are optional. If any of the values contain white space, they must be enclosed in double quotes, and any values that are enclosed in double quotes are subject to escape processing as @@ -8270,6 +8927,24 @@ yields &"99"&. Two successive separators mean that the field between them is empty (for example, the fifth field above). +.vitem &*${filter{*&<&'string'&>&*}{*&<&'condition'&>&*}}*& +.cindex "list" "selecting by condition" +.cindex "expansion" "selecting from list by condition" +.vindex "&$item$&" +After expansion, <&'string'&> is interpreted as a list, colon-separated by +default, but the separator can be changed in the usual way. For each item +in this list, its value is place in &$item$&, and then the condition is +evaluated. If the condition is true, &$item$& is added to the output as an +item in a new list; if the condition is false, the item is discarded. The +separator used for the output list is the same as the one used for the +input, but a separator setting is not included in the output. For example: +.code +${filter{a:b:c}{!eq{$item}{b}} +.endd +yields &`a:c`&. At the end of the expansion, the value of &$item$& is restored +to what it was before. See also the &*map*& and &*reduce*& expansion items. + + .vitem &*${hash{*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*& .cindex "hash function" "textual" .cindex "expansion" "textual hash" @@ -8301,19 +8976,15 @@ letters appear. For example: .endd .vitem "&*$header_*&<&'header&~name'&>&*:*&&~or&~&&& - &*$h_*&<&'header&~name'&>&*:*&" -See &*$rheader*& below. - -.vitem "&*$bheader_*&<&'header&~name'&>&*:*&&~or&~&&& - &*$bh_*&<&'header&~name'&>&*:*&" -See &*$rheader*& below. - -.vitem "&*$rheader_*&<&'header&~name'&>&*:*&&~or&~&&& + &*$h_*&<&'header&~name'&>&*:*&" &&& + "&*$bheader_*&<&'header&~name'&>&*:*&&~or&~&&& + &*$bh_*&<&'header&~name'&>&*:*&" &&& + "&*$rheader_*&<&'header&~name'&>&*:*&&~or&~&&& &*$rh_*&<&'header&~name'&>&*:*&" .cindex "expansion" "header insertion" -.cindex "&$header_$&" -.cindex "&$bheader_$&" -.cindex "&$rheader_$&" +.vindex "&$header_$&" +.vindex "&$bheader_$&" +.vindex "&$rheader_$&" .cindex "header lines" "in expansion strings" .cindex "header lines" "character sets" .cindex "header lines" "decoding" @@ -8371,16 +9042,16 @@ if they were variables. Attempting to do so causes a syntax error. Only header lines that are common to all copies of a message are visible to this mechanism. These are the original header lines that are received with the -message, and any that are added by an ACL &%warn%& statement or by a system +message, and any that are added by an ACL statement or by a system filter. Header lines that are added to a particular copy of a message by a router or transport are not accessible. For incoming SMTP messages, no header lines are visible in ACLs that are obeyed before the DATA ACL, because the header structure is not set up until the -message is received. Header lines that are added by &%warn%& statements in a -RCPT ACL (for example) are saved until the message's incoming header lines -are available, at which point they are added. When a DATA ACL is running, -however, header lines added by earlier ACLs are visible. +message is received. Header lines that are added in a RCPT ACL (for example) +are saved until the message's incoming header lines are available, at which +point they are added. When a DATA ACL is running, however, header lines added +by earlier ACLs are visible. Upper case and lower case letters are synonymous in header names. If the following character is white space, the terminating colon may be omitted, but @@ -8390,12 +9061,14 @@ If the message does not contain the given header, the expansion item is replaced by an empty string. (See the &%def%& condition in section &<>& for a means of testing for the existence of a header.) -If there is more than one header with the same name, they are all -concatenated to form the substitution string, up to a maximum length of 64K. A -newline character is inserted between each line. For the &%header%& expansion, -for those headers that contain lists of addresses, a comma is also inserted at -the junctions between lines. This does not happen for the &%rheader%& -expansion. +If there is more than one header with the same name, they are all concatenated +to form the substitution string, up to a maximum length of 64K. Unless +&%rheader%& is being used, leading and trailing white space is removed from +each header before concatenation, and a completely empty header is ignored. A +newline character is then inserted between non-empty headers, but there is no +newline at the very end. For the &%header%& and &%bheader%& expansion, for +those headers that contain lists of addresses, a comma is also inserted at the +junctions between headers. This does not happen for the &%rheader%& expansion. .vitem &*${hmac{*&<&'hashname'&>&*}{*&<&'secret'&>&*}{*&<&'string'&>&*}}*& @@ -8464,7 +9137,7 @@ condition = ${if >{$acl_m4}{3}} .vitem &*${length{*&<&'string1'&>&*}{*&<&'string2'&>&*}}*& .cindex "expansion" "string truncation" -.cindex "&%length%&" "expansion item" +.cindex "&%length%& expansion item" The &%length%& item is used to extract the initial portion of a string. Both strings are expanded, and the first one must yield a number, <&'n'&>, say. If you are using a fixed value for the number, that is, if <&'string1'&> does not @@ -8499,7 +9172,7 @@ other place where white space is significant, the lookup item must be enclosed in double quotes. The use of data lookups in users' filter files may be locked out by the system administrator. -.cindex "&$value$&" +.vindex "&$value$&" If the lookup succeeds, <&'string1'&> is expanded and replaces the entire item. During its expansion, the variable &$value$& contains the data returned by the lookup. Afterwards it reverts to the value it had previously (at the outer @@ -8539,6 +9212,23 @@ ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \ {$value}fail} .endd + +.vitem &*${map{*&<&'string1'&>&*}{*&<&'string2'&>&*}}*& +.cindex "expansion" "list creation" +.vindex "&$item$&" +After expansion, <&'string1'&> is interpreted as a list, colon-separated by +default, but the separator can be changed in the usual way. For each item +in this list, its value is place in &$item$&, and then <&'string2'&> is +expanded and added to the output as an item in a new list. The separator used +for the output list is the same as the one used for the input, but a separator +setting is not included in the output. For example: +.code +${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}} +.endd +expands to &`[a]:[b]:[c] (x)-(y)-(z)`&. At the end of the expansion, the +value of &$item$& is restored to what it was before. See also the &*filter*& +and &*reduce*& expansion items. + .vitem &*${nhash{*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*& .cindex "expansion" "numeric hash" .cindex "hash function" "numeric" @@ -8586,7 +9276,7 @@ out the use of this expansion item in filter files. .vitem &*${prvs{*&<&'address'&>&*}{*&<&'secret'&>&*}{*&<&'keynumber'&>&*}}*& -.cindex "prvs" "expansion item" +.cindex "&%prvs%& expansion item" The first argument is a complete email address and the second is secret keystring. The third argument, specifying a key number, is optional. If absent, it defaults to 0. The result of the expansion is a prvs-signed email address, @@ -8596,7 +9286,7 @@ and an example, see section &<>&. .vitem "&*${prvscheck{*&<&'address'&>&*}{*&<&'secret'&>&*}&&& {*&<&'string'&>&*}}*&" -.cindex "prvscheck" "expansion item" +.cindex "&%prvscheck%& expansion item" This expansion item is the complement of the &%prvs%& item. It is used for checking prvs-signed addresses. If the expansion of the first argument does not yield a syntactically valid prvs-signed address, the whole item expands to the @@ -8640,9 +9330,8 @@ locks out the use of this expansion item in filter files. .vitem "&*${readsocket{*&<&'name'&>&*}{*&<&'request'&>&*}&&& {*&<&'timeout'&>&*}{*&<&'eol&~string'&>&*}{*&<&'fail&~string'&>&*}}*&" .cindex "expansion" "inserting from a socket" -.cindex "socket" "use of in expansion" +.cindex "socket, use of in expansion" .cindex "&%readsocket%& expansion item" -.new This item inserts data from a Unix domain or Internet socket into the expanded string. The minimal way of using it uses just two arguments, as in these examples: @@ -8665,18 +9354,15 @@ both kinds of socket, Exim makes a connection, writes the request string (unless it is an empty string) and reads from the socket until an end-of-file is read. A timeout of 5 seconds is applied. Additional, optional arguments extend what can be done. Firstly, you can vary the timeout. For example: -.wen .code -${readsocket{/socket/name}{request-string}{3s}} +${readsocket{/socket/name}{request string}{3s}} .endd A fourth argument allows you to change any newlines that are in the data that is read, in the same way as for &%readfile%& (see above). This example turns them into spaces: -.new .code -${readsocket{inet:127.0.0.1:3294}{request-string}{3s}{ }} +${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }} .endd -.wen As with all expansions, the substrings are expanded before the processing happens. Errors in these sub-expansions cause the expansion to fail. In addition, the following errors can occur: @@ -8686,7 +9372,7 @@ Failure to create a socket file descriptor; .next Failure to connect the socket; .next -Failure to write the request-string; +Failure to write the request string; .next Timeout on reading from the socket. .endlist @@ -8695,46 +9381,89 @@ By default, any of these errors causes the expansion to fail. However, if you supply a fifth substring, it is expanded and used when any of the above errors occurs. For example: .code -${readsocket{/socket/name}{request-string}{3s}{\n}\ +${readsocket{/socket/name}{request string}{3s}{\n}\ {socket failure}} .endd -.new You can test for the existence of a Unix domain socket by wrapping this expansion in &`${if exists`&, but there is a race condition between that test and the actual opening of the socket, so it is safer to use the fifth argument if you want to be absolutely sure of avoiding an expansion error for a non-existent Unix domain socket, or a failure to connect to an Internet socket. -.wen The &(redirect)& router has an option called &%forbid_filter_readsocket%& which locks out the use of this expansion item in filter files. -.vitem &*$rheader_*&<&'header&~name'&>&*:&~or&~$rh_*&<&'header&~name'&>&*:*& -This item inserts &"raw"& header lines. It is described with the &%header%& -expansion item above. -.vitem "&*${run{*&<&'command'&>&*&~*&<&'args'&>&*}{*&<&'string1'&>&*}&&& - {*&<&'string2'&>&*}}*&" -.cindex "expansion" "running a command" +.vitem &*${reduce{*&<&'string1'&>}{<&'string2'&>&*}{*&<&'string3'&>&*}}*& +.cindex "expansion" "reducing a list to a scalar" +.cindex "list" "reducing to a scalar" +.vindex "&$value$&" +.vindex "&$item$&" +This operation reduces a list to a single, scalar string. After expansion, +<&'string1'&> is interpreted as a list, colon-separated by default, but the +separator can be changed in the usual way. Then <&'string2'&> is expanded and +assigned to the &$value$& variable. After this, each item in the <&'string1'&> +list is assigned to &$item$& in turn, and <&'string3'&> is expanded for each of +them. The result of that expansion is assigned to &$value$& before the next +iteration. When the end of the list is reached, the final value of &$value$& is +added to the expansion output. The &*reduce*& expansion item can be used in a +number of ways. For example, to add up a list of numbers: +.code +${reduce {<, 1,2,3}{0}{${eval:$value+$item}}} +.endd +The result of that expansion would be &`6`&. The maximum of a list of numbers +can be found: +.code +${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}} +.endd +At the end of a &*reduce*& expansion, the values of &$item$& and &$value$& are +restored to what they were before. See also the &*filter*& and &*map*& +expansion items. + +.vitem &*$rheader_*&<&'header&~name'&>&*:*&&~or&~&*$rh_*&<&'header&~name'&>&*:*& +This item inserts &"raw"& header lines. It is described with the &%header%& +expansion item above. + +.vitem "&*${run{*&<&'command'&>&*&~*&<&'args'&>&*}{*&<&'string1'&>&*}&&& + {*&<&'string2'&>&*}}*&" +.cindex "expansion" "running a command" .cindex "&%run%& expansion item" The command and its arguments are first expanded separately, and then the command is run in a separate process, but under the same uid and gid. As in other command executions from Exim, a shell is not used by default. If you want a shell, you must explicitly code it. +The standard input for the command exists, but is empty. The standard output +and standard error are set to the same file descriptor. .cindex "return code" "from &%run%& expansion" -.cindex "&$value$&" +.vindex "&$value$&" If the command succeeds (gives a zero return code) <&'string1'&> is expanded -and replaces the entire item; during this expansion, the standard output from -the command is in the variable &$value$&. If the command fails, <&'string2'&>, -if present, is expanded and used. Once again, during the expansion, the -standard output from the command is in the variable &$value$&. If <&'string2'&> -is absent, the result is empty. Alternatively, <&'string2'&> can be the word -&"fail"& (not in braces) to force expansion failure if the command does not -succeed. If both strings are omitted, the result is contents of the standard -output on success, and nothing on failure. - -.cindex "&$runrc$&" +and replaces the entire item; during this expansion, the standard output/error +from the command is in the variable &$value$&. If the command fails, +<&'string2'&>, if present, is expanded and used. Once again, during the +expansion, the standard output/error from the command is in the variable +&$value$&. + +If <&'string2'&> is absent, the result is empty. Alternatively, <&'string2'&> +can be the word &"fail"& (not in braces) to force expansion failure if the +command does not succeed. If both strings are omitted, the result is contents +of the standard output/error on success, and nothing on failure. + +.vindex "&$run_in_acl$&" +The standard output/error of the command is put in the variable &$value$&. +In this ACL example, the output of a command is logged for the admin to +troubleshoot: +.code +warn condition = ${run{/usr/bin/id}{yes}{no}} + log_message = Output of id: $value +.endd +If the command requires shell idioms, such as the > redirect operator, the +shell must be invoked directly, such as with: +.code +${run{/bin/bash -c "/usr/bin/id >/tmp/id"}{yes}{yes}} +.endd + +.vindex "&$runrc$&" The return code from the command is put in the variable &$runrc$&, and this remains set afterwards, so in a filter file you can do things like this: .code @@ -8783,7 +9512,7 @@ the regular expression from string expansion. .vitem &*${substr{*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*& -.cindex "&%substr%&" +.cindex "&%substr%& expansion item" .cindex "substring extraction" .cindex "expansion" "substring extraction" The three strings are expanded; the first two must yield numbers. Call them @@ -8867,14 +9596,36 @@ following operations can be performed: .vlist .vitem &*${address:*&<&'string'&>&*}*& .cindex "expansion" "RFC 2822 address handling" -.cindex "&%address%&" "expansion item" +.cindex "&%address%& expansion item" The string is interpreted as an RFC 2822 address, as it might appear in a header line, and the effective address is extracted from it. If the string does not parse successfully, the result is empty. +.vitem &*${addresses:*&<&'string'&>&*}*& +.cindex "expansion" "RFC 2822 address handling" +.cindex "&%addresses%& expansion item" +The string (after expansion) is interpreted as a list of addresses in RFC +2822 format, such as can be found in a &'To:'& or &'Cc:'& header line. The +operative address (&'local-part@domain'&) is extracted from each item, and the +result of the expansion is a colon-separated list, with appropriate +doubling of colons should any happen to be present in the email addresses. +Syntactically invalid RFC2822 address items are omitted from the output. + +It is possible to specify a character other than colon for the output +separator by starting the string with > followed by the new separator +character. For example: +.code +${addresses:>& Chief , sec@base.ment (dogsbody)} +.endd +expands to &`ceo@up.stairs&&sec@base.ment`&. Compare the &*address*& (singular) +expansion item, which extracts the working address from a single RFC2822 +address. See the &*filter*&, &*map*&, and &*reduce*& items for ways of +processing lists. + + .vitem &*${base62:*&<&'digits'&>&*}*& -.cindex "&%base62%&" +.cindex "&%base62%& expansion item" .cindex "expansion" "conversion to base 62" The string must consist entirely of decimal digits. The number is converted to base 62 and output as a string of six characters, including leading zeros. In @@ -8884,13 +9635,14 @@ names), base 36 is used by this operator, despite its name. &*Note*&: Just to be absolutely clear: this is &'not'& base64 encoding. .vitem &*${base62d:*&<&'base-62&~digits'&>&*}*& -.cindex "&%base62d%&" +.cindex "&%base62d%& expansion item" .cindex "expansion" "conversion to base 62" The string must consist entirely of base-62 digits, or, in operating environments where Exim uses base 36 instead of base 62 for its message identifiers, base-36 digits. The number is converted to decimal and output as a string. + .vitem &*${domain:*&<&'string'&>&*}*& .cindex "domain" "extraction" .cindex "expansion" "domain extraction" @@ -8900,7 +9652,7 @@ from it. If the string does not parse successfully, the result is empty. .vitem &*${escape:*&<&'string'&>&*}*& .cindex "expansion" "escaping non-printing characters" -.cindex "&%escape%&, expansion item" +.cindex "&%escape%& expansion item" If the string contains any non-printing characters, they are converted to escape sequences starting with a backslash. Whether characters with the most significant bit set (so-called &"8-bit characters"&) count as printing or not @@ -8911,28 +9663,47 @@ is controlled by the &%print_topbitchars%& option. .cindex "expansion" "expression evaluation" .cindex "expansion" "arithmetic expression" .cindex "&%eval%& expansion item" -These items supports simple arithmetic in expansion strings. The string (after -expansion) must be a conventional arithmetic expression, but it is limited to -five basic operators (plus, minus, times, divide, remainder) and parentheses. -All operations are carried out using integer arithmetic. Plus and minus have a -lower priority than times, divide, and remainder; operators with the same -priority are evaluated from left to right. +These items supports simple arithmetic and bitwise logical operations in +expansion strings. The string (after expansion) must be a conventional +arithmetic expression, but it is limited to basic arithmetic operators, bitwise +logical operators, and parentheses. All operations are carried out using +integer arithmetic. The operator priorities are as follows (the same as in the +C programming language): +.table2 70pt 300pt +.irow &'highest:'& "not (~), negate (-)" +.irow "" "multiply (*), divide (/), remainder (%)" +.irow "" "plus (+), minus (-)" +.irow "" "shift-left (<<), shift-right (>>)" +.irow "" "and (&&)" +.irow "" "xor (^)" +.irow &'lowest:'& "or (|)" +.endtable +Binary operators with the same priority are evaluated from left to right. White +space is permitted before or after operators. For &%eval%&, numbers may be decimal, octal (starting with &"0"&) or hexadecimal (starting with &"0x"&). For &%eval10%&, all numbers are taken as -decimal, even if they start with a leading zero. This can be useful when -processing numbers extracted from dates or times, which often do have leading -zeros. +decimal, even if they start with a leading zero; hexadecimal numbers are not +permitted. This can be useful when processing numbers extracted from dates or +times, which often do have leading zeros. -A number may be followed by &"K"& or &"M"& to multiply it by 1024 or 1024*1024, +A number may be followed by &"K"&, &"M"& or &"G"& to multiply it by 1024, 1024*1024 +or 1024*1024*1024, respectively. Negative numbers are supported. The result of the computation is -a decimal representation of the answer (without &"K"& or &"M"&). For example: +a decimal representation of the answer (without &"K"&, &"M"& or &"G"&). For example: .display -&`${eval:1+1} `& yields 2 -&`${eval:1+2*3} `& yields 7 -&`${eval:(1+2)*3} `& yields 9 -&`${eval:2+42%5} `& yields 4 +&`${eval:1+1} `& yields 2 +&`${eval:1+2*3} `& yields 7 +&`${eval:(1+2)*3} `& yields 9 +&`${eval:2+42%5} `& yields 4 +&`${eval:0xc&5} `& yields 4 +&`${eval:0xc|5} `& yields 13 +&`${eval:0xc^5} `& yields 9 +&`${eval:0xc>>1} `& yields 6 +&`${eval:0xc<<1} `& yields 24 +&`${eval:~255&0x1234} `& yields 4608 +&`${eval:-(~255&0x1234)} `& yields -4608 .endd As a more realistic example, in an ACL you might have @@ -8967,7 +9738,7 @@ and then re-expands what it has found. .cindex "Unicode" .cindex "UTF-8" "conversion from" .cindex "expansion" "UTF-8 conversion" -.cindex "&%from_utf8%&" +.cindex "&%from_utf8%& expansion item" The world is slowly moving towards Unicode, although there are no standards for email yet. However, other applications (including some databases) are starting to store data in Unicode, using UTF-8 encoding. This operator converts from a @@ -9001,11 +9772,21 @@ abbreviation &%h%& can be used when &%hash%& is used as an operator. .vitem &*${hex2b64:*&<&'hexstring'&>&*}*& .cindex "base64 encoding" "conversion from hex" .cindex "expansion" "hex to base64" -.cindex "&%hex2b64%&" +.cindex "&%hex2b64%& expansion item" This operator converts a hex string into one that is base64 encoded. This can be useful for processing the output of the MD5 and SHA-1 hashing functions. + +.vitem &*${hexquote:*&<&'string'&>&*}*& +.cindex "quoting" "hex-encoded unprintable characters" +.cindex "&%hexquote%& expansion item" +This operator converts non-printable characters in a string into a hex +escape form. Byte values between 33 (!) and 126 (~) inclusive are left +as is, and other byte values are converted to &`\xNN`&, for example a +byt value 127 is converted to &`\x7f`&. + + .vitem &*${lc:*&<&'string'&>&*}*& .cindex "case forcing in strings" .cindex "string" "case forcing" @@ -9019,7 +9800,7 @@ ${lc:$local_part} .vitem &*${length_*&<&'number'&>&*:*&<&'string'&>&*}*& .cindex "expansion" "string truncation" -.cindex "&%length%&" "expansion item" +.cindex "&%length%& expansion item" The &%length%& operator is a simpler interface to the &%length%& function that can be used when the parameter is a fixed number (as opposed to a string that changes when expanded). The effect is the same as @@ -9031,6 +9812,25 @@ See the description of the general &%length%& item above for details. Note that when &%length%& is used as an operator. +.vitem &*${listcount:*&<&'string'&>&*}*& +.cindex "expansion" "list item count" +.cindex "list" "item count" +.cindex "list" "count of items" +.cindex "&%listcount%& expansion item" +The string is interpreted as a list and the number of items is returned. + + +.vitem &*${listnamed:*&<&'name'&>&*}*&&~and&~&*${list_*&<&'type'&>&*name*&>&*}*& +.cindex "expansion" "named list" +.cindex "&%listnamed%& expansion item" +The name is interpreted as a named list and the content of the list is returned, +expanding any referenced lists, re-quoting as needed for colon-separation. +If the optional type if given it must be one of "a", "d", "h" or "l" +and selects address-, domain-, host- or localpart- lists to search among respectively. +Otherwise all types are searched in an undefined order and the first +matching list is returned. + + .vitem &*${local_part:*&<&'string'&>&*}*& .cindex "expansion" "local part extraction" .cindex "&%local_part%& expansion item" @@ -9044,7 +9844,7 @@ empty. .cindex "IP address" "masking" .cindex "CIDR notation" .cindex "expansion" "IP address masking" -.cindex "&%mask%&, expansion item" +.cindex "&%mask%& expansion item" If the form of the string to be operated on is not an IP address followed by a slash and an integer (that is, a network address in CIDR notation), the expansion fails. Otherwise, this operator converts the IP address to binary, @@ -9090,7 +9890,7 @@ See the description of the general &%nhash%& item above for details. .vitem &*${quote:*&<&'string'&>&*}*& .cindex "quoting" "in string expansions" .cindex "expansion" "quoting" -.cindex "&%quote%&, expansion item" +.cindex "&%quote%& expansion item" The &%quote%& operator puts its argument into double quotes if it is an empty string or contains anything other than letters, digits, underscores, dots, and hyphens. @@ -9132,13 +9932,34 @@ For single-key lookup types, no quoting is ever necessary and this operator yields an unchanged string. -.vitem &*${rxquote:*&<&'string'&>&*}*& -.cindex "quoting" "in regular expressions" -.cindex "regular expressions" "quoting" -.cindex "&%rxquote%& expansion item" -The &%rxquote%& operator inserts a backslash before any non-alphanumeric -characters in its argument. This is useful when substituting the values of -variables or headers inside regular expressions. +.vitem &*${randint:*&<&'n'&>&*}*& +.cindex "random number" +This operator returns a somewhat random number which is less than the +supplied number and is at least 0. The quality of this randomness depends +on how Exim was built; the values are not suitable for keying material. +If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used. +If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used, +for versions of GnuTLS with that function. +Otherwise, the implementation may be arc4random(), random() seeded by +srandomdev() or srandom(), or a custom implementation even weaker than +random(). + + +.vitem &*${reverse_ip:*&<&'ipaddr'&>&*}*& +.cindex "expansion" "IP address" +This operator reverses an IP address; for IPv4 addresses, the result is in +dotted-quad decimal form, while for IPv6 addreses the result is in +dotted-nibble hexadecimal form. In both cases, this is the "natural" form +for DNS. For example, +.code +${reverse_ip:192.0.2.4} +${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127} +.endd +returns +.code +4.2.0.192 +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 +.endd .vitem &*${rfc2047:*&<&'string'&>&*}*& @@ -9159,6 +9980,29 @@ string, using as many &"encoded words"& as necessary to encode all the characters. +.vitem &*${rfc2047d:*&<&'string'&>&*}*& +.cindex "expansion" "RFC 2047" +.cindex "RFC 2047" "decoding" +.cindex "&%rfc2047d%& expansion item" +This operator decodes strings that are encoded as per RFC 2047. Binary zero +bytes are replaced by question marks. Characters are converted into the +character set defined by &%headers_charset%&. Overlong RFC 2047 &"words"& are +not recognized unless &%check_rfc2047_length%& is set false. + +&*Note*&: If you use &%$header%&_&'xxx'&&*:*& (or &%$h%&_&'xxx'&&*:*&) to +access a header line, RFC 2047 decoding is done automatically. You do not need +to use this operator as well. + + + +.vitem &*${rxquote:*&<&'string'&>&*}*& +.cindex "quoting" "in regular expressions" +.cindex "regular expressions" "quoting" +.cindex "&%rxquote%& expansion item" +The &%rxquote%& operator inserts a backslash before any non-alphanumeric +characters in its argument. This is useful when substituting the values of +variables or headers inside regular expressions. + .vitem &*${sha1:*&<&'string'&>&*}*& .cindex "SHA-1 hash" @@ -9244,7 +10088,7 @@ This forces the letters in the string into upper-case. .section "Expansion conditions" "SECTexpcond" -.cindex "expansion" "conditions" +.scindex IIDexpcond "expansion" "conditions" The following conditions are available for testing by the &%${if%& construct while expanding strings: @@ -9274,12 +10118,65 @@ ${if >{$message_size}{10M} ... .endd Note that the general negation operator provides for inequality testing. The two strings must take the form of optionally signed decimal integers, -optionally followed by one of the letters &"K"& or &"M"& (in either upper or -lower case), signifying multiplication by 1024 or 1024*1024, respectively. +optionally followed by one of the letters &"K"&, &"M"& or &"G"& (in either upper or +lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively. +As a special case, the numerical value of an empty string is taken as +zero. + +In all cases, a relative comparator OP is testing if <&'string1'&> OP +<&'string2'&>; the above example is checking if &$message_size$& is larger than +10M, not if 10M is larger than &$message_size$&. + + +.vitem &*acl&~{{*&<&'name'&>&*}{*&<&'arg1'&>&*}&&& + {*&<&'arg2'&>&*}...}*& +.cindex "expansion" "calling an acl" +.cindex "&%acl%&" "expansion condition" +The name and zero to nine argument strings are first expanded separately. The expanded +arguments are assigned to the variables &$acl_arg1$& to &$acl_arg9$& in order. +Any unused are made empty. The variable &$acl_narg$& is set to the number of +arguments. The named ACL (see chapter &<>&) is called +and may use the variables; if another acl expansion is used the values +are restored after it returns. If the ACL sets +a value using a "message =" modifier the variable $value becomes +the result of the expansion, otherwise it is empty. +If the ACL returns accept the condition is true; if deny, false. +If the ACL returns defer the result is a forced-fail. + +.vitem &*bool&~{*&<&'string'&>&*}*& +.cindex "expansion" "boolean parsing" +.cindex "&%bool%& expansion condition" +This condition turns a string holding a true or false representation into +a boolean state. It parses &"true"&, &"false"&, &"yes"& and &"no"& +(case-insensitively); also positive integer numbers map to true if non-zero, +false if zero. +An empty string is treated as false. +Leading and trailing whitespace is ignored; +thus a string consisting only of whitespace is false. +All other string values will result in expansion failure. + +When combined with ACL variables, this expansion condition will let you +make decisions in one place and act on those decisions in another place. +For example: +.code +${if bool{$acl_m_privileged_sender} ... +.endd + + +.vitem &*bool_lax&~{*&<&'string'&>&*}*& +.cindex "expansion" "boolean parsing" +.cindex "&%bool_lax%& expansion condition" +Like &%bool%&, this condition turns a string into a boolean state. But +where &%bool%& accepts a strict set of strings, &%bool_lax%& uses the same +loose definition that the Router &%condition%& option uses. The empty string +and the values &"false"&, &"no"& and &"0"& map to false, all others map to +true. Leading and trailing whitespace is ignored. + +Note that where &"bool{00}"& is false, &"bool_lax{00}"& is true. .vitem &*crypteq&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "expansion" "encrypted comparison" -.cindex "encrypted strings" "comparing" +.cindex "encrypted strings, comparing" .cindex "&%crypteq%& expansion condition" This condition is included in the Exim binary if it is built to support any authentication mechanisms (see chapter &<>&). Otherwise, it is @@ -9329,30 +10226,35 @@ SHA-1 digest. If the length is not 28 or 40, the comparison fails. only the first eight characters of the password. However, in modern operating systems this is no longer true, and in many cases the entire password is used, whatever its length. + .next .cindex "&[crypt16()]&" -&%{crypt16}%& calls the &[crypt16()]& function (also known as &[bigcrypt()]&), -which was orginally created to use up to 16 characters of the password. Again, -in modern operating systems, more characters may be used. +&%{crypt16}%& calls the &[crypt16()]& function, which was originally created to +use up to 16 characters of the password in some operating systems. Again, in +modern operating systems, more characters may be used. .endlist - -Exim has its own version of &[crypt16()]& (which is just a double call to -&[crypt()]&). For operating systems that have their own version, setting +Exim has its own version of &[crypt16()]&, which is just a double call to +&[crypt()]&. For operating systems that have their own version, setting HAVE_CRYPT16 in &_Local/Makefile_& when building Exim causes it to use the operating system version instead of its own. This option is set by default in the OS-dependent &_Makefile_& for those operating systems that are known to support &[crypt16()]&. -If you do not put any curly bracket encryption type in a &%crypteq%& -comparison, the default is either &`{crypt}`& or &`{crypt16}`&, as determined -by the setting of DEFAULT_CRYPT in &_Local/Makefile_&. The default default is -&`{crypt}`&. Whatever the default, you can always use either function by -specifying it explicitly in curly brackets. +Some years after Exim's &[crypt16()]& was implemented, a user discovered that +it was not using the same algorithm as some operating systems' versions. It +turns out that as well as &[crypt16()]& there is a function called +&[bigcrypt()]& in some operating systems. This may or may not use the same +algorithm, and both of them may be different to Exim's built-in &[crypt16()]&. + +However, since there is now a move away from the traditional &[crypt()]& +functions towards using SHA1 and other algorithms, tidying up this area of +Exim is seen as very low priority. -Note that if a password is no longer than 8 characters, the results of -encrypting it with &[crypt()]& and &[crypt16()]& are identical. That means that -&[crypt16()]& is backwards compatible, as long as nobody feeds it a password -longer than 8 characters. +If you do not put a encryption type (in curly brackets) in a &%crypteq%& +comparison, the default is usually either &`{crypt}`& or &`{crypt16}`&, as +determined by the setting of DEFAULT_CRYPT in &_Local/Makefile_&. The default +default is &`{crypt}`&. Whatever the default, you can always use either +function by specifying it explicitly in curly brackets. .vitem &*def:*&<&'variable&~name'&> .cindex "expansion" "checking for empty variable" @@ -9377,19 +10279,15 @@ ${if def:header_reply-to:{$h_reply-to:}{$h_from:}} &*Note*&: No &%$%& appears before &%header_%& or &%h_%& in the condition, and the header name must be terminated by a colon if white space does not follow. -.vitem &*eq&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem &*eq&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*eqi&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "string" "comparison" .cindex "expansion" "string comparison" .cindex "&%eq%& expansion condition" -The two substrings are first expanded. The condition is true if the two -resulting strings are identical, including the case of letters. - -.vitem &*eqi&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& -.cindex "string" "comparison" -.cindex "expansion" "string comparison" .cindex "&%eqi%& expansion condition" The two substrings are first expanded. The condition is true if the two -resulting strings are identical when compared in a case-independent way. +resulting strings are identical. For &%eq%& the comparison includes the case of +letters, whereas for &%eqi%& the comparison is case-independent. .vitem &*exists&~{*&<&'file&~name'&>&*}*& .cindex "expansion" "file existence test" @@ -9408,53 +10306,105 @@ users' filter files may be locked out by the system administrator. This condition, which has no data, is true during a message's first delivery attempt. It is false during any subsequent delivery attempts. -.vitem &*ge&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& -.cindex "&%ge%& expansion condition" -See &*gei*&. -.vitem &*gei&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem "&*forall{*&<&'a list'&>&*}{*&<&'a condition'&>&*}*&" &&& + "&*forany{*&<&'a list'&>&*}{*&<&'a condition'&>&*}*&" +.cindex "list" "iterative conditions" +.cindex "expansion" "&*forall*& condition" +.cindex "expansion" "&*forany*& condition" +.vindex "&$item$&" +These conditions iterate over a list. The first argument is expanded to form +the list. By default, the list separator is a colon, but it can be changed by +the normal method. The second argument is interpreted as a condition that is to +be applied to each item in the list in turn. During the interpretation of the +condition, the current list item is placed in a variable called &$item$&. +.ilist +For &*forany*&, interpretation stops if the condition is true for any item, and +the result of the whole condition is true. If the condition is false for all +items in the list, the overall condition is false. +.next +For &*forall*&, interpretation stops if the condition is false for any item, +and the result of the whole condition is false. If the condition is true for +all items in the list, the overall condition is true. +.endlist +Note that negation of &*forany*& means that the condition must be false for all +items for the overall condition to succeed, and negation of &*forall*& means +that the condition must be false for at least one item. In this example, the +list separator is changed to a comma: +.code +${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}} +.endd +The value of &$item$& is saved and restored while &*forany*& or &*forall*& is +being processed, to enable these expansion items to be nested. + +To scan a named list, expand it with the &*listnamed*& operator. + + +.vitem &*ge&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*gei&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "string" "comparison" .cindex "expansion" "string comparison" +.cindex "&%ge%& expansion condition" .cindex "&%gei%& expansion condition" The two substrings are first expanded. The condition is true if the first -string is lexically greater than or equal to the second string: for &%ge%& the +string is lexically greater than or equal to the second string. For &%ge%& the comparison includes the case of letters, whereas for &%gei%& the comparison is case-independent. -.vitem &*gt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& -.cindex "&%gt%& expansion condition" -See &*gti*&. - -.vitem &*gti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem &*gt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*gti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "string" "comparison" .cindex "expansion" "string comparison" +.cindex "&%gt%& expansion condition" .cindex "&%gti%& expansion condition" The two substrings are first expanded. The condition is true if the first -string is lexically greater than the second string: for &%gt%& the comparison +string is lexically greater than the second string. For &%gt%& the comparison includes the case of letters, whereas for &%gti%& the comparison is case-independent. -.vitem &*isip&~{*&<&'string'&>&*}*& -.cindex "&%isip%& expansion condition" -See &*isip6*&. +.vitem &*inlist&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*inlisti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.cindex "string" "comparison" +.cindex "list" "iterative conditions" +Both strings are expanded; the second string is treated as a list of simple +strings; if the first string is a member of the second, then the condition +is true. -.vitem &*isip4&~{*&<&'string'&>&*}*& -.cindex "&%isip4%& expansion condition" -See &*isip6*&. +These are simpler to use versions of the more powerful &*forany*& condition. +Examples, and the &*forany*& equivalents: +.code +${if inlist{needle}{foo:needle:bar}} + ${if forany{foo:needle:bar}{eq{$item}{needle}}} +${if inlisti{Needle}{fOo:NeeDLE:bAr}} + ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}} +.endd -.vitem &*isip6&~{*&<&'string'&>&*}*& +.vitem &*isip&~{*&<&'string'&>&*}*& &&& + &*isip4&~{*&<&'string'&>&*}*& &&& + &*isip6&~{*&<&'string'&>&*}*& .cindex "IP address" "testing string format" .cindex "string" "testing for IP address" +.cindex "&%isip%& expansion condition" +.cindex "&%isip4%& expansion condition" .cindex "&%isip6%& expansion condition" The substring is first expanded, and then tested to see if it has the form of an IP address. Both IPv4 and IPv6 addresses are valid for &%isip%&, whereas -&%isip4%& and &%isip6%& test just for IPv4 or IPv6 addresses, respectively. For -example, you could use +&%isip4%& and &%isip6%& test specifically for IPv4 or IPv6 addresses. + +For an IPv4 address, the test is for four dot-separated components, each of +which consists of from one to three digits. For an IPv6 address, up to eight +colon-separated components are permitted, each containing from one to four +hexadecimal digits. There may be fewer than eight components if an empty +component (adjacent colons) is present. Only one empty component is permitted. + +&*Note*&: The checks are just on the form of the address; actual numerical +values are not considered. Thus, for example, 999.999.999.999 passes the IPv4 +check. The main use of these tests is to distinguish between IP addresses and +host names, or between IPv4 and IPv6 addresses. For example, you could use .code ${if isip4{$sender_host_address}... .endd -to test which version of IP an incoming SMTP connection is using. - +to test which IP version an incoming SMTP connection is using. .vitem &*ldapauth&~{*&<&'ldap&~query'&>&*}*& .cindex "LDAP" "use for authentication" @@ -9472,29 +10422,25 @@ of SMTP authentication, and chapter &<>& for an example of how this can be used. -.vitem &*le&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& -.cindex "&%le%& expansion condition" -See &*lei*&. - -.vitem &*lei&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem &*le&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*lei&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "string" "comparison" .cindex "expansion" "string comparison" +.cindex "&%le%& expansion condition" .cindex "&%lei%& expansion condition" The two substrings are first expanded. The condition is true if the first -string is lexically less than or equal to the second string: for &%le%& the +string is lexically less than or equal to the second string. For &%le%& the comparison includes the case of letters, whereas for &%lei%& the comparison is case-independent. -.vitem &*lt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& -.cindex "&%lt%& expansion condition" -See &*lti*&. - -.vitem &*lti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem &*lt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& + &*lti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "string" "comparison" .cindex "expansion" "string comparison" +.cindex "&%lt%& expansion condition" .cindex "&%lti%& expansion condition" The two substrings are first expanded. The condition is true if the first -string is lexically less than the second string: for &%lt%& the comparison +string is lexically less than the second string. For &%lt%& the comparison includes the case of letters, whereas for &%lti%& the comparison is case-independent. @@ -9502,7 +10448,7 @@ case-independent. .vitem &*match&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "expansion" "regular expression comparison" .cindex "regular expressions" "match in expanded string" -.cindex "&%match%&, expansion condition" +.cindex "&%match%& expansion condition" The two substrings are first expanded. The second is then treated as a regular expression and applied to the first. Because of the pre-expansion, if the regular expression contains dollar, or backslash characters, they must be @@ -9545,7 +10491,7 @@ See &*match_local_part*&. .cindex "&%match_ip%& expansion condition" This condition matches an IP address to a list of IP address patterns. It must be followed by two argument strings. The first (after expansion) must be an IP -address or an empty string. The second (after expansion) is a restricted host +address or an empty string. The second (not expanded) is a restricted host list that can match only an IP address, not a host name. For example: .code ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}} @@ -9561,7 +10507,9 @@ An empty item, which matches only if the IP address is empty. This could be useful for testing for a locally submitted message or one from specific hosts in a single test such as . ==== As this is a nested list, any displays it contains must be indented -. ==== as otherwise they are too far to the left. +. ==== as otherwise they are too far to the left. This comment applies to +. ==== the use of xmlto plus fop. There's no problem when formatting with +. ==== sdop, with or without the extra indent. .code ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}} .endd @@ -9569,22 +10517,36 @@ where the first item in the list is the empty string. .next The item @[] matches any of the local host's interface addresses. .next -Lookups are assumed to be &"net-"& style lookups, even if &`net-`& is not -specified. Thus, the following are equivalent: +Single-key lookups are assumed to be like &"net-"& style lookups in host lists, +even if &`net-`& is not specified. There is never any attempt to turn the IP +address into a host name. The most common type of linear search for +&*match_ip*& is likely to be &*iplsearch*&, in which the file can contain CIDR +masks. For example: +.code + ${if match_ip{$sender_host_address}{iplsearch;/some/file}... +.endd +It is of course possible to use other kinds of lookup, and in such a case, you +do need to specify the &`net-`& prefix if you want to specify a specific +address mask, for example: .code - ${if match_ip{$sender_host_address}{lsearch;/some/file}... - ${if match_ip{$sender_host_address}{net-lsearch;/some/file}... + ${if match_ip{$sender_host_address}{net24-dbm;/some/file}... +.endd +However, unless you are combining a &%match_ip%& condition with others, it is +just as easy to use the fact that a lookup is itself a condition, and write: +.code + ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}... .endd -You do need to specify the &`net-`& prefix if you want to specify a -specific address mask, for example, by using &`net24-`&. .endlist ilist +Note that <&'string2'&> is not itself subject to string expansion, unless +Exim was built with the EXPAND_LISTMATCH_RHS option. + Consult section &<>& for further details of these patterns. .vitem &*match_local_part&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& .cindex "domain list" "in expansion condition" .cindex "address list" "in expansion condition" -.cindex "local part list" "in expansion condition" +.cindex "local part" "list, in expansion condition" .cindex "&%match_local_part%& expansion condition" This condition, together with &%match_address%& and &%match_domain%&, make it possible to test domain, address, and local part lists within expansions. Each @@ -9606,6 +10568,9 @@ item can be used, as in all address lists, to cause subsequent items to have their local parts matched casefully. Domains are always matched caselessly. +Note that <&'string2'&> is not itself subject to string expansion, unless +Exim was built with the EXPAND_LISTMATCH_RHS option. + &*Note*&: Host lists are &'not'& supported in this way. This is because hosts have two identities: a name and an IP address, and it is not clear how to specify cleanly how such a test would work. However, IP addresses can be @@ -9642,11 +10607,11 @@ separators. If the data is being inserted from a variable, the &%sg%& expansion item can be used to double any existing colons. For example, the configuration of a LOGIN authenticator might contain this setting: .code -server_condition = ${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}} +server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}} .endd For a PLAIN authenticator you could use: .code -server_condition = ${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}} +server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}} .endd In some operating systems, PAM authentication can be done only from a process running as root. Since Exim is running as the Exim user when receiving @@ -9683,12 +10648,16 @@ The &%pwcheck%& condition takes one argument, which must be the user name and password, separated by a colon. For example, in a LOGIN authenticator configuration, you might have this: .code -server_condition = ${if pwcheck{$1:$2}{1}{0}} +server_condition = ${if pwcheck{$auth1:$auth2}} +.endd +Again, for a PLAIN authenticator configuration, this would be: +.code +server_condition = ${if pwcheck{$auth2:$auth3}} .endd .vitem &*queue_running*& .cindex "queue runner" "detecting when delivering from" .cindex "expansion" "queue runner test" -.cindex "&%queue_runnint%& expansion condition" +.cindex "&%queue_running%& expansion condition" This condition, which has no data, is true during delivery attempts that are initiated by queue runner processes, and false otherwise. @@ -9696,7 +10665,7 @@ initiated by queue runner processes, and false otherwise. .vitem &*radius&~{*&<&'authentication&~string'&>&*}*& .cindex "Radius" .cindex "expansion" "Radius authentication" -.cindex "&%radiu%& expansion condition" +.cindex "&%radius%& expansion condition" Radius authentication (RFC 2865) is supported in a similar way to PAM. You must set RADIUS_CONFIG_FILE in &_Local/Makefile_& to specify the location of the Radius client configuration file in order to build Exim with Radius @@ -9721,7 +10690,7 @@ The string specified by RADIUS_CONFIG_FILE is expanded and passed to the Radius client library, which calls the Radius server. The condition is true if the authentication is successful. For example: .code -server_condition = ${if radius{}{yes}{no}} +server_condition = ${if radius{}} .endd @@ -9749,7 +10718,7 @@ from the Cyrus SASL library. Up to four arguments can be supplied to the &%saslauthd%& condition, but only two are mandatory. For example: .code -server_condition = ${if saslauthd{{$1}{$2}}{1}{0}} +server_condition = ${if saslauthd{{$auth1}{$auth2}}} .endd The service and the realm are optional (which is why the arguments are enclosed in their own set of braces). For details of the meaning of the service and @@ -9758,7 +10727,7 @@ realm, and how to run the daemon, consult the Cyrus documentation. -.section "Combining expansion conditions" +.section "Combining expansion conditions" "SECID84" .cindex "expansion" "combining conditions" Several conditions can be tested at once by combining them using the &%and%& and &%or%& combination conditions. Note that &%and%& and &%or%& are complete @@ -9790,12 +10759,13 @@ sub-conditions, the values of the numeric variables afterwards are taken from the last one. When a false sub-condition is found, the following ones are parsed but not evaluated. .endlist +.ecindex IIDexpcond .section "Expansion variables" "SECTexpvar" -.cindex "expansion variables" "list of" +.cindex "expansion" "variables, list of" This section contains an alphabetical list of all the expansion variables. Some of them are available only when Exim is compiled with specific options such as support for TLS or the content scanning extension. @@ -9805,30 +10775,37 @@ support for TLS or the content scanning extension. .cindex "numerical variables (&$1$& &$2$& etc)" When a &%match%& expansion condition succeeds, these variables contain the captured substrings identified by the regular expression during subsequent -processing of the success string of the containing &%if%& expansion item. They -may also be set externally by some other matching process which precedes the -expansion of the string. For example, the commands available in Exim filter -files include an &%if%& command with its own regular expression matching -condition. - -.vitem "&$acl_c0$& &-- &$acl_c19$&" -Values can be placed in these variables by the &%set%& modifier in an ACL. The -values persist throughout the lifetime of an SMTP connection. They can be used -to pass information between ACLs and different invocations of the same ACL. -When a message is received, the values of these variables are saved with the -message, and can be accessed by filters, routers, and transports during -subsequent delivery. - -.vitem "&$acl_m0$& &-- &$acl_m19$&" +processing of the success string of the containing &%if%& expansion item. +However, they do not retain their values afterwards; in fact, their previous +values are restored at the end of processing an &%if%& item. The numerical +variables may also be set externally by some other matching process which +precedes the expansion of the string. For example, the commands available in +Exim filter files include an &%if%& command with its own regular expression +matching condition. + +.vitem "&$acl_c...$&" Values can be placed in these variables by the &%set%& modifier in an ACL. They -retain their values while a message is being received, but are reset -afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a -TLS session. When a message is received, the values of these variables are -saved with the message, and can be accessed by filters, routers, and transports +can be given any name that starts with &$acl_c$& and is at least six characters +long, but the sixth character must be either a digit or an underscore. For +example: &$acl_c5$&, &$acl_c_mycount$&. The values of the &$acl_c...$& +variables persist throughout the lifetime of an SMTP connection. They can be +used to pass information between ACLs and between different invocations of the +same ACL. When a message is received, the values of these variables are saved +with the message, and can be accessed by filters, routers, and transports during subsequent delivery. +.vitem "&$acl_m...$&" +These variables are like the &$acl_c...$& variables, except that their values +are reset after a message has been received. Thus, if several messages are +received in one SMTP connection, &$acl_m...$& values are not passed on from one +message to the next, as &$acl_c...$& values are. The &$acl_m...$& variables are +also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a +message is received, the values of these variables are saved with the message, +and can be accessed by filters, routers, and transports during subsequent +delivery. + .vitem &$acl_verify_message$& -.cindex "&$acl_verify_message$&" +.vindex "&$acl_verify_message$&" After an address verification has failed, this variable contains the failure message. It retains its value for use in subsequent modifiers. The message can be preserved by coding like this: @@ -9841,7 +10818,7 @@ You can use &$acl_verify_message$& during the expansion of the &%message%& or failure. .vitem &$address_data$& -.cindex "&$address_data$&" +.vindex "&$address_data$&" This variable is set by means of the &%address_data%& option in routers. The value then remains with the address while it is processed by subsequent routers and eventually a transport. If the transport is handling multiple addresses, @@ -9866,7 +10843,7 @@ after the end of the current ACL statement. If you want to preserve these values for longer, you can save them in ACL variables. .vitem &$address_file$& -.cindex "&$address_file$&" +.vindex "&$address_file$&" When, as a result of aliasing, forwarding, or filtering, a message is directed to a specific file, this variable holds the name of the file when the transport is running. At other times, the variable is empty. For example, using the @@ -9875,40 +10852,44 @@ default configuration, if user &%r2d2%& has a &_.forward_& file containing /home/r2d2/savemail .endd then when the &(address_file)& transport is running, &$address_file$& -contains &"/home/r2d2/savemail"&. - +contains the text string &`/home/r2d2/savemail`&. .cindex "Sieve filter" "value of &$address_file$&" For Sieve filters, the value may be &"inbox"& or a relative folder name. It is then up to the transport configuration to generate an appropriate absolute path to the relevant file. .vitem &$address_pipe$& -.cindex "&$address_pipe$&" +.vindex "&$address_pipe$&" When, as a result of aliasing or forwarding, a message is directed to a pipe, this variable holds the pipe command when the transport is running. .vitem "&$auth1$& &-- &$auth3$&" -.cindex "&$auth1$&, &$auth2$&, etc" +.vindex "&$auth1$&, &$auth2$&, etc" These variables are used in SMTP authenticators (see chapters &<>&&--&<>&). Elsewhere, they are empty. .vitem &$authenticated_id$& .cindex "authentication" "id" -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" When a server successfully authenticates a client it may be configured to preserve some of the authentication information in the variable &$authenticated_id$& (see chapter &<>&). For example, a user/password authenticator configuration might preserve the user name for use in the routers. Note that this is not the same information that is saved in -&$sender_host_authenticated$&. When a message is submitted locally (that is, -not over a TCP connection), the value of &$authenticated_id$& is the login name -of the calling process. +&$sender_host_authenticated$&. +When a message is submitted locally (that is, not over a TCP connection) +the value of &$authenticated_id$& is normally the login name of the calling +process. However, a trusted user can override this by means of the &%-oMai%& +command line option. + + + .vitem &$authenticated_sender$& .cindex "sender" "authenticated" .cindex "authentication" "sender" .cindex "AUTH" "on MAIL command" -.cindex "&$authenticated_sender$&" +.vindex "&$authenticated_sender$&" When acting as a server, Exim takes note of the AUTH= parameter on an incoming SMTP MAIL command if it believes the sender is sufficiently trusted, as described in section &<>&. Unless the data is the string @@ -9916,15 +10897,16 @@ described in section &<>&. Unless the data is the string available during delivery in the &$authenticated_sender$& variable. If the sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data. -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" When a message is submitted locally (that is, not over a TCP connection), the value of &$authenticated_sender$& is an address constructed from the login -name of the calling process and &$qualify_domain$&. +name of the calling process and &$qualify_domain$&, except that a trusted user +can override this by means of the &%-oMas%& command line option. .vitem &$authentication_failed$& .cindex "authentication" "failure" -.cindex "&$authentication_failed$&" +.vindex "&$authentication_failed$&" This variable is set to &"1"& in an Exim server if a client issues an AUTH command that does not succeed. Otherwise it is set to &"0"&. This makes it possible to distinguish between &"did not try to authenticate"& @@ -9934,10 +10916,17 @@ is empty and &$authentication_failed$& is set to &"1"&). Failure includes any negative response to an AUTH command, including (for example) an attempt to use an undefined mechanism. +.vitem &$av_failed$& +.cindex "content scanning" "AV scanner failure" +This variable is available when Exim is compiled with the content-scanning +extension. It is set to &"0"& by default, but will be set to &"1"& if any +problem occurs with the virus scanner (specified by &%av_scanner%&) during +the ACL malware condition. + .vitem &$body_linecount$& .cindex "message body" "line count" .cindex "body of message" "line count" -.cindex "&$body_linecount$&" +.vindex "&$body_linecount$&" When a message is being received or delivered, this variable contains the number of lines in the message's body. See also &$message_linecount$&. @@ -9945,25 +10934,25 @@ number of lines in the message's body. See also &$message_linecount$&. .cindex "message body" "binary zero count" .cindex "body of message" "binary zero count" .cindex "binary zero" "in message body" -.cindex "&$body_zerocount$&" +.vindex "&$body_zerocount$&" When a message is being received or delivered, this variable contains the -number of binary zero bytes in the message's body. +number of binary zero bytes (ASCII NULs) in the message's body. .vitem &$bounce_recipient$& -.cindex "&$bounce_recipient$&" +.vindex "&$bounce_recipient$&" This is set to the recipient address of a bounce message while Exim is creating it. It is useful if a customized bounce message text file is in use (see chapter &<>&). .vitem &$bounce_return_size_limit$& -.cindex "&$bounce_return_size_limit$&" +.vindex "&$bounce_return_size_limit$&" This contains the value set in the &%bounce_return_size_limit%& option, rounded up to a multiple of 1000. It is useful when a customized error message text file is in use (see chapter &<>&). .vitem &$caller_gid$& .cindex "gid (group id)" "caller" -.cindex "&$caller_gid$&" +.vindex "&$caller_gid$&" The real group id under which the process that called Exim was running. This is not the same as the group id of the originator of a message (see &$originator_gid$&). If Exim re-execs itself, this variable in the new @@ -9971,62 +10960,58 @@ incarnation normally contains the Exim gid. .vitem &$caller_uid$& .cindex "uid (user id)" "caller" -.cindex "&$caller_uid$&" +.vindex "&$caller_uid$&" The real user id under which the process that called Exim was running. This is not the same as the user id of the originator of a message (see &$originator_uid$&). If Exim re-execs itself, this variable in the new incarnation normally contains the Exim uid. .vitem &$compile_date$& -.cindex "&$compile_date$&" +.vindex "&$compile_date$&" The date on which the Exim binary was compiled. .vitem &$compile_number$& -.cindex "&$compile_number$&" +.vindex "&$compile_number$&" The building process for Exim keeps a count of the number of times it has been compiled. This serves to distinguish different compilations of the same version of the program. .vitem &$demime_errorlevel$& -.cindex "&$demime_errorlevel$&" +.vindex "&$demime_errorlevel$&" This variable is available when Exim is compiled with the content-scanning extension and the obsolete &%demime%& condition. For details, see section &<>&. .vitem &$demime_reason$& -.cindex "&$demime_reason$&" +.vindex "&$demime_reason$&" This variable is available when Exim is compiled with the content-scanning extension and the obsolete &%demime%& condition. For details, see section &<>&. - -.vitem &$dnslist_domain$& +.vitem &$dnslist_domain$& &&& + &$dnslist_matched$& &&& + &$dnslist_text$& &&& + &$dnslist_value$& +.vindex "&$dnslist_domain$&" +.vindex "&$dnslist_matched$&" +.vindex "&$dnslist_text$&" +.vindex "&$dnslist_value$&" .cindex "black list (DNS)" -.cindex "&$dnslist_domain$&" -When a client host is found to be on a DNS (black) list, -the list's domain name is put into this variable so that it can be included in -the rejection message. - -.vitem &$dnslist_text$& -.cindex "&$dnslist_text$&" -When a client host is found to be on a DNS (black) list, the -contents of any associated TXT record are placed in this variable. - -.vitem &$dnslist_value$& -.cindex "&$dnslist_value$&" -When a client host is found to be on a DNS (black) list, -the IP address from the resource record is placed in this variable. -If there are multiple records, all the addresses are included, comma-space -separated. +When a DNS (black) list lookup succeeds, these variables are set to contain +the following data from the lookup: the list's domain name, the key that was +looked up, the contents of any associated TXT record, and the value from the +main A record. See section &<>& for more details. .vitem &$domain$& -.cindex "&$domain$&" +.vindex "&$domain$&" When an address is being routed, or delivered on its own, this variable -contains the domain. Global address rewriting happens when a message is -received, so the value of &$domain$& during routing and delivery is the value -after rewriting. &$domain$& is set during user filtering, but not during system -filtering, because a message may have many recipients and the system filter is -called just once. +contains the domain. Uppercase letters in the domain are converted into lower +case for &$domain$&. + +Global address rewriting happens when a message is received, so the value of +&$domain$& during routing and delivery is the value after rewriting. &$domain$& +is set during user filtering, but not during system filtering, because a +message may have many recipients and the system filter is called just once. When more than one address is being delivered at once (for example, several RCPT commands in one SMTP delivery), &$domain$& is set only if they all @@ -10035,7 +11020,7 @@ at a time if the value of &$domain$& is required at transport time &-- this is the default for local transports. For further details of the environment in which local transports are run, see chapter &<>&. -.cindex "&%delay_warning_condition%&" +.oindex "&%delay_warning_condition%&" At the end of a delivery, if all deferred addresses have the same domain, it is set in &$domain$& during the expansion of &%delay_warning_condition%&. @@ -10066,14 +11051,14 @@ recipient domain (which is what is in &$domain$& at this time). .next .cindex "ETRN" "value of &$domain$&" -.cindex "&%smtp_etrn_command%&" +.oindex "&%smtp_etrn_command%&" When the &%smtp_etrn_command%& option is being expanded, &$domain$& contains the complete argument of the ETRN command (see section &<>&). .endlist .vitem &$domain_data$& -.cindex "&$domain_data$&" +.vindex "&$domain_data$&" When the &%domains%& option on a router matches a domain by means of a lookup, the data read by the lookup is available during the running of the router as &$domain_data$&. In addition, if the driver routes the @@ -10087,19 +11072,19 @@ the rest of the ACL statement. In all other situations, this variable expands to nothing. .vitem &$exim_gid$& -.cindex "&$exim_gid$&" +.vindex "&$exim_gid$&" This variable contains the numerical value of the Exim group id. .vitem &$exim_path$& -.cindex "&$exim_path$&" +.vindex "&$exim_path$&" This variable contains the path to the Exim binary. .vitem &$exim_uid$& -.cindex "&$exim_uid$&" +.vindex "&$exim_uid$&" This variable contains the numerical value of the Exim user id. .vitem &$found_extension$& -.cindex "&$found_extension$&" +.vindex "&$found_extension$&" This variable is available when Exim is compiled with the content-scanning extension and the obsolete &%demime%& condition. For details, see section &<>&. @@ -10110,8 +11095,14 @@ inserting the message header line with the given name. Note that the name must be terminated by colon or white space, because it may contain a wide variety of characters. Note also that braces must &'not'& be used. +.vitem &$headers_added$& +.vindex "&$headers_added$&" +Within an ACL this variable contains the headers added so far by +the ACL modifier add_header (section &<>&). +The headers are a newline-separated list. + .vitem &$home$& -.cindex "&$home$&" +.vindex "&$home$&" When the &%check_local_user%& option is set for a router, the user's home directory is placed in &$home$& when the check succeeds. In particular, this means it is set during the running of users' filter files. A router may also @@ -10122,28 +11113,34 @@ When running a filter test via the &%-bf%& option, &$home$& is set to the value of the environment variable HOME. .vitem &$host$& -.cindex "&$host$&" -When the &(smtp)& transport is expanding its options for encryption using TLS, -&$host$& contains the name of the host to which it is connected. Likewise, when -used in the client part of an authenticator configuration (see chapter -&<>&), &$host$& contains the name of the server to which the -client is connected. +.vindex "&$host$&" +If a router assigns an address to a transport (any transport), and passes a +list of hosts with the address, the value of &$host$& when the transport starts +to run is the name of the first host on the list. Note that this applies both +to local and remote transports. .cindex "transport" "filter" .cindex "filter" "transport filter" -When used in a transport filter (see chapter &<>&) -&$host$& refers to the host involved in the current connection. When a local -transport is run as a result of a router that sets up a host list, &$host$& -contains the name of the first host. +For the &(smtp)& transport, if there is more than one host, the value of +&$host$& changes as the transport works its way through the list. In +particular, when the &(smtp)& transport is expanding its options for encryption +using TLS, or for specifying a transport filter (see chapter +&<>&), &$host$& contains the name of the host to which it +is connected. + +When used in the client part of an authenticator configuration (see chapter +&<>&), &$host$& contains the name of the server to which the +client is connected. + .vitem &$host_address$& -.cindex "&$host_address$&" +.vindex "&$host_address$&" This variable is set to the remote host's IP address whenever &$host$& is set for a remote connection. It is also set to the IP address that is being checked when the &%ignore_target_hosts%& option is being processed. .vitem &$host_data$& -.cindex "&$host_data$&" +.vindex "&$host_data$&" If a &%hosts%& condition in an ACL is satisfied by means of a lookup, the result of the lookup is made available in the &$host_data$& variable. This allows you, for example, to do things like this: @@ -10152,8 +11149,8 @@ deny hosts = net-lsearch;/some/file message = $host_data .endd .vitem &$host_lookup_deferred$& -.cindex "host name lookup" "failure of" -.cindex "&$host_lookup_deferred$&" +.cindex "host name" "lookup, failure of" +.vindex "&$host_lookup_deferred$&" This variable normally contains &"0"&, as does &$host_lookup_failed$&. When a message comes from a remote host and there is an attempt to look up the host's name from its IP address, and the attempt is not successful, one of these @@ -10181,44 +11178,46 @@ the result, the name is not accepted, and &$host_lookup_deferred$& is set to &"1"&. See also &$sender_host_name$&. .vitem &$host_lookup_failed$& -.cindex "&$host_lookup_failed$&" +.vindex "&$host_lookup_failed$&" See &$host_lookup_deferred$&. .vitem &$inode$& -.cindex "&$inode$&" +.vindex "&$inode$&" The only time this variable is set is while expanding the &%directory_file%& option in the &(appendfile)& transport. The variable contains the inode number of the temporary file which is about to be renamed. It can be used to construct a unique name for the file. .vitem &$interface_address$& -.cindex "&$interface_address$&" -As soon as a server starts processing a TCP/IP connection, this variable is set -to the address of the local IP interface, and &$interface_port$& is set to the -port number. These values are therefore available for use in the &"connect"& -ACL. See also the &%-oMi%& command line option. As well as being used in ACLs, -these variable could be used, for example, to make the file name for a TLS -certificate depend on which interface and/or port is being used. +.vindex "&$interface_address$&" +This is an obsolete name for &$received_ip_address$&. .vitem &$interface_port$& -.cindex "&$interface_port$&" -See &$interface_address$&. +.vindex "&$interface_port$&" +This is an obsolete name for &$received_port$&. + +.vitem &$item$& +.vindex "&$item$&" +This variable is used during the expansion of &*forall*& and &*forany*& +conditions (see section &<>&), and &*filter*&, &*map*&, and +&*reduce*& items (see section &<>&). In other circumstances, it is +empty. .vitem &$ldap_dn$& -.cindex "&$ldap_dn$&" +.vindex "&$ldap_dn$&" This variable, which is available only when Exim is compiled with LDAP support, contains the DN from the last entry in the most recently successful LDAP lookup. .vitem &$load_average$& -.cindex "&$load_average$&" -This variable contains the system load average, multiplied by 1000 to that it +.vindex "&$load_average$&" +This variable contains the system load average, multiplied by 1000 so that it is an integer. For example, if the load average is 0.21, the value of the variable is 210. The value is recomputed every time the variable is referenced. .vitem &$local_part$& -.cindex "&$local_part$&" +.vindex "&$local_part$&" When an address is being routed, or delivered on its own, this variable contains the local part. When a number of addresses are being delivered together (for example, multiple RCPT commands in an SMTP @@ -10230,8 +11229,8 @@ Global address rewriting happens when a message is received, so the value of because a message may have many recipients and the system filter is called just once. -.cindex "&$local_part_prefix$&" -.cindex "&$local_part_suffix$&" +.vindex "&$local_part_prefix$&" +.vindex "&$local_part_suffix$&" If a local part prefix or suffix has been recognized, it is not included in the value of &$local_part$& during routing and subsequent delivery. The values of any prefix or suffix are in &$local_part_prefix$& and @@ -10270,7 +11269,7 @@ to process local parts in a case-dependent manner in a router, you can set the &%caseful_local_part%& option (see chapter &<>&). .vitem &$local_part_data$& -.cindex "&$local_part_data$&" +.vindex "&$local_part_data$&" When the &%local_parts%& option on a router matches a local part by means of a lookup, the data read by the lookup is available during the running of the router as &$local_part_data$&. In addition, if the driver routes the address @@ -10283,28 +11282,28 @@ available during the rest of the ACL statement. In all other situations, this variable expands to nothing. .vitem &$local_part_prefix$& -.cindex "&$local_part_prefix$&" +.vindex "&$local_part_prefix$&" When an address is being routed or delivered, and a specific prefix for the local part was recognized, it is available in this variable, having been removed from &$local_part$&. .vitem &$local_part_suffix$& -.cindex "&$local_part_suffix$&" +.vindex "&$local_part_suffix$&" When an address is being routed or delivered, and a specific suffix for the local part was recognized, it is available in this variable, having been removed from &$local_part$&. .vitem &$local_scan_data$& -.cindex "&$local_scan_data$&" +.vindex "&$local_scan_data$&" This variable contains the text returned by the &[local_scan()]& function when a message is received. See chapter &<>& for more details. .vitem &$local_user_gid$& -.cindex "&$local_user_gid$&" +.vindex "&$local_user_gid$&" See &$local_user_uid$&. .vitem &$local_user_uid$& -.cindex "&$local_user_uid$&" +.vindex "&$local_user_uid$&" This variable and &$local_user_gid$& are set to the uid and gid after the &%check_local_user%& router precondition succeeds. This means that their values are available for the remaining preconditions (&%senders%&, &%require_files%&, @@ -10313,20 +11312,20 @@ router-specific expansions. At all other times, the values in these variables are &`(uid_t)(-1)`& and &`(gid_t)(-1)`&, respectively. .vitem &$localhost_number$& -.cindex "&$localhost_number$&" +.vindex "&$localhost_number$&" This contains the expanded value of the &%localhost_number%& option. The expansion happens after the main options have been read. .vitem &$log_inodes$& -.cindex "&$log_inodes$&" +.vindex "&$log_inodes$&" The number of free inodes in the disk partition where Exim's log files are being written. The value is recalculated whenever the variable is referenced. If the relevant file system does not have the concept of inodes, the value of is -1. See also the &%check_log_inodes%& option. .vitem &$log_space$& -.cindex "&$log_space$&" +.vindex "&$log_space$&" The amount of free space (as a number of kilobytes) in the disk partition where Exim's log files are being written. The value is recalculated whenever the variable is referenced. If the operating system does not have the @@ -10335,7 +11334,7 @@ the space value is -1. See also the &%check_log_space%& option. .vitem &$mailstore_basename$& -.cindex "&$mailstore_basename$&" +.vindex "&$mailstore_basename$&" This variable is set only when doing deliveries in &"mailstore"& format in the &(appendfile)& transport. During the expansion of the &%mailstore_prefix%&, &%mailstore_suffix%&, &%message_prefix%&, and &%message_suffix%& options, it @@ -10344,15 +11343,22 @@ without the &".tmp"&, &".env"&, or &".msg"& suffix. At all other times, this variable is empty. .vitem &$malware_name$& -.cindex "&$malware_name$&" +.vindex "&$malware_name$&" This variable is available when Exim is compiled with the content-scanning extension. It is set to the name of the virus that was found when the ACL &%malware%& condition is true (see section &<>&). +.vitem &$max_received_linelength$& +.vindex "&$max_received_linelength$&" +.cindex "maximum" "line length" +.cindex "line length" "maximum" +This variable contains the number of bytes in the longest line that was +received as part of the message, not counting the line termination +character(s). .vitem &$message_age$& .cindex "message" "age of" -.cindex "&$message_age$&" +.vindex "&$message_age$&" This variable is set at the start of a delivery attempt to contain the number of seconds since the message was received. It does not change during a single delivery attempt. @@ -10361,19 +11367,23 @@ delivery attempt. .cindex "body of message" "expansion variable" .cindex "message body" "in expansion" .cindex "binary zero" "in message body" -.cindex "&$message_body$&" -This variable contains the initial portion of a message's -body while it is being delivered, and is intended mainly for use in filter -files. The maximum number of characters of the body that are put into the -variable is set by the &%message_body_visible%& configuration option; the -default is 500. Newlines are converted into spaces to make it easier to search -for phrases that might be split over a line break. -Binary zeros are also converted into spaces. +.vindex "&$message_body$&" +.oindex "&%message_body_visible%&" +This variable contains the initial portion of a message's body while it is +being delivered, and is intended mainly for use in filter files. The maximum +number of characters of the body that are put into the variable is set by the +&%message_body_visible%& configuration option; the default is 500. + +.oindex "&%message_body_newlines%&" +By default, newlines are converted into spaces in &$message_body$&, to make it +easier to search for phrases that might be split over a line break. However, +this can be disabled by setting &%message_body_newlines%& to be true. Binary +zeros are always converted into spaces. .vitem &$message_body_end$& .cindex "body of message" "expansion variable" .cindex "message body" "in expansion" -.cindex "&$message_body_end$&" +.vindex "&$message_body_end$&" This variable contains the final portion of a message's body while it is being delivered. The format and maximum size are as for &$message_body$&. @@ -10381,14 +11391,14 @@ body while it is being delivered. The format and maximum size are as for .vitem &$message_body_size$& .cindex "body of message" "size" .cindex "message body" "size" -.cindex "&$message_body_size$&" +.vindex "&$message_body_size$&" When a message is being delivered, this variable contains the size of the body in bytes. The count starts from the character after the blank line that separates the body from the header. Newlines are included in the count. See also &$message_size$&, &$body_linecount$&, and &$body_zerocount$&. .vitem &$message_exim_id$& -.cindex "&$message_exim_id$&" +.vindex "&$message_exim_id$&" When a message is being received or delivered, this variable contains the unique message id that is generated and used by Exim to identify the message. An id is not created for a message until after its header has been successfully @@ -10397,15 +11407,22 @@ line; it is the local id that Exim assigns to the message, for example: &`1BXTIK-0001yO-VA`&. .vitem &$message_headers$& +.vindex &$message_headers$& This variable contains a concatenation of all the header lines when a message is being processed, except for lines added by routers or transports. The header -lines are separated by newline characters. +lines are separated by newline characters. Their contents are decoded in the +same way as a header line that is inserted by &%bheader%&. + +.vitem &$message_headers_raw$& +.vindex &$message_headers_raw$& +This variable is like &$message_headers$& except that no processing of the +contents of header lines is done. .vitem &$message_id$& This is an old name for &$message_exim_id$&, which is now deprecated. .vitem &$message_linecount$& -.cindex "&$message_linecount$&" +.vindex "&$message_linecount$&" This variable contains the total number of lines in the header and body of the message. Compare &$body_linecount$&, which is the count for the body only. During the DATA and content-scanning ACLs, &$message_linecount$& contains the @@ -10413,12 +11430,19 @@ number of lines received. Before delivery happens (that is, before filters, routers, and transports run) the count is increased to include the &'Received:'& header line that Exim standardly adds, and also any other header lines that are added by ACLs. The blank line that separates the message header -from the body is not counted. Here is an example of the use of this variable in -a DATA ACL: +from the body is not counted. + +As with the special case of &$message_size$&, during the expansion of the +appendfile transport's maildir_tag option in maildir format, the value of +&$message_linecount$& is the precise size of the number of newlines in the +file that has been written (minus one for the blank line between the +header and the body). + +Here is an example of the use of this variable in a DATA ACL: .code deny message = Too many lines in message header condition = \ - ${if <{250}{${eval:$message_linecount - $body_linecount}}} + ${if <{250}{${eval:$message_linecount - $body_linecount}}} .endd In the MAIL and RCPT ACLs, the value is zero because at that stage the message has not yet been received. @@ -10426,7 +11450,7 @@ message has not yet been received. .vitem &$message_size$& .cindex "size" "of message" .cindex "message" "size" -.cindex "&$message_size$&" +.vindex "&$message_size$&" When a message is being processed, this variable contains its size in bytes. In most cases, the size includes those headers that were received with the message, but not those (such as &'Envelope-to:'&) that are added to individual @@ -10437,7 +11461,7 @@ precise size of the file that has been written. See also &$message_body_size$&, &$body_linecount$&, and &$body_zerocount$&. .cindex "RCPT" "value of &$message_size$&" -While running an ACL at the time of an SMTP RCPT command, &$message_size$& +While running a per message ACL (mail/rcpt/predata), &$message_size$& contains the size supplied on the MAIL command, or -1 if no size was given. The value may not, of course, be truthful. @@ -10451,23 +11475,23 @@ These variables are counters that can be incremented by means of the &%add%& command in filter files. .vitem &$original_domain$& -.cindex "&$domain$&" -.cindex "&$original_domain$&" +.vindex "&$domain$&" +.vindex "&$original_domain$&" When a top-level address is being processed for delivery, this contains the same value as &$domain$&. However, if a &"child"& address (for example, generated by an alias, forward, or filter file) is being processed, this -variable contains the domain of the original address. This differs from -&$parent_domain$& only when there is more than one level of aliasing or -forwarding. When more than one address is being delivered in a single transport -run, &$original_domain$& is not set. +variable contains the domain of the original address (lower cased). This +differs from &$parent_domain$& only when there is more than one level of +aliasing or forwarding. When more than one address is being delivered in a +single transport run, &$original_domain$& is not set. If a new address is created by means of a &%deliver%& command in a system filter, it is set up with an artificial &"parent"& address. This has the local part &'system-filter'& and the default qualify domain. .vitem &$original_local_part$& -.cindex "&$local_part$&" -.cindex "&$original_local_part$&" +.vindex "&$local_part$&" +.vindex "&$original_local_part$&" When a top-level address is being processed for delivery, this contains the same value as &$local_part$&, unless a prefix or suffix was removed from the local part, because &$original_local_part$& always contains the full local @@ -10488,8 +11512,8 @@ part &'system-filter'& and the default qualify domain. .vitem &$originator_gid$& .cindex "gid (group id)" "of originating user" .cindex "sender" "gid" -.cindex "&$caller_gid$&" -.cindex "&$originator_gid$&" +.vindex "&$caller_gid$&" +.vindex "&$originator_gid$&" This variable contains the value of &$caller_gid$& that was set when the message was received. For messages received via the command line, this is the gid of the sending user. For messages received by SMTP over TCP/IP, this is @@ -10498,32 +11522,32 @@ normally the gid of the Exim user. .vitem &$originator_uid$& .cindex "uid (user id)" "of originating user" .cindex "sender" "uid" -.cindex "&$caller_uid$&" -.cindex "&$originaltor_uid$&" +.vindex "&$caller_uid$&" +.vindex "&$originaltor_uid$&" The value of &$caller_uid$& that was set when the message was received. For messages received via the command line, this is the uid of the sending user. For messages received by SMTP over TCP/IP, this is normally the uid of the Exim user. .vitem &$parent_domain$& -.cindex "&$parent_domain$&" +.vindex "&$parent_domain$&" This variable is similar to &$original_domain$& (see above), except that it refers to the immediately preceding parent address. .vitem &$parent_local_part$& -.cindex "&$parent_local_part$&" +.vindex "&$parent_local_part$&" This variable is similar to &$original_local_part$& (see above), except that it refers to the immediately preceding parent address. .vitem &$pid$& .cindex "pid (process id)" "of current process" -.cindex "&$pid$&" +.vindex "&$pid$&" This variable contains the current process id. .vitem &$pipe_addresses$& .cindex "filter" "transport filter" .cindex "transport" "filter" -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" This is not an expansion variable, but is mentioned here because the string &`$pipe_addresses`& is handled specially in the command specification for the &(pipe)& transport (chapter &<>&) and in transport filters @@ -10532,7 +11556,7 @@ It cannot be used in general expansion strings, and provokes an &"unknown variable"& error if encountered. .vitem &$primary_hostname$& -.cindex "&$primary_hostname$&" +.vindex "&$primary_hostname$&" This variable contains the value set by &%primary_hostname%& in the configuration file, or read by the &[uname()]& function. If &[uname()]& returns a single-component name, Exim calls &[gethostbyname()]& (or @@ -10556,48 +11580,73 @@ which is described in sections &<>& and &<>&. .vitem &$qualify_domain$& -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" The value set for the &%qualify_domain%& option in the configuration file. .vitem &$qualify_recipient$& -.cindex "&$qualify_recipient$&" +.vindex "&$qualify_recipient$&" The value set for the &%qualify_recipient%& option in the configuration file, or if not set, the value of &$qualify_domain$&. .vitem &$rcpt_count$& -.cindex "&$rcpt_count$&" +.vindex "&$rcpt_count$&" When a message is being received by SMTP, this variable contains the number of RCPT commands received for the current message. If this variable is used in a RCPT ACL, its value includes the current command. .vitem &$rcpt_defer_count$& -.cindex "&$rcpt_defer_count$&" +.vindex "&$rcpt_defer_count$&" +.cindex "4&'xx'& responses" "count of" When a message is being received by SMTP, this variable contains the number of RCPT commands in the current message that have previously been rejected with a temporary (4&'xx'&) response. .vitem &$rcpt_fail_count$& -.cindex "&$rcpt_fail_count$&" +.vindex "&$rcpt_fail_count$&" When a message is being received by SMTP, this variable contains the number of RCPT commands in the current message that have previously been rejected with a permanent (5&'xx'&) response. .vitem &$received_count$& -.cindex "&$received_count$&" +.vindex "&$received_count$&" This variable contains the number of &'Received:'& header lines in the message, including the one added by Exim (so its value is always greater than zero). It is available in the DATA ACL, the non-SMTP ACL, and while routing and delivering. .vitem &$received_for$& -.cindex "&$received_for$&" +.vindex "&$received_for$&" If there is only a single recipient address in an incoming message, this variable contains that address when the &'Received:'& header line is being built. The value is copied after recipient rewriting has happened, but before the &[local_scan()]& function is run. +.vitem &$received_ip_address$& +.vindex "&$received_ip_address$&" +As soon as an Exim server starts processing an incoming TCP/IP connection, this +variable is set to the address of the local IP interface, and &$received_port$& +is set to the local port number. (The remote IP address and port are in +&$sender_host_address$& and &$sender_host_port$&.) When testing with &%-bh%&, +the port value is -1 unless it has been set using the &%-oMi%& command line +option. + +As well as being useful in ACLs (including the &"connect"& ACL), these variable +could be used, for example, to make the file name for a TLS certificate depend +on which interface and/or port is being used for the incoming connection. The +values of &$received_ip_address$& and &$received_port$& are saved with any +messages that are received, thus making these variables available at delivery +time. + +&*Note:*& There are no equivalent variables for outgoing connections, because +the values are unknown (unless they are explicitly set by options of the +&(smtp)& transport). + +.vitem &$received_port$& +.vindex "&$received_port$&" +See &$received_ip_address$&. + .vitem &$received_protocol$& -.cindex "&$received_protocol$&" +.vindex "&$received_protocol$&" When a message is being processed, this variable contains the name of the protocol by which it was received. Most of the names used by Exim are defined by RFCs 821, 2821, and 3848. They start with &"smtp"& (the client used HELO) or @@ -10618,12 +11667,12 @@ messages that are injected locally by trusted callers. This is commonly used to identify messages that are being re-injected after some kind of scanning. .vitem &$received_time$& -.cindex "&$received_time$&" +.vindex "&$received_time$&" This variable contains the date and time when the current message was received, as a number of seconds since the start of the Unix epoch. .vitem &$recipient_data$& -.cindex "&$recipient_data$&" +.vindex "&$recipient_data$&" This variable is set after an indexing lookup success in an ACL &%recipients%& condition. It contains the data from the lookup, and the value remains set until the next &%recipients%& test. Thus, you can do things like this: @@ -10637,7 +11686,7 @@ The variable is not set for a lookup that is used as part of the string expansion that all such lists undergo before being interpreted. .vitem &$recipient_verify_failure$& -.cindex "&$recipient_verify_failure$&" +.vindex "&$recipient_verify_failure$&" In an ACL, when a recipient verification fails, this variable contains information about the failure. It is set to one of the following words: @@ -10664,30 +11713,41 @@ The main use of this variable is expected to be to distinguish between rejections of MAIL and rejections of RCPT. .vitem &$recipients$& -.cindex "&$recipients$&" -This variable contains a list of envelope recipients for a -message. A comma and a space separate the addresses in the replacement text. -However, the variable is not generally available, to prevent exposure of Bcc -recipients in unprivileged users' filter files. You can use &$recipients$& only -in these two cases: +.vindex "&$recipients$&" +This variable contains a list of envelope recipients for a message. A comma and +a space separate the addresses in the replacement text. However, the variable +is not generally available, to prevent exposure of Bcc recipients in +unprivileged users' filter files. You can use &$recipients$& only in these +cases: .olist In a system filter file. .next -In the ACLs associated with the DATA command, that is, the ACLs defined by -&%acl_smtp_predata%& and &%acl_smtp_data%&. +In the ACLs associated with the DATA command and with non-SMTP messages, that +is, the ACLs defined by &%acl_smtp_predata%&, &%acl_smtp_data%&, +&%acl_smtp_mime%&, &%acl_not_smtp_start%&, &%acl_not_smtp%&, and +&%acl_not_smtp_mime%&. +.next +From within a &[local_scan()]& function. .endlist .vitem &$recipients_count$& -.cindex "&$recipients_count$&" +.vindex "&$recipients_count$&" When a message is being processed, this variable contains the number of envelope recipients that came with the message. Duplicates are not excluded from the count. While a message is being received over SMTP, the number increases for each accepted recipient. It can be referenced in an ACL. + +.vitem &$regex_match_string$& +.vindex "&$regex_match_string$&" +This variable is set to contain the matching regular expression after a +&%regex%& ACL condition has matched (see section &<>&). + + .vitem &$reply_address$& -.cindex "&$reply_address$&" +.vindex "&$reply_address$&" When a message is being processed, this variable contains the contents of the &'Reply-To:'& header line if one exists and it is not empty, or otherwise the contents of the &'From:'& header line. Apart from the removal of leading @@ -10695,7 +11755,7 @@ white space, the value is not processed in any way. In particular, no RFC 2047 decoding or character code translation takes place. .vitem &$return_path$& -.cindex "&$return_path$&" +.vindex "&$return_path$&" When a message is being delivered, this variable contains the return path &-- the sender field that will be sent as part of the envelope. It is not enclosed in <> characters. At the start of routing an address, &$return_path$& has the @@ -10708,12 +11768,18 @@ the incoming envelope sender, and &$return_path$& contains the outgoing envelope sender. .vitem &$return_size_limit$& -.cindex "&$return_size_limit$&" +.vindex "&$return_size_limit$&" This is an obsolete name for &$bounce_return_size_limit$&. +.vitem &$router_name$& +.cindex "router" "name" +.cindex "name" "of router" +.vindex "&$router_name$&" +During the running of a router this variable contains its name. + .vitem &$runrc$& .cindex "return code" "from &%run%& expansion" -.cindex "&$runrc$&" +.vindex "&$runrc$&" This variable contains the return code from a command that is run by the &%${run...}%& expansion item. &*Warning*&: In a router or transport, you cannot assume the order in which option values are expanded, except for those @@ -10722,8 +11788,8 @@ reliably expect to set &$runrc$& by the expansion of one option, and use it in another. .vitem &$self_hostname$& -.cindex "&%self%& option" "value of host name" -.cindex "&$self_hostname$&" +.oindex "&%self%&" "value of host name" +.vindex "&$self_hostname$&" When an address is routed to a supposedly remote host that turns out to be the local host, what happens is controlled by the &%self%& generic router option. One of its values causes the address to be passed to another router. When this @@ -10731,14 +11797,15 @@ happens, &$self_hostname$& is set to the name of the local host that the original router encountered. In other circumstances its contents are null. .vitem &$sender_address$& -.cindex "&$sender_address$&" +.vindex "&$sender_address$&" When a message is being processed, this variable contains the sender's address -that was received in the message's envelope. For bounce messages, the value of -this variable is the empty string. See also &$return_path$&. +that was received in the message's envelope. The case of letters in the address +is retained, in both the local part and the domain. For bounce messages, the +value of this variable is the empty string. See also &$return_path$&. .vitem &$sender_address_data$& -.cindex "&$address_data$&" -.cindex "&$sender_address_data$&" +.vindex "&$address_data$&" +.vindex "&$sender_address_data$&" If &$address_data$& is set when the routers are called from an ACL to verify a sender address, the final value is preserved in &$sender_address_data$&, to distinguish it from data from a recipient address. The value does not persist @@ -10746,15 +11813,15 @@ after the end of the current ACL statement. If you want to preserve it for longer, you can save it in an ACL variable. .vitem &$sender_address_domain$& -.cindex "&$sender_address_domain$&" +.vindex "&$sender_address_domain$&" The domain portion of &$sender_address$&. .vitem &$sender_address_local_part$& -.cindex "&$sender_address_local_part$&" +.vindex "&$sender_address_local_part$&" The local part portion of &$sender_address$&. .vitem &$sender_data$& -.cindex "&$sender_data$&" +.vindex "&$sender_data$&" This variable is set after a lookup success in an ACL &%senders%& condition or in a router &%senders%& option. It contains the data from the lookup, and the value remains set until the next &%senders%& test. Thus, you can do things like @@ -10769,7 +11836,7 @@ The variable is not set for a lookup that is used as part of the string expansion that all such lists undergo before being interpreted. .vitem &$sender_fullhost$& -.cindex "&$sender_fullhost$&" +.vindex "&$sender_fullhost$&" When a message is received from a remote host, this variable contains the host name and IP address in a single string. It ends with the IP address in square brackets, followed by a colon and a port number if the logging of ports is @@ -10783,31 +11850,56 @@ the argument of a HELO or EHLO command. This is omitted if it is identical to the verified host name or to the host's IP address in square brackets. .vitem &$sender_helo_name$& -.cindex "&$sender_hslo_name$&" +.vindex "&$sender_helo_name$&" When a message is received from a remote host that has issued a HELO or EHLO command, the argument of that command is placed in this variable. It is also set if HELO or EHLO is used when a message is received using SMTP locally via the &%-bs%& or &%-bS%& options. .vitem &$sender_host_address$& -.cindex "&$sender_host_address$&" +.vindex "&$sender_host_address$&" When a message is received from a remote host, this variable contains that host's IP address. For locally submitted messages, it is empty. .vitem &$sender_host_authenticated$& -.cindex "&$sender_host_authenticated$&" +.vindex "&$sender_host_authenticated$&" This variable contains the name (not the public name) of the authenticator driver that successfully authenticated the client from which the message was received. It is empty if there was no successful authentication. See also &$authenticated_id$&. +.new +.vitem &$sender_host_dnssec$& +.vindex "&$sender_host_dnssec$&" +If &$sender_host_name$& has been populated (by reference, &%hosts_lookup%& or +otherwise) then this boolean will have been set true if, and only if, the +resolver library states that the reverse DNS was authenticated data. At all +other times, this variable is false. + +It is likely that you will need to coerce DNSSEC support on in the resolver +library, by setting: +.code +dns_use_dnssec = 1 +.endd + +Exim does not perform DNSSEC validation itself, instead leaving that to a +validating resolver (eg, unbound, or bind with suitable configuration). + +Exim does not (currently) check to see if the forward DNS was also secured +with DNSSEC, only the reverse DNS. + +If you have changed &%host_lookup_order%& so that &`bydns`& is not the first +mechanism in the list, then this variable will be false. +.wen + + .vitem &$sender_host_name$& -.cindex "&$sender_host_name$&" +.vindex "&$sender_host_name$&" When a message is received from a remote host, this variable contains the host's name as obtained by looking up its IP address. For messages received by other means, this variable is empty. -.cindex "&$host_lookup_failed$&" +.vindex "&$host_lookup_failed$&" If the host name has not previously been looked up, a reference to &$sender_host_name$& triggers a lookup (for messages from remote hosts). A looked up name is accepted only if it leads back to the original IP address @@ -10815,14 +11907,14 @@ via a forward lookup. If either the reverse or the forward lookup fails to find any data, or if the forward lookup does not yield the original IP address, &$sender_host_name$& remains empty, and &$host_lookup_failed$& is set to &"1"&. -.cindex "&$host_lookup_deferred$&" +.vindex "&$host_lookup_deferred$&" However, if either of the lookups cannot be completed (for example, there is a DNS timeout), &$host_lookup_deferred$& is set to &"1"&, and &$host_lookup_failed$& remains set to &"0"&. Once &$host_lookup_failed$& is set to &"1"&, Exim does not try to look up the host name again if there is a subsequent reference to &$sender_host_name$& -in the same Exim process, but it does try again if &$sender_host_deferred$& +in the same Exim process, but it does try again if &$host_lookup_deferred$& is set to &"1"&. Exim does not automatically look up every calling host's name. If you want @@ -10858,12 +11950,12 @@ IP address in an EHLO or HELO command. .vitem &$sender_host_port$& -.cindex "&$sender_host_port$&" +.vindex "&$sender_host_port$&" When a message is received from a remote host, this variable contains the port number that was used on the remote host. .vitem &$sender_ident$& -.cindex "&$sender_ident$&" +.vindex "&$sender_ident$&" When a message is received from a remote host, this variable contains the identification received in response to an RFC 1413 request. When a message has been received locally, this variable contains the login name of the user that @@ -10877,7 +11969,7 @@ A number of variables whose names begin &$sender_rate_$& are set as part of the .vitem &$sender_rcvhost$& .cindex "DNS" "reverse lookup" .cindex "reverse DNS lookup" -.cindex "&$sender_rcvhost$&" +.vindex "&$sender_rcvhost$&" This is provided specifically for use in &'Received:'& headers. It starts with either the verified host name (as obtained from a reverse DNS lookup) or, if there is no verified host name, the IP address in square brackets. After that @@ -10894,20 +11986,34 @@ all three items are present in the parentheses, a newline and tab are inserted into the string, to improve the formatting of the &'Received:'& header. .vitem &$sender_verify_failure$& -.cindex "&$sender_verify_failure$&" +.vindex "&$sender_verify_failure$&" In an ACL, when a sender verification fails, this variable contains information about the failure. The details are the same as for &$recipient_verify_failure$&. +.vitem &$sending_ip_address$& +.vindex "&$sending_ip_address$&" +This variable is set whenever an outgoing SMTP connection to another host has +been set up. It contains the IP address of the local interface that is being +used. This is useful if a host that has more than one IP address wants to take +on different personalities depending on which one is being used. For incoming +connections, see &$received_ip_address$&. + +.vitem &$sending_port$& +.vindex "&$sending_port$&" +This variable is set whenever an outgoing SMTP connection to another host has +been set up. It contains the local port that is being used. For incoming +connections, see &$received_port$&. + .vitem &$smtp_active_hostname$& -.cindex "&$smtp_active_hostname$&" -During an SMTP session, this variable contains the value of the active host -name, as specified by the &%smtp_active_hostname%& option. The value of +.vindex "&$smtp_active_hostname$&" +During an incoming SMTP session, this variable contains the value of the active +host name, as specified by the &%smtp_active_hostname%& option. The value of &$smtp_active_hostname$& is saved with any message that is received, so its value can be consulted during routing and delivery. .vitem &$smtp_command$& -.cindex "&$smtp_command$&" +.vindex "&$smtp_command$&" During the processing of an incoming SMTP command, this variable contains the entire command. This makes it possible to distinguish between HELO and EHLO in the HELO ACL, and also to distinguish between commands such as these: @@ -10921,13 +12027,25 @@ rewriting, whereas the values in &$local_part$& and &$domain$& are taken from the address after SMTP-time rewriting. .vitem &$smtp_command_argument$& -.cindex "SMTP command" "argument for" -.cindex "&$smtp_command_argument$&" +.cindex "SMTP" "command, argument for" +.vindex "&$smtp_command_argument$&" While an ACL is running to check an SMTP command, this variable contains the argument, that is, the text that follows the command name, with leading white space removed. Following the introduction of &$smtp_command$&, this variable is somewhat redundant, but is retained for backwards compatibility. +.vitem &$smtp_count_at_connection_start$& +.vindex "&$smtp_count_at_connection_start$&" +This variable is set greater than zero only in processes spawned by the Exim +daemon for handling incoming SMTP connections. The name is deliberately long, +in order to emphasize what the contents are. When the daemon accepts a new +connection, it increments this variable. A copy of the variable is passed to +the child process that handles the connection, but its value is fixed, and +never changes. It is only an approximation of how many incoming connections +there actually are, because many other connections may come and go while a +single connection is being processed. When a child process terminates, the +daemon decrements its copy of the variable. + .vitem "&$sn0$& &-- &$sn9$&" These variables are copies of the values of the &$n0$& &-- &$n9$& accumulators that were current at the end of the system filter file. This allows a system @@ -10942,18 +12060,18 @@ is compiled with the content-scanning extension. For details, see section .vitem &$spool_directory$& -.cindex "&$spool_directory$&" +.vindex "&$spool_directory$&" The name of Exim's spool directory. .vitem &$spool_inodes$& -.cindex "&$spool_inodes$&" +.vindex "&$spool_inodes$&" The number of free inodes in the disk partition where Exim's spool files are being written. The value is recalculated whenever the variable is referenced. If the relevant file system does not have the concept of inodes, the value of is -1. See also the &%check_spool_inodes%& option. .vitem &$spool_space$& -.cindex "&$spool_space$&" +.vindex "&$spool_space$&" The amount of free space (as a number of kilobytes) in the disk partition where Exim's spool files are being written. The value is recalculated whenever the variable is referenced. If the operating system does not have the ability to @@ -10967,85 +12085,175 @@ See also the &%check_spool_space%& option. .vitem &$thisaddress$& -.cindex "&$thisaddress$&" +.vindex "&$thisaddress$&" This variable is set only during the processing of the &%foranyaddress%& command in a filter file. Its use is explained in the description of that command, which can be found in the separate document entitled &'Exim's interfaces to mail filtering'&. -.vitem &$tls_certificate_verified$& -.cindex "&$tls_certificate_verified$&" +.vitem &$tls_in_bits$& +.vindex "&$tls_in_bits$&" +Contains an approximation of the TLS cipher's bit-strength +on the inbound connection; the meaning of +this depends upon the TLS implementation used. +If TLS has not been negotiated, the value will be 0. +The value of this is automatically fed into the Cyrus SASL authenticator +when acting as a server, to specify the "external SSF" (a SASL term). + +The deprecated &$tls_bits$& variable refers to the inbound side +except when used in the context of an outbound SMTP delivery, when it refers to +the outbound. + +.vitem &$tls_out_bits$& +.vindex "&$tls_out_bits$&" +Contains an approximation of the TLS cipher's bit-strength +on an outbound SMTP connection; the meaning of +this depends upon the TLS implementation used. +If TLS has not been negotiated, the value will be 0. + +.vitem &$tls_in_certificate_verified$& +.vindex "&$tls_in_certificate_verified$&" This variable is set to &"1"& if a TLS certificate was verified when the message was received, and &"0"& otherwise. -.vitem &$tls_cipher$& -.cindex "&$tls_cipher$&" +The deprecated &$tls_certificate_verfied$& variable refers to the inbound side +except when used in the context of an outbound SMTP delivery, when it refers to +the outbound. + +.vitem &$tls_out_certificate_verified$& +.vindex "&$tls_out_certificate_verified$&" +This variable is set to &"1"& if a TLS certificate was verified when an +outbound SMTP connection was made, +and &"0"& otherwise. + +.vitem &$tls_in_cipher$& +.vindex "&$tls_in_cipher$&" +.vindex "&$tls_cipher$&" When a message is received from a remote host over an encrypted SMTP connection, this variable is set to the cipher suite that was negotiated, for example DES-CBC3-SHA. In other circumstances, in particular, for message -received over unencrypted connections, the variable is empty. See chapter -&<>& for details of TLS support. - -.vitem &$tls_peerdn$& -.cindex "&$tls_peerdn$&" +received over unencrypted connections, the variable is empty. Testing +&$tls_cipher$& for emptiness is one way of distinguishing between encrypted and +non-encrypted connections during ACL processing. + +The deprecated &$tls_cipher$& variable is the same as &$tls_in_cipher$& during message reception, +but in the context of an outward SMTP delivery taking place via the &(smtp)& transport +becomes the same as &$tls_out_cipher$&. + +.vitem &$tls_out_cipher$& +.vindex "&$tls_out_cipher$&" +This variable is +cleared before any outgoing SMTP connection is made, +and then set to the outgoing cipher suite if one is negotiated. See chapter +&<>& for details of TLS support and chapter &<>& for +details of the &(smtp)& transport. + +.vitem &$tls_in_peerdn$& +.vindex "&$tls_in_peerdn$&" +.vindex "&$tls_peerdn$&" When a message is received from a remote host over an encrypted SMTP connection, and Exim is configured to request a certificate from the client, the value of the Distinguished Name of the certificate is made available in the -&$tls_peerdn$& during subsequent processing. +&$tls_in_peerdn$& during subsequent processing. + +The deprecated &$tls_peerdn$& variable refers to the inbound side +except when used in the context of an outbound SMTP delivery, when it refers to +the outbound. + +.vitem &$tls_out_peerdn$& +.vindex "&$tls_out_peerdn$&" +When a message is being delivered to a remote host over an encrypted SMTP +connection, and Exim is configured to request a certificate from the server, +the value of the Distinguished Name of the certificate is made available in the +&$tls_out_peerdn$& during subsequent processing. + +.vitem &$tls_in_sni$& +.vindex "&$tls_in_sni$&" +.vindex "&$tls_sni$&" +.cindex "TLS" "Server Name Indication" +When a TLS session is being established, if the client sends the Server +Name Indication extension, the value will be placed in this variable. +If the variable appears in &%tls_certificate%& then this option and +some others, described in &<>&, +will be re-expanded early in the TLS session, to permit +a different certificate to be presented (and optionally a different key to be +used) to the client, based upon the value of the SNI extension. + +The deprecated &$tls_sni$& variable refers to the inbound side +except when used in the context of an outbound SMTP delivery, when it refers to +the outbound. + +.vitem &$tls_out_sni$& +.vindex "&$tls_out_sni$&" +.cindex "TLS" "Server Name Indication" +During outbound +SMTP deliveries, this variable reflects the value of the &%tls_sni%& option on +the transport. .vitem &$tod_bsdinbox$& -.cindex "&$tod_bsdinbox$&" +.vindex "&$tod_bsdinbox$&" The time of day and the date, in the format required for BSD-style mailbox files, for example: Thu Oct 17 17:14:09 1995. .vitem &$tod_epoch$& -.cindex "&$tod_epoch$&" +.vindex "&$tod_epoch$&" The time and date as a number of seconds since the start of the Unix epoch. +.vitem &$tod_epoch_l$& +.vindex "&$tod_epoch_l$&" +The time and date as a number of microseconds since the start of the Unix epoch. + .vitem &$tod_full$& -.cindex "&$tod_full$&" +.vindex "&$tod_full$&" A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40 +0100. The timezone is always given as a numerical offset from UTC, with positive values used for timezones that are ahead (east) of UTC, and negative values for those that are behind (west). .vitem &$tod_log$& -.cindex "&$tod_log$&" +.vindex "&$tod_log$&" The time and date in the format used for writing Exim's log files, for example: 1995-10-12 15:32:29, but without a timezone. .vitem &$tod_logfile$& -.cindex "&$tod_logfile$&" +.vindex "&$tod_logfile$&" This variable contains the date in the format yyyymmdd. This is the format that is used for datestamping log files when &%log_file_path%& contains the &`%D`& flag. .vitem &$tod_zone$& -.cindex "&$tod_zone$&" +.vindex "&$tod_zone$&" This variable contains the numerical value of the local timezone, for example: -0500. .vitem &$tod_zulu$& -.cindex "&$tod_zulu$&" +.vindex "&$tod_zulu$&" This variable contains the UTC date and time in &"Zulu"& format, as specified by ISO 8601, for example: 20030221154023Z. +.vitem &$transport_name$& +.cindex "transport" "name" +.cindex "name" "of transport" +.vindex "&$transport_name$&" +During the running of a transport, this variable contains its name. + .vitem &$value$& -.cindex "&$value$&" +.vindex "&$value$&" This variable contains the result of an expansion lookup, extraction operation, -or external command, as described above. +or external command, as described above. It is also used during a +&*reduce*& expansion. .vitem &$version_number$& -.cindex "&$version_number$&" +.vindex "&$version_number$&" The version number of Exim. .vitem &$warn_message_delay$& -.cindex "&$warn_message_delay$&" +.vindex "&$warn_message_delay$&" This variable is set only during the creation of a message warning about a delivery delay. Details of its use are explained in section &<>&. .vitem &$warn_message_recipients$& -.cindex "&$warn_message_recipients$&" +.vindex "&$warn_message_recipients$&" This variable is set only during the creation of a message warning about a delivery delay. Details of its use are explained in section &<>&. .endlist @@ -11069,8 +12277,8 @@ EXIM_PERL = perl.o in your &_Local/Makefile_& and then build Exim in the normal way. -.section "Setting up so Perl can be used" -.cindex "&%perl_startup%&" +.section "Setting up so Perl can be used" "SECID85" +.oindex "&%perl_startup%&" Access to Perl subroutines is via a global configuration option called &%perl_startup%& and an expansion string operator &%${perl ...}%&. If there is no &%perl_startup%& option in the Exim configuration file then no Perl @@ -11096,7 +12304,7 @@ the interpreter is started only when it is needed, but this can be changed in two ways: .ilist -.cindex "&%perl_at_start%&" +.oindex "&%perl_at_start%&" Setting &%perl_at_start%& (a boolean option) in the configuration requests a startup when Exim is entered. .next @@ -11108,7 +12316,7 @@ There is also a command line option &%-pd%& (for delay) which suppresses the initial startup, even if &%perl_at_start%& is set. -.section "Calling Perl subroutines" +.section "Calling Perl subroutines" "SECID86" When the configuration file includes a &%perl_startup%& option you can make use of the string expansion item to call the Perl subroutines that are defined by the &%perl_startup%& code. The operator is used in any of the following @@ -11132,7 +12340,7 @@ by obeying Perl's &%die%& function, the expansion fails with the error message that was passed to &%die%&. -.section "Calling Exim functions from Perl" +.section "Calling Exim functions from Perl" "SECID87" Within any Perl code called from Exim, the function &'Exim::expand_string()'& is available to call back into Exim's string expansion function. For example, the Perl code @@ -11157,7 +12365,7 @@ debugging is enabled. If you want a newline at the end, you must supply it. timestamp. In this case, you should not supply a terminating newline. -.section "Use of standard output and error by Perl" +.section "Use of standard output and error by Perl" "SECID88" .cindex "Perl" "standard output and error" You should not write to the standard error or output streams from within your Perl code, as it is not defined how these are set up. In versions of Exim @@ -11236,11 +12444,11 @@ options that can be used to influence Exim's behaviour. The rest of this chapter describes how they operate. When a message is received over TCP/IP, the interface and port that were -actually used are set in &$interface_address$& and &$interface_port$&. +actually used are set in &$received_ip_address$& and &$received_port$&. -.section "Starting a listening daemon" +.section "Starting a listening daemon" "SECID89" When a listening daemon is started (by means of the &%-bd%& command line option), the interfaces and ports on which it listens are controlled by the following options: @@ -11295,7 +12503,7 @@ IP addresses in &%local_interfaces%&, only numbers (not names) can be used. -.section "Special IP listening addresses" +.section "Special IP listening addresses" "SECID90" The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted as &"all IPv4 interfaces"& and &"all IPv6 interfaces"&, respectively. In each case, Exim tells the TCP/IP stack to &"listen on all IPv&'x'& interfaces"& @@ -11312,7 +12520,7 @@ Thus, by default, Exim listens on all available interfaces, on the SMTP port. -.section "Overriding local_interfaces and daemon_smtp_ports" +.section "Overriding local_interfaces and daemon_smtp_ports" "SECID91" The &%-oX%& command line option can be used to override the values of &%daemon_smtp_ports%& and/or &%local_interfaces%& for a particular daemon instance. Another way of doing this would be to use macros and the &%-D%& @@ -11366,7 +12574,7 @@ connections via the daemon.) -.section "IPv6 address scopes" +.section "IPv6 address scopes" "SECID92" .cindex "IPv6" "address scopes" IPv6 addresses have &"scopes"&, and a host with multiple hardware interfaces can, in principle, have the same link-local IPv6 address on different @@ -11392,7 +12600,7 @@ instead of &[getaddrinfo()]&. (Before version 4.14, it always used this function.) Of course, this means that the additional functionality of &[getaddrinfo()]& &-- recognizing scoped addresses &-- is lost. -.section "Disabling IPv6" +.section "Disabling IPv6" "SECID93" .cindex "IPv6" "disabling" Sometimes it happens that an Exim binary that was compiled with IPv6 support is run on a host whose kernel does not support IPv6. The binary will fall back to @@ -11413,7 +12621,7 @@ IPv6 addresses in an individual router. -.section "Examples of starting a listening daemon" +.section "Examples of starting a listening daemon" "SECID94" The default case in an IPv6 environment is .code daemon_smtp_ports = smtp @@ -11440,13 +12648,13 @@ local_interfaces = 0.0.0.0 : 127.0.0.1.26 .endd To specify listening on the default port on specific interfaces only: .code -local_interfaces = 192.168.34.67 : 192.168.34.67 +local_interfaces = 10.0.0.67 : 192.168.34.67 .endd &*Warning*&: Such a setting excludes listening on the loopback interfaces. -.section "Recognising the local host" "SECTreclocipadd" +.section "Recognizing the local host" "SECTreclocipadd" The &%local_interfaces%& option is also used when Exim needs to determine whether or not an IP address refers to the local host. That is, the IP addresses of all the interfaces on which a daemon is listening are always @@ -11486,7 +12694,7 @@ addresses match &%local_interfaces%& or &%extra_local_interfaces%&. -.section "Delivering to a remote host" +.section "Delivering to a remote host" "SECID95" Delivery to a remote host is handled by the smtp transport. By default, it allows the system's TCP/IP functions to choose which interface to use (if there is more than one) when connecting to a remote host. However, the @@ -11527,12 +12735,13 @@ are now so many options, they are first listed briefly in functional groups, as an aid to finding the name of the option you are looking for. Some options are listed in more than one group. -.section "Miscellaneous" +.section "Miscellaneous" "SECID96" .table2 .row &%bi_command%& "to run for &%-bi%& command line option" .row &%disable_ipv6%& "do no IPv6 processing" .row &%keep_malformed%& "for broken files &-- should not happen" .row &%localhost_number%& "for unique message ids in clusters" +.row &%message_body_newlines%& "retain newlines in &$message_body$&" .row &%message_body_visible%& "how much to show in &$message_body$&" .row &%mua_wrapper%& "run in &""MUA wrapper""& mode" .row &%print_topbitchars%& "top-bit characters are printing" @@ -11540,7 +12749,7 @@ listed in more than one group. .endtable -.section "Exim parameters" +.section "Exim parameters" "SECID97" .table2 .row &%exim_group%& "override compiled-in value" .row &%exim_path%& "override compiled-in value" @@ -11552,7 +12761,7 @@ listed in more than one group. -.section "Privilege controls" +.section "Privilege controls" "SECID98" .table2 .row &%admin_groups%& "groups that are Exim admin users" .row &%deliver_drop_privilege%& "drop root for delivery processes" @@ -11569,7 +12778,7 @@ listed in more than one group. -.section "Logging" +.section "Logging" "SECID99" .table2 .row &%hosts_connection_nolog%& "exemption from connect logging" .row &%log_file_path%& "override compiled-in value" @@ -11587,7 +12796,7 @@ listed in more than one group. -.section "Frozen messages" +.section "Frozen messages" "SECID100" .table2 .row &%auto_thaw%& "sets time for retrying frozen messages" .row &%freeze_tell%& "send message when freezing" @@ -11597,20 +12806,28 @@ listed in more than one group. -.section "Data lookups" +.section "Data lookups" "SECID101" .table2 +.row &%ibase_servers%& "InterBase servers" +.row &%ldap_ca_cert_dir%& "dir of CA certs to verify LDAP server's" +.row &%ldap_ca_cert_file%& "file of CA certs to verify LDAP server's" +.row &%ldap_cert_file%& "client cert file for LDAP" +.row &%ldap_cert_key%& "client key file for LDAP" +.row &%ldap_cipher_suite%& "TLS negotiation preference control" .row &%ldap_default_servers%& "used if no server in query" +.row &%ldap_require_cert%& "action to take without LDAP server cert" +.row &%ldap_start_tls%& "require TLS within LDAP" .row &%ldap_version%& "set protocol version" .row &%lookup_open_max%& "lookup files held open" -.row &%mysql_servers%& "as it says" -.row &%oracle_servers%& "as it says" -.row &%pgsql_servers%& "as it says" +.row &%mysql_servers%& "default MySQL servers" +.row &%oracle_servers%& "Oracle servers" +.row &%pgsql_servers%& "default PostgreSQL servers" .row &%sqlite_lock_timeout%& "as it says" .endtable -.section "Message ids" +.section "Message ids" "SECID102" .table2 .row &%message_id_header_domain%& "used to build &'Message-ID:'& header" .row &%message_id_header_text%& "ditto" @@ -11618,7 +12835,7 @@ listed in more than one group. -.section "Embedded Perl Startup" +.section "Embedded Perl Startup" "SECID103" .table2 .row &%perl_at_start%& "always start the interpreter" .row &%perl_startup%& "code to obey when starting Perl" @@ -11626,7 +12843,7 @@ listed in more than one group. -.section "Daemon" +.section "Daemon" "SECID104" .table2 .row &%daemon_smtp_ports%& "default ports" .row &%daemon_startup_retries%& "number of times to retry" @@ -11639,7 +12856,7 @@ listed in more than one group. -.section "Resource control" +.section "Resource control" "SECID105" .table2 .row &%check_log_inodes%& "before accepting a message" .row &%check_log_space%& "before accepting a message" @@ -11647,10 +12864,11 @@ listed in more than one group. .row &%check_spool_space%& "before accepting a message" .row &%deliver_queue_load_max%& "no queue deliveries if load high" .row &%queue_only_load%& "queue incoming if load high" +.row &%queue_only_load_latch%& "don't re-evaluate load for each message" .row &%queue_run_max%& "maximum simultaneous queue runners" .row &%remote_max_parallel%& "parallel SMTP delivery per message" .row &%smtp_accept_max%& "simultaneous incoming connections" -.row &%smtp_accept_max_nommail%& "non-mail commands" +.row &%smtp_accept_max_nonmail%& "non-mail commands" .row &%smtp_accept_max_nonmail_hosts%& "hosts to which the limit applies" .row &%smtp_accept_max_per_connection%& "messages per connection" .row &%smtp_accept_max_per_host%& "connections from one host" @@ -11666,13 +12884,15 @@ listed in more than one group. -.section "Policy controls" +.section "Policy controls" "SECID106" .table2 .row &%acl_not_smtp%& "ACL for non-SMTP messages" .row &%acl_not_smtp_mime%& "ACL for non-SMTP MIME parts" +.row &%acl_not_smtp_start%& "ACL for start of non-SMTP message" .row &%acl_smtp_auth%& "ACL for AUTH" .row &%acl_smtp_connect%& "ACL for connection" .row &%acl_smtp_data%& "ACL for DATA" +.row &%acl_smtp_dkim%& "ACL for DKIM verification" .row &%acl_smtp_etrn%& "ACL for ETRN" .row &%acl_smtp_expn%& "ACL for EXPN" .row &%acl_smtp_helo%& "ACL for EHLO or HELO" @@ -11704,11 +12924,12 @@ listed in more than one group. .row &%message_size_limit%& "for all messages" .row &%percent_hack_domains%& "recognize %-hack for these domains" .row &%spamd_address%& "set interface to SpamAssassin" +.row &%strict_acl_vars%& "object to unset ACL variables" .endtable -.section "Callout cache" +.section "Callout cache" "SECID107" .table2 .row &%callout_domain_negative_expire%& "timeout for negative domain cache &&& item" @@ -11721,16 +12942,20 @@ listed in more than one group. -.section "TLS" +.section "TLS" "SECID108" .table2 +.row &%gnutls_compat_mode%& "use GnuTLS compatibility mode" +.row &%gnutls_enable_pkcs11%& "allow GnuTLS to autoload PKCS11 modules" +.row &%openssl_options%& "adjust OpenSSL compatibility options" .row &%tls_advertise_hosts%& "advertise TLS to these hosts" .row &%tls_certificate%& "location of server certificate" .row &%tls_crl%& "certificate revocation list" +.row &%tls_dh_max_bits%& "clamp D-H bit count suggestion" .row &%tls_dhparam%& "DH parameters for server" .row &%tls_on_connect_ports%& "specify SSMTP (SMTPS) ports" .row &%tls_privatekey%& "location of server private key" .row &%tls_remember_esmtp%& "don't reset after starting TLS" -.row &%tls_require_ciphers%& "specify acceptable cipers" +.row &%tls_require_ciphers%& "specify acceptable ciphers" .row &%tls_try_verify_hosts%& "try to verify client certificate" .row &%tls_verify_certificates%& "expected client certificates" .row &%tls_verify_hosts%& "insist on client certificate verify" @@ -11738,7 +12963,7 @@ listed in more than one group. -.section "Local user handling" +.section "Local user handling" "SECID109" .table2 .row &%finduser_retries%& "useful in NIS environments" .row &%gecos_name%& "used when creating &'Sender:'&" @@ -11752,7 +12977,7 @@ listed in more than one group. -.section "All incoming messages (SMTP and non-SMTP)" +.section "All incoming messages (SMTP and non-SMTP)" "SECID110" .table2 .row &%header_maxsize%& "total size of message header" .row &%header_line_maxsize%& "individual header line limit" @@ -11761,13 +12986,13 @@ listed in more than one group. .row &%received_header_text%& "expanded to make &'Received:'&" .row &%received_headers_max%& "for mail loop detection" .row &%recipients_max%& "limit per message" -.row &%recipients_max_reject%& "permanently reject excess" +.row &%recipients_max_reject%& "permanently reject excess recipients" .endtable -.section "Non-SMTP incoming messages" +.section "Non-SMTP incoming messages" "SECID111" .table2 .row &%receive_timeout%& "for non-SMTP messages" .endtable @@ -11776,7 +13001,7 @@ listed in more than one group. -.section "Incoming SMTP messages" +.section "Incoming SMTP messages" "SECID112" See also the &'Policy controls'& section above. .table2 @@ -11815,7 +13040,7 @@ See also the &'Policy controls'& section above. -.section "SMTP extensions" +.section "SMTP extensions" "SECID113" .table2 .row &%accept_8bitmime%& "advertise 8BITMIME" .row &%auth_advertise_hosts%& "advertise AUTH to these hosts" @@ -11827,7 +13052,7 @@ See also the &'Policy controls'& section above. -.section "Processing messages" +.section "Processing messages" "SECID114" .table2 .row &%allow_domain_literals%& "recognize domain literal syntax" .row &%allow_mx_to_ip%& "allow MX to point to IP address" @@ -11835,7 +13060,7 @@ See also the &'Policy controls'& section above. .row &%check_rfc2047_length%& "check length of RFC 2047 &""encoded &&& words""&" .row &%delivery_date_remove%& "from incoming messages" -.row &%envelope_to_remote%& "from incoming messages" +.row &%envelope_to_remove%& "from incoming messages" .row &%extract_addresses_remove_arguments%& "affects &%-t%& processing" .row &%headers_charset%& "default for translations" .row &%qualify_domain%& "default for senders" @@ -11848,7 +13073,7 @@ See also the &'Policy controls'& section above. -.section "System filter" +.section "System filter" "SECID115" .table2 .row &%system_filter%& "locate system filter" .row &%system_filter_directory_transport%& "transport for delivery to a &&& @@ -11862,7 +13087,7 @@ See also the &'Policy controls'& section above. -.section "Routing and delivery" +.section "Routing and delivery" "SECID116" .table2 .row &%disable_ipv6%& "do no IPv6 processing" .row &%dns_again_means_nonexist%& "for broken domains" @@ -11870,12 +13095,15 @@ See also the &'Policy controls'& section above. .row &%dns_ipv4_lookup%& "only v4 lookup for these domains" .row &%dns_retrans%& "parameter for resolver" .row &%dns_retry%& "parameter for resolver" +.row &%dns_use_dnssec%& "parameter for resolver" +.row &%dns_use_edns0%& "parameter for resolver" .row &%hold_domains%& "hold delivery for these domains" .row &%local_interfaces%& "for routing checks" .row &%queue_domains%& "no immediate delivery for these" .row &%queue_only%& "no immediate delivery at all" .row &%queue_only_file%& "no immediate delivery if file exists" .row &%queue_only_load%& "no immediate delivery if load is high" +.row &%queue_only_load_latch%& "don't re-evaluate load for each message" .row &%queue_only_override%& "allow command line to override" .row &%queue_run_in_order%& "order of arrival" .row &%queue_run_max%& "of simultaneous queue runners" @@ -11888,7 +13116,7 @@ See also the &'Policy controls'& section above. -.section "Bounce and warning messages" +.section "Bounce and warning messages" "SECID117" .table2 .row &%bounce_message_file%& "content of bounce" .row &%bounce_message_text%& "content of bounce" @@ -11896,6 +13124,7 @@ See also the &'Policy controls'& section above. .row &%bounce_return_message%& "include original message in bounce" .row &%bounce_return_size_limit%& "limit on returned message" .row &%bounce_sender_authentication%& "send authenticated sender with bounce" +.row &%dsn_from%& "set &'From:'& contents in bounces" .row &%errors_copy%& "copy bounce messages" .row &%errors_reply_to%& "&'Reply-to:'& in bounces" .row &%delay_warning%& "time schedule" @@ -11911,26 +13140,47 @@ See also the &'Policy controls'& section above. Those options that undergo string expansion before use are marked with †. -.option accept_8bitmime main boolean false +.option accept_8bitmime main boolean true .cindex "8BITMIME" .cindex "8-bit characters" +.cindex "log" "selectors" +.cindex "log" "8BITMIME" This option causes Exim to send 8BITMIME in its response to an SMTP EHLO command, and to accept the BODY= parameter on MAIL commands. However, though Exim is 8-bit clean, it is not a protocol converter, and it takes no steps to do anything special with messages received by this route. -Consequently, this option is turned off by default. + +Historically Exim kept this option off by default, but the maintainers +feel that in today's Internet, this causes more problems than it solves. +It now defaults to true. +A more detailed analysis of the issues is provided by Dan Bernstein: +.display +&url(http://cr.yp.to/smtp/8bitmime.html) +.endd + +To log received 8BITMIME status use +.code +log_selector = +8bitmime +.endd .option acl_not_smtp main string&!! unset .cindex "&ACL;" "for non-SMTP messages" .cindex "non-SMTP messages" "ACLs for" -This option defines the ACL that is run when a non-SMTP message is on the point -of being accepted. See chapter &<>& for further details. +This option defines the ACL that is run when a non-SMTP message has been +read and is on the point of being accepted. See chapter &<>& for +further details. .option acl_not_smtp_mime main string&!! unset This option defines the ACL that is run for individual MIME parts of non-SMTP messages. It operates in exactly the same way as &%acl_smtp_mime%& operates for SMTP messages. +.option acl_not_smtp_start main string&!! unset +.cindex "&ACL;" "at start of non-SMTP message" +.cindex "non-SMTP messages" "ACLs for" +This option defines the ACL that is run before Exim starts reading a +non-SMTP message. See chapter &<>& for further details. + .option acl_smtp_auth main string&!! unset .cindex "&ACL;" "setting up for SMTP commands" .cindex "AUTH" "ACL for" @@ -11946,7 +13196,7 @@ See chapter &<>& for further details. .cindex "DATA" "ACL for" This option defines the ACL that is run after an SMTP DATA command has been processed and the message itself has been received, but before the final -acknowledgement is sent. See chapter &<>& for further details. +acknowledgment is sent. See chapter &<>& for further details. .option acl_smtp_etrn main string&!! unset .cindex "ETRN" "ACL for" @@ -11988,7 +13238,7 @@ received, before the message itself is received. See chapter &<>& for further details. .option acl_smtp_quit main string&!! unset -.cindex "QUIT" "ACL for" +.cindex "QUIT, ACL for" This option defines the ACL that is run when an SMTP QUIT command is received. See chapter &<>& for further details. @@ -11998,7 +13248,7 @@ This option defines the ACL that is run when an SMTP RCPT command is received. See chapter &<>& for further details. .option acl_smtp_starttls main string&!! unset -.cindex "STARTTLS" "ACL for" +.cindex "STARTTLS, ACL for" This option defines the ACL that is run when an SMTP STARTTLS command is received. See chapter &<>& for further details. @@ -12092,10 +13342,10 @@ If you want to advertise the availability of AUTH only when the connection is encrypted using TLS, you can make use of the fact that the value of this option is expanded, with a setting like this: .code -auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}} +auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}} .endd -.cindex "&$tls_cipher$&" -If &$tls_cipher$& is empty, the session is not encrypted, and the result of +.vindex "&$tls_in_cipher$&" +If &$tls_in_cipher$& is empty, the session is not encrypted, and the result of the expansion is empty, thus matching no hosts. Otherwise, the result of the expansion is *, which matches all hosts. @@ -12113,19 +13363,19 @@ saying &"keep on trying, even though there are big problems"&. &%ignore_bounce_errors_after%&. It is retained for compatibility, but it is not thought to be very useful any more, and its use should probably be avoided. + .option av_scanner main string "see below" This option is available if Exim is built with the content-scanning extension. It specifies which anti-virus scanner to use. The default value is: .code sophie:/var/run/sophie .endd -If the value of &%av_scanner%& starts with dollar character, it is expanded +If the value of &%av_scanner%& starts with a dollar character, it is expanded before use. See section &<>& for further details. - .option bi_command main string unset -.cindex "&%-bi%& option" +.oindex "&%-bi%&" This option supplies the name of a command that is run when Exim is called with the &%-bi%& option (see chapter &<>&). The string value is just the command name, it is not a complete command line. If an argument is @@ -12163,7 +13413,7 @@ bounce messages generated by Exim. See also &%bounce_return_size_limit%& and .option bounce_return_size_limit main integer 100K -.cindex "size limit" "of bounce" +.cindex "size" "of bounce, limit" .cindex "bounce message" "size limit" .cindex "limit" "bounce message size" This option sets a limit in bytes on the size of messages that are returned to @@ -12226,7 +13476,7 @@ section &<>& for details of the caching. This option defines the &"random"& local part that can be used as part of callout verification. The default value is .code -$primary_host_name-$tod_epoch-testing +$primary_hostname-$tod_epoch-testing .endd See section &<>& for details of how this value is used. @@ -12240,7 +13490,7 @@ See &%check_spool_space%& below. .oindex "&%check_rfc2047_length%&" .cindex "RFC 2047" "disabling length check" -.option check_rfc2047_length " User: main" boolean true +.option check_rfc2047_length main boolean true RFC 2047 defines a way of encoding non-ASCII characters in headers using a system of &"encoded words"&. The RFC specifies a maximum length for an encoded word; strings to be encoded that exceed this length are supposed to use @@ -12256,18 +13506,18 @@ See &%check_spool_space%& below. .option check_spool_space main integer 0 .cindex "checking disk space" -.cindex "disk space" "checking" +.cindex "disk space, checking" .cindex "spool directory" "checking space" The four &%check_...%& options allow for checking of disk resources before a message is accepted. -.cindex "&$log_inodes$&" -.cindex "&$log_space$&" -.cindex "&$spool_inodes$&" -.cindex "&$spool_space$&" +.vindex "&$log_inodes$&" +.vindex "&$log_space$&" +.vindex "&$spool_inodes$&" +.vindex "&$spool_space$&" When any of these options are set, they apply to all incoming messages. If you want to apply different checks to different kinds of message, you can do so by -testing the the variables &$log_inodes$&, &$log_space$&, &$spool_inodes$&, and +testing the variables &$log_inodes$&, &$log_space$&, &$spool_inodes$&, and &$spool_space$& in an ACL with appropriate additional conditions. @@ -12307,7 +13557,7 @@ listens. See chapter &<>& for details of how it is used. For backward compatibility, &%daemon_smtp_port%& (singular) is a synonym. .option daemon_startup_retries main integer 9 -.cindex "daemon startup" "retrying" +.cindex "daemon startup, retrying" This option, along with &%daemon_startup_sleep%&, controls the retrying done by the daemon at startup when it cannot immediately bind a listening socket (typically because the socket is already in use): &%daemon_startup_retries%& @@ -12319,7 +13569,7 @@ See &%daemon_startup_retries%&. .option delay_warning main "time list" 24h .cindex "warning of delay" -.cindex "delay warning" "specifying" +.cindex "delay warning, specifying" When a message is delayed, Exim sends a warning message to the sender at intervals specified by this option. The data is a colon-separated list of times after which to send warning messages. If the value of the option is an empty @@ -12344,19 +13594,24 @@ delay_warning = 2h:12h:99d .endd .option delay_warning_condition main string&!! "see below" -.cindex "&$domain$&" +.vindex "&$domain$&" The string is expanded at the time a warning message might be sent. If all the deferred addresses have the same domain, it is set in &$domain$& during the expansion. Otherwise &$domain$& is empty. If the result of the expansion is a forced failure, an empty string, or a string matching any of &"0"&, &"no"& or &"false"& (the comparison being done caselessly) then the warning message is -not sent. The default is +not sent. The default is: .code -delay_warning_condition = \ - ${if match{$h_precedence:}{(?i)bulk|list|junk}{no}{yes}} +delay_warning_condition = ${if or {\ + { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\ + { match{$h_precedence:}{(?i)bulk|list|junk} }\ + { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\ + } {no}{yes}} .endd -which suppresses the sending of warnings about messages that have &"bulk"&, -&"list"& or &"junk"& in a &'Precedence:'& header. +This suppresses the sending of warnings for messages that contain &'List-ID:'&, +&'List-Post:'&, or &'List-Subscribe:'& headers, or have &"bulk"&, &"list"& or +&"junk"& in a &'Precedence:'& header, or have &"auto-generated"& or +&"auto-replied"& in an &'Auto-Submitted:'& header. .option deliver_drop_privilege main boolean false .cindex "unprivileged delivery" @@ -12385,6 +13640,20 @@ should not be present in incoming messages, and this option causes them to be removed at the time the message is received, to avoid any problems that might occur when a delivered message is subsequently sent on to some other recipient. +.option disable_fsync main boolean false +.cindex "&[fsync()]&, disabling" +This option is available only if Exim was built with the compile-time option +ENABLE_DISABLE_FSYNC. When this is not set, a reference to &%disable_fsync%& in +a runtime configuration generates an &"unknown option"& error. You should not +build Exim with ENABLE_DISABLE_FSYNC or set &%disable_fsync%& unless you +really, really, really understand what you are doing. &'No pre-compiled +distributions of Exim should ever make this option available.'& + +When &%disable_fsync%& is set true, Exim no longer calls &[fsync()]& to force +updated files' data to be written to disc before continuing. Unexpected events +such as crashes and power outages may cause data to be lost or scrambled. +Here be Dragons. &*Beware.*& + .option disable_ipv6 main boolean false .cindex "IPv6" "disabling" @@ -12429,7 +13698,7 @@ dns_check_names_pattern = \ (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$ .endd which permits only letters, digits, slashes, and hyphens in components, but -they must start and end with a letter or digit. Hyphens are not, in fact, +they must start and end with a letter or digit. Slashes are not, in fact, permitted in host names, but they are found in certain NS records (which can be accessed in Exim by using a &%dnsdb%& lookup). If you set &%allow_utf8_domains%&, you must modify this pattern, or set the option to an @@ -12474,11 +13743,45 @@ to set in them. See &%dns_retrans%& above. +.new +.option dns_use_dnssec main integer -1 +.cindex "DNS" "resolver options" +.cindex "DNS" "DNSSEC" +If this option is set to a non-negative number then Exim will initialise the +DNS resolver library to either use or not use DNSSEC, overriding the system +default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on. + +If the resolver library does not support DNSSEC then this option has no effect. +.wen + + +.option dns_use_edns0 main integer -1 +.cindex "DNS" "resolver options" +.cindex "DNS" "EDNS0" +If this option is set to a non-negative number then Exim will initialise the +DNS resolver library to either use or not use EDNS0 extensions, overriding +the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0 +on. + +If the resolver library does not support EDNS0 then this option has no effect. + + .option drop_cr main boolean false This is an obsolete option that is now a no-op. It used to affect the way Exim handled CR and LF characters in incoming messages. What happens now is described in section &<>&. +.option dsn_from main "string&!!" "see below" +.cindex "&'From:'& header line" "in bounces" +.cindex "bounce messages" "&'From:'& line, specifying" +This option can be used to vary the contents of &'From:'& header lines in +bounces and other automatically generated messages (&"Delivery Status +Notifications"& &-- hence the name of the option). The default setting is: +.code +dsn_from = Mail Delivery System +.endd +The value is expanded every time it is needed. If the expansion fails, a +panic is logged, and the default value is used. .option envelope_to_remove main boolean true .cindex "&'Envelope-to:'& header line" @@ -12511,8 +13814,8 @@ errors_copy = spqr@mydomain postmaster@mydomain.example :\ rqps@mydomain hostmaster@mydomain.example,\ postmaster@mydomain.example .endd -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" The address list is expanded before use. The expansion variables &$local_part$& and &$domain$& are set from the original recipient of the error message, and if there was any wildcard matching in the pattern, the expansion @@ -12557,7 +13860,7 @@ security issues. .option exim_path main string "see below" -.cindex "Exim binary" "path name" +.cindex "Exim binary, path name" This option specifies the path name of the Exim binary, which is used when Exim needs to re-exec itself. The default is set up to point to the file &'exim'& in the directory configured at compile time by the BIN_DIRECTORY setting. It @@ -12589,8 +13892,12 @@ routing, but which are not used for listening by the daemon. See section &<>& for details. -.option "extract_addresses_remove_ &~arguments" main boolean true -.cindex "&%-t%& option" +. Allow this long option name to split; give it unsplit as a fifth argument +. for the automatic .oindex that is generated by .option. + +.option "extract_addresses_remove_ &~&~arguments" main boolean true &&& + extract_addresses_remove_arguments +.oindex "&%-t%&" .cindex "command line" "addresses with &%-t%&" .cindex "Sendmail compatibility" "&%-t%& option" According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses @@ -12605,7 +13912,7 @@ addresses. .option finduser_retries main integer 0 -.cindex "NIS" "looking up users; retrying" +.cindex "NIS, retrying user lookups" On systems running NIS or other schemes in which user and group information is distributed from a remote system, there can be times when &[getpwnam()]& and related functions fail, even when given valid data, because things time out. @@ -12640,7 +13947,7 @@ logging that you require. .option gecos_name main string&!! unset .cindex "HP-UX" -.cindex "&""gecos""& field" "parsing" +.cindex "&""gecos""& field, parsing" Some operating systems, notably HP-UX, use the &"gecos"& field in the system password file to hold other information in addition to users' real names. Exim looks up this field for use when it is creating &'Sender:'& or &'From:'& @@ -12667,6 +13974,24 @@ gecos_name = $1 See &%gecos_name%& above. +.option gnutls_compat_mode main boolean unset +This option controls whether GnuTLS is used in compatibility mode in an Exim +server. This reduces security slightly, but improves interworking with older +implementations of TLS. + + +.new +option gnutls_enable_pkcs11 main boolean unset +This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with +the p11-kit configuration files in &_/etc/pkcs11/modules/_&. + +See +&url(http://www.gnu.org/software/gnutls/manual/gnutls.html#Smart-cards-and-HSMs) +for documentation. +.wen + + + .option headers_charset main string "see below" This option sets a default character set for translating from encoded MIME &"words"& in header lines, when referenced by an &$h_xxx$& expansion item. The @@ -12733,14 +14058,14 @@ do. .option helo_try_verify_hosts main "host list&!!" unset .cindex "HELO verifying" "optional" -.cindex "EHLO verifying" "optional" +.cindex "EHLO" "verifying, optional" By default, Exim just checks the syntax of HELO and EHLO commands (see &%helo_accept_junk_hosts%& and &%helo_allow_chars%&). However, some sites like to do more extensive checking of the data supplied by these commands. The ACL -condition &`verify`& &`=`& &`helo`& is provided to make this possible. +condition &`verify = helo`& is provided to make this possible. Formerly, it was necessary also to set this option (&%helo_try_verify_hosts%&) to force the check to occur. From release 4.53 onwards, this is no longer -necessary. If the check has not been done before &`verify`& &`=`& &`helo`& is +necessary. If the check has not been done before &`verify = helo`& is encountered, it is done at that time. Consequently, this option is obsolete. Its specification is retained here for backwards compatibility. @@ -12762,11 +14087,11 @@ available) yields the calling host address. However, the EHLO or HELO command is not rejected if any of the checks fail. Processing continues, but the result of the check is remembered, and can -be detected later in an ACL by the &`verify`& &`=`& &`helo`& condition. +be detected later in an ACL by the &`verify = helo`& condition. .option helo_verify_hosts main "host list&!!" unset .cindex "HELO verifying" "mandatory" -.cindex "EHLO verifying" "mandatory" +.cindex "EHLO" "verifying, mandatory" Like &%helo_try_verify_hosts%&, this option is obsolete, and retained only for backwards compatibility. For hosts that match this option, Exim checks the host name given in the HELO or EHLO in the same way as for @@ -12798,7 +14123,7 @@ retry times, insert a dummy retry rule with a long retry time. .option host_lookup main "host list&!!" unset -.cindex "host name lookup" "forcing" +.cindex "host name" "lookup, forcing" Exim does not look up the name of a calling host from its IP address unless it is required to compare against some host list, or the host matches &%helo_try_verify_hosts%& or &%helo_verify_hosts%&, or the host matches this @@ -12814,12 +14139,12 @@ After a successful reverse lookup, Exim does a forward lookup on the name it has obtained, to verify that it yields the IP address that it started with. If this check fails, Exim behaves as if the name lookup failed. -.cindex "&$host_lookup_failed$&" -.cindex "&$sender_host_name$&" +.vindex "&$host_lookup_failed$&" +.vindex "&$sender_host_name$&" After any kind of failure, the host name (in &$sender_host_name$&) remains unset, and &$host_lookup_failed$& is set to the string &"1"&. See also -&%dns_again_means_nonexist%&, &%helo_lookup_domains%&, and &`verify`& &`=`& -&`reverse_host_lookup`& in ACLs. +&%dns_again_means_nonexist%&, &%helo_lookup_domains%&, and +&`verify = reverse_host_lookup`& in ACLs. .option host_lookup_order main "string list" &`bydns:byaddr`& @@ -12882,7 +14207,15 @@ section &<>&), and when checking the &%hosts%& option in the &(smtp)& transport for the local host (see the &%allow_localhost%& option in that transport). See also &%local_interfaces%&, &%extra_local_interfaces%&, and chapter &<>&, which contains a discussion about local network -interfaces and recognising the local host. +interfaces and recognizing the local host. + + +.option ibase_servers main "string list" unset +.cindex "InterBase" "server list" +This option provides a list of InterBase servers and associated connection data, +to be used in conjunction with &(ibase)& lookups (see section &<>&). +The option is available only if Exim has been built with InterBase support. + .option ignore_bounce_errors_after main time 10w @@ -12933,6 +14266,46 @@ next attempt to deliver such a message, it gets removed. The incident is logged. +.option ldap_ca_cert_dir main string unset +.cindex "LDAP", "TLS CA certificate directory" +This option indicates which directory contains CA certificates for verifying +a TLS certificate presented by an LDAP server. +While Exim does not provide a default value, your SSL library may. +Analogous to &%tls_verify_certificates%& but as a client-side option for LDAP +and constrained to be a directory. + + +.option ldap_ca_cert_file main string unset +.cindex "LDAP", "TLS CA certificate file" +This option indicates which file contains CA certificates for verifying +a TLS certificate presented by an LDAP server. +While Exim does not provide a default value, your SSL library may. +Analogous to &%tls_verify_certificates%& but as a client-side option for LDAP +and constrained to be a file. + + +.option ldap_cert_file main string unset +.cindex "LDAP" "TLS client certificate file" +This option indicates which file contains an TLS client certificate which +Exim should present to the LDAP server during TLS negotiation. +Should be used together with &%ldap_cert_key%&. + + +.option ldap_cert_key main string unset +.cindex "LDAP" "TLS client key file" +This option indicates which file contains the secret/private key to use +to prove identity to the LDAP server during TLS negotiation. +Should be used together with &%ldap_cert_file%&, which contains the +identity to be proven. + + +.option ldap_cipher_suite main string unset +.cindex "LDAP" "TLS cipher suite" +This controls the TLS cipher-suite negotiation during TLS negotiation with +the LDAP server. See &<>& for more details of the format of +cipher-suite options with OpenSSL (as used by LDAP client libraries). + + .option ldap_default_servers main "string list" unset .cindex "LDAP" "default servers" This option provides a list of LDAP servers which are tried in turn when an @@ -12941,8 +14314,27 @@ details of LDAP queries. This option is available only when Exim has been built with LDAP support. +.option ldap_require_cert main string unset. +.cindex "LDAP" "policy for LDAP server TLS cert presentation" +This should be one of the values "hard", "demand", "allow", "try" or "never". +A value other than one of these is interpreted as "never". +See the entry "TLS_REQCERT" in your system man page for ldap.conf(5). +Although Exim does not set a default, the LDAP library probably defaults +to hard/demand. + + +.option ldap_start_tls main boolean false +.cindex "LDAP" "whether or not to negotiate TLS" +If set, Exim will attempt to negotiate TLS with the LDAP server when +connecting on a regular LDAP port. This is the LDAP equivalent of SMTP's +"STARTTLS". This is distinct from using "ldaps", which is the LDAP form +of SSL-on-connect. +In the event of failure to negotiate TLS, the action taken is controlled +by &%ldap_require_cert%&. + + .option ldap_version main integer unset -.cindex "LDAP protocol version" "forcing" +.cindex "LDAP" "protocol version, forcing" This option can be used to force Exim to set a specific protocol version for LDAP. If it option is unset, it is shown by the &%-bP%& command line option as -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in @@ -13050,7 +14442,7 @@ See also the ACL modifier &`control = suppress_local_fixups`&. Section .option localhost_number main string&!! unset .cindex "host" "locally unique number for" .cindex "message ids" "with multiple hosts" -.cindex "&$localhost_number$&" +.vindex "&$localhost_number$&" Exim's message ids are normally unique only within the local host. If uniqueness among a set of hosts is required, each host must set a different value for the &%localhost_number%& option. The string is expanded immediately @@ -13095,8 +14487,8 @@ logging, in section &<>&. .option log_timezone main boolean false .cindex "log" "timezone for entries" -.cindex "&$tod_log$&" -.cindex "&$tod_zone$&" +.vindex "&$tod_log$&" +.vindex "&$tod_zone$&" By default, the timestamps on log lines are in local time without the timezone. This means that if your timezone changes twice a year, the timestamps in log lines are ambiguous for an hour when the clocks go back. One way of @@ -13110,7 +14502,7 @@ another variable called &$tod_zone$& that contains just the timezone offset. .option lookup_open_max main integer 25 .cindex "too many open files" -.cindex "open files" "too many" +.cindex "open files, too many" .cindex "file" "too many open" .cindex "lookup" "maximum open files" .cindex "limit" "open files for lookups" @@ -13126,7 +14518,7 @@ open files"& errors with NDBM, you need to reduce the value of .option max_username_length main integer 0 -.cindex "length" "of login name" +.cindex "length of login name" .cindex "user name" "maximum length" .cindex "limit" "user name length" Some operating systems are broken in that they truncate long arguments to @@ -13135,12 +14527,21 @@ this option is set greater than zero, any attempt to call &[getpwnam()]& with an argument that is longer behaves as if &[getpwnam()]& failed. +.option message_body_newlines main bool false +.cindex "message body" "newlines in variables" +.cindex "newline" "in message body variables" +.vindex "&$message_body$&" +.vindex "&$message_body_end$&" +By default, newlines in the message body are replaced by spaces when setting +the &$message_body$& and &$message_body_end$& expansion variables. If this +option is set true, this no longer happens. + .option message_body_visible main integer 500 .cindex "body of message" "visible size" .cindex "message body" "visible size" -.cindex "&$message_body$&" -.cindex "&$message_body_end$&" +.vindex "&$message_body$&" +.vindex "&$message_body_end$&" This option specifies how much of a message's body is to be included in the &$message_body$& and &$message_body_end$& expansion variables. @@ -13172,7 +14573,7 @@ colons will become hyphens. .option message_logs main boolean true -.cindex "message log" "disabling" +.cindex "message logs" "disabling" .cindex "log" "message log; disabling" If this option is turned off, per-message log files are not created in the &_msglog_& spool sub-directory. This reduces the amount of disk I/O required by @@ -13185,15 +14586,18 @@ which is not affected by this option. .option message_size_limit main string&!! 50M .cindex "message" "size limit" .cindex "limit" "message size" -.cindex "size of message" "limit" +.cindex "size" "of message, limit" This option limits the maximum size of message that Exim will process. The -value is expanded for each incoming -connection so, for example, it can be made to depend on the IP address of the -remote host for messages arriving via TCP/IP. &*Note*&: This limit cannot be -made to depend on a message's sender or any other properties of an individual -message, because it has to be advertised in the server's response to EHLO. -String expansion failure causes a temporary error. A value of zero means no -limit, but its use is not recommended. See also &%bounce_return_size_limit%&. +value is expanded for each incoming connection so, for example, it can be made +to depend on the IP address of the remote host for messages arriving via +TCP/IP. After expansion, the value must be a sequence of decimal digits, +optionally followed by K or M. + +&*Note*&: This limit cannot be made to depend on a message's sender or any +other properties of an individual message, because it has to be advertised in +the server's response to EHLO. String expansion failure causes a temporary +error. A value of zero means no limit, but its use is not recommended. See also +&%bounce_return_size_limit%&. Incoming SMTP messages are failed with a 552 error if the limit is exceeded; locally-generated messages either get a stderr message or a delivery @@ -13202,6 +14606,18 @@ an oversized message is logged in both the main and the reject logs. See also the generic transport option &%message_size_limit%&, which limits the size of message that an individual transport can process. +If you use a virus-scanner and set this option to to a value larger than the +maximum size that your virus-scanner is configured to support, you may get +failures triggered by large mails. The right size to configure for the +virus-scanner depends upon what data is passed and the options in use but it's +probably safest to just set it to a little larger than this value. Eg, with a +default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M, +some problems may result. + +A value of 0 will disable size limit checking; Exim will still advertise the +SIZE extension in an EHLO response, but without a limit, so as to permit +SMTP clients to still indicate the message size along with the MAIL verb. + .option move_frozen_messages main boolean false .cindex "frozen messages" "moving" @@ -13226,7 +14642,7 @@ contains a full description of this facility. .option mysql_servers main "string list" unset .cindex "MySQL" "server list" This option provides a list of MySQL servers and associated connection data, to -be used in conjunction with &(mysql)& lookups (see section &<>&). The +be used in conjunction with &(mysql)& lookups (see section &<>&). The option is available only if Exim has been built with MySQL support. @@ -13254,36 +14670,135 @@ harm. This option overrides the &%pipe_as_creator%& option of the &(pipe)& transport driver. -.option oracle_servers main "string list" unset -.cindex "Oracle" "server list" -This option provides a list of Oracle servers and associated connection data, -to be used in conjunction with &(oracle)& lookups (see section &<>&). -The option is available only if Exim has been built with Oracle support. +.option openssl_options main "string list" "+no_sslv2" +.cindex "OpenSSL "compatibility options" +This option allows an administrator to adjust the SSL options applied +by OpenSSL to connections. It is given as a space-separated list of items, +each one to be +added or -subtracted from the current value. +This option is only available if Exim is built against OpenSSL. The values +available for this option vary according to the age of your OpenSSL install. +The &"all"& value controls a subset of flags which are available, typically +the bug workaround options. The &'SSL_CTX_set_options'& man page will +list the values known on your system and Exim should support all the +&"bug workaround"& options and many of the &"modifying"& options. The Exim +names lose the leading &"SSL_OP_"& and are lower-cased. -.option percent_hack_domains main "domain list&!!" unset -.cindex "&""percent hack""&" -.cindex "source routing" "in email address" -.cindex "address" "source-routed" -The &"percent hack"& is the convention whereby a local part containing a -percent sign is re-interpreted as a new email address, with the percent -replaced by @. This is sometimes called &"source routing"&, though that term is -also applied to RFC 2822 addresses that begin with an @ character. If this -option is set, Exim implements the percent facility for those domains listed, -but no others. This happens before an incoming SMTP address is tested against -an ACL. +Note that adjusting the options can have severe impact upon the security of +SSL as used by Exim. It is possible to disable safety checks and shoot +yourself in the foot in various unpleasant ways. This option should not be +adjusted lightly. An unrecognised item will be detected at startup, by +invoking Exim with the &%-bV%& flag. -&*Warning*&: The &"percent hack"& has often been abused by people who are -trying to get round relaying restrictions. For this reason, it is best avoided -if at all possible. Unfortunately, a number of less security-conscious MTAs -implement it unconditionally. If you are running Exim on a gateway host, and -routing mail through to internal MTAs without processing the local parts, it is -a good idea to reject recipient addresses with percent characters in their -local parts. Exim's default configuration does this. +Historical note: prior to release 4.80, Exim defaulted this value to +"+dont_insert_empty_fragments", which may still be needed for compatibility +with some clients, but which lowers security by increasing exposure to +some now infamous attacks. +An example: +.code +# Make both old MS and old Eudora happy: +openssl_options = -all +microsoft_big_sslv3_buffer \ + +dont_insert_empty_fragments +.endd -.option perl_at_start main boolean false -This option is available only when Exim is built with an embedded Perl +Possible options may include: +.ilist +&`all`& +.next +&`allow_unsafe_legacy_renegotiation`& +.next +&`cipher_server_preference`& +.next +&`dont_insert_empty_fragments`& +.next +&`ephemeral_rsa`& +.next +&`legacy_server_connect`& +.next +&`microsoft_big_sslv3_buffer`& +.next +&`microsoft_sess_id_bug`& +.next +&`msie_sslv2_rsa_padding`& +.next +&`netscape_challenge_bug`& +.next +&`netscape_reuse_cipher_change_bug`& +.next +&`no_compression`& +.next +&`no_session_resumption_on_renegotiation`& +.next +&`no_sslv2`& +.next +&`no_sslv3`& +.next +&`no_ticket`& +.next +&`no_tlsv1`& +.next +&`no_tlsv1_1`& +.next +&`no_tlsv1_2`& +.next +&`safari_ecdhe_ecdsa_bug`& +.next +&`single_dh_use`& +.next +&`single_ecdh_use`& +.next +&`ssleay_080_client_dh_bug`& +.next +&`sslref2_reuse_cert_type_bug`& +.next +&`tls_block_padding_bug`& +.next +&`tls_d5_bug`& +.next +&`tls_rollback_bug`& +.endlist + +.new +As an aside, the &`safari_ecdhe_ecdsa_bug`& item is a misnomer and affects +all clients connecting using the MacOS SecureTransport TLS facility prior +to MacOS 10.8.4, including email clients. If you see old MacOS clients failing +to negotiate TLS then this option value might help, provided that your OpenSSL +release is new enough to contain this work-around. This may be a situation +where you have to upgrade OpenSSL to get buggy clients working. +.wen + + +.option oracle_servers main "string list" unset +.cindex "Oracle" "server list" +This option provides a list of Oracle servers and associated connection data, +to be used in conjunction with &(oracle)& lookups (see section &<>&). +The option is available only if Exim has been built with Oracle support. + + +.option percent_hack_domains main "domain list&!!" unset +.cindex "&""percent hack""&" +.cindex "source routing" "in email address" +.cindex "address" "source-routed" +The &"percent hack"& is the convention whereby a local part containing a +percent sign is re-interpreted as a new email address, with the percent +replaced by @. This is sometimes called &"source routing"&, though that term is +also applied to RFC 2822 addresses that begin with an @ character. If this +option is set, Exim implements the percent facility for those domains listed, +but no others. This happens before an incoming SMTP address is tested against +an ACL. + +&*Warning*&: The &"percent hack"& has often been abused by people who are +trying to get round relaying restrictions. For this reason, it is best avoided +if at all possible. Unfortunately, a number of less security-conscious MTAs +implement it unconditionally. If you are running Exim on a gateway host, and +routing mail through to internal MTAs without processing the local parts, it is +a good idea to reject recipient addresses with percent characters in their +local parts. Exim's default configuration does this. + + +.option perl_at_start main boolean false +This option is available only when Exim is built with an embedded Perl interpreter. See chapter &<>& for details of its use. @@ -13296,13 +14811,13 @@ interpreter. See chapter &<>& for details of its use. .cindex "PostgreSQL lookup type" "server list" This option provides a list of PostgreSQL servers and associated connection data, to be used in conjunction with &(pgsql)& lookups (see section -&<>&). The option is available only if Exim has been built with +&<>&). The option is available only if Exim has been built with PostgreSQL support. .option pid_file_path main string&!! "set at compile time" .cindex "daemon" "pid file path" -.cindex "pid file" "path for" +.cindex "pid file, path for" This option sets the name of the file to which the Exim daemon writes its process id. The string is expanded, so it can contain, for example, references to the host name: @@ -13317,14 +14832,14 @@ of the &%-oX%& option, unless a path is explicitly supplied by &%-oP%&. .option pipelining_advertise_hosts main "host list&!!" * -.cindex "PIPELINING advertising" "suppressing" +.cindex "PIPELINING" "suppressing advertising" This option can be used to suppress the advertisement of the SMTP -PIPELINING extension to specific hosts. When PIPELINING is not -advertised and &%smtp_enforce_sync%& is true, an Exim server enforces strict -synchronization for each SMTP command and response. -When PIPELINING is advertised, Exim assumes that clients will use it; &"out -of order"& commands that are &"expected"& do not count as protocol errors (see -&%smtp_max_synprot_errors%&). +PIPELINING extension to specific hosts. See also the &*no_pipelining*& +control in section &<>&. When PIPELINING is not advertised and +&%smtp_enforce_sync%& is true, an Exim server enforces strict synchronization +for each SMTP command and response. When PIPELINING is advertised, Exim assumes +that clients will use it; &"out of order"& commands that are &"expected"& do +not count as protocol errors (see &%smtp_max_synprot_errors%&). .option preserve_message_logs main boolean false @@ -13340,7 +14855,7 @@ volume of mail. Use with care! .cindex "name" "of local host" .cindex "host" "name of local" .cindex "local host" "name of" -.cindex "&$primary_hostname$&" +.vindex "&$primary_hostname$&" This specifies the name of the current host. It is used in the default EHLO or HELO command for outgoing SMTP messages (changeable via the &%helo_data%& option in the &(smtp)& transport), and as the default for &%qualify_domain%&. @@ -13365,6 +14880,13 @@ sequences, primarily to avoid messing up the layout. If &%print_topbitchars%& is set, code values of 128 and above are also considered to be printing characters. +This option also affects the header syntax checks performed by the +&(autoreply)& transport, and whether Exim uses RFC 2047 encoding of +the user's full name when constructing From: and Sender: addresses (as +described in section &<>&). Setting this option can cause +Exim to generate eight bit message headers that do not conform to the +standards. + .option process_log_path main string unset .cindex "process log path" @@ -13379,9 +14901,9 @@ different spool directories. .option prod_requires_admin main boolean true -.cindex "&%-M%& option" -.cindex "&%-R%& option" -.cindex "&%-q%& option" +.oindex "&%-M%&" +.oindex "&%-R%&" +.oindex "&%-q%&" The &%-M%&, &%-R%&, and &%-q%& command-line options require the caller to be an admin user unless &%prod_requires_admin%& is set false. See also &%queue_list_requires_admin%&. @@ -13423,7 +14945,7 @@ next queue run. See also &%hold_domains%& and &%queue_smtp_domains%&. .option queue_list_requires_admin main boolean true -.cindex "&%-bp%& option" +.oindex "&%-bp%&" The &%-bp%& command-line option, which lists the messages that are on the queue, requires the caller to be an admin user unless &%queue_list_requires_admin%& is set false. See also &%prod_requires_admin%&. @@ -13449,7 +14971,7 @@ and &%-odi%& command line options override &%queue_only%& unless This option can be set to a colon-separated list of absolute path names, each one optionally preceded by &"smtp"&. When Exim is receiving a message, it tests for the existence of each listed path using a call to &[stat()]&. For -each path that exists, the corresponding queuing option is set. +each path that exists, the corresponding queueing option is set. For paths with no prefix, &%queue_only%& is set; for paths prefixed by &"smtp"&, &%queue_smtp_domains%& is set to match all domains. So, for example, .code @@ -13465,11 +14987,29 @@ causes Exim to behave as if &%queue_smtp_domains%& were set to &"*"& whenever .cindex "message" "queueing by load" If the system load average is higher than this value, incoming messages from all sources are queued, and no automatic deliveries are started. If this -happens during local or remote SMTP input, all subsequent messages on the same -connection are queued. Deliveries will subsequently be performed by queue -runner processes. This option has no effect on ancient operating systems on -which Exim cannot determine the load average. See also -&%deliver_queue_load_max%& and &%smtp_load_reserve%&. +happens during local or remote SMTP input, all subsequent messages received on +the same SMTP connection are queued by default, whatever happens to the load in +the meantime, but this can be changed by setting &%queue_only_load_latch%& +false. + +Deliveries will subsequently be performed by queue runner processes. This +option has no effect on ancient operating systems on which Exim cannot +determine the load average. See also &%deliver_queue_load_max%& and +&%smtp_load_reserve%&. + + +.option queue_only_load_latch main boolean true +.cindex "load average" "re-evaluating per message" +When this option is true (the default), once one message has been queued +because the load average is higher than the value set by &%queue_only_load%&, +all subsequent messages received on the same SMTP connection are also queued. +This is a deliberate choice; even though the load average may fall below the +threshold, it doesn't seem right to deliver later messages on the same +connection when not delivering earlier ones. However, there are special +circumstances such as very long-lived connections from scanning appliances +where this is not the best strategy. In such cases, &%queue_only_load_latch%& +should be set false. This causes the value of the load average to be +re-evaluated for each message. .option queue_only_override main boolean true @@ -13554,7 +15094,7 @@ received_header_text = Received: \ ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\ by $primary_hostname \ ${if def:received_protocol {with $received_protocol}} \ - ${if def:tls_cipher {($tls_cipher)\n\t}}\ + ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\ (Exim $version_number)\n\t\ ${if def:sender_address \ {(envelope-from <$sender_address>)\n\t}}\ @@ -13663,7 +15203,7 @@ then take place at once is &%queue_run_max%& multiplied by If it is purely remote deliveries you want to control, use &%queue_smtp_domains%& instead of &%queue_only%&. This has the added benefit of -doing the SMTP routing before queuing, so that several messages for the same +doing the SMTP routing before queueing, so that several messages for the same host will eventually get delivered down the same connection. @@ -13743,7 +15283,7 @@ using TCP/IP), and the &%-bnq%& option was not set. This option controls the setting of the SO_KEEPALIVE option on incoming TCP/IP socket connections. When set, it causes the kernel to probe idle connections periodically, by sending packets with &"old"& sequence numbers. The -other end of the connection should send an acknowledgement if the connection is +other end of the connection should send an acknowledgment if the connection is still okay or a reset if the connection has been aborted. The reason for doing this is that it has the beneficial effect of freeing up certain types of connection that can get stuck when the remote host is disconnected without @@ -13761,8 +15301,12 @@ that Exim will accept. It applies only to the listening daemon; there is no control (in Exim) when incoming SMTP is being handled by &'inetd'&. If the value is set to zero, no limit is applied. However, it is required to be non-zero if either &%smtp_accept_max_per_host%& or &%smtp_accept_queue%& is -set. See also &%smtp_accept_reserve%&. +set. See also &%smtp_accept_reserve%& and &%smtp_load_reserve%&. +A new SMTP connection is immediately rejected if the &%smtp_accept_max%& limit +has been reached. If not, Exim first checks &%smtp_accept_max_per_host%&. If +that limit has not been reached for the client host, &%smtp_accept_reserve%& +and &%smtp_load_reserve%& are then checked before accepting the connection. .option smtp_accept_max_nonmail main integer 10 @@ -13776,7 +15320,7 @@ client host matches &%smtp_accept_max_nonmail_hosts%&. When a new message is expected, one occurrence of RSET is not counted. This allows a client to send one RSET between messages (this is not necessary, -but some clients do it). Exim also allows one uncounted occurence of HELO +but some clients do it). Exim also allows one uncounted occurrence of HELO or EHLO, and one occurrence of STARTTLS between messages. After starting up a TLS session, another EHLO is expected, and so it too is not counted. The first occurrence of AUTH in a connection, or immediately @@ -13791,9 +15335,12 @@ changing the value, you can exclude any badly-behaved hosts that you have to live with. +. Allow this long option name to split; give it unsplit as a fifth argument +. for the automatic .oindex that is generated by .option. -.option smtp_accept_max_per_connection main integer 1000 -.cindex "SMTP incoming message count" "limiting" +.option "smtp_accept_max_per_connection" main integer 1000 &&& + smtp_accept_max_per_connection +.cindex "SMTP" "limiting incoming message count" .cindex "limit" "messages per SMTP connection" The value of this option limits the number of MAIL commands that Exim is prepared to accept over a single SMTP connection, whether or not each command @@ -13810,9 +15357,10 @@ This option restricts the number of simultaneous IP connections from a single host (strictly, from a single IP address) to the Exim daemon. The option is expanded, to enable different limits to be applied to different hosts by reference to &$sender_host_address$&. Once the limit is reached, additional -connection attempts from the same host are rejected with error code 421. The -default value of zero imposes no limit. If this option is set, it is required -that &%smtp_accept_max%& be non-zero. +connection attempts from the same host are rejected with error code 421. This +is entirely independent of &%smtp_accept_reserve%&. The option's default value +of zero imposes no limit. If this option is set greater than zero, it is +required that &%smtp_accept_max%& be non-zero. &*Warning*&: When setting this option you should not use any expansion constructions that take an appreciable amount of time. The expansion and test @@ -13827,16 +15375,24 @@ doing this processing, it cannot accept any other incoming connections. .cindex "SMTP" "incoming connection count" .cindex "queueing incoming messages" .cindex "message" "queueing by SMTP connection count" -If the number of simultaneous incoming SMTP calls handled via the listening -daemon exceeds this value, messages received by SMTP are just placed on the -queue; no delivery processes are started automatically. A value of zero implies -no limit, and clearly any non-zero value is useful only if it is less than the -&%smtp_accept_max%& value (unless that is zero). See also &%queue_only%&, -&%queue_only_load%&, &%queue_smtp_domains%&, and the various &%-od%&&'x'& -command line options. +If the number of simultaneous incoming SMTP connections being handled via the +listening daemon exceeds this value, messages received by SMTP are just placed +on the queue; no delivery processes are started automatically. The count is +fixed at the start of an SMTP connection. It cannot be updated in the +subprocess that receives messages, and so the queueing or not queueing applies +to all messages received in the same connection. +A value of zero implies no limit, and clearly any non-zero value is useful only +if it is less than the &%smtp_accept_max%& value (unless that is zero). See +also &%queue_only%&, &%queue_only_load%&, &%queue_smtp_domains%&, and the +various &%-od%&&'x'& command line options. -.option smtp_accept_queue_per_connection main integer 10 + +. Allow this long option name to split; give it unsplit as a fifth argument +. for the automatic .oindex that is generated by .option. + +.option "smtp_accept_queue_per_ &~&~connection" main integer 10 &&& + smtp_accept_queue_per_connection .cindex "queueing incoming messages" .cindex "message" "queueing by message count" This option limits the number of delivery processes that Exim starts @@ -13858,30 +15414,31 @@ number of SMTP connections that are reserved for connections from the hosts that are specified in &%smtp_reserve_hosts%&. The value set in &%smtp_accept_max%& includes this reserve pool. The specified hosts are not restricted to this number of connections; the option specifies a minimum number -of connection slots for them, not a maximum. It is a guarantee that that group -of hosts can always get at least &%smtp_accept_reserve%& connections. +of connection slots for them, not a maximum. It is a guarantee that this group +of hosts can always get at least &%smtp_accept_reserve%& connections. However, +the limit specified by &%smtp_accept_max_per_host%& is still applied to each +individual host. For example, if &%smtp_accept_max%& is set to 50 and &%smtp_accept_reserve%& is set to 5, once there are 45 active connections (from any hosts), new -connections are accepted only from hosts listed in &%smtp_reserve_hosts%&. -See also &%smtp_accept_max_per_host%&. +connections are accepted only from hosts listed in &%smtp_reserve_hosts%&, +provided the other criteria for acceptance are met. .option smtp_active_hostname main string&!! unset .cindex "host" "name in SMTP responses" .cindex "SMTP" "host name in responses" -.cindex "&$primary_hostname$&" +.vindex "&$primary_hostname$&" This option is provided for multi-homed servers that want to masquerade as -several different hosts. At the start of an SMTP connection, its value is -expanded and used instead of the value of &$primary_hostname$& in SMTP +several different hosts. At the start of an incoming SMTP connection, its value +is expanded and used instead of the value of &$primary_hostname$& in SMTP responses. For example, it is used as domain name in the response to an incoming HELO or EHLO command. -.cindex "&$smtp_active_hostname$&" -It is also used in HELO commands for callout verification. The active hostname -is placed in the &$smtp_active_hostname$& variable, which is saved with any -messages that are received. It is therefore available for use in routers and -transports when the message is later delivered. +.vindex "&$smtp_active_hostname$&" +The active hostname is placed in the &$smtp_active_hostname$& variable, which +is saved with any messages that are received. It is therefore available for use +in routers and transports when the message is later delivered. If this option is unset, or if its expansion is forced to fail, or if the expansion results in an empty string, the value of &$primary_hostname$& is @@ -13890,10 +15447,15 @@ panic logs, and the SMTP command receives a temporary error. Typically, the value of &%smtp_active_hostname%& depends on the incoming interface address. For example: .code -smtp_active_hostname = ${if eq{$interface_address}{10.0.0.1}\ +smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\ {cox.mydomain}{box.mydomain}} .endd +Although &$smtp_active_hostname$& is primarily concerned with incoming +messages, it is also used as the default for HELO commands in callout +verification if there is no remote transport from which to obtain a +&%helo_data%& value. + .option smtp_banner main string&!! "see below" .cindex "SMTP" "welcome banner" .cindex "banner for SMTP" @@ -13914,7 +15476,7 @@ multiline response). .option smtp_check_spool_space main boolean true .cindex "checking disk space" -.cindex "disk space" "checking" +.cindex "disk space, checking" .cindex "spool directory" "checking space" When this option is set, if an incoming SMTP session encounters the SIZE option on a MAIL command, it checks that there is enough space in the @@ -13962,7 +15524,7 @@ hosts), you can do so by an appropriate use of a &%control%& modifier in an ACL .option smtp_etrn_command main string&!! unset .cindex "ETRN" "command to be run" -.cindex "&$domain$&" +.vindex "&$domain$&" If this option is set, the given command is run whenever an SMTP ETRN command is received from a host that is permitted to issue such commands (see chapter &<>&). The string is split up into separate arguments which @@ -14087,7 +15649,7 @@ See &%smtp_ratelimit_hosts%& above. .option smtp_receive_timeout main time 5m .cindex "timeout" "for SMTP input" -.cindex "SMTP timeout" "input" +.cindex "SMTP" "input timeout" This sets a timeout value for SMTP reception. It applies to all forms of SMTP input, including batch SMTP. If a line of input (either an SMTP command or a data line) is not received within this time, the SMTP connection is dropped and @@ -14101,7 +15663,7 @@ The former means that Exim was expecting to read an SMTP command; the latter means that it was in the DATA phase, reading the contents of a message. -.cindex "&%-os%& option" +.oindex "&%-os%&" The value set by this option can be overridden by the &%-os%& command-line option. A setting of zero time disables the timeout, but this should never be used for SMTP over TCP/IP. (It can be useful in some cases @@ -14116,11 +15678,11 @@ This option defines hosts for which SMTP connections are reserved; see .option smtp_return_error_details main boolean false .cindex "SMTP" "details policy failures" -.cindex "policy control rejection" "returning details" +.cindex "policy control" "rejection, returning details" In the default state, Exim uses bland messages such as &"Administrative prohibition"& when it rejects SMTP commands for policy reasons. Many sysadmins like this because it gives away little information -to spammers. However, some other syadmins who are applying strict checking +to spammers. However, some other sysadmins who are applying strict checking policies want to give out much fuller information about failures. Setting &%smtp_return_error_details%& true causes Exim to be more forthcoming. For example, instead of &"Administrative prohibition"&, it might give: @@ -14143,7 +15705,7 @@ See section &<>& for more details. .option split_spool_directory main boolean false .cindex "multiple spool directories" .cindex "spool directory" "split" -.cindex "directories" "multiple" +.cindex "directories, multiple" If this option is set, it causes Exim to split its input directory into 62 subdirectories, each with a single alphanumeric character as its name. The sixth character of the message id is used to allocate messages to @@ -14191,12 +15753,19 @@ By using this option to override the compiled-in path, it is possible to run tests of Exim without using the standard spool. .option sqlite_lock_timeout main time 5s -.cindex "sqlite" "lock timeout" +.cindex "sqlite lookup type" "lock timeout" This option controls the timeout that the &(sqlite)& lookup uses when trying to access an SQLite database. See section &<>& for more details. +.option strict_acl_vars main boolean false +.cindex "&ACL;" "variables, handling unset" +This option controls what happens if a syntactically valid but undefined ACL +variable is referenced. If it is false (the default), an empty string +is substituted; if it is true, an error is generated. See section +&<>& for details of ACL variables. + .option strip_excess_angle_brackets main boolean false -.cindex "angle brackets" "excess" +.cindex "angle brackets, excess" If this option is set, redundant pairs of angle brackets round &"route-addr"& items in addresses are stripped. For example, &'<>'& is treated as &''&. If this is in the envelope and the message is @@ -14268,7 +15837,7 @@ which transports are to be used. Details of this facility are given in chapter .option system_filter_directory_transport main string&!! unset -.cindex "&$address_file$&" +.vindex "&$address_file$&" This sets the name of the transport driver that is to be used when the &%save%& command in a system message filter specifies a path ending in &"/"&, implying delivery of each message into a separate file in some directory. @@ -14289,7 +15858,7 @@ with the user. The value may be numerical or symbolic. .option system_filter_pipe_transport main string&!! unset .cindex "&(pipe)& transport" "for system filter" -.cindex "&$address_pipe$&" +.vindex "&$address_pipe$&" This specifies the transport driver that is to be used when a &%pipe%& command is used in a system filter. During the delivery, the variable &$address_pipe$& contains the pipe command. @@ -14300,11 +15869,13 @@ contains the pipe command. This specifies the transport driver that is to be used when a &%mail%& command is used in a system filter. + .option system_filter_user main string unset .cindex "uid (user id)" "system filter" -If this option is not set, the system filter is run in the main Exim delivery -process, as root. When the option is set, the system filter runs in a separate -process, as the given user. Unless the string consists entirely of digits, it +If this option is set to root, the system filter is run in the main Exim +delivery process, as root. Otherwise, the system filter runs in a separate +process, as the given user, defaulting to the Exim run-time user. +Unless the string consists entirely of digits, it is looked up in the password data. Failure to find the named user causes a configuration error. The gid is either taken from the password data, or specified by &%system_filter_group%&. When the uid is specified numerically, @@ -14312,8 +15883,7 @@ specified by &%system_filter_group%&. When the uid is specified numerically, If the system filter generates any pipe, file, or reply deliveries, the uid under which the filter is run is used when transporting them, unless a -transport option overrides. Normally you should set &%system_filter_user%& if -your system filter generates these kinds of delivery. +transport option overrides. .option tcp_nodelay main boolean true @@ -14335,16 +15905,20 @@ TCP_NODELAY. .cindex "frozen messages" "timing out" .cindex "timeout" "frozen messages" If &%timeout_frozen_after%& is set to a time greater than zero, a frozen -message of any kind that has been on the queue for longer than the given -time is automatically cancelled at the next queue run. If it is a bounce -message, it is just discarded; otherwise, a bounce is sent to the sender, in a -similar manner to cancellation by the &%-Mg%& command line option. If you want -to timeout frozen bounce messages earlier than other kinds of frozen message, -see &%ignore_bounce_errors_after%&. +message of any kind that has been on the queue for longer than the given time +is automatically cancelled at the next queue run. If the frozen message is a +bounce message, it is just discarded; otherwise, a bounce is sent to the +sender, in a similar manner to cancellation by the &%-Mg%& command line option. +If you want to timeout frozen bounce messages earlier than other kinds of +frozen message, see &%ignore_bounce_errors_after%&. + +&*Note:*& the default value of zero means no timeouts; with this setting, +frozen messages remain on the queue forever (except for any frozen bounce +messages that are released by &%ignore_bounce_errors_after%&). .option timezone main string unset -.cindex "timezone" "setting" +.cindex "timezone, setting" The value of &%timezone%& is used to set the environment variable TZ while running Exim (if it is different on entry). This ensures that all timestamps created by Exim are in the required timezone. If you want all your timestamps @@ -14372,7 +15946,7 @@ chapter &<>& for details of Exim's support for TLS. .option tls_certificate main string&!! unset .cindex "TLS" "server certificate; location of" -.cindex "certificate for server" "location of" +.cindex "certificate" "server, location of" The value of this option is expanded, and must then be the absolute path to a file which contains the server's certificates. The server's private key is also assumed to be in this file if &%tls_privatekey%& is unset. See chapter @@ -14383,6 +15957,10 @@ receiving incoming messages as a server. If you want to supply certificates for use when sending messages as a client, you must set the &%tls_certificate%& option in the relevant &(smtp)& transport. +If the option contains &$tls_out_sni$& and Exim is built against OpenSSL, then +if the OpenSSL build supports TLS extensions and the TLS client sends the +Server Name Indication extension, then this option and others documented in +&<>& will be re-expanded. .option tls_crl main string&!! unset .cindex "TLS" "server certificate revocation list" @@ -14390,13 +15968,68 @@ option in the relevant &(smtp)& transport. This option specifies a certificate revocation list. The expanded value must be the name of a file that contains a CRL in PEM format. +See &<>& for discussion of when this option might be re-expanded. + + +.option tls_dh_max_bits main integer 2236 +.cindex "TLS" "D-H bit count" +The number of bits used for Diffie-Hellman key-exchange may be suggested by +the chosen TLS library. That value might prove to be too high for +interoperability. This option provides a maximum clamp on the value +suggested, trading off security for interoperability. + +The value must be at least 1024. + +The value 2236 was chosen because, at time of adding the option, it was the +hard-coded maximum value supported by the NSS cryptographic library, as used +by Thunderbird, while GnuTLS was suggesting 2432 bits as normal. + +If you prefer more security and are willing to break some clients, raise this +number. + +Note that the value passed to GnuTLS for *generating* a new prime may be a +little less than this figure, because GnuTLS is inexact and may produce a +larger prime than requested. + .option tls_dhparam main string&!! unset .cindex "TLS" "D-H parameters for server" -The value of this option is expanded, and must then be the absolute path to -a file which contains the server's DH parameter values. -This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is -ignored. See section &<>& for further details. +The value of this option is expanded and indicates the source of DH parameters +to be used by Exim. + +If it is a filename starting with a &`/`&, then it names a file from which DH +parameters should be loaded. If the file exists, it should hold a PEM-encoded +PKCS#3 representation of the DH prime. If the file does not exist, for +OpenSSL it is an error. For GnuTLS, Exim will attempt to create the file and +fill it with a generated DH prime. For OpenSSL, if the DH bit-count from +loading the file is greater than &%tls_dh_max_bits%& then it will be ignored, +and treated as though the &%tls_dhparam%& were set to "none". + +If this option expands to the string "none", then no DH parameters will be +loaded by Exim. + +If this option expands to the string "historic" and Exim is using GnuTLS, then +Exim will attempt to load a file from inside the spool directory. If the file +does not exist, Exim will attempt to create it. +See section &<>& for further details. + +If Exim is using OpenSSL and this option is empty or unset, then Exim will load +a default DH prime; the default is the 2048 bit prime described in section +2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which +in IKE is assigned number 23. + +Otherwise, the option must expand to the name used by Exim for any of a number +of DH primes specified in RFC 2409, RFC 3526 and RFC 5114. As names, Exim uses +"ike" followed by the number used by IKE, of "default" which corresponds to +"ike23". + +The available primes are: +&`ike1`&, &`ike2`&, &`ike5`&, +&`ike14`&, &`ike15`&, &`ike16`&, &`ike17`&, &`ike18`&, +&`ike22`&, &`ike23`& (aka &`default`&) and &`ike24`&. + +Some of these will be too small to be accepted by clients. +Some may be too large to be accepted by clients. .option tls_on_connect_ports main "string list" unset @@ -14415,6 +16048,8 @@ the expansion is forced to fail, or the result is an empty string, the private key is assumed to be in the same file as the server's certificates. See chapter &<>& for further details. +See &<>& for discussion of when this option might be re-expanded. + .option tls_remember_esmtp main boolean false .cindex "TLS" "esmtp state; remembering" @@ -14454,19 +16089,35 @@ are using OpenSSL, you can set &%tls_verify_certificates%& to the name of a directory containing certificate files. This does not work with GnuTLS; the option must be set to the name of a single file if you are using GnuTLS. +These certificates should be for the certificate authorities trusted, rather +than the public cert of individual clients. With both OpenSSL and GnuTLS, if +the value is a file then the certificates are sent by Exim as a server to +connecting clients, defining the list of accepted certificate authorities. +Thus the values defined should be considered public data. To avoid this, +use OpenSSL with a directory. + +See &<>& for discussion of when this option might be re-expanded. + +A forced expansion failure or setting to an empty string is equivalent to +being unset. + .option tls_verify_hosts main "host list&!!" unset .cindex "TLS" "client certificate verification" .cindex "certificate" "verification of client" This option, along with &%tls_try_verify_hosts%&, controls the checking of -certificates from clients. -The expected certificates are defined by &%tls_verify_certificates%&, which -must be set. A configuration error occurs if either &%tls_verify_hosts%& or -&%tls_try_verify_hosts%& is set and &%tls_verify_certificates%& is not set. +certificates from clients. The expected certificates are defined by +&%tls_verify_certificates%&, which must be set. A configuration error occurs if +either &%tls_verify_hosts%& or &%tls_try_verify_hosts%& is set and +&%tls_verify_certificates%& is not set. Any client that matches &%tls_verify_hosts%& is constrained by -&%tls_verify_certificates%&. The client must present one of the listed -certificates. If it does not, the connection is aborted. +&%tls_verify_certificates%&. When the client initiates a TLS session, it must +present one of the listed certificates. If it does not, the connection is +aborted. &*Warning*&: Including a host in &%tls_verify_hosts%& does not require +the host to use TLS. It can still send SMTP commands through unencrypted +connections. Forcing a client to use TLS has to be done separately using an +ACL to reject inappropriate commands when the connection is not encrypted. A weaker form of checking is provided by &%tls_try_verify_hosts%&. If a client matches this option (but not &%tls_verify_hosts%&), Exim requests a @@ -14482,8 +16133,8 @@ certificates. .option trusted_groups main "string list&!!" unset -.cindex "trusted group" -.cindex "group" "trusted" +.cindex "trusted groups" +.cindex "groups" "trusted" This option is expanded just once, at the start of Exim's processing. If this option is set, any process that is running in one of the listed groups, or which has one of them as a supplementary group, is trusted. The groups can be @@ -14493,7 +16144,7 @@ details of what trusted callers are permitted to do. If neither are trusted. .option trusted_users main "string list&!!" unset -.cindex "trusted user" +.cindex "trusted users" .cindex "user" "trusted" This option is expanded just once, at the start of Exim's processing. If this option is set, any process that is running as one of the listed users is @@ -14504,7 +16155,7 @@ Exim user are trusted. .option unknown_login main string&!! unset .cindex "uid (user id)" "unknown caller" -.cindex "&$caller_uid$&" +.vindex "&$caller_uid$&" This is a specialized feature for use in unusual configurations. By default, if the uid of the caller of Exim cannot be looked up using &[getpwuid()]&, Exim gives up. The &%unknown_login%& option can be used to set a login name to be @@ -14517,9 +16168,9 @@ is used for the user's real name (gecos field), unless this has been set by the See &%unknown_login%&. .option untrusted_set_sender main "address list&!!" unset -.cindex "trusted user" +.cindex "trusted users" .cindex "sender" "setting by untrusted user" -.cindex "untrusted user" "setting sender" +.cindex "untrusted user setting sender" .cindex "user" "untrusted setting sender" .cindex "envelope sender" When an untrusted user submits a message to Exim using the standard input, Exim @@ -14533,7 +16184,7 @@ to declare that a message should never generate any bounces. For example: .code exim -f '<>' user@domain.example .endd -.cindex "&$sender_ident$&" +.vindex "&$sender_ident$&" The &%untrusted_set_sender%& option allows you to permit untrusted users to set other envelope sender addresses in a controlled way. When it is set, untrusted users are allowed to set envelope sender addresses that match any of the @@ -14641,7 +16292,7 @@ router declines, the value of &%address_data%& remains unchanged, and the &%more%& option controls what happens next. Other expansion failures cause delivery of the address to be deferred. -.cindex "&$address_data$&" +.vindex "&$address_data$&" When the expansion succeeds, the value is retained with the address, and can be accessed using the variable &$address_data$& in the current router, subsequent routers, and the eventual transport. @@ -14671,20 +16322,18 @@ file = ${extract{mailbox}{$address_data}} This makes the configuration file less messy, and also reduces the number of lookups (though Exim does cache lookups). +.vindex "&$sender_address_data$&" +.vindex "&$address_data$&" The &%address_data%& facility is also useful as a means of passing information from one router to another, and from a router to a transport. In addition, if - -.cindex "&$sender_address_data$&" -.cindex "&$address_data$&" -When &$address_data$& is set by a router when verifying a recipient address -from an ACL, it remains available for use in the rest of the ACL statement. -After verifying a sender, the value is transferred to &$sender_address_data$&. - +&$address_data$& is set by a router when verifying a recipient address from an +ACL, it remains available for use in the rest of the ACL statement. After +verifying a sender, the value is transferred to &$sender_address_data$&. .option address_test routers&!? boolean true -.cindex "&%-bt%& option" +.oindex "&%-bt%&" .cindex "router" "skipping when address testing" If this option is set false, the router is skipped when routing is being tested by means of the &%-bt%& command line option. This can be a convenience when @@ -14730,9 +16379,9 @@ part lists (for example, &%local_parts%&), case-sensitive matching can be turned on by &"+caseful"& as a list item. See section &<>& for more details. -.cindex "&$local_part$&" -.cindex "&$original_local_part$&" -.cindex "&$parent_local_part$&" +.vindex "&$local_part$&" +.vindex "&$original_local_part$&" +.vindex "&$parent_local_part$&" The value of the &$local_part$& variable is forced to lower case while a router is running unless &%caseful_local_part%& is set. When a router assigns an address to a transport, the value of &$local_part$& when the transport runs @@ -14748,10 +16397,10 @@ modifier that can be used to specify case-sensitive processing within the ACL .option check_local_user routers&!? boolean false -.cindex "local user" "checking in router" +.cindex "local user, checking in router" .cindex "router" "checking for local user" .cindex "&_/etc/passwd_&" -.cindex "&$home$&" +.vindex "&$home$&" When this option is true, Exim checks that the local part of the recipient address (with affixes removed if relevant) is the name of an account on the local system. The check is done by calling the &[getpwnam()]& function rather @@ -14789,6 +16438,9 @@ router is skipped, and the address is offered to the next one. If the result is any other value, the router is run (as this is the last precondition to be evaluated, all the other preconditions must be true). +This option is unusual in that multiple &%condition%& options may be present. +All &%condition%& options must succeed. + The &%condition%& option provides a means of applying custom conditions to the running of routers. Note that in the case of a simple conditional expansion, the default expansion values are exactly what is wanted. For example: @@ -14799,16 +16451,24 @@ Because of the default behaviour of the string expansion, this is equivalent to .code condition = ${if >{$message_age}{600}{true}{}} .endd + +A multiple condition example, which succeeds: +.code +condition = ${if >{$message_age}{600}} +condition = ${if !eq{${lc:$local_part}}{postmaster}} +condition = foobar +.endd + If the expansion fails (other than forced failure) delivery is deferred. Some of the other precondition options are common special cases that could in fact be specified using &%condition%&. - .option debug_print routers string&!! unset .cindex "testing" "variables in drivers" If this option is set and debugging is enabled (see the &%-d%& command line -option), the string is expanded and included in the debugging output. +option) or in address-testing mode (see the &%-bt%& command line option), +the string is expanded and included in the debugging output. If expansion of the string fails, the error message is written to the debugging output, and Exim carries on processing. This option is provided to help with checking out the values of variables and @@ -14817,6 +16477,7 @@ option appears not to be working, &%debug_print%& can be used to output the variables it references. The output happens after checks for &%domains%&, &%local_parts%&, and &%check_local_user%& but before any other preconditions are tested. A newline is added to the text if it does not end with one. +The variable &$router_name$& contains the name of the router. @@ -14829,7 +16490,7 @@ transport option of the same name. .option domains routers&!? "domain list&!!" unset .cindex "router" "restricting to specific domains" -.cindex "&$domain_data$&" +.vindex "&$domain_data$&" If this option is set, the router is skipped unless the current domain matches the list. If the match is achieved by means of a file lookup, the data that the lookup returned for the domain is placed in &$domain_data$& for use in string @@ -14879,7 +16540,7 @@ no longer gives rise to a bounce message; the error is discarded. If the address is delivered to a remote host, the return path is set to &`<>`&, unless overridden by the &%return_path%& option on the transport. -.cindex "&$address_data$&" +.vindex "&$address_data$&" If for some reason you want to discard local errors, but use a non-empty MAIL command for remote delivery, you can preserve the original return path in &$address_data$& in the router, and reinstate it in the transport by @@ -14978,11 +16639,22 @@ The &%headers_add%& option is expanded after &%errors_to%&, but before the expansion is forced to fail, the option has no effect. Other expansion failures are treated as configuration errors. +Unlike most options, &%headers_add%& can be specified multiple times +for a router; all listed headers are added. + &*Warning 1*&: The &%headers_add%& option cannot be used for a &(redirect)& router that has the &%one_time%& option set. +.cindex "duplicate addresses" +.oindex "&%unseen%&" &*Warning 2*&: If the &%unseen%& option is set on the router, all header additions are deleted when the address is passed on to subsequent routers. +For a &%redirect%& router, if a generated address is the same as the incoming +address, this can lead to duplicate addresses with different header +modifications. Exim does not do duplicate deliveries (except, in certain +circumstances, to pipes -- see section &<>&), but it is undefined +which of the duplicates is discarded, so this ambiguous situation should be +avoided. The &%repeat_use%& option of the &%redirect%& router may be of help. @@ -15003,12 +16675,16 @@ The &%headers_remove%& option is expanded after &%errors_to%& and the option has no effect. Other expansion failures are treated as configuration errors. +Unlike most options, &%headers_remove%& can be specified multiple times +for a router; all listed headers are removed. + &*Warning 1*&: The &%headers_remove%& option cannot be used for a &(redirect)& router that has the &%one_time%& option set. &*Warning 2*&: If the &%unseen%& option is set on the router, all header removal requests are deleted when the address is passed on to subsequent -routers. +routers, and this can lead to problems with duplicates -- see the similar +warning for &%headers_add%& above. .option ignore_target_hosts routers "host list&!!" unset @@ -15047,7 +16723,7 @@ addresses. Because, like all host lists, the value of &%ignore_target_hosts%& is expanded before use as a list, it is possible to make it dependent on the domain that is being routed. -.cindex "&$host_address$&" +.vindex "&$host_address$&" During its expansion, &$host_address$& is set to the IP address that is being checked. @@ -15066,7 +16742,7 @@ and &%user%& and the discussion in chapter &<>&. .option local_part_prefix routers&!? "string list" unset .cindex "router" "prefix for local part" -.cindex "prefix" "for local part; used in router" +.cindex "prefix" "for local part, used in router" If this option is set, the router is skipped unless the local part starts with one of the given strings, or &%local_part_prefix_optional%& is true. See section &<>& for a list of the order in which preconditions are @@ -15082,8 +16758,8 @@ some character that does not occur in normal local parts. Wildcarding can be used to set up multiple user mailboxes, as described in section &<>&. -.cindex "&$local_part$&" -.cindex "&$local_part_prefix$&" +.vindex "&$local_part$&" +.vindex "&$local_part_prefix$&" During the testing of the &%local_parts%& option, and while the router is running, the prefix is removed from the local part, and is available in the expansion variable &$local_part_prefix$&. When a message is being delivered, if @@ -15110,6 +16786,13 @@ real_localuser: check_local_user transport = local_delivery .endd +For security, it would probably be a good idea to restrict the use of this +router to locally-generated messages, using a condition such as this: +.code + condition = ${if match {$sender_host_address}\ + {\N^(|127\.0\.0\.1)$\N}} +.endd + If both &%local_part_prefix%& and &%local_part_suffix%& are set for a router, both conditions must be met if not optional. Care must be taken if wildcards are used in both a prefix and a suffix on the same router. Different @@ -15150,7 +16833,7 @@ example: .code local_parts = dbm;/usr/local/specials/$domain .endd -.cindex "&$local_part_data$&" +.vindex "&$local_part_data$&" If the match is achieved by a lookup, the data that the lookup returned for the local part is placed in the variable &$local_part_data$& for use in expansions of the router's private options. You might use this option, for @@ -15187,7 +16870,7 @@ delivery to be deferred. If this option is set false, and the router declines to handle the address, no further routers are tried, routing fails, and the address is bounced. -.cindex "&%self%& option" +.oindex "&%self%&" However, if the router explicitly passes an address to the following router by means of the setting .code @@ -15219,12 +16902,15 @@ applies to all of them. .option pass_router routers string unset .cindex "router" "go to after &""pass""&" -When a router returns &"pass"&, the address is normally handed on to the next +Routers that recognize the generic &%self%& option (&(dnslookup)&, +&(ipliteral)&, and &(manualroute)&) are able to return &"pass"&, forcing +routing to continue, and overriding a false setting of &%more%&. When one of +these routers returns &"pass"&, the address is normally handed on to the next router in sequence. This can be changed by setting &%pass_router%& to the name of another router. However (unlike &%redirect_router%&) the named router must be below the current router, to avoid loops. Note that this option applies only to the special case of &"pass"&. It does not apply when a router returns -&"decline"&. +&"decline"& because it cannot handle an address. @@ -15351,7 +17037,7 @@ independently; this setting does not become attached to them. .option router_home_directory routers string&!! unset .cindex "router" "home directory for" .cindex "home directory" "for router" -.cindex "&$home$&" +.vindex "&$home$&" This option sets a home directory for use while the router is running. (Compare &%transport_home_directory%&, which sets a home directory for later transporting.) In particular, if used on a &(redirect)& router, this option @@ -15423,8 +17109,8 @@ reprocessed by the routers. Any headers that contain the original domain are rewritten. .vitem &%pass%& -.cindex "&%more%& option" -.cindex "&$self_hostname$&" +.oindex "&%more%&" +.vindex "&$self_hostname$&" The router passes the address to the next router, or to the router named in the &%pass_router%& option if it is set. This overrides &%no_more%&. During subsequent routing and delivery, the variable &$self_hostname$& contains the @@ -15482,7 +17168,7 @@ is inadequate or broken. Because this is an extremely uncommon requirement, the code to support this option is not included in the Exim binary unless SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in &_Local/Makefile_&. -.cindex "&$host_address$&" +.vindex "&$host_address$&" The &%translate_ip_address%& string is expanded for every IP address generated by the router, with the generated address set in &$host_address$&. If the expansion is forced to fail, no action is taken. @@ -15550,7 +17236,7 @@ logged, and delivery is deferred. If the transport does not specify a home directory, and &%transport_home_directory%& is not set for the router, the home directory for -the tranport is taken from the password data if &%check_local_user%& is set for +the transport is taken from the password data if &%check_local_user%& is set for the router. Otherwise it is taken from &%router_home_directory%& if that option is set; if not, no home directory is set for the transport. @@ -15576,21 +17262,28 @@ the value of &%unseen%& contains expansion items (and therefore, presumably, is sometimes true and sometimes false). .cindex "copy of message (&%unseen%& option)" -The &%unseen%& option can be used to cause copies of messages to be delivered -to some other destination, while also carrying out a normal delivery. In -effect, the current address is made into a &"parent"& that has two children &-- -one that is delivered as specified by this router, and a clone that goes on to -be routed further. For this reason, &%unseen%& may not be combined with the +Setting the &%unseen%& option has a similar effect to the &%unseen%& command +qualifier in filter files. It can be used to cause copies of messages to be +delivered to some other destination, while also carrying out a normal delivery. +In effect, the current address is made into a &"parent"& that has two children +&-- one that is delivered as specified by this router, and a clone that goes on +to be routed further. For this reason, &%unseen%& may not be combined with the &%one_time%& option in a &(redirect)& router. &*Warning*&: Header lines added to the address (or specified for removal) by this router or by previous routers affect the &"unseen"& copy of the message only. The clone that continues to be processed by further routers starts with -no added headers and none specified for removal. However, any data that was set -by the &%address_data%& option in the current or previous routers is passed on. -Setting the &%unseen%& option has a similar effect to the &%unseen%& command -qualifier in filter files. +no added headers and none specified for removal. For a &%redirect%& router, if +a generated address is the same as the incoming address, this can lead to +duplicate addresses with different header modifications. Exim does not do +duplicate deliveries (except, in certain circumstances, to pipes -- see section +&<>&), but it is undefined which of the duplicates is discarded, +so this ambiguous situation should be avoided. The &%repeat_use%& option of the +&%redirect%& router may be of help. +Unlike the handling of header modifications, any data that was set by the +&%address_data%& option in the current or previous routers &'is'& passed on to +subsequent routers. .option user routers string&!! "see below" @@ -15619,9 +17312,10 @@ Setting this option has the effect of setting &%verify_sender%& and .option verify_only routers&!? boolean false .cindex "EXPN" "with &%verify_only%&" -.cindex "&%-bv%& option" +.oindex "&%-bv%&" .cindex "router" "used only when verifying" -If this option is set, the router is used only when verifying an address or +If this option is set, the router is used only when verifying an address, +delivering in cutthrough mode or testing with the &%-bv%& option, not when actually doing a delivery, testing with the &%-bt%& option, or running the SMTP EXPN command. It can be further restricted to verifying only senders or recipients by means of @@ -15635,7 +17329,8 @@ user or group. .option verify_recipient routers&!? boolean true If this option is false, the router is skipped when verifying recipient -addresses +addresses, +delivering in cutthrough mode or testing recipient verification using &%-bv%&. See section &<>& for a list of the order in which preconditions are evaluated. @@ -15657,7 +17352,7 @@ are evaluated. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The accept router" +.chapter "The accept router" "CHID4" .cindex "&(accept)& router" .cindex "routers" "&(accept)&" The &(accept)& router has no private options of its own. Unless it is being @@ -15712,7 +17407,7 @@ are discarded, together with any other MX records of equal or lower priority. .cindex "MX record" "pointing to local host" .cindex "local host" "MX pointing to" -.cindex "&%self%& option" "in &(dnslookup)& router" +.oindex "&%self%&" "in &(dnslookup)& router" If the host pointed to by the highest priority MX record, or looked up as an address record, is the local host, or matches &%hosts_treat_as_local%&, what happens is controlled by the generic &%self%& option. @@ -15736,9 +17431,41 @@ look for A or AAAA records, unless the domain matches &%mx_domains%&, in which case routing fails. +.section "Declining addresses by dnslookup" "SECTdnslookupdecline" +.cindex "&(dnslookup)& router" "declines" +There are a few cases where a &(dnslookup)& router will decline to accept +an address; if such a router is expected to handle "all remaining non-local +domains", then it is important to set &%no_more%&. + +Reasons for a &(dnslookup)& router to decline currently include: +.ilist +The domain does not exist in DNS +.next +The domain exists but the MX record's host part is just "."; this is a common +convention (borrowed from SRV) used to indicate that there is no such service +for this domain and to not fall back to trying A/AAAA records. +.next +Ditto, but for SRV records, when &%check_srv%& is set on this router. +.next +MX record points to a non-existent host. +.next +MX record points to an IP address and the main section option +&%allow_mx_to_ip%& is not set. +.next +MX records exist and point to valid hosts, but all hosts resolve only to +addresses blocked by the &%ignore_target_hosts%& generic option on this router. +.next +The domain is not syntactically valid (see also &%allow_utf8_domains%& and +&%dns_check_names_pattern%& for handling one variant of this) +.next +&%check_secondary_mx%& is set on this router but the local host can +not be found in the MX records (see below) +.endlist + + -.section "Private options for dnslookup" +.section "Private options for dnslookup" "SECID118" .cindex "options" "&(dnslookup)& router" The private options for the &(dnslookup)& router are as follows: @@ -15792,7 +17519,7 @@ when there is a DNS lookup error. .cindex "MX record" "required to exist" .cindex "SRV record" "required to exist" A domain that matches &%mx_domains%& is required to have either an MX or an SRV -record in order to be recognised. (The name of this option could be improved.) +record in order to be recognized. (The name of this option could be improved.) For example, if all the mail hosts in &'fict.example'& are known to have MX records, except for those in &'discworld.fict.example'&, you could use this setting: @@ -15919,7 +17646,7 @@ the DNS resolver. &%widen_domains%& is not applied to sender addresses when verifying, unless &%rewrite_headers%& is false (not the default). -.section "Effect of qualify_single and search_parents" +.section "Effect of qualify_single and search_parents" "SECID119" When a domain from an envelope recipient is changed by the resolver as a result of the &%qualify_single%& or &%search_parents%& options, Exim rewrites the corresponding address in the message's header lines unless &%rewrite_headers%& @@ -15947,7 +17674,7 @@ entered. No widening ever takes place for these lookups. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The ipliteral router" +.chapter "The ipliteral router" "CHID5" .cindex "&(ipliteral)& router" .cindex "domain literal" "routing" .cindex "routers" "&(ipliteral)&" @@ -15968,7 +17695,7 @@ postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678] Exim allows &`ipv4:`& before IPv4 addresses, for consistency, and on the grounds that sooner or later somebody will try it. -.cindex "&%self%& option" "in &(ipliteral)& router" +.oindex "&%self%&" "in &(ipliteral)& router" If the IP address matches something in &%ignore_target_hosts%&, the router declines. If an IP literal turns out to refer to the local host, the generic &%self%& option determines what happens. @@ -15983,7 +17710,7 @@ Exim will not recognize the domain literal syntax in addresses. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The iplookup router" +.chapter "The iplookup router" "CHID6" .cindex "&(iplookup)& router" .cindex "routers" "&(iplookup)&" The &(iplookup)& router was written to fulfil a specific requirement in @@ -16029,10 +17756,14 @@ This option can be set to &"udp"& or &"tcp"& to specify which of the two protocols is to be used. -.option query iplookup string&!! "&`$local_part@$domain $local_part@$domain`&" +.option query iplookup string&!! "see below" This defines the content of the query that is sent to the remote hosts. The -repetition serves as a way of checking that a response is to the correct query -in the default case (see &%response_pattern%& below). +default value is: +.code +$local_part@$domain $local_part@$domain +.endd +The repetition serves as a way of checking that a response is to the correct +query in the default case (see &%response_pattern%& below). .option reroute iplookup string&!! unset @@ -16070,7 +17801,7 @@ call. It does not apply to UDP. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The manualroute router" +.chapter "The manualroute router" "CHID7" .scindex IIDmanrou1 "&(manualroute)& router" .scindex IIDmanrou2 "routers" "&(manualroute)&" .cindex "domain" "manually routing" @@ -16089,7 +17820,7 @@ include a transport. The combination of a pattern and its data is called a generic &%transport%& option must specify a transport, unless the router is being used purely for verification (see &%verify_only%&). -.cindex "&$host$&" +.vindex "&$host$&" In the case of verification, matching the domain pattern is sufficient for the router to accept the address. When actually routing an address for delivery, an address that matches a domain pattern is queued for the associated @@ -16111,29 +17842,37 @@ below, following the list of private options. .cindex "options" "&(manualroute)& router" The private options for the &(manualroute)& router are as follows: +.option host_all_ignored manualroute string defer +See &%host_find_failed%&. .option host_find_failed manualroute string freeze This option controls what happens when &(manualroute)& tries to find an IP address for a host, and the host does not exist. The option can be set to one -of +of the following values: .code decline defer fail freeze +ignore pass .endd -The default assumes that this state is a serious configuration error. The -difference between &"pass"& and &"decline"& is that the former forces the -address to be passed to the next router (or the router defined by +The default (&"freeze"&) assumes that this state is a serious configuration +error. The difference between &"pass"& and &"decline"& is that the former +forces the address to be passed to the next router (or the router defined by &%pass_router%&), -.cindex "&%more%& option" +.oindex "&%more%&" overriding &%no_more%&, whereas the latter passes the address to the next router only if &%more%& is true. -This option applies only to a definite &"does not exist"& state; if a host -lookup gets a temporary error, delivery is deferred unless the generic -&%pass_on_timeout%& option is set. +The value &"ignore"& causes Exim to completely ignore a host whose IP address +cannot be found. If all the hosts in the list are ignored, the behaviour is +controlled by the &%host_all_ignored%& option. This takes the same values +as &%host_find_failed%&, except that it cannot be set to &"ignore"&. + +The &%host_find_failed%& option applies only to a definite &"does not exist"& +state; if a host lookup gets a temporary error, delivery is deferred unless the +generic &%pass_on_timeout%& option is set. .option hosts_randomize manualroute boolean false @@ -16173,7 +17912,7 @@ router declines. Other kinds of expansion failure cause delivery to be deferred. -.option route_list manualroute " "string list" " semicolon-separated"" +.option route_list manualroute "string list" unset This string is a list of routing rules, in the form defined below. Note that, unlike most string lists, the items are separated by semicolons. This is so that they may contain colon-separated host lists. @@ -16200,7 +17939,7 @@ if &%headers_add%& and &%headers_remove%& are unset. -.section "Routing rules in route_list" +.section "Routing rules in route_list" "SECID120" The value of &%route_list%& is a string consisting of a sequence of routing rules, separated by semicolons. If a semicolon is needed in a rule, it can be entered as two semicolons. Alternatively, the list separator can be changed as @@ -16234,7 +17973,7 @@ then used as described below. If there is no match, the router declines. When -.section "Routing rules in route_data" +.section "Routing rules in route_data" "SECID121" The use of &%route_list%& is convenient when there are only a small number of routing rules. For larger numbers, it is easier to use a file or database to hold the routing information, and use the &%route_data%& option instead. @@ -16259,7 +17998,7 @@ be enclosed in quotes if it contains white space. -.section "Format of the list of hosts" +.section "Format of the list of hosts" "SECID122" A list of hosts, whether obtained via &%route_data%& or &%route_list%&, is always separately expanded before use. If the expansion fails, the router declines. The result of the expansion must be a colon-separated list of names @@ -16283,7 +18022,7 @@ route_list = ^domain(\d+) host-$1.text.example &$1$& is also set when partial matching is done in a file lookup. .next -.cindex "&$value$&" +.vindex "&$value$&" If the pattern that matched the domain was a lookup item, the data that was looked up is available in the expansion variable &$value$&. For example: .code @@ -16346,7 +18085,7 @@ that is not followed by &`/MX`& it looks up an IP address. If this turns out to be an interface on the local host and the item is not the first in the list, Exim discards it and any subsequent items. If it is the first item, what happens is controlled by the -.cindex "&%self%& option" "in &(manualroute)& router" +.oindex "&%self%&" "in &(manualroute)& router" &%self%& option of the router. A name on the list that is followed by &`/MX`& is replaced with the list of @@ -16425,13 +18164,13 @@ function called. If no IP address for a host can be found, what happens is controlled by the &%host_find_failed%& option. -.cindex "&$host$&" +.vindex "&$host$&" When an address is routed to a local transport, IP addresses are not looked up. The host list is passed to the transport in the &$host$& variable. -.section "Manualroute examples" +.section "Manualroute examples" "SECID123" In some of the examples that follow, the presence of the &%remote_smtp%& transport, as defined in the default configuration file, is assumed: @@ -16533,8 +18272,8 @@ save_in_file: ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \ batch_pipe .endd -.cindex "&$domain$&" -.cindex "&$host$&" +.vindex "&$domain$&" +.vindex "&$host$&" The first of these just passes the domain in the &$host$& variable, which doesn't achieve much (since it is also in &$domain$&), but the second does a file lookup to find a value to pass, causing the router to decline to handle @@ -16694,7 +18433,7 @@ anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim goes on to try a call to &[getipnodebyname()]& or &[gethostbyname()]&, and the result of the lookup is the result of that call. -.cindex "&$address_data$&" +.vindex "&$address_data$&" If the DATA field is set, its value is placed in the &$address_data$& variable. For example, this return line .code @@ -16732,9 +18471,9 @@ It can be routed to be delivered to a specified pipe command. .next It can cause an automatic reply to be generated. .next -It can be forced to fail, with a custom error message. +It can be forced to fail, optionally with a custom error message. .next -It can be temporarily deferred. +It can be temporarily deferred, optionally with a custom message. .next It can be discarded. .endlist @@ -16746,7 +18485,7 @@ files and pipes, and for generating autoreplies. See the &%file_transport%&, -.section "Redirection data" +.section "Redirection data" "SECID124" The router operates by interpreting a text string which it obtains either by expanding the contents of the &%data%& option, or by reading the entire contents of a file whose name is given in the &%file%& option. These two @@ -16779,17 +18518,16 @@ comments. -.section "Forward files and address verification" +.section "Forward files and address verification" "SECID125" .cindex "address redirection" "while verifying" It is usual to set &%no_verify%& on &(redirect)& routers which handle users' &_.forward_& files, as in the example above. There are two reasons for this: .ilist When Exim is receiving an incoming SMTP message from a remote host, it is -running under the Exim uid, not as root. -Exim is unable to change uid to read the file as the user, and it may not be -able to read it as the Exim user. So in practice the router may not be able to -operate. +running under the Exim uid, not as root. Exim is unable to change uid to read +the file as the user, and it may not be able to read it as the Exim user. So in +practice the router may not be able to operate. .next However, even when the router can operate, the existence of a &_.forward_& file is unimportant when verifying an address. What should be checked is whether the @@ -16802,7 +18540,7 @@ saves some resources. -.section "Interpreting redirection data" +.section "Interpreting redirection data" "SECID126" .cindex "Sieve filter" "specifying in redirection data" .cindex "filter" "specifying in redirection data" The contents of the data string, whether obtained from &%data%& or &%file%&, @@ -16850,7 +18588,7 @@ double quotes are retained because some forms of mail address require their use &"item"& refers to what remains after any surrounding double quotes have been removed. -.cindex "&$local_part$&" +.vindex "&$local_part$&" &*Warning*&: If you use an Exim expansion to construct a redirection address, and the expansion contains a reference to &$local_part$&, you should make use of the &%quote_local_part%& expansion operator, in case the local part contains @@ -16864,7 +18602,7 @@ data = ${quote_local_part:$local_part}@newdomain.example .section "Redirecting to a local mailbox" "SECTredlocmai" .cindex "routing" "loops in" -.cindex "loop while routing" "avoidance of" +.cindex "loop" "while routing, avoidance of" .cindex "address redirection" "to local mailbox" A redirection item may safely be the same as the address currently under consideration. This does not cause a routing loop, because a router is @@ -16885,7 +18623,7 @@ cleo, cleopatra@egypt.example .cindex "backslash in alias file" .cindex "alias file" "backslash in" For compatibility with other MTAs, such unqualified local parts may be -preceeded by &"\"&, but this is not a requirement for loop prevention. However, +preceded by &"\"&, but this is not a requirement for loop prevention. However, it does make a difference if more than one domain is being handled synonymously. @@ -16948,6 +18686,18 @@ quote just the command. An item such as .endd is interpreted as a pipe with a rather strange command name, and no arguments. +.new +Note that the above example assumes that the text comes from a lookup source +of some sort, so that the quotes are part of the data. If composing a +redirect router with a &%data%& option directly specifying this command, the +quotes will be used by the configuration parser to define the extent of one +string, but will not be passed down into the redirect router itself. There +are two main approaches to get around this: escape quotes to be part of the +data itself, or avoid using this mechanism and instead create a custom +transport with the &%command%& option set and reference that transport from +an &%accept%& router. +.wen + .next .cindex "file" "in redirection list" .cindex "address redirection" "to file" @@ -17000,14 +18750,11 @@ Sometimes you want to throw away mail to a particular local part. Making the the router to decline. Instead, the alias item .cindex "black hole" .cindex "abandoning mail" -.code -:blackhole: -.endd -can be used. It does what its name implies. No delivery is done, and no error -message is generated. This has the same effect as specifing &_/dev/null_&, but -can be independently disabled. +&':blackhole:'& can be used. It does what its name implies. No delivery is +done, and no error message is generated. This has the same effect as specifing +&_/dev/null_& as a destination, but it can be independently disabled. -&*Warning*&: If &`:blackhole:`& appears anywhere in a redirection list, no +&*Warning*&: If &':blackhole:'& appears anywhere in a redirection list, no delivery is done for the original local part, even if other redirection items are present. If you are generating a multi-item list (for example, by reading a database) and need the ability to provide a no-op item, you must use @@ -17017,7 +18764,7 @@ database) and need the ability to provide a no-op item, you must use .cindex "delivery" "forcing failure" .cindex "delivery" "forcing deferral" .cindex "failing delivery" "forcing" -.cindex "deferred delivery" "forcing" +.cindex "deferred delivery, forcing" .cindex "customizing" "failure message" An attempt to deliver a particular address can be deferred or forced to fail by redirection items of the form @@ -17025,27 +18772,37 @@ redirection items of the form :defer: :fail: .endd -respectively. When a redirection list contains such an item, it applies to the -entire redirection; any other items in the list are ignored (&':blackhole:'& is -different). Any text following &':fail:'& or &':defer:'& is placed in the error -text associated with the failure. For example, an alias file might contain: +respectively. When a redirection list contains such an item, it applies +to the entire redirection; any other items in the list are ignored. Any +text following &':fail:'& or &':defer:'& is placed in the error text +associated with the failure. For example, an alias file might contain: .code X.Employee: :fail: Gone away, no forwarding address .endd In the case of an address that is being verified from an ACL or as the subject of a -.cindex "VRFY error text" "display of" +.cindex "VRFY" "error text, display of" VRFY command, the text is included in the SMTP error response by default. -.cindex "EXPN error text" "display of" -The text is not included in the response to an EXPN command. +.cindex "EXPN" "error text, display of" +The text is not included in the response to an EXPN command. In non-SMTP cases +the text is included in the error message that Exim generates. + +.cindex "SMTP" "error codes" +By default, Exim sends a 451 SMTP code for a &':defer:'&, and 550 for +&':fail:'&. However, if the message starts with three digits followed by a +space, optionally followed by an extended code of the form &'n.n.n'&, also +followed by a space, and the very first digit is the same as the default error +code, the code from the message is used instead. If the very first digit is +incorrect, a panic error is logged, and the default code is used. You can +suppress the use of the supplied code in a redirect router by setting the +&%forbid_smtp_code%& option true. In this case, any SMTP code is quietly +ignored. -.cindex "&$acl_verify_message$&" +.vindex "&$acl_verify_message$&" In an ACL, an explicitly provided message overrides the default, but the default message is available in the variable &$acl_verify_message$& and can -therefore be included in a custom message if this is desired. Exim sends a 451 -SMTP code for a &':defer:'&, and 550 for &':fail:'&. In non-SMTP cases the text -is included in the error message that Exim generates. +therefore be included in a custom message if this is desired. Normally the error text is the rest of the redirection list &-- a comma does not terminate it &-- but a newline does act as a terminator. Newlines are not @@ -17065,18 +18822,15 @@ rules still apply. Sometimes it is useful to use a single-key search type with a default (see chapter &<>&) to look up aliases. However, there may be a need for exceptions to the default. These can be handled by aliasing them to -.code -:unknown: -.endd -This differs from &':fail:'& in that it causes the &(redirect)& router to -decline, whereas &':fail:'& forces routing to fail. A lookup which results in -an empty redirection list has the same effect. +&':unknown:'&. This differs from &':fail:'& in that it causes the &(redirect)& +router to decline, whereas &':fail:'& forces routing to fail. A lookup which +results in an empty redirection list has the same effect. .endlist -.section "Duplicate addresses" +.section "Duplicate addresses" "SECTdupaddr" .cindex "duplicate addresses" -.cindex "address duplicate" "discarding" +.cindex "address duplicate, discarding" .cindex "pipe" "duplicated" Exim removes duplicate addresses from the list to which it is delivering, so as to deliver just one copy to each address. This does not apply to deliveries @@ -17100,7 +18854,7 @@ the pipes are distinct. -.section "Repeated redirection expansion" +.section "Repeated redirection expansion" "SECID128" .cindex "repeated redirection expansion" .cindex "address redirection" "repeated for each delivery attempt" When a message cannot be delivered to all of its recipients immediately, @@ -17111,7 +18865,7 @@ members of the list receiving copies of old messages. The &%one_time%& option can be used to avoid this. -.section "Errors in redirection lists" +.section "Errors in redirection lists" "SECID129" .cindex "address redirection" "errors" If &%skip_syntax_errors%& is set, a malformed address that causes a parsing error is skipped, and an entry is written to the main log. This may be useful @@ -17121,7 +18875,7 @@ deferred. See also &%syntax_errors_to%&. -.section "Private options for the redirect router" +.section "Private options for the redirect router" "SECID130" .cindex "options" "&(redirect)& router" The private options for the &(redirect)& router are as follows: @@ -17258,7 +19012,7 @@ not, the router declines. .option file_transport redirect string&!! unset -.cindex "&$address_file$&" +.vindex "&$address_file$&" A &(redirect)& router sets up a direct delivery to a file when a path name not ending in a slash is specified as a new &"address"&. The transport used is specified by this option, which, after expansion, must be the name of a @@ -17266,6 +19020,13 @@ configured transport. This should normally be an &(appendfile)& transport. When it is running, the file name is in &$address_file$&. +.option filter_prepend_home redirect boolean true +When this option is true, if a &(save)& command in an Exim filter specifies a +relative path, and &$home$& is defined, it is automatically prepended to the +relative path. If this option is set false, this action does not happen. The +relative path is then passed to the transport unmodified. + + .option forbid_blackhole redirect boolean false If this option is true, the &':blackhole:'& item may not appear in a redirection list. @@ -17360,6 +19121,13 @@ If this option is set true, only Exim filters are permitted when &%allow_filter%& is true. +.cindex "SMTP" "error codes" +.option forbid_smtp_code redirect boolean false +If this option is set true, any SMTP error codes that are present at the start +of messages specified for &`:defer:`& or &`:fail:`& are quietly ignored, and +the default codes (451 and 550, respectively) are always used. + + .option hide_child_in_errmsg redirect boolean false @@ -17463,7 +19231,7 @@ The list is in addition to the local user's primary group when .option pipe_transport redirect string&!! unset -.cindex "&$address_pipe$&" +.vindex "&$address_pipe$&" A &(redirect)& router sets up a direct delivery to a pipe when a string starting with a vertical bar character is specified as a new &"address"&. The transport used is specified by this option, which, after expansion, must be the @@ -17472,7 +19240,7 @@ When the transport is run, the pipe command is in &$address_pipe$&. .option qualify_domain redirect string&!! unset -.cindex "&$qualify_recipient$&" +.vindex "&$qualify_recipient$&" If this option is set, and an unqualified address (one without a domain) is generated, and that address would normally be qualified by the global setting in &%qualify_recipient%&, it is instead qualified with the domain specified by @@ -17609,6 +19377,13 @@ real_localuser: local_part_prefix = real- transport = local_delivery .endd +For security, it would probably be a good idea to restrict the use of this +router to locally-generated messages, using a condition such as this: +.code + condition = ${if match {$sender_host_address}\ + {\N^(|127\.0\.0\.1)$\N}} +.endd + .option syntax_errors_text redirect string&!! unset See &%skip_syntax_errors%& above. @@ -17650,10 +19425,10 @@ configuration, and these override anything that comes from the router. -.section "Concurrent deliveries" +.section "Concurrent deliveries" "SECID131" .cindex "concurrent deliveries" .cindex "simultaneous deliveries" -If two different messages for the same local recpient arrive more or less +If two different messages for the same local recipient arrive more or less simultaneously, the two delivery processes are likely to run concurrently. When the &(appendfile)& transport is used to write to a file, Exim applies locking rules to stop concurrent processes from writing to the same file at the same @@ -17702,7 +19477,7 @@ address by the router. If &%user%& is non-numeric and &%group%& is not set, the gid associated with the user is used. If &%user%& is numeric, &%group%& must be set. -.cindex "&%initgroups%& option" +.oindex "&%initgroups%&" When the uid is taken from the transport's configuration, the &[initgroups()]& function is called for the groups associated with that uid if the &%initgroups%& option is set for the transport. When the uid is not specified @@ -17758,7 +19533,7 @@ Of course, an error will still occur if the uid that is chosen is on the -.section "Current and home directories" +.section "Current and home directories" "SECID132" .cindex "current directory for local transport" .cindex "home directory" "for local transport" .cindex "transport" "local; home directory for" @@ -17794,10 +19569,10 @@ directory to &_/_& before running a local transport. -.section "Expansion variables derived from the address" -.cindex "&$domain$&" -.cindex "&$local_part$&" -.cindex "&$original_domain$&" +.section "Expansion variables derived from the address" "SECID133" +.vindex "&$domain$&" +.vindex "&$local_part$&" +.vindex "&$original_domain$&" Normally a local delivery is handling a single address, and in that case the variables such as &$domain$& and &$local_part$& are set during local deliveries. However, in some circumstances more than one address may be handled @@ -17863,6 +19638,8 @@ so on when debugging driver configurations. For example, if a &%headers_add%& option is not working properly, &%debug_print%& could be used to output the variables it references. A newline is added to the text if it does not end with one. +The variables &$transport_name$& and &$router_name$& contain the name of the +transport and the router that called it. .option delivery_date_add transports boolean false @@ -17908,6 +19685,9 @@ routers. If the result of the expansion is an empty string, or if the expansion is forced to fail, no action is taken. Other expansion failures are treated as errors and cause the delivery to be deferred. +Unlike most options, &%headers_add%& can be specified multiple times +for a transport; all listed headers are added. + .option headers_only transports boolean false @@ -17930,6 +19710,9 @@ routers. If the result of the expansion is an empty string, or if the expansion is forced to fail, no action is taken. Other expansion failures are treated as errors and cause the delivery to be deferred. +Unlike most options, &%headers_remove%& can be specified multiple times +for a router; all listed headers are added. + .option headers_rewrite transports string unset @@ -17958,7 +19741,7 @@ change envelope recipients at this time. .option home_directory transports string&!! unset .cindex "transport" "home directory for" -.cindex "&$home$&" +.vindex "&$home$&" This option specifies a home directory setting for a local transport, overriding any value that may be set by the router. The home directory is placed in &$home$& while expanding the transport's private options. It is also @@ -17980,24 +19763,24 @@ to ensure that any additional groups associated with the uid are set up. .option message_size_limit transports string&!! 0 .cindex "limit" "message size per transport" -.cindex "size of message" "limit" +.cindex "size" "of message, limit" .cindex "transport" "message size; limiting" This option controls the size of messages passed through the transport. It is -expanded before use; the result of the expansion must be a sequence of digits, -optionally followed by K or M. -If the expansion fails for any reason, including forced failure, or if the -result is not of the required form, delivery is deferred. -If the value is greater than zero and the size of a message exceeds this -limit, the address is failed. If there is any chance that the resulting bounce -message could be routed to the same transport, you should ensure that -&%return_size_limit%& is less than the transport's &%message_size_limit%&, as -otherwise the bounce message will fail to get delivered. +expanded before use; the result of the expansion must be a sequence of decimal +digits, optionally followed by K or M. If the expansion fails for any reason, +including forced failure, or if the result is not of the required form, +delivery is deferred. If the value is greater than zero and the size of a +message exceeds this limit, the address is failed. If there is any chance that +the resulting bounce message could be routed to the same transport, you should +ensure that &%return_size_limit%& is less than the transport's +&%message_size_limit%&, as otherwise the bounce message will fail to get +delivered. .option rcpt_include_affixes transports boolean false -.cindex "prefix" "for local part; including in envelope" -.cindex "suffix" "for local part; including in envelope" +.cindex "prefix" "for local part, including in envelope" +.cindex "suffix for local part" "including in envelope" .cindex "local part" "prefix" .cindex "local part" "suffix" When this option is false (the default), and an address that has had any @@ -18051,7 +19834,10 @@ SMTP MAIL command. If you set &%return_path%& for a local transport, the only effect is to change the address that is placed in the &'Return-path:'& header line, if one is added to the message (see the next option). -.cindex "&$return_path$&" +&*Note:*& A changed return path is not logged unless you add +&%return_path_on_delivery%& to the log selector. + +.vindex "&$return_path$&" The expansion can refer to the existing value via &$return_path$&. This is either the message's envelope sender, or an address set by the &%errors_to%& option on a router. If the expansion is forced to fail, no @@ -18111,7 +19897,7 @@ ST= If the shadow transport did not succeed, the error message is put in parentheses afterwards. Shadow transports can be used for a number of different purposes, including keeping more detailed log information than Exim normally -provides, and implementing automatic acknowledgement policies based on message +provides, and implementing automatic acknowledgment policies based on message headers that some sites insist on. @@ -18142,11 +19928,9 @@ filter itself, and the original process that reads the result and delivers it are all run in parallel, like a shell pipeline. The filter can perform any transformations it likes, but of course should take -care not to break RFC 2822 syntax. A demonstration Perl script is provided in -&_util/transport-filter.pl_&; this makes a few arbitrary modifications just to -show the possibilities. Exim does not check the result, except to test for a -final newline when SMTP is in use. All messages transmitted over SMTP must end -with a newline, so Exim supplies one if it is missing. +care not to break RFC 2822 syntax. Exim does not check the result, except to +test for a final newline when SMTP is in use. All messages transmitted over +SMTP must end with a newline, so Exim supplies one if it is missing. .cindex "content scanning" "per user" A transport filter can be used to provide content-scanning on a per-user basis @@ -18164,7 +19948,7 @@ more, the server might reject the message. This can be worked round by setting the &%size_addition%& option on the &(smtp)& transport, either to allow for additions to the message, or to disable the use of SIZE altogether. -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" The value of the &%transport_filter%& option is the command string for starting the filter, which is run directly from Exim, not under a shell. The string is parsed by Exim in the same way as a command string for the &(pipe)& transport: @@ -18175,8 +19959,8 @@ of arguments, one for each address that applies to this delivery. (This isn't an ideal name for this feature here, but as it was already implemented for the &(pipe)& transport, it seemed sensible not to change it.) -.cindex "&$host$&" -.cindex "&$host_address$&" +.vindex "&$host$&" +.vindex "&$host_address$&" The expansion variables &$host$& and &$host_address$& are available when the transport is a remote one. They contain the name and IP address of the host to which the message is being sent. For example: @@ -18207,13 +19991,13 @@ Except for the special case of &$pipe_addresses$& that is mentioned above, an expansion cannot generate multiple arguments, or a command name followed by arguments. Consider this example: .code -transport_filter = ${lookup{$host}lsearch{/some/file}\ +transport_filter = ${lookup{$host}lsearch{/a/file}\ {$value}{/bin/cat}} .endd The result of the lookup is interpreted as the name of the command, even if it contains white space. The simplest way round this is to use a shell: .code -transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\ +transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\ {$value}{/bin/cat}} .endd .endlist @@ -18232,8 +20016,8 @@ message, which happens if the &%return_message%& option is set. .option transport_filter_timeout transports time 5m -.cindex "transport filter" "timeout" -When Exim is reading the output of a transport filter, it a applies a timeout +.cindex "transport" "filter, timeout" +When Exim is reading the output of a transport filter, it applies a timeout that can be set by this option. Exceeding the timeout is normally treated as a temporary delivery failure. However, if a transport filter is used with a &(pipe)& transport, a timeout in the transport filter is treated in the same @@ -18244,7 +20028,7 @@ becomes a temporary error. .option user transports string&!! "Exim user" .cindex "uid (user id)" "local delivery" -.cindex "transport user" "specifying" +.cindex "transport" "user, specifying" This option specifies the user under whose uid the delivery process is to be run, overriding any uid that may have been set by the router. If the user is given as a name, the uid is looked up from the password data, and the @@ -18283,8 +20067,8 @@ transport is run for each address that is routed to the transport. A separate copy of the message is delivered each time. .cindex "batched local delivery" -.cindex "&%batch_max%&" -.cindex "&%batch_id%&" +.oindex "&%batch_max%&" +.oindex "&%batch_id%&" In special cases, it may be desirable to handle several addresses at once in a local transport, for example: @@ -18302,7 +20086,6 @@ to some other delivery mechanism such as UUCP, multiple recipients may be acceptable. .endlist -.new These three local transports all have the same options for controlling multiple (&"batched"&) deliveries, namely &%batch_max%& and &%batch_id%&. To save repeating the information for each transport, these options are described here. @@ -18313,14 +20096,13 @@ delivered together in a single run of the transport. Its default value is one &%batch_max%& value greater than one, the addresses are delivered in a batch (that is, in a single run of the transport with multiple recipients), subject to certain conditions: -.wen .ilist -.cindex "&$local_part$&" +.vindex "&$local_part$&" If any of the transport's options contain a reference to &$local_part$&, no batching is possible. .next -.cindex "&$domain$&" +.vindex "&$domain$&" If any of the transport's options contain a reference to &$domain$&, only addresses with the same domain are batched. .next @@ -18337,7 +20119,6 @@ group for the transport, and if a host list is present, the first host must be the same. .endlist -.new In the case of the &(appendfile)& and &(pipe)& transports, batching applies both when the file or pipe command is specified in the transport, and when it is specified by a &(redirect)& router, but all the batched addresses must of @@ -18361,15 +20142,14 @@ transport without &%use_bsmtp%&, the only way to preserve the recipient addresses is to set the &%envelope_to_add%& option. .cindex "&(pipe)& transport" "with multiple addresses" -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" If you are using a &(pipe)& transport without BSMTP, and setting the transport's &%command%& option, you can include &$pipe_addresses$& as part of the command. This is not a true variable; it is a bit of magic that causes each of the recipient addresses to be inserted into the command as a separate argument. This provides a way of accessing all the addresses that are being delivered in the batch. &*Note:*& This is not possible for pipe commands that -are specififed by a &(redirect)& router. -.wen +are specified by a &(redirect)& router. @@ -18399,7 +20179,7 @@ SUPPORT_MAILSTORE in &_Local/Makefile_& to have the appropriate code included. .cindex "quota" "system" -Exim recognises system quota errors, and generates an appropriate message. Exim +Exim recognizes system quota errors, and generates an appropriate message. Exim also supports its own quota control within the transport, for use when the system facility is unavailable or cannot be used for some reason. @@ -18426,8 +20206,8 @@ the &%directory%& option specifies a directory, in which a new file containing the message is created. Only one of these two options can be set, and for normal deliveries to mailboxes, one of them &'must'& be set. -.cindex "&$address_file$&" -.cindex "&$local_part$&" +.vindex "&$address_file$&" +.vindex "&$local_part$&" However, &(appendfile)& is also used for delivering messages to files or directories whose names (or parts of names) are obtained from alias, forwarding, or filtering operations (for example, a &%save%& command in a @@ -18495,7 +20275,7 @@ the &%file%& or &%directory%& option is still used if it is set. -.section "Private options for appendfile" +.section "Private options for appendfile" "SECID134" .cindex "options" "&(appendfile)& transport" @@ -18611,14 +20391,18 @@ appended to a single mailbox file. A number of different formats are provided &<>& for further details of this form of delivery. -.option directory_file appendfile string&!! &`q${base62:$tod_epoch}-$inode`& +.option directory_file appendfile string&!! "see below" .cindex "base62" -.cindex "&$inode$&" +.vindex "&$inode$&" When &%directory%& is set, but neither &%maildir_format%& nor &%mailstore_format%& is set, &(appendfile)& delivers each message into a file -whose name is obtained by expanding this string. The default value generates a -unique name from the current time, in base 62 form, and the inode of the file. -The variable &$inode$& is available only when expanding this option. +whose name is obtained by expanding this string. The default value is: +.code +q${base62:$tod_epoch}-$inode +.endd +This generates a unique name from the current time, in base 62 form, and the +inode of the file. The variable &$inode$& is available only when expanding this +option. .option directory_mode appendfile "octal integer" 0700 @@ -18685,14 +20469,14 @@ delivery is deferred. .option file_must_exist appendfile boolean false -If this option is true, the file specified by the &%file%& option must exist, -and an error occurs if it does not. Otherwise, it is created if it does not -exist. +If this option is true, the file specified by the &%file%& option must exist. +A temporary error occurs if it does not, causing delivery to be deferred. +If this option is false, the file is created if it does not exist. .option lock_fcntl_timeout appendfile time 0s .cindex "timeout" "mailbox locking" -.cindex "mailbox locking" "blocking and non-blocking" +.cindex "mailbox" "locking, blocking and non-blocking" .cindex "locking files" By default, the &(appendfile)& transport uses non-blocking calls to &[fcntl()]& when locking an open mailbox file. If the call fails, the delivery process @@ -18741,10 +20525,8 @@ is treated as 1. See below for details of locking. .option lockfile_mode appendfile "octal integer" 0600 -.new This specifies the mode of the created lock file, when a lock file is being used (see &%use_lockfile%& and &%use_mbx_lock%&). -.wen .option lockfile_timeout appendfile time 30m @@ -18789,12 +20571,10 @@ SUPPORT_MAILDIR is present in &_Local/Makefile_&. See section .option maildir_quota_directory_regex appendfile string "See below" .cindex "maildir format" "quota; directories included in" .cindex "quota" "maildir; directories included in" -.new This option is relevant only when &%maildir_use_size_file%& is set. It defines a regular expression for specifying directories, relative to the quota directory (see &%quota_directory%&), that should be included in the quota calculation. The default value is: -.wen .code maildir_quota_directory_regex = ^(?:cur|new|\..*)$ .endd @@ -18805,12 +20585,10 @@ folder from the count (as some sites do), you need to change this setting to .code maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$ .endd -.new This uses a negative lookahead in the regular expression to exclude the directory whose name is &_.Trash_&. When a directory is excluded from quota calculations, quota processing is bypassed for any messages that are delivered directly into that directory. -.wen .option maildir_retries appendfile integer 10 @@ -18823,28 +20601,25 @@ This option applies only to deliveries in maildir format, and is described in section &<>& below. -.option maildir_use_size_file appendfile boolean false +.option maildir_use_size_file appendfile&!! boolean false .cindex "maildir format" "&_maildirsize_& file" -.new -Setting this option true enables support for &_maildirsize_& files. Exim +The result of string expansion for this option must be a valid boolean value. +If it is true, it enables support for &_maildirsize_& files. Exim creates a &_maildirsize_& file in a maildir if one does not exist, taking the quota from the &%quota%& option of the transport. If &%quota%& is unset, the value is zero. See &%maildir_quota_directory_regex%& above and section &<>& below for further details. -.wen -.new .option maildirfolder_create_regex appendfile string unset .cindex "maildir format" "&_maildirfolder_& file" .cindex "&_maildirfolder_&, creating" The value of this option is a regular expression. If it is unset, it has no -effect. Otherwise, before a maildir delivery takes place place, the pattern is +effect. Otherwise, before a maildir delivery takes place, the pattern is matched against the name of the maildir directory, that is, the directory containing the &_new_& and &_tmp_& subdirectories that will be used for the delivery. If there is a match, Exim checks for the existence of a file called &_maildirfolder_& in the directory, and creates it if it does not exist. See section &<>& for more details. -.wen .option mailstore_format appendfile boolean false @@ -18869,7 +20644,7 @@ section &<>& below. .cindex "locking files" .cindex "file" "locking" .cindex "file" "MBX format" -.cindex "MBX format" "specifying" +.cindex "MBX format, specifying" This option is available only if Exim has been compiled with SUPPORT_MBX set in &_Local/Makefile_&. If &%mbx_format%& is set with the &%file%& option, the message is appended to the mailbox file in MBX format instead of @@ -18909,7 +20684,8 @@ in which case it is: message_prefix = "From ${if def:return_path{$return_path}\ {MAILER-DAEMON}} $tod_bsdinbox\n" .endd - +&*Note:*& If you set &%use_crlf%& true, you must change any occurrences of +&`\n`& to &`\r\n`& in &%message_prefix%&. .option message_suffix appendfile string&!! "see below" The string specified here is expanded and output at the end of every message. @@ -18919,12 +20695,14 @@ setting .code message_suffix = .endd +&*Note:*& If you set &%use_crlf%& true, you must change any occurrences of +&`\n`& to &`\r\n`& in &%message_suffix%&. .option mode appendfile "octal integer" 0600 If the output file is created, it is given this mode. If it already exists and has wider permissions, they are reduced to this mode. If it has narrower permissions, an error occurs unless &%mode_fail_narrower%& is false. However, -if the delivery is the result of a &%save%& command in a filter file specifing +if the delivery is the result of a &%save%& command in a filter file specifying a particular mode, the mode of the output file is always forced to take that value, and this option is ignored. @@ -19031,6 +20809,7 @@ The regular expression should not assume that the length is at the end of the file name (even though &%maildir_tag%& puts it there) because maildir MUAs sometimes add other information onto the ends of message file names. +Section &<>& contains further information. .option quota_warn_message appendfile string&!! "see below" @@ -19100,11 +20879,12 @@ This option causes lines to be terminated with the two-character CRLF sequence of batched SMTP, the byte sequence written to the file is then an exact image of what would be sent down a real SMTP connection. -The contents of the &%message_prefix%& and &%message_suffix%& options are -written verbatim, so must contain their own carriage return characters if these -are needed. In cases where these options have non-empty defaults, the values -end with a single linefeed, so they must be changed to end with &`\r\n`& if -&%use_crlf%& is set. +&*Note:*& The contents of the &%message_prefix%& and &%message_suffix%& options +(which are used to supply the traditional &"From&~"& and blank line separators +in Berkeley-style mailboxes) are written verbatim, so must contain their own +carriage return characters if these are needed. In cases where these options +have non-empty defaults, the values end with a single linefeed, so they must be +changed to end with &`\r\n`& if &%use_crlf%& is set. .option use_fcntl_lock appendfile boolean "see below" @@ -19294,11 +21074,9 @@ file, and an exclusive lock on the file whose name is .code /tmp/.. .endd -.new using the device and inode numbers of the open mailbox file, in accordance with the MBX locking rules. This file is created with a mode that is specified by the &%lockfile_mode%& option. -.wen If Exim fails to lock the file, there are two possible courses of action, depending on the value of the locking timeout. This is obtained from @@ -19369,13 +21147,11 @@ deferred. .section "Maildir delivery" "SECTmaildirdelivery" .cindex "maildir format" "description of" -.new If the &%maildir_format%& option is true, Exim delivers each message by writing it to a file whose name is &_tmp/.HP._& in the directory that is defined by the &%directory%& option (the &"delivery directory"&). If the delivery is successful, the file is renamed into the &_new_& subdirectory. -.wen In the file name, <&'stime'&> is the current time of day in seconds, and <&'mtime'&> is the microsecond fraction of the time. After a maildir delivery, @@ -19385,7 +21161,6 @@ file name. However, as a precaution, Exim calls &[stat()]& for the file before opening it. If any response other than ENOENT (does not exist) is given, Exim waits 2 seconds and tries again, up to &%maildir_retries%& times. -.new Before Exim carries out a maildir delivery, it ensures that subdirectories called &_new_&, &_cur_&, and &_tmp_& exist in the delivery directory. If they do not exist, Exim tries to create them and any superior directories in their @@ -19408,7 +21183,7 @@ maildirfolder_create_regex = /\.[^/]+$ If &$local_part_suffix$& is empty (there was no suffix for the local part), delivery is into a toplevel maildir with a name like &_/var/mail/pimbo_& (for the user called &'pimbo'&). The pattern in &%maildirfolder_create_regex%& does -not match this name, so Exim will not look for or create +not match this name, so Exim will not look for or create the file &_/var/mail/pimbo/maildirfolder_&, though it will create &_/var/mail/pimbo/{cur,new,tmp}_& if necessary. @@ -19421,7 +21196,6 @@ directories &_/var/mail/pimbo/.eximusers/{cur,new,tmp}_&. &*Warning:*& Take care when setting &%maildirfolder_create_regex%& that it does not inadvertently match the toplevel maildir directory, because a &_maildirfolder_& file at top level would completely break quota calculations. -.wen .cindex "quota" "in maildir delivery" .cindex "maildir++" @@ -19443,14 +21217,15 @@ of the &%mailbox_size%& option as a way of importing it into Exim. -.section "Using tags to record message sizes" +.section "Using tags to record message sizes" "SECID135" If &%maildir_tag%& is set, the string is expanded for each delivery. When the maildir file is renamed into the &_new_& sub-directory, the tag is added to its name. However, if adding the tag takes the length of the name to the point where the test &[stat()]& call fails with ENAMETOOLONG, the tag is dropped and the maildir file is created with no tag. -.cindex "&$message_size$&" + +.vindex "&$message_size$&" Tags can be used to encode the size of files in their names; see &%quota_size_regex%& above for an example. The expansion of &%maildir_tag%& happens after the message has been written. The value of the &$message_size$& @@ -19459,11 +21234,22 @@ forced to fail, the tag is ignored, but a non-forced failure causes delivery to be deferred. The expanded tag may contain any printing characters except &"/"&. Non-printing characters in the string are ignored; if the resulting string is empty, it is ignored. If it starts with an alphanumeric character, a leading -colon is inserted. +colon is inserted; this default has not proven to be the path that popular +maildir implementations have chosen (but changing it in Exim would break +backwards compatibility). +For one common implementation, you might set: +.code +maildir_tag = ,S=${message_size} +.endd +but you should check the documentation of the other software to be sure. +It is advisable to also set &%quota_size_regex%& when setting &%maildir_tag%& +as this allows Exim to extract the size from your tag, instead of having to +&[stat()]& each message file. -.section "Using a maildirsize file" + +.section "Using a maildirsize file" "SECID136" .cindex "quota" "in maildir delivery" .cindex "maildir format" "&_maildirsize_& file" If &%maildir_use_size_file%& is true, Exim implements the maildir++ rules for @@ -19483,15 +21269,13 @@ need to know the quota. If the &%quota%& option in the transport is unset or zero, the &_maildirsize_& file is maintained (with a zero quota setting), but no quota is imposed. -.new A regular expression is available for controlling which directories in the maildir participate in quota calculations when a &_maildirsizefile_& is in use. See the description of the &%maildir_quota_directory_regex%& option above for details. -.wen -.section "Mailstore delivery" +.section "Mailstore delivery" "SECID137" .cindex "mailstore format" "description of" If the &%mailstore_format%& option is true, each message is written as two files in the given directory. A unique base name is constructed from the @@ -19520,7 +21304,7 @@ configuration errors, and delivery is deferred. The variable &$mailstore_basename$& is available for use during these expansions. -.section "Non-special new file delivery" +.section "Non-special new file delivery" "SECID138" If neither &%maildir_format%& nor &%mailstore_format%& is set, a single new file is created directly in the named directory. For example, when delivering messages into files in batched SMTP format for later delivery to some host (see @@ -19542,7 +21326,7 @@ expanding the contents of the &%directory_file%& option. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The autoreply transport" +.chapter "The autoreply transport" "CHID8" .scindex IIDauttra1 "transports" "&(autoreply)&" .scindex IIDauttra2 "&(autoreply)& transport" The &(autoreply)& transport is not a true transport in that it does not cause @@ -19601,7 +21385,7 @@ If any of the generic options for manipulating headers (for example, of the original message that is included in the generated message when &%return_message%& is set. They do not apply to the generated message itself. -.cindex "&$sender_address$&" +.vindex "&$sender_address$&" If the &(autoreply)& transport receives return code 2 from Exim when it submits the message, indicating that there were no recipients, it does not treat this as an error. This means that autoreplies sent to &$sender_address$& when this @@ -19610,7 +21394,7 @@ problems. They are just discarded. -.section "Private options for autoreply" +.section "Private options for autoreply" "SECID139" .cindex "options" "&(autoreply)& transport" .option bcc autoreply string&!! unset @@ -19661,12 +21445,10 @@ used. .option never_mail autoreply "address list&!!" unset -.new If any run of the transport creates a message with a recipient that matches any item in the list, that recipient is quietly discarded. If all recipients are discarded, no message is created. This applies both when the recipients are generated by a filter and when they are specified in the transport. -.wen @@ -19804,12 +21586,10 @@ delivers the message to it using the LMTP protocol. .option timeout lmtp time 5m -The transport is aborted if the created process -or Unix domain socket -does not respond to LMTP commands or message input within this timeout. - - -Here is an example of a typical LMTP transport: +The transport is aborted if the created process or Unix domain socket does not +respond to LMTP commands or message input within this timeout. Delivery +is deferred, and will be tried again later. Here is an example of a typical +LMTP transport: .code lmtp: driver = lmtp @@ -19836,14 +21616,13 @@ their incoming messages. The &(pipe)& transport can be used in one of the following ways: .ilist -.cindex "&$local_part$&" +.vindex "&$local_part$&" A router routes one address to a transport in the normal way, and the transport is configured as a &(pipe)& transport. In this case, &$local_part$& contains the local part of the address (as usual), and the command that is run is specified by the &%command%& option on the transport. .next -.new -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" If the &%batch_max%& option is set greater than 1 (the default is 1), the transport can handle more than one address in a single run. In this case, when more than one address is routed to the transport, &$local_part$& is not set @@ -19851,14 +21630,13 @@ more than one address is routed to the transport, &$local_part$& is not set (described in section &<>& below) contains all the addresses that are routed to the transport. .next -.cindex "&$address_pipe$&" +.vindex "&$address_pipe$&" A router redirects an address directly to a pipe command (for example, from an alias or forward file). In this case, &$address_pipe$& contains the text of the -pipe command, and the &%command%& option on the transport is ignored. If only -one address is being transported (&%batch_max%& is not greater than one, or -only one address was redirected to this pipe command), &$local_part$& contains -the local part that was redirected. -.wen +pipe command, and the &%command%& option on the transport is ignored unless +&%force_command%& is set. If only one address is being transported +(&%batch_max%& is not greater than one, or only one address was redirected to +this pipe command), &$local_part$& contains the local part that was redirected. .endlist @@ -19871,11 +21649,11 @@ In the case when &(pipe)& is run as a consequence of an entry in a local user's other cases, the uid and gid have to be specified explicitly, either on the transport or on the router that handles the address. Current and &"home"& directories are also controllable. See chapter &<>& for -details of the local delivery environment &new("and chapter &<>& -for a discussion of local delivery batching.") +details of the local delivery environment and chapter &<>& +for a discussion of local delivery batching. -.section "Concurrent delivery" +.section "Concurrent delivery" "SECID140" If two messages arrive at almost the same time, and both are routed to a pipe delivery, the two pipe transports may be run concurrently. You must ensure that any pipe commands you set up are robust against this happening. If the commands @@ -19884,7 +21662,7 @@ write to a file, the &%exim_lock%& utility might be of use. -.section "Returned status and data" +.section "Returned status and data" "SECID141" .cindex "&(pipe)& transport" "returned data" If the command exits with a non-zero return code, the delivery is deemed to have failed, unless either the &%ignore_status%& option is set (in which case @@ -19894,9 +21672,14 @@ later"&. In this case, delivery is deferred. Details of a permanent failure are logged, but are not included in the bounce message, which merely contains &"local delivery failed"&. +If the command exits on a signal and the &%freeze_signal%& option is set then +the message will be frozen in the queue. If that option is not set, a bounce +will be sent as normal. + If the return code is greater than 128 and the command being run is a shell script, it normally means that the script was terminated by a signal whose -value is the return code minus 128. +value is the return code minus 128. The &%freeze_signal%& option does not +apply in this case. If Exim is unable to run the command (that is, if &[execve()]& fails), the return code is set to 127. This is the value that a shell returns if it is @@ -19952,7 +21735,7 @@ command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}} .cindex "transport" "filter" .cindex "filter" "transport filter" -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" Special handling takes place when an argument consists of precisely the text &`$pipe_addresses`&. This is not a general expansion variable; the only place this string is recognized is when it appears as an argument for a pipe or @@ -19961,6 +21744,15 @@ inserted in the argument list at that point &'as a separate argument'&. This avoids any problems with spaces or shell metacharacters, and is of use when a &(pipe)& transport is handling groups of addresses in a batch. +If &%force_command%& is enabled on the transport, Special handling takes place +for an argument that consists of precisely the text &`$address_pipe`&. It +is handled similarly to &$pipe_addresses$& above. It is expanded and each +argument is inserted in the argument list at that point +&'as a separate argument'&. The &`$address_pipe`& item does not need to be +the only item in the argument; in fact, if it were then &%force_command%& +should behave as a no-op. Rather, it should be used to adjust the command +run while preserving the argument vector separation. + After splitting up into arguments and expansion, the resulting command is run in a subprocess directly from the transport, &'not'& under a shell. The message that is being delivered is supplied on the standard input, and the @@ -20028,7 +21820,7 @@ by the router's &%transport_home_directory%& option, which defaults to the user's home directory if &%check_local_user%& is set. -.section "Private options for pipe" +.section "Private options for pipe" "SECID142" .cindex "options" "&(pipe)& transport" @@ -20105,6 +21897,31 @@ is set, failure to exec is treated specially, and causes the message to be frozen, whatever the setting of &%ignore_status%&. +.option freeze_signal pipe boolean false +.cindex "signal exit" +.cindex "&(pipe)& transport", "signal exit" +Normally if the process run by a command in a pipe transport exits on a signal, +a bounce message is sent. If &%freeze_signal%& is set, the message will be +frozen in Exim's queue instead. + + +.option force_command pipe boolean false +.cindex "force command" +.cindex "&(pipe)& transport", "force command" +Normally when a router redirects an address directly to a pipe command +the &%command%& option on the transport is ignored. If &%force_command%& +is set, the &%command%& option will used. This is especially +useful for forcing a wrapper or additional argument to be added to the +command. For example: +.code +command = /usr/bin/remote_exec myhost -- $address_pipe +force_command +.endd + +Note that &$address_pipe$& is handled specially in &%command%& when +&%force_command%& is set, expanding out to the original argument vector as +separate items, similarly to a Unix shell &`"$@"`& construct. + .option ignore_status pipe boolean false If this option is true, the status returned by the subprocess that is set up to run the command is ignored, and Exim behaves as if zero had been returned. @@ -20166,6 +21983,9 @@ setting .code message_prefix = .endd +&*Note:*& If you set &%use_crlf%& true, you must change any occurrences of +&`\n`& to &`\r\n`& in &%message_prefix%&. + .option message_suffix pipe string&!! "see below" The string specified here is expanded and output at the end of every message. @@ -20174,13 +21994,30 @@ The suffix can be suppressed by setting .code message_suffix = .endd +&*Note:*& If you set &%use_crlf%& true, you must change any occurrences of +&`\n`& to &`\r\n`& in &%message_suffix%&. + -.option path pipe string &`/bin:/usr/bin`& +.option path pipe string "see below" This option specifies the string that is set up in the PATH environment -variable of the subprocess. If the &%command%& option does not yield an -absolute path name, the command is sought in the PATH directories, in the usual -way. &*Warning*&: This does not apply to a command specified as a transport -filter. +variable of the subprocess. The default is: +.code +/bin:/usr/bin +.endd +If the &%command%& option does not yield an absolute path name, the command is +sought in the PATH directories, in the usual way. &*Warning*&: This does not +apply to a command specified as a transport filter. + + +.option permit_coredump pipe boolean false +Normally Exim inhibits core-dumps during delivery. If you have a need to get +a core-dump of a pipe command, enable this command. This enables core-dumps +during delivery and affects both the Exim binary and the pipe command run. +It is recommended that this option remain off unless and until you have a need +for it and that this only be enabled when needed, as the risk of excessive +resource consumption can be quite high. Note also that Exim is typically +installed as a setuid binary and most operating systems will inhibit coredumps +of these by default, so further OS-specific action may be required. .option pipe_as_creator pipe boolean false @@ -20281,13 +22118,13 @@ of what would be sent down a real SMTP connection. The contents of the &%message_prefix%& and &%message_suffix%& options are written verbatim, so must contain their own carriage return characters if these -are needed. Since the default values for both &%message_prefix%& and -&%message_suffix%& end with a single linefeed, their values must be changed to -end with &`\r\n`& if &%use_crlf%& is set. +are needed. When &%use_bsmtp%& is not set, the default values for both +&%message_prefix%& and &%message_suffix%& end with a single linefeed, so their +values must be changed to end with &`\r\n`& if &%use_crlf%& is set. .option use_shell pipe boolean false -.cindex "&$pipe_addresses$&" +.vindex "&$pipe_addresses$&" If this option is set, it causes the command to be passed to &_/bin/sh_& instead of being run directly from the transport, as described in section &<>&. This is less secure, but is needed in some situations @@ -20299,7 +22136,7 @@ its &%-c%& option. -.section "Using an external local delivery agent" +.section "Using an external local delivery agent" "SECID143" .cindex "local delivery" "using an external agent" .cindex "&'procmail'&" .cindex "external local delivery" @@ -20323,6 +22160,7 @@ procmail_pipe: envelope_to_add check_string = "From " escape_string = ">From " + umask = 077 user = $local_part group = mail @@ -20389,7 +22227,7 @@ explicitly for the transport. Timeout and retry processing (see chapter &<>&) is applied to each IP address independently. -.section "Multiple messages on a single connection" +.section "Multiple messages on a single connection" "SECID144" The sending of multiple messages over a single TCP/IP connection can arise in two ways: @@ -20418,9 +22256,9 @@ no further messages are sent over that connection. -.section "Use of the $host variable" -.cindex "&$host$&" -.cindex "&$host_address$&" +.section "Use of the $host and $host_address variables" "SECID145" +.vindex "&$host$&" +.vindex "&$host_address$&" At the start of a run of the &(smtp)& transport, the values of &$host$& and &$host_address$& are the name and IP address of the first host on the host list passed by the router. However, when the transport is about to connect to a @@ -20430,12 +22268,39 @@ that are in force when the &%helo_data%&, &%hosts_try_auth%&, &%interface%&, &%serialize_hosts%&, and the various TLS options are expanded. +.section "Use of $tls_cipher and $tls_peerdn" "usecippeer" +.vindex &$tls_bits$& +.vindex &$tls_cipher$& +.vindex &$tls_peerdn$& +.vindex &$tls_sni$& +At the start of a run of the &(smtp)& transport, the values of &$tls_bits$&, +&$tls_cipher$&, &$tls_peerdn$& and &$tls_sni$& +are the values that were set when the message was received. +These are the values that are used for options that are expanded before any +SMTP connections are made. Just before each connection is made, these four +variables are emptied. If TLS is subsequently started, they are set to the +appropriate values for the outgoing connection, and these are the values that +are in force when any authenticators are run and when the +&%authenticated_sender%& option is expanded. + +These variables are deprecated in favour of &$tls_in_cipher$& et. al. +and will be removed in a future release. + -.section "Private options for smtp" +.section "Private options for smtp" "SECID146" .cindex "options" "&(smtp)& transport" The private options of the &(smtp)& transport are as follows: +.option address_retry_include_sender smtp boolean true +.cindex "4&'xx'& responses" "retrying after" +When an address is delayed because of a 4&'xx'& response to a RCPT command, it +is the combination of sender and recipient that is delayed in subsequent queue +runs until the retry time is reached. You can delay the recipient without +reference to the sender (which is what earlier versions of Exim did), by +setting &%address_retry_include_sender%& false. However, this can lead to +problems with servers that regularly issue 4&'xx'& responses to RCPT commands. + .option allow_localhost smtp boolean false .cindex "local host" "sending to" .cindex "fallback" "hosts specified on transport" @@ -20456,6 +22321,11 @@ forced to fail, the option is ignored. Other expansion failures cause delivery to be deferred. If the result of expansion is an empty string, that is also ignored. +The expansion happens after the outgoing connection has been made and TLS +started, if required. This means that the &$host$&, &$host_address$&, +&$tls_out_cipher$&, and &$tls_out_peerdn$& variables are set according to the +particular connection. + If the SMTP session is not authenticated, the expansion of &%authenticated_sender%& still happens (and can cause the delivery to be deferred if it fails), but no AUTH= item is added to MAIL commands @@ -20543,13 +22413,28 @@ in chapter &<>& for more details. .option dns_search_parents smtp boolean false -.cindex "&%search_parents%&" If the &%hosts%& or &%fallback_hosts%& option is being used, and the &%gethostbyname%& option is false, the RES_DNSRCH resolver option is set. See the &%search_parents%& option in chapter &<>& for more details. +.new +.option dscp smtp string&!! unset +.cindex "DCSP" "outbound" +This option causes the DSCP value associated with a socket to be set to one +of a number of fixed strings or to numeric value. +The &%-bI:dscp%& option may be used to ask Exim which names it knows of. +Common values include &`throughput`&, &`mincost`&, and on newer systems +&`ef`&, &`af41`&, etc. Numeric values may be in the range 0 to 0x3F. + +The outbound packets from Exim will be marked with this value in the header +(for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee +that these values will have any effect, not be stripped by networking +equipment, or do much of anything without cooperation with your Network +Engineer and those of all network operators between the source and destination. +.wen + .option fallback_hosts smtp "string list" unset .cindex "fallback" "hosts specified on transport" @@ -20590,7 +22475,6 @@ This is the timeout that applies while waiting for the response to the final line containing just &"."& that terminates a message. Its value must not be zero. - .option gethostbyname smtp boolean false If this option is true when the &%hosts%& and/or &%fallback_hosts%& options are being used, names are looked up using &[gethostbyname()]& @@ -20598,16 +22482,35 @@ being used, names are looked up using &[gethostbyname()]& instead of using the DNS. Of course, that function may in fact use the DNS, but it may also consult other sources of information such as &_/etc/hosts_&. -.option helo_data smtp string&!! &`$primary_hostname`& -.cindex "HELO argument" "setting" -.cindex "EHLO argument" "setting" -.cindex "LHLO argument" "setting" -.new -The value of this option is expanded, and used as the argument for the EHLO, -HELO, or LHLO command that starts the outgoing SMTP or LMTP session. The -variables &$host$& and &$host_address$& are set to the identity of the remote -host, and can be used to generate different values for different servers. -.wen +.option gnutls_compat_mode smtp boolean unset +This option controls whether GnuTLS is used in compatibility mode in an Exim +server. This reduces security slightly, but improves interworking with older +implementations of TLS. + +.option helo_data smtp string&!! "see below" +.cindex "HELO" "argument, setting" +.cindex "EHLO" "argument, setting" +.cindex "LHLO argument setting" +The value of this option is expanded after a connection to a another host has +been set up. The result is used as the argument for the EHLO, HELO, or LHLO +command that starts the outgoing SMTP or LMTP session. The default value of the +option is: +.code +$primary_hostname +.endd +During the expansion, the variables &$host$& and &$host_address$& are set to +the identity of the remote host, and the variables &$sending_ip_address$& and +&$sending_port$& are set to the local IP address and port number that are being +used. These variables can be used to generate different values for different +servers or different local IP addresses. For example, if you want the string +that is used for &%helo_data%& to be obtained by a DNS lookup of the outgoing +interface address, you could use this: +.code +helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\ + {$primary_hostname}} +.endd +The use of &%helo_data%& applies both to sending messages and when doing +callouts. .option hosts smtp "string list&!!" unset Hosts are associated with an address by a router such as &(dnslookup)&, which @@ -20643,7 +22546,7 @@ unless &%hosts_randomize%& is set. .option hosts_avoid_esmtp smtp "host list&!!" unset -.cindex "ESMTP" "avoiding use of" +.cindex "ESMTP, avoiding use of" .cindex "HELO" "forcing use of" .cindex "EHLO" "avoiding use of" .cindex "PIPELINING" "avoiding the use of" @@ -20654,11 +22557,24 @@ start of the SMTP session. This means that it cannot use any of the ESMTP facilities such as AUTH, PIPELINING, SIZE, and STARTTLS. +.option hosts_avoid_pipelining smtp "host list&!!" unset +.cindex "PIPELINING" "avoiding the use of" +Exim will not use the SMTP PIPELINING extension when delivering to any host +that matches this list, even if the server host advertises PIPELINING support. + + .option hosts_avoid_tls smtp "host list&!!" unset .cindex "TLS" "avoiding for certain hosts" Exim will not try to start a TLS session when delivering to any host that matches this list. See chapter &<>& for details of TLS. +.option hosts_verify_avoid_tls smtp "host list&!!" * +.cindex "TLS" "avoiding for certain hosts" +Exim will not try to start a TLS session for a verify callout, +or when delivering in cutthrough mode, +to any host that matches this list. +Note that the default is to not use TLS. + .option hosts_max_try smtp integer 5 .cindex "host" "maximum number to try" @@ -20701,7 +22617,7 @@ attached to the address are ignored, and instead the hosts specified by the If this option is set, and either the list of hosts is taken from the &%hosts%& or the &%fallback_hosts%& option, or the hosts supplied by the router were not obtained from MX records (this includes fallback hosts from the -router), and were not randomizied by the router, the order of trying the hosts +router), and were not randomized by the router, the order of trying the hosts is randomized each time the transport runs. Randomizing the order of a host list can be used to do crude load sharing. @@ -20745,16 +22661,23 @@ unauthenticated. See also &%hosts_require_auth%&, and chapter .option interface smtp "string list&!!" unset .cindex "bind IP address" .cindex "IP address" "binding" -.cindex "&$host$&" -.cindex "&$host_address$&" +.vindex "&$host$&" +.vindex "&$host_address$&" This option specifies which interface to bind to when making an outgoing SMTP -call. The variables &$host$& and &$host_address$& refer to the host to which a -connection is about to be made during the expansion of the string. Forced -expansion failure, or an empty string result causes the option to be ignored. -Otherwise, after expansion, -the string must be a list of IP addresses, colon-separated by default, but the -separator can be changed in the usual way. -For example: +call. The value is an IP address, not an interface name such as +&`eth0`&. Do not confuse this with the interface address that was used when a +message was received, which is in &$received_ip_address$&, formerly known as +&$interface_address$&. The name was changed to minimize confusion with the +outgoing interface address. There is no variable that contains an outgoing +interface address because, unless it is set by this option, its value is +unknown. + +During the expansion of the &%interface%& option the variables &$host$& and +&$host_address$& refer to the host to which a connection is about to be made +during the expansion of the string. Forced expansion failure, or an empty +string result causes the option to be ignored. Otherwise, after expansion, the +string must be a list of IP addresses, colon-separated by default, but the +separator can be changed in the usual way. For example: .code interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061 .endd @@ -20769,7 +22692,7 @@ interface to use if the host has more than one. This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket connections. When set, it causes the kernel to probe idle connections periodically, by sending packets with &"old"& sequence numbers. The other end -of the connection should send a acknowledgement if the connection is still okay +of the connection should send a acknowledgment if the connection is still okay or a reset if the connection has been aborted. The reason for doing this is that it has the beneficial effect of freeing up certain types of connection that can get stuck when the remote host is disconnected without tidying up the @@ -20792,7 +22715,7 @@ permits this. .option multi_domain smtp boolean true -.cindex "&$domain$&" +.vindex "&$domain$&" When this option is set, the &(smtp)& transport can handle a number of addresses containing a mixture of different domains provided they all resolve to the same list of hosts. Turning the option off restricts the transport to @@ -20804,23 +22727,36 @@ is a single domain involved in a remote delivery. .option port smtp string&!! "see below" .cindex "port" "sending TCP/IP" .cindex "TCP/IP" "setting outgoing port" -This option specifies the TCP/IP port on the server to which Exim connects. If -it begins with a digit it is taken as a port number; otherwise it is looked up -using &[getservbyname()]&. The default value is normally &"smtp"&, but if -&%protocol%& is set to &"lmtp"&, the default is &"lmtp"&. -If the expansion fails, or if a port number cannot be found, delivery is -deferred. +This option specifies the TCP/IP port on the server to which Exim connects. +&*Note:*& Do not confuse this with the port that was used when a message was +received, which is in &$received_port$&, formerly known as &$interface_port$&. +The name was changed to minimize confusion with the outgoing port. There is no +variable that contains an outgoing port. + +If the value of this option begins with a digit it is taken as a port number; +otherwise it is looked up using &[getservbyname()]&. The default value is +normally &"smtp"&, but if &%protocol%& is set to &"lmtp"&, the default is +&"lmtp"&. If the expansion fails, or if a port number cannot be found, delivery +is deferred. .option protocol smtp string smtp .cindex "LMTP" "over TCP/IP" +.cindex "ssmtp protocol" "outbound" +.cindex "TLS" "SSL-on-connect outbound" +.vindex "&$port$&" If this option is set to &"lmtp"& instead of &"smtp"&, the default value for the &%port%& option changes to &"lmtp"&, and the transport operates the LMTP protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local deliveries into closed message stores. Exim also has support for running LMTP over a pipe to a local process &-- see chapter &<>&. +If this option is set to &"smtps"&, the default vaule for the &%port%& option +changes to &"smtps"&, and the transport initiates TLS immediately after +connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade. +The Internet standards bodies strongly discourage use of this mode. + .option retry_include_ip_address smtp boolean true Exim normally includes both the host name and the IP address in the key it @@ -20879,10 +22815,10 @@ the use of the SIZE option altogether. .option tls_certificate smtp string&!! unset -.cindex "TLS client certificate" "location of" -.cindex "certificate for client" "location of" -.cindex "&$host$&" -.cindex "&$host_address$&" +.cindex "TLS" "client certificate, location of" +.cindex "certificate" "client, location of" +.vindex "&$host$&" +.vindex "&$host_address$&" The value of this option must be the absolute path to a file which contains the client's certificate, for possible use when sending a message over an encrypted connection. The values of &$host$& and &$host_address$& are set to the name and @@ -20903,10 +22839,23 @@ This option specifies a certificate revocation list. The expanded value must be the name of a file that contains a CRL in PEM format. +.new +.option tls_dh_min_bits smtp integer 1024 +.cindex "TLS" "Diffie-Hellman minimum acceptable size" +When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman +key agreement is negotiated, the server will provide a large prime number +for use. This option establishes the minimum acceptable size of that number. +If the parameter offered by the server is too small, then the TLS handshake +will fail. + +Only supported when using GnuTLS. +.wen + + .option tls_privatekey smtp string&!! unset -.cindex "TLS client private key" "location of" -.cindex "&$host$&" -.cindex "&$host_address$&" +.cindex "TLS" "client private key, location of" +.vindex "&$host$&" +.vindex "&$host_address$&" The value of this option must be the absolute path to a file which contains the client's private key. This is used when sending a message over an encrypted connection using a client certificate. The values of &$host$& and @@ -20919,8 +22868,8 @@ the certificate. See chapter &<>& for details of TLS. .option tls_require_ciphers smtp string&!! unset .cindex "TLS" "requiring specific ciphers" .cindex "cipher" "requiring specific" -.cindex "&$host$&" -.cindex "&$host_address$&" +.vindex "&$host$&" +.vindex "&$host_address$&" The value of this option must be a list of permitted cipher suites, for use when setting up an outgoing encrypted connection. (There is a global option of the same name for controlling incoming connections.) The values of &$host$& and @@ -20932,7 +22881,24 @@ ciphers is a preference order. +.option tls_sni smtp string&!! unset +.cindex "TLS" "Server Name Indication" +.vindex "&$tls_sni$&" +If this option is set then it sets the $tls_out_sni variable and causes any +TLS session to pass this value as the Server Name Indication extension to +the remote side, which can be used by the remote side to select an appropriate +certificate and private key for the session. + +See &<>& for more information. + +Note that for OpenSSL, this feature requires a build of OpenSSL that supports +TLS extensions. + + + + .option tls_tempfail_tryclear smtp boolean true +.cindex "4&'xx'& responses" "to STARTTLS" When the server host is not in &%hosts_require_tls%&, and there is a problem in setting up a TLS session, this option determines whether or not Exim should try to deliver the message unencrypted. If it is set false, delivery to the @@ -20947,8 +22913,8 @@ in clear. .option tls_verify_certificates smtp string&!! unset .cindex "TLS" "server certificate verification" .cindex "certificate" "verification of server" -.cindex "&$host$&" -.cindex "&$host_address$&" +.vindex "&$host$&" +.vindex "&$host_address$&" The value of this option must be the absolute path to a file containing permitted server certificates, for use when setting up an encrypted connection. Alternatively, if you are using OpenSSL, you can set @@ -21061,7 +23027,7 @@ such a domain should be rewritten using the &"canonical"& name, and some MTAs do this. The new RFCs do not contain this suggestion. -.section "Explicitly configured address rewriting" +.section "Explicitly configured address rewriting" "SECID147" This chapter describes the rewriting rules that can be used in the main rewrite section of the configuration file, and also in the generic &%headers_rewrite%& option that can be set on any transport. @@ -21075,12 +23041,19 @@ configuration file are applied to addresses in incoming messages, both envelope addresses and addresses in header lines. Each rule specifies the types of address to which it applies. -Rewriting of addresses in header lines applies only to those headers that -were received with the message, and, in the case of transport rewriting, those -that were added by a system filter. That is, it applies only to those headers -that are common to all copies of the message. Header lines that are added by -individual routers or transports (and which are therefore specific to -individual recipient addresses) are not rewritten. +Whether or not addresses in header lines are rewritten depends on the origin of +the headers and the type of rewriting. Global rewriting, that is, rewriting +rules from the rewrite section of the configuration file, is applied only to +those headers that were received with the message. Header lines that are added +by ACLs or by a system filter or by individual routers or transports (which +are specific to individual recipient addresses) are not rewritten by the global +rules. + +Rewriting at transport time, by means of the &%headers_rewrite%& option, +applies all headers except those added by routers and transports. That is, as +well as the headers that were received with the message, it also applies to +headers that were added by an ACL or a system filter. + In general, rewriting addresses from your own system or domain has some legitimacy. Rewriting other addresses should be done only with great care and @@ -21104,13 +23077,13 @@ A host rewrites the local parts of its own users so that, for example, -.section "When does rewriting happen?" +.section "When does rewriting happen?" "SECID148" .cindex "rewriting" "timing of" .cindex "&ACL;" "rewriting addresses in" Configured address rewriting can take place at several different stages of a message's processing. -.cindex "&$sender_address$&" +.vindex "&$sender_address$&" At the start of an ACL for MAIL, the sender address may have been rewritten by a special SMTP-time rewrite rule (see section &<>&), but no ordinary rewrite rules have yet been applied. If, however, the sender address @@ -21120,8 +23093,8 @@ rewritten address. This also applies if sender verification happens in a RCPT ACL. Otherwise, when the sender address is not verified, it is rewritten as soon as a message's header lines have been received. -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" Similarly, at the start of an ACL for RCPT, the current recipient's address may have been rewritten by a special SMTP-time rewrite rule, but no ordinary rewrite rules have yet been applied to it. However, the behaviour is different @@ -21159,7 +23132,7 @@ transport time. -.section "Testing the rewriting rules that apply on input" +.section "Testing the rewriting rules that apply on input" "SECID149" .cindex "rewriting" "testing" .cindex "testing" "rewriting" Exim's input rewriting configuration appears in a part of the run time @@ -21189,7 +23162,7 @@ present time, there is no equivalent way of testing rewriting rules that are set for a particular transport. -.section "Rewriting rules" +.section "Rewriting rules" "SECID150" .cindex "rewriting" "rules" The rewrite section of the configuration file consists of lines of rewriting rules in the form @@ -21219,8 +23192,8 @@ address in &'To:'& must not assume that the message's address in &'From:'& has (or has not) already been rewritten. However, a rewrite of &'From:'& may assume that the envelope sender has already been rewritten. -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" The variables &$local_part$& and &$domain$& can be used in the replacement string to refer to the address that is being rewritten. Note that lookup-driven rewriting can be done by a rule of the form @@ -21231,7 +23204,7 @@ where the lookup key uses &$1$& and &$2$& or &$local_part$& and &$domain$& to refer to the address that is being rewritten. -.section "Rewriting patterns" +.section "Rewriting patterns" "SECID151" .cindex "rewriting" "patterns" .cindex "address list" "in a rewriting pattern" The source pattern in a rewriting rule is any item which may appear in an @@ -21292,7 +23265,7 @@ whole domain. For non-partial domain lookups, no numerical variables are set. .endlist -.section "Rewriting replacements" +.section "Rewriting replacements" "SECID152" .cindex "rewriting" "replacements" If the replacement string for a rule is a single asterisk, addresses that match the pattern and the flags are &'not'& rewritten, and no subsequent @@ -21303,8 +23276,8 @@ hatta@lookingglass.fict.example * f specifies that &'hatta@lookingglass.fict.example'& is never to be rewritten in &'From:'& headers. -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" If the replacement string is not a single asterisk, it is expanded, and must yield a fully qualified address. Within the expansion, the variables &$local_part$& and &$domain$& refer to the address that is being rewritten. @@ -21318,7 +23291,7 @@ entry written to the panic log. -.section "Rewriting flags" +.section "Rewriting flags" "SECID153" There are three different kinds of flag that may appear on rewriting rules: .ilist @@ -21335,7 +23308,8 @@ E, F, T, and S are not permitted. -.section "Flags specifying which headers and envelope addresses to rewrite" +.section "Flags specifying which headers and envelope addresses to rewrite" &&& + "SECID154" .cindex "rewriting" "flags" If none of the following flag letters, nor the &"S"& flag (see section &<>&) are present, a main rewriting rule applies to all headers @@ -21354,6 +23328,10 @@ rewriting rule is skipped unless the relevant addresses are being processed. &`s`& rewrite the &'Sender:'& header &`t`& rewrite the &'To:'& header .endd +"All headers" means all of the headers listed above that can be selected +individually, plus their &'Resent-'& versions. It does not include +other headers such as &'Subject:'& etc. + You should be particularly careful about rewriting &'Sender:'& headers, and restrict this to special known cases in your own domains. @@ -21368,8 +23346,8 @@ before any other processing; even before syntax checking. The pattern is required to be a regular expression, and it is matched against the whole of the data for the command, including any surrounding angle brackets. -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" This form of rewrite rule allows for the handling of addresses that are not compliant with RFCs 2821 and 2822 (for example, &"bang paths"& in batched SMTP input). Because the input is not required to be a syntactically valid address, @@ -21378,7 +23356,7 @@ expansion of the replacement string. The result of rewriting replaces the original address in the MAIL or RCPT command. -.section "Flags controlling the rewriting process" +.section "Flags controlling the rewriting process" "SECID155" There are four flags which control the way the rewriting process works. These take effect only when a rule is invoked, that is, when the address is of the correct type (matches the flags) and matches the pattern: @@ -21423,7 +23401,7 @@ rewritten, all but the working part of the replacement address is discarded. .endlist -.section "Rewriting examples" +.section "Rewriting examples" "SECID156" Here is an example of the two common rewriting paradigms: .code *@*.hitch.fict.example $1@hitch.fict.example @@ -21485,13 +23463,16 @@ can be done on the rewritten addresses. . //////////////////////////////////////////////////////////////////////////// .chapter "Retry configuration" "CHAPretry" -.scindex IIDretconf1 "retry configuration" "description of" +.scindex IIDretconf1 "retry" "configuration, description of" .scindex IIDregconf2 "configuration file" "retry section" -The &"retry"& section of the run time configuration file contains a list of +The &"retry"& section of the runtime configuration file contains a list of retry rules that control how often Exim tries to deliver messages that cannot -be delivered at the first attempt. If there are no retry rules, temporary -errors are treated as permanent. The &%-brt%& command line option can be used -to test which retry rule will be used for a given address, domain and error. +be delivered at the first attempt. If there are no retry rules (the section is +empty or not present), there are no retries. In this situation, temporary +errors are treated as permanent. The default configuration contains a single, +general-purpose retry rule (see section &<>&). The &%-brt%& command +line option can be used to test which retry rule will be used for a given +address, domain and error. The most common cause of retries is temporary failure to deliver to a remote host because the host is down, or inaccessible because of a network problem. @@ -21523,9 +23504,22 @@ suffers a temporary failure, the retry data is updated as normal, and subsequent delivery attempts from queue runs occur only when the retry time for the local address is reached. +.section "Changing retry rules" "SECID157" +If you change the retry rules in your configuration, you should consider +whether or not to delete the retry data that is stored in Exim's spool area in +files with names like &_db/retry_&. Deleting any of Exim's hints files is +always safe; that is why they are called &"hints"&. + +The hints retry data contains suggested retry times based on the previous +rules. In the case of a long-running problem with a remote host, it might +record the fact that the host has timed out. If your new rules increase the +timeout time for such a host, you should definitely remove the old retry data +and let Exim recreate it, based on the new rules. Otherwise Exim might bounce +messages that it should now be retaining. -.section "Retry rules" + +.section "Format of retry rules" "SECID158" .cindex "retry" "rules" Each retry rule occupies one line and consists of three or four parts, separated by white space: a pattern, an error name, an optional list of sender @@ -21539,9 +23533,10 @@ message's sender, respectively. The pattern is any single item that may appear in an address list (see section &<>&). It is in fact processed as a one-item address list, which means that it is expanded before being tested against the address that -has been delayed. Address list processing treats a plain domain name as if it -were preceded by &"*@"&, which makes it possible for many retry rules to start -with just a domain. For example, +has been delayed. A negated address list item is permitted. Address +list processing treats a plain domain name as if it were preceded by &"*@"&, +which makes it possible for many retry rules to start with just a domain. For +example, .code lookingglass.fict.example * F,24h,30m; .endd @@ -21564,7 +23559,7 @@ expressions work in address lists. .endd -.section "Choosing which retry rule to use for address errors" +.section "Choosing which retry rule to use for address errors" "SECID159" When Exim is looking for a retry rule after a routing attempt has failed (for example, after a DNS timeout), each line in the retry configuration is tested against the complete address only if &%retry_use_local_part%& is set for the @@ -21580,13 +23575,22 @@ configuration is tested against the complete address only if &%retry_use_local_part%& is set for the transport (it defaults true for all local transports). +.cindex "4&'xx'& responses" "retry rules for" However, when Exim is looking for a retry rule after a remote delivery attempt suffers an address error (a 4&'xx'& SMTP response for a recipient address), the whole address is always used as the key when searching the retry rules. The -rule that is found is used to create a retry time for the failing address. +rule that is found is used to create a retry time for the combination of the +failing address and the message's sender. It is the combination of sender and +recipient that is delayed in subsequent queue runs until its retry time is +reached. You can delay the recipient without regard to the sender by setting +&%address_retry_include_sender%& false in the &(smtp)& transport but this can +lead to problems with servers that regularly issue 4&'xx'& responses to RCPT +commands. + -.section "Choosing which retry rule to use for host and message errors" +.section "Choosing which retry rule to use for host and message errors" &&& + "SECID160" For a temporary error that is not related to an individual address (for example, a connection timeout), each line in the retry configuration is checked twice. First, the name of the remote host is used as a domain name (preceded by @@ -21624,7 +23628,7 @@ route_list = *.a.example 192.168.34.23 then the &"host name"& that is used when searching for a retry rule is the textual form of the IP address. -.section "Retry rules for specific errors" +.section "Retry rules for specific errors" "SECID161" .cindex "retry" "specific errors; specifying" The second field in a retry rule is the name of a particular error, or an asterisk, which matches any error. The errors that can be tested for are: @@ -21740,7 +23744,7 @@ error). -.section "Retry rules for specified senders" +.section "Retry rules for specified senders" "SECID162" .cindex "retry" "rules; sender-specific" You can specify retry rules that apply only when the failing message has a specific sender. In particular, this can be used to define retry rules that @@ -21777,7 +23781,7 @@ list is never matched. -.section "Retry parameters" +.section "Retry parameters" "SECID163" .cindex "retry" "parameters in rules" The third (or fourth, if a senders list is present) field in a retry rule is a sequence of retry parameter sets, separated by semicolons. Each set consists of @@ -21806,7 +23810,7 @@ is used to increase the size of the interval at each retry. .next &'H'&: retry at randomized intervals. The arguments are as for &'G'&. For each retry, the previous interval is multiplied by the factor in order to get a -maximum for the next interval. The mininum interval is the first argument of +maximum for the next interval. The minimum interval is the first argument of the parameter, and an actual interval is chosen randomly between them. Such a rule has been found to be helpful in cluster configurations when all the members of the cluster restart at once, and may therefore synchronize their @@ -21821,8 +23825,8 @@ current time. For geometrically increasing intervals, retry intervals are computed from the rule's parameters until one that is greater than the previous interval is found. The main configuration variable .cindex "limit" "retry interval" -.cindex "retry interval" "maximum" -.cindex "&%retry_interval_max%&" +.cindex "retry" "interval, maximum" +.oindex "&%retry_interval_max%&" &%retry_interval_max%& limits the maximum interval between retries. It cannot be set greater than &`24h`&, which is its default value. @@ -21855,7 +23859,7 @@ are for the hosts associated with a particular mail domain, and also for local deliveries that have been deferred. -.section "Retry rule examples" +.section "Retry rule examples" "SECID164" Here are some example retry rules: .code alice@wonderland.fict.example quota_5d F,7d,3h @@ -21893,9 +23897,9 @@ hours, then with intervals starting at one hour and increasing by a factor of -.section "Timeout of retry data" +.section "Timeout of retry data" "SECID165" .cindex "timeout" "of retry data" -.cindex "&%retry_data_expire%&" +.oindex "&%retry_data_expire%&" .cindex "hints database" "data expiry" .cindex "retry" "timeout of data" Exim timestamps the data that it writes to its retry hints database. When it @@ -21911,14 +23915,14 @@ Exim tries a month later, using the old retry data would imply that it had been down all the time, which is not a justified assumption. If a host really is permanently dead, this behaviour causes a burst of retries -every now and again, but only if messages routed to it are rare. It there is a +every now and again, but only if messages routed to it are rare. If there is a message at least once every 7 days the retry data never expires. -.section "Long-term failures" -.cindex "delivery failure" "long-term" +.section "Long-term failures" "SECID166" +.cindex "delivery failure, long-term" .cindex "retry" "after long-term failure" Special processing happens when an email address has been failing for so long that the cutoff time for the last algorithm is reached. For example, using the @@ -21941,7 +23945,7 @@ messages. If this delivery fails, the address fails immediately. The post-cutoff retry time is not used. If the delivery is remote, there are two possibilities, controlled by the -.cindex "&%delay_after_cutoff%&" +.oindex "&%delay_after_cutoff%&" &%delay_after_cutoff%& option of the &(smtp)& transport. The option is true by default. Until the post-cutoff retry time for one of the IP addresses is reached, the failing email address is bounced immediately, without a delivery @@ -21967,9 +23971,8 @@ If there is a continuous stream of messages for the failing domains, setting deliver to permanently failing IP addresses than when &%delay_after_cutoff%& is true. -.section "Deliveries that work intermittently" +.section "Deliveries that work intermittently" "SECID167" .cindex "retry" "intermittently working deliveries" -.new Some additional logic is needed to cope with cases where a host is intermittently available, or when a message has some attribute that prevents its delivery when others to the same address get through. In this situation, @@ -21993,7 +23996,6 @@ given address, a delivery is attempted for that address, even if it is not yet time, and if this delivery fails, the address is timed out. A new retry time is not computed in this case, so that other messages for the same address are considered immediately. -.wen .ecindex IIDretconf1 .ecindex IIDregconf2 @@ -22052,7 +24054,7 @@ includes the list of supported mechanisms. For example: &`$ `&&*&`telnet server.example 25`&*& &`Trying 192.168.34.25...`& &`Connected to server.example.`& -&`Escape character is '^]'.`& +&`Escape character is '^]'.`& &`220 server.example ESMTP Exim 4.20 ...`& &*&`ehlo client.example`&*& &`250-server.example Hello client.example [10.8.4.5]`& @@ -22070,14 +24072,24 @@ included by setting .code AUTH_CRAM_MD5=yes AUTH_CYRUS_SASL=yes +AUTH_DOVECOT=yes +AUTH_GSASL=yes +AUTH_HEIMDAL_GSSAPI=yes AUTH_PLAINTEXT=yes AUTH_SPA=yes .endd in &_Local/Makefile_&, respectively. The first of these supports the CRAM-MD5 authentication mechanism (RFC 2195), and the second provides an interface to -the Cyrus SASL authentication library. The third can be configured to support +the Cyrus SASL authentication library. +The third is an interface to Dovecot's authentication system, delegating the +work via a socket interface. +The fourth provides an interface to the GNU SASL authentication library, which +provides mechanisms but typically not data sources. +The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but +supporting setting a server keytab. +The sixth can be configured to support the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is -not formally documented, but used by several MUAs. The fourth authenticator +not formally documented, but used by several MUAs. The seventh authenticator supports Microsoft's &'Secure Password Authentication'& mechanism. The authenticators are configured using the same syntax as other drivers (see @@ -22110,12 +24122,49 @@ The remainder of this chapter covers the generic options for the authenticators, followed by general discussion of the way authentication works in Exim. +&*Beware:*& the meaning of &$auth1$&, &$auth2$&, ... varies on a per-driver and +per-mechanism basis. Please read carefully to determine which variables hold +account labels such as usercodes and which hold passwords or other +authenticating data. + +Note that some mechanisms support two different identifiers for accounts: the +&'authentication id'& and the &'authorization id'&. The contractions &'authn'& +and &'authz'& are commonly encountered. The American spelling is standard here. +Conceptually, authentication data such as passwords are tied to the identifier +used to authenticate; servers may have rules to permit one user to act as a +second user, so that after login the session is treated as though that second +user had logged in. That second user is the &'authorization id'&. A robust +configuration might confirm that the &'authz'& field is empty or matches the +&'authn'& field. Often this is just ignored. The &'authn'& can be considered +as verified data, the &'authz'& as an unverified request which the server might +choose to honour. +A &'realm'& is a text string, typically a domain name, presented by a server +to a client to help it select an account and credentials to use. In some +mechanisms, the client and server provably agree on the realm, but clients +typically can not treat the realm as secure data to be blindly trusted. -.section "Generic options for authenticators" + + +.section "Generic options for authenticators" "SECID168" .cindex "authentication" "generic options" .cindex "options" "generic; for authenticators" +.option client_condition authenticators string&!! unset +When Exim is authenticating as a client, it skips any authenticator whose +&%client_condition%& expansion yields &"0"&, &"no"&, or &"false"&. This can be +used, for example, to skip plain text authenticators when the connection is not +encrypted by a setting such as: +.code +client_condition = ${if !eq{$tls_out_cipher}{}} +.endd + + +.option client_set_id authenticators string&!! unset +When client authentication succeeds, this condition is expanded; the +result is used in the log lines for outbound messasges. +Typically it will be the user name used for authentication. + .option driver authenticators string unset This option must always be set. It specifies which of the available @@ -22139,6 +24188,26 @@ forced, and was not caused by a lookup defer, the incident is logged. See section &<>& below for further discussion. +.option server_condition authenticators string&!! unset +This option must be set for a &%plaintext%& server authenticator, where it +is used directly to control authentication. See section &<>& +for details. + +For the &(gsasl)& authenticator, this option is required for various +mechanisms; see chapter &<>& for details. + +For the other authenticators, &%server_condition%& can be used as an additional +authentication or authorization mechanism that is applied after the other +authenticator conditions succeed. If it is set, it is expanded when the +authenticator would otherwise return a success code. If the expansion is forced +to fail, authentication fails. Any other expansion failure causes a temporary +error code to be returned. If the result of a successful expansion is an empty +string, &"0"&, &"no"&, or &"false"&, authentication fails. If the result of the +expansion is &"1"&, &"yes"&, or &"true"&, authentication succeeds. For any +other result, a temporary error code is returned, with the expanded string as +the error text. + + .option server_debug_print authenticators string&!! unset If this option is set and authentication debugging is enabled (see the &%-d%& command line option), the string is expanded and included in the debugging @@ -22149,7 +24218,7 @@ output, and Exim carries on processing. .option server_set_id authenticators string&!! unset -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" When an Exim server successfully authenticates a client, this string is expanded using data from the authentication, and preserved for any incoming messages in the variable &$authenticated_id$&. It is also included in the log @@ -22184,7 +24253,7 @@ than EHLO), the use of AUTH= is a syntax error. .next If the value of the AUTH= parameter is &"<>"&, it is ignored. .next -.cindex "&$authenticated_sender$&" +.vindex "&$authenticated_sender$&" If &%acl_smtp_mailauth%& is defined, the ACL it specifies is run. While it is running, the value of &$authenticated_sender$& is set to the value obtained from the AUTH= parameter. If the ACL does not yield &"accept"&, the value of @@ -22212,7 +24281,7 @@ hosts to which Exim authenticates as a client. Do not confuse this value with &$authenticated_id$&, which is a string obtained from the authentication process, and which is not usually a complete email address. -.cindex "&$sender_address$&" +.vindex "&$sender_address$&" Whenever an AUTH= value is ignored, the incident is logged. The ACL for MAIL, if defined, is run after AUTH= is accepted or ignored. It can therefore make use of &$authenticated_sender$&. The converse is not true: the @@ -22251,13 +24320,13 @@ so that no authentication mechanisms are advertised to them. The &%server_advertise_condition%& controls the advertisement of individual authentication mechanisms. For example, it can be used to restrict the -advertisement of a patricular mechanism to encrypted connections, by a setting +advertisement of a particular mechanism to encrypted connections, by a setting such as: .code -server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}} +server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}} .endd -.cindex "&$tls_cipher$&" -If the session is encrypted, &$tls_cipher$& is not empty, and so the expansion +.vindex "&$tls_in_cipher$&" +If the session is encrypted, &$tls_in_cipher$& is not empty, and so the expansion yields &"yes"&, which allows the advertisement to happen. When an Exim server receives an AUTH command from a client, it rejects it @@ -22285,8 +24354,8 @@ the appropriate authentication protocol, and authentication either succeeds or fails. If there is no matching advertised mechanism, the AUTH command is rejected with a 504 error. -.cindex "&$received_protocol$&" -.cindex "&$sender_host_authenticated$&" +.vindex "&$received_protocol$&" +.vindex "&$sender_host_authenticated$&" When a message is received from an authenticated host, the value of &$received_protocol$& is set to &"esmtpa"& or &"esmtpsa"& instead of &"esmtp"& or &"esmtps"&, and &$sender_host_authenticated$& contains the name (not the @@ -22297,7 +24366,7 @@ no successful authentication. -.section "Testing server authentication" +.section "Testing server authentication" "SECID169" .cindex "authentication" "testing a server" .cindex "AUTH" "testing a server" .cindex "base64 encoding" "creating authentication test data" @@ -22346,7 +24415,7 @@ should check your version before relying on this suggestion. -.section "Authentication by an Exim client" +.section "Authentication by an Exim client" "SECID170" .cindex "authentication" "on an Exim client" The &(smtp)& transport has two options called &%hosts_require_auth%& and &%hosts_try_auth%&. When the &(smtp)& transport connects to a server that @@ -22354,20 +24423,19 @@ announces support for authentication, and the host matches an entry in either of these options, Exim (as a client) tries to authenticate as follows: .ilist -For each authenticator that is configured as a client, it searches the -authentication mechanisms announced by the server for one whose name -matches the public name of the authenticator. -.next -.cindex "&$host$&" -.cindex "&$host_address$&" -When it finds one that matches, it runs the authenticator's client code. -The variables &$host$& and &$host_address$& are available for any string -expansions that the client might do. They are set to the server's name and -IP address. If any expansion is forced to fail, the authentication attempt -is abandoned, -and Exim moves on to the next authenticator. -Otherwise an expansion failure causes delivery to be -deferred. +For each authenticator that is configured as a client, in the order in which +they are defined in the configuration, it searches the authentication +mechanisms announced by the server for one whose name matches the public name +of the authenticator. +.next +.vindex "&$host$&" +.vindex "&$host_address$&" +When it finds one that matches, it runs the authenticator's client code. The +variables &$host$& and &$host_address$& are available for any string expansions +that the client might do. They are set to the server's name and IP address. If +any expansion is forced to fail, the authentication attempt is abandoned, and +Exim moves on to the next authenticator. Otherwise an expansion failure causes +delivery to be deferred. .next If the result of the authentication attempt is a temporary error or a timeout, Exim abandons trying to send the message to the host for the moment. It will @@ -22418,32 +24486,34 @@ security risk; you are strongly advised to insist on the use of SMTP encryption use unencrypted plain text, you should not use the same passwords for SMTP connections as you do for login accounts. -.section "Using plaintext in a server" +.section "Plaintext options" "SECID171" .cindex "options" "&(plaintext)& authenticator (server)" -When running as a server, &(plaintext)& performs the authentication test by -expanding a string. It has the following options: +When configured as a server, &(plaintext)& uses the following options: + +.option server_condition authenticators string&!! unset +This is actually a global authentication option, but it must be set in order to +configure the &(plaintext)& driver as a server. Its use is described below. .option server_prompts plaintext string&!! unset The contents of this option, after expansion, must be a colon-separated list of prompt strings. If expansion fails, a temporary authentication rejection is given. -.option server_condition plaintext string&!! unset -This option must be set in order to configure the driver as a server. Its use -is described below. - +.section "Using plaintext in a server" "SECTplainserver" .cindex "AUTH" "in &(plaintext)& authenticator" .cindex "binary zero" "in &(plaintext)& authenticator" .cindex "numerical variables (&$1$& &$2$& etc)" &&& "in &(plaintext)& authenticator" -.cindex "&$auth1$&, &$auth2$&, etc" +.vindex "&$auth1$&, &$auth2$&, etc" .cindex "base64 encoding" "in &(plaintext)& authenticator" -The data sent by the client with the AUTH command, or in response to -subsequent prompts, is base64 encoded, and so may contain any byte values -when decoded. If any data is supplied with the command, it is treated as a -list of strings, separated by NULs (binary zeros), the first three of which are -placed in the expansion variables &$auth1$&, &$auth2$&, and &$auth3$& (neither -LOGIN nor PLAIN uses more than three strings). + +When running as a server, &(plaintext)& performs the authentication test by +expanding a string. The data sent by the client with the AUTH command, or in +response to subsequent prompts, is base64 encoded, and so may contain any byte +values when decoded. If any data is supplied with the command, it is treated as +a list of strings, separated by NULs (binary zeros), the first three of which +are placed in the expansion variables &$auth1$&, &$auth2$&, and &$auth3$& +(neither LOGIN nor PLAIN uses more than three strings). For compatibility with previous releases of Exim, the values are also placed in the expansion variables &$1$&, &$2$&, and &$3$&. However, the use of these @@ -22454,7 +24524,7 @@ If there are more strings in &%server_prompts%& than the number of strings supplied with the AUTH command, the remaining prompts are used to obtain more data. Each response from the client may be a list of NUL-separated strings. -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" Once a sufficient number of data strings have been received, &%server_condition%& is expanded. If the expansion is forced to fail, authentication fails. Any other expansion failure causes a temporary error code @@ -22471,7 +24541,7 @@ There are good and bad examples at the end of the next section. -.section "The PLAIN authentication mechanism" +.section "The PLAIN authentication mechanism" "SECID172" .cindex "PLAIN authentication mechanism" .cindex "authentication" "PLAIN mechanism" .cindex "binary zero" "in &(plaintext)& authenticator" @@ -22489,10 +24559,14 @@ fixed_plain: public_name = PLAIN server_prompts = : server_condition = \ - ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}\ - {yes}{no}} + ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}} server_set_id = $auth2 .endd +Note that the default result strings from &%if%& (&"true"& or an empty string) +are exactly what we want here, so they need not be specified. Obviously, if the +password contains expansion-significant characters such as dollar, backslash, +or closing brace, they have to be escaped. + The &%server_prompts%& setting specifies a single, empty prompt (empty items at the end of a string list are ignored). If all the data comes as part of the AUTH command, as is commonly the case, the prompt is not used. This @@ -22529,7 +24603,7 @@ this approach, where the passwords are looked up in a DBM file. &*Warning*&: This is an incorrect example: .code server_condition = \ - ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}{yes}{no}} + ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}} .endd The expansion uses the user name (&$auth2$&) as the key to look up a password, which it then compares to the supplied password (&$auth3$&). Why is this example @@ -22540,17 +24614,16 @@ the authentication, all a client has to do is to supply a non-existent user name and an empty password. The correct way of writing this test is: .code server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\ - {${if eq{$value}{$auth3}{yes}{no}}}{no}} + {${if eq{$value}{$auth3}}} {false}} .endd In this case, if the lookup succeeds, the result is checked; if the lookup -fails, authentication fails. If &%crypteq%& is being used instead of &%eq%&, -the first example is in fact safe, because &%crypteq%& always fails if its -second argument is empty. However, the second way of writing the test makes the -logic clearer. - +fails, &"false"& is returned and authentication fails. If &%crypteq%& is being +used instead of &%eq%&, the first example is in fact safe, because &%crypteq%& +always fails if its second argument is empty. However, the second way of +writing the test makes the logic clearer. -.section "The LOGIN authentication mechanism" +.section "The LOGIN authentication mechanism" "SECID173" .cindex "LOGIN authentication mechanism" .cindex "authentication" "LOGIN mechanism" The LOGIN authentication mechanism is not documented in any RFC, but is in use @@ -22563,8 +24636,7 @@ fixed_login: public_name = LOGIN server_prompts = User Name : Password server_condition = \ - ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}\ - {yes}{no}} + ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}} server_set_id = $auth1 .endd Because of the way plaintext operates, this authenticator accepts data supplied @@ -22582,21 +24654,24 @@ login: driver = plaintext public_name = LOGIN server_prompts = Username:: : Password:: - server_condition = ${if ldapauth \ - {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \ - pass=${quote:$auth2} \ - ldap://ldap.example.org/}{yes}{no}} + server_condition = ${if and{{ \ + !eq{}{$auth1} }{ \ + ldapauth{\ + user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \ + pass=${quote:$auth2} \ + ldap://ldap.example.org/} }} } server_set_id = uid=$auth1,ou=people,o=example.org .endd -Note the use of the &%quote_ldap_dn%& operator to correctly quote the DN for -authentication. However, the basic &%quote%& operator, rather than any of the -LDAP quoting operators, is the correct one to use for the password, because -quoting is needed only to make the password conform to the Exim syntax. At the -LDAP level, the password is an uninterpreted string. - +We have to check that the username is not empty before using it, because LDAP +does not permit empty DN components. We must also use the &%quote_ldap_dn%& +operator to correctly quote the DN for authentication. However, the basic +&%quote%& operator, rather than any of the LDAP quoting operators, is the +correct one to use for the password, because quoting is needed only to make +the password conform to the Exim syntax. At the LDAP level, the password is an +uninterpreted string. -.section "Support for different kinds of authentication" +.section "Support for different kinds of authentication" "SECID174" A number of string expansion features are provided for the purpose of interfacing to different ways of user authentication. These include checking traditionally encrypted passwords from &_/etc/passwd_& (or equivalent), PAM, @@ -22606,7 +24681,7 @@ Radius, &%ldapauth%&, &'pwcheck'&, and &'saslauthd'&. For details see section -.section "Using plaintext in a client" +.section "Using plaintext in a client" "SECID175" .cindex "options" "&(plaintext)& authenticator (client)" The &(plaintext)& authenticator has two client options: @@ -22667,7 +24742,7 @@ prompts. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The cram_md5 authenticator" +.chapter "The cram_md5 authenticator" "CHID9" .scindex IIDcramauth1 "&(cram_md5)& authenticator" .scindex IIDcramauth2 "authenticators" "&(cram_md5)&" .cindex "CRAM-MD5 authentication mechanism" @@ -22681,7 +24756,7 @@ secure than &(plaintext)&. However, the downside is that the secret has to be available in plain text at either end. -.section "Using cram_md5 as a server" +.section "Using cram_md5 as a server" "SECID176" .cindex "options" "&(cram_md5)& authenticator (server)" This authenticator has one server option, which must be set to configure the authenticator as a server: @@ -22711,22 +24786,35 @@ fixed_cram: server_secret = ${if eq{$auth1}{ph10}{secret}fail} server_set_id = $auth1 .endd -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" If authentication succeeds, the setting of &%server_set_id%& preserves the user -name in &$authenticated_id$&. A more tyical configuration might look up the +name in &$authenticated_id$&. A more typical configuration might look up the secret string in a file, using the user name as the key. For example: .code lookup_cram: driver = cram_md5 public_name = CRAM-MD5 - server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail} + server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\ + {$value}fail} server_set_id = $auth1 .endd Note that this expansion explicitly forces failure if the lookup fails -because &$1$& contains an unknown user name. +because &$auth1$& contains an unknown user name. +As another example, if you wish to re-use a Cyrus SASL sasldb2 file without +using the relevant libraries, you need to know the realm to specify in the +lookup and then ask for the &"userPassword"& attribute for that user in that +realm, with: +.code +cyrusless_crammd5: + driver = cram_md5 + public_name = CRAM-MD5 + server_secret = ${lookup{$auth1:mail.example.org:userPassword}\ + dbmjz{/etc/sasldb2}} + server_set_id = $auth1 +.endd -.section "Using cram_md5 as a client" +.section "Using cram_md5 as a client" "SECID177" .cindex "options" "&(cram_md5)& authenticator (client)" When used as a client, the &(cram_md5)& authenticator has two options: @@ -22742,8 +24830,8 @@ This option must be set for the authenticator to work as a client. Its value is expanded and the result used as the secret string when computing the response. -.cindex "&$host$&" -.cindex "&$host_address$&" +.vindex "&$host$&" +.vindex "&$host_address$&" Different user names and secrets can be used for different servers by referring to &$host$& or &$host_address$& in the options. Forced failure of either expansion string is treated as an indication that this authenticator is not @@ -22768,10 +24856,11 @@ fixed_cram: . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "The cyrus_sasl authenticator" +.chapter "The cyrus_sasl authenticator" "CHID10" .scindex IIDcyrauth1 "&(cyrus_sasl)& authenticator" .scindex IIDcyrauth2 "authenticators" "&(cyrus_sasl)&" .cindex "Cyrus" "SASL library" +.cindex "Kerberos" The code for this authenticator was provided by Matthew Byng-Maddick of A L Digital Ltd (&url(http://www.aldigital.co.uk)). @@ -22792,8 +24881,24 @@ user, and that the Cyrus SASL library has no way of escalating privileges by default. You may also find you need to set environment variables, depending on the driver you are using. +The application name provided by Exim is &"exim"&, so various SASL options may +be set in &_exim.conf_& in your SASL directory. If you are using GSSAPI for +Kerberos, note that because of limitations in the GSSAPI interface, +changing the server keytab might need to be communicated down to the Kerberos +layer independently. The mechanism for doing so is dependent upon the Kerberos +implementation. + +For example, for older releases of Heimdal, the environment variable KRB5_KTNAME +may be set to point to an alternative keytab file. Exim will pass this +variable through from its own inherited environment when started as root or the +Exim user. The keytab file needs to be readable by the Exim user. +With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the +environment variable. In practice, for those releases, the Cyrus authenticator +is not a suitable interface for GSSAPI (Kerberos) support. Instead, consider +the &(heimdal_gssapi)& authenticator, described in chapter &<>& + -.section "Using cyrus_sasl as a server" +.section "Using cyrus_sasl as a server" "SECID178" The &(cyrus_sasl)& authenticator has four private options. It puts the username (on a successful authentication) into &$auth1$&. For compatibility with previous releases of Exim, the username is also placed in &$1$&. However, the @@ -22802,16 +24907,17 @@ confusion in string expansions that also use numeric variables for other things. -.option server_hostname cyrus_sasl string&!! &`$primary_hostname`& -This option selects the hostname that is used when communicating with -the library. It is up to the underlying SASL plug-in what it does with -this data. +.option server_hostname cyrus_sasl string&!! "see below" +This option selects the hostname that is used when communicating with the +library. The default value is &`$primary_hostname`&. It is up to the underlying +SASL plug-in what it does with this data. -.option server_mech cyrus_sasl string &`public_name`& -This option selects the authentication mechanism this driver should -use. It allows you to use a different underlying mechanism from the -advertised name. For example: +.option server_mech cyrus_sasl string "see below" +This option selects the authentication mechanism this driver should use. The +default is the value of the generic &%public_name%& option. This option allows +you to use a different underlying mechanism from the advertised name. For +example: .code sasl: driver = cyrus_sasl @@ -22820,7 +24926,7 @@ sasl: server_set_id = $auth1 .endd -.option server_realm cyrus_sasl string unset +.option server_realm cyrus_sasl string&!! unset This specifies the SASL realm that the server claims to be in. @@ -22841,7 +24947,7 @@ sasl_cram_md5: sasl_plain: driver = cyrus_sasl public_name = PLAIN - server_set_id = $auth1 + server_set_id = $auth2 .endd Cyrus SASL does implement the LOGIN authentication method, even though it is not a standard method. It is disabled by default in the source distribution, @@ -22852,6 +24958,253 @@ but it is present in many binary distributions. +. //////////////////////////////////////////////////////////////////////////// +. //////////////////////////////////////////////////////////////////////////// +.chapter "The dovecot authenticator" "CHAPdovecot" +.scindex IIDdcotauth1 "&(dovecot)& authenticator" +.scindex IIDdcotauth2 "authenticators" "&(dovecot)&" +This authenticator is an interface to the authentication facility of the +Dovecot POP/IMAP server, which can support a number of authentication methods. +If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful +to use the same mechanisms for SMTP authentication. This is a server +authenticator only. There is only one option: + +.option server_socket dovecot string unset + +This option must specify the socket that is the interface to Dovecot +authentication. The &%public_name%& option must specify an authentication +mechanism that Dovecot is configured to support. You can have several +authenticators for different mechanisms. For example: +.code +dovecot_plain: + driver = dovecot + public_name = PLAIN + server_socket = /var/run/dovecot/auth-client + server_set_id = $auth2 + +dovecot_ntlm: + driver = dovecot + public_name = NTLM + server_socket = /var/run/dovecot/auth-client + server_set_id = $auth1 +.endd +If the SMTP connection is encrypted, or if &$sender_host_address$& is equal to +&$received_ip_address$& (that is, the connection is local), the &"secured"& +option is passed in the Dovecot authentication command. If, for a TLS +connection, a client certificate has been verified, the &"valid-client-cert"& +option is passed. When authentication succeeds, the identity of the user +who authenticated is placed in &$auth1$&. +.ecindex IIDdcotauth1 +.ecindex IIDdcotauth2 + + +. //////////////////////////////////////////////////////////////////////////// +. //////////////////////////////////////////////////////////////////////////// +.chapter "The gsasl authenticator" "CHAPgsasl" +.scindex IIDgsaslauth1 "&(gsasl)& authenticator" +.scindex IIDgsaslauth2 "authenticators" "&(gsasl)&" +.cindex "authentication" "GNU SASL" +.cindex "authentication" "SASL" +.cindex "authentication" "EXTERNAL" +.cindex "authentication" "ANONYMOUS" +.cindex "authentication" "PLAIN" +.cindex "authentication" "LOGIN" +.cindex "authentication" "DIGEST-MD5" +.cindex "authentication" "CRAM-MD5" +.cindex "authentication" "SCRAM-SHA-1" +The &(gsasl)& authenticator provides server integration for the GNU SASL +library and the mechanisms it provides. This is new as of the 4.80 release +and there are a few areas where the library does not let Exim smoothly +scale to handle future authentication mechanisms, so no guarantee can be +made that any particular new authentication mechanism will be supported +without code changes in Exim. + + +.option server_channelbinding gsasl boolean false +Some authentication mechanisms are able to use external context at both ends +of the session to bind the authentication to that context, and fail the +authentication process if that context differs. Specifically, some TLS +ciphersuites can provide identifying information about the cryptographic +context. + +This means that certificate identity and verification becomes a non-issue, +as a man-in-the-middle attack will cause the correct client and server to +see different identifiers and authentication will fail. + +This is currently only supported when using the GnuTLS library. This is +only usable by mechanisms which support "channel binding"; at time of +writing, that's the SCRAM family. + +This defaults off to ensure smooth upgrade across Exim releases, in case +this option causes some clients to start failing. Some future release +of Exim may switch the default to be true. + + +.option server_hostname gsasl string&!! "see below" +This option selects the hostname that is used when communicating with the +library. The default value is &`$primary_hostname`&. +Some mechanisms will use this data. + + +.option server_mech gsasl string "see below" +This option selects the authentication mechanism this driver should use. The +default is the value of the generic &%public_name%& option. This option allows +you to use a different underlying mechanism from the advertised name. For +example: +.code +sasl: + driver = gsasl + public_name = X-ANYTHING + server_mech = CRAM-MD5 + server_set_id = $auth1 +.endd + + +.option server_password gsasl string&!! unset +Various mechanisms need access to the cleartext password on the server, so +that proof-of-possession can be demonstrated on the wire, without sending +the password itself. + +The data available for lookup varies per mechanism. +In all cases, &$auth1$& is set to the &'authentication id'&. +The &$auth2$& variable will always be the &'authorization id'& (&'authz'&) +if available, else the empty string. +The &$auth3$& variable will always be the &'realm'& if available, +else the empty string. + +A forced failure will cause authentication to defer. + +If using this option, it may make sense to set the &%server_condition%& +option to be simply "true". + + +.option server_realm gsasl string&!! unset +This specifies the SASL realm that the server claims to be in. +Some mechanisms will use this data. + + +.option server_scram_iter gsasl string&!! unset +This option provides data for the SCRAM family of mechanisms. +&$auth1$& is not available at evaluation time. +(This may change, as we receive feedback on use) + + +.option server_scram_salt gsasl string&!! unset +This option provides data for the SCRAM family of mechanisms. +&$auth1$& is not available at evaluation time. +(This may change, as we receive feedback on use) + + +.option server_service gsasl string &`smtp`& +This is the SASL service that the server claims to implement. +Some mechanisms will use this data. + + +.section "&(gsasl)& auth variables" "SECTgsaslauthvar" +.vindex "&$auth1$&, &$auth2$&, etc" +These may be set when evaluating specific options, as detailed above. +They will also be set when evaluating &%server_condition%&. + +Unless otherwise stated below, the &(gsasl)& integration will use the following +meanings for these variables: + +.ilist +.vindex "&$auth1$&" +&$auth1$&: the &'authentication id'& +.next +.vindex "&$auth2$&" +&$auth2$&: the &'authorization id'& +.next +.vindex "&$auth3$&" +&$auth3$&: the &'realm'& +.endlist + +On a per-mechanism basis: + +.ilist +.cindex "authentication" "EXTERNAL" +EXTERNAL: only &$auth1$& is set, to the possibly empty &'authorization id'&; +the &%server_condition%& option must be present. +.next +.cindex "authentication" "ANONYMOUS" +ANONYMOUS: only &$auth1$& is set, to the possibly empty &'anonymous token'&; +the &%server_condition%& option must be present. +.next +.cindex "authentication" "GSSAPI" +GSSAPI: &$auth1$& will be set to the &'GSSAPI Display Name'&; +&$auth2$& will be set to the &'authorization id'&, +the &%server_condition%& option must be present. +.endlist + +An &'anonymous token'& is something passed along as an unauthenticated +identifier; this is analogous to FTP anonymous authentication passing an +email address, or software-identifier@, as the "password". + + +An example showing the password having the realm specified in the callback +and demonstrating a Cyrus SASL to GSASL migration approach is: +.code +gsasl_cyrusless_crammd5: + driver = gsasl + public_name = CRAM-MD5 + server_realm = imap.example.org + server_password = ${lookup{$auth1:$auth3:userPassword}\ + dbmjz{/etc/sasldb2}{$value}fail} + server_set_id = ${quote:$auth1} + server_condition = yes +.endd + + +. //////////////////////////////////////////////////////////////////////////// +. //////////////////////////////////////////////////////////////////////////// + +.chapter "The heimdal_gssapi authenticator" "CHAPheimdalgss" +.scindex IIDheimdalgssauth1 "&(heimdal_gssapi)& authenticator" +.scindex IIDheimdalgssauth2 "authenticators" "&(heimdal_gssapi)&" +.cindex "authentication" "GSSAPI" +.cindex "authentication" "Kerberos" +The &(heimdal_gssapi)& authenticator provides server integration for the +Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname +reliably. + +.option server_hostname heimdal_gssapi string&!! "see below" +This option selects the hostname that is used, with &%server_service%&, +for constructing the GSS server name, as a &'GSS_C_NT_HOSTBASED_SERVICE'& +identifier. The default value is &`$primary_hostname`&. + +.option server_keytab heimdal_gssapi string&!! unset +If set, then Heimdal will not use the system default keytab (typically +&_/etc/krb5.keytab_&) but instead the pathname given in this option. +The value should be a pathname, with no &"file:"& prefix. + +.option server_service heimdal_gssapi string&!! "smtp" +This option specifies the service identifier used, in conjunction with +&%server_hostname%&, for building the identifer for finding credentials +from the keytab. + + +.section "&(heimdal_gssapi)& auth variables" "SECTheimdalgssauthvar" +Beware that these variables will typically include a realm, thus will appear +to be roughly like an email address already. The &'authzid'& in &$auth2$& is +not verified, so a malicious client can set it to anything. + +The &$auth1$& field should be safely trustable as a value from the Key +Distribution Center. Note that these are not quite email addresses. +Each identifier is for a role, and so the left-hand-side may include a +role suffix. For instance, &"joe/admin@EXAMPLE.ORG"&. + +.vindex "&$auth1$&, &$auth2$&, etc" +.ilist +.vindex "&$auth1$&" +&$auth1$&: the &'authentication id'&, set to the GSS Display Name. +.next +.vindex "&$auth2$&" +&$auth2$&: the &'authorization id'&, sent within SASL encapsulation after +authentication. If that was empty, this will also be set to the +GSS Display Name. +.endlist + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -22884,7 +25237,7 @@ Encryption is used to protect the password in transit. -.section "Using spa as a server" +.section "Using spa as a server" "SECID179" .cindex "options" "&(spa)& authenticator (server)" The &(spa)& authenticator has just one server option: @@ -22910,7 +25263,7 @@ failure causes a temporary error code to be returned. -.section "Using spa as a client" +.section "Using spa as a client" "SECID180" .cindex "options" "&(spa)& authenticator (client)" The &(spa)& authenticator has the following client options: @@ -22981,7 +25334,8 @@ in order to get TLS to work. -.section "Support for the legacy &""ssmtp""& (aka &""smtps""&) protocol" +.section "Support for the legacy &""ssmtp""& (aka &""smtps""&) protocol" &&& + "SECID284" .cindex "ssmtp protocol" .cindex "smtps protocol" .cindex "SMTP" "ssmtp protocol" @@ -22992,7 +25346,7 @@ waiting for a STARTTLS command from the client using the standard SMTP port. The protocol was called &"ssmtp"& or &"smtps"&, and port 465 was allocated for this purpose. -This approach was abandoned when encrypted SMTP was standardised, but there are +This approach was abandoned when encrypted SMTP was standardized, but there are still some legacy clients that use it. Exim supports these clients by means of the &%tls_on_connect_ports%& global option. Its value must be a list of port numbers; the most common use is expected to be: @@ -23035,34 +25389,54 @@ There are some differences in usage when using GnuTLS instead of OpenSSL: The &%tls_verify_certificates%& option must contain the name of a file, not the name of a directory (for OpenSSL it can be either). .next -The &%tls_dhparam%& option is ignored, because early versions of GnuTLS had no -facility for varying its Diffie-Hellman parameters. I understand that this has -changed, but Exim has not been updated to provide this facility. +The default value for &%tls_dhparam%& differs for historical reasons. .next -.cindex "&$tls_peerdn$&" +.vindex "&$tls_in_peerdn$&" +.vindex "&$tls_out_peerdn$&" Distinguished Name (DN) strings reported by the OpenSSL library use a slash for separating fields; GnuTLS uses commas, in accordance with RFC 2253. This -affects the value of the &$tls_peerdn$& variable. +affects the value of the &$tls_in_peerdn$& and &$tls_out_peerdn$& variables. .next OpenSSL identifies cipher suites using hyphens as separators, for example: -DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is -more, OpenSSL complains if underscores are present in a cipher list. To make -life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to -underscores for GnuTLS when processing lists of cipher suites in the +DES-CBC3-SHA. GnuTLS historically used underscores, for example: +RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present +in a cipher list. To make life simpler, Exim changes underscores to hyphens +for OpenSSL and passes the string unchanged to GnuTLS (expecting the library +to handle its own older variants) when processing lists of cipher suites in the &%tls_require_ciphers%& options (the global option and the &(smtp)& transport option). .next The &%tls_require_ciphers%& options operate differently, as described in the sections &<>& and &<>&. +.next +.new +The &%tls_dh_min_bits%& SMTP transport option is only honoured by GnuTLS. +When using OpenSSL, this option is ignored. +(If an API is found to let OpenSSL be configured in this way, +let the Exim Maintainers know and we'll likely use it). +.wen +.next +Some other recently added features may only be available in one or the other. +This should be documented with the feature. If the documentation does not +explicitly state that the feature is infeasible in the other TLS +implementation, then patches are welcome. .endlist -.section "GnuTLS parameter computation" -GnuTLS uses RSA and D-H parameters that take a substantial amount of time to -compute. It is unreasonable to re-compute them for every TLS session. +.section "GnuTLS parameter computation" "SECTgnutlsparam" +This section only applies if &%tls_dhparam%& is set to &`historic`& or to +an explicit path; if the latter, then the text about generation still applies, +but not the chosen filename. +By default, as of Exim 4.80 a hard-coded D-H prime is used. +See the documentation of &%tls_dhparam%& for more information. + +GnuTLS uses D-H parameters that may take a substantial amount of time +to compute. It is unreasonable to re-compute them for every TLS session. Therefore, Exim keeps this data in a file in its spool directory, called -&_gnutls-params_&. The file is owned by the Exim user and is readable only by -its owner. Every Exim process that start up GnuTLS reads the RSA and D-H +&_gnutls-params-NNNN_& for some value of NNNN, corresponding to the number +of bits requested. +The file is owned by the Exim user and is readable only by +its owner. Every Exim process that start up GnuTLS reads the D-H parameters from this file. If the file does not exist, the first Exim process that needs it computes the data and writes it to a temporary file which is renamed once it is complete. It does not matter if several Exim processes do @@ -23071,6 +25445,10 @@ place, new Exim processes immediately start using it. For maximum security, the parameters that are stored in this file should be recalculated periodically, the frequency depending on your paranoia level. +If you are avoiding using the fixed D-H primes published in RFCs, then you +are concerned about some advanced attacks and will wish to do this; if you do +not regenerate then you might as well stick to the standard primes. + Arranging this is easy in principle; just delete the file when you want new values to be computed. However, there may be a problem. The calculation of new parameters needs random numbers, and these are obtained from &_/dev/random_&. @@ -23079,35 +25457,66 @@ until enough randomness (entropy) is available. This may cause Exim to hang for a substantial amount of time, causing timeouts on incoming connections. The solution is to generate the parameters externally to Exim. They are stored -in &_gnutls-params_& in PEM format, which means that they can be generated -externally using the &(certtool)& command that is part of GnuTLS. +in &_gnutls-params-N_& in PEM format, which means that they can be +generated externally using the &(certtool)& command that is part of GnuTLS. To replace the parameters with new ones, instead of deleting the file and letting Exim re-create it, you can generate new parameters using &(certtool)& and, when this has been done, replace Exim's cache file by renaming. The relevant commands are something like this: .code +# ls +[ look for file; assume gnutls-params-2236 is the most recent ] # rm -f new-params # touch new-params # chown exim:exim new-params +# chmod 0600 new-params +# certtool --generate-dh-params --bits 2236 >>new-params +# openssl dhparam -noout -text -in new-params | head +[ check the first line, make sure it's not more than 2236; + if it is, then go back to the start ("rm") and repeat + until the size generated is at most the size requested ] # chmod 0400 new-params -# certtool --generate-privkey --bits 512 >new-params -# echo "" >>new-params -# certtool --generate-dh-params --bits 1024 >> new-params -# mv new-params gnutls-params +# mv new-params gnutls-params-2236 .endd If Exim never has to generate the parameters itself, the possibility of stalling is removed. +The filename changed in Exim 4.80, to gain the -bits suffix. The value which +Exim will choose depends upon the version of GnuTLS in use. For older GnuTLS, +the value remains hard-coded in Exim as 1024. As of GnuTLS 2.12.x, there is +a way for Exim to ask for the "normal" number of bits for D-H public-key usage, +and Exim does so. This attempt to remove Exim from TLS policy decisions +failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit +of the NSS library. Thus Exim gains the &%tls_dh_max_bits%& global option, +which applies to all D-H usage, client or server. If the value returned by +GnuTLS is greater than &%tls_dh_max_bits%& then the value will be clamped down +to &%tls_dh_max_bits%&. The default value has been set at the current NSS +limit, which is still much higher than Exim historically used. + +The filename and bits used will change as the GnuTLS maintainers change the +value for their parameter &`GNUTLS_SEC_PARAM_NORMAL`&, as clamped by +&%tls_dh_max_bits%&. At the time of writing (mid 2012), GnuTLS 2.12 recommends +2432 bits, while NSS is limited to 2236 bits. + +In fact, the requested value will be *lower* than &%tls_dh_max_bits%&, to +increase the chance of the generated prime actually being within acceptable +bounds, as GnuTLS has been observed to overshoot. Note the check step in the +procedure above. There is no sane procedure available to Exim to double-check +the size of the generated prime, so it might still be too large. + .section "Requiring specific ciphers in OpenSSL" "SECTreqciphssl" .cindex "TLS" "requiring specific ciphers (OpenSSL)" -.cindex "&%tls_require_ciphers%&" "OpenSSL" +.oindex "&%tls_require_ciphers%&" "OpenSSL" There is a function in the OpenSSL library that can be passed a list of cipher suites before the cipher negotiation takes place. This specifies which ciphers are acceptable. The list is colon separated and may contain names like DES-CBC3-SHA. Exim passes the expanded value of &%tls_require_ciphers%& -directly to this function call. The following quotation from the OpenSSL +directly to this function call. +Many systems will install the OpenSSL manual-pages, so you may have +&'ciphers(1)'& available to you. +The following quotation from the OpenSSL documentation specifies what forms of item are allowed in the cipher string: .ilist @@ -23144,60 +25553,80 @@ includes any ciphers already present they will be ignored: that is, they will not be moved to the end of the list. .endlist +The OpenSSL &'ciphers(1)'& command may be used to test the results of a given +string: +.code +# note single-quotes to get ! past any shell history expansion +$ openssl ciphers 'HIGH:!MD5:!SHA1' +.endd +This example will let the library defaults be permitted on the MX port, where +there's probably no identity verification anyway, but ups the ante on the +submission ports where the administrator might have some influence on the +choice of clients used: +.code +# OpenSSL variant; see man ciphers(1) +tls_require_ciphers = ${if =={$received_port}{25}\ + {DEFAULT}\ + {HIGH:!MD5:!SHA1}} +.endd -.section "Requiring specific ciphers in GnuTLS" "SECTreqciphgnu" -.cindex "TLS" "requiring specific ciphers (GnuTLS)" -.cindex "&%tls_require_ciphers%&" "GnuTLS" -The GnuTLS library does not have a combined function like OpenSSL. Instead, -it allows the caller to specify separate lists of key-exchange methods, -main cipher algorithms, and MAC algorithms. Unfortunately, these lists are -numerical, and the library does not have a function for turning names into -numbers. Consequently, the list of recognized names has to be built into -the application. -At present, Exim permits only the list of main cipher algorithms to be -changed. The &%tls_require_ciphers%& option is in the same format as for -OpenSSL. Exim searches each item for the name of available algorithm. For -example, if the list contains RSA_AES_SHA then AES is recognized. +.section "Requiring specific ciphers or other parameters in GnuTLS" &&& + "SECTreqciphgnu" +.cindex "GnuTLS" "specifying parameters for" +.cindex "TLS" "specifying ciphers (GnuTLS)" +.cindex "TLS" "specifying key exchange methods (GnuTLS)" +.cindex "TLS" "specifying MAC algorithms (GnuTLS)" +.cindex "TLS" "specifying protocols (GnuTLS)" +.cindex "TLS" "specifying priority string (GnuTLS)" +.oindex "&%tls_require_ciphers%&" "GnuTLS" +The GnuTLS library allows the caller to provide a "priority string", documented +as part of the &[gnutls_priority_init]& function. This is very similar to the +ciphersuite specification in OpenSSL. -The cipher algorithms list starts out with a default set of algorithms. If -the first item in &%tls_require_ciphers%& does &'not'& start with an -exclamation mark, all the default items are deleted. Thus, only those specified -can be used. If the first item in &%tls_require_ciphers%& &'does'& start with -an exclamation mark, the defaults are left on the list. +The &%tls_require_ciphers%& option is treated as the GnuTLS priority string. -Then, any item that starts with an exclamation mark causes the relevant -algorithms to be removed from the list, and any item that does not start -with an exclamation mark causes the relevant algorithms to be added to the -list. Thus, -.code -tls_require_ciphers = !RSA_ARCFOUR_SHA -.endd -allows all the defaults except those that use ARCFOUR, whereas -.code -tls_require_ciphers = AES : 3DES -.endd -allows only cipher suites that use AES and 3DES. The currently recognized -algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and -ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the -list is unimportant; the server will advertise the availability of all the -relevant cipher suites. However, in a client, the order of the list specifies a -preference order for the algorithms. The first one in the client's list that is -also advertised by the server is tried first. The default order is as listed -above. +The &%tls_require_ciphers%& option is available both as an global option, +controlling how Exim behaves as a server, and also as an option of the +&(smtp)& transport, controlling how Exim behaves as a client. In both cases +the value is string expanded. The resulting string is not an Exim list and +the string is given to the GnuTLS library, so that Exim does not need to be +aware of future feature enhancements of GnuTLS. +Documentation of the strings accepted may be found in the GnuTLS manual, under +"Priority strings". This is online as +&url(http://www.gnu.org/software/gnutls/manual/html_node/Priority-Strings.html), +but beware that this relates to GnuTLS 3, which may be newer than the version +installed on your system. If you are using GnuTLS 3, +&url(http://www.gnu.org/software/gnutls/manual/html_node/Listing-the-ciphersuites-in-a-priority-string.html, then the example code) +on that site can be used to test a given string. +Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three +additional options, "&%gnutls_require_kx%&", "&%gnutls_require_mac%&" and +"&%gnutls_require_protocols%&". &%tls_require_ciphers%& was an Exim list. + +This example will let the library defaults be permitted on the MX port, where +there's probably no identity verification anyway, and lowers security further +by increasing compatibility; but this ups the ante on the submission ports +where the administrator might have some influence on the choice of clients +used: +.code +# GnuTLS variant +tls_require_ciphers = ${if =={$received_port}{25}\ + {NORMAL:%COMPAT}\ + {SECURE128}} +.endd -.section "Configuring an Exim server to use TLS" +.section "Configuring an Exim server to use TLS" "SECID182" .cindex "TLS" "configuring an Exim server" When Exim has been built with TLS support, it advertises the availability of the STARTTLS command to client hosts that match &%tls_advertise_hosts%&, but not to any others. The default value of this option is unset, which means that STARTTLS is not advertised at all. This default is chosen because you -need to set some other options in order to make TLS avaliable, and also it is +need to set some other options in order to make TLS available, and also it is sensible for systems that want to use TLS only as a client. If a client issues a STARTTLS command and there is some configuration @@ -23248,13 +25677,22 @@ this). There is one other option that may be needed in other situations. If tls_dhparam = /some/file/name .endd is set, the SSL library is initialized for the use of Diffie-Hellman ciphers -with the parameters contained in the file. This increases the set of cipher -suites that the server supports. See the command +with the parameters contained in the file. +Set this to &`none`& to disable use of DH entirely, by making no prime +available: +.code +tls_dhparam = none +.endd +This may also be set to a string identifying a standard prime to be used for +DH; if it is set to &`default`& or, for OpenSSL, is unset, then the prime +used is &`ike23`&. There are a few standard primes available, see the +documetnation for &%tls_dhparam%& for the complete list. + +See the command .code openssl dhparam .endd -for a way of generating this data. At present, &%tls_dhparam%& is used only -when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used. +for a way of generating file data. The strings supplied for these three options are expanded every time a client host connects. It is therefore possible to use different certificates and keys @@ -23264,24 +25702,26 @@ forced to fail, Exim behaves as if the option is not set. .cindex "cipher" "logging" .cindex "log" "TLS cipher" -.cindex "&$tls_cipher$&" -The variable &$tls_cipher$& is set to the cipher suite that was negotiated for +.vindex "&$tls_in_cipher$&" +The variable &$tls_in_cipher$& is set to the cipher suite that was negotiated for an incoming TLS connection. It is included in the &'Received:'& header of an incoming message (by default &-- you can, of course, change this), and it is also included in the log line that records a message's arrival, keyed by &"X="&, unless the &%tls_cipher%& log selector is turned off. The &%encrypted%& condition can be used to test for specific cipher suites in ACLs. -The ACLs that run for subsequent SMTP commands can check the name of the cipher -suite and vary their actions accordingly. The cipher suite names are those used -by OpenSSL. These may differ from the names used elsewhere. For example, -OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts -is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL +Once TLS has been established, the ACLs that run for subsequent SMTP commands +can check the name of the cipher suite and vary their actions accordingly. The +cipher suite names vary, depending on which TLS library is being used. For +example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other +contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS documentation for more details. +For outgoing SMTP deliveries, &$tls_out_cipher$& is used and logged +(again depending on the &%tls_cipher%& log selector). -.section "Requesting and verifying client certificates" +.section "Requesting and verifying client certificates" "SECID183" .cindex "certificate" "verification of client" .cindex "TLS" "client certificate verification" If you want an Exim server to request a certificate when negotiating a TLS @@ -23316,20 +25756,20 @@ fact that no certificate was verified, and vary their actions accordingly. For example, you can insist on a certificate before accepting a message for relaying, but not when the message is destined for local delivery. -.cindex "&$tls_peerdn$&" +.vindex "&$tls_in_peerdn$&" When a client supplies a certificate (whether it verifies or not), the value of the Distinguished Name of the certificate is made available in the variable -&$tls_peerdn$& during subsequent processing of the message. +&$tls_in_peerdn$& during subsequent processing of the message. .cindex "log" "distinguished name" Because it is often a long text string, it is not included in the log line or &'Received:'& header by default. You can arrange for it to be logged, keyed by &"DN="&, by setting the &%tls_peerdn%& log selector, and you can use &%received_header_text%& to change the &'Received:'& header. When no -certificate is supplied, &$tls_peerdn$& is empty. +certificate is supplied, &$tls_in_peerdn$& is empty. -.section "Revoked certificates" +.section "Revoked certificates" "SECID184" .cindex "TLS" "revoked certificates" .cindex "revocation list" .cindex "certificate" "revocation list" @@ -23341,7 +25781,7 @@ of the option is expanded and must then be the name of a file that contains a CRL in PEM format. -.section "Configuring an Exim client to use TLS" +.section "Configuring an Exim client to use TLS" "SECID185" .cindex "cipher" "logging" .cindex "log" "TLS cipher" .cindex "log" "distinguished name" @@ -23376,17 +25816,13 @@ negotiation fails, Exim closes the current connection (because it is in an unknown state), opens a new one to the same host, and then tries the delivery unencrypted. - The &%tls_certificate%& and &%tls_privatekey%& options of the &(smtp)& transport provide the client with a certificate, which is passed to the server if it requests it. If the server is Exim, it will request a certificate only if -&%tls_verify_hosts%& or &%tls_try_verify_hosts%& matches the client. &*Note*&: -These options must be set in the &(smtp)& transport for Exim to use TLS when it -is operating as a client. Exim does not assume that a server certificate (set -by the global options of the same name) should also be used when operating as a -client. +&%tls_verify_hosts%& or &%tls_try_verify_hosts%& matches the client. -If &%tls_verify_certificates%& is set, it must name a file or, +If the &%tls_verify_certificates%& option is set on the &(smtp)& transport, it +must name a file or, for OpenSSL only (not GnuTLS), a directory, that contains a collection of expected server certificates. The client verifies the server's certificate against this collection, taking into account any revoked certificates that are @@ -23398,13 +25834,104 @@ list of permitted cipher suites. If either of these checks fails, delivery to the current host is abandoned, and the &(smtp)& transport tries to deliver to alternative hosts, if any. -.cindex "&$host$&" -.cindex "&$host_address$&" + &*Note*&: +These options must be set in the &(smtp)& transport for Exim to use TLS when it +is operating as a client. Exim does not assume that a server certificate (set +by the global options of the same name) should also be used when operating as a +client. + +.vindex "&$host$&" +.vindex "&$host_address$&" All the TLS options in the &(smtp)& transport are expanded before use, with &$host$& and &$host_address$& containing the name and address of the server to which the client is connected. Forced failure of an expansion causes Exim to behave as if the relevant option were unset. +.vindex &$tls_out_bits$& +.vindex &$tls_out_cipher$& +.vindex &$tls_out_peerdn$& +.vindex &$tls_out_sni$& +Before an SMTP connection is established, the +&$tls_out_bits$&, &$tls_out_cipher$&, &$tls_out_peerdn$& and &$tls_out_sni$& +variables are emptied. (Until the first connection, they contain the values +that were set when the message was received.) If STARTTLS is subsequently +successfully obeyed, these variables are set to the relevant values for the +outgoing connection. + + + +.section "Use of TLS Server Name Indication" "SECTtlssni" +.cindex "TLS" "Server Name Indication" +.vindex "&$tls_in_sni$&" +.oindex "&%tls_in_sni%&" +With TLS1.0 or above, there is an extension mechanism by which extra +information can be included at various points in the protocol. One of these +extensions, documented in RFC 6066 (and before that RFC 4366) is +&"Server Name Indication"&, commonly &"SNI"&. This extension is sent by the +client in the initial handshake, so that the server can examine the servername +within and possibly choose to use different certificates and keys (and more) +for this session. + +This is analagous to HTTP's &"Host:"& header, and is the main mechanism by +which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP +address. + +With SMTP to MX, there are the same problems here as in choosing the identity +against which to validate a certificate: you can't rely on insecure DNS to +provide the identity which you then cryptographically verify. So this will +be of limited use in that environment. + +With SMTP to Submission, there is a well-defined hostname which clients are +connecting to and can validate certificates against. Thus clients &*can*& +choose to include this information in the TLS negotiation. If this becomes +wide-spread, then hosters can choose to present different certificates to +different clients. Or even negotiate different cipher suites. + +The &%tls_sni%& option on an SMTP transport is an expanded string; the result, +if not empty, will be sent on a TLS session as part of the handshake. There's +nothing more to it. Choosing a sensible value not derived insecurely is the +only point of caution. The &$tls_out_sni$& variable will be set to this string +for the lifetime of the client connection (including during authentication). + +Except during SMTP client sessions, if &$tls_in_sni$& is set then it is a string +received from a client. +It can be logged with the &%log_selector%& item &`+tls_sni`&. + +If the string &`tls_in_sni`& appears in the main section's &%tls_certificate%& +option (prior to expansion) then the following options will be re-expanded +during TLS session handshake, to permit alternative values to be chosen: + +.ilist +.vindex "&%tls_certificate%&" +&%tls_certificate%& +.next +.vindex "&%tls_crl%&" +&%tls_crl%& +.next +.vindex "&%tls_privatekey%&" +&%tls_privatekey%& +.next +.vindex "&%tls_verify_certificates%&" +&%tls_verify_certificates%& +.endlist + +Great care should be taken to deal with matters of case, various injection +attacks in the string (&`../`& or SQL), and ensuring that a valid filename +can always be referenced; it is important to remember that &$tls_sni$& is +arbitrary unverified data provided prior to authentication. + +The Exim developers are proceeding cautiously and so far no other TLS options +are re-expanded. + +When Exim is built againt OpenSSL, OpenSSL must have been built with support +for TLS Extensions. This holds true for OpenSSL 1.0.0+ and 0.9.8+ with +enable-tlsext in EXTRACONFIGURE. If you invoke &(openssl s_client -h)& and +see &`-servername`& in the output, then OpenSSL has support. + +When Exim is built against GnuTLS, SNI support is available as of GnuTLS +0.5.10. (Its presence predates the current API which Exim uses, so if Exim +built, then you have SNI support). + .section "Multiple messages on the same encrypted TCP/IP connection" &&& @@ -23463,7 +25990,7 @@ Some sample programs taken from the book are available from .endd -.section "Certificate chains" +.section "Certificate chains" "SECID186" The file named by &%tls_certificate%& may contain more than one certificate. This is useful in the case where the certificate that is being sent is validated by an intermediate certificate which the other end does @@ -23478,10 +26005,12 @@ root certificate along with the rest makes it available for the user to install if the receiving end is a client MUA that can interact with a user. -.section "Self-signed certificates" +.section "Self-signed certificates" "SECID187" .cindex "certificate" "self-signed" You can create a self-signed certificate using the &'req'& command provided with OpenSSL, like this: +. ==== Do not shorten the duration here without reading and considering +. ==== the text below. Please leave it at 9999 days. .code openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \ -days 9999 -nodes @@ -23494,6 +26023,22 @@ that you are prompted for, and any use that is made of the key causes more prompting for the passphrase. This is not helpful if you are going to use this certificate and key in an MTA, where prompting is not possible. +. ==== I expect to still be working 26 years from now. The less technical +. ==== debt I create, in terms of storing up trouble for my later years, the +. ==== happier I will be then. We really have reached the point where we +. ==== should start, at the very least, provoking thought and making folks +. ==== pause before proceeding, instead of leaving all the fixes until two +. ==== years before 2^31 seconds after the 1970 Unix epoch. +. ==== -pdp, 2012 +NB: we are now past the point where 9999 days takes us past the 32-bit Unix +epoch. If your system uses unsigned time_t (most do) and is 32-bit, then +the above command might produce a date in the past. Think carefully about +the lifetime of the systems you're deploying, and either reduce the duration +of the certificate or reconsider your platform deployment. (At time of +writing, reducing the duration is the most likely choice, but the inexorable +progression of time takes us steadily towards an era where this will not +be a sensible resolution). + A self-signed certificate made in this way is sufficient for testing, and may be adequate for all your requirements if you are mainly interested in encrypting transfers, and not in secure identification. @@ -23528,7 +26073,6 @@ name, terminated by a colon. Here is a complete ACL section that contains just one very small ACL: .code begin acl - small_acl: accept hosts = one.host.only .endd @@ -23545,7 +26089,7 @@ a realistic ACL for checking RCPT commands. This is discussed in chapter &<>&. -.section "Testing ACLs" +.section "Testing ACLs" "SECID188" The &%-bh%& command line option provides a way of testing your ACL configuration locally by running a fake SMTP session with which you interact. The host &'relay-test.mail-abuse.org'& provides a service for checking your @@ -23553,7 +26097,7 @@ relaying configuration (see section &<>& for more details). -.section "Specifying when ACLs are used" +.section "Specifying when ACLs are used" "SECID189" .cindex "&ACL;" "options for specifying" In order to cause an ACL to be used, you have to name it in one of the relevant options in the main part of the configuration. These options are: @@ -23564,29 +26108,33 @@ options in the main part of the configuration. These options are: .cindex "HELO" "ACL for" .cindex "EHLO" "ACL for" .cindex "MAIL" "ACL for" -.cindex "QUIT" "ACL for" +.cindex "QUIT, ACL for" .cindex "RCPT" "ACL for" -.cindex "STARTTLS" "ACL for" +.cindex "STARTTLS, ACL for" .cindex "VRFY" "ACL for" -.cindex "SMTP connection" "ACL for" -.cindex "non-smtp message" "ACL for" +.cindex "SMTP" "connection, ACL for" +.cindex "non-SMTP messages" "ACLs for" +.cindex "MIME content scanning" "ACL for" .table2 140pt -.row &~&%acl_not_smtp%& "ACL for non-SMTP messages" -.row &~&%acl_smtp_auth%& "ACL for AUTH" -.row &~&%acl_smtp_connect%& "ACL for start of SMTP connection" -.row &~&%acl_smtp_data%& "ACL after DATA is complete" -.row &~&%acl_smtp_etrn%& "ACL for ETRN" -.row &~&%acl_smtp_expn%& "ACL for EXPN" -.row &~&%acl_smtp_helo%& "ACL for HELO or EHLO" -.row &~&%acl_smtp_mail%& "ACL for MAIL" -.row &~&%acl_smtp_mailauth%& "ACL for the AUTH parameter of MAIL" -.row &~&%acl_smtp_mime%& "ACL for content-scanning MIME parts" -.row &~&%acl_smtp_predata%& "ACL at start of DATA command" -.row &~&%acl_smtp_quit%& "ACL for QUIT" -.row &~&%acl_smtp_rcpt%& "ACL for RCPT" -.row &~&%acl_smtp_starttls%& "ACL for STARTTLS" -.row &~&%acl_smtp_vrfy%& "ACL for VRFY" +.irow &%acl_not_smtp%& "ACL for non-SMTP messages" +.irow &%acl_not_smtp_mime%& "ACL for non-SMTP MIME parts" +.irow &%acl_not_smtp_start%& "ACL at start of non-SMTP message" +.irow &%acl_smtp_auth%& "ACL for AUTH" +.irow &%acl_smtp_connect%& "ACL for start of SMTP connection" +.irow &%acl_smtp_data%& "ACL after DATA is complete" +.irow &%acl_smtp_etrn%& "ACL for ETRN" +.irow &%acl_smtp_expn%& "ACL for EXPN" +.irow &%acl_smtp_helo%& "ACL for HELO or EHLO" +.irow &%acl_smtp_mail%& "ACL for MAIL" +.irow &%acl_smtp_mailauth%& "ACL for the AUTH parameter of MAIL" +.irow &%acl_smtp_mime%& "ACL for content-scanning MIME parts" +.irow &%acl_smtp_notquit%& "ACL for non-QUIT terminations" +.irow &%acl_smtp_predata%& "ACL at start of DATA command" +.irow &%acl_smtp_quit%& "ACL for QUIT" +.irow &%acl_smtp_rcpt%& "ACL for RCPT" +.irow &%acl_smtp_starttls%& "ACL for STARTTLS" +.irow &%acl_smtp_vrfy%& "ACL for VRFY" .endtable For example, if you set @@ -23602,25 +26150,69 @@ trying to deliver the message. It is therefore recommended that you do as much testing as possible at RCPT time. -.section "The non-SMTP ACL" -.cindex "non-smtp message" "ACL for" -The non-SMTP ACL applies to all non-interactive incoming messages, that is, it -applies to batch SMTP as well as to non-SMTP messages. (Batch SMTP is not -really SMTP.) This ACL is run just before the &[local_scan()]& function. Any +.section "The non-SMTP ACLs" "SECID190" +.cindex "non-SMTP messages" "ACLs for" +The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they +apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not +really SMTP.) Many of the ACL conditions (for example, host tests, and tests on +the state of the SMTP connection such as encryption and authentication) are not +relevant and are forbidden in these ACLs. However, the sender and recipients +are known, so the &%senders%& and &%sender_domains%& conditions and the +&$sender_address$& and &$recipients$& variables can be used. Variables such as +&$authenticated_sender$& are also available. You can specify added header lines +in any of these ACLs. + +The &%acl_not_smtp_start%& ACL is run right at the start of receiving a +non-SMTP message, before any of the message has been read. (This is the +analogue of the &%acl_smtp_predata%& ACL for SMTP input.) In the case of +batched SMTP input, it runs after the DATA command has been reached. The +result of this ACL is ignored; it cannot be used to reject a message. If you +really need to, you could set a value in an ACL variable here and reject based +on that in the &%acl_not_smtp%& ACL. However, this ACL can be used to set +controls, and in particular, it can be used to set +.code +control = suppress_local_fixups +.endd +This cannot be used in the other non-SMTP ACLs because by the time they are +run, it is too late. + +The &%acl_not_smtp_mime%& ACL is available only when Exim is compiled with the +content-scanning extension. For details, see chapter &<>&. + +The &%acl_not_smtp%& ACL is run just before the &[local_scan()]& function. Any kind of rejection is treated as permanent, because there is no way of sending a -temporary error for these kinds of message. Many of the ACL conditions (for -example, host tests, and tests on the state of the SMTP connection such as -encryption and authentication) are not relevant and are forbidden in this ACL. +temporary error for these kinds of message. + +.section "The SMTP connect ACL" "SECID191" +.cindex "SMTP" "connection, ACL for" +.oindex &%smtp_banner%& +The ACL test specified by &%acl_smtp_connect%& happens at the start of an SMTP +session, after the test specified by &%host_reject_connection%& (which is now +an anomaly) and any TCP Wrappers testing (if configured). If the connection is +accepted by an &%accept%& verb that has a &%message%& modifier, the contents of +the message override the banner message that is otherwise specified by the +&%smtp_banner%& option. -.section "The connect ACL" -.cindex "SMTP connection" "ACL for" -The ACL test specified by &%acl_smtp_connect%& happens after the test specified -by &%host_reject_connection%& (which is now an anomaly) and any TCP Wrappers -testing (if configured). +.section "The EHLO/HELO ACL" "SECID192" +.cindex "EHLO" "ACL for" +.cindex "HELO" "ACL for" +The ACL test specified by &%acl_smtp_helo%& happens when the client issues an +EHLO or HELO command, after the tests specified by &%helo_accept_junk_hosts%&, +&%helo_allow_chars%&, &%helo_verify_hosts%&, and &%helo_try_verify_hosts%&. +Note that a client may issue more than one EHLO or HELO command in an SMTP +session, and indeed is required to issue a new EHLO or HELO after successfully +setting up encryption following a STARTTLS command. -.section "The DATA ACLs" +If the command is accepted by an &%accept%& verb that has a &%message%& +modifier, the message may not contain more than one line (it will be truncated +at the first newline and a panic logged if it does). Such a message cannot +affect the EHLO options that are listed on the second and subsequent lines of +an EHLO response. + + +.section "The DATA ACLs" "SECID193" .cindex "DATA" "ACLs for" Two ACLs are associated with the DATA command, because it is two-stage command, with two responses being sent to the client. @@ -23645,14 +26237,32 @@ before or after the data) correctly &-- they keep the message on their queues and try again later, but that is their problem, though it does waste some of your resources. +The &%acl_smtp_data%& ACL is run after both the &%acl_smtp_dkim%& and +the &%acl_smtp_mime%& ACLs. + -.section "The MIME ACL" +.section "The SMTP DKIM ACL" "SECTDKIMACL" +The &%acl_smtp_dkim%& ACL is available only when Exim is compiled with DKIM support +enabled (which is the default). + +The ACL test specified by &%acl_smtp_dkim%& happens after a message has been +received, and is executed for each DKIM signature found in a message. If not +otherwise specified, the default action is to accept. + +This ACL is evaluated before &%acl_smtp_mime%& and &%acl_smtp_data%&. + +For details on the operation of DKIM, see chapter &<>&. + + +.section "The SMTP MIME ACL" "SECID194" The &%acl_smtp_mime%& option is available only when Exim is compiled with the content-scanning extension. For details, see chapter &<>&. +This ACL is evaluated after &%acl_smtp_dkim%& but before &%acl_smtp_data%&. + .section "The QUIT ACL" "SECTQUITACL" -.cindex "QUIT" "ACL for" +.cindex "QUIT, ACL for" The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL does not affect the response code to QUIT, which is always 221. Thus, the ACL does not in fact control any access. For this reason, the only verbs that are @@ -23677,13 +26287,60 @@ client are given temporary error responses until QUIT is received or the connection is closed. In these special cases, the QUIT ACL does not run. +.section "The not-QUIT ACL" "SECTNOTQUITACL" +.vindex &$acl_smtp_notquit$& +The not-QUIT ACL, specified by &%acl_smtp_notquit%&, is run in most cases when +an SMTP session ends without sending QUIT. However, when Exim itself is in bad +trouble, such as being unable to write to its log files, this ACL is not run, +because it might try to do things (such as write to log files) that make the +situation even worse. + +Like the QUIT ACL, this ACL is provided to make it possible to do customized +logging or to gather statistics, and its outcome is ignored. The &%delay%& +modifier is forbidden in this ACL, and the only permitted verbs are &%accept%& +and &%warn%&. -.section "Finding an ACL to use" +.vindex &$smtp_notquit_reason$& +When the not-QUIT ACL is running, the variable &$smtp_notquit_reason$& is set +to a string that indicates the reason for the termination of the SMTP +connection. The possible values are: +.table2 +.irow &`acl-drop`& "Another ACL issued a &%drop%& command" +.irow &`bad-commands`& "Too many unknown or non-mail commands" +.irow &`command-timeout`& "Timeout while reading SMTP commands" +.irow &`connection-lost`& "The SMTP connection has been lost" +.irow &`data-timeout`& "Timeout while reading message data" +.irow &`local-scan-error`& "The &[local_scan()]& function crashed" +.irow &`local-scan-timeout`& "The &[local_scan()]& function timed out" +.irow &`signal-exit`& "SIGTERM or SIGINT" +.irow &`synchronization-error`& "SMTP synchronization error" +.irow &`tls-failed`& "TLS failed to start" +.endtable +In most cases when an SMTP connection is closed without having received QUIT, +Exim sends an SMTP response message before actually closing the connection. +With the exception of the &`acl-drop`& case, the default message can be +overridden by the &%message%& modifier in the not-QUIT ACL. In the case of a +&%drop%& verb in another ACL, it is the message from the other ACL that is +used. + + +.section "Finding an ACL to use" "SECID195" .cindex "&ACL;" "finding which to use" -The value of an &%acl_smtp_%&&'xxx'& option is expanded before use, so you can -use different ACLs in different circumstances. The resulting string does not -have to be the name of an ACL in the configuration file; there are other -possibilities. Having expanded the string, Exim searches for an ACL as follows: +The value of an &%acl_smtp_%&&'xxx'& option is expanded before use, so +you can use different ACLs in different circumstances. For example, +.code +acl_smtp_rcpt = ${if ={25}{$interface_port} \ + {acl_check_rcpt} {acl_check_rcpt_submit} } +.endd +In the default configuration file there are some example settings for +providing an RFC 4409 message submission service on port 587 and a +non-standard &"smtps"& service on port 465. You can use a string +expansion like this to choose an ACL for MUAs on these ports which is +more appropriate for this purpose than the default ACL on port 25. + +The expanded string does not have to be the name of an ACL in the +configuration file; there are other possibilities. Having expanded the +string, Exim searches for an ACL as follows: .ilist If the string begins with a slash, Exim uses it as a file name, and reads its @@ -23719,7 +26376,7 @@ newlines; it is processed in the same way as an ACL that is read from a file. -.section "ACL return codes" +.section "ACL return codes" "SECID196" .cindex "&ACL;" "return codes" Except for the QUIT ACL, which does not affect the SMTP return code (see section &<>& above), the result of running an ACL is either @@ -23754,17 +26411,21 @@ recipients; it may create new recipients. -.section "Unset ACL options" +.section "Unset ACL options" "SECID197" .cindex "&ACL;" "unset options" The default actions when any of the &%acl_%&&'xxx'& options are unset are not all the same. &*Note*&: These defaults apply only when the relevant ACL is not defined at all. For any defined ACL, the default action when control reaches the end of the ACL statements is &"deny"&. +For &%acl_smtp_quit%& and &%acl_not_smtp_start%& there is no default because +these two are ACLs that are used only for their side effects. They cannot be +used to accept or reject anything. + For &%acl_not_smtp%&, &%acl_smtp_auth%&, &%acl_smtp_connect%&, &%acl_smtp_data%&, &%acl_smtp_helo%&, &%acl_smtp_mail%&, &%acl_smtp_mailauth%&, -&%acl_smtp_mime%&, &%acl_smtp_predata%&, &%acl_smtp_quit%&, and -&%acl_smtp_starttls%&, the action when the ACL is not defined is &"accept"&. +&%acl_smtp_mime%&, &%acl_smtp_predata%&, and &%acl_smtp_starttls%&, the action +when the ACL is not defined is &"accept"&. For the others (&%acl_smtp_etrn%&, &%acl_smtp_expn%&, &%acl_smtp_rcpt%&, and &%acl_smtp_vrfy%&), the action when the ACL is not defined is &"deny"&. @@ -23775,13 +26436,13 @@ configuration file. -.section "Data for message ACLs" +.section "Data for message ACLs" "SECID198" .cindex "&ACL;" "data for message ACL" -.cindex &$domain$& -.cindex &$local_part$& -.cindex &$sender_address$& -.cindex &$sender_host_address$& -.cindex &$smtp_command$& +.vindex &$domain$& +.vindex &$local_part$& +.vindex &$sender_address$& +.vindex &$sender_host_address$& +.vindex &$smtp_command$& When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables that contain information about the host and the message's sender (for example, &$sender_host_address$& and &$sender_address$&) are set, and can be used in ACL @@ -23794,15 +26455,15 @@ contain information about the host are set, but &$sender_address$& is not yet set. Section &<>& contains a discussion of this parameter and how it is used. -.cindex "&$message_size$&" +.vindex "&$message_size$&" The &$message_size$& variable is set to the value of the SIZE parameter on the MAIL command at MAIL, RCPT and pre-data time, or to -1 if that parameter is not given. The value is updated to the true message size by the time the final DATA ACL is run (after the message data has been received). -.cindex "&$rcpt_count$&" -.cindex "&$recipients_count$&" +.vindex "&$rcpt_count$&" +.vindex "&$recipients_count$&" The &$rcpt_count$& variable increases by one for each RCPT command received. The &$recipients_count$& variable increases by one each time a RCPT command is accepted, so while an ACL for RCPT is being processed, it contains the number @@ -23816,8 +26477,8 @@ of previously accepted recipients. At DATA time (for both the DATA ACLs), .section "Data for non-message ACLs" "SECTdatfornon" .cindex "&ACL;" "data for non-message ACL" -.cindex &$smtp_command_argument$& -.cindex &$smtp_command$& +.vindex &$smtp_command_argument$& +.vindex &$smtp_command$& When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY, the remainder of the SMTP command line is placed in &$smtp_command_argument$&, and the entire SMTP command is available in &$smtp_command$&. @@ -23840,9 +26501,9 @@ option to do this.) -.section "Format of an ACL" +.section "Format of an ACL" "SECID199" .cindex "&ACL;" "format of" -.cindex "&ACL;" "verbs; definition of" +.cindex "&ACL;" "verbs, definition of" An individual ACL consists of a number of statements. Each statement starts with a verb, optionally followed by a number of conditions and &"modifiers"&. Modifiers can change the way the verb operates, define error and log messages, @@ -23863,11 +26524,11 @@ all the conditions make sense at every testing point. For example, you cannot test a sender address in the ACL that is run for a VRFY command. -.section "ACL verbs" +.section "ACL verbs" "SECID200" The ACL verbs are as follows: .ilist -.cindex "&%accept%&" "ACL verb" +.cindex "&%accept%& ACL verb" &%accept%&: If all the conditions are met, the ACL returns &"accept"&. If any of the conditions are not met, what happens depends on whether &%endpass%& appears among the conditions (for syntax see below). If the failing condition @@ -23885,16 +26546,43 @@ the command is accepted if verification succeeds. However, if verification fails, the ACL yields &"deny"&, because the failing condition is after &%endpass%&. +The &%endpass%& feature has turned out to be confusing to many people, so its +use is not recommended nowadays. It is always possible to rewrite an ACL so +that &%endpass%& is not needed, and it is no longer used in the default +configuration. + +.cindex "&%message%& ACL modifier" "with &%accept%&" +If a &%message%& modifier appears on an &%accept%& statement, its action +depends on whether or not &%endpass%& is present. In the absence of &%endpass%& +(when an &%accept%& verb either accepts or passes control to the next +statement), &%message%& can be used to vary the message that is sent when an +SMTP command is accepted. For example, in a RCPT ACL you could have: +.display +&`accept `&<&'some conditions'&> +&` message = OK, I will allow you through today`& +.endd +You can specify an SMTP response code, optionally followed by an &"extended +response code"& at the start of the message, but the first digit must be the +same as would be sent by default, which is 2 for an &%accept%& verb. + +If &%endpass%& is present in an &%accept%& statement, &%message%& specifies +an error message that is used when access is denied. This behaviour is retained +for backward compatibility, but current &"best practice"& is to avoid the use +of &%endpass%&. + + .next -.cindex "&%defer%&" "ACL verb" -&%defer%&: If all the conditions are met, the ACL returns &"defer"& which, in +.cindex "&%defer%& ACL verb" +&%defer%&: If all the conditions are true, the ACL returns &"defer"& which, in an SMTP session, causes a 4&'xx'& response to be given. For a non-SMTP ACL, &%defer%& is the same as &%deny%&, because there is no way of sending a temporary error. For a RCPT command, &%defer%& is much the same as using a &(redirect)& router and &`:defer:`& while verifying, but the &%defer%& verb can be used in any ACL, and even for a recipient it might be a simpler approach. + + .next -.cindex "&%deny%&" "ACL verb" +.cindex "&%deny%& ACL verb" &%deny%&: If all the conditions are met, the ACL returns &"deny"&. If any of the conditions are not met, control is passed to the next ACL statement. For example, @@ -23903,21 +26591,25 @@ deny dnslists = blackholes.mail-abuse.org .endd rejects commands from hosts that are on a DNS black list. + .next -.cindex "&%discard%&" "ACL verb" +.cindex "&%discard%& ACL verb" &%discard%&: This verb behaves like &%accept%&, except that it returns &"discard"& from the ACL instead of &"accept"&. It is permitted only on ACLs -that are concerned with receiving messages, and it causes recipients to be -discarded. If the &%log_message%& modifier is set when &%discard%& operates, +that are concerned with receiving messages. When all the conditions are true, +the sending entity receives a &"success"& response. However, &%discard%& causes +recipients to be discarded. If it is used in an ACL for RCPT, just the one +recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the +message's recipients are discarded. Recipients that are discarded before DATA +do not appear in the log line when the &%received_recipients%& log selector is set. + +If the &%log_message%& modifier is set when &%discard%& operates, its contents are added to the line that is automatically written to the log. +The &%message%& modifier operates exactly as it does for &%accept%&. + -If &%discard%& is used in an ACL for RCPT, just the one recipient is -discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the -message's recipients are discarded. Recipients that are discarded before -DATA do not appear in the log line when the &%log_recipients%& log selector -is set. .next -.cindex "&%drop%&" "ACL verb" +.cindex "&%drop%& ACL verb" &%drop%&: This verb behaves like &%deny%&, except that an SMTP connection is forcibly closed after the 5&'xx'& error message has been sent. For example: .code @@ -23928,42 +26620,44 @@ There is no difference between &%deny%& and &%drop%& for the connect-time ACL. The connection is always dropped after sending a 550 response. .next -.cindex "&%require%&" "ACL verb" +.cindex "&%require%& ACL verb" &%require%&: If all the conditions are met, control is passed to the next ACL statement. If any of the conditions are not met, the ACL returns &"deny"&. For example, when checking a RCPT command, .code -require verify = sender +require message = Sender did not verify + verify = sender .endd passes control to subsequent statements only if the message's sender can be -verified. Otherwise, it rejects the command. - -.next -.cindex "&%warn%&" "ACL verb" -&%warn%&: If all the conditions are met, a header line is added to an incoming -message and/or a line is written to Exim's main log. In all cases, control -passes to the next ACL statement. The text of the added header line and the log -line are specified by modifiers; if they are not present, a &%warn%& verb just -checks its conditions and obeys any &"immediate"& modifiers such as &%set%& and -&%logwrite%&. There is more about adding header lines in section +verified. Otherwise, it rejects the command. Note the positioning of the +&%message%& modifier, before the &%verify%& condition. The reason for this is +discussed in section &<>&. + +.next +.cindex "&%warn%& ACL verb" +&%warn%&: If all the conditions are true, a line specified by the +&%log_message%& modifier is written to Exim's main log. Control always passes +to the next ACL statement. If any condition is false, the log line is not +written. If an identical log line is requested several times in the same +message, only one copy is actually written to the log. If you want to force +duplicates to be written, use the &%logwrite%& modifier instead. + +If &%log_message%& is not present, a &%warn%& verb just checks its conditions +and obeys any &"immediate"& modifiers (such as &%control%&, &%set%&, +&%logwrite%&, &%add_header%&, and &%remove_header%&) that appear before the +first failing condition. There is more about adding header lines in section &<>&. If any condition on a &%warn%& statement cannot be completed (that is, there is -some sort of defer), no header lines are added and the configured log line is -not written. No further conditions or modifiers in the &%warn%& statement are -processed. The incident is logged, but the ACL continues to be processed, from -the next statement onwards. - -If a &%message%& modifier is present on a &%warn%& verb in an ACL that is not -testing an incoming message, it is ignored, and the incident is logged. +some sort of defer), the log line specified by &%log_message%& is not written. +This does not include the case of a forced failure from a lookup, which +is considered to be a successful completion. After a defer, no further +conditions or modifiers in the &%warn%& statement are processed. The incident +is logged, and the ACL continues to be processed, from the next statement +onwards. -A &%warn%& statement may use the &%log_message%& modifier to cause a line to be -written to the main log when the statement's conditions are true. -If an identical log line is requested several times in the same message, only -one copy is actually written to the log. If you want to force duplicates to be -written, use the &%logwrite%& modifier instead. -.cindex "&$acl_verify_message$&" +.vindex "&$acl_verify_message$&" When one of the &%warn%& conditions is an address verification that fails, the text of the verification failure message is in &$acl_verify_message$&. If you want this logged, you must set it up explicitly. For example: @@ -23988,34 +26682,46 @@ mechanism. It is conventional to align the conditions vertically. There are some special variables that can be set during ACL processing. They can be used to pass information between different ACLs, different invocations of the same ACL in the same SMTP connection, and between ACLs and the routers, -transports, and filters that are used to deliver a message. There are two sets -of these variables: - +transports, and filters that are used to deliver a message. The names of these +variables must begin with &$acl_c$& or &$acl_m$&, followed either by a digit or +an underscore, but the remainder of the name can be any sequence of +alphanumeric characters and underscores that you choose. There is no limit on +the number of ACL variables. The two sets act as follows: .ilist -The values of &$acl_c0$& to &$acl_c19$& persist throughout an SMTP -connection. They are never reset. Thus, a value that is set while receiving one -message is still available when receiving the next message on the same SMTP -connection. -.next -The values of &$acl_m0$& to &$acl_m19$& persist only while a message is -being received. They are reset afterwards. They are also reset by MAIL, RSET, -EHLO, HELO, and after starting up a TLS session. +The values of those variables whose names begin with &$acl_c$& persist +throughout an SMTP connection. They are never reset. Thus, a value that is set +while receiving one message is still available when receiving the next message +on the same SMTP connection. +.next +The values of those variables whose names begin with &$acl_m$& persist only +while a message is being received. They are reset afterwards. They are also +reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session. .endlist When a message is accepted, the current values of all the ACL variables are preserved with the message and are subsequently made available at delivery -time. The ACL variables are set by modifier called &%set%&. For example: +time. The ACL variables are set by a modifier called &%set%&. For example: .code accept hosts = whatever set acl_m4 = some value +accept authenticated = * + set acl_c_auth = yes .endd &*Note*&: A leading dollar sign is not used when naming a variable that is to be set. If you want to set a variable without taking any action, you can use a &%warn%& verb without any other modifiers or conditions. +.oindex &%strict_acl_vars%& +What happens if a syntactically valid but undefined ACL variable is +referenced depends on the setting of the &%strict_acl_vars%& option. If it is +false (the default), an empty string is substituted; if it is true, an +error is generated. + +Versions of Exim before 4.64 have a limited set of numbered variables, but +their names are compatible, so there is no problem with upgrading. -.section "Condition and modifier processing" +.section "Condition and modifier processing" "SECTcondmodproc" .cindex "&ACL;" "conditions; processing" .cindex "&ACL;" "modifiers; processing" An exclamation mark preceding a condition negates its result. For example: @@ -24057,7 +26763,7 @@ others specify text for messages that are used when access is denied or a warning is generated. The &%control%& modifier affects the way an incoming message is handled. -The positioning of the modifiers in an ACL statement important, because the +The positioning of the modifiers in an ACL statement is important, because the processing of a verb ceases as soon as its outcome is known. Only those modifiers that have already been encountered will take effect. For example, consider this use of the &%message%& modifier: @@ -24095,12 +26801,28 @@ The ACL modifiers are as follows: .vlist .vitem &*add_header*&&~=&~<&'text'&> -This modifier specifies one of more header lines that are to be added to an +This modifier specifies one or more header lines that are to be added to an incoming message, assuming, of course, that the message is ultimately accepted. For details, see section &<>&. +.vitem &*continue*&&~=&~<&'text'&> +.cindex "&%continue%& ACL modifier" +.cindex "database" "updating in ACL" +This modifier does nothing of itself, and processing of the ACL always +continues with the next condition or modifier. The value of &%continue%& is in +the side effects of expanding its argument. Typically this could be used to +update a database. It is really just a syntactic tidiness, to avoid having to +write rather ugly lines like this: +.display +&`condition = ${if eq{0}{`&<&'some expansion'&>&`}{true}{true}}`& +.endd +Instead, all you need is +.display +&`continue = `&<&'some expansion'&> +.endd + .vitem &*control*&&~=&~<&'text'&> -.cindex "&%control%&" "ACL modifier" +.cindex "&%control%& ACL modifier" This modifier affects the subsequent processing of the SMTP connection or of an incoming message that is accepted. The effect of the first type of control lasts for the duration of the connection, whereas the effect of the second type @@ -24113,7 +26835,9 @@ separately in section &<>&. The &%control%& modifier can be used in several different ways. For example: . ==== As this is a nested list, any displays it contains must be indented -. ==== as otherwise they are too far to the left. +. ==== as otherwise they are too far to the left. That comment applies only +. ==== when xmlto and fop are used; formatting with sdop gets it right either +. ==== way. .ilist It can be at the end of an &%accept%& statement: @@ -24153,18 +26877,19 @@ log entry. If you want to apply a control unconditionally, you can use it with a &%require%& verb. For example: .code - require control = no_multiline_response + require control = no_multiline_responses .endd .endlist .vitem &*delay*&&~=&~<&'time'&> -.cindex "&%delay%&" "ACL modifier" -.cindex "&%-bh%& option" -This modifier causes Exim to wait for the time interval before proceeding. The -time is given in the usual Exim notation. This modifier may appear in any ACL. -The delay happens as soon as the modifier is processed. However, when testing -Exim using the &%-bh%& option, the delay is not actually imposed (an -appropriate message is output instead). +.cindex "&%delay%& ACL modifier" +.oindex "&%-bh%&" +This modifier may appear in any ACL except notquit. It causes Exim to wait for +the time interval before proceeding. However, when testing Exim using the +&%-bh%& option, the delay is not actually imposed (an appropriate message is +output instead). The time is given in the usual Exim notation, and the delay +happens as soon as the modifier is processed. In an SMTP session, pending +output is flushed before the delay is imposed. Like &%control%&, &%delay%& can be used with &%accept%& or &%deny%&, for example: @@ -24187,32 +26912,53 @@ warn ...some conditions... accept ... .endd +If &%delay%& is encountered when the SMTP PIPELINING extension is in use, +responses to several commands are no longer buffered and sent in one packet (as +they would normally be) because all output is flushed before imposing the +delay. This optimization is disabled so that a number of small delays do not +appear to the client as one large aggregated delay that might provoke an +unwanted timeout. You can, however, disable output flushing for &%delay%& by +using a &%control%& modifier to set &%no_delay_flush%&. + + .vitem &*endpass*& -.cindex "&%endpass%&" "ACL modifier" -This modifier, which has no argument, is recognized only in &%accept%& -statements. It marks the boundary between the conditions whose failure causes -control to pass to the next statement, and the conditions whose failure causes -the ACL to return &"deny"&. See the description of &%accept%& above. +.cindex "&%endpass%& ACL modifier" +This modifier, which has no argument, is recognized only in &%accept%& and +&%discard%& statements. It marks the boundary between the conditions whose +failure causes control to pass to the next statement, and the conditions whose +failure causes the ACL to return &"deny"&. This concept has proved to be +confusing to some people, so the use of &%endpass%& is no longer recommended as +&"best practice"&. See the description of &%accept%& above for more details. + .vitem &*log_message*&&~=&~<&'text'&> -.cindex "&%log_message%&" "ACL modifier" +.cindex "&%log_message%& ACL modifier" This modifier sets up a message that is used as part of the log message if the ACL denies access or a &%warn%& statement's conditions are true. For example: .code -require log_message = wrong cipher suite $tls_cipher +require log_message = wrong cipher suite $tls_in_cipher encrypted = DES-CBC3-SHA .endd -&%log_message%& adds to any underlying error message that may exist because of -the condition failure. For example, while verifying a recipient address, a -&':fail:'& redirection might have already set up a message. Although the -message is usually defined before the conditions to which it applies, the -expansion does not happen until Exim decides that access is to be denied. This -means that any variables that are set by the condition are available for -inclusion in the message. For example, the &$dnslist_$&<&'xxx'&> variables are -set after a DNS black list lookup succeeds. If the expansion of &%log_message%& -fails, or if the result is an empty string, the modifier is ignored. - -.cindex "&$acl_verify_message$&" +&%log_message%& is also used when recipients are discarded by &%discard%&. For +example: +.display +&`discard `&<&'some conditions'&> +&` log_message = Discarded $local_part@$domain because...`& +.endd +When access is denied, &%log_message%& adds to any underlying error message +that may exist because of a condition failure. For example, while verifying a +recipient address, a &':fail:'& redirection might have already set up a +message. + +The message may be defined before the conditions to which it applies, because +the string expansion does not happen until Exim decides that access is to be +denied. This means that any variables that are set by the condition are +available for inclusion in the message. For example, the &$dnslist_$&<&'xxx'&> +variables are set after a DNS black list lookup succeeds. If the expansion of +&%log_message%& fails, or if the result is an empty string, the modifier is +ignored. + +.vindex "&$acl_verify_message$&" If you want to use a &%warn%& statement to log the result of an address verification, you can use &$acl_verify_message$& to include the verification error message. @@ -24222,7 +26968,7 @@ the start of the logged message. If the same warning log message is requested more than once while receiving a single email message, only one copy is actually logged. If you want to log multiple copies, use &%logwrite%& instead of &%log_message%&. In the absence of &%log_message%& and &%logwrite%&, nothing -is logged for a succesful &%warn%& statement. +is logged for a successful &%warn%& statement. If &%log_message%& is not present and there is no underlying error message (for example, from the failure of address verification), but &%message%& is present, @@ -24231,13 +26977,32 @@ logging contains newlines, only the first line is logged. In the absence of both &%log_message%& and &%message%&, a default built-in message is used for logging rejections. + +.vitem "&*log_reject_target*&&~=&~<&'log name list'&>" +.cindex "&%log_reject_target%& ACL modifier" +.cindex "logging in ACL" "specifying which log" +This modifier makes it possible to specify which logs are used for messages +about ACL rejections. Its argument is a colon-separated list of words that can +be &"main"&, &"reject"&, or &"panic"&. The default is &`main:reject`&. The list +may be empty, in which case a rejection is not logged at all. For example, this +ACL fragment writes no logging information when access is denied: +.display +&`deny `&<&'some conditions'&> +&` log_reject_target =`& +.endd +This modifier can be used in SMTP and non-SMTP ACLs. It applies to both +permanent and temporary rejections. Its effect lasts for the rest of the +current ACL. + + .vitem &*logwrite*&&~=&~<&'text'&> -.cindex "&%logwrite%&" "ACL modifier" +.cindex "&%logwrite%& ACL modifier" .cindex "logging in ACL" "immediate" This modifier writes a message to a log file as soon as it is encountered when processing an ACL. (Compare &%log_message%&, which, except in the case of -&%warn%&, is used only if the ACL statement denies access.) The &%logwrite%& -modifier can be used to log special incidents in ACLs. For example: +&%warn%& and &%discard%&, is used only if the ACL statement denies +access.) The &%logwrite%& modifier can be used to log special incidents in +ACLs. For example: .display &`accept `&<&'some special conditions'&> &` control = freeze`& @@ -24252,22 +27017,59 @@ logwrite = :main,reject: text for main and reject logs logwrite = :panic: text for panic log only .endd + .vitem &*message*&&~=&~<&'text'&> -.cindex "&%message%&" "ACL modifier" -This modifier sets up a text string that is expanded and used as an error -message if the current statement causes the ACL to deny access. The expansion -happens at the time Exim decides that access is to be denied, not at the time -it processes &%message%&. If the expansion fails, or generates an empty string, -the modifier is ignored. For ACLs that are triggered by SMTP commands, the -message is returned as part of the SMTP error response. - -The text is literal; any quotes are taken as literals, but because the string -is expanded, backslash escapes are processed anyway. If the message contains -newlines, this gives rise to a multi-line SMTP response. Like &%log_message%&, -the contents of &%message%& are not expanded until after a condition has -failed. +.cindex "&%message%& ACL modifier" +This modifier sets up a text string that is expanded and used as a response +message when an ACL statement terminates the ACL with an &"accept"&, &"deny"&, +or &"defer"& response. (In the case of the &%accept%& and &%discard%& verbs, +there is some complication if &%endpass%& is involved; see the description of +&%accept%& for details.) + +The expansion of the message happens at the time Exim decides that the ACL is +to end, not at the time it processes &%message%&. If the expansion fails, or +generates an empty string, the modifier is ignored. Here is an example where +&%message%& must be specified first, because the ACL ends with a rejection if +the &%hosts%& condition fails: +.code +require message = Host not recognized + hosts = 10.0.0.0/8 +.endd +(Once a condition has failed, no further conditions or modifiers are +processed.) + +.cindex "SMTP" "error codes" +.oindex "&%smtp_banner%& +For ACLs that are triggered by SMTP commands, the message is returned as part +of the SMTP response. The use of &%message%& with &%accept%& (or &%discard%&) +is meaningful only for SMTP, as no message is returned when a non-SMTP message +is accepted. In the case of the connect ACL, accepting with a message modifier +overrides the value of &%smtp_banner%&. For the EHLO/HELO ACL, a customized +accept message may not contain more than one line (otherwise it will be +truncated at the first newline and a panic logged), and it cannot affect the +EHLO options. + +When SMTP is involved, the message may begin with an overriding response code, +consisting of three digits optionally followed by an &"extended response code"& +of the form &'n.n.n'&, each code being followed by a space. For example: +.code +deny message = 599 1.2.3 Host not welcome + hosts = 192.168.34.0/24 +.endd +The first digit of the supplied response code must be the same as would be sent +by default. A panic occurs if it is not. Exim uses a 550 code when it denies +access, but for the predata ACL, note that the default success code is 354, not +2&'xx'&. + +Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others, +the message modifier cannot override the 221 response code. + +The text in a &%message%& modifier is literal; any quotes are taken as +literals, but because the string is expanded, backslash escapes are processed +anyway. If the message contains newlines, this gives rise to a multi-line SMTP +response. -.cindex "&$acl_verify_message$&" +.vindex "&$acl_verify_message$&" If &%message%& is used on a statement that verifies an address, the message specified overrides any message that is generated by the verification process. However, the original message is available in the variable @@ -24284,10 +27086,32 @@ all the conditions are true, wherever it appears in an ACL command, whereas &%warn%& in an ACL that is not concerned with receiving a message, it has no effect. + +.vitem &*remove_header*&&~=&~<&'text'&> +This modifier specifies one or more header names in a colon-separated list + that are to be removed from an incoming message, assuming, of course, that +the message is ultimately accepted. For details, see section &<>&. + + .vitem &*set*&&~<&'acl_name'&>&~=&~<&'value'&> -.cindex "&%set%&" "ACL modifier" +.cindex "&%set%& ACL modifier" This modifier puts a value into one of the ACL variables (see section &<>&). + + +.vitem &*udpsend*&&~=&~<&'parameters'&> +This modifier sends a UDP packet, for purposes such as statistics +collection or behaviour monitoring. The parameters are expanded, and +the result of the expansion must be a colon-separated list consisting +of a destination server, port number, and the packet contents. The +server can be specified as a host name or IPv4 or IPv6 address. The +separator can be changed with the usual angle bracket syntax. For +example, you might want to collect information on which hosts connect +when: +.code +udpsend = <; 2001:dB8::dead:beef ; 1234 ;\ + $tod_zulu $sender_host_address +.endd .endlist @@ -24295,7 +27119,7 @@ This modifier puts a value into one of the ACL variables (see section .section "Use of the control modifier" "SECTcontrols" -.cindex "&%control%&" "ACL modifier" +.cindex "&%control%& ACL modifier" The &%control%& modifier supports the following settings: .vlist @@ -24317,13 +27141,11 @@ mechanism has been advertised is bypassed. Any configured mechanism can be used by the client. This control is permitted only in the connection and HELO ACLs. -.vitem &*control&~=&~caseful_local_part*& -See below. - -.vitem &*control&~=&~caselower_local_part*& +.vitem &*control&~=&~caseful_local_part*& &&& + &*control&~=&~caselower_local_part*& .cindex "&ACL;" "case of local part in" .cindex "case of local parts" -.cindex "&$local_part$&" +.vindex "&$local_part$&" These two controls are permitted only in the ACL specified by &%acl_smtp_rcpt%& (that is, during RCPT processing). By default, the contents of &$local_part$& are lower cased before ACL processing. If &"caseful_local_part"& is specified, @@ -24351,10 +27173,79 @@ warn control = caseful_local_part Notice that we put back the lower cased version afterwards, assuming that is what is wanted for subsequent tests. -.vitem &*control&~=&~enforce_sync*& -See below. -.vitem &*control&~=&~no_enforce_sync*& +.new +.vitem &*control&~=&~cutthrough_delivery*& +.cindex "&ACL;" "cutthrough routing" +.cindex "cutthrough" "requesting" +This option requests delivery be attempted while the item is being received. +It is usable in the RCPT ACL and valid only for single-recipient mails forwarded +from one SMTP connection to another. If a recipient-verify callout connection is +requested in the same ACL it is held open and used for the data, otherwise one is made +after the ACL completes. Note that routers are used in verify mode. + +Should the ultimate destination system positively accept or reject the mail, +a corresponding indication is given to the source system and nothing is queued. +If there is a temporary error the item is queued for later delivery in the +usual fashion. If the item is successfully delivered in cutthrough mode the log line +is tagged with ">>" rather than "=>" and appears before the acceptance "<=" +line. + +Delivery in this mode avoids the generation of a bounce mail to a (possibly faked) +sender when the destination system is doing content-scan based rejection. +.wen + + +.new +.vitem &*control&~=&~debug/*&<&'options'&> +.cindex "&ACL;" "enabling debug logging" +.cindex "debugging" "enabling from an ACL" +This control turns on debug logging, almost as though Exim had been invoked +with &`-d`&, with the output going to a new logfile, by default called +&'debuglog'&. The filename can be adjusted with the &'tag'& option, which +may access any variables already defined. The logging may be adjusted with +the &'opts'& option, which takes the same values as the &`-d`& command-line +option. Some examples (which depend on variables that don't exist in all +contexts): +.code + control = debug + control = debug/tag=.$sender_host_address + control = debug/opts=+expand+acl + control = debug/tag=.$message_exim_id/opts=+expand +.endd +.wen + + +.new +.vitem &*control&~=&~dkim_disable_verify*& +.cindex "disable DKIM verify" +.cindex "DKIM" "disable verify" +This control turns off DKIM verification processing entirely. For details on +the operation and configuration of DKIM, see chapter &<>&. +.wen + + +.new +.vitem &*control&~=&~dscp/*&<&'value'&> +.cindex "&ACL;" "setting DSCP value" +.cindex "DSCP" "inbound" +This option causes the DSCP value associated with the socket for the inbound +connection to be adjusted to a given value, given as one of a number of fixed +strings or to numeric value. +The &%-bI:dscp%& option may be used to ask Exim which names it knows of. +Common values include &`throughput`&, &`mincost`&, and on newer systems +&`ef`&, &`af41`&, etc. Numeric values may be in the range 0 to 0x3F. + +The outbound packets from Exim will be marked with this value in the header +(for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee +that these values will have any effect, not be stripped by networking +equipment, or do much of anything without cooperation with your Network +Engineer and those of all network operators between the source and destination. +.wen + + +.vitem &*control&~=&~enforce_sync*& &&& + &*control&~=&~no_enforce_sync*& .cindex "SMTP" "synchronization checking" .cindex "synchronization checking in SMTP" These controls make it possible to be selective about when SMTP synchronization @@ -24373,7 +27264,7 @@ work with. .vitem &*control&~=&~fakedefer/*&<&'message'&> .cindex "fake defer" -.cindex "defer" "fake" +.cindex "defer, fake" This control works in exactly the same way as &%fakereject%& (described below) except that it causes an SMTP 450 response after the message data instead of a 550 response. You must take care when using &%fakedefer%& because it causes the @@ -24382,7 +27273,7 @@ use &%fakedefer%& if the message is to be delivered normally. .vitem &*control&~=&~fakereject/*&<&'message'&> .cindex "fake rejection" -.cindex "rejection" "fake" +.cindex "rejection, fake" This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other words, only when an SMTP message is being received. If Exim accepts the message, instead the final 250 response, a 550 rejection message is sent. @@ -24398,7 +27289,7 @@ message is supplied, the following is used: 550-If it was a legitimate message, it may still be 550 delivered to the target recipient(s). .endd -This facilty should be used with extreme caution. +This facility should be used with extreme caution. .vitem &*control&~=&~freeze*& .cindex "frozen messages" "forcing in ACL" @@ -24413,6 +27304,19 @@ This modifier can optionally be followed by &`/no_tell`&. If the global option is told about the freezing), provided all the &*control=freeze*& modifiers that are obeyed for the current message have the &`/no_tell`& option. +.vitem &*control&~=&~no_delay_flush*& +.cindex "SMTP" "output flushing, disabling for delay" +Exim normally flushes SMTP output before implementing a delay in an ACL, to +avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in +use. This control, as long as it is encountered before the &%delay%& modifier, +disables such output flushing. + +.vitem &*control&~=&~no_callout_flush*& +.cindex "SMTP" "output flushing, disabling for callout" +Exim normally flushes SMTP output before performing a callout in an ACL, to +avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in +use. This control, as long as it is encountered before the &%verify%& condition +that causes the callout, disables such output flushing. .vitem &*control&~=&~no_mbox_unspool*& This control is available when Exim is compiled with the content scanning @@ -24424,8 +27328,8 @@ only to the current message, not to any subsequent ones that may be received in the same SMTP connection. It is provided for debugging purposes and is unlikely to be useful in production. -.vitem &*control&~=&~no_multiline_response*& -.cindex "multiline responses" "suppressing" +.vitem &*control&~=&~no_multiline_responses*& +.cindex "multiline responses, suppressing" This control is permitted for any ACL except the one for non-SMTP messages. It seems that there are broken clients in use that cannot handle multiline SMTP responses, despite the fact that RFC 821 defined them over 20 years ago. @@ -24449,8 +27353,16 @@ line is output. The setting of the switch can, of course, be made conditional on the calling host. Its effect lasts until the end of the SMTP connection. +.vitem &*control&~=&~no_pipelining*& +.cindex "PIPELINING" "suppressing advertising" +This control turns off the advertising of the PIPELINING extension to SMTP in +the current session. To be useful, it must be obeyed before Exim sends its +response to an EHLO command. Therefore, it should normally appear in an ACL +controlled by &%acl_smtp_connect%& or &%acl_smtp_helo%&. See also +&%pipelining_advertise_hosts%&. + .vitem &*control&~=&~queue_only*& -.cindex "&%queue_only%&" +.oindex "&%queue_only%&" .cindex "queueing incoming messages" This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in other words, only when a message is being received. If the message is accepted, @@ -24467,7 +27379,7 @@ This control is permitted only for the MAIL, RCPT, and start of data ACLs (the latter is the one defined by &%acl_smtp_predata%&). Setting it tells Exim that the current message is a submission from a local MUA. In this case, Exim operates in &"submission mode"&, and applies certain fixups to the message if -necessary. For example, it add a &'Date:'& header line if one is not present. +necessary. For example, it adds a &'Date:'& header line if one is not present. This control is not permitted in the &%acl_smtp_data%& ACL, because that is too late (the message has already been created). @@ -24478,9 +27390,9 @@ The control applies only to the current message, not to any subsequent ones that may be received in the same SMTP connection. .vitem &*control&~=&~suppress_local_fixups*& -.cindex "submission fixups" "suppressing" +.cindex "submission fixups, suppressing" This control applies to locally submitted (non TCP/IP) messages, and is the -complement of &`control`& &`=`& &`submission`&. It disables the fixups that are +complement of &`control = submission`&. It disables the fixups that are normally applied to locally-submitted messages. Specifically: .ilist @@ -24492,21 +27404,29 @@ No &'Message-ID:'&, &'From:'&, or &'Date:'& header lines are added. There is no check that &'From:'& corresponds to the actual sender. .endlist ilist -This feature may be useful when a remotely-originated message is accepted, -passed to some scanning program, and then re-submitted for delivery. +This control may be useful when a remotely-originated message is accepted, +passed to some scanning program, and then re-submitted for delivery. It can be +used only in the &%acl_smtp_mail%&, &%acl_smtp_rcpt%&, &%acl_smtp_predata%&, +and &%acl_not_smtp_start%& ACLs, because it has to be set before the message's +data is read. + +&*Note:*& This control applies only to the current message, not to any others +that are being submitted at the same time using &%-bs%& or &%-bS%&. .endlist vlist + +.section "Summary of message fixup control" "SECTsummesfix" All four possibilities for message fixups can be specified: .ilist Locally submitted, fixups applied: the default. .next -Locally submitted, no fixups applied: use &`control`& &`=`& -&`suppress_local_fixups`&. +Locally submitted, no fixups applied: use +&`control = suppress_local_fixups`&. .next Remotely submitted, no fixups applied: the default. .next -Remotely submitted, fixups applied: use &`control`& &`=`& &`submission`&. +Remotely submitted, fixups applied: use &`control = submission`&. .endlist @@ -24514,7 +27434,7 @@ Remotely submitted, fixups applied: use &`control`& &`=`& &`submission`&. .section "Adding header lines in ACLs" "SECTaddheadacl" .cindex "header lines" "adding in an ACL" .cindex "header lines" "position of added lines" -.cindex "&%message%&" "ACL modifier" +.cindex "&%add_header%& ACL modifier" The &%add_header%& modifier can be used to add one or more extra header lines to an incoming message, as in this example: .code @@ -24529,7 +27449,9 @@ receiving a message). The message must ultimately be accepted for any ACL verb, including &%deny%& (though this is potentially useful only in a RCPT ACL). -If the data for the &%add_header%& modifier contains one or more newlines that +Leading and trailing newlines are removed from +the data for the &%add_header%& modifier; if it then +contains one or more newlines that are not followed by a space or a tab, it is assumed to contain multiple header lines. Each one is checked for valid syntax; &`X-ACL-Warn:`& is added to the front of any line that is not a valid header line. @@ -24542,12 +27464,14 @@ during the DATA and MIME ACLs, after which they are added to the message, again with duplicates suppressed. Thus, it is possible to add two identical header lines to an SMTP message, but only if one is added before DATA and one after. In the case of non-SMTP messages, new headers are accumulated during the -non-SMTP ACL, and added to the message at the end. If a message is rejected -after DATA or by the non-SMTP ACL, all added header lines are included in the -entry that is written to the reject log. +non-SMTP ACLs, and are added to the message after all the ACLs have run. If a +message is rejected after DATA or by the non-SMTP ACL, all added header lines +are included in the entry that is written to the reject log. .cindex "header lines" "added; visibility of" -Header lines are not visible in string expansions until they are added to the +Header lines are not visible in string expansions +of message headers +until they are added to the message. It follows that header lines defined in the MAIL, RCPT, and predata ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly, header lines that are added by the DATA or MIME ACLs are not visible in those @@ -24556,7 +27480,9 @@ passing data between (for example) the MAIL and RCPT ACLs. If you want to do this, you can use ACL variables, as described in section &<>&. -The &%add_header%& modifier acts immediately it is encountered during the +The list of headers yet to be added is given by the &%$headers_added%& variable. + +The &%add_header%& modifier acts immediately as it is encountered during the processing of an ACL. Notice the difference between these two cases: .display &`accept add_header = ADDED: some text`& @@ -24571,7 +27497,7 @@ condition is true. Multiple occurrences of &%add_header%& may occur in the same ACL statement. All those that are encountered before a condition fails are honoured. -.cindex "&%warn%&" "ACL verb" +.cindex "&%warn%& ACL verb" For compatibility with previous versions of Exim, a &%message%& modifier for a &%warn%& verb acts in the same way as &%add_header%&, except that it takes effect only if all the conditions are true, even if it appears before some of @@ -24605,10 +27531,81 @@ system filter or in a router or transport. +.section "Removing header lines in ACLs" "SECTremoveheadacl" +.cindex "header lines" "removing in an ACL" +.cindex "header lines" "position of removed lines" +.cindex "&%remove_header%& ACL modifier" +The &%remove_header%& modifier can be used to remove one or more header lines +from an incoming message, as in this example: +.code +warn message = Remove internal headers + remove_header = x-route-mail1 : x-route-mail2 +.endd +The &%remove_header%& modifier is permitted in the MAIL, RCPT, PREDATA, DATA, +MIME, and non-SMTP ACLs (in other words, those that are concerned with +receiving a message). The message must ultimately be accepted for +&%remove_header%& to have any significant effect. You can use &%remove_header%& +with any ACL verb, including &%deny%&, though this is really not useful for +any verb that doesn't result in a delivered message. + +More than one header can be removed at the same time by using a colon separated +list of header names. The header matching is case insensitive. Wildcards are +not permitted, nor is list expansion performed, so you cannot use hostlists to +create a list of headers, however both connection and message variable expansion +are performed (&%$acl_c_*%& and &%$acl_m_*%&), illustrated in this example: +.code +warn hosts = +internal_hosts + set acl_c_ihdrs = x-route-mail1 : x-route-mail2 +warn message = Remove internal headers + remove_header = $acl_c_ihdrs +.endd +Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs. +They are removed from the message before processing the DATA and MIME ACLs. +There is no harm in attempting to remove the same header twice nor is removing +a non-existent header. Further header lines to be removed may be accumulated +during the DATA and MIME ACLs, after which they are removed from the message, +if present. In the case of non-SMTP messages, headers to be removed are +accumulated during the non-SMTP ACLs, and are removed from the message after +all the ACLs have run. If a message is rejected after DATA or by the non-SMTP +ACL, there really is no effect because there is no logging of what headers +would have been removed. + +.cindex "header lines" "removed; visibility of" +Header lines are not visible in string expansions until the DATA phase when it +is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are +not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are +removed by the DATA or MIME ACLs are still visible in those ACLs. Because of +this restriction, you cannot use header lines as a way of controlling data +passed between (for example) the MAIL and RCPT ACLs. If you want to do this, +you should instead use ACL variables, as described in section +&<>&. + +The &%remove_header%& modifier acts immediately as it is encountered during the +processing of an ACL. Notice the difference between these two cases: +.display +&`accept remove_header = X-Internal`& +&` `&<&'some condition'&> + +&`accept `&<&'some condition'&> +&` remove_header = X-Internal`& +.endd +In the first case, the header line is always removed, whether or not the +condition is true. In the second case, the header line is removed only if the +condition is true. Multiple occurrences of &%remove_header%& may occur in the +same ACL statement. All those that are encountered before a condition fails +are honoured. + +&*Warning*&: This facility currently applies only to header lines that are +present during ACL processing. It does NOT remove header lines that are added +in a system filter or in a router or transport. + + + + .section "ACL conditions" "SECTaclconditions" .cindex "&ACL;" "conditions; list of" -Some of conditions listed in this section are available only when Exim is +Some of the conditions listed in this section are available only when Exim is compiled with the content-scanning extension. They are included here briefly for completeness. More detailed descriptions can be found in the discussion on content scanning in chapter &<>&. @@ -24626,7 +27623,8 @@ The conditions are as follows: .vitem &*acl&~=&~*&<&'name&~of&~acl&~or&~ACL&~string&~or&~file&~name&~'&> .cindex "&ACL;" "nested" .cindex "&ACL;" "indirect" -.cindex "&%acl%&" "ACL condition" +.cindex "&ACL;" "arguments" +.cindex "&%acl%& ACL condition" The possible values of the argument are the same as for the &%acl_smtp_%&&'xxx'& options. The named or inline ACL is run. If it returns &"accept"& the condition is true; if it returns &"deny"& the condition is @@ -24635,6 +27633,12 @@ condition is on a &%warn%& verb. In that case, a &"defer"& return makes the condition false. This means that further processing of the &%warn%& verb ceases, but processing of the ACL continues. +If the argument is a named ACL, up to nine space-separated optional values +can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9, +and $acl_narg is set to the count of values. +Previous values of these variables are restored after the call returns. +The name and values are expanded separately. + If the nested &%acl%& returns &"drop"& and the outer condition denies access, the connection is dropped. If it returns &"discard"&, the verb must be &%accept%& or &%discard%&, and the action is taken immediately &-- no further @@ -24646,7 +27650,7 @@ circumstances. For example, different ACLs can be used to handle RCPT commands for different local users or different local domains. .vitem &*authenticated&~=&~*&<&'string&~list'&> -.cindex "&%authenticated%&" "ACL condition" +.cindex "&%authenticated%& ACL condition" .cindex "authentication" "ACL checking" .cindex "&ACL;" "testing for authentication" If the SMTP connection is not authenticated, the condition is false. Otherwise, @@ -24657,32 +27661,36 @@ authenticated = * .endd .vitem &*condition&~=&~*&<&'string'&> -.cindex "&%condition%&" "ACL condition" +.cindex "&%condition%& ACL condition" .cindex "customizing" "ACL condition" .cindex "&ACL;" "customized test" -.cindex "&ACL;" "testing; customized" +.cindex "&ACL;" "testing, customized" This feature allows you to make up custom conditions. If the result of expanding the string is an empty string, the number zero, or one of the strings &"no"& or &"false"&, the condition is false. If the result is any non-zero number, or one of the strings &"yes"& or &"true"&, the condition is true. For -any other values, some error is assumed to have occurred, and the ACL returns -&"defer"&. +any other value, some error is assumed to have occurred, and the ACL returns +&"defer"&. However, if the expansion is forced to fail, the condition is +ignored. The effect is to treat it as true, whether it is positive or +negative. .vitem &*decode&~=&~*&<&'location'&> -.cindex "&%decode%&" "ACL condition" +.cindex "&%decode%& ACL condition" This condition is available only when Exim is compiled with the -content-scanning extension, and it is allowed only the the ACL defined by +content-scanning extension, and it is allowed only in the ACL defined by &%acl_smtp_mime%&. It causes the current MIME part to be decoded into a file. -For details, see chapter &<>&. +If all goes well, the condition is true. It is false only if there are +problems such as a syntax error or a memory shortage. For more details, see +chapter &<>&. .vitem &*demime&~=&~*&<&'extension&~list'&> -.cindex "&%demime%&" "ACL condition" +.cindex "&%demime%& ACL condition" This condition is available only when Exim is compiled with the content-scanning extension. Its use is described in section &<>&. .vitem &*dnslists&~=&~*&<&'list&~of&~domain&~names&~and&~other&~data'&> -.cindex "&%dnslists%&" "ACL condition" +.cindex "&%dnslists%& ACL condition" .cindex "DNS list" "in ACL" .cindex "black list (DNS)" .cindex "&ACL;" "testing a DNS list" @@ -24690,21 +27698,25 @@ This condition checks for entries in DNS black lists. These are also known as &"RBL lists"&, after the original Realtime Blackhole List, but note that the use of the lists at &'mail-abuse.org'& now carries a charge. There are too many different variants of this condition to describe briefly here. See sections -&<>&--&<>& for details. +&<>&&--&<>& for details. .vitem &*domains&~=&~*&<&'domain&~list'&> -.cindex "&%domains%&" "ACL condition" +.cindex "&%domains%& ACL condition" .cindex "domain" "ACL checking" .cindex "&ACL;" "testing a recipient domain" -.cindex "&$domain_data$&" +.vindex "&$domain_data$&" This condition is relevant only after a RCPT command. It checks that the domain of the recipient address is in the domain list. If percent-hack processing is enabled, it is done before this test is done. If the check succeeds with a lookup, the result of the lookup is placed in &$domain_data$& until the next &%domains%& test. +&*Note carefully*& (because many people seem to fall foul of this): you cannot +use &%domains%& in a DATA ACL. + + .vitem &*encrypted&~=&~*&<&'string&~list'&> -.cindex "&%encrypted%&" "ACL condition" +.cindex "&%encrypted%& ACL condition" .cindex "encryption" "checking in an ACL" .cindex "&ACL;" "testing for encryption" If the SMTP connection is not encrypted, the condition is false. Otherwise, the @@ -24714,8 +27726,9 @@ encryption without testing for any specific cipher suite(s), set encrypted = * .endd -.vitem &*hosts&~=&~*&<&'&~host&~list'&> -.cindex "&%hosts%&" "ACL condition" + +.vitem &*hosts&~=&~*&<&'host&~list'&> +.cindex "&%hosts%& ACL condition" .cindex "host" "ACL checking" .cindex "&ACL;" "testing the client host" This condition tests that the calling host matches the host list. If you have @@ -24724,12 +27737,16 @@ you should normally put the IP addresses first. For example, you could have: .code accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts .endd -The reason for this lies in the left-to-right way that Exim processes lists. -It can test IP addresses without doing any DNS lookups, but when it reaches an -item that requires a host name, it fails if it cannot find a host name to -compare with the pattern. If the above list is given in the opposite order, the -&%accept%& statement fails for a host whose name cannot be found, even if its -IP address is 10.9.8.7. +The lookup in this example uses the host name for its key. This is implied by +the lookup type &"dbm"&. (For a host address lookup you would use &"net-dbm"& +and it wouldn't matter which way round you had these two items.) + +The reason for the problem with host names lies in the left-to-right way that +Exim processes lists. It can test IP addresses without doing any DNS lookups, +but when it reaches an item that requires a host name, it fails if it cannot +find a host name to compare with the pattern. If the above list is given in the +opposite order, the &%accept%& statement fails for a host whose name cannot be +found, even if its IP address is 10.9.8.7. If you really do want to do the name check first, and still recognize the IP address even if the name lookup fails, you can rewrite the ACL like this: @@ -24741,7 +27758,7 @@ The default action on failing to find the host name is to assume that the host is not in the list, so the first &%accept%& statement fails. The second statement can then check the IP address. -.cindex "&$host_data$&" +.vindex "&$host_data$&" If a &%hosts%& condition is satisfied by means of a lookup, the result of the lookup is made available in the &$host_data$& variable. This allows you, for example, to set up a statement like this: @@ -24752,10 +27769,10 @@ message = $host_data which gives a custom error message for each denied host. .vitem &*local_parts&~=&~*&<&'local&~part&~list'&> -.cindex "&%local_parts%&" "ACL condition" +.cindex "&%local_parts%& ACL condition" .cindex "local part" "ACL checking" .cindex "&ACL;" "testing a local part" -.cindex "&$local_part_data$&" +.vindex "&$local_part_data$&" This condition is relevant only after a RCPT command. It checks that the local part of the recipient address is in the list. If percent-hack processing is enabled, it is done before this test. If the check succeeds with a lookup, the @@ -24763,7 +27780,7 @@ result of the lookup is placed in &$local_part_data$&, which remains set until the next &%local_parts%& test. .vitem &*malware&~=&~*&<&'option'&> -.cindex "&%malware%&" "ACL condition" +.cindex "&%malware%& ACL condition" .cindex "&ACL;" "virus scanning" .cindex "&ACL;" "scanning for viruses" This condition is available only when Exim is compiled with the @@ -24771,10 +27788,10 @@ content-scanning extension. It causes the incoming message to be scanned for viruses. For details, see chapter &<>&. .vitem &*mime_regex&~=&~*&<&'list&~of&~regular&~expressions'&> -.cindex "&%mime_regex%&" "ACL condition" +.cindex "&%mime_regex%& ACL condition" .cindex "&ACL;" "testing by regex matching" This condition is available only when Exim is compiled with the -content-scanning extension, and it is allowed only the the ACL defined by +content-scanning extension, and it is allowed only in the ACL defined by &%acl_smtp_mime%&. It causes the current MIME part to be scanned for a match with any of the regular expressions. For details, see chapter &<>&. @@ -24785,14 +27802,14 @@ This condition can be used to limit the rate at which a user or host submits messages. Details are given in section &<>&. .vitem &*recipients&~=&~*&<&'address&~list'&> -.cindex "&%recipients%&" "ACL condition" +.cindex "&%recipients%& ACL condition" .cindex "recipient" "ACL checking" .cindex "&ACL;" "testing a recipient" This condition is relevant only after a RCPT command. It checks the entire recipient address against a list of recipients. .vitem &*regex&~=&~*&<&'list&~of&~regular&~expressions'&> -.cindex "&%regex%&" "ACL condition" +.cindex "&%regex%& ACL condition" .cindex "&ACL;" "testing by regex matching" This condition is available only when Exim is compiled with the content-scanning extension, and is available only in the DATA, MIME, and @@ -24800,11 +27817,11 @@ non-SMTP ACLs. It causes the incoming message to be scanned for a match with any of the regular expressions. For details, see chapter &<>&. .vitem &*sender_domains&~=&~*&<&'domain&~list'&> -.cindex "&%sender_domains%&" "ACL condition" +.cindex "&%sender_domains%& ACL condition" .cindex "sender" "ACL checking" .cindex "&ACL;" "testing a sender domain" -.cindex "&$domain$&" -.cindex "&$sender_address_domain$&" +.vindex "&$domain$&" +.vindex "&$sender_address_domain$&" This condition tests the domain of the sender of the message against the given domain list. &*Note*&: The domain of the sender address is in &$sender_address_domain$&. It is &'not'& put in &$domain$& during the testing @@ -24817,7 +27834,7 @@ influence the sender checking. relaying, because sender addresses are easily, and commonly, forged. .vitem &*senders&~=&~*&<&'address&~list'&> -.cindex "&%senders%&" "ACL condition" +.cindex "&%senders%& ACL condition" .cindex "sender" "ACL checking" .cindex "&ACL;" "testing a sender" This condition tests the sender of the message against the given list. To test @@ -24829,14 +27846,14 @@ senders = : relaying, because sender addresses are easily, and commonly, forged. .vitem &*spam&~=&~*&<&'username'&> -.cindex "&%spam%&" "ACL condition" +.cindex "&%spam%& ACL condition" .cindex "&ACL;" "scanning for spam" This condition is available only when Exim is compiled with the content-scanning extension. It causes the incoming message to be scanned by SpamAssassin. For details, see chapter &<>&. .vitem &*verify&~=&~certificate*& -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "TLS" "client certificate verification" .cindex "certificate" "verification of client" .cindex "&ACL;" "certificate verification" @@ -24853,7 +27870,7 @@ send email. Details of how this works are given in section &<>&. .vitem &*verify&~=&~header_sender/*&<&'options'&> -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying sender in the header" .cindex "header lines" "verifying the sender in" .cindex "sender" "verifying in header" @@ -24879,7 +27896,7 @@ deny senders = : .endd .vitem &*verify&~=&~header_syntax*& -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying header syntax" .cindex "header lines" "verifying syntax" .cindex "verifying" "header syntax" @@ -24901,22 +27918,26 @@ and this condition can be used to reject such messages, though they are not as common as they used to be. .vitem &*verify&~=&~helo*& -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying HELO/EHLO" .cindex "HELO" "verifying" .cindex "EHLO" "verifying" .cindex "verifying" "EHLO" .cindex "verifying" "HELO" This condition is true if a HELO or EHLO command has been received from the -client host, and its contents have been verified. It there has been no previous -attempt to verify the the HELO/EHLO contents, it is carried out when this +client host, and its contents have been verified. If there has been no previous +attempt to verify the HELO/EHLO contents, it is carried out when this condition is encountered. See the description of the &%helo_verify_hosts%& and &%helo_try_verify_hosts%& options for details of how to request verification independently of this condition. +For SMTP input that does not come over TCP/IP (the &%-bs%& command line +option), this condition is always true. + + .vitem &*verify&~=&~not_blind*& .cindex "verifying" "not blind" -.cindex "bcc recipients" "verifying none" +.cindex "bcc recipients, verifying none" This condition checks that there are no blind (bcc) recipients in the message. Every envelope recipient must appear either in a &'To:'& header line or in a &'Cc:'& header line for this condition to be true. Local parts are checked @@ -24929,11 +27950,11 @@ recipients. This check should not be used on its own for blocking messages. .vitem &*verify&~=&~recipient/*&<&'options'&> -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying recipient" .cindex "recipient" "verifying" .cindex "verifying" "recipient" -.cindex "&$address_data$&" +.vindex "&$address_data$&" This condition is relevant only after a RCPT command. It verifies the current recipient. Details of address verification are given later, starting at section &<>&. After a recipient has been verified, the value @@ -24944,7 +27965,7 @@ address, and in that case, the subsequent value of &$address_data$& is the value for the child address. .vitem &*verify&~=&~reverse_host_lookup*& -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying host reverse lookup" .cindex "host" "verifying reverse lookup" This condition ensures that a verified host name has been looked up from the IP @@ -24958,7 +27979,7 @@ If this condition is used for a locally generated message (that is, when there is no client host involved), it always succeeds. .vitem &*verify&~=&~sender/*&<&'options'&> -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" .cindex "&ACL;" "verifying sender" .cindex "sender" "verifying" .cindex "verifying" "sender" @@ -24967,8 +27988,8 @@ message has been received (the &%acl_smtp_data%& or &%acl_not_smtp%& ACLs). If the message's sender is empty (that is, this is a bounce message), the condition is true. Otherwise, the sender address is verified. -.cindex "&$address_data$&" -.cindex "&$sender_address_data$&" +.vindex "&$address_data$&" +.vindex "&$sender_address_data$&" If there is data in the &$address_data$& variable at the end of routing, its value is placed in &$sender_address_data$& at the end of verification. This value can be used in subsequent conditions and modifiers in the same ACL @@ -24980,7 +28001,7 @@ Details of verification are given later, starting at section to avoid doing it more than once per message. .vitem &*verify&~=&~sender=*&<&'address'&>&*/*&<&'options'&> -.cindex "&%verify%&" "ACL condition" +.cindex "&%verify%& ACL condition" This is a variation of the previous option, in which a modified address is verified as a sender. .endlist @@ -24993,7 +28014,9 @@ verified as a sender. .cindex "&ACL;" "testing a DNS list" In its simplest form, the &%dnslists%& condition tests whether the calling host is on at least one of a number of DNS lists by looking up the inverted IP -address in one or more DNS domains. For example, if the calling host's IP +address in one or more DNS domains. (Note that DNS list domains are not mail +domains, so the &`+`& syntax for named lists doesn't work - it is used for +special options instead.) For example, if the calling host's IP address is 192.168.62.43, and the ACL statement is .code deny dnslists = blackholes.mail-abuse.org : \ @@ -25047,7 +28070,7 @@ connections (but your local name server cache should be active). -.section "Specifying the IP address for a DNS list lookup" +.section "Specifying the IP address for a DNS list lookup" "SECID201" .cindex "DNS list" "keyed by explicit IP address" By default, the IP address that is used in a DNS list lookup is the IP address of the calling host. However, you can specify another IP address by listing it @@ -25063,7 +28086,7 @@ MX hosts or nameservers of an email sender address. For an example, see section -.section "DNS lists keyed on domain names" +.section "DNS lists keyed on domain names" "SECID202" .cindex "DNS list" "keyed by domain name" There are some lists that are keyed on domain names rather than inverted IP addresses (see for example the &'domain based zones'& link at @@ -25154,11 +28177,13 @@ dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|... Thus, this example checks whether or not the IP addresses of the sender domain's mail servers are on the Spamhaus black list. +The key that was used for a successful DNS list lookup is put into the variable +&$dnslist_matched$& (see section &<>&). -.section "Data returned by DNS lists" +.section "Data returned by DNS lists" "SECID203" .cindex "DNS list" "data returned from" DNS lists are constructed using address records in the DNS. The original RBL just used the address 127.0.0.1 on the right hand side of each record, but the @@ -25173,24 +28198,48 @@ The values used on the RBL+ list are: 127.1.0.6 RSS and DUL 127.1.0.7 RSS and DUL and RBL .endd -Some DNS lists may return more than one address record. +Section &<>& below describes how you can distinguish between +different values. Some DNS lists may return more than one address record; +see section &<>& for details of how they are checked. -.section "Variables set from DNS lists" +.section "Variables set from DNS lists" "SECID204" +.cindex "expansion" "variables, set from DNS list" .cindex "DNS list" "variables set from" -.cindex "&$dnslist_domain$&" -.cindex "&$dnslist_text$&" -.cindex "&$dnslist_value$&" -When an entry is found in a DNS list, the variable &$dnslist_domain$& -contains the name of the domain that matched, &$dnslist_value$& contains the -data from the entry, and &$dnslist_text$& contains the contents of any -associated TXT record. If more than one address record is returned by the DNS -lookup, all the IP addresses are included in &$dnslist_value$&, separated by -commas and spaces. - -You can use these variables in &%message%& or &%log_message%& modifiers &-- -although these appear before the condition in the ACL, they are not expanded -until after it has failed. For example: +.vindex "&$dnslist_domain$&" +.vindex "&$dnslist_matched$&" +.vindex "&$dnslist_text$&" +.vindex "&$dnslist_value$&" +When an entry is found in a DNS list, the variable &$dnslist_domain$& contains +the name of the overall domain that matched (for example, +&`spamhaus.example`&), &$dnslist_matched$& contains the key within that domain +(for example, &`192.168.5.3`&), and &$dnslist_value$& contains the data from +the DNS record. When the key is an IP address, it is not reversed in +&$dnslist_matched$& (though it is, of course, in the actual lookup). In simple +cases, for example: +.code +deny dnslists = spamhaus.example +.endd +the key is also available in another variable (in this case, +&$sender_host_address$&). In more complicated cases, however, this is not true. +For example, using a data lookup (as described in section &<>&) +might generate a dnslists lookup like this: +.code +deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|... +.endd +If this condition succeeds, the value in &$dnslist_matched$& might be +&`192.168.6.7`& (for example). + +If more than one address record is returned by the DNS lookup, all the IP +addresses are included in &$dnslist_value$&, separated by commas and spaces. +The variable &$dnslist_text$& contains the contents of any associated TXT +record. For lists such as RBL+ the TXT record for a merged entry is often not +very meaningful. See section &<>& for a way of obtaining more +information. + +You can use the DNS list variables in &%message%& or &%log_message%& modifiers +&-- although these appear before the condition in the ACL, they are not +expanded until after it has failed. For example: .code deny hosts = !+local_networks message = $sender_host_address is listed \ @@ -25209,8 +28258,9 @@ For example, deny dnslists = rblplus.mail-abuse.org=127.0.0.2 .endd rejects only those hosts that yield 127.0.0.2. Without this additional data, -any address record is considered to be a match. If more than one address record -is found on the list, they are all checked for a matching right-hand side. +any address record is considered to be a match. For the moment, we assume +that the DNS lookup returns just one record. Section &<>& +describes how multiple records are handled. More than one IP address may be given for checking, using a comma as a separator. These are alternatives &-- if any one of them matches, the @@ -25245,7 +28295,7 @@ an odd number. -.section "Negated DNS matching conditions" +.section "Negated DNS matching conditions" "SECID205" You can supply a negative list of IP addresses as part of a &%dnslists%& condition. Whereas .code @@ -25291,6 +28341,119 @@ which is less clear, and harder to maintain. +.section "Handling multiple DNS records from a DNS list" "SECThanmuldnsrec" +A DNS lookup for a &%dnslists%& condition may return more than one DNS record, +thereby providing more than one IP address. When an item in a &%dnslists%& list +is followed by &`=`& or &`&&`& and a list of IP addresses, in order to restrict +the match to specific results from the DNS lookup, there are two ways in which +the checking can be handled. For example, consider the condition: +.code +dnslists = a.b.c=127.0.0.1 +.endd +What happens if the DNS lookup for the incoming IP address yields both +127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the +condition true because at least one given value was found, or is it false +because at least one of the found values was not listed? And how does this +affect negated conditions? Both possibilities are provided for with the help of +additional separators &`==`& and &`=&&`&. + +.ilist +If &`=`& or &`&&`& is used, the condition is true if any one of the looked up +IP addresses matches one of the listed addresses. For the example above, the +condition is true because 127.0.0.1 matches. +.next +If &`==`& or &`=&&`& is used, the condition is true only if every one of the +looked up IP addresses matches one of the listed addresses. If the condition is +changed to: +.code +dnslists = a.b.c==127.0.0.1 +.endd +and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is +false because 127.0.0.2 is not listed. You would need to have: +.code +dnslists = a.b.c==127.0.0.1,127.0.0.2 +.endd +for the condition to be true. +.endlist + +When &`!`& is used to negate IP address matching, it inverts the result, giving +the precise opposite of the behaviour above. Thus: +.ilist +If &`!=`& or &`!&&`& is used, the condition is true if none of the looked up IP +addresses matches one of the listed addresses. Consider: +.code +dnslists = a.b.c!&0.0.0.1 +.endd +If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is +false because 127.0.0.1 matches. +.next +If &`!==`& or &`!=&&`& is used, the condition is true if there is at least one +looked up IP address that does not match. Consider: +.code +dnslists = a.b.c!=&0.0.0.1 +.endd +If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is +true, because 127.0.0.2 does not match. You would need to have: +.code +dnslists = a.b.c!=&0.0.0.1,0.0.0.2 +.endd +for the condition to be false. +.endlist +When the DNS lookup yields only a single IP address, there is no difference +between &`=`& and &`==`& and between &`&&`& and &`=&&`&. + + + + +.section "Detailed information from merged DNS lists" "SECTmordetinf" +.cindex "DNS list" "information from merged" +When the facility for restricting the matching IP values in a DNS list is used, +the text from the TXT record that is set in &$dnslist_text$& may not reflect +the true reason for rejection. This happens when lists are merged and the IP +address in the A record is used to distinguish them; unfortunately there is +only one TXT record. One way round this is not to use merged lists, but that +can be inefficient because it requires multiple DNS lookups where one would do +in the vast majority of cases when the host of interest is not on any of the +lists. + +A less inefficient way of solving this problem is available. If +two domain names, comma-separated, are given, the second is used first to +do an initial check, making use of any IP value restrictions that are set. +If there is a match, the first domain is used, without any IP value +restrictions, to get the TXT record. As a byproduct of this, there is also +a check that the IP being tested is indeed on the first list. The first +domain is the one that is put in &$dnslist_domain$&. For example: +.code +reject message = \ + rejected because $sender_host_address is blacklisted \ + at $dnslist_domain\n$dnslist_text + dnslists = \ + sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \ + dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10 +.endd +For the first blacklist item, this starts by doing a lookup in +&'sbl-xbl.spamhaus.org'& and testing for a 127.0.0.2 return. If there is a +match, it then looks in &'sbl.spamhaus.org'&, without checking the return +value, and as long as something is found, it looks for the corresponding TXT +record. If there is no match in &'sbl-xbl.spamhaus.org'&, nothing more is done. +The second blacklist item is processed similarly. + +If you are interested in more than one merged list, the same list must be +given several times, but because the results of the DNS lookups are cached, +the DNS calls themselves are not repeated. For example: +.code +reject dnslists = \ + http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \ + socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \ + misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \ + dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10 +.endd +In this case there is one lookup in &'dnsbl.sorbs.net'&, and if none of the IP +values matches (or if no record is found), this is the only lookup that is +done. Only if there is a match is one of the more specific lists consulted. + + + .section "DNS lists and IPv6" "SECTmorednslistslast" .cindex "IPv6" "DNS black lists" .cindex "DNS list" "IPv6 usage" @@ -25317,10 +28480,10 @@ deny condition = ${if isip4{$sender_host_address}} dnslists = some.list.example .endd -.section "Rate limiting senders" "SECTratelimiting" +.section "Rate limiting incoming messages" "SECTratelimiting" .cindex "rate limiting" "client sending" .cindex "limiting client sending rates" -.oindex "&%smpt_ratelimit_*%&" +.oindex "&%smtp_ratelimit_*%&" The &%ratelimit%& ACL condition can be used to measure and control the rate at which clients can send email. This is more powerful than the &%smtp_ratelimit_*%& options, because those options control the rate of @@ -25345,7 +28508,7 @@ parameter &'m'& is the maximum number of messages that a client is permitted to send in each time interval. It also specifies the number of messages permitted in a fast burst. By increasing both &'m'& and &'p'& but keeping &'m/p'& constant, you can allow a client to send more messages in a burst without -changing its overall sending rate limit. Conversely, if &'m'& and &'p'& are +changing its long-term sending rate limit. Conversely, if &'m'& and &'p'& are both small, messages must be sent at an even rate. There is a script in &_util/ratelimit.pl_& which extracts sending rates from @@ -25354,71 +28517,195 @@ when deploying the &%ratelimit%& ACL condition. The script prints usage instructions when it is run with no arguments. The key is used to look up the data for calculating the client's average -sending rate. This data is stored in a database maintained by Exim in its spool -directory, alongside the retry and other hints databases. The default key is -&$sender_host_address$&, which applies the limit to each client host IP address. +sending rate. This data is stored in Exim's spool directory, alongside the +retry and other hints databases. The default key is &$sender_host_address$&, +which means Exim computes the sending rate of each client host IP address. By changing the key you can change how Exim identifies clients for the purpose of ratelimiting. For example, to limit the sending rate of each authenticated user, independent of the computer they are sending from, set the key to &$authenticated_id$&. You must ensure that the lookup key is meaningful; for example, &$authenticated_id$& is only meaningful if the client has -authenticated, and you can check with with the &%authenticated%& ACL condition. +authenticated (which you can check with the &%authenticated%& ACL condition). -Internally, Exim includes the smoothing constant &'p'& and the options in the -lookup key because they alter the meaning of the stored data. This is not true -for the limit &'m'&, so you can alter the configured maximum rate and Exim will -still remember clients' past behaviour, but if you alter the other ratelimit -parameters Exim forgets past behaviour. +The lookup key does not have to identify clients: If you want to limit the +rate at which a recipient receives messages, you can use the key +&`$local_part@$domain`& with the &%per_rcpt%& option (see below) in a RCPT +ACL. -Each &%ratelimit%& condition can have up to two options. The first option -specifies what Exim measures the rate of, and the second specifies how Exim -handles excessively fast clients. The options are separated by a slash, like -the other parameters. +Each &%ratelimit%& condition can have up to four options. A &%per_*%& option +specifies what Exim measures the rate of, for example messages or recipients +or bytes. You can adjust the measurement using the &%unique=%& and/or +&%count=%& options. You can also control when Exim updates the recorded rate +using a &%strict%&, &%leaky%&, or &%readonly%& option. The options are +separated by a slash, like the other parameters. They may appear in any order. -The &%per_conn%& option limits the client's connection rate. +Internally, Exim appends the smoothing constant &'p'& onto the lookup key with +any options that alter the meaning of the stored data. The limit &'m'& is not +stored, so you can alter the configured maximum rate and Exim will still +remember clients' past behaviour. If you change the &%per_*%& mode or add or +remove the &%unique=%& option, the lookup key changes so Exim will forget past +behaviour. The lookup key is not affected by changes to the update mode and +the &%count=%& option. -The &%per_mail%& option limits the client's rate of sending messages. This is -the default if none of the &%per_*%& options is specified. -The &%per_byte%& option limits the sender's email bandwidth. Note that it is -best to use this option in the DATA ACL; if it is used in an earlier ACL it -relies on the SIZE parameter on the MAIL command, which may be inaccurate or -completely missing. You can follow the limit &'m'& in the configuration with K, -M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively. +.section "Ratelimit options for what is being measured" "ratoptmea" +.cindex "rate limiting" "per_* options" +The &%per_conn%& option limits the client's connection rate. It is not +normally used in the &%acl_not_smtp%&, &%acl_not_smtp_mime%&, or +&%acl_not_smtp_start%& ACLs. -The &%per_cmd%& option causes Exim to recompute the rate every time the -condition is processed. This can be used to limit the SMTP command rate. The -alias &%per_rcpt%& is provided for use in the RCPT ACL instead of &%per_cmd%& -to make it clear that the effect is to limit the rate at which recipients are -accepted. Note that in this case the rate limiting engine will see a message -with many recipients as a large high-speed burst. +The &%per_mail%& option limits the client's rate of sending messages. This is +the default if none of the &%per_*%& options is specified. It can be used in +&%acl_smtp_mail%&, &%acl_smtp_rcpt%&, &%acl_smtp_predata%&, &%acl_smtp_mime%&, +&%acl_smtp_data%&, or &%acl_not_smtp%&. + +The &%per_byte%& option limits the sender's email bandwidth. It can be used in +the same ACLs as the &%per_mail%& option, though it is best to use this option +in the &%acl_smtp_mime%&, &%acl_smtp_data%& or &%acl_not_smtp%& ACLs; if it is +used in an earlier ACL, Exim relies on the SIZE parameter given by the client +in its MAIL command, which may be inaccurate or completely missing. You can +follow the limit &'m'& in the configuration with K, M, or G to specify limits +in kilobytes, megabytes, or gigabytes, respectively. + +The &%per_rcpt%& option causes Exim to limit the rate at which recipients are +accepted. It can be used in the &%acl_smtp_rcpt%&, &%acl_smtp_predata%&, +&%acl_smtp_mime%&, &%acl_smtp_data%&, or &%acl_smtp_rcpt%& ACLs. In +&%acl_smtp_rcpt%& the rate is updated one recipient at a time; in the other +ACLs the rate is updated with the total recipient count in one go. Note that +in either case the rate limiting engine will see a message with many +recipients as a large high-speed burst. + +The &%per_addr%& option is like the &%per_rcpt%& option, except it counts the +number of different recipients that the client has sent messages to in the +last time period. That is, if the client repeatedly sends messages to the same +recipient, its measured rate is not increased. This option can only be used in +&%acl_smtp_rcpt%&. +The &%per_cmd%& option causes Exim to recompute the rate every time the +condition is processed. This can be used to limit the rate of any SMTP +command. If it is used in multiple ACLs it can limit the aggregate rate of +multiple different commands. + +The &%count=%& option can be used to alter how much Exim adds to the client's +measured rate. For example, the &%per_byte%& option is equivalent to +&`per_mail/count=$message_size`&. If there is no &%count=%& option, Exim +increases the measured rate by one (except for the &%per_rcpt%& option in ACLs +other than &%acl_smtp_rcpt%&). The count does not have to be an integer. + +The &%unique=%& option is described in section &<>& below. + + +.section "Ratelimit update modes" "ratoptupd" +.cindex "rate limiting" "reading data without updating" +You can specify one of three options with the &%ratelimit%& condition to +control when its database is updated. This section describes the &%readonly%& +mode, and the next section describes the &%strict%& and &%leaky%& modes. + +If the &%ratelimit%& condition is used in &%readonly%& mode, Exim looks up a +previously-computed rate to check against the limit. + +For example, you can test the client's sending rate and deny it access (when +it is too fast) in the connect ACL. If the client passes this check then it +can go on to send a message, in which case its recorded rate will be updated +in the MAIL ACL. Subsequent connections from the same client will check this +new rate. +.code +acl_check_connect: + deny ratelimit = 100 / 5m / readonly + log_message = RATE CHECK: $sender_rate/$sender_rate_period \ + (max $sender_rate_limit) +# ... +acl_check_mail: + warn ratelimit = 100 / 5m / strict + log_message = RATE UPDATE: $sender_rate/$sender_rate_period \ + (max $sender_rate_limit) +.endd + +If Exim encounters multiple &%ratelimit%& conditions with the same key when +processing a message then it may increase the client's measured rate more than +it should. For example, this will happen if you check the &%per_rcpt%& option +in both &%acl_smtp_rcpt%& and &%acl_smtp_data%&. However it's OK to check the +same &%ratelimit%& condition multiple times in the same ACL. You can avoid any +multiple update problems by using the &%readonly%& option on later ratelimit +checks. + +The &%per_*%& options described above do not make sense in some ACLs. If you +use a &%per_*%& option in an ACL where it is not normally permitted then the +update mode defaults to &%readonly%& and you cannot specify the &%strict%& or +&%leaky%& modes. In other ACLs the default update mode is &%leaky%& (see the +next section) so you must specify the &%readonly%& option explicitly. + + +.section "Ratelimit options for handling fast clients" "ratoptfast" +.cindex "rate limiting" "strict and leaky modes" If a client's average rate is greater than the maximum, the rate limiting engine can react in two possible ways, depending on the presence of the -&%strict%& or &%leaky%& options. This is independent of the other +&%strict%& or &%leaky%& update modes. This is independent of the other counter-measures (such as rejecting the message) that may be specified by the -rest of the ACL. The default mode is leaky, which avoids a sender's -over-aggressive retry rate preventing it from getting any email through. - -The &%strict%& option means that the client's recorded rate is always updated. -The effect of this is that Exim measures the client's average rate of attempts -to send email, which can be much higher than the maximum. If the client is over -the limit it will be subjected to counter-measures until it slows down below -the maximum rate. The smoothing period determines the time it takes for a high -sending rate to decay exponentially to 37% of its peak value, which means that -you can work out the time (the number of smoothing periods) that a client is -subjected to counter-measures after an over-limit burst with this formula: -.code -ln(peakrate/maxrate) -.endd -The &%leaky%& option means that the client's recorded rate is not updated if it -is above the limit. The effect of this is that Exim measures the client's -average rate of successfully sent email, which cannot be greater than the -maximum. If the client is over the limit it will suffer some counter-measures, -but it will still be able to send email at the configured maximum rate, -whatever the rate of its attempts. This is generally the better choice if you -have clients that retry automatically. - +rest of the ACL. + +The &%leaky%& (default) option means that the client's recorded rate is not +updated if it is above the limit. The effect of this is that Exim measures the +client's average rate of successfully sent email, which cannot be greater than +the maximum allowed. If the client is over the limit it may suffer some +counter-measures (as specified in the ACL), but it will still be able to send +email at the configured maximum rate, whatever the rate of its attempts. This +is generally the better choice if you have clients that retry automatically. +For example, it does not prevent a sender with an over-aggressive retry rate +from getting any email through. + +The &%strict%& option means that the client's recorded rate is always +updated. The effect of this is that Exim measures the client's average rate +of attempts to send email, which can be much higher than the maximum it is +actually allowed. If the client is over the limit it may be subjected to +counter-measures by the ACL. It must slow down and allow sufficient time to +pass that its computed rate falls below the maximum before it can send email +again. The time (the number of smoothing periods) it must wait and not +attempt to send mail can be calculated with this formula: +.code + ln(peakrate/maxrate) +.endd + + +.section "Limiting the rate of different events" "ratoptuniq" +.cindex "rate limiting" "counting unique events" +The &%ratelimit%& &%unique=%& option controls a mechanism for counting the +rate of different events. For example, the &%per_addr%& option uses this +mechanism to count the number of different recipients that the client has +sent messages to in the last time period; it is equivalent to +&`per_rcpt/unique=$local_part@$domain`&. You could use this feature to +measure the rate that a client uses different sender addresses with the +options &`per_mail/unique=$sender_address`&. + +For each &%ratelimit%& key Exim stores the set of &%unique=%& values that it +has seen for that key. The whole set is thrown away when it is older than the +rate smoothing period &'p'&, so each different event is counted at most once +per period. In the &%leaky%& update mode, an event that causes the client to +go over the limit is not added to the set, in the same way that the client's +recorded rate is not updated in the same situation. + +When you combine the &%unique=%& and &%readonly%& options, the specific +&%unique=%& value is ignored, and Exim just retrieves the client's stored +rate. + +The &%unique=%& mechanism needs more space in the ratelimit database than the +other &%ratelimit%& options in order to store the event set. The number of +unique values is potentially as large as the rate limit, so the extra space +required increases with larger limits. + +The uniqueification is not perfect: there is a small probability that Exim +will think a new event has happened before. If the sender's rate is less than +the limit, Exim should be more than 99.9% correct. However in &%strict%& mode +the measured rate can go above the limit, in which case Exim may under-count +events by a significant margin. Fortunately, if the rate is high enough (2.7 +times the limit) that the false positive rate goes above 9%, then Exim will +throw away the over-full event set before the measured rate falls below the +limit. Therefore the only harm should be that exceptionally high sending rates +are logged incorrectly; any countermeasures you configure will be as effective +as intended. + + +.section "Using rate limiting" "useratlim" Exim's other ACL facilities are used to define what counter-measures are taken when the rate limit is exceeded. This might be anything from logging a warning (for example, while measuring existing sending rates in order to define @@ -25426,35 +28713,30 @@ policy), through time delays to slow down fast senders, up to rejecting the message. For example: .code # Log all senders' rates -warn - ratelimit = 0 / 1h / strict - log_message = Sender rate $sender_rate / $sender_rate_period +warn ratelimit = 0 / 1h / strict + log_message = Sender rate $sender_rate / $sender_rate_period # Slow down fast senders; note the need to truncate $sender_rate # at the decimal point. -warn - ratelimit = 100 / 1h / per_rcpt / strict - delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \ - $sender_rate_limit }s +warn ratelimit = 100 / 1h / per_rcpt / strict + delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \ + $sender_rate_limit }s # Keep authenticated users under control -deny - authenticated = * - ratelimit = 100 / 1d / strict / $authenticated_id +deny authenticated = * + ratelimit = 100 / 1d / strict / $authenticated_id # System-wide rate limit -defer - message = Sorry, too busy. Try again later. - ratelimit = 10 / 1s / $primary_hostname +defer message = Sorry, too busy. Try again later. + ratelimit = 10 / 1s / $primary_hostname # Restrict incoming rate from each host, with a default # set using a macro and special cases looked up in a table. -defer - message = Sender rate exceeds $sender_rate_limit \ - messages per $sender_rate_period - ratelimit = ${lookup {$sender_host_address} \ - cdb {DB/ratelimits.cdb} \ - {$value} {RATELIMIT} } +defer message = Sender rate exceeds $sender_rate_limit \ + messages per $sender_rate_period + ratelimit = ${lookup {$sender_host_address} \ + cdb {DB/ratelimits.cdb} \ + {$value} {RATELIMIT} } .endd &*Warning*&: If you have a busy server with a lot of &%ratelimit%& tests, especially with the &%per_rcpt%& option, you may suffer from a performance @@ -25465,14 +28747,16 @@ this means that Exim will lose its hints data after a reboot (including retry hints, the callout cache, and ratelimit data). + .section "Address verification" "SECTaddressverification" .cindex "verifying address" "options for" .cindex "policy control" "address verification" Several of the &%verify%& conditions described in section -&<>& cause addresses to be verified. These conditions can be -followed by options that modify the verification process. The options are -separated from the keyword and from each other by slashes, and some of them -contain parameters. For example: +&<>& cause addresses to be verified. Section +&<>& discusses the reporting of sender verification failures. +The verification conditions can be followed by options that modify the +verification process. The options are separated from the keyword and from each +other by slashes, and some of them contain parameters. For example: .code verify = sender/callout verify = recipient/defer_ok/callout=10s,defer_ok @@ -25504,9 +28788,9 @@ discussion in section &<>&. .endlist .cindex "verifying address" "differentiating failures" -.cindex "&$recipient_verify_failure$&" -.cindex "&$sender_verify_failure$&" -.cindex "&$acl_verify_message$&" +.vindex "&$recipient_verify_failure$&" +.vindex "&$sender_verify_failure$&" +.vindex "&$acl_verify_message$&" After an address verification failure, &$acl_verify_message$& contains the error message that is associated with the failure. It can be preserved by coding like this: @@ -25582,13 +28866,15 @@ The port that is used is taken from the transport, if it is specified and is a remote transport. (For routers that do verification only, no transport need be specified.) Otherwise, the default SMTP port is used. If a remote transport specifies an outgoing interface, this is used; otherwise the interface is not -specified. +specified. Likewise, the text that is used for the HELO command is taken from +the transport's &%helo_data%& option; if there is no transport, the value of +&$smtp_active_hostname$& is used. For a sender callout check, Exim makes SMTP connections to the remote hosts, to test whether a bounce message could be delivered to the sender address. The following SMTP commands are sent: .display -&`HELO `&<&'smtp active host name'&> +&`HELO `&<&'local host name'&> &`MAIL FROM:<>`& &`RCPT TO:`&<&'the address to be tested'&> &`QUIT`& @@ -25596,6 +28882,9 @@ following SMTP commands are sent: LHLO is used instead of HELO if the transport's &%protocol%& option is set to &"lmtp"&. +The callout may use EHLO, AUTH and/or STARTTLS given appropriate option +settings. + A recipient callout check is similar. By default, it also uses an empty address for the sender. This default is chosen because most hosts do not make use of the sender address when verifying a recipient. Using the same address means @@ -25609,6 +28898,11 @@ Exim tries the next host, if any. If there is a problem with all the remote hosts, the ACL yields &"defer"&, unless the &%defer_ok%& parameter of the &%callout%& option is given, in which case the condition is forced to succeed. +.cindex "SMTP" "output flushing, disabling for callout" +A callout may take a little time. For this reason, Exim normally flushes SMTP +output before performing a callout in an ACL, to avoid unexpected timeouts in +clients when the SMTP PIPELINING extension is in use. The flushing can be +disabled by using a &%control%& modifier to set &%no_callout_flush%&. @@ -25627,19 +28921,19 @@ deprecated. The additional parameters for &%callout%& are as follows: .vlist .vitem <&'a&~time&~interval'&> -.cindex "callout timeout" "specifying" +.cindex "callout" "timeout, specifying" This specifies the timeout that applies for the callout attempt to each host. For example: .code verify = sender/callout=5s .endd The default is 30 seconds. The timeout is used for each response from the -remote host. It is also used for the intial connection, unless overridden by +remote host. It is also used for the initial connection, unless overridden by the &%connect%& parameter. .vitem &*connect&~=&~*&<&'time&~interval'&> -.cindex "callout connection timeout" "specifying" +.cindex "callout" "connection timeout, specifying" This parameter makes it possible to set a different (usually smaller) timeout for making the SMTP connection. For example: .code @@ -25648,7 +28942,7 @@ verify = sender/callout=5s,connect=1s If not specified, this timeout defaults to the general timeout value. .vitem &*defer_ok*& -.cindex "callout defer" "action on" +.cindex "callout" "defer, action on" When this parameter is present, failure to contact any host, or any other kind of temporary error, is treated as success by the ACL. However, the cache is not updated in this circumstance. @@ -25678,7 +28972,7 @@ This parameter is available only for the &%header_sender%& verification option. .vitem &*maxwait&~=&~*&<&'time&~interval'&> -.cindex "callout overall timeout" "specifying" +.cindex "callout" "overall timeout, specifying" This parameter sets an overall timeout for performing a callout verification. For example: .code @@ -25692,13 +28986,13 @@ very long delays if there are a large number of hosts and all are timing out .vitem &*no_cache*& -.cindex "callout cache" "suppressing" -.cindex "caching callout" "suppressing" +.cindex "callout" "cache, suppressing" +.cindex "caching callout, suppressing" When this parameter is given, the callout cache is neither read nor updated. .vitem &*postmaster*& .cindex "callout" "postmaster; checking" -When this parameter is set, a sucessful callout check is followed by a similar +When this parameter is set, a successful callout check is followed by a similar check for the local part &'postmaster'& at the same domain. If this address is rejected, the callout fails (but see &%fullpostmaster%& above). The result of the postmaster check is recorded in a cache record; if it is a failure, this is @@ -25730,7 +29024,7 @@ check for a &"random"& local part at the same domain. The local part is not really random &-- it is defined by the expansion of the option &%callout_random_local_part%&, which defaults to .code -$primary_host_name-$tod_epoch-testing +$primary_hostname-$tod_epoch-testing .endd The idea here is to try to determine whether the remote host accepts all local parts without checking. If it does, there is no point in doing callouts for @@ -25744,7 +29038,7 @@ This parameter applies to recipient callouts only. For example: .code deny !verify = recipient/callout=use_postmaster .endd -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" It causes a non-empty postmaster address to be used in the MAIL command when performing the callout for the recipient, and also for a &"random"& check if that is configured. The local part of the address is &`postmaster`& and the @@ -25788,7 +29082,7 @@ actual callouts are performed than when an empty sender or postmaster is used. .section "Callout caching" "SECTcallvercache" .cindex "hints database" "callout cache" -.cindex "callout" "caching" +.cindex "callout" "cache, description of" .cindex "caching" "callout" Exim caches the results of callouts in order to reduce the amount of resources used, unless you specify the &%no_cache%& parameter with the &%callout%& @@ -25832,9 +29126,10 @@ behaviour will be the same. .section "Sender address verification reporting" "SECTsenaddver" .cindex "verifying" "suppressing error details" -When sender verification fails in an ACL, the details of the failure are -given as additional output lines before the 550 response to the relevant -SMTP command (RCPT or DATA). For example, if sender callout is in use, +See section &<>& for a general discussion of +verification. When sender verification fails in an ACL, the details of the +failure are given as additional output lines before the 550 response to the +relevant SMTP command (RCPT or DATA). For example, if sender callout is in use, you might see: .code MAIL FROM: @@ -25894,6 +29189,10 @@ require verify = recipient/success_on_redirect/callout=10s In this example, verification succeeds if a router generates a new address, and the callout does not occur, because no address was routed to a remote host. +When verification is being tested via the &%-bv%& option, the treatment of +redirections is as just described, unless the &%-v%& or any debugging option is +also specified. In that case, full verification is done for every generated +address and a report is output for each of them. @@ -25973,7 +29272,7 @@ authorization required but absent, or &"?"& for unknown. .section "Bounce address tag validation" "SECTverifyPRVS" -.cindex "BATV" "verifying" +.cindex "BATV, verifying" Bounce address tag validation (BATV) is a scheme whereby the envelope senders of outgoing messages have a cryptographic, timestamped &"tag"& added to them. Genuine incoming bounce messages should therefore always be addressed to @@ -25983,10 +29282,10 @@ spam"&), because the recipients of such messages do not include valid tags. There are two expansion items to help with the implementation of the BATV &"prvs"& (private signature) scheme in an Exim configuration. This scheme signs -the original envelope sender address by using a simple shared key to add a hash -of the address and some time-based randomizing information. The &%prvs%& -expansion item creates a signed address, and the &%prvscheck%& expansion item -checks one. The syntax of these expansion items is described in section +the original envelope sender address by using a simple key to add a hash of the +address and some time-based randomizing information. The &%prvs%& expansion +item creates a signed address, and the &%prvscheck%& expansion item checks one. +The syntax of these expansion items is described in section &<>&. As an example, suppose the secret per-address keys are stored in an MySQL @@ -26002,7 +29301,7 @@ list called &%batv_senders%&. Then, in the ACL for RCPT commands, you could use this: .code # Bounces: drop unsigned addresses for BATV senders -deny message = This address does not send an unsigned reverse path. +deny message = This address does not send an unsigned reverse path senders = : recipients = +batv_senders @@ -26027,19 +29326,8 @@ the third string (in this case &"1"&), whether or not the cryptographic and timeout checks succeed. The &$prvscheck_result$& variable contains the result of the checks (empty for failure, &"1"& for success). -There are two more issues you must consider when implementing prvs-signing. -Firstly, you need to ensure that prvs-signed addresses are not blocked by your -ACLs. A prvs-signed address contains a slash character, but the default Exim -configuration contains this statement in the RCPT ACL: -.code -deny message = Restricted characters in address - domains = +local_domains - local_parts = ^[.] : ^.*[@%!/|] -.endd -This is a conservative rule that blocks local parts that contain slashes. You -should remove the slash in the last line. - -Secondly, you have to ensure that the routers accept prvs-signed addresses and +There is one more issue you must consider when implementing prvs-signing: +you have to ensure that the routers accept prvs-signed addresses and deliver them correctly. The easiest way to handle this is to use a &(redirect)& router to remove the signature with a configuration along these lines: .code @@ -26112,16 +29400,16 @@ Suppose your LAN is 192.168.45.0/24. In the main part of the configuration, you put the following definitions: .code -domainlist local_domains = my.dom1.example : my.dom2.example -domainlist relay_domains = friend1.example : friend2.example -hostlist relay_hosts = 192.168.45.0/24 +domainlist local_domains = my.dom1.example : my.dom2.example +domainlist relay_to_domains = friend1.example : friend2.example +hostlist relay_from_hosts = 192.168.45.0/24 .endd Now you can use these definitions in the ACL that is run for every RCPT command: .code acl_check_rcpt: - accept domains = +local_domains : +relay_domains - accept hosts = +relay_hosts + accept domains = +local_domains : +relay_to_domains + accept hosts = +relay_from_hosts .endd The first statement accepts any RCPT command that contains an address in the local or relay domains. For any other domain, control passes to the second @@ -26199,7 +29487,7 @@ EXPERIMENTAL_ in &_Local/Makefile_&. Such features are not documented in this manual. You can find out about them by reading the file called &_doc/experimental.txt_&. -All the content-scanning facilites work on a MBOX copy of the message that is +All the content-scanning facilities work on a MBOX copy of the message that is temporarily created in a file called: .display <&'spool_directory'&>&`/scan/`&<&'message_id'&>/<&'message_id'&>&`.eml`& @@ -26226,7 +29514,8 @@ It supports a &"generic"& interface to scanners called via the shell, and specialized interfaces for &"daemon"& type virus scanners, which are resident in memory and thus are much faster. -.cindex "&%av_scanner%&" + +.oindex "&%av_scanner%&" You can set the &%av_scanner%& option in first part of the Exim configuration file to specify which scanner to use, together with any additional options that are needed. The basic syntax is as follows: @@ -26237,7 +29526,7 @@ If you do not set &%av_scanner%&, it defaults to .code av_scanner = sophie:/var/run/sophie .endd -If the value of &%av_scanner%& starts with dollar character, it is expanded +If the value of &%av_scanner%& starts with a dollar character, it is expanded before use. The following scanner types are supported in this release: .vlist @@ -26251,6 +29540,7 @@ example: av_scanner = aveserver:/var/run/aveserver .endd + .vitem &%clamd%& .cindex "virus scanners" "clamd" This daemon-type scanner is GPL and free. You can get it at @@ -26261,8 +29551,16 @@ required: either the path and name of a UNIX socket file, or a hostname or IP number, and a port, separated by space, as in the second of these examples: .code av_scanner = clamd:/opt/clamd/socket -av_scanner = clamd:192.168.2.100 1234 -.endd +av_scanner = clamd:192.0.2.3 1234 +av_scanner = clamd:192.0.2.3 1234:local +.endd +If the value of av_scanner points to a UNIX socket file or contains the local +keyword, then the ClamAV interface will pass a filename containing the data +to be scanned, which will should normally result in less I/O happening and be +more efficient. Normally in the TCP case, the data is streamed to ClamAV as +Exim does not assume that there is a common filesystem with the remote host. +There is an option WITH_OLD_CLAMAV_STREAM in &_src/EDITME_& available, should +you be running a version of ClamAV prior to 0.95. If the option is unset, the default is &_/tmp/clamd_&. Thanks to David Saez for contributing the code for this scanner. @@ -26292,14 +29590,14 @@ For example, Sophos Sweep reports a virus on a line like this: .code Virus 'W32/Magistr-B' found in file ./those.bat .endd -For the trigger expression, we can just match the word &"found"&. For the name -expression, we want to extract the W32/Magistr-B string, so we can match for -the single quotes left and right of it. Altogether, this makes the +For the trigger expression, we can match the phrase &"found in file"&. For the +name expression, we want to extract the W32/Magistr-B string, so we can match +for the single quotes left and right of it. Altogether, this makes the configuration setting: .code av_scanner = cmdline:\ - /path/to/sweep -all -rec -archive %s:\ - found:'(.+)' + /path/to/sweep -ss -all -rec -archive %s:\ + found in file:'(.+)' .endd .vitem &%drweb%& .cindex "virus scanners" "DrWeb" @@ -26350,9 +29648,9 @@ You can safely omit this option (the default value is 1). .vitem &%sophie%& .cindex "virus scanners" "Sophos and Sophie" Sophie is a daemon that uses Sophos' &%libsavi%& library to scan for viruses. -You can get Sophie at &url(http://www.vanja.com/tools/sophie/). The only -option for this scanner type is the path to the UNIX socket that Sophie uses -for client communication. For example: +You can get Sophie at &url(http://www.clanfield.info/sophie/). The only option +for this scanner type is the path to the UNIX socket that Sophie uses for +client communication. For example: .code av_scanner = sophie:/tmp/sophie .endd @@ -26380,8 +29678,8 @@ use. It can then be one of The condition succeeds if a virus was found, and fail otherwise. This is the recommended usage. .next -&"false"& or &"0"&, in which case no scanning is done and the condition fails -immediately. +&"false"& or &"0"& or an empty string, in which case no scanning is done and +the condition fails immediately. .next A regular expression, in which case the message is scanned for viruses. The condition succeeds if a virus is found and its name matches the regular @@ -26389,9 +29687,10 @@ expression. This allows you to take special actions on certain types of virus. .endlist You can append &`/defer_ok`& to the &%malware%& condition to accept messages -even if there is a problem with the virus scanner. +even if there is a problem with the virus scanner. Otherwise, such a problem +causes the ACL to defer. -.cindex "&$malware_name$&" +.vindex "&$malware_name$&" When a virus is found, the condition sets up an expansion variable called &$malware_name$& that contains the name of the virus. You can use it in a &%message%& modifier that specifies the error returned to the sender, and/or in @@ -26401,6 +29700,9 @@ If your virus scanner cannot unpack MIME and TNEF containers itself, you should use the &%demime%& condition (see section &<>&) before the &%malware%& condition. +Beware the interaction of Exim's &%message_size_limit%& with any size limits +imposed by your anti-virus scanner. + Here is a very simple scanning example: .code deny message = This message contains malware ($malware_name) @@ -26433,7 +29735,7 @@ deny message = This message contains malware ($malware_name) .section "Scanning with SpamAssassin" "SECTscanspamass" .cindex "content scanning" "for spam" .cindex "spam scanning" -.cindex "SpamAssassin" "scanning with" +.cindex "SpamAssassin" The &%spam%& ACL condition calls SpamAssassin's &%spamd%& daemon to get a spam score and a report for the message. You can get SpamAssassin at &url(http://www.spamassassin.org), or, if you have a working Perl @@ -26445,7 +29747,7 @@ SpamAssassin has its own set of configuration files. Please review its documentation to see how you can tweak it. The default installation should work nicely, however. -.cindex "&%spamd_address%&" +.oindex "&%spamd_address%&" After having installed and configured SpamAssassin, start the &%spamd%& daemon. By default, it listens on 127.0.0.1, TCP port 783. If you use another host or port for &%spamd%&, you must set the &%spamd_address%& option in the global @@ -26477,26 +29779,37 @@ condition defers. &*Warning*&: It is not possible to use the UNIX socket connection method with multiple &%spamd%& servers. +The &%spamd_address%& variable is expanded before use if it starts with +a dollar sign. In this case, the expansion may return a string that is +used as the list so that multiple spamd servers can be the result of an +expansion. -.section "Calling SpamAssassin from an Exim ACL" +.section "Calling SpamAssassin from an Exim ACL" "SECID206" Here is a simple example of the use of the &%spam%& condition in a DATA ACL: .code deny message = This message was classified as SPAM spam = joe .endd -The right-hand side of the &%spam%& condition specifies the username that -SpamAssassin should scan for. If you do not want to scan for a particular user, -but rather use the SpamAssassin system-wide default profile, you can scan for -an unknown user, or simply use &"nobody"&. However, you must put something on -the right-hand side. +The right-hand side of the &%spam%& condition specifies a name. This is +relevant if you have set up multiple SpamAssassin profiles. If you do not want +to scan using a specific profile, but rather use the SpamAssassin system-wide +default profile, you can scan for an unknown name, or simply use &"nobody"&. +However, you must put something on the right-hand side. + +The name allows you to use per-domain or per-user antispam profiles in +principle, but this is not straightforward in practice, because a message may +have multiple recipients, not necessarily all in the same domain. Because the +&%spam%& condition has to be called from a DATA ACL in order to be able to +read the contents of the message, the variables &$local_part$& and &$domain$& +are not set. + +The right-hand side of the &%spam%& condition is expanded before being used, so +you can put lookups or conditions there. When the right-hand side evaluates to +&"0"& or &"false"&, no scanning is done and the condition fails immediately. -The username allows you to use per-domain or per-user antispam profiles. The -right-hand side is expanded before being used, so you can put lookups or -conditions there. When the right-hand side evaluates to &"0"& or &"false"&, no -scanning is done and the condition fails immediately. Scanning with SpamAssassin uses a lot of resources. If you scan every message, -large ones may cause significant performance degredation. As most spam messages +large ones may cause significant performance degradation. As most spam messages are quite small, it is recommended that you do not scan the big ones. For example: .code @@ -26511,12 +29824,9 @@ SpamAssassin profile has been matched or exceeded. If you want to use the it always return &"true"& by appending &`:true`& to the username. .cindex "spam scanning" "returned variables" -.new When the &%spam%& condition is run, it sets up a number of expansion -variables. With the exception of &$spam_score_int$&, these are usable only -within ACLs; their values are not retained with the message and so cannot be -used at delivery time. -.wen +variables. These variables are saved with the received message, thus they are +available for use at delivery time. .vlist .vitem &$spam_score$& @@ -26525,11 +29835,9 @@ for inclusion in log or reject messages. .vitem &$spam_score_int$& The spam score of the message, multiplied by ten, as an integer value. For -example &"34"& or &"305"&. This is useful for numeric comparisons in -conditions. This variable is special; its value is saved with the message, and -written to Exim's spool file. This means that it can be used during the whole -life of the message on your Exim system, in particular, in routers or -transports during the later delivery phase. +example &"34"& or &"305"&. It may appear to disagree with &$spam_score$& +because &$spam_score$& is rounded and &$spam_score_int$& is truncated. +The integer value is useful for numeric comparisons in conditions. .vitem &$spam_bar$& A string consisting of a number of &"+"& or &"-"& characters, representing the @@ -26542,14 +29850,15 @@ A multiline text table, containing the full SpamAssassin report for the message. Useful for inclusion in headers or reject messages. .endlist -The &%spam%& condition caches its results. If you call it again with the same -user name, it does not scan again, but rather returns the same values as -before. +The &%spam%& condition caches its results unless expansion in +spamd_address was used. If you call it again with the same user name, it +does not scan again, but rather returns the same values as before. -The &%spam%& condition returns DEFER if there is any error while running the -message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to -the next ACL statement block), append &`/defer_ok`& to the right-hand side of -the spam condition, like this: +The &%spam%& condition returns DEFER if there is any error while running +the message through SpamAssassin or if the expansion of spamd_address +failed. If you want to treat DEFER as FAIL (to pass on to the next ACL +statement block), append &`/defer_ok`& to the right-hand side of the +spam condition, like this: .code deny message = This message was classified as SPAM spam = joe/defer_ok @@ -26560,15 +29869,14 @@ Here is a longer, commented example of the use of the &%spam%& condition: .code # put headers in all messages (no matter if spam or not) -warn message = X-Spam-Score: $spam_score ($spam_bar) - spam = nobody:true -warn message = X-Spam-Report: $spam_report - spam = nobody:true +warn spam = nobody:true + add_header = X-Spam-Score: $spam_score ($spam_bar) + add_header = X-Spam-Report: $spam_report # add second subject line with *SPAM* marker when message # is over threshold -warn message = Subject: *SPAM* $h_Subject: - spam = nobody +warn spam = nobody + add_header = Subject: *SPAM* $h_Subject: # reject spam at high scores (> 12) deny message = This message scored $spam_score spam points. @@ -26581,7 +29889,8 @@ deny message = This message scored $spam_score spam points. .section "Scanning MIME parts" "SECTscanmimepart" .cindex "content scanning" "MIME parts" .cindex "MIME content scanning" -.cindex "&%acl_smtp_mime%&" +.oindex "&%acl_smtp_mime%&" +.oindex "&%acl_not_smtp_mime%&" The &%acl_smtp_mime%& global option specifies an ACL that is called once for each MIME part of an SMTP message, including multipart types, in the sequence of their position in the message. Similarly, the &%acl_not_smtp_mime%& option @@ -26590,12 +29899,12 @@ options may both refer to the same ACL if you want the same processing in both cases. These ACLs are called (possibly many times) just before the &%acl_smtp_data%& -ACL in the case of an SMTP message, or just before a non-SMTP message is -accepted. However, a MIME ACL is called only if the message contains a -&'MIME-Version:'& header line. When a call to a MIME ACL does not yield -&"accept"&, ACL processing is aborted and the appropriate result code is sent -to the client. In the case of an SMTP message, the &%acl_smtp_data%& ACL is not -called when this happens. +ACL in the case of an SMTP message, or just before the &%acl_not_smtp%& ACL in +the case of a non-SMTP message. However, a MIME ACL is called only if the +message contains a &'Content-Type:'& header line. When a call to a MIME +ACL does not yield &"accept"&, ACL processing is aborted and the appropriate +result code is sent to the client. In the case of an SMTP message, the +&%acl_smtp_data%& ACL is not called when this happens. You cannot use the &%malware%& or &%spam%& conditions in a MIME ACL; these can only be used in the DATA or non-SMTP ACLs. However, you can use the &%regex%& @@ -26607,8 +29916,8 @@ At the start of a MIME ACL, a number of variables are set from the header information for the relevant MIME part. These are described below. The contents of the MIME part are not by default decoded into a disk file except for MIME parts whose content-type is &"message/rfc822"&. If you want to decode a MIME -part into a disk file, you can use the &%decode%& modifier. The general syntax -is: +part into a disk file, you can use the &%decode%& condition. The general +syntax is: .display &`decode = [/`&<&'path'&>&`/]`&<&'filename'&> .endd @@ -26631,8 +29940,9 @@ the full path and file name. If the string does not start with a slash, it is used as the filename, and the default path is then used. .endlist - -You can easily decode a file with its original, proposed filename using +The &%decode%& condition normally succeeds. It is only false for syntax +errors or unusual circumstances such as memory shortages. You can easily decode +a file with its original, proposed filename using .code decode = $mime_filename .endd @@ -26728,7 +30038,7 @@ found, this variable contains the empty string. .vitem &$mime_is_coverletter$& This variable attempts to differentiate the &"cover letter"& of an e-mail from -attached data. It can be used to clamp down on flashy or unneccessarily encoded +attached data. It can be used to clamp down on flashy or unnecessarily encoded content in the cover letter, while not restricting attachments at all. The variable contains 1 (true) for a MIME part believed to be part of the @@ -26834,7 +30144,7 @@ The &%demime%& condition unpacks MIME containers in the message. It detects errors in MIME containers and can match file extensions found in the message against a list. Using this facility produces files containing the unpacked MIME parts of the message in the temporary scan directory. If you do antivirus -scanning, it is recommened that you use the &%demime%& condition before the +scanning, it is recommended that you use the &%demime%& condition before the antivirus (&%malware%&) condition. On the right-hand side of the &%demime%& condition you can pass a @@ -26857,21 +30167,21 @@ The &%demime%& condition set the following variables: .vlist .vitem &$demime_errorlevel$& -.cindex "&$demime_errorlevel$&" +.vindex "&$demime_errorlevel$&" When an error is detected in a MIME container, this variable contains the severity of the error, as an integer number. The higher the value, the more severe the error (the current maximum value is 3). If this variable is unset or zero, no error occurred. .vitem &$demime_reason$& -.cindex "&$demime_reason$&" +.vindex "&$demime_reason$&" When &$demime_errorlevel$& is greater than zero, this variable contains a human-readable text string describing the MIME error that occurred. .endlist .vlist .vitem &$found_extension$& -.cindex "&$found_extension$&" +.vindex "&$found_extension$&" When the &%demime%& condition is true, this variable contains the file extension it found. .endlist @@ -26944,7 +30254,7 @@ code. The incident is logged on the main and reject logs. -.section "Building Exim to use a local scan function" +.section "Building Exim to use a local scan function" "SECID207" .cindex "&[local_scan()]& function" "building Exim to use" To make use of the local scan function feature, you must tell Exim where your function is before building Exim, by setting LOCAL_SCAN_SOURCE in your @@ -27015,7 +30325,7 @@ The function must return an &%int%& value which is one of the following macros: .vlist .vitem &`LOCAL_SCAN_ACCEPT`& -.cindex "&$local_scan_data$&" +.vindex "&$local_scan_data$&" The message is accepted. If you pass back a string of text, it is saved with the message, and made available in the variable &$local_scan_data$&. No newlines are permitted (if there are any, they are turned into spaces) and the @@ -27125,7 +30435,7 @@ This is the same as &%opt_int%&, except that when such a value is output in a printed with the suffix K or M. .vitem &*opt_octint*& -This also specifies an integer, but the value is always interpeted as an +This also specifies an integer, but the value is always interpreted as an octal integer, whether or not it starts with the digit zero, and it is always output in octal. @@ -27143,14 +30453,21 @@ out the values of all the &[local_scan()]& options. -.section "Available Exim variables" +.section "Available Exim variables" "SECID208" .cindex "&[local_scan()]& function" "available Exim variables" The header &_local_scan.h_& gives you access to a number of C variables. These are the only ones that are guaranteed to be maintained from release to release. -Note, however, that you can obtain the value of any Exim variable by calling -&'expand_string()'&. The exported variables are as follows: +Note, however, that you can obtain the value of any Exim expansion variable, +including &$recipients$&, by calling &'expand_string()'&. The exported +C variables are as follows: .vlist +.vitem &*int&~body_linecount*& +This variable contains the number of lines in the message's body. + +.vitem &*int&~body_zerocount*& +This variable contains the number of binary zero bytes in the message's body. + .vitem &*unsigned&~int&~debug_selector*& This variable is set to zero when no debugging is taking place. Otherwise, it is a bitmap of debugging selectors. Two bits are identified for use in @@ -27196,7 +30513,9 @@ The IP address of the interface that received the message, as a string. This is NULL for locally submitted messages. .vitem &*int&~interface_port*& -The port on which this message was received. +The port on which this message was received. When testing with the &%-bh%& +command line option, the value of this variable is -1 unless a port has been +specified via the &%-oMi%& option. .vitem &*uschar&~*message_id*& This variable contains Exim's message id for the incoming message (the value of @@ -27214,8 +30533,8 @@ The number of accepted recipients. The list of accepted recipients, held in a vector of length &%recipients_count%&. The &%recipient_item%& structure is discussed below. You can add additional recipients by calling &'receive_add_recipient()'& (see -below). You can delete recipients by removing them from the vector and adusting -the value in &%recipients_count%&. In particular, by setting +below). You can delete recipients by removing them from the vector and +adjusting the value in &%recipients_count%&. In particular, by setting &%recipients_count%& to zero you remove all recipients. If you then return the value &`LOCAL_SCAN_ACCEPT`&, the message is accepted, but immediately blackholed. To replace the recipients, you can set &%recipients_count%& to zero @@ -27250,7 +30569,7 @@ requests. See section &<>& for details. .endlist -.section "Structure of header lines" +.section "Structure of header lines" "SECID209" The &%header_line%& structure contains the members listed below. You can add additional header lines by calling the &'header_add()'& function (see below). You can cause header lines to be ignored (deleted) by setting @@ -27280,7 +30599,7 @@ a zero byte. Internal newlines are preserved. -.section "Structure of recipient items" +.section "Structure of recipient items" "SECID210" The &%recipient_item%& structure contains these members: .vlist @@ -27304,7 +30623,7 @@ is NULL for all recipients. -.section "Available Exim functions" +.section "Available Exim functions" "SECID211" .cindex "&[local_scan()]& function" "available Exim functions" The header &_local_scan.h_& gives you access to a number of Exim functions. These are the only ones that are guaranteed to be maintained from release to @@ -27494,7 +30813,7 @@ expected to be .code lss_match_host(sender_host_name, sender_host_address, ...) .endd -.cindex "&$sender_host_address$&" +.vindex "&$sender_host_address$&" An empty address field matches an empty item in the host list. If the host name is NULL, the name corresponding to &$sender_host_address$& is automatically looked up if a host name is required to match an item in the list. The return @@ -27522,9 +30841,9 @@ described with the structure of &%recipient_item%& above), because it pre-dates the addition of that field to the structure. However, it is easy to add such a value afterwards. For example: .code -receive_add_recipient(US"monitor@mydom.example", -1); -recipients_list[recipients_count-1].errors_to = -US"postmaster@mydom.example"; + receive_add_recipient(US"monitor@mydom.example", -1); + recipients_list[recipients_count-1].errors_to = + US"postmaster@mydom.example"; .endd .vitem &*BOOL&~receive_remove_recipient(uschar&~*recipient)*& @@ -27694,8 +31013,8 @@ If you want your filter to do something only once per message, you can make use of the &%first_delivery%& condition in an &%if%& command in the filter to prevent it happening on retries. -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" &*Warning*&: Because the system filter runs just once, variables that are specific to individual recipient addresses, such as &$local_part$& and &$domain$&, are not set, and the &"personal"& condition is not meaningful. If @@ -27704,7 +31023,7 @@ independently, you can do so by setting up a suitable &(redirect)& router, as described in section &<>& below. -.section "Specifying a system filter" +.section "Specifying a system filter" "SECID212" .cindex "uid (user id)" "system filter" .cindex "gid (group id)" "system filter" The name of the file that contains the system filter must be specified by @@ -27723,7 +31042,7 @@ specified by setting &%system_filter_file_transport%& and by the &%reply%& command. -.section "Testing a system filter" +.section "Testing a system filter" "SECID213" You can run simple tests of a system filter in the same way as for a user filter, but you should use &%-bF%& rather than &%-bf%&, so that features that are permitted only in system filters are recognized. @@ -27733,7 +31052,7 @@ you can use both &%-bF%& and &%-bf%& on the same command line. -.section "Contents of a system filter" +.section "Contents of a system filter" "SECID214" The language used to specify system filters is the same as for users' filter files. It is described in the separate end-user document &'Exim's interface to mail filtering'&. However, there are some additional features that are @@ -27762,15 +31081,15 @@ to which users' filter files can refer. -.section "Additional variable for system filters" -.cindex "&$recipients$&" +.section "Additional variable for system filters" "SECID215" +.vindex "&$recipients$&" The expansion variable &$recipients$&, containing a list of all the recipients of the message (separated by commas and white space), is available in system filters. It is not available in users' filters for privacy reasons. -.section "Defer, freeze, and fail commands for system filters" +.section "Defer, freeze, and fail commands for system filters" "SECID216" .cindex "freezing messages" .cindex "message" "freezing" .cindex "message" "forced failure" @@ -27913,7 +31232,7 @@ headers remove "Old-Subject" -.section "Setting an errors address in a system filter" +.section "Setting an errors address in a system filter" "SECID217" .cindex "envelope sender" In a system filter, if a &%deliver%& command is followed by .code @@ -27932,8 +31251,8 @@ address if its delivery failed. .section "Per-address filtering" "SECTperaddfil" -.cindex "&$domain$&" -.cindex "&$local_part$&" +.vindex "&$domain$&" +.vindex "&$local_part$&" In contrast to the system filter, which is run just once per message for each delivery attempt, it is also possible to set up a system-wide filtering operation that runs once for each recipient address. In this case, variables @@ -28003,7 +31322,7 @@ that there are appropriate entries in your ACLs. Processing that happens automatically for locally-originated messages (unless &%suppress_local_fixups%& is set) can also be requested for messages that are received over TCP/IP. The term &"submission mode"& is used to describe this -state. Submisssion mode is set by the modifier +state. Submission mode is set by the modifier .code control = submission .endd @@ -28017,7 +31336,7 @@ interface, you could include the following in the MAIL ACL: warn hosts = 127.0.0.1 control = submission .endd -.cindex "&%sender_retain%&" +.cindex "&%sender_retain%& submission option" There are some options that can be used when setting submission mode. A slash is used to separate options. For example: .code @@ -28114,7 +31433,7 @@ line. -.section "Unqualified addresses" +.section "Unqualified addresses" "SECID218" .cindex "unqualified addresses" .cindex "address" "qualification" By default, Exim expects every envelope address it receives from an external @@ -28124,13 +31443,13 @@ messages from MUAs running on personal workstations, there is sometimes a requirement to accept unqualified addresses from specific hosts or IP networks. Exim has two options that separately control which hosts may send unqualified -sender or receipient addresses in SMTP commands, namely +sender or recipient addresses in SMTP commands, namely &%sender_unqualified_hosts%& and &%recipient_unqualified_hosts%&. In both cases, if an unqualified address is accepted, it is qualified by adding the value of &%qualify_domain%& or &%qualify_recipient%&, as appropriate. -.cindex "&%qualify_domain%&" -.cindex "&%qualify_recipient%&" +.oindex "&%qualify_domain%&" +.oindex "&%qualify_recipient%&" Unqualified addresses in header lines are automatically qualified for messages that are locally originated, unless the &%-bnq%& option is given on the command line. For messages received over SMTP, unqualified addresses in header lines @@ -28141,12 +31460,12 @@ other words, such qualification is also controlled by -.section "The UUCP From line" +.section "The UUCP From line" "SECID219" .cindex "&""From""& line" .cindex "UUCP" "&""From""& line" .cindex "sender" "address" -.cindex "&%uucp_from_pattern%&" -.cindex "&%uucp_from_sender%&" +.oindex "&%uucp_from_pattern%&" +.oindex "&%uucp_from_sender%&" .cindex "envelope sender" .cindex "Sendmail compatibility" "&""From""& line" Messages that have come from UUCP (and some other applications) often begin @@ -28185,7 +31504,7 @@ incoming SMTP message from a source that is not permitted to send them. -.section "Resent- header lines" +.section "Resent- header lines" "SECID220" .cindex "&%Resent-%& header lines" RFC 2822 makes provision for sets of header lines starting with the string &`Resent-`& to be added to a message when it is resent by the original @@ -28226,14 +31545,14 @@ The logic for adding &'Sender:'& is duplicated for &'Resent-Sender:'& when any -.section "The Auto-Submitted: header line" +.section "The Auto-Submitted: header line" "SECID221" Whenever Exim generates an autoreply, a bounce, or a delay warning message, it includes the header line: .code Auto-Submitted: auto-replied .endd -.section "The Bcc: header line" +.section "The Bcc: header line" "SECID222" .cindex "&'Bcc:'& header line" If Exim is called with the &%-t%& option, to take recipient addresses from a message's header, it removes any &'Bcc:'& header line that may exist (after @@ -28241,15 +31560,15 @@ extracting its addresses). If &%-t%& is not present on the command line, any existing &'Bcc:'& is not removed. -.section "The Date: header line" +.section "The Date: header line" "SECID223" .cindex "&'Date:'& header line" If a locally-generated or submission-mode message has no &'Date:'& header line, Exim adds one, using the current date and time, unless the &%suppress_local_fixups%& control has been specified. -.section "The Delivery-date: header line" +.section "The Delivery-date: header line" "SECID224" .cindex "&'Delivery-date:'& header line" -.cindex "&%delivery_date_remove%&" +.oindex "&%delivery_date_remove%&" &'Delivery-date:'& header lines are not part of the standard RFC 2822 header set. Exim can be configured to add them to the final delivery of messages. (See the generic &%delivery_date_add%& transport option.) They should not be present @@ -28258,9 +31577,9 @@ set (the default), Exim removes &'Delivery-date:'& header lines from incoming messages. -.section "The Envelope-to: header line" +.section "The Envelope-to: header line" "SECID225" .cindex "&'Envelope-to:'& header line" -.cindex "&%envelope_to_remove%&" +.oindex "&%envelope_to_remove%&" &'Envelope-to:'& header lines are not part of the standard RFC 2822 header set. Exim can be configured to add them to the final delivery of messages. (See the generic &%envelope_to_add%& transport option.) They should not be present in @@ -28281,15 +31600,15 @@ adds one if either of the following conditions is true: The envelope sender address is not empty (that is, this is not a bounce message). The added header line copies the envelope sender address. .next -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" The SMTP session is authenticated and &$authenticated_id$& is not empty. .olist -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" If no domain is specified by the submission control, the local part is &$authenticated_id$& and the domain is &$qualify_domain$&. .next If a non-empty domain is specified by the submission control, the local -part is &$authenticated_id$&, and the the domain is the specified domain. +part is &$authenticated_id$&, and the domain is the specified domain. .next If an empty domain is specified by the submission control, &$authenticated_id$& is assumed to be the complete address. @@ -28312,10 +31631,10 @@ user, this is replaced by an address containing the user's login name and full name as described in section &<>&. -.section "The Message-ID: header line" +.section "The Message-ID: header line" "SECID226" .cindex "&'Message-ID:'& header line" .cindex "message" "submission" -.cindex "&%message_id_header_text%&" +.oindex "&%message_id_header_text%&" If a locally-generated or submission-mode incoming message does not contain a &'Message-ID:'& or &'Resent-Message-ID:'& header line, and the &%suppress_local_fixups%& control is not set, Exim adds a suitable header line @@ -28327,7 +31646,7 @@ in this header line by setting the &%message_id_header_text%& and/or &%message_id_header_domain%& options. -.section "The Received: header line" +.section "The Received: header line" "SECID227" .cindex "&'Received:'& header line" A &'Received:'& header line is added at the start of every message. The contents are defined by the &%received_header_text%& configuration option, and @@ -28343,7 +31662,7 @@ changed to the time of acceptance, which is (apart from a small delay while the -H spool file is written) the earliest time at which delivery could start. -.section "The References: header line" +.section "The References: header line" "SECID228" .cindex "&'References:'& header line" Messages created by the &(autoreply)& transport include a &'References:'& header line. This is constructed according to the rules that are described in @@ -28357,9 +31676,9 @@ incoming message. If there are more than 12, the first one and then the final -.section "The Return-path: header line" +.section "The Return-path: header line" "SECID229" .cindex "&'Return-path:'& header line" -.cindex "&%return_path_remove%&" +.oindex "&%return_path_remove%&" &'Return-path:'& header lines are defined as something an MTA may insert when it does the final delivery of messages. (See the generic &%return_path_add%& transport option.) Therefore, they should not be present in messages in @@ -28398,18 +31717,18 @@ received over TCP/IP or for messages submitted by trusted users. However, when a message is received over TCP/IP in submission mode, and &%sender_retain%& is not specified on the submission control, the following processing takes place: -.cindex "&$authenticated_id$&" +.vindex "&$authenticated_id$&" First, any existing &'Sender:'& lines are removed. Then, if the SMTP session is authenticated, and &$authenticated_id$& is not empty, a sender address is created as follows: .ilist -.cindex "&$qualify_domain$&" +.vindex "&$qualify_domain$&" If no domain is specified by the submission control, the local part is &$authenticated_id$& and the domain is &$qualify_domain$&. .next If a non-empty domain is specified by the submission control, the local part -is &$authenticated_id$&, and the the domain is the specified domain. +is &$authenticated_id$&, and the domain is the specified domain. .next If an empty domain is specified by the submission control, &$authenticated_id$& is assumed to be the complete address. @@ -28457,6 +31776,10 @@ headers_add = X-added-header: added by $primary_hostname\n\ .endd Exim does not check the syntax of these added header lines. +Multiple &%headers_add%& options for a single router or transport can be +specified; the values will be concatenated (with a separating newline +added) before expansion. + The result of expanding &%headers_remove%& must consist of a colon-separated list of header names. This is confusing, because header names themselves are often terminated by colons. In this case, the colons are the list separators, @@ -28464,13 +31787,18 @@ not part of the names. For example: .code headers_remove = return-receipt-to:acknowledge-to .endd + +Multiple &%headers_remove%& options for a single router or transport can be +specified; the values will be concatenated (with a separating colon +added) before expansion. + When &%headers_add%& or &%headers_remove%& is specified on a router, its value is expanded at routing time, and then associated with all addresses that are accepted by that router, and also with any new addresses that it generates. If an address passes through several routers as a result of aliasing or forwarding, the changes are cumulative. -.cindex "&%unseen%& option" +.oindex "&%unseen%&" However, this does not apply to multiple routers that result from the use of the &%unseen%& option. Any header modifications that were specified by the &"unseen"& router or its predecessors apply only to the &"unseen"& delivery. @@ -28559,7 +31887,7 @@ is, with codes greater than 127) count as printing characters or not. -.section "Case of local parts" +.section "Case of local parts" "SECID230" .cindex "case of local parts" .cindex "local part" "case of" RFC 2822 states that the case of letters in the local parts of addresses cannot @@ -28591,7 +31919,7 @@ local parts with the correct case in a case-sensitive manner. -.section "Dots in local parts" +.section "Dots in local parts" "SECID231" .cindex "dot" "in local part" .cindex "local part" "dots in" RFC 2822 forbids empty components in local parts. That is, an unquoted local @@ -28601,7 +31929,7 @@ empty components for compatibility. -.section "Rewriting addresses" +.section "Rewriting addresses" "SECID232" .cindex "rewriting" "addresses" Rewriting of sender and recipient addresses, and addresses in headers, can happen automatically, or as the result of configuration options, as described @@ -28702,6 +32030,8 @@ required for the transaction. If the remote server advertises support for the STARTTLS command, and Exim was built to support TLS encryption, it tries to start a TLS session unless the server matches &%hosts_avoid_tls%&. See chapter &<>& for more details. +Either a match in that or &%hosts_verify_avoid_tls%& apply when the transport +is called for verification. If the remote server advertises support for the AUTH command, Exim scans the authenticators configuration for any suitable client settings, as described @@ -28718,8 +32048,8 @@ If a message contains a number of different addresses, all those with the same characteristics (for example, the same envelope sender) that resolve to the same set of hosts, in the same order, are sent in a single SMTP transaction, even if they are for different domains, unless there are more than the setting -of the &%max_rcpts%& option in the &(smtp)& transport allows, in which case -they are split into groups containing no more than &%max_rcpts%& addresses +of the &%max_rcpt%&s option in the &(smtp)& transport allows, in which case +they are split into groups containing no more than &%max_rcpt%&s addresses each. If &%remote_max_parallel%& is greater than one, such groups may be sent in parallel sessions. The order of hosts with identical MX values is not significant when checking whether addresses can be batched in this way. @@ -28897,7 +32227,7 @@ host error, in order not to delay other messages to the same host. -.section "Incoming SMTP messages over TCP/IP" +.section "Incoming SMTP messages over TCP/IP" "SECID233" .cindex "SMTP" "incoming over TCP/IP" .cindex "incoming SMTP over TCP/IP" .cindex "inetd" @@ -28999,7 +32329,7 @@ MAIL and RCPT commands in a single SMTP session. See the -.section "Unrecognized SMTP commands" +.section "Unrecognized SMTP commands" "SECID234" .cindex "SMTP" "unrecognized commands" If Exim receives more than &%smtp_max_unknown_commands%& unrecognized SMTP commands during a single SMTP connection, it drops the connection after sending @@ -29009,7 +32339,7 @@ abuse that subvert web servers into making connections to SMTP ports; in these circumstances, a number of non-SMTP lines are sent first. -.section "Syntax and protocol errors in SMTP commands" +.section "Syntax and protocol errors in SMTP commands" "SECID235" .cindex "SMTP" "syntax errors" .cindex "SMTP" "protocol errors" A syntax error is detected if an SMTP command is recognized, but there is @@ -29023,7 +32353,7 @@ broken clients that loop sending bad commands (yes, it has been seen). -.section "Use of non-mail SMTP commands" +.section "Use of non-mail SMTP commands" "SECID236" .cindex "SMTP" "non-mail commands" The &"non-mail"& SMTP commands are those other than MAIL, RCPT, and DATA. Exim counts such commands, and drops the connection if there are too @@ -29034,7 +32364,7 @@ defines what &"too many"& means. Its default value is 10. When a new message is expected, one occurrence of RSET is not counted. This allows a client to send one RSET between messages (this is not necessary, -but some clients do it). Exim also allows one uncounted occurence of HELO +but some clients do it). Exim also allows one uncounted occurrence of HELO or EHLO, and one occurrence of STARTTLS between messages. After starting up a TLS session, another EHLO is expected, and so it too is not counted. @@ -29052,7 +32382,7 @@ specific badly-behaved hosts that you have to live with. -.section "The VRFY and EXPN commands" +.section "The VRFY and EXPN commands" "SECID237" When Exim receives a VRFY or EXPN command on a TCP/IP connection, it runs the ACL specified by &%acl_smtp_vrfy%& or &%acl_smtp_expn%& (as appropriate) in order to decide whether the command should be accepted or not. @@ -29110,7 +32440,7 @@ a &"success"& return code. Obviously there is scope for hints records to get left lying around if there is a system or program crash. To guard against this, Exim ignores any records that are more than six hours old. -.cindex "&%smtp_etrn_command%&" +.oindex "&%smtp_etrn_command%&" For more control over what ETRN does, the &%smtp_etrn_command%& option can used. This specifies a command that is run whenever ETRN is received, whatever the form of its argument. For @@ -29119,7 +32449,7 @@ example: smtp_etrn_command = /etc/etrn_command $domain \ $sender_host_address .endd -.cindex "&$domain$&" +.vindex "&$domain$&" The string is split up into arguments which are independently expanded. The expansion variable &$domain$& is set to the argument of the ETRN command, and no syntax checking is done on the contents of this argument. Exim does not @@ -29129,7 +32459,7 @@ for it to change them before running the command. -.section "Incoming local SMTP" +.section "Incoming local SMTP" "SECID238" .cindex "SMTP" "local incoming" Some user agents use SMTP to pass messages to their local MTA using the standard input and output, as opposed to passing the envelope on the command @@ -29168,7 +32498,7 @@ to handle several addresses at once by setting the &%batch_max%& option. When this is done for BSMTP, messages may contain multiple RCPT commands. See chapter &<>& for more details. -.cindex "&$host$&" +.vindex "&$host$&" When one or more addresses are routed to a BSMTP transport by a router that sets up a host list, the name of the first host on the list is available to the transport in the variable &$host$&. Here is an example of such a transport and @@ -29205,8 +32535,8 @@ rejected (there seems little point) but instead just get qualified. HELO and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act as NOOP; QUIT quits. -No policy checking is done for BSMTP input. That is, no ACL is run at anytime. -In this respect it is like non-SMTP local input. +Minimal policy checking is done for BSMTP input. Only the non-SMTP +ACL is run in the same way as for non-SMTP local input. If an error is detected while reading a message, including a missing &"."& at the end, Exim gives up immediately. It writes details of the error to the @@ -29262,7 +32592,7 @@ Auto-Submitted: auto-generated to all warning and bounce messages, -.section "Customizing bounce messages" +.section "Customizing bounce messages" "SECID239" .cindex "customizing" "bounce message" .cindex "bounce message" "customizing" If &%bounce_message_text%& is set, its contents are included in the default @@ -29277,8 +32607,8 @@ opened, default text is used and a message is written to the main and panic logs. If any text item in the file is empty, default text is used for that item. -.cindex "&$bounce_recipient$&" -.cindex "&$bounce_return_size_limit$&" +.vindex "&$bounce_recipient$&" +.vindex "&$bounce_return_size_limit$&" Each item of text that is read from the file is expanded, and there are two expansion variables which can be of use here: &$bounce_recipient$& is set to the recipient of an error message while it is being created, and @@ -29322,7 +32652,7 @@ A message ${if eq{$sender_address}{$bounce_recipient} <$sender_address> }}could not be delivered to all of its recipients. -The following address(es) failed: +This is a permanent error. The following address(es) failed: **** The following text was generated during the delivery attempt(s): **** @@ -29379,8 +32709,8 @@ intervals if the message remains undelivered. Eventually the mail delivery software will give up, and when that happens, the message will be returned to you. .endd -.cindex "&$warn_message_delay$&" -.cindex "&$warn_message_recipients$&" +.vindex "&$warn_message_delay$&" +.vindex "&$warn_message_recipients$&" However, in the default state the subject and date lines are omitted if no appropriate headers exist. During the expansion of this file, &$warn_message_delay$& is set to the delay time in one of the forms &"<&'n'&> @@ -29401,7 +32731,7 @@ common. More examples and discussion can be found in the Exim book. -.section "Sending mail to a smart host" +.section "Sending mail to a smart host" "SECID240" .cindex "smart host" "example router" If you want to send all mail for non-local domains to a &"smart host"&, you should replace the default &(dnslookup)& router with a router which does the @@ -29450,7 +32780,7 @@ The &%forbid_pipe%& and &%forbid_file%& options prevent a local part from being expanded into a file name or a pipe delivery, which is usually inappropriate in a mailing list. -.cindex "&%errors_to%&" +.oindex "&%errors_to%&" The &%errors_to%& option specifies that any delivery errors caused by addresses taken from a mailing list are to be sent to the given address rather than the original sender of the message. However, before acting on this, Exim verifies @@ -29468,7 +32798,7 @@ or &%local_part_suffix%& options) to handle addresses of the form -.section "Syntax errors in mailing lists" +.section "Syntax errors in mailing lists" "SECID241" .cindex "mailing lists" "syntax errors in" If an entry in redirection data contains a syntax error, Exim normally defers delivery of the original address. That means that a syntax error in a mailing @@ -29484,7 +32814,7 @@ whenever a broken address is skipped. It is usually appropriate to set -.section "Re-expansion of mailing lists" +.section "Re-expansion of mailing lists" "SECID242" .cindex "mailing lists" "re-expansion of" Exim remembers every individual address to which a message has been delivered, in order to avoid duplication, but it normally stores only the original @@ -29512,7 +32842,7 @@ one level of expansion anyway. -.section "Closed mailing lists" +.section "Closed mailing lists" "SECID243" .cindex "mailing lists" "closed" The examples so far have assumed open mailing lists, to which anybody may send mail. It is also possible to set up closed lists, where mail is accepted @@ -29594,7 +32924,7 @@ verp_smtp: max_rcpt = 1 return_path = \ ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\ - {$1-request=$local_part%$domain@your.dom.example}fail} + {$1-request+$local_part=$domain@your.dom.example}fail} .endd This has the effect of rewriting the return path (envelope sender) on outgoing SMTP messages, if the local part of the original return path ends in @@ -29605,19 +32935,19 @@ example, that a message whose return path has been set to &'subscriber@other.dom.example'&. In the transport, the return path is rewritten as .code -somelist-request=subscriber%other.dom.example@your.dom.example +somelist-request+subscriber=other.dom.example@your.dom.example .endd -.cindex "&$local_part$&" -For this to work, you must also arrange for outgoing messages that have -&"-request"& in their return paths to have just a single recipient. That is +.vindex "&$local_part$&" +For this to work, you must tell Exim to send multiple copies of messages that +have more than one recipient, so that each copy has just one recipient. This is achieved by setting &%max_rcpt%& to 1. Without this, a single copy of a message might be sent to several different recipients in the same domain, in which case &$local_part$& is not available in the transport, because it is not unique. Unless your host is doing nothing but mailing list deliveries, you should probably use a separate transport for the VERP deliveries, so as not to use -extra resources for the others. This can easily be done by expanding the -&%transport%& option in the router: +extra resources in making one-per-recipient copies for other deliveries. This +can easily be done by expanding the &%transport%& option in the router: .code dnslookup: driver = dnslookup @@ -29645,7 +32975,7 @@ verp_dnslookup: transport = remote_smtp errors_to = \ ${if match {$return_path}{^(.+?)-request@your.dom.example\$}} - {$1-request=$local_part%$domain@your.dom.example}fail} + {$1-request+$local_part=$domain@your.dom.example}fail} no_more .endd Before you start sending out messages with VERPed return paths, you must also @@ -29761,7 +33091,7 @@ userforward: local_part_suffix_optional allow_filter .endd -.cindex "&$local_part_suffix$&" +.vindex "&$local_part_suffix$&" It runs a user's &_.forward_& file for all local parts of the form &'username-*'&. Within the filter file the user can distinguish different cases by testing the variable &$local_part_suffix$&. For example: @@ -29795,7 +33125,7 @@ subsequent routers, which could, if required, look for an unqualified -.section "Simplified vacation processing" +.section "Simplified vacation processing" "SECID244" .cindex "vacation processing" The traditional way of running the &'vacation'& program is for a user to set up a pipe command in a &_.forward_& file @@ -29825,7 +33155,7 @@ use of arbitrary pipes by users is locked out. -.section "Taking copies of mail" +.section "Taking copies of mail" "SECID245" .cindex "message" "copying every" Some installations have policies that require archive copies of all messages to be made. A single copy of each message can easily be taken by an appropriate @@ -29839,7 +33169,7 @@ notification of delivery by sites that insist on doing such things. -.section "Intermittently connected hosts" +.section "Intermittently connected hosts" "SECID246" .cindex "intermittently connected hosts" It has become quite common (because it is cheaper) for hosts to connect to the Internet periodically rather than remain connected all the time. The normal @@ -29851,7 +33181,7 @@ particularly well-suited to use in an intermittently connected environment. Nevertheless there are some features that can be used. -.section "Exim on the upstream server host" +.section "Exim on the upstream server host" "SECID247" It is tempting to arrange for incoming mail for the intermittently connected host to remain on Exim's queue until the client connects. However, this approach does not scale very well. Two different kinds of waiting message are @@ -29892,7 +33222,7 @@ arrange a separate transport for the intermittently connected ones. -.section "Exim on the intermittently connected client host" +.section "Exim on the intermittently connected client host" "SECID248" The value of &%smtp_accept_queue_per_connection%& should probably be increased, or even set to zero (that is, disabled) on the intermittently connected host, so that all incoming messages down a single connection get @@ -29919,8 +33249,8 @@ single SMTP connection. .chapter "Using Exim as a non-queueing client" "CHAPnonqueueing" &&& "Exim as a non-queueing client" -.cindex "client" "non-queueing" -.cindex "smart host" "queueing; suppressing" +.cindex "client, non-queueing" +.cindex "smart host" "suppressing queueing" On a personal computer, it is a common requirement for all email to be sent to a &"smart host"&. There are plenty of MUAs that can be configured to operate that way, for all the popular operating systems. @@ -29952,7 +33282,7 @@ Exim already had the necessary infrastructure for doing this job. Just a few tweaks were needed to make it behave as required, though it is somewhat of an overkill to use a fully-featured MTA for this purpose. -.cindex "&%mua_wrapper%&" +.oindex "&%mua_wrapper%&" There is a Boolean global option called &%mua_wrapper%&, defaulting false. Setting &%mua_wrapper%& true causes Exim to run in a special mode where it assumes that it is being used to &"wrap"& a command-line MUA in the manner @@ -29967,7 +33297,7 @@ following ways: A daemon cannot be run, nor will Exim accept incoming messages from &'inetd'&. In other words, the only way to submit messages is via the command line. .next -Each message is synchonously delivered as soon as it is received (&%-odi%& is +Each message is synchronously delivered as soon as it is received (&%-odi%& is assumed). All queueing options (&%queue_only%&, &%queue_smtp_domains%&, &%control%& in an ACL, etc.) are quietly ignored. The Exim reception process does not finish until the delivery attempt is complete. If the delivery is @@ -30002,7 +33332,7 @@ are ever generated. No retry data is maintained, and any retry rules are ignored. .next A number of Exim options are overridden: &%deliver_drop_privilege%& is forced -true, &%max_rcpt%& in the smtp transport is forced to &"unlimited"&, +true, &%max_rcpt%& in the &(smtp)& transport is forced to &"unlimited"&, &%remote_max_parallel%& is forced to one, and fallback hosts are ignored. .endlist @@ -30086,6 +33416,13 @@ example: .endd .endlist +.cindex "log" "process ids in" +.cindex "pid (process id)" "in log lines" +Exim does not include its process id in log lines by default, but you can +request that it does so by specifying the &`pid`& log selector (see section +&<>&). When this is set, the process id is output, in square +brackets, immediately after the time and date. + @@ -30136,8 +33473,8 @@ log_file_path = $spool_directory/log/%slog If you do not specify anything at build time or run time, that is where the logs are written. -A log file path may also contain &`%D`& if datestamped log file names are in -use &-- see section &<>& below. +A log file path may also contain &`%D`& or &`%M`& if datestamped log file names +are in use &-- see section &<>& below. Here are some examples of possible settings: .display @@ -30151,12 +33488,12 @@ error is logged. -.section "Logging to local files that are periodically &""cycled""&" +.section "Logging to local files that are periodically &""cycled""&" "SECID285" .cindex "log" "cycling local files" .cindex "cycling logs" .cindex "&'exicyclog'&" .cindex "log" "local files; writing to" -Some operating systems provide centralized and standardised methods for cycling +Some operating systems provide centralized and standardized methods for cycling log files. For those that do not, a utility script called &'exicyclog'& is provided (see section &<>&). This renames and compresses the main and reject logs each time it is called. The maximum number of old logs to @@ -30181,14 +33518,15 @@ renamed. .cindex "log" "datestamped files" Instead of cycling the main and reject log files by renaming them periodically, some sites like to use files whose names contain a datestamp, -for example, &_mainlog-20031225_&. The datestamp is in the form &_yyyymmdd_&. -Exim has support for this way of working. It is enabled by setting the -&%log_file_path%& option to a path that includes &`%D`& at the point where the -datestamp is required. For example: +for example, &_mainlog-20031225_&. The datestamp is in the form &_yyyymmdd_& or +&_yyyymm_&. Exim has support for this way of working. It is enabled by setting +the &%log_file_path%& option to a path that includes &`%D`& or &`%M`& at the +point where the datestamp is required. For example: .code log_file_path = /var/spool/exim/log/%slog-%D log_file_path = /var/log/exim-%s-%D.log log_file_path = /var/spool/exim/log/%D-%slog +log_file_path = /var/log/exim/%s.%M .endd As before, &`%s`& is replaced by &"main"& or &"reject"&; the following are examples of names generated by the above examples: @@ -30196,6 +33534,7 @@ examples of names generated by the above examples: /var/spool/exim/log/mainlog-20021225 /var/log/exim-reject-20021225.log /var/spool/exim/log/20021225-mainlog +/var/log/exim/main.200212 .endd When this form of log file is specified, Exim automatically switches to new files at midnight. It does not make any attempt to compress old logs; you @@ -30204,18 +33543,20 @@ run &'exicyclog'& with this form of logging. The location of the panic log is also determined by &%log_file_path%&, but it is not datestamped, because rotation of the panic log does not make sense. -When generating the name of the panic log, &`%D`& is removed from the string. -In addition, if it immediately follows a slash, a following non-alphanumeric -character is removed; otherwise a preceding non-alphanumeric character is -removed. Thus, the three examples above would give these panic log names: +When generating the name of the panic log, &`%D`& or &`%M`& are removed from +the string. In addition, if it immediately follows a slash, a following +non-alphanumeric character is removed; otherwise a preceding non-alphanumeric +character is removed. Thus, the four examples above would give these panic +log names: .code /var/spool/exim/log/paniclog /var/log/exim-panic.log /var/spool/exim/log/paniclog +/var/log/exim/panic .endd -.section "Logging to syslog" +.section "Logging to syslog" "SECID249" .cindex "log" "syslog; writing to" The use of syslog does not change what Exim logs or the format of its messages, except in one respect. If &%syslog_timestamp%& is set false, the timestamps on @@ -30305,7 +33646,7 @@ where it is. -.section "Log line flags" +.section "Log line flags" "SECID250" One line is written to the main log for each message received, and for each successful, unsuccessful, and delayed delivery. These lines can readily be picked out by the distinctive two-character flags that immediately follow the @@ -30314,13 +33655,14 @@ timestamp. The flags are: &`<=`& message arrival &`=>`& normal message delivery &`->`& additional address in same delivery +&`>>`& cutthrough message delivery &`*>`& delivery suppressed by &%-N%& &`**`& delivery failed; address bounced &`==`& delivery deferred; temporary problem .endd -.section "Logging message reception" +.section "Logging message reception" "SECID251" .cindex "log" "reception line" The format of the single-line entry in the main log that is written for every message received is shown in the basic example below, which is split over @@ -30374,7 +33716,7 @@ extensions (ESMTP), encryption, or authentication were used. If the SMTP session was encrypted, there is an additional X field that records the cipher suite that was used. -The protocol is set to &"esmptsa"& or &"esmtpa"& for messages received from +The protocol is set to &"esmtpsa"& or &"esmtpa"& for messages received from hosts that have authenticated themselves using the SMTP AUTH command. The first value is used when the SMTP connection was encrypted (&"secure"&). In this case there is an additional item A= followed by the name of the authenticator that @@ -30394,7 +33736,7 @@ data when a message is received. See section &<>& below. -.section "Logging deliveries" +.section "Logging deliveries" "SECID252" .cindex "log" "delivery line" The format of the single-line entry in the main log that is written for every delivery is shown in one of the examples below, for local and remote @@ -30413,6 +33755,11 @@ intermediate address(es) exist between the original and the final address, the last of these is given in parentheses after the final address. The R and T fields record the router and transport that were used to process the address. +If SMTP AUTH was used for the delivery there is an additional item A= +followed by the name of the authenticator that was used. +If an authenticated identification was set up by the authenticator's &%client_set_id%& +option, this is logged too, separated by a colon from the authenticator name. + If a shadow transport was run after a successful local delivery, the log line for the successful delivery has an item added on the end, of the form .display @@ -30428,6 +33775,12 @@ flagged with &`->`& instead of &`=>`&. When two or more messages are delivered down a single SMTP connection, an asterisk follows the IP address in the log lines for the second and subsequent messages. +.cindex "delivery" "cutthrough; logging" +.cindex "cutthrough" "logging" +When delivery is done in cutthrough mode it is flagged with &`>>`& and the log +line precedes the reception line, since cutthrough waits for a possible +rejection from the destination in case it can reject the sourced item. + The generation of a reply message by a filter file gets logged as a &"delivery"& to the addressee, preceded by &">"&. @@ -30435,7 +33788,7 @@ The &%log_selector%& option can be used to request the logging of additional data when a message is delivered. See section &<>& below. -.section "Discarded deliveries" +.section "Discarded deliveries" "SECID253" .cindex "discarded messages" .cindex "message" "discarded" .cindex "delivery" "discarded; logging" @@ -30453,7 +33806,7 @@ because it is aliased to &":blackhole:"& the log line is like this: .endd -.section "Deferred deliveries" +.section "Deferred deliveries" "SECID254" When a delivery is deferred, a line of the following form is logged: .code 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example @@ -30472,7 +33825,7 @@ appropriate value in &%log_selector%&. -.section "Delivery failures" +.section "Delivery failures" "SECID255" .cindex "delivery" "failure; logging" If a delivery fails because an address cannot be routed, a line of the following form is logged: @@ -30496,7 +33849,7 @@ flagged with &`**`&. -.section "Fake deliveries" +.section "Fake deliveries" "SECID256" .cindex "delivery" "fake; logging" If a delivery does not actually take place because the &%-N%& option has been used to suppress it, a normal delivery line is written to the log, except that @@ -30504,7 +33857,7 @@ used to suppress it, a normal delivery line is written to the log, except that -.section "Completion" +.section "Completion" "SECID257" A line of the form .code 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed @@ -30515,14 +33868,16 @@ at the end of its processing. -.section "Summary of Fields in Log Lines" +.section "Summary of Fields in Log Lines" "SECID258" .cindex "log" "summary of fields" A summary of the field identifiers that are used in log lines is shown in the following table: .display -&`A `& authenticator name (and optional id) +&`A `& authenticator name (and optional id and sender) &`C `& SMTP confirmation on delivery +&` `& command list for &"no mail in SMTP session"& &`CV `& certificate verification status +&`D `& duration of &"no mail in SMTP session"& &`DN `& distinguished name from peer certificate &`DT `& on &`=>`& lines: time taken for a delivery &`F `& sender address (on delivery lines) @@ -30544,7 +33899,7 @@ the following table: .endd -.section "Other log entries" +.section "Other log entries" "SECID259" Various other types of log entry are written from time to time. Most should be self-explanatory. Among the more common are: @@ -30602,6 +33957,7 @@ log_selector = +arguments -retry_defer The list of optional log items is in the following table, with the default selection marked by asterisks: .display +&` 8bitmime `& received 8BITMIME status &`*acl_warn_skipped `& skipped &%warn%& statement in ACL &` address_rewrite `& address rewriting &` all_parents `& all parents in => lines @@ -30621,24 +33977,28 @@ selection marked by asterisks: &`*queue_run `& start and end queue runs &` queue_time `& time on queue for one recipient &` queue_time_overall `& time on queue for whole message +&` pid `& Exim process id &` received_recipients `& recipients on <= lines &` received_sender `& sender on <= lines &`*rejected_header `& header contents on reject log &`*retry_defer `& &"retry time not reached"& -&` return_path_on_delivery `& put return path on => and *\ lines +&` return_path_on_delivery `& put return path on => and ** lines &` sender_on_delivery `& add sender to => lines &`*sender_verify_fail `& sender verification failures &`*size_reject `& rejection because too big &`*skip_delivery `& delivery skipped in a queue run -&` smtp_confirmation `& SMTP confirmation on => lines +&`*smtp_confirmation `& SMTP confirmation on => lines &` smtp_connection `& SMTP connections &` smtp_incomplete_transaction`& incomplete SMTP transactions +&` smtp_mailauth `& AUTH argument to MAIL commands +&` smtp_no_mail `& session with no MAIL commands &` smtp_protocol_error `& SMTP protocol errors &` smtp_syntax_error `& SMTP syntax errors &` subject `& contents of &'Subject:'& on <= lines &` tls_certificate_verified `& certificate verification status &`*tls_cipher `& TLS cipher suite on <= and => lines &` tls_peerdn `& TLS peer DN on <= and => lines +&` tls_sni `& TLS SNI on <= lines &` unknown_in_list `& DNS lookup failed in list match &` all `& all of the above @@ -30646,7 +34006,15 @@ selection marked by asterisks: More details on each of these items follows: .ilist -.cindex "&%warn%& statement" "log when skipping" +.cindex "8BITMIME" +.cindex "log" "8BITMIME" +&%8bitmime%&: This causes Exim to log any 8BITMIME status of received messages, +which may help in tracking down interoperability issues with ancient MTAs +that are not 8bit clean. This is added to the &"<="& line, tagged with +&`M8S=`& and a value of &`0`&, &`7`& or &`8`&, corresponding to "not given", +&`7BIT`& and &`8BITMIME`& respectively. +.next +.cindex "&%warn%& ACL verb" "log when skipping" &%acl_warn_skipped%&: When an ACL &%warn%& statement is skipped because one of its conditions cannot be evaluated, a log line to this effect is written if this log selector is set. @@ -30663,7 +34031,7 @@ delivery lines; with this selector, intermediate parents are given in parentheses between them. .next .cindex "log" "Exim arguments" -.cindex "Exim arguments" "logging" +.cindex "Exim arguments, logging" &%arguments%&: This causes Exim to write the arguments with which it was called to the main log, preceded by the current working directory. This is a debugging feature, added to make it easier to find out how certain MUAs call @@ -30680,7 +34048,7 @@ between the caller and Exim. connection is rejected, for whatever reason. .next .cindex "log" "delayed delivery" -.cindex "delayed delivery" "logging" +.cindex "delayed delivery, logging" &%delay_delivery%&: A log entry is written whenever a delivery process is not started for an incoming message because the load is too high or too many messages were received on one connection. Logging does not occur if no delivery @@ -30703,7 +34071,7 @@ DNS black list suffers a temporary error. .next .cindex "log" "ETRN commands" .cindex "ETRN" "logging" -&%etrn%&: Every legal ETRN command that is received is logged, before the ACL +&%etrn%&: Every valid ETRN command that is received is logged, before the ACL is run to determine whether or not it is actually accepted. An invalid ETRN command, or one received within a message transaction is not logged by this selector (see &%smtp_syntax_error%& and &%smtp_protocol_error%&). @@ -30730,8 +34098,8 @@ rejection lines. .cindex "log" "incoming remote port" .cindex "port" "logging remote" .cindex "TCP/IP" "logging incoming remote port" -.cindex "&$sender_fullhost$&" -.cindex "&$sender_rcvhost$&" +.vindex "&$sender_fullhost$&" +.vindex "&$sender_rcvhost$&" &%incoming_port%&: The remote port number from which a message was received is added to log entries and &'Received:'& header lines, following the IP address in square brackets, and separated from it by a colon. This is implemented by @@ -30751,6 +34119,11 @@ containing => tags) following the IP address. This option is not included in the default setting, because for most ordinary configurations, the remote port number is always 25 (the SMTP port). .next +.cindex "log" "process ids in" +.cindex "pid (process id)" "in log lines" +&%pid%&: The current process id is added to every log line, in square brackets, +immediately after the time and date. +.next .cindex "log" "queue run" .cindex "queue runner" "logging" &%queue_run%&: The start and end of every queue run are logged. @@ -30808,10 +34181,10 @@ This is the original sender that was received with the message; it is not necessarily the same as the outgoing return path. .next .cindex "log" "sender verify failure" -&%sender_verify_failure%&: If this selector is unset, the separate log line -that gives details of a sender verification failure is not written. Log lines -for the rejection of SMTP commands contain just &"sender verify failed"&, so -some detail is lost. +&%sender_verify_fail%&: If this selector is unset, the separate log line that +gives details of a sender verification failure is not written. Log lines for +the rejection of SMTP commands contain just &"sender verify failed"&, so some +detail is lost. .next .cindex "log" "size rejection" &%size_reject%&: A log line is written whenever a message is rejected because @@ -30859,6 +34232,38 @@ RSET, QUIT, loss of connection, or otherwise, the incident is logged, and the message sender plus any accepted recipients are included in the log line. This can provide evidence of dictionary attacks. .next +.cindex "log" "non-MAIL SMTP sessions" +.cindex "MAIL" "logging session without" +&%smtp_no_mail%&: A line is written to the main log whenever an accepted SMTP +connection terminates without having issued a MAIL command. This includes both +the case when the connection is dropped, and the case when QUIT is used. It +does not include cases where the connection is rejected right at the start (by +an ACL, or because there are too many connections, or whatever). These cases +already have their own log lines. + +The log line that is written contains the identity of the client in the usual +way, followed by D= and a time, which records the duration of the connection. +If the connection was authenticated, this fact is logged exactly as it is for +an incoming message, with an A= item. If the connection was encrypted, CV=, +DN=, and X= items may appear as they do for an incoming message, controlled by +the same logging options. + +Finally, if any SMTP commands were issued during the connection, a C= item +is added to the line, listing the commands that were used. For example, +.code +C=EHLO,QUIT +.endd +shows that the client issued QUIT straight after EHLO. If there were fewer +than 20 commands, they are all listed. If there were more than 20 commands, +the last 20 are listed, preceded by &"..."&. However, with the default +setting of 10 for &%smtp_accep_max_nonmail%&, the connection will in any case +have been aborted before 20 non-mail commands are processed. +.next +&%smtp_mailauth%&: A third subfield with the authenticated sender, +colon-separated, is appended to the A= item for a message arrival or delivery +log line, if an AUTH argument to the SMTP MAIL command (see &<>&) +was accepted or used. +.next .cindex "log" "SMTP protocol error" .cindex "SMTP" "logging protocol error" &%smtp_protocol_error%&: A log line is written for every SMTP protocol error @@ -30879,7 +34284,7 @@ external connection, the host identity is given; for an internal connection using &%-bs%& the sender identification (normally the calling user) is given. .next .cindex "log" "subject" -.cindex "subject" "logging" +.cindex "subject, logging" &%subject%&: The subject of the message is added to the arrival log line, preceded by &"T="& (T for &"topic"&, since S is already used for &"size"&). Any MIME &"words"& in the subject are decoded. The &%print_topbitchars%& option @@ -30902,17 +34307,23 @@ connection, the cipher suite used is added to the log line, preceded by X=. connection, and a certificate is supplied by the remote host, the peer DN is added to the log line, preceded by DN=. .next +.cindex "log" "TLS SNI" +.cindex "TLS" "logging SNI" +&%tls_sni%&: When a message is received over an encrypted connection, and +the remote host provided the Server Name Indication extension, the SNI is +added to the log line, preceded by SNI=. +.next .cindex "log" "DNS failure in list" &%unknown_in_list%&: This setting causes a log entry to be written when the result of a list match is failure because a DNS lookup failed. .endlist -.section "Message log" +.section "Message log" "SECID260" .cindex "message" "log file for" .cindex "log" "message log; description of" .cindex "&_msglog_& directory" -.cindex "&%preserve_message_logs%&" +.oindex "&%preserve_message_logs%&" In addition to the general log files, Exim writes a log file for each message that it handles. The names of these per-message logs are the message ids, and they are kept in the &_msglog_& sub-directory of the spool directory. Each @@ -30928,6 +34339,8 @@ per-message logs, in order to reduce disk I/O. This can be done by setting the .ecindex IIDloggen + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -30937,25 +34350,25 @@ A number of utility scripts and programs are supplied with Exim and are described in this chapter. There is also the Exim Monitor, which is covered in the next chapter. The utilities described here are: -.itable none 0 0 4 2* left 8* left 30* left 40* left -.row "" &<>& &'exiwhat'& &&& +.itable none 0 0 3 7* left 15* left 40* left +.irow &<>& &'exiwhat'& &&& "list what Exim processes are doing" -.row "" &<>& &'exiqgrep'& "grep the queue" -.row "" &<>& &'exiqsumm'& "summarize the queue" -.row "" &<>& &'exigrep'& "search the main log" -.row "" &<>& &'exipick'& "select messages on &&& - various criteria" -.row "" &<>& &'exicyclog'& "cycle (rotate) log files" -.row "" &<>& &'eximstats'& &&& +.irow &<>& &'exiqgrep'& "grep the queue" +.irow &<>& &'exiqsumm'& "summarize the queue" +.irow &<>& &'exigrep'& "search the main log" +.irow &<>& &'exipick'& "select messages on &&& + various criteria" +.irow &<>& &'exicyclog'& "cycle (rotate) log files" +.irow &<>& &'eximstats'& &&& "extract statistics from the log" -.row "" &<>& &'exim_checkaccess'& &&& +.irow &<>& &'exim_checkaccess'& &&& "check address acceptance from given IP" -.row "" &<>& &'exim_dbmbuild'& "build a DBM file" -.row "" &<>& &'exinext'& "extract retry information" -.row "" &<>& &'exim_dumpdb'& "dump a hints database" -.row "" &<>& &'exim_tidydb'& "clean up a hints database" -.row "" &<>& &'exim_fixdb'& "patch a hints database" -.row "" &<>& &'exim_lock'& "lock a mailbox file" +.irow &<>& &'exim_dbmbuild'& "build a DBM file" +.irow &<>& &'exinext'& "extract retry information" +.irow &<>& &'exim_dumpdb'& "dump a hints database" +.irow &<>& &'exim_tidydb'& "clean up a hints database" +.irow &<>& &'exim_fixdb'& "patch a hints database" +.irow &<>& &'exim_lock'& "lock a mailbox file" .endtable Another utility that might be of use to sites with many MTAs is Tom Kistner's @@ -30967,7 +34380,7 @@ Another utility that might be of use to sites with many MTAs is Tom Kistner's .section "Finding out what Exim processes are doing (exiwhat)" "SECTfinoutwha" .cindex "&'exiwhat'&" -.cindex "process" "querying" +.cindex "process, querying" .cindex "SIGUSR1" On operating systems that can restart a system call after receiving a signal (most modern OS), an Exim process responds to the SIGUSR1 signal by writing @@ -31071,7 +34484,7 @@ There is one more option, &%-h%&, which outputs a list of options. -.section "Summarising the queue (exiqsumm)" "SECTsumtheque" +.section "Summarizing the queue (exiqsumm)" "SECTsumtheque" .cindex "&'exiqsumm'&" .cindex "queue" "summary" The &'exiqsumm'& utility is a Perl script which reads the output of &`exim @@ -31085,16 +34498,18 @@ it, as in the following example: .code 3 2322 74m 66m msn.com.example .endd -Each line lists the number of -pending deliveries for a domain, their total volume, and the length of time -that the oldest and the newest messages have been waiting. Note that the number -of pending deliveries is greater than the number of messages when messages -have more than one recipient. +Each line lists the number of pending deliveries for a domain, their total +volume, and the length of time that the oldest and the newest messages have +been waiting. Note that the number of pending deliveries is greater than the +number of messages when messages have more than one recipient. A summary line is output at the end. By default the output is sorted on the domain name, but &'exiqsumm'& has the options &%-a%& and &%-c%&, which cause the output to be sorted by oldest message and by count of messages, -respectively. +respectively. There are also three options that split the messages for each +domain into two or more subcounts: &%-b%& separates bounce messages, &%-f%& +separates frozen messages, and &%-s%& separates messages according to their +sender. The output of &'exim -bp'& contains the original addresses in the message, so this also applies to the output from &'exiqsumm'&. No domains from addresses @@ -31115,20 +34530,29 @@ extracts all the log entries for the relevant message, not just those that match the pattern. Thus, &'exigrep'& can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example. The input files can be in Exim log format or syslog format. - -If a matching log line is not associated with a specific message, it is always -included in &'exigrep'&'s output. The usage is: +If a matching log line is not associated with a specific message, it is +included in &'exigrep'&'s output without any additional lines. The usage is: .display -&`exigrep [-l] [-t<`&&'n'&&`>] <`&&'pattern'&&`> [<`&&'log file'&&`>] ...`& +&`exigrep [-t<`&&'n'&&`>] [-I] [-l] [-v] <`&&'pattern'&&`> [<`&&'log file'&&`>] ...`& .endd +If no log file names are given on the command line, the standard input is read. + The &%-t%& argument specifies a number of seconds. It adds an additional condition for message selection. Messages that are complete are shown only if they spent more than <&'n'&> seconds on the queue. -The &%-l%& flag means &"literal"&, that is, treat all characters in the +By default, &'exigrep'& does case-insensitive matching. The &%-I%& option +makes it case-sensitive. This may give a performance improvement when searching +large log files. Without &%-I%&, the Perl pattern matches use Perl's &`/i`& +option; with &%-I%& they do not. In both cases it is possible to change the +case sensitivity within the pattern by using &`(?i)`& or &`(?-i)`&. + +The &%-l%& option means &"literal"&, that is, treat all characters in the pattern as standing for themselves. Otherwise the pattern must be a Perl -regular expression. The pattern match is case-insensitive. If no file names are -given on the command line, the standard input is read. +regular expression. + +The &%-v%& option inverts the matching condition. That is, a line is selected +if it does &'not'& match the pattern. If the location of a &'zcat'& command is known from the definition of ZCAT_COMMAND in &_Local/Makefile_&, &'exigrep'& automatically passes any file @@ -31138,11 +34562,10 @@ whose name ends in COMPRESS_SUFFIX through &'zcat'& as it searches it. .section "Selecting messages by various criteria (exipick)" "SECTexipick" .cindex "&'exipick'&" John Jetmore's &'exipick'& utility is included in the Exim distribution. It -lists messages from the queue according to a variety of criteria. For details, -run: -.code -exipick --help -.endd +lists messages from the queue according to a variety of criteria. For details +of &'exipick'&'s facilities, visit the web page at +&url(http://www.exim.org/eximwiki/ToolExipickManPage) or run &'exipick'& with +the &%--help%& option. .section "Cycling log files (exicyclog)" "SECTcyclogfil" @@ -31195,7 +34618,7 @@ assuming you have used the name &"exim"& for the Exim user. You can run .cindex "&'eximstats'&" A Perl script called &'eximstats'& is provided for extracting statistical information from log files. The output is either plain text, or HTML. -Exim log files are also suported by the &'Lire'& system produced by the +Exim log files are also supported by the &'Lire'& system produced by the LogReport Foundation &url(http://www.logreport.org). The &'eximstats'& script has been hacked about quite a bit over time. The @@ -31417,7 +34840,7 @@ Serializing delivery to a specific host (when &%serialize_hosts%& is set in an -.section "exim_dumpdb" +.section "exim_dumpdb" "SECID261" .cindex "&'exim_dumpdb'&" The entire contents of a database are written to the standard output by the &'exim_dumpdb'& program, which has no options or arguments other than the @@ -31434,7 +34857,7 @@ The first item on the first line is the key of the record. It starts with one of the letters R, or T, depending on whether it refers to a routing or transport retry. For a local delivery, the next part is the local address; for a remote delivery it is the name of the remote host, followed by its failing IP -address (unless &%no_retry_include_ip_address%& is set on the &(smtp)& +address (unless &%retry_include_ip_address%& is set false on the &(smtp)& transport). If the remote port is not the standard one (port 25), it is added to the IP address. Then there follows an error code, an additional error code, and a textual description of the error. @@ -31454,7 +34877,7 @@ cross-references. -.section "exim_tidydb" +.section "exim_tidydb" "SECID262" .cindex "&'exim_tidydb'&" The &'exim_tidydb'& utility program is used to tidy up the contents of a hints database. If run with no options, it removes all records that are more than 30 @@ -31503,7 +34926,7 @@ databases is likely to keep on increasing. -.section "exim_fixdb" +.section "exim_fixdb" "SECID263" .cindex "&'exim_fixdb'&" The &'exim_fixdb'& program is a utility for interactively modifying databases. Its main use is for testing Exim, but it might also be occasionally useful for @@ -31630,7 +35053,7 @@ second argument &-- hence the quotes. .cindex "X-windows" .cindex "&'eximon'&" .cindex "Local/eximon.conf" -.cindex "_exim_monitor/EDITME_" +.cindex "&_exim_monitor/EDITME_&" The Exim monitor is an application which displays in an X window information about the state of Exim's queue and what Exim is doing. An admin user can perform certain operations on messages from this GUI interface; however all @@ -31639,7 +35062,7 @@ monitor itself makes use of the command line to perform any actions requested. -.section "Running the monitor" +.section "Running the monitor" "SECID264" The monitor is started by running the script called &'eximon'&. This is a shell script that sets up a number of environment variables, and then runs the binary called &_eximon.bin_&. The default appearance of the monitor window can @@ -31680,6 +35103,12 @@ End In order to see the contents of messages on the queue, and to operate on them, &'eximon'& must either be run as root or by an admin user. +The command-line parameters of &'eximon'& are passed to &_eximon.bin_& and may +contain X11 resource parameters interpreted by the X11 library. In addition, +if the first parameter starts with the string "gdb" then it is removed and the +binary is invoked under gdb (the parameter is used as the gdb command-name, so +versioned variants of gdb can be invoked). + The monitor's window is divided into three parts. The first contains one or more stripcharts and two action buttons, the second contains a &"tail"& of the main log file, and the third is a display of the queue of messages awaiting @@ -31689,7 +35118,7 @@ different parts of the display. -.section "The stripcharts" +.section "The stripcharts" "SECID265" .cindex "stripchart" The first stripchart is always a count of messages on the queue. Its name can be configured by setting QUEUE_STRIPCHART_NAME in the @@ -31721,7 +35150,7 @@ SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the -.section "Main action buttons" +.section "Main action buttons" "SECID266" .cindex "size" "of monitor window" .cindex "Exim monitor" "window size" .cindex "window size" @@ -31750,7 +35179,7 @@ START_SMALL=yes in &_Local/eximon.conf_&. -.section "The log display" +.section "The log display" "SECID267" .cindex "log" "tail of; in monitor" The second section of the window is an area in which a display of the tail of the main log is maintained. @@ -31804,7 +35233,7 @@ window. -.section "The queue display" +.section "The queue display" "SECID268" .cindex "queue" "display in monitor" The bottom section of the monitor window contains a list of all messages that are on the queue, which includes those currently being received or delivered, @@ -31856,7 +35285,7 @@ display is updated. -.section "The queue menu" +.section "The queue menu" "SECID269" .cindex "queue" "menu in monitor" If the &%shift%& key is held down and the left button is clicked when the mouse pointer is over the text for any message, an action menu pops up, and the first @@ -31982,7 +35411,7 @@ absence of bugs can never be guaranteed. Any that are reported will get fixed as soon as possible. -.section "Building a more &""hardened""& Exim" +.section "Building a more &""hardened""& Exim" "SECID286" .cindex "security" "build-time features" There are a number of build-time options that can be set in &_Local/Makefile_& to create Exim binaries that are &"harder"& to attack, in particular by a rogue @@ -32002,15 +35431,26 @@ which only root has access, this guards against someone who has broken into the Exim account from running a privileged Exim with an arbitrary configuration file, and using it to break into other accounts. .next -If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for &%-C%& -and &%-D%& only if the caller of Exim is root. Without it, the Exim user may -also use &%-C%& and &%-D%& and retain privilege. Setting this option locks out -the possibility of testing a configuration using &%-C%& right through message -reception and delivery, even if the caller is root. The reception works, but by -that time, Exim is running as the Exim user, so when it re-execs to regain -privilege for the delivery, the use of &%-C%& causes privilege to be lost. -However, root can test reception and delivery using two separate commands. -ALT_CONFIG_ROOT_ONLY is not set by default. + +If a non-trusted configuration file (i.e. not the default configuration file +or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST +file) is specified with &%-C%&, or if macros are given with &%-D%& (but see +the next item), then root privilege is retained only if the caller of Exim is +root. This locks out the possibility of testing a configuration using &%-C%& +right through message reception and delivery, even if the caller is root. The +reception works, but by that time, Exim is running as the Exim user, so when +it re-execs to regain privilege for the delivery, the use of &%-C%& causes +privilege to be lost. However, root can test reception and delivery using two +separate commands. + +.next +The WHITELIST_D_MACROS build option declares some macros to be safe to override +with &%-D%& if the real uid is one of root, the Exim run-time user or the +CONFIGURE_OWNER, if defined. The potential impact of this option is limited by +requiring the run-time value supplied to &%-D%& to match a regex that errs on +the restrictive side. Requiring build-time selection of safe macros is onerous +but this option is intended solely as a transition mechanism to permit +previously-working configurations to continue to work after release 4.73. .next If DISABLE_D_OPTION is defined, the use of the &%-D%& command line option is disabled. @@ -32024,8 +35464,7 @@ is permitted to modify the runtime file from using Exim as a way to get root. - -.section "Root privilege" +.section "Root privilege" "SECID270" .cindex "setuid" .cindex "root privilege" The Exim binary is normally setuid to root, which means that it gains root @@ -32062,19 +35501,21 @@ After a new Exim process has interpreted its command line options, it changes uid and gid in the following cases: .ilist -.cindex "&%-C%& option" -.cindex "&%-D%& option" +.oindex "&%-C%&" +.oindex "&%-D%&" If the &%-C%& option is used to specify an alternate configuration file, or if the &%-D%& option is used to define macro values for the configuration, and the -calling process is not running as root or the Exim user, the uid and gid are -changed to those of the calling process. -However, if ALT_CONFIG_ROOT_ONLY is defined in &_Local/Makefile_&, only -root callers may use &%-C%& and &%-D%& without losing privilege, and if -DISABLE_D_OPTION is set, the &%-D%& option may not be used at all. -.next -.cindex "&%-be%& option" -.cindex "&%-bf%& option" -.cindex "&%-bF%& option" +calling process is not running as root, the uid and gid are changed to those of +the calling process. +However, if DISABLE_D_OPTION is defined in &_Local/Makefile_&, the &%-D%& +option may not be used at all. +If WHITELIST_D_MACROS is defined in &_Local/Makefile_&, then some macro values +can be supplied if the calling process is running as root, the Exim run-time +user or CONFIGURE_OWNER, if defined. +.next +.oindex "&%-be%&" +.oindex "&%-bf%&" +.oindex "&%-bF%&" If the expansion test option (&%-be%&) or one of the filter testing options (&%-bf%& or &%-bF%&) are used, the uid and gid are changed to those of the calling process. @@ -32084,8 +35525,8 @@ process or a process for testing address routing (started with &%-bt%&), the uid and gid are changed to the Exim user and group. This means that Exim always runs under its own uid and gid when receiving messages. This also applies when testing address verification -.cindex "&%-bv%& option" -.cindex "&%-bh%& option" +.oindex "&%-bv%&" +.oindex "&%-bh%&" (the &%-bv%& option) and testing incoming message policy controls (the &%-bh%& option). .next @@ -32126,7 +35567,7 @@ the routing is done in the same environment as a message delivery. .section "Running Exim without privilege" "SECTrunexiwitpri" -.cindex "privilege" "running without" +.cindex "privilege, running without" .cindex "unprivileged running" .cindex "root privilege" "running without" Some installations like to run Exim in an unprivileged state for more of its @@ -32137,16 +35578,17 @@ gid are changed to the Exim user and group at the start of a delivery process routing is no longer run as root, and the deliveries themselves cannot change to any other uid. +.cindex SIGHUP +.cindex "daemon" "restarting" Leaving the binary setuid to root, but setting &%deliver_drop_privilege%& means that the daemon can still be started in the usual way, and it can respond correctly to SIGHUP because the re-invocation regains root privilege. An alternative approach is to make Exim setuid to the Exim user and also setgid -to the Exim group. -If you do this, the daemon must be started from a root process. (Calling -Exim from a root process makes it behave in the way it does when it is setuid -root.) However, the daemon cannot restart itself after a SIGHUP signal because -it cannot regain privilege. +to the Exim group. If you do this, the daemon must be started from a root +process. (Calling Exim from a root process makes it behave in the way it does +when it is setuid root.) However, the daemon cannot restart itself after a +SIGHUP signal because it cannot regain privilege. It is still useful to set &%deliver_drop_privilege%& in this case, because it stops Exim from trying to re-invoke itself to do a delivery after a message has @@ -32193,7 +35635,7 @@ Unless the local user mailboxes are all owned by the Exim user (possible in some POP3 or IMAP-only environments): .olist -They must be owned by the Exim group and be writable by that group. This +They must be owned by the Exim group and be writeable by that group. This implies you must set &%mode%& in the appendfile configuration, as well as the mode of the mailbox files themselves. .next @@ -32218,13 +35660,57 @@ If you are using the &%mua_wrapper%& facility (see chapter -.section "Delivering to local files" +.section "Delivering to local files" "SECID271" Full details of the checks applied by &(appendfile)& before it writes to a file are given in chapter &<>&. -.section "IPv4 source routing" +.section "Running local commands" "SECTsecconslocalcmds" +There are a number of ways in which an administrator can configure Exim to run +commands based upon received, untrustworthy, data. Further, in some +configurations a user who can control a &_.forward_& file can also arrange to +run commands. Configuration to check includes, but is not limited to: + +.ilist +Use of &%use_shell%& in the pipe transport: various forms of shell command +injection may be possible with this option present. It is dangerous and should +be used only with considerable caution. Consider constraints which whitelist +allowed characters in a variable which is to be used in a pipe transport that +has &%use_shell%& enabled. +.next +A number of options such as &%forbid_filter_run%&, &%forbid_filter_perl%&, +&%forbid_filter_dlfunc%& and so forth which restrict facilities available to +&_.forward_& files in a redirect router. If Exim is running on a central mail +hub to which ordinary users do not have shell access, but home directories are +NFS mounted (for instance) then administrators should review the list of these +forbid options available, and should bear in mind that the options that may +need forbidding can change as new features are added between releases. +.next +The &%${run...}%& expansion item does not use a shell by default, but +administrators can configure use of &_/bin/sh_& as part of the command. +Such invocations should be viewed with prejudicial suspicion. +.next +Administrators who use embedded Perl are advised to explore how Perl's +taint checking might apply to their usage. +.next +Use of &%${expand...}%& is somewhat analagous to shell's eval builtin and +administrators are well advised to view its use with suspicion, in case (for +instance) it allows a local-part to contain embedded Exim directives. +.next +Use of &%${match_local_part...}%& and friends becomes more dangerous if +Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in +each can reference arbitrary lists and files, rather than just being a list +of opaque strings. +The EXPAND_LISTMATCH_RHS option was added and set false by default because of +real-world security vulnerabilities caused by its use with untrustworthy data +injected in, for SQL injection attacks. +Consider the use of the &%inlisti%& expansion condition instead. +.endlist + + + +.section "IPv4 source routing" "SECID272" .cindex "source routing" "in IP packets" .cindex "IP source routing" Many operating systems suppress IP source-routed packets in the kernel, but @@ -32234,26 +35720,26 @@ IPv6. No special checking is currently done. -.section "The VRFY, EXPN, and ETRN commands in SMTP" +.section "The VRFY, EXPN, and ETRN commands in SMTP" "SECID273" Support for these SMTP commands is disabled by default. If required, they can be enabled by defining suitable ACLs. -.section "Privileged users" -.cindex "trusted user" +.section "Privileged users" "SECID274" +.cindex "trusted users" .cindex "admin user" .cindex "privileged user" .cindex "user" "trusted" .cindex "user" "admin" -Exim recognises two sets of users with special privileges. Trusted users are +Exim recognizes two sets of users with special privileges. Trusted users are able to submit new messages to Exim locally, but supply their own sender addresses and information about a sending host. For other users submitting local messages, Exim sets up the sender address from the uid, and doesn't permit a remote host to be specified. -.cindex "&%-f%& option" +.oindex "&%-f%&" However, an untrusted user is permitted to use the &%-f%& command line option in the special form &%-f <>%& to indicate that a delivery failure for the message should not cause an error report. This affects the message's envelope, @@ -32273,8 +35759,8 @@ them entirely, or modify them in various ways. In addition, admin users can run the Exim monitor and see all the information it is capable of providing, which includes the contents of files on the spool. -.cindex "&%-M%& option" -.cindex "&%-q%& option" +.oindex "&%-M%&" +.oindex "&%-q%&" By default, the use of the &%-M%& and &%-q%& options to cause Exim to attempt delivery of messages on its queue is restricted to admin users. This restriction can be relaxed by setting the &%no_prod_requires_admin%& option. @@ -32282,7 +35768,7 @@ Similarly, the use of &%-bp%& (and its variants) to list the contents of the queue is also restricted to admin users. This restriction can be relaxed by setting &%no_queue_list_requires_admin%&. -Exim recognises an admin user if the calling process is running as root or as +Exim recognizes an admin user if the calling process is running as root or as the Exim user or if any of the groups associated with the calling process is the Exim group. It is not necessary actually to be running under the Exim group. However, if admin users who are not root or the Exim user are to access @@ -32292,7 +35778,7 @@ files. -.section "Spool files" +.section "Spool files" "SECID275" .cindex "spool directory" "files" Exim's spool directory and everything it contains is owned by the Exim user and set to the Exim group. The mode for spool files is defined in the @@ -32301,7 +35787,7 @@ any user who is a member of the Exim group can access these files. -.section "Use of argv[0]" +.section "Use of argv[0]" "SECID276" Exim examines the last component of &%argv[0]%&, and if it matches one of a set of specific strings, Exim assumes certain options. For example, calling Exim with the last component of &%argv[0]%& set to &"rsmtp"& is exactly equivalent @@ -32310,7 +35796,7 @@ this. -.section "Use of %f formatting" +.section "Use of %f formatting" "SECID277" The only use made of &"%f"& by Exim is in formatting load average values. These are actually stored in integer variables as 1000 times the load average. Consequently, their range is limited and so therefore is the length of the @@ -32318,7 +35804,7 @@ converted output. -.section "Embedded Exim path" +.section "Embedded Exim path" "SECID278" Exim uses its own path name, which is embedded in the code, only when it needs to re-exec in order to regain root privilege. Therefore, it is not root when it does so. If some bug allowed the path to get overwritten, it would lead to an @@ -32326,7 +35812,13 @@ arbitrary program's being run as exim, not as root. -.section "Use of sprintf()" +.section "Dynamic module directory" "SECTdynmoddir" +Any dynamically loadable modules must be installed into the directory +defined in &`LOOKUP_MODULE_DIR`& in &_Local/Makefile_& for Exim to permit +loading it. + + +.section "Use of sprintf()" "SECID279" .cindex "&[sprintf()]&" A large number of occurrences of &"sprintf"& in the code are actually calls to &'string_sprintf()'&, a function that returns the result in malloc'd store. @@ -32340,14 +35832,14 @@ string. -.section "Use of debug_printf() and log_write()" +.section "Use of debug_printf() and log_write()" "SECID280" Arbitrary strings are passed to both these functions, but they do their formatting by calling the function &'string_vformat()'&, which runs through the format string itself, and checks the length of each conversion. -.section "Use of strcat() and strcpy()" +.section "Use of strcat() and strcpy()" "SECID281" These are used only in cases where the output buffer is known to be large enough to hold the result. .ecindex IIDsecurcon @@ -32382,7 +35874,7 @@ which is what Exim itself does, using &[fcntl()]&. If you update the file in place, the lock will be retained. If you write a new file and rename it, the lock will be lost at the instant of rename. .next -.cindex "&$body_linecount$&" +.vindex "&$body_linecount$&" If you change the number of lines in the file, the value of &$body_linecount$&, which is stored in the -H file, will be incorrect. At present, this value is not used by Exim, but there is no guarantee that this @@ -32393,22 +35885,26 @@ If the message is in MIME format, you must take care not to break it. If the message is cryptographically signed, any change will invalidate the signature. .endlist - +All in all, modifying -D files is fraught with danger. Files whose names end with -J may also be seen in the &_input_& directory (or its subdirectories when &%split_spool_directory%& is set). These are journal files, used to record addresses to which the message has been delivered during -the course of a delivery run. At the end of the run, the -H file is updated, -and the -J file is deleted. - +the course of a delivery attempt. If there are still undelivered recipients at +the end, the -H file is updated, and the -J file is deleted. If, however, there +is some kind of crash (for example, a power outage) before this happens, the -J +file remains in existence. When Exim next processes the message, it notices the +-J file and uses it to update the -H file before starting the next delivery +attempt. -.section "Format of the -H file" +.section "Format of the -H file" "SECID282" .cindex "uid (user id)" "in spool file" .cindex "gid (group id)" "in spool file" The second line of the -H file contains the login name for the uid of the process that called Exim to read the message, followed by the numerical uid and gid. For a locally generated message, this is normally the user who sent the -message. For a message received over TCP/IP, it is normally the Exim user. +message. For a message received over TCP/IP via the daemon, it is +normally the Exim user. The third line of the file contains the address of the message's sender as transmitted in the envelope, contained in angle brackets. The sender address is @@ -32428,7 +35924,7 @@ There follow a number of lines starting with a hyphen. These can appear in any order, and are omitted when not relevant: .vlist -.vitem "&%-acl%& <&'number'&> <&'length'&>" +.vitem "&%-acl%&&~<&'number'&>&~<&'length'&>" This item is obsolete, and is not generated from Exim release 4.61 onwards; &%-aclc%& and &%-aclm%& are used instead. However, &%-acl%& is still recognized, to provide backward compatibility. In the old format, a line of @@ -32439,19 +35935,21 @@ the data string for the variable. The string itself starts at the beginning of the next line, and is followed by a newline character. It may contain internal newlines. -.vitem "&%-aclc%& <&'number'&> <&'length'&>" -A line of this form is present for every ACL connection variable that is not -empty. The number identifies the variable. The length is the length of the data -string for the variable. The string itself starts at the beginning of the next -line, and is followed by a newline character. It may contain internal newlines. - -.vitem "&%-aclm%& <&'number'&> <&'length'&>" -A line of this form is present for every ACL message variable that is not -empty. The number identifies the variable. The length is the length of the data -string for the variable. The string itself starts at the beginning of the next -line, and is followed by a newline character. It may contain internal newlines. - -.vitem "&%-active_hostname%& <&'hostname'&>" +.vitem "&%-aclc%&&~<&'rest-of-name'&>&~<&'length'&>" +A line of this form is present for every ACL connection variable that is +defined. Note that there is a space between &%-aclc%& and the rest of the name. +The length is the length of the data string for the variable. The string itself +starts at the beginning of the next line, and is followed by a newline +character. It may contain internal newlines. + +.vitem "&%-aclm%&&~<&'rest-of-name'&>&~<&'length'&>" +A line of this form is present for every ACL message variable that is defined. +Note that there is a space between &%-aclm%& and the rest of the name. The +length is the length of the data string for the variable. The string itself +starts at the beginning of the next line, and is followed by a newline +character. It may contain internal newlines. + +.vitem "&%-active_hostname%&&~<&'hostname'&>" This is present if, when the message was received over SMTP, the value of &$smtp_active_hostname$& was different to the value of &$primary_hostname$&. @@ -32467,19 +35965,19 @@ This is present if unqualified sender addresses are permitted in header lines time). Local messages that were input using &%-bnq%& and remote messages from hosts that match &%sender_unqualified_hosts%& set this flag. -.vitem "&%-auth_id%& <&'text'&>" +.vitem "&%-auth_id%&&~<&'text'&>" The id information for a message received on an authenticated SMTP connection &-- the value of the &$authenticated_id$& variable. -.vitem "&%-auth_sender%& <&'address'&>" +.vitem "&%-auth_sender%&&~<&'address'&>" The address of an authenticated sender &-- the value of the &$authenticated_sender$& variable. -.vitem "&%-body_linecount%& <&'number'&>" +.vitem "&%-body_linecount%&&~<&'number'&>" This records the number of lines in the body of the message, and is always present. -.vitem "&%-body_zerocount%& <&'number'&>" +.vitem "&%-body_zerocount%&&~<&'number'&>" This records the number of binary zero bytes in the body of the message, and is present if the number is greater than zero. @@ -32487,20 +35985,20 @@ present if the number is greater than zero. This is written when a new message is first added to the spool. When the spool file is updated after a deferral, it is omitted. -.vitem "&%-frozen%& <&'time'&>" +.vitem "&%-frozen%&&~<&'time'&>" .cindex "frozen messages" "spool data" The message is frozen, and the freezing happened at <&'time'&>. -.vitem "&%-helo_name%& <&'text'&>" +.vitem "&%-helo_name%&&~<&'text'&>" This records the host name as specified by a remote host in a HELO or EHLO command. -.vitem "&%-host_address%& <&'address'&>.<&'port'&>" +.vitem "&%-host_address%&&~<&'address'&>.<&'port'&>" This records the IP address of the host from which the message was received and the remote port number that was used. It is omitted for locally generated messages. -.vitem "&%-host_auth%& <&'text'&>" +.vitem "&%-host_auth%&&~<&'text'&>" If the message was received on an authenticated SMTP connection, this records the name of the authenticator &-- the value of the &$sender_host_authenticated$& variable. @@ -32509,20 +36007,20 @@ the name of the authenticator &-- the value of the This is present if an attempt to look up the sending host's name from its IP address failed. It corresponds to the &$host_lookup_failed$& variable. -.vitem "&%-host_name%& <&'text'&>" +.vitem "&%-host_name%&&~<&'text'&>" .cindex "reverse DNS lookup" .cindex "DNS" "reverse lookup" This records the name of the remote host from which the message was received, if the host name was looked up from the IP address when the message was being received. It is not present if no reverse lookup was done. -.vitem "&%-ident%& <&'text'&>" +.vitem "&%-ident%&&~<&'text'&>" For locally submitted messages, this records the login of the originating user, unless it was a trusted user and the &%-oMt%& option was used to specify an ident value. For messages received over TCP/IP, this records the ident string supplied by the remote host, if any. -.vitem "&%-interface_address%& <&'address'&>.<&'port'&>" +.vitem "&%-interface_address%&&~<&'address'&>.<&'port'&>" This records the IP address of the local interface and the port number through which a message was received from a remote host. It is omitted for locally generated messages. @@ -32533,7 +36031,7 @@ The message is from a local sender. .vitem &%-localerror%& The message is a locally-generated bounce message. -.vitem "&%-local_scan%& <&'string'&>" +.vitem "&%-local_scan%&&~<&'string'&>" This records the data string that was returned by the &[local_scan()]& function when the message was received &-- the value of the &$local_scan_data$& variable. It is omitted if no data was returned. @@ -32555,7 +36053,7 @@ the name of the protocol by which the message was received. The envelope sender of this message was set by an untrusted local caller (used to ensure that the caller is displayed in queue listings). -.vitem "&%-spam_score_int%& <&'number'&>" +.vitem "&%-spam_score_int%&&~<&'number'&>" If a message was scanned by SpamAssassin, this is present. It records the value of &$spam_score_int$&. @@ -32563,11 +36061,11 @@ of &$spam_score_int$&. A TLS certificate was received from the client that sent this message, and the certificate was verified by the server. -.vitem "&%-tls_cipher%& <&'cipher name'&>" +.vitem "&%-tls_cipher%&&~<&'cipher name'&>" When the message was received over an encrypted connection, this records the name of the cipher suite that was used. -.vitem "&%-tls_peerdn%& <&'peer DN'&>" +.vitem "&%-tls_peerdn%&&~<&'peer DN'&>" When the message was received over an encrypted connection, and a certificate was received from the client, this records the Distinguished Name from that certificate. @@ -32666,16 +36164,282 @@ unqualified domain &'foundation'&. .ecindex IIDforspo2 .ecindex IIDforspo3 +. //////////////////////////////////////////////////////////////////////////// +. //////////////////////////////////////////////////////////////////////////// + +.chapter "Support for DKIM (DomainKeys Identified Mail)" "CHAPdkim" &&& + "DKIM Support" +.cindex "DKIM" + +DKIM is a mechanism by which messages sent by some entity can be provably +linked to a domain which that entity controls. It permits reputation to +be tracked on a per-domain basis, rather than merely upon source IP address. +DKIM is documented in RFC 4871. + +Since version 4.70, DKIM support is compiled into Exim by default. It can be +disabled by setting DISABLE_DKIM=yes in Local/Makefile. + +Exim's DKIM implementation allows to +.olist +Sign outgoing messages: This function is implemented in the SMTP transport. +It can co-exist with all other Exim features, including transport filters. +.next +Verify signatures in incoming messages: This is implemented by an additional +ACL (acl_smtp_dkim), which can be called several times per message, with +different signature contexts. +.endlist + +In typical Exim style, the verification implementation does not include any +default "policy". Instead it enables you to build your own policy using +Exim's standard controls. + +Please note that verification of DKIM signatures in incoming mail is turned +on by default for logging purposes. For each signature in incoming email, +exim will log a line displaying the most important signature details, and the +signature status. Here is an example (with line-breaks added for clarity): +.code +2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM: + d=facebookmail.com s=q1-2009b + c=relaxed/relaxed a=rsa-sha1 + i=@facebookmail.com t=1252484542 [verification succeeded] +.endd +You might want to turn off DKIM verification processing entirely for internal +or relay mail sources. To do that, set the &%dkim_disable_verify%& ACL +control modifier. This should typically be done in the RCPT ACL, at points +where you accept mail from relay sources (internal hosts or authenticated +senders). + + +.section "Signing outgoing messages" "SECID513" +.cindex "DKIM" "signing" + +Signing is implemented by setting private options on the SMTP transport. +These options take (expandable) strings as arguments. + +.option dkim_domain smtp string&!! unset +MANDATORY: +The domain you want to sign with. The result of this expanded +option is put into the &%$dkim_domain%& expansion variable. + +.option dkim_selector smtp string&!! unset +MANDATORY: +This sets the key selector string. You can use the &%$dkim_domain%& expansion +variable to look up a matching selector. The result is put in the expansion +variable &%$dkim_selector%& which should be used in the &%dkim_private_key%& +option along with &%$dkim_domain%&. + +.option dkim_private_key smtp string&!! unset +MANDATORY: +This sets the private key to use. You can use the &%$dkim_domain%& and +&%$dkim_selector%& expansion variables to determine the private key to use. +The result can either +.ilist +be a valid RSA private key in ASCII armor, including line breaks. +.next +start with a slash, in which case it is treated as a file that contains +the private key. +.next +be "0", "false" or the empty string, in which case the message will not +be signed. This case will not result in an error, even if &%dkim_strict%& +is set. +.endlist + +.option dkim_canon smtp string&!! unset +OPTIONAL: +This option sets the canonicalization method used when signing a message. +The DKIM RFC currently supports two methods: "simple" and "relaxed". +The option defaults to "relaxed" when unset. Note: the current implementation +only supports using the same canonicalization method for both headers and body. + +.option dkim_strict smtp string&!! unset +OPTIONAL: +This option defines how Exim behaves when signing a message that +should be signed fails for some reason. When the expansion evaluates to +either "1" or "true", Exim will defer. Otherwise Exim will send the message +unsigned. You can use the &%$dkim_domain%& and &%$dkim_selector%& expansion +variables here. + +.option dkim_sign_headers smtp string&!! unset +OPTIONAL: +When set, this option must expand to (or be specified as) a colon-separated +list of header names. Headers with these names will be included in the message +signature. When unspecified, the header names recommended in RFC4871 will be +used. + + +.section "Verifying DKIM signatures in incoming mail" "SECID514" +.cindex "DKIM" "verification" + +Verification of DKIM signatures in incoming email is implemented via the +&%acl_smtp_dkim%& ACL. By default, this ACL is called once for each +syntactically(!) correct signature in the incoming message. + +To evaluate the signature in the ACL a large number of expansion variables +containing the signature status and its details are set up during the +runtime of the ACL. + +Calling the ACL only for existing signatures is not sufficient to build +more advanced policies. For that reason, the global option +&%dkim_verify_signers%&, and a global expansion variable +&%$dkim_signers%& exist. + +The global option &%dkim_verify_signers%& can be set to a colon-separated +list of DKIM domains or identities for which the ACL &%acl_smtp_dkim%& is +called. It is expanded when the message has been received. At this point, +the expansion variable &%$dkim_signers%& already contains a colon-separated +list of signer domains and identities for the message. When +&%dkim_verify_signers%& is not specified in the main configuration, +it defaults as: +.code +dkim_verify_signers = $dkim_signers +.endd +This leads to the default behaviour of calling &%acl_smtp_dkim%& for each +DKIM signature in the message. Current DKIM verifiers may want to explicitly +call the ACL for known domains or identities. This would be achieved as follows: +.code +dkim_verify_signers = paypal.com:ebay.com:$dkim_signers +.endd +This would result in &%acl_smtp_dkim%& always being called for "paypal.com" +and "ebay.com", plus all domains and identities that have signatures in the message. +You can also be more creative in constructing your policy. For example: +.code +dkim_verify_signers = $sender_address_domain:$dkim_signers +.endd + +If a domain or identity is listed several times in the (expanded) value of +&%dkim_verify_signers%&, the ACL is only called once for that domain or identity. +Inside the &%acl_smtp_dkim%&, the following expansion variables are +available (from most to least important): + + +.vlist +.vitem &%$dkim_cur_signer%& +The signer that is being evaluated in this ACL run. This can be a domain or +an identity. This is one of the list items from the expanded main option +&%dkim_verify_signers%& (see above). +.vitem &%$dkim_verify_status%& +A string describing the general status of the signature. One of +.ilist +&%none%&: There is no signature in the message for the current domain or +identity (as reflected by &%$dkim_cur_signer%&). +.next +&%invalid%&: The signature could not be verified due to a processing error. +More detail is available in &%$dkim_verify_reason%&. +.next +&%fail%&: Verification of the signature failed. More detail is +available in &%$dkim_verify_reason%&. +.next +&%pass%&: The signature passed verification. It is valid. +.endlist +.vitem &%$dkim_verify_reason%& +A string giving a litte bit more detail when &%$dkim_verify_status%& is either +"fail" or "invalid". One of +.ilist +&%pubkey_unavailable%& (when &%$dkim_verify_status%&="invalid"): The public +key for the domain could not be retrieved. This may be a temporary problem. +.next +&%pubkey_syntax%& (when &%$dkim_verify_status%&="invalid"): The public key +record for the domain is syntactically invalid. +.next +&%bodyhash_mismatch%& (when &%$dkim_verify_status%&="fail"): The calculated +body hash does not match the one specified in the signature header. This +means that the message body was modified in transit. +.next +&%signature_incorrect%& (when &%$dkim_verify_status%&="fail"): The signature +could not be verified. This may mean that headers were modified, +re-written or otherwise changed in a way which is incompatible with +DKIM verification. It may of course also mean that the signature is forged. +.endlist +.vitem &%$dkim_domain%& +The signing domain. IMPORTANT: This variable is only populated if there is +an actual signature in the message for the current domain or identity (as +reflected by &%$dkim_cur_signer%&). +.vitem &%$dkim_identity%& +The signing identity, if present. IMPORTANT: This variable is only populated +if there is an actual signature in the message for the current domain or +identity (as reflected by &%$dkim_cur_signer%&). +.vitem &%$dkim_selector%& +The key record selector string. +.vitem &%$dkim_algo%& +The algorithm used. One of 'rsa-sha1' or 'rsa-sha256'. +.vitem &%$dkim_canon_body%& +The body canonicalization method. One of 'relaxed' or 'simple'. +.vitem &%dkim_canon_headers%& +The header canonicalization method. One of 'relaxed' or 'simple'. +.vitem &%$dkim_copiedheaders%& +A transcript of headers and their values which are included in the signature +(copied from the 'z=' tag of the signature). +.vitem &%$dkim_bodylength%& +The number of signed body bytes. If zero ("0"), the body is unsigned. If no +limit was set by the signer, "9999999999999" is returned. This makes sure +that this variable always expands to an integer value. +.vitem &%$dkim_created%& +UNIX timestamp reflecting the date and time when the signature was created. +When this was not specified by the signer, "0" is returned. +.vitem &%$dkim_expires%& +UNIX timestamp reflecting the date and time when the signer wants the +signature to be treated as "expired". When this was not specified by the +signer, "9999999999999" is returned. This makes it possible to do useful +integer size comparisons against this value. +.vitem &%$dkim_headernames%& +A colon-separated list of names of headers included in the signature. +.vitem &%$dkim_key_testing%& +"1" if the key record has the "testing" flag set, "0" if not. +.vitem &%$nosubdomains%& +"1" if the key record forbids subdomaining, "0" otherwise. +.vitem &%$dkim_key_srvtype%& +Service type (tag s=) from the key record. Defaults to "*" if not specified +in the key record. +.vitem &%$dkim_key_granularity%& +Key granularity (tag g=) from the key record. Defaults to "*" if not specified +in the key record. +.vitem &%$dkim_key_notes%& +Notes from the key record (tag n=). +.endlist + +In addition, two ACL conditions are provided: + +.vlist +.vitem &%dkim_signers%& +ACL condition that checks a colon-separated list of domains or identities +for a match against the domain or identity that the ACL is currently verifying +(reflected by &%$dkim_cur_signer%&). This is typically used to restrict an ACL +verb to a group of domains or identities. For example: + +.code +# Warn when Mail purportedly from GMail has no signature at all +warn log_message = GMail sender without DKIM signature + sender_domains = gmail.com + dkim_signers = gmail.com + dkim_status = none +.endd + +.vitem &%dkim_status%& +ACL condition that checks a colon-separated list of possible DKIM verification +results against the actual result of verification. This is typically used +to restrict an ACL verb to a list of verification outcomes, for example: + +.code +deny message = Mail from Paypal with invalid/missing signature + sender_domains = paypal.com:paypal.de + dkim_signers = paypal.com:paypal.de + dkim_status = none:invalid:fail +.endd + +The possible status keywords are: 'none','invalid','fail' and 'pass'. Please +see the documentation of the &%$dkim_verify_status%& expansion variable above +for more information of what they mean. +.endlist . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "Adding new drivers or lookup types" "" &&& +.chapter "Adding new drivers or lookup types" "CHID13" &&& "Adding drivers or lookups" .cindex "adding drivers" -.cindex "new drivers" "adding" +.cindex "new drivers, adding" .cindex "drivers" "adding new" The following actions have to be taken in order to add a new router, transport, authenticator, or lookup type to Exim: @@ -32700,6 +36464,12 @@ Add to &_src/config.h.defaults_& the line: Edit &_src/drtables.c_&, adding conditional code to pull in the private header and create a table entry as is done for all the other drivers and lookup types. .next +Edit &_scripts/lookups-Makefile_& if this is a new lookup; there is a for-loop +near the bottom, ranging the &`name_mod`& variable over a list of all lookups. +Add your &`NEWDRIVER`& to that list. +As long as the dynamic module would be named &_newdriver.so_&, you can use the +simple form that most lookups have. +.next Edit &_Makefile_& in the appropriate sub-directory (&_src/routers_&, &_src/transports_&, &_src/auths_&, or &_src/lookups_&); add a line for the new driver or lookup type and add it to the definition of OBJ. @@ -32726,9 +36496,24 @@ the interface that is expected. . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.makeindex "Option index" "option" +. ///////////////////////////////////////////////////////////////////////////// +. These lines are processing instructions for the Simple DocBook Processor that +. Philip Hazel has developed as a less cumbersome way of making PostScript and +. PDFs than using xmlto and fop. They will be ignored by all other XML +. processors. +. ///////////////////////////////////////////////////////////////////////////// + +.literal xml + +.literal off -.makeindex "Concept index" "concept" +.makeindex "Options index" "option" +.makeindex "Variables index" "variable" +.makeindex "Concept index" "concept" . /////////////////////////////////////////////////////////////////////////////