X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/4783307727d83aee3cd8d746618dce5266188e0f..bebeeb502c5bbdd5e91e073a04dc84b6434d6566:/doc/doc-docbook/spec.xfpt diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index e3ac7f3b9..e48208899 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -45,14 +45,14 @@ . Update the Copyright year (only) when changing content. . ///////////////////////////////////////////////////////////////////////////// -.set previousversion "4.89" +.set previousversion "4.91" .include ./local_params .set ACL "access control lists (ACLs)" .set I "    " .macro copyyear -2017 +2018 .endmacro . ///////////////////////////////////////////////////////////////////////////// @@ -392,7 +392,7 @@ very wide interest. 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'& (second edition, 2007), published by UIT Cambridge -(&url(http://www.uit.co.uk/exim-book/)). +(&url(https://www.uit.co.uk/exim-book/)). This book also contains a chapter that gives a general introduction to SMTP and Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date @@ -448,26 +448,25 @@ available in other formats (HTML, PostScript, PDF, and Texinfo). Section .section "FTP and web sites" "SECID2" .cindex "web site" .cindex "FTP site" -The primary site for Exim source distributions is currently the University of -Cambridge's FTP site, whose contents are described in &'Where to find the Exim -distribution'& below. In addition, there is a web site and an FTP site at -&%exim.org%&. These are now also hosted at the University of Cambridge. The -&%exim.org%& site was previously hosted for a number of years by Energis -Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge. +The primary site for Exim source distributions is the &%exim.org%& FTP site, +available over HTTPS, HTTP and FTP. These services, and the &%exim.org%& +website, are hosted at the University of Cambridge. .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. A recent addition to the -online information is the Exim wiki (&url(http://wiki.exim.org)), +online information is the Exim wiki (&url(https://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. +The wiki site should always redirect to the correct place, which is currently +provided by GitHub, and is open to editing by anyone with a GitHub account. .cindex Bugzilla An Exim Bugzilla exists at &url(https://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. - +Please do not ask for configuration help in the bug-tracker. .section "Mailing lists" "SECID3" @@ -488,7 +487,7 @@ 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'& via this web page: .display -&url(http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users) +&url(https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exim4-users) .endd Please ask Debian-specific questions on this list and not on the general Exim lists. @@ -505,26 +504,41 @@ message to the &'exim-dev'& mailing list and have it discussed. .section "Where to find the Exim distribution" "SECTavail" .cindex "FTP site" +.cindex "HTTPS download site" .cindex "distribution" "ftp site" -The master ftp site for the Exim distribution is +.cindex "distribution" "https site" +The master distribution site for the Exim distribution is .display -&*ftp://ftp.exim.org/pub/exim*& +&url(https://downloads.exim.org/) .endd -The file references that follow are relative to the &_exim_& directories at -these sites. There are now quite a number of independent mirror sites around +The service is available over HTTPS, HTTP and FTP. +We encourage people to migrate to HTTPS. + +The content served at &url(https://downloads.exim.org/) is identical to the +content served at &url(https://ftp.exim.org/pub/exim) and +&url(ftp://ftp.exim.org/pub/exim). + +If accessing via a hostname containing &'ftp'&, then the file references that +follow are relative to the &_exim_& directories at these sites. +If accessing via the hostname &'downloads'& then the subdirectories described +here are top-level directories. + +There are now quite a number of independent mirror sites around the world. Those that I know about are listed in the file called &_Mirrors_&. -Within the &_exim_& directory there are subdirectories called &_exim3_& (for +Within the top exim directory there are subdirectories called &_exim3_& (for previous Exim 3 distributions), &_exim4_& (for the latest Exim 4 distributions), and &_Testing_& for testing versions. In the &_exim4_& subdirectory, the current release can always be found in files called .display +&_exim-n.nn.tar.xz_& &_exim-n.nn.tar.gz_& &_exim-n.nn.tar.bz2_& .endd -where &'n.nn'& is the highest such version number in the directory. The two +where &'n.nn'& is the highest such version number in the directory. The three files contain identical data; the only difference is the type of compression. -The &_.bz2_& file is usually a lot smaller than the &_.gz_& file. +The &_.xz_& file is usually the smallest, while the &_.gz_& file is the +most portable to old systems. .cindex "distribution" "signing details" .cindex "distribution" "public key" @@ -538,17 +552,14 @@ 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). - -Releases have also been authorized to be performed by Todd Lyons who signs with -key &'0xC4F4F94804D29EBA'&. A direct trust path exists between previous RE Phil -Pennock and Todd Lyons through a common associate. +At time of last update, releases were being made by Jeremy Harris and signed +with key &'0xBCE58C8CE41F32DF'&. Other recent keys used for signing are those +of Heiko Schlittermann, &'0x26101B62F69376CE'&, +and of Phil Pennock, &'0x4D1E900E14C1CC04'&. The signatures for the tar bundles are in: .display +&_exim-n.nn.tar.xz.asc_& &_exim-n.nn.tar.gz.asc_& &_exim-n.nn.tar.bz2.asc_& .endd @@ -567,7 +578,7 @@ inside the &_exim4_& directory of the FTP site: &_exim-texinfo-n.nn.tar.gz_& .endd These tar files contain only the &_doc_& directory, not the complete -distribution, and are also available in &_.bz2_& as well as &_.gz_& forms. +distribution, and are also available in &_.bz2_& and &_.xz_& forms. .section "Limitations" "SECID6" @@ -760,7 +771,7 @@ 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 +&url(https://cr.yp.to/cdb.html). This implementation borrows some code from Dan Bernstein's implementation (which has no license restrictions applied to it). .endblockquote @@ -814,7 +825,7 @@ Redistributions of any form whatsoever must retain the following acknowledgment: &"This product includes software developed by Computing Services -at Carnegie Mellon University (&url(http://www.cmu.edu/computing/)."& +at Carnegie Mellon University (&url(https://www.cmu.edu/computing/)."& CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY @@ -1353,6 +1364,7 @@ order in which they are tested. The individual configuration options are described in more detail in chapter &<>&. .ilist +.cindex affix "router precondition" The &%local_part_prefix%& and &%local_part_suffix%& options can specify that the local parts handled by the router may or must have certain prefixes and/or suffixes. If a mandatory affix (prefix or suffix) is not present, the router is @@ -1389,6 +1401,7 @@ of domains that it defines. .vindex "&$local_part_prefix$&" .vindex "&$local_part$&" .vindex "&$local_part_suffix$&" +.cindex affix "router precondition" 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 @@ -1685,7 +1698,7 @@ 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/). +More information on PCRE is available at &url(https://www.pcre.org/). .section "DBM libraries" "SECTdb" .cindex "DBM libraries" "discussion of" @@ -1738,14 +1751,18 @@ the traditional &'ndbm'& interface. .next To complicate things further, there are several very different versions of the Berkeley DB package. Version 1.85 was stable for a very long time, releases -2.&'x'& and 3.&'x'& were current for a while, but the latest versions are now -numbered 4.&'x'&. Maintenance of some of the earlier releases has ceased. All -versions of Berkeley DB can be obtained from -&url(http://www.sleepycat.com/). +2.&'x'& and 3.&'x'& were current for a while, but the latest versions when Exim last revamped support were numbered 4.&'x'&. +Maintenance of some of the earlier releases has ceased. All versions of +Berkeley DB could be obtained from +&url(http://www.sleepycat.com/), which is now a redirect to their new owner's +page with far newer versions listed. +It is probably wise to plan to move your storage configurations away from +Berkeley DB format, as today there are smaller and simpler alternatives more +suited to Exim's usage model. .next .cindex "&'tdb'& DBM library" Yet another DBM library, called &'tdb'&, is available from -&url(http://download.sourceforge.net/tdb). It has its own interface, and also +&url(https://sourceforge.net/projects/tdb/files/). It has its own interface, and also operates on a single file. .endlist @@ -1858,7 +1875,7 @@ supports the &[iconv()]& function. However, some of the operating systems that supply &[iconv()]& do not support very many conversions. The GNU &%libiconv%& library (available from -&url(http://www.gnu.org/software/libiconv/)) can be installed on such +&url(https://www.gnu.org/software/libiconv/)) can be installed on such systems to remedy this deficiency, as well as on systems that do not supply &[iconv()]& at all. After installing &%libiconv%&, you should add .code @@ -2791,12 +2808,10 @@ 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. -.new Macro processing is done on lines before string-expansion: new macros can be defined and macros will be expanded. Because macros in the config file are often used for secrets, those are only available to admin users. -.wen .vitem &%-bem%&&~<&'filename'&> .oindex "&%-bem%&" @@ -2887,12 +2902,14 @@ actually being delivered. .vitem &%-bfp%&&~<&'prefix'&> .oindex "&%-bfp%&" +.cindex affix "filter testing" This sets the prefix of the local part of the recipient address when a filter file is being tested by means of the &%-bf%& option. The default is an empty prefix. .vitem &%-bfs%&&~<&'suffix'&> .oindex "&%-bfs%&" +.cindex affix "filter testing" This sets the suffix of the local part of the recipient address when a filter file is being tested by means of the &%-bf%& option. The default is an empty suffix. @@ -2948,7 +2965,7 @@ 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). +&url(https://www.jetmore.org/john/code/swaks/,swaks). .vitem &%-bhc%&&~<&'IP&~address'&> .oindex "&%-bhc%&" @@ -3164,6 +3181,8 @@ 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. +For the "-bP macro " form, if no such macro is found +the exit status will be nonzero. .vitem &%-bp%& .oindex "&%-bp%&" @@ -3601,7 +3620,8 @@ are: &<>&) &`lookup `& general lookup code and all lookups &`memory `& memory handling -&`pid `& add pid to debug output lines +&`noutf8 `& modifier: avoid UTF-8 line-drawing +&`pid `& modifier: add pid to debug output lines &`process_info `& setting info for the process log &`queue_run `& queue runs &`receive `& general message reception logic @@ -3609,7 +3629,7 @@ are: &`retry `& retry handling &`rewrite `& address rewriting &`route `& address routing -&`timestamp `& add timestamp to debug output lines +&`timestamp `& modifier: add timestamp to debug output lines &`tls `& TLS logic &`transport `& transports &`uid `& changes of uid/gid and looking up uid/gid @@ -3641,6 +3661,15 @@ The &`timestamp`& selector causes the current time to be inserted at the start of all debug output lines. This can be useful when trying to track down delays in processing. +.new +.cindex debugging "UTF-8 in" +.cindex UTF-8 "in debug output" +The &`noutf8`& selector disables the use of +UTF-8 line-drawing characters to group related information. +When disabled. ascii-art is used instead. +Using the &`+all`& option does not set this modifier, +.wen + If the &%debug_print%& option is set in any driver, it produces output whenever any debugging is selected, or if &%-v%& is used. @@ -3836,7 +3865,7 @@ alternate queue is used, named by the following argument. .vitem &%-MCK%& .oindex "&%-MCK%&" This option is not intended for use by external callers. It is used internally -by Exim in conjunction with the &%-MC%& option. It signifies that an +by Exim in conjunction with the &%-MC%& option. It signifies that a remote host supports the ESMTP &_CHUNKING_& extension. .vitem &%-MCP%& @@ -3867,14 +3896,12 @@ This option is not intended for use by external callers. It is used internally by Exim in conjunction with the &%-MC%& option, and passes on the fact that the host to which Exim is connected supports TLS encryption. -.new .vitem &%-MCt%&&~<&'IP&~address'&>&~<&'port'&>&~<&'cipher'&> .oindex "&%-MCt%&" This option is not intended for use by external callers. It is used internally by Exim in conjunction with the &%-MC%& option, and passes on the fact that the connection is being proxied by a parent process for handling TLS encryption. The arguments give the local address and port being proxied, and the TLS cipher. -.wen .vitem &%-Mc%&&~<&'message&~id'&>&~<&'message&~id'&>&~... .oindex "&%-Mc%&" @@ -3957,8 +3984,17 @@ 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. +. .new +. .vitem &%-MS%& +. .oindex "&%-MS%&" +. .cindex REQUIRETLS +. This option is used to request REQUIRETLS processing on the message. +. It is used internally by Exim in conjunction with -E when generating +. a bounce message. +. .wen + .vitem &%-Mset%&&~<&'message&~id'&> -.oindex "&%-Mset%& +.oindex "&%-Mset%&" .cindex "testing" "string expansion" .cindex "expansion" "testing" This option is useful only in conjunction with &%-be%& (that is, when testing @@ -5058,6 +5094,7 @@ The following classes of macros are defined: &` _DRIVER_ROUTER_* `& router drivers &` _DRIVER_TRANSPORT_* `& transport drivers &` _DRIVER_AUTHENTICATOR_* `& authenticator drivers +&` _LOG_* `& log_selector values &` _OPT_MAIN_* `& main config options &` _OPT_ROUTERS_* `& generic router options &` _OPT_TRANSPORTS_* `& generic transport options @@ -5583,19 +5620,27 @@ Another two commented-out option settings follow: .cindex "port" "465 and 587" .cindex "port" "for message submission" .cindex "message" "submission, ports for" -.cindex "ssmtp protocol" +.cindex "submissions protocol" .cindex "smtps protocol" +.cindex "ssmtp protocol" +.cindex "SMTP" "submissions 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 -&<>&). +more in section &<>&). +Mail submission from mail clients (MUAs) should be separate from inbound mail +to your domain (MX delivery) for various good reasons (eg, ability to impose +much saner TLS protocol and ciphersuite requirements without unintended +consequences). +RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission, +which uses STARTTLS, so this is the &"submission"& port. +RFC 8314 specifies use of port 465 as the &"submissions"& protocol, +which should be used in preference to 587. +You should also consider deploying SRV records to help clients find +these ports. +Older names for &"submissions"& are &"smtps"& and &"ssmtp"&. Two more commented-out options settings follow: .code @@ -6308,6 +6353,9 @@ online Perl manpages, in many Perl reference books, and also in Jeffrey Friedl's &'Mastering Regular Expressions'&, which is published by O'Reilly (see &url(http://www.oreilly.com/catalog/regex2/)). +. --- the http: URL here redirects to another page with the ISBN in the URL +. --- where trying to use https: just redirects back to http:, so sticking +. --- to the old URL for now. 2018-09-07. The documentation for the syntax and semantics of the regular expressions that are supported by PCRE is included in the PCRE distribution, and no further @@ -6474,13 +6522,15 @@ The following single-key lookup types are implemented: 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 particularly suitable for large files containing -aliases or other indexed data referenced by an MTA. Information about cdb can -be found in several places: +aliases or other indexed data referenced by an MTA. Information about cdb and +tools for building the files can be found in several places: .display -&url(http://www.pobox.com/~djb/cdb.html) -&url(ftp://ftp.corpit.ru/pub/tinycdb/) -&url(http://packages.debian.org/stable/utils/freecdb.html) +&url(https://cr.yp.to/cdb.html) +&url(http://www.corpit.ru/mjt/tinycdb.html) +&url(https://packages.debian.org/stable/utils/freecdb) +&url(https://github.com/philpennock/cdbtools) (in Go) .endd +. --- 2018-09-07: corpit.ru http:-only A cdb distribution is not needed in order to build Exim with cdb support, because the code for reading cdb files is included directly in Exim itself. However, no means of building or testing cdb files is provided with Exim, so @@ -6761,6 +6811,7 @@ not likely to be useful in normal operation. .next .cindex "whoson lookup type" .cindex "lookup" "whoson" +. --- still http:-only, 2018-09-07 &(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 @@ -7831,6 +7882,17 @@ ${lookup redis{set keyname ${quote_redis:objvalue plus}}} ${lookup redis{get keyname}} .endd +As of release 4.91, "lightweight" support for Redis Cluster is available. +Requires &%redis_servers%& list to contain all the servers in the cluster, all +of which must be reachable from the running exim instance. If the cluster has +master/slave replication, the list must contain all the master and slave +servers. + +When the Redis Cluster returns a "MOVED" response to a query, Exim does not +immediately follow the redirection but treats the response as a DEFER, moving on +to the next server in the &%redis_servers%& list until the correct server is +reached. + .ecindex IIDfidalo1 .ecindex IIDfidalo2 @@ -9129,6 +9191,31 @@ the expansion result is an empty string. If the ACL returns defer the result is a forced-fail. Otherwise the expansion fails. +.vitem "&*${authresults{*&<&'authserv-id'&>&*}}*&" +.cindex authentication "results header" +.cindex headers "authentication-results:" +.cindex authentication "expansion item" +This item returns a string suitable for insertion as an +&'Authentication-Results"'& +header line. +The given <&'authserv-id'&> is included in the result; typically this +will be a domain name identifying the system performing the authentications. +Methods that might be present in the result include: +.code +none +iprev +auth +spf +dkim +.endd + +Example use (as an ACL modifier): +.code + add_header = :at_start:${authresults {$primary_hostname}} +.endd +This is safe even if no authentication results are available. + + .vitem "&*${certextract{*&<&'field'&>&*}{*&<&'certificate'&>&*}&&& {*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" .cindex "expansion" "extracting certificate fields" @@ -9297,6 +9384,27 @@ ${extract{Z}{A=... B=...}{$value} fail } This forces an expansion failure (see section &<>&); {<&'string2'&>} must be present for &"fail"& to be recognized. +.new +.vitem "&*${extract json{*&<&'key'&>&*}{*&<&'string1'&>&*}{*&<&'string2'&>&*}&&& + {*&<&'string3'&>&*}}*&" +.cindex "expansion" "extracting from JSON object" +.cindex JSON expansions +The key and <&'string1'&> are first expanded separately. Leading and trailing +white space is removed from the key (but not from any of the strings). The key +must not be empty and must not consist entirely of digits. +The expanded <&'string1'&> must be of the form: +.display +{ <&'"key1"'&> : <&'value1'&> , <&'"key2"'&> , <&'value2'&> ... } +.endd +.vindex "&$value$&" +The braces, commas and colons, and the quoting of the member name are required; +the spaces are optional. +Matching of the key against the member names is done case-sensitively. +. XXX should be a UTF-8 compare + +The results of matching are handled as above. +.wen + .vitem "&*${extract{*&<&'number'&>&*}{*&<&'separators'&>&*}&&& {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" @@ -9329,6 +9437,19 @@ yields &"99"&. Two successive separators mean that the field between them is empty (for example, the fifth field above). +.new +.vitem "&*${extract json{*&<&'number'&>&*}}&&& + {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" +.cindex "expansion" "extracting from JSON array" +.cindex JSON expansions +The <&'number'&> argument must consist entirely of decimal digits, +apart from leading and trailing white space, which is ignored. + +Field selection and result handling is as above; +there is no choice of field separator. +.wen + + .vitem &*${filter{*&<&'string'&>&*}{*&<&'condition'&>&*}}*& .cindex "list" "selecting by condition" .cindex "expansion" "selecting from list by condition" @@ -9341,7 +9462,7 @@ 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}} +${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. @@ -9381,11 +9502,14 @@ letters appear. For example: &*$h_*&<&'header&~name'&>&*:*&" &&& "&*$bheader_*&<&'header&~name'&>&*:*&&~or&~&&& &*$bh_*&<&'header&~name'&>&*:*&" &&& + "&*$lheader_*&<&'header&~name'&>&*:*&&~or&~&&& + &*$lh_*&<&'header&~name'&>&*:*&" "&*$rheader_*&<&'header&~name'&>&*:*&&~or&~&&& &*$rh_*&<&'header&~name'&>&*:*&" .cindex "expansion" "header insertion" .vindex "&$header_$&" .vindex "&$bheader_$&" +.vindex "&$lheader_$&" .vindex "&$rheader_$&" .cindex "header lines" "in expansion strings" .cindex "header lines" "character sets" @@ -9398,7 +9522,7 @@ The newline that terminates a header line is not included in the expansion, but internal newlines (caused by splitting the header line over several physical lines) may be present. -The difference between &%rheader%&, &%bheader%&, and &%header%& is in the way +The difference between the four pairs of expansions is in the way the data in the header line is interpreted. .ilist @@ -9406,6 +9530,15 @@ the data in the header line is interpreted. &%rheader%& gives the original &"raw"& content of the header line, with no processing at all, and without the removal of leading and trailing white space. +.next +.cindex "list" "of header lines" +&%lheader%& gives a colon-separated list, one element per header when there +are multiple headers with a given name. +Any embedded colon characters within an element are doubled, so normal Exim +list-processing facilities can be used. +The terminating newline of each element is removed; in other respects +the content is &"raw"&. + .next .cindex "base64 encoding" "in header lines" &%bheader%& removes leading and trailing white space, and then decodes base64 @@ -9563,9 +9696,10 @@ some of the braces: .code ${length_:} .endd -The result of this item is either the first <&'n'&> characters or the whole +The result of this item is either the first <&'n'&> bytes or the whole of <&'string2'&>, whichever is the shorter. Do not confuse &%length%& with &%strlen%&, which gives the length of a string. +All measurement is done in bytes and is not UTF-8 aware. .vitem "&*${listextract{*&<&'number'&>&*}&&& @@ -9813,15 +9947,26 @@ extend what can be done. Firstly, you can vary the timeout. For example: .code ${readsocket{/socket/name}{request string}{3s}} .endd + The third argument is a list of options, of which the first element is the timeout and must be present if the argument is given. Further elements are options of form &'name=value'&. -One option type is currently recognised, defining whether (the default) +Two option types is currently recognised: shutdown and tls. +The first defines whether (the default) or not a shutdown is done on the connection after sending the request. Example, to not do so (preferred, eg. by some webservers): .code ${readsocket{/socket/name}{request string}{3s:shutdown=no}} .endd +.new +The second, tls, controls the use of TLS on the connection. Example: +.code +${readsocket{/socket/name}{request string}{3s:tls=yes}} +.endd +The default is to not use TLS. +If it is enabled, a shutdown as descripbed above is never done. +.wen + 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: @@ -9887,7 +10032,7 @@ 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. +expansion item in section &<>& above. .vitem "&*${run{*&<&'command'&>&*&~*&<&'args'&>&*}{*&<&'string1'&>&*}&&& {*&<&'string2'&>&*}}*&" @@ -9986,6 +10131,8 @@ ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}} yields &"K1=A K4=D K3=C"&. Note the use of &`\N`& to protect the contents of the regular expression from string expansion. +The regular expression is compiled in 8-bit mode, working against bytes +rather than any Unicode-aware character handling. .vitem &*${sort{*&<&'string'&>&*}{*&<&'comparator'&>&*}{*&<&'extractor'&>&*}}*& @@ -10042,11 +10189,11 @@ ${substr{3}{2}{$local_part}} If the starting offset is greater than the string length the result is the null string; if the length plus starting offset is greater than the string length, the result is the right-hand part of the string, starting from the -given offset. The first character in the string has offset zero. +given offset. The first byte (character) in the string has offset zero. The &%substr%& expansion item can take negative offset values to count -from the right-hand end of its operand. The last character is offset -1, the -second-last is offset -2, and so on. Thus, for example, +from the right-hand end of its operand. The last byte (character) is offset -1, +the second-last is offset -2, and so on. Thus, for example, .code ${substr{-5}{2}{1234567}} .endd @@ -10063,7 +10210,7 @@ ${substr{-3}{2}{12}} yields &"1"&. When the second number is omitted from &%substr%&, the remainder of the string -is taken if the offset is positive. If it is negative, all characters in the +is taken if the offset is positive. If it is negative, all bytes (characters) in the string preceding the offset point are taken. For example, an offset of -1 and no length, as in these semantically identical examples: .code @@ -10072,13 +10219,15 @@ ${substr{-1}{abcde}} .endd yields all but the last character of the string, that is, &"abcd"&. +All measurement is done in bytes and is not UTF-8 aware. + .vitem "&*${tr{*&<&'subject'&>&*}{*&<&'characters'&>&*}&&& {*&<&'replacements'&>&*}}*&" .cindex "expansion" "character translation" .cindex "&%tr%& expansion item" -This item does single-character translation on its subject string. The second +This item does single-character (in bytes) translation on its subject string. The second argument is a list of characters to be translated in the subject string. Each matching character is replaced by the corresponding character from the replacement list. For example @@ -10089,6 +10238,9 @@ yields &`1b3de1`&. If there are duplicates in the second character string, the last occurrence is used. If the third string is shorter than the second, its last character is replicated. However, if it is empty, no translation takes place. + +All character handling is done in bytes and is not UTF-8 aware. + .endlist @@ -10108,6 +10260,8 @@ 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. +The parsing correctly handles SMTPUTF8 Unicode in the string. + .vitem &*${addresses:*&<&'string'&>&*}*& .cindex "expansion" "RFC 2822 address handling" @@ -10151,7 +10305,7 @@ It does not see the comma because it's still encoded as "=2C". The second example below is passed the contents of &`$header_from:`&, meaning it gets de-mimed. Exim sees the decoded "," so it treats it as &*two*& email addresses. The third example shows that the presence of a comma is skipped when it is -quoted. +quoted. The fourth example shows SMTPUTF8 handling. .code # exim -be '${addresses:From: \ =?iso-8859-2?Q?Last=2C_First?= }' @@ -10160,6 +10314,8 @@ user@example.com Last:user@example.com # exim -be '${addresses:From: "Last, First" }' user@example.com +# exim -be '${addresses:フィル <フィリップ@example.jp>}' +フィリップ@example.jp .endd .vitem &*${base32:*&<&'digits'&>&*}*& @@ -10349,7 +10505,7 @@ abbreviation &%h%& can be used when &%hash%& is used as an operator. .cindex "expansion" "hex to base64" .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. +be useful for processing the output of the various hashing functions. @@ -10391,6 +10547,7 @@ This forces the letters in the string into lower-case, for example: .code ${lc:$local_part} .endd +Case is defined per the system C locale. .vitem &*${length_*&<&'number'&>&*:*&<&'string'&>&*}*& .cindex "expansion" "string truncation" @@ -10404,6 +10561,7 @@ ${length{}{}} See the description of the general &%length%& item above for details. Note that &%length%& is not the same as &%strlen%&. The abbreviation &%l%& can be used when &%length%& is used as an operator. +All measurement is done in bytes and is not UTF-8 aware. .vitem &*${listcount:*&<&'string'&>&*}*& @@ -10431,6 +10589,7 @@ matching list is returned. The string is interpreted as an RFC 2822 address and the local part is extracted from it. If the string does not parse successfully, the result is empty. +The parsing correctly handles SMTPUTF8 Unicode in the string. .vitem &*${mask:*&<&'IP&~address'&>&*/*&<&'bit&~count'&>&*}*& @@ -10513,6 +10672,10 @@ example, a plus sign would not cause quoting (but it would for &%quote%&). If you are creating a new email address from the contents of &$local_part$& (or any other unknown data), you should always use this operator. +This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data +will likely use the quoting form. +Thus &'${quote_local_part:フィル}'& will always become &'"フィル"'&. + .vitem &*${quote_*&<&'lookup-type'&>&*:*&<&'string'&>&*}*& .cindex "quoting" "lookup-specific" @@ -10641,7 +10804,9 @@ the output length. Values of 224, 256, 384 and 512 are accepted; with 256 being the default. The &%sha3%& expansion item is only supported if Exim has been -compiled with GnuTLS 3.5.0 or later. +compiled with GnuTLS 3.5.0 or later, +or OpenSSL 1.1.1 or later. +The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported. .vitem &*${stat:*&<&'string'&>&*}*& @@ -10674,6 +10839,7 @@ Now deprecated, a synonym for the &%base64%& expansion operator. .cindex "&%strlen%& expansion item" The item is replace by the length of the expanded string, expressed as a decimal number. &*Note*&: Do not confuse &%strlen%& with &%length%&. +All measurement is done in bytes and is not UTF-8 aware. .vitem &*${substr_*&<&'start'&>&*_*&<&'length'&>&*:*&<&'string'&>&*}*& @@ -10688,6 +10854,7 @@ ${substr{}{}{}} .endd See the description of the general &%substr%& item above for details. The abbreviation &%s%& can be used when &%substr%& is used as an operator. +All measurement is done in bytes and is not UTF-8 aware. .vitem &*${time_eval:*&<&'string'&>&*}*& .cindex "&%time_eval%& expansion item" @@ -10710,6 +10877,7 @@ number of larger units and output in Exim's normal time format, for example, .cindex "expansion" "case forcing" .cindex "&%uc%& expansion item" This forces the letters in the string into upper-case. +Case is defined per the system C locale. .vitem &*${utf8clean:*&<&'string'&>&*}*& .cindex "correction of invalid utf-8 sequences in strings" @@ -10718,6 +10886,20 @@ This forces the letters in the string into upper-case. .cindex "expansion" "utf-8 forcing" .cindex "&%utf8clean%& expansion item" This replaces any invalid utf-8 sequence in the string by the character &`?`&. +.new +In versions of Exim before 4.92, this did not correctly do so for a truncated +final codepoint's encoding, and the character would be silently dropped. +If you must handle detection of this scenario across both sets of Exim behavior, +the complexity will depend upon the task. +For instance, to detect if the first character is multibyte and a 1-byte +extraction can be successfully used as a path component (as is common for +dividing up delivery folders), you might use: +.code +condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}} +.endd +(which will false-positive if the first character of the local part is a +literal question mark). +.wen .vitem "&*${utf8_domain_to_alabel:*&<&'string'&>&*}*&" &&& "&*${utf8_domain_from_alabel:*&<&'string'&>&*}*&" &&& @@ -10940,7 +11122,8 @@ the header name must be terminated by a colon if white space does not follow. .cindex "&%eqi%& expansion condition" The two substrings are first expanded. The condition is true if the two resulting strings are identical. For &%eq%& the comparison includes the case of -letters, whereas for &%eqi%& the comparison is case-independent. +letters, whereas for &%eqi%& the comparison is case-independent, where +case is defined per the system C locale. .vitem &*exists&~{*&<&'file&~name'&>&*}*& .cindex "expansion" "file existence test" @@ -11003,6 +11186,7 @@ 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 comparison includes the case of letters, whereas for &%gei%& the comparison is case-independent. +Case and collation order are defined per the system C locale. .vitem &*gt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& &*gti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& @@ -11014,6 +11198,7 @@ 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 includes the case of letters, whereas for &%gti%& the comparison is case-independent. +Case and collation order are defined per the system C locale. .vitem &*inlist&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& &*inlisti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& @@ -11022,6 +11207,7 @@ case-independent. 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. +For the case-independent &%inlisti%& condition, case is defined per the system C locale. These are simpler to use versions of the more powerful &*forany*& condition. Examples, and the &*forany*& equivalents: @@ -11050,12 +11236,10 @@ 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. -.new &*Note*&: The checks used to be just on the form of the address; actual numerical values were not considered. Thus, for example, 999.999.999.999 passed the IPv4 check. This is no longer the case. -.wen 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 @@ -11090,6 +11274,7 @@ 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 comparison includes the case of letters, whereas for &%lei%& the comparison is case-independent. +Case and collation order are defined per the system C locale. .vitem &*lt&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& &*lti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& @@ -11101,6 +11286,7 @@ 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 includes the case of letters, whereas for &%lti%& the comparison is case-independent. +Case and collation order are defined per the system C locale. .vitem &*match&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& @@ -11127,6 +11313,8 @@ metacharacter, but if there is no circumflex, the expression is not anchored, and it may match anywhere in the subject, not just at the start. If you want the pattern to match at the end of the subject, you must include the &`$`& metacharacter at an appropriate point. +All character handling is done in bytes and is not UTF-8 aware, +but we might change this in a future Exim release. .cindex "numerical variables (&$1$& &$2$& etc)" "in &%if%& expansion" At the start of an &%if%& expansion the values of the numeric variable @@ -11241,7 +11429,7 @@ matched using &%match_ip%&. .cindex "expansion" "PAM authentication test" .cindex "&%pam%& expansion condition" &'Pluggable Authentication Modules'& -(&url(http://www.kernel.org/pub/linux/libs/pam/)) are a facility that is +(&url(https://mirrors.edge.kernel.org/pub/linux/libs/pam/)) are a facility that is available in the latest releases of Solaris and in some GNU/Linux distributions. The Exim support, which is intended for use in conjunction with the SMTP AUTH command, is available only if Exim is compiled with @@ -11274,11 +11462,7 @@ server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}} 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 messages, this means that PAM cannot be used directly in those systems. -A patched version of the &'pam_unix'& module that comes with the -Linux PAM package is available from &url(http://www.e-admin.de/pam_exim/). -The patched module allows one special uid/gid combination, in addition to root, -to authenticate. If you build the patched module to allow the Exim user and -group, PAM can then be used from an Exim authenticator. +. --- 2018-09-07: the pam_exim modified variant has gone, removed claims re using Exim via that .vitem &*pwcheck&~{*&<&'string1'&>&*:*&<&'string2'&>&*}*& @@ -11545,10 +11729,13 @@ preserve some of the authentication information in the variable 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 normally the login name of the calling process. However, a trusted user can override this by means of the &%-oMai%& command line option. +This second case also sets up information used by the +&$authresults$& expansion item. .vitem &$authenticated_fail_id$& .cindex "authentication" "fail" "id" @@ -11665,9 +11852,9 @@ contain the trailing slash. If &$config_file$& does not contain a slash, .vindex "&$config_file$&" The name of the main configuration file Exim is using. -.vitem &$dkim_verify_status$& &&& +.vitem &$dkim_verify_status$& Results of DKIM verification. -For details see chapter &<>&. +For details see section &<>&. .vitem &$dkim_cur_signer$& &&& &$dkim_verify_reason$& &&& @@ -11689,13 +11876,13 @@ For details see chapter &<>&. &$dkim_key_notes$& &&& &$dkim_key_length$& These variables are only available within the DKIM ACL. -For details see chapter &<>&. +For details see section &<>&. .vitem &$dkim_signers$& .vindex &$dkim_signers$& When a message has been received this variable contains a colon-separated list of signer domains and identities for the message. -For details see chapter &<>&. +For details see section &<>&. .vitem &$dnslist_domain$& &&& &$dnslist_matched$& &&& @@ -11804,6 +11991,7 @@ This is not strictly an expansion variable. It is expansion syntax for 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. +See the full description in section &<>& above. .vitem &$headers_added$& .vindex "&$headers_added$&" @@ -11888,6 +12076,11 @@ lookup succeeds, but there is a lookup problem such as a timeout when checking the result, the name is not accepted, and &$host_lookup_deferred$& is set to &"1"&. See also &$sender_host_name$&. +.cindex authentication "expansion item" +Performing these checks sets up information used by the +&$authresults$& expansion item. + + .vitem &$host_lookup_failed$& .vindex "&$host_lookup_failed$&" See &$host_lookup_deferred$&. @@ -11953,6 +12146,7 @@ once. .vindex "&$local_part_prefix$&" .vindex "&$local_part_suffix$&" +.cindex affix variables 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 @@ -12005,6 +12199,7 @@ variable expands to nothing. .vitem &$local_part_prefix$& .vindex "&$local_part_prefix$&" +.cindex affix variables 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$&. @@ -12089,9 +12284,7 @@ when the ACL &%malware%& condition is true (see section &<>&). 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). -.new It is not valid if the &%spool_files_wireformat%& option is used. -.wen .vitem &$message_age$& .cindex "message" "age of" @@ -12134,11 +12327,9 @@ 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$&. -.new If the spool file is wireformat (see the &%spool_files_wireformat%& main option) the CRLF line-terminators are included in the count. -.wen .vitem &$message_exim_id$& .vindex "&$message_exim_id$&" @@ -12190,9 +12381,7 @@ deny message = Too many lines in message header In the MAIL and RCPT ACLs, the value is zero because at that stage the message has not yet been received. -.new This variable is not valid if the &%spool_files_wireformat%& option is used. -.wen .vitem &$message_size$& .cindex "size" "of message" @@ -12814,14 +13003,12 @@ 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. -.new .vitem &$smtp_command_history$& .cindex SMTP "command history" .vindex "&$smtp_command_history$&" A comma-separated list (with no whitespace) of the most-recent SMTP commands received, in time-order left to right. Only a limited number of commands are remembered. -.wen .vitem &$smtp_count_at_connection_start$& .vindex "&$smtp_count_at_connection_start$&" @@ -12847,6 +13034,13 @@ A number of variables whose names start with &$spam$& are available when Exim is compiled with the content-scanning extension. For details, see section &<>&. +.vitem &$spf_header_comment$& &&& + &$spf_received$& &&& + &$spf_result$& &&& + &$spf_result_guessed$& &&& + &$spf_smtp_comment$& +These variables are only available if Exim is built with SPF support. +For details see section &<>&. .vitem &$spool_directory$& .vindex "&$spool_directory$&" @@ -12909,10 +13103,9 @@ It is only useful as the argument of a &%certextract%& expansion item, &%md5%&, &%sha1%& or &%sha256%& operator, or a &%def%& condition. -.new -&*Note*&: Under current versions of OpenSSL, when a list of more than one +&*Note*&: Under versions of OpenSSL preceding 1.1.1, +when a list of more than one file is used for &%tls_certificate%&, this variable is not reliable. -.wen .vitem &$tls_in_peercert$& .vindex "&$tls_in_peercert$&" @@ -12977,6 +13170,10 @@ 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_out_dane$& +.vindex &$tls_out_dane$& +DANE active status. See section &<>&. + .vitem &$tls_in_ocsp$& .vindex "&$tls_in_ocsp$&" When a message is received from a remote client connection @@ -13042,6 +13239,10 @@ During outbound SMTP deliveries, this variable reflects the value of the &%tls_sni%& option on the transport. +.vitem &$tls_out_tlsa_usage$& +.vindex &$tls_out_tlsa_usage$& +Bitfield of TLSA record types found. See section &<>&. + .vitem &$tod_bsdinbox$& .vindex "&$tod_bsdinbox$&" The time of day and the date, in the format required for BSD-style mailbox @@ -13416,23 +13617,32 @@ value of &%daemon_smtp_ports%& is no longer relevant in this example.) -.section "Support for the obsolete SSMTP (or SMTPS) protocol" "SECTsupobssmt" +.section "Support for the submissions (aka SSMTP or SMTPS) protocol" "SECTsupobssmt" +.cindex "submissions protocol" .cindex "ssmtp protocol" .cindex "smtps protocol" .cindex "SMTP" "ssmtp protocol" .cindex "SMTP" "smtps protocol" -Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used -before the STARTTLS command was standardized for SMTP. Some legacy clients -still use this protocol. If the &%tls_on_connect_ports%& option is set to a -list of port numbers or service names, -connections to those ports must use SSMTP. The most -common use of this option is expected to be +Exim supports the use of TLS-on-connect, used by mail clients in the +&"submissions"& protocol, historically also known as SMTPS or SSMTP. +For some years, IETF Standards Track documents only blessed the +STARTTLS-based Submission service (port 587) while common practice was to support +the same feature set on port 465, but using TLS-on-connect. +If your installation needs to provide service to mail clients +(Mail User Agents, MUAs) then you should provide service on both the 587 and +the 465 TCP ports. + +If the &%tls_on_connect_ports%& option is set to a list of port numbers or +service names, connections to those ports must first establish TLS, before +proceeding to the application layer use of the SMTP protocol. + +The common use of this option is expected to be .code tls_on_connect_ports = 465 .endd -because 465 is the usual port number used by the legacy clients. There is also -a command line option &%-tls-on-connect%&, which forces all ports to behave in -this way when a daemon is started. +per RFC 8314. +There is also a command line option &%-tls-on-connect%&, which forces all ports +to behave in this way when a daemon is started. &*Warning*&: Setting &%tls_on_connect_ports%& does not of itself cause the daemon to listen on those ports. You must still specify them in @@ -13785,6 +13995,7 @@ listed in more than one group. .row &%av_scanner%& "specify virus scanner" .row &%check_rfc2047_length%& "check length of RFC 2047 &""encoded &&& words""&" +.row &%dns_cname_loops%& "follow CNAMEs returned by resolver" .row &%dns_csa_search_limit%& "control CSA parent search depth" .row &%dns_csa_use_reverse%& "en/disable CSA IP reverse search" .row &%header_maxsize%& "total size of message header" @@ -14043,7 +14254,7 @@ 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) +&url(https://cr.yp.to/smtp/8bitmime.html) .endd To log received 8BITMIME status use @@ -14102,7 +14313,7 @@ acknowledgment is sent. See chapter &<>& for further details. This option defines the ACL that is run for each DKIM signature (by default, or as specified in the dkim_verify_signers option) of a received message. -See chapter &<>& for further details. +See section &<>& for further details. .option acl_smtp_etrn main string&!! unset .cindex "ETRN" "ACL for" @@ -14498,13 +14709,11 @@ The CHUNKING extension (RFC3030) will be advertised in the EHLO message to these hosts. Hosts may use the BDAT command as an alternate to DATA. -.new .option commandline_checks_require_admin main boolean &`false`& .cindex "restricting access to features" This option restricts various basic checking features to require an administrative user. This affects most of the &%-b*%& options, such as &%-be%&. -.wen .option debug_store main boolean &`false`& .cindex debugging "memory corruption" @@ -14637,7 +14846,7 @@ to handle IPv6 literal addresses. This option gives a list of DKIM domains for which the DKIM ACL is run. It is expanded after the message is received; by default it runs the ACL once for each signature in the message. -See chapter &<>&. +See section &<>&. .option dns_again_means_nonexist main "domain list&!!" unset @@ -14689,6 +14898,19 @@ This option controls whether or not an IP address, given as a CSA domain, is reversed and looked up in the reverse DNS, as described in more detail in section &<>&. +.new +.option dns_cname_loops main integer 1 +.cindex DNS "CNAME following" +This option controls the following of CNAME chains, needed if the resolver does +not do it internally. +As of 2018 most should, and the default can be left. +If you have an ancient one, a value of 10 is likely needed. + +The default value of one CNAME-follow is needed +thanks to the observed return for an MX request, +given no MX presence but a CNAME to an A, of the CNAME. +.wen + .option dns_dnssec_ok main integer -1 .cindex "DNS" "resolver options" @@ -14703,6 +14925,7 @@ If the resolver library does not support DNSSEC then this option has no effect. .option dns_ipv4_lookup main "domain list&!!" unset .cindex "IPv6" "DNS lookup for AAAA records" .cindex "DNS" "IPv6 lookup for AAAA records" +.cindex DNS "IPv6 disabling" When Exim is compiled with IPv6 support and &%disable_ipv6%& is not set, it looks for IPv6 address records (AAAA records) as well as IPv4 address records (A records) when trying to find IP addresses for hosts, unless the host's @@ -15007,12 +15230,12 @@ server. This reduces security slightly, but improves interworking with older implementations of TLS. -option gnutls_allow_auto_pkcs11 main boolean unset +.option gnutls_allow_auto_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.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs) +&url(https://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs) for documentation. @@ -16822,17 +17045,19 @@ response to EHLO only to those client hosts that match this option. See chapter &<>& for details of Exim's support for internationalisation. -.option spamd_address main string "see below" +.option spamd_address main string "127.0.0.1 783" This option is available when Exim is compiled with the content-scanning extension. It specifies how Exim connects to SpamAssassin's &%spamd%& daemon. -The default value is -.code -127.0.0.1 783 -.endd See section &<>& for more details. +.option spf_guess main string "v=spf1 a/24 mx/24 ptr ?all" +This option is available when Exim is compiled with SPF support. +See section &<>& for more details. + + + .option split_spool_directory main boolean false .cindex "multiple spool directories" .cindex "spool directory" "split" @@ -16883,13 +17108,12 @@ as failures in the configuration file. By using this option to override the compiled-in path, it is possible to run tests of Exim without using the standard spool. -.new .option spool_wireformat main boolean false .cindex "spool directory" "file formats" -If this option is set, Exim may for some messages use an alternate format +If this option is set, Exim may for some messages use an alternative format for data-files in the spool which matches the wire format. Doing this permits more efficient message reception and transmission. -Currently it is only done for messages received using the EMSTP CHUNKING +Currently it is only done for messages received using the ESMTP CHUNKING option. The following variables will not have useful values: @@ -16902,12 +17126,11 @@ $body_zerocount Users of the local_scan() API (see &<>&), and any external programs which are passed a reference to a message data file (except via the &"regex"&, &"malware"& or &"spam"&) ACL conditions) -will need to be aware of the potential different format. +will need to be aware of the different formats potentially available. Using any of the ACL conditions noted will negate the reception benefit -(as a Unix-mbox-format file is contructed for them). -The transimssion benefit is maintained. -.wen +(as a Unix-mbox-format file is constructed for them). +The transmission benefit is maintained. .option sqlite_lock_timeout main time 5s .cindex "sqlite lookup type" "lock timeout" @@ -17118,11 +17341,9 @@ is not required the &%tls_advertise_hosts%& option should be set empty. .option tls_certificate main string list&!! unset .cindex "TLS" "server certificate; location of" .cindex "certificate" "server, location of" -.new The value of this option is expanded, and must then be a list of absolute paths to files which contains the server's certificates. Commonly only one file is needed. -.wen The server's private key is also assumed to be in this file if &%tls_privatekey%& is unset. See chapter &<>& for further details. @@ -17132,13 +17353,15 @@ 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. -.new &*Note*&: If you use filenames based on IP addresses, change the list separator in the usual way to avoid confusion under IPv6. -&*Note*&: Under current versions of OpenSSL, when a list of more than one -file is used, the &$tls_in_ourcert$& veriable is unreliable. -.wen +&*Note*&: Under versions of OpenSSL preceding 1.1.1, +when a list of more than one +file is used, the &$tls_in_ourcert$& variable is unreliable. + +&*Note*&: OCSP stapling is not usable under OpenSSL +when a list of more than one file is used. 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 @@ -17152,7 +17375,13 @@ generated for every connection. .cindex "TLS" "server certificate revocation list" .cindex "certificate" "revocation list for server" This option specifies a certificate revocation list. The expanded value must -be the name of a file that contains a CRL in PEM format. +be the name of a file that contains CRLs in PEM format. + +Under OpenSSL the option can specify a directory with CRL files. + +&*Note:*& Under OpenSSL the option must, if given, supply a CRL +for each signing element of the certificate chain (i.e. all but the leaf). +For the file variant this can be multiple PEM blocks in the one file. See &<>& for discussion of when this option might be re-expanded. @@ -17279,12 +17508,16 @@ Certificate Authority. Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later). +For GnuTLS 3.5.6 or later the expanded value of this option can be a list +of files, to match a list given for the &%tls_certificate%& option. +The ordering of the two lists must match. + .option tls_on_connect_ports main "string list" unset .cindex SSMTP .cindex SMTPS This option specifies a list of incoming SSMTP (aka SMTPS) ports that should -operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately +operate the SSMTP (SMTPS) protocol, where a TLS session is immediately set up without waiting for the client to issue a STARTTLS command. For further details, see section &<>&. @@ -17292,10 +17525,8 @@ further details, see section &<>&. .option tls_privatekey main string list&!! unset .cindex "TLS" "server private key; location of" -.new The value of this option is expanded, and must then be a list of absolute paths to files which contains the server's private keys. -.wen If this option is unset, or if 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 @@ -18084,6 +18315,7 @@ and &%user%& and the discussion in chapter &<>&. .option local_part_prefix routers&!? "string list" unset +.cindex affix "router precondition" .cindex "router" "prefix for local part" .cindex "prefix" "for local part, used in router" If this option is set, the router is skipped unless the local part starts with @@ -18742,7 +18974,7 @@ records. MX records of equal priority are sorted by Exim into a random order. Exim then looks for address records for the host names obtained from MX or SRV records. When a host has more than one IP address, they are sorted into a random order, -except that IPv6 addresses are always sorted before IPv4 addresses. If all the +except that IPv6 addresses are sorted before IPv4 addresses. If all the IP addresses found are discarded by a setting of the &%ignore_target_hosts%& generic option, the router declines. @@ -18875,6 +19107,22 @@ However, it will result in any message with mistyped domains also being queued. +.option ipv4_only "string&!!" unset +.cindex IPv6 disabling +.cindex DNS "IPv6 disabling" +The string is expanded, and if the result is anything but a forced failure, +or an empty string, or one of the strings “0” or “no” or “false” +(checked without regard to the case of the letters), +only A records are used. + +.option ipv4_prefer "string&!!" unset +.cindex IPv4 preference +.cindex DNS "IPv4 preference" +The string is expanded, and if the result is anything but a forced failure, +or an empty string, or one of the strings “0” or “no” or “false” +(checked without regard to the case of the letters), +A records are sorted before AAAA records (inverting the default). + .option mx_domains dnslookup "domain list&!!" unset .cindex "MX record" "required to exist" .cindex "SRV record" "required to exist" @@ -19362,7 +19610,9 @@ be enclosed in quotes if it contains white space. 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 -and/or IP addresses, optionally also including ports. The format of each item +and/or IP addresses, optionally also including ports. +If the list is written with spaces, it must be protected with quotes. +The format of each item in the list is described in the next section. The list separator can be changed as described in section &<>&. @@ -19479,8 +19729,8 @@ whether obtained from an MX lookup or not. .section "How the options are used" "SECThowoptused" -The options are a sequence of words; in practice no more than three are ever -present. One of the words can be the name of a transport; this overrides the +The options are a sequence of words, space-separated. +One of the words can be the name of a transport; this overrides the &%transport%& option on the router for this particular routing rule only. The other words (if present) control randomization of the list of hosts on a per-rule basis, and how the IP addresses of the hosts are to be found when @@ -19500,6 +19750,10 @@ also look in &_/etc/hosts_& or other sources of information. &%bydns%&: look up address records for the hosts directly in the DNS; fail if no address records are found. If there is a temporary DNS error (such as a timeout), delivery is deferred. +.next +&%ipv4_only%&: in direct DNS lookups, look up only A records. +.next +&%ipv4_prefer%&: in direct DNS lookups, sort A records before AAAA records. .endlist For example: @@ -23825,24 +24079,43 @@ For testing purposes, this value can be overridden by the &%-oB%& command line option. +.option dane_require_tls_ciphers smtp string&!! unset +.cindex "TLS" "requiring specific ciphers for DANE" +.cindex "cipher" "requiring specific" +.cindex DANE "TLS ciphers" +This option may be used to override &%tls_require_ciphers%& for connections +where DANE has been determined to be in effect. +If not set, then &%tls_require_ciphers%& will be used. +Normal SMTP delivery is not able to make strong demands of TLS cipher +configuration, because delivery will fall back to plaintext. Once DANE has +been determined to be in effect, there is no plaintext fallback and making the +TLS cipherlist configuration stronger will increase security, rather than +counter-intuitively decreasing it. +If the option expands to be empty or is forced to fail, then it will +be treated as unset and &%tls_require_ciphers%& will be used instead. + + .option data_timeout smtp time 5m This sets a timeout for the transmission of each block in the data portion of the message. As a result, the overall timeout for a message depends on the size of the message. Its value must not be zero. See also &%final_timeout%&. +.option dkim_canon smtp string&!! unset .option dkim_domain smtp string list&!! unset -.option dkim_selector smtp string&!! unset +.option dkim_hash smtp string&!! sha256 +.option dkim_identity smtp string&!! unset .option dkim_private_key smtp string&!! unset -.option dkim_canon smtp string&!! unset +.option dkim_selector smtp string&!! unset .option dkim_strict smtp string&!! unset .option dkim_sign_headers smtp string&!! "per RFC" -.option dkim_hash smtp string&!! sha256 -.option dkim_identity smtp string&!! unset +.option dkim_timestamps smtp string&!! unset DKIM signing options. For details see section &<>&. .option delay_after_cutoff smtp boolean true +.cindex "final cutoff" "retries, controlling" +.cindex retry "final cutoff" This option controls what happens when all remote IP addresses for a given domain have been inaccessible for so long that they have passed their retry cutoff times. @@ -24082,7 +24355,6 @@ been started will not be passed to a new delivery process for sending another message on the same connection. See section &<>& for an explanation of when this might be needed. -.new .option hosts_noproxy_tls smtp "host list&!!" * .cindex "TLS" "passing connection" .cindex "multiple SMTP deliveries" @@ -24098,7 +24370,6 @@ instead, and the original process maintains the TLS connection and proxies the SMTP connection from and to the new process and any subsequents. The new process has no access to TLS information, so cannot include it in logging. -.wen @@ -24148,6 +24419,15 @@ Exim will request a Certificate Status on a TLS session for any host that matches this list. &%tls_verify_certificates%& should also be set for the transport. +.option hosts_require_dane smtp "host list&!!" unset +.cindex DANE "transport options" +.cindex DANE "requiring for certain servers" +If built with DANE support, Exim will require that a DNSSEC-validated +TLSA record is present for any host matching the list, +and that a DANE-verified TLS connection is made. +There will be no fallback to in-clear communication. +See section &<>&. + .option hosts_require_ocsp smtp "host list&!!" unset .cindex "TLS" "requiring for certain servers" Exim will request, and check for a valid Certificate Status being given, on a @@ -24177,6 +24457,16 @@ This option provides a list of servers to which, provided they announce CHUNKING support, Exim will attempt to use BDAT commands rather than DATA. BDAT will not be used in conjunction with a transport filter. +.option hosts_try_dane smtp "host list&!!" unset +.cindex DANE "transport options" +.cindex DANE "attempting for certain servers" +If built with DANE support, Exim will lookup a +TLSA record for any host matching the list. +If found and verified by DNSSEC, +a DANE-verified TLS connection is made to that host; +there will be no fallback to in-clear communication. +See section &<>&. + .option hosts_try_fastopen smtp "host list&!!" unset .cindex "fast open, TCP" "enabling, in client" .cindex "TCP Fast Open" "enabling, in client" @@ -24194,7 +24484,7 @@ as the initiator must present a cookie in the SYN segment. On (at least some) current Linux distributions the facility must be enabled in the kernel by the sysadmin before the support is usable. There is no option for control of the server side; if the system supports -it it is always enebled. Note that legthy operations in the connect ACL, +it it is always enabled. Note that lengthy operations in the connect ACL, such as DNSBL lookups, will still delay the emission of the SMTP banner. .option hosts_try_prdr smtp "host list&!!" * @@ -24284,10 +24574,17 @@ 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 +normally &"smtp"&, +but if &%protocol%& is set to &"lmtp"& the default is &"lmtp"& +and if &%protocol%& is set to &"smtps"& the default is &"smtps"&. +If the expansion fails, or if a port number cannot be found, delivery is deferred. +.new +Note that at least one Linux distribution has been seen failing +to put &"smtps"& in its &"/etc/services"& file, resulting is such deferrals. +.wen + .option protocol smtp string smtp @@ -24304,7 +24601,11 @@ over a pipe to a local process &-- see chapter &<>&. If this option is set to &"smtps"&, the default value 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. +.new +The Internet standards bodies used to strongly discourage use of this mode, +but as of RFC 8314 it is perferred over STARTTLS for message submission +(as distinct from MTA-MTA communication). +.wen .option retry_include_ip_address smtp boolean&!! true @@ -24533,6 +24834,16 @@ The &%tls_verify_certificates%& option must also be set. If both this option and &%tls_try_verify_hosts%& are unset operation is as if this option selected all hosts. +.new +.option utf8_downconvert smtp integer!! unset +.cindex utf8 "address downconversion" +.cindex i18n "utf8 address downconversion" +If built with internationalization support, +this option controls conversion of UTF-8 in message addresses +to a-label form. +For details see section &<>&. +.wen + @@ -25560,10 +25871,13 @@ For local deliveries, one delivery attempt is always made for any subsequent messages. If this delivery fails, the address fails immediately. The post-cutoff retry time is not used. +.cindex "final cutoff" "retries, controlling" +.cindex retry "final cutoff" If the delivery is remote, there are two possibilities, controlled by the .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 +default. Until the post-cutoff retry time for one of the IP addresses, +as set by the &%retry_data_expire%& option, is reached, the failing email address is bounced immediately, without a delivery attempt taking place. After that time, one new delivery attempt is made to those IP addresses that are past their retry times, and if that still fails, @@ -25838,12 +26152,15 @@ output, and Exim carries on processing. .option server_set_id authenticators string&!! unset .vindex "&$authenticated_id$&" +.vindex "&$authenticated_fail_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 lines for incoming messages. For example, a user/password authenticator configuration might preserve the user name that was used to authenticate, and refer to it subsequently during delivery of the message. +On a failing authentication the expansion result is instead saved in +the &$authenticated_fail_id$& variable. If expansion fails, the option is ignored. @@ -25982,6 +26299,10 @@ public name) of the authenticator driver that successfully authenticated the client from which the message was received. This variable is empty if there was no successful authentication. +.cindex authentication "expansion item" +Successful authentication sets up information used by the +&$authresults$& expansion item. + @@ -26074,8 +26395,8 @@ deliver the message unauthenticated. Note that the hostlist test for whether to do authentication can be confused if name-IP lookups change between the time the peer is decided -on and the transport running. For example, with a manualroute -router given a host name, and DNS "round-robin" use by that name: if +upon and the time that the transport runs. For example, with a manualroute +router given a host name, and with DNS "round-robin" used by that name: if the local resolver cache times out between the router and the transport running, the transport may get an IP for the name for its authentication check which does not match the connection peer IP. @@ -26491,8 +26812,8 @@ fixed_cram: .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)). +The code for this authenticator was provided by Matthew Byng-Maddick while +at A L Digital Ltd. The &(cyrus_sasl)& authenticator provides server support for the Cyrus SASL library implementation of the RFC 2222 (&"Simple Authentication and Security @@ -26602,7 +26923,7 @@ 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 +This option must specify the UNIX 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: @@ -26652,15 +26973,17 @@ without code changes in Exim. .option server_channelbinding gsasl boolean false +Do not set this true without consulting a cryptographic engineer. + 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 should have meant 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 @@ -26668,7 +26991,11 @@ 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. +of Exim might have switched the default to be true. + +However, Channel Binding in TLS has proven to be broken in current versions. +Do not plan to rely upon this feature for security, ever, without consulting +with a subject matter expert (a cryptographic engineer). .option server_hostname gsasl string&!! "see below" @@ -26850,7 +27177,7 @@ The &(spa)& authenticator provides client support for Microsoft's &'Secure Password Authentication'& mechanism, which is also sometimes known as NTLM (NT LanMan). The code for client side of this authenticator was contributed by Marc Prud'hommeaux, and much of it is -taken from the Samba project (&url(http://www.samba.org)). The code for the +taken from the Samba project (&url(https://www.samba.org/)). The code for the server side was subsequently contributed by Tom Kistner. The mechanism works as follows: @@ -27056,22 +27383,36 @@ in order to get TLS to work. -.section "Support for the legacy &""ssmtp""& (aka &""smtps""&) protocol" &&& +.section "Support for the &""submissions""& (aka &""ssmtp""& and &""smtps""&) protocol" &&& "SECID284" +.cindex "submissions protocol" .cindex "ssmtp protocol" .cindex "smtps protocol" +.cindex "SMTP" "submissions protocol" .cindex "SMTP" "ssmtp protocol" .cindex "SMTP" "smtps protocol" -Early implementations of encrypted SMTP used a different TCP port from normal -SMTP, and expected an encryption negotiation to start immediately, instead of -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 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: +The history of port numbers for TLS in SMTP is a little messy and has been +contentious. As of RFC 8314, the common practice of using the historically +allocated port 465 for "email submission but with TLS immediately upon connect +instead of using STARTTLS" is officially blessed by the IETF, and recommended +by them in preference to STARTTLS. + +The name originally assigned to the port was &"ssmtp"& or &"smtps"&, but as +clarity emerged over the dual roles of SMTP, for MX delivery and Email +Submission, nomenclature has shifted. The modern name is now &"submissions"&. + +This approach was, for a while, officially abandoned when encrypted SMTP was +standardized, but many clients kept using it, even as the TCP port number was +reassigned for other use. +Thus you may encounter guidance claiming that you shouldn't enable use of +this port. +In practice, a number of mail-clients have only ever supported submissions, +not submission with STARTTLS upgrade. +Ideally, offer both submission (587) and submissions (465) service. + +Exim supports TLS-on-connect 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: .code tls_on_connect_ports = 465 .endd @@ -27083,7 +27424,7 @@ an extra port &-- rather, it specifies different behaviour on a port that is defined elsewhere. There is also a &%-tls-on-connect%& command line option. This overrides -&%tls_on_connect_ports%&; it forces the legacy behaviour for all ports. +&%tls_on_connect_ports%&; it forces the TLS-only behaviour for all ports. @@ -27138,10 +27479,8 @@ 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). .next -.new With GnuTLS, if an explicit list is used for the &%tls_privatekey%& main option main option, it must be ordered to match the &%tls_certificate%& list. -.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 @@ -27238,7 +27577,10 @@ the size of the generated prime, so it might still be too large. .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 +.new +are acceptable for TLS versions prior to 1.3. +.wen +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. Many systems will install the OpenSSL manual-pages, so you may have @@ -27298,11 +27640,21 @@ tls_require_ciphers = ${if =={$received_port}{25}\ {HIGH:!MD5:!SHA1}} .endd -.new This example will prefer ECDSA-authenticated ciphers over RSA ones: .code tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT .endd + +.new +For TLS version 1.3 the control available is less fine-grained +and Exim does not provide access to it at present. +The value of the &%tls_require_ciphers%& option is ignored when +TLS version 1.3 is negotiated. + +As of writing the library default cipher suite list for TLSv1.3 is +.code +TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +.endd .wen @@ -27331,11 +27683,11 @@ 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.gnutls.org/manual/html_node/Priority-Strings.html), +&url(https://www.gnutls.org/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, then the example code -&url(http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string) +&url(https://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string) on that site can be used to test a given string. For example: @@ -27366,8 +27718,8 @@ tls_require_ciphers = ${if =={$received_port}{25}\ 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 *, which means -that STARTTLS is alway advertised. Set it to blank to never advertise; -this is reasonble for systems that want to use TLS only as a client. +that STARTTLS is always advertised. Set it to blank to never advertise; +this is reasonable for systems that want to use TLS only as a client. If STARTTLS is to be used you need to set some other options in order to make TLS available. @@ -27411,14 +27763,12 @@ is assumed to be the case. The certificate file may also contain intermediate certificates that need to be sent to the client to enable it to authenticate the server's certificate. -.new For dual-stack (eg. RSA and ECDSA) configurations, these options can be colon-separated lists of file paths. Ciphers using given authentication algorithms require the presence of a suitable certificate to supply the public-key. The server selects among the certificates to present to the client depending on the selected cipher, hence the priority ordering for ciphers will affect which certificate is used. -.wen If you do not understand about certificates and keys, please try to find a source of this background information, which is not Exim-specific. (There are a @@ -27489,7 +27839,7 @@ session with a client, you must set either &%tls_verify_hosts%& or apply to all TLS connections. For any host that matches one of these options, Exim requests a certificate as part of the setup of the TLS session. The contents of the certificate are verified by comparing it with a list of -expected certificates. +expected trust-anchors or certificates. These may be the system default set (depending on library version), an explicit file or, depending on library version, a directory, identified by @@ -27506,6 +27856,9 @@ openssl x509 -hash -noout -in /cert/file .endd where &_/cert/file_& contains a single certificate. +There is no checking of names of the client against the certificate +Subject Name or Subject Alternate Names. + The difference between &%tls_verify_hosts%& and &%tls_try_verify_hosts%& is what happens if the client does not supply a certificate, or if the certificate does not match any of the certificates in the collection named by @@ -27653,11 +28006,10 @@ if it requests it. If the server is Exim, it will request a certificate only if If the &%tls_verify_certificates%& option is set on the &(smtp)& transport, it specifies a collection of expected server certificates. -These may be the system default set (depending on library version), -a file or, -depending on library version, a directory, -must name a file or, -for OpenSSL only (not GnuTLS), a directory. +These may be +the system default set (depending on library version), +a file, +or (depending on library version) a directory. The client verifies the server's certificate against this collection, taking into account any revoked certificates that are in the list defined by &%tls_crl%&. @@ -27668,6 +28020,11 @@ The &%tls_verify_hosts%& and &%tls_try_verify_hosts%& options restrict certificate verification to the listed servers. Verification either must or need not succeed respectively. +The &%tls_verify_cert_hostnames%& option lists hosts for which additional +checks are made: that the host name (the one in the DNS A record) +is valid for the certificate. +The option defaults to always checking. + The &(smtp)& transport has two OCSP-related options: &%hosts_require_ocsp%&; a host-list for which a Certificate Status is requested and required for the connection to proceed. The default @@ -27755,19 +28112,14 @@ 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%& .next -.vindex "&%tls_ocsp_file%&" &%tls_ocsp_file%& .endlist @@ -27797,7 +28149,6 @@ built, then you have SNI support). "SECTmulmessam" .cindex "multiple SMTP deliveries with TLS" .cindex "TLS" "multiple message deliveries" -.new Exim sends multiple messages down the same TCP/IP connection by starting up an entirely new delivery process for each message, passing the socket from one process to the next. This implementation does not fit well with the use @@ -27809,8 +28160,7 @@ unencrypted data stream from and to the delivery processes. An older mode of operation can be enabled on a per-host basis by the &%hosts_noproxy_tls%& option on the &(smtp)& transport. If the host matches -this list the proxy process descibed above is not used; instead Exim -.wen +this list the proxy process described above is not used; instead Exim shuts down an existing TLS session being run by the delivery process before passing the socket to a new process. The new process may then try to start a new TLS session, and if successful, may try to re-authenticate @@ -27841,22 +28191,29 @@ connections to new processes if TLS has been used. .section "Certificates and all that" "SECTcerandall" .cindex "certificate" "references to discussion" In order to understand fully how TLS works, you need to know about -certificates, certificate signing, and certificate authorities. This is not the -place to give a tutorial, especially as I do not know very much about it -myself. Some helpful introduction can be found in the FAQ for the SSL addition -to Apache, currently at +certificates, certificate signing, and certificate authorities. +This is a large topic and an introductory guide is unsuitable for the Exim +reference manual, so instead we provide pointers to existing documentation. + +The Apache web-server was for a long time the canonical guide, so their +documentation is a good place to start; their SSL module's Introduction +document is currently at .display -&url(http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24) +&url(https://httpd.apache.org/docs/current/ssl/ssl_intro.html) .endd -Other parts of the &'modssl'& documentation are also helpful, and have -links to further files. -Eric Rescorla's book, &'SSL and TLS'&, published by Addison-Wesley (ISBN -0-201-61598-3), contains both introductory and more in-depth descriptions. -Some sample programs taken from the book are available from +and their FAQ is at .display -&url(http://www.rtfm.com/openssl-examples/) +&url(https://httpd.apache.org/docs/current/ssl/ssl_faq.html) .endd +Eric Rescorla's book, &'SSL and TLS'&, published by Addison-Wesley (ISBN +0-201-61598-3) in 2001, contains both introductory and more in-depth +descriptions. +More recently Ivan Ristić's book &'Bulletproof SSL and TLS'&, +published by Feisty Duck (ISBN 978-1907117046) in 2013 is good. +Ivan is the author of the popular TLS testing tools at +&url(https://www.ssllabs.com/). + .section "Certificate chains" "SECID186" The file named by &%tls_certificate%& may contain more than one @@ -27927,12 +28284,208 @@ signed with that self-signed certificate. For information on creating self-signed CA certificates and using them to sign user certificates, see the &'General implementation overview'& chapter of the Open-source PKI book, available online at -&url(http://ospkibook.sourceforge.net/). +&url(https://sourceforge.net/projects/ospkibook/). .ecindex IIDencsmtp1 .ecindex IIDencsmtp2 +.section DANE "SECDANE" +.cindex DANE +DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that +it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM) +operation. The latter can terminate the TLS connection you make, and make another one to the server (so both +you and the server still think you have an encrypted connection) and, if one of the "well known" set of +Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable +certificate (if you're using normal root CAs, eg. the Mozilla set, as your trust anchors). + +What DANE does is replace the CAs with the DNS as the trust anchor. The assurance is limited to a) the possibility +that the DNS has been suborned, b) mistakes made by the admins of the target server. The attack surface presented +by (a) is thought to be smaller than that of the set of root CAs. + +It also allows the server to declare (implicitly) that connections to it should use TLS. An MITM could simply +fail to pass on a server's STARTTLS. + +DANE scales better than having to maintain (and side-channel communicate) copies of server certificates +for every possible target server. It also scales (slightly) better than having to maintain on an SMTP +client a copy of the standard CAs bundle. It also means not having to pay a CA for certificates. + +DANE requires a server operator to do three things: 1) run DNSSEC. This provides assurance to clients +that DNS lookups they do for the server have not been tampered with. The domain MX record applying +to this server, its A record, its TLSA record and any associated CNAME records must all be covered by +DNSSEC. +2) add TLSA DNS records. These say what the server certificate for a TLS connection should be. +3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records. + +There are no changes to Exim specific to server-side operation of DANE. +Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes +in &_Local/Makefile_&. +If it has been included, the macro "_HAVE_DANE" will be defined. + +The TLSA record for the server may have "certificate usage" of DANE-TA(2) or DANE-EE(3). +These are the "Trust Anchor" and "End Entity" variants. +The latter specifies the End Entity directly, i.e. the certificate involved is that of the server +(and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake); +this is appropriate for a single system, using a self-signed certificate. +DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public, +well-known one. +A private CA at simplest is just a self-signed certificate (with certain +attributes) which is used to sign server certificates, but running one securely +does require careful arrangement. +With DANE-TA, as implemented in Exim and commonly in other MTAs, +the server TLS handshake must transmit the entire certificate chain from CA to server-certificate. +DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record, +all of which point to a single TLSA record. +DANE-TA and DANE-EE can both be used together. + +.new +Our recommendation is to use DANE with a certificate from a public CA, +because this enables a variety of strategies for remote clients to verify +your certificate. +You can then publish information both via DANE and another technology, +"MTA-STS", described below. + +When you use DANE-TA to publish trust anchor information, you ask entities +outside your administrative control to trust the Certificate Authority for +connections to you. +If using a private CA then you should expect others to still apply the +technical criteria they'd use for a public CA to your certificates. +In particular, you should probably try to follow current best practices for CA +operation around hash algorithms and key sizes. +Do not expect other organizations to lower their security expectations just +because a particular profile might be reasonable for your own internal use. + +When this text was last updated, this in practice means to avoid use of SHA-1 +and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger +than 4096, for interoperability); to use keyUsage fields correctly; to use +random serial numbers. +The list of requirements is subject to change as best practices evolve. +If you're not already using a private CA, or it doesn't meet these +requirements, then we encourage you to avoid all these issues and use a public +CA such as &url(https://letsencrypt.org/,Let's Encrypt) instead. +.wen + +The TLSA record should have a Selector field of SPKI(1) and a Matching Type field of SHA2-512(2). + +At the time of writing, &url(https://www.huque.com/bin/gen_tlsa) +is useful for quickly generating TLSA records; and commands like + +.code + openssl x509 -in -pubkey -noout /dev/null \ + | openssl sha512 \ + | awk '{print $2}' +.endd + +are workable for 4th-field hashes. + +For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName). + +.new +The Certificate issued by the CA published in the DANE-TA model should be +issued using a strong hash algorithm. +Exim, and importantly various other MTAs sending to you, will not +re-enable hash algorithms which have been disabled by default in TLS +libraries. +This means no MD5 and no SHA-1. SHA2-256 is the minimum for reliable +interoperability (and probably the maximum too, in 2018). +.wen + +The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise +be limited by the DNS TTL on the TLSA records). However, this is likely to only be usable with DANE-TA. NOTE: the +default of requesting OCSP for all hosts is modified iff DANE is in use, to: + +.code + hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \ + {= {4}{$tls_out_tlsa_usage}} } \ + {*}{}} +.endd + +The (new) variable &$tls_out_tlsa_usage$& is a bitfield with numbered bits set for TLSA record usage codes. +The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were +found. If the definition of &%hosts_request_ocsp%& includes the +string "tls_out_tlsa_usage", they are re-expanded in time to +control the OCSP request. + +This modification of hosts_request_ocsp is only done if it has the default value of "*". Admins who change it, and +those who use &%hosts_require_ocsp%&, should consider the interaction with DANE in their OCSP settings. + + +For client-side DANE there are three new smtp transport options, &%hosts_try_dane%&, &%hosts_require_dane%& +and &%dane_require_tls_ciphers%&. +The require variant will result in failure if the target host is not DNSSEC-secured. + +DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records. + +A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using dnssec. +If a TLSA lookup is done and succeeds, a DANE-verified TLS connection +will be required for the host. If it does not, the host will not +be used; there is no fallback to non-DANE or non-TLS. + +If DANE is requested and usable, then the TLS cipher list configuration +prefers to use the option &%dane_require_tls_ciphers%& and falls +back to &%tls_require_ciphers%& only if that is unset. +This lets you configure "decent crypto" for DANE and "better than nothing +crypto" as the default. Note though that while GnuTLS lets the string control +which versions of TLS/SSL will be negotiated, OpenSSL does not and you're +limited to ciphersuite constraints. + +If DANE is requested and useable (see above) the following transport options are ignored: +.code + hosts_require_tls + tls_verify_hosts + tls_try_verify_hosts + tls_verify_certificates + tls_crl + tls_verify_cert_hostnames +.endd + +If DANE is not usable, whether requested or not, and CA-anchored +verification evaluation is wanted, the above variables should be set appropriately. + +Currently the &%dnssec_request_domains%& must be active and &%dnssec_require_domains%& is ignored. + +If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane". + +There is a new variable &$tls_out_dane$& which will have "yes" if +verification succeeded using DANE and "no" otherwise (only useful +in combination with events; see &<>&), +and a new variable &$tls_out_tlsa_usage$& (detailed above). + +.cindex DANE reporting +An event (see &<>&) of type "dane:fail" will be raised on failures +to achieve DANE-verified connection, if one was either requested and offered, or +required. This is intended to support TLS-reporting as defined in +&url(https://tools.ietf.org/html/draft-ietf-uta-smtp-tlsrpt-17). +The &$event_data$& will be one of the Result Types defined in +Section 4.3 of that document. + +Under GnuTLS, DANE is only supported from version 3.0.0 onwards. + +DANE is specified in published RFCs and decouples certificate authority trust +selection from a "race to the bottom" of "you must trust everything for mail +to get through". There is an alternative technology called MTA-STS, which +instead publishes MX trust anchor information on an HTTPS website. At the +time this text was last updated, MTA-STS was still a draft, not yet an RFC. +Exim has no support for MTA-STS as a client, but Exim mail server operators +can choose to publish information describing their TLS configuration using +MTA-STS to let those clients who do use that protocol derive trust +information. + +The MTA-STS design requires a certificate from a public Certificate Authority +which is recognized by clients sending to you. +That selection of which CAs are trusted by others is outside your control. + +The most interoperable course of action is probably to use +&url(https://letsencrypt.org/,Let's Encrypt), with automated certificate +renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA +records for DANE clients (such as Exim and Postfix) and to publish anchor +information for MTA-STS as well. This is what is done for the &'exim.org'& +domain itself (with caveats around occasionally broken MTA-STS because of +incompatible specification changes prior to reaching RFC status). + + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -28140,7 +28693,7 @@ 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 &<>&. +For details on the operation of DKIM, see section &<>&. .section "The SMTP MIME ACL" "SECID194" @@ -28257,8 +28810,8 @@ 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 +providing an RFC 4409 message &"submission"& service on port 587 and +an RFC 8314 &"submissions"& 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. @@ -29018,6 +29571,8 @@ effect. .vitem &*queue*&&~=&~<&'text'&> +.cindex "&%queue%& ACL modifier" +.cindex "named queues" "selecting in ACL" This modifier specifies the use of a named queue for spool files for the message. It can only be used before the message is received (i.e. not in @@ -29141,11 +29696,9 @@ and cannot depend on content of received headers. Note also that headers cannot be modified by any of the post-data ACLs (DATA, MIME and DKIM). Headers may be modified by routers (subject to the above) and transports. -.new -The Received-By: header is generated as soon as the body reception starts, +The &'Received-By:'& header is generated as soon as the body reception starts, rather than the traditional time after the full message is received; this will affect the timestamp. -.wen All the usual ACLs are called; if one results in the message being rejected, all effort spent in delivery (including the costs on @@ -29206,7 +29759,7 @@ contexts): .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 &<>&. +the operation and configuration of DKIM, see section &<>&. .vitem &*control&~=&~dscp/*&<&'value'&> @@ -29552,9 +30105,10 @@ warn hosts = +internal_hosts 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 +Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs. +Matching header lines are removed from the message before processing the DATA and MIME ACLs. +If multiple header lines match, all are removed. +There is no harm in attempting to remove the same header twice nor in 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 @@ -30086,6 +30640,10 @@ connection (assuming long-enough TTL). Exim does not share information between multiple incoming connections (but your local name server cache should be active). +There are a number of DNS lists to choose from, some commercial, some free, +or free for small deployments. An overview can be found at +&url(https://en.wikipedia.org/wiki/Comparison_of_DNS_blacklists). + .section "Specifying the IP address for a DNS list lookup" "SECID201" @@ -30107,8 +30665,7 @@ MX hosts or nameservers of an email sender address. For an example, see section .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 -&url(http://www.rfc-ignorant.org/)). No reversing of components is used +addresses. No reversing of components is used with these lists. You can change the name that is looked up in a DNS list by listing it after the domain name, introduced by a slash. For example, .code @@ -30442,7 +30999,7 @@ 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 = \ +deny message = \ rejected because $sender_host_address is blacklisted \ at $dnslist_domain\n$dnslist_text dnslists = \ @@ -30460,7 +31017,7 @@ 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 = \ +deny 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 : \ @@ -30671,13 +31228,15 @@ 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 +client's average rate of successfully sent email, +.new +up to the given limit. +This is appropriate if the countermeasure when the condition is true +consists of refusing the message, and 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. +If the action when true is anything more complex then this option is +likely not what is wanted. +.wen 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 @@ -30848,6 +31407,15 @@ connection, HELO, or MAIL). The main use of these variables is expected to be to distinguish between rejections of MAIL and rejections of RCPT in callouts. +.new +The above variables may also be set after a &*successful*& +address verification to: + +.ilist +&%random%&: A random local-part callout succeeded +.endlist +.wen + @@ -31081,13 +31649,12 @@ need to use this option unless you know that the called hosts make use of the sender when checking recipients. If used indiscriminately, it reduces the usefulness of callout caching. -.new .vitem &*hold*& This option applies to recipient callouts only. For example: .code require verify = recipient/callout=use_sender,hold .endd -It causes the connection to be helod open and used for any further recipients +It causes the connection to be held open and used for any further recipients and for eventual delivery (should that be done quickly). Doing this saves on TCP and SMTP startup costs, and TLS costs also when that is used for the connections. @@ -31096,7 +31663,6 @@ The advantage is only gained if there are no callout cache hits if the use_sender option is used, if neither the random nor the use_postmaster option is used, and if no other callouts intervene. -.wen .endlist If you use any of the parameters that set a non-empty sender for the MAIL @@ -31563,25 +32129,35 @@ av_scanner = sophie:/var/run/sophie If the value of &%av_scanner%& starts with a dollar character, it is expanded before use. The usual list-parsing of the content (see &<>&) applies. -The following scanner types are supported in this release: +The following scanner types are supported in this release, +though individual ones can be included or not at build time: .vlist .vitem &%avast%& .cindex "virus scanners" "avast" This is the scanner daemon of Avast. It has been tested with Avast Core -Security (currently at version 1.1.7). -You can get a trial version at &url(http://www.avast.com) or for Linux -at &url(http://www.avast.com/linux-server-antivirus). +Security (currently at version 2.2.0). +You can get a trial version at &url(https://www.avast.com) or for Linux +at &url(https://www.avast.com/linux-server-antivirus). This scanner type takes one option, which can be either a full path to a UNIX socket, or host and port specifiers separated by white space. The host may be a name or an IP address; the port is either a single number or a pair of numbers with a dash between. -Any further options are given, on separate lines, -to the daemon as options before the main scan command. +A list of options may follow. These options are interpreted on the +Exim's side of the malware scanner, or are given on separate lines to +the daemon as options before the main scan command. + +.cindex &`pass_unscanned`& "avast" +If &`pass_unscanned`& +is set, any files the Avast scanner can't scan (e.g. +decompression bombs, or invalid archives) are considered clean. Use with +care. + For example: .code av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup +av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup av_scanner = avast:192.168.2.22 5036 .endd If you omit the argument, the default path @@ -31598,11 +32174,14 @@ $ socat UNIX:/var/run/avast/scan.sock STDIO: PACK .endd +If the scanner returns a temporary failure (e.g. license issues, or +permission problems), the message is deferred and a paniclog entry is +written. The usual &`defer_ok`& option is available. .vitem &%aveserver%& .cindex "virus scanners" "Kaspersky" This is the scanner daemon of Kaspersky Version 5. You can get a trial version -at &url(http://www.kaspersky.com). This scanner type takes one option, +at &url(https://www.kaspersky.com/). This scanner type takes one option, which is the path to the daemon's UNIX socket. The default is shown in this example: .code @@ -31613,7 +32192,7 @@ av_scanner = aveserver:/var/run/aveserver .vitem &%clamd%& .cindex "virus scanners" "clamd" This daemon-type scanner is GPL and free. You can get it at -&url(http://www.clamav.net/). Some older versions of clamd do not seem to +&url(https://www.clamav.net/). Some older versions of clamd do not seem to unpack MIME containers, so it used to be recommended to unpack MIME attachments in the MIME ACL. This is no longer believed to be necessary. @@ -31648,11 +32227,9 @@ av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234 If the value of av_scanner points to a UNIX socket file or contains the &`local`& option, 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 +to be scanned, which 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. The final example shows that multiple TCP targets can be specified. Exim will randomly use one for each incoming email (i.e. it load balances them). Note @@ -31709,7 +32286,7 @@ av_scanner = cmdline:\ .endd .vitem &%drweb%& .cindex "virus scanners" "DrWeb" -The DrWeb daemon scanner (&url(http://www.sald.com/)) interface +The DrWeb daemon scanner (&url(https://www.sald.ru/)) interface takes one option, either a full path to a UNIX socket, or host and port specifiers separated by white space. @@ -31732,9 +32309,8 @@ For example: .code av_scanner = f-protd:localhost 10200-10204 .endd -If you omit the argument, the default values show above are used. +If you omit the argument, the default values shown above are used. -.new .vitem &%f-prot6d%& .cindex "virus scanners" "f-prot6d" The f-prot6d scanner is accessed using the FPSCAND protocol over TCP. @@ -31744,11 +32320,10 @@ For example: av_scanner = f-prot6d:localhost 10200 .endd If you omit the argument, the default values show above are used. -.wen .vitem &%fsecure%& .cindex "virus scanners" "F-Secure" -The F-Secure daemon scanner (&url(http://www.f-secure.com)) takes one +The F-Secure daemon scanner (&url(https://www.f-secure.com/)) takes one argument which is the path to a UNIX socket. For example: .code av_scanner = fsecure:/path/to/.fsav @@ -31769,9 +32344,13 @@ The default path is &_/var/run/AvpCtl_&. .vitem &%mksd%& .cindex "virus scanners" "mksd" -This is a daemon type scanner that is aimed mainly at Polish users, though some -parts of documentation are now available in English. You can get it at -&url(http://linux.mks.com.pl/). The only option for this scanner type is +This was a daemon type scanner that is aimed mainly at Polish users, +though some documentation was available in English. +The history can be shown at &url(https://en.wikipedia.org/wiki/Mks_vir) +and this appears to be a candidate for removal from Exim, unless +we are informed of other virus scanners which use the same protocol +to integrate. +The only option for this scanner type is the maximum number of processes used simultaneously to scan the attachments, provided that mksd has been run with at least the same number of child processes. For example: @@ -31794,18 +32373,16 @@ For example: .code av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$ .endd -.new Note that surrounding whitespace is stripped from each option, meaning there is no way to specify a trailing newline. The socket specifier and both regular-expressions are required. Default for the commandline is &_%s\n_& (note this does have a trailing newline); specify an empty element to get this. -.wen .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.clanfield.info/sophie/). The only option +You can get Sophie at &url(http://sophie.sourceforge.net/). The only option for this scanner type is the path to the UNIX socket that Sophie uses for client communication. For example: .code @@ -31909,7 +32486,7 @@ Support is also provided for Rspamd. For more information about installation and configuration of SpamAssassin or Rspamd refer to their respective websites at -&url(http://spamassassin.apache.org) and &url(http://www.rspamd.com) +&url(https://spamassassin.apache.org/) and &url(https://www.rspamd.com/) SpamAssassin can be installed with CPAN by running: .code @@ -32320,7 +32897,7 @@ All parts contained within an attachment multipart are attachments. As an example, the following will ban &"HTML mail"& (including that sent with alternative plain text), while allowing HTML files to be attached. HTML -coverletter mail attached to non-HMTL coverletter mail will also be allowed: +coverletter mail attached to non-HTML coverletter mail will also be allowed: .code deny message = HTML mail is not accepted here !condition = $mime_is_rfc822 @@ -32433,10 +33010,15 @@ code. The incident is logged on the main and reject logs. .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 +function is before building Exim, by setting +.new +both HAVE_LOCAL_SCAN and +.wen +LOCAL_SCAN_SOURCE in your &_Local/Makefile_&. A recommended place to put it is in the &_Local_& directory, so you might set .code +HAVE_LOCAL_SCAN=yes LOCAL_SCAN_SOURCE=Local/local_scan.c .endd for example. The function must be called &[local_scan()]&. It is called by @@ -32640,15 +33222,11 @@ C variables are as follows: .vlist .vitem &*int&~body_linecount*& This variable contains the number of lines in the message's body. -.new It is not valid if the &%spool_files_wireformat%& option is used. -.wen .vitem &*int&~body_zerocount*& This variable contains the number of binary zero bytes in the message's body. -.new It is not valid if the &%spool_files_wireformat%& option is used. -.wen .vitem &*unsigned&~int&~debug_selector*& This variable is set to zero when no debugging is taking place. Otherwise, it @@ -35097,7 +35675,7 @@ the address, giving a suitable error message. .cindex "VERP" .cindex "Variable Envelope Return Paths" .cindex "envelope sender" -Variable Envelope Return Paths &-- see &url(http://cr.yp.to/proto/verp.txt) &-- +Variable Envelope Return Paths &-- see &url(https://cr.yp.to/proto/verp.txt) &-- are a way of helping mailing list administrators discover which subscription address is the cause of a particular delivery failure. The idea is to encode the original recipient address in the outgoing envelope sender address, so that @@ -35972,12 +36550,10 @@ SMTP RCPT commands in one transaction) the second and subsequent addresses are 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. -.new When two or more messages are delivered down a single TLS connection, the DNS and some TLS-related information logged for the first message delivered will not be present in the log lines for the second and subsequent messages. TLS cipher information is still available. -.wen .cindex "delivery" "cutthrough; logging" .cindex "cutthrough" "logging" @@ -36082,14 +36658,16 @@ the following table: &` `& command list for &"no mail in SMTP session"& &`CV `& certificate verification status &`D `& duration of &"no mail in SMTP session"& +&`DKIM`& domain verified in incoming message &`DN `& distinguished name from peer certificate &`DS `& DNSSEC secured lookups &`DT `& on &`=>`& lines: time taken for a delivery &`F `& sender address (on delivery lines) &`H `& host name and IP address &`I `& local interface used -&`K `& CHUNKING extension used &`id `& message id for incoming message +&`K `& CHUNKING extension used +&`L `& on &`<=`& and &`=>`& lines: PIPELINING extension used &`M8S `& 8BITMIME status for incoming message &`P `& on &`<=`& lines: protocol used &` `& on &`=>`& and &`**`& lines: return path @@ -36100,6 +36678,7 @@ the following table: &` `& on &"Completed"& lines: time spent on queue &`R `& on &`<=`& lines: reference for local bounce &` `& on &`=>`& &`>>`& &`**`& and &`==`& lines: router name +&`RT `& on &`<=`& lines: time taken for reception &`S `& size of message in bytes &`SNI `& server name indication from TLS client hello &`ST `& shadow transport name @@ -36151,6 +36730,10 @@ A delivery set up by a router configured with .endd failed. The delivery was discarded. .endlist olist +.next +.cindex DKIM "log line" +&'DKIM: d='&&~&~Verbose results of a DKIM verification attempt, if enabled for +logging and the message has a DKIM signature header. .endlist ilist @@ -36178,6 +36761,8 @@ selection marked by asterisks: &`*delay_delivery `& immediate delivery delayed &` deliver_time `& time taken to perform delivery &` delivery_size `& add &`S=`&&'nnn'& to => lines +&`*dkim `& DKIM verified domain on <= lines +&` dkim_verbose `& separate full DKIM verification result line, per signature &`*dnslist_defer `& defers of DNS list (aka RBL) lookups &` dnssec `& DNSSEC secured lookups &`*etrn `& ETRN commands @@ -36186,14 +36771,16 @@ selection marked by asterisks: &` incoming_interface `& local interface on <= and => lines &` incoming_port `& remote port on <= lines &`*lost_incoming_connection `& as it says (includes timeouts) -&` millisec `& millisecond timestamps and QT,DT,D times +&` millisec `& millisecond timestamps and RT,QT,DT,D times &` outgoing_interface `& local interface on => lines &` outgoing_port `& add remote port to => lines &`*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 +&` pipelining `& PIPELINING use, on <= and => lines &` proxy `& proxy address on <= and => lines +&` receive_time `& time taken to receive message &` received_recipients `& recipients on <= lines &` received_sender `& sender on <= lines &`*rejected_header `& header contents on reject log @@ -36277,13 +36864,22 @@ process is started because &%queue_only%& is set or &%-odq%& was used. &%deliver_time%&: For each delivery, the amount of real time it has taken to perform the actual delivery is logged as DT=<&'time'&>, for example, &`DT=1s`&. If millisecond logging is enabled, short times will be shown with greater -precision, eg. &`DT=0.304`&. +precision, eg. &`DT=0.304s`&. .next .cindex "log" "message size on delivery" .cindex "size" "of message" &%delivery_size%&: For each delivery, the size of message delivered is added to the &"=>"& line, tagged with S=. .next +.cindex log "DKIM verification" +.cindex DKIM "verification logging" +&%dkim%&: For message acceptance log lines, when an DKIM signature in the header +verifies successfully a tag of DKIM is added, with one of the verified domains. +.next +.cindex log "DKIM verification" +.cindex DKIM "verification logging" +&%dkim_verbose%&: A log entry is written for each attempted DKIM verification. +.next .cindex "log" "dnslist defer" .cindex "DNS list" "logging defer" .cindex "black list (DNS)" @@ -36353,13 +36949,11 @@ important with the widening use of NAT (see RFC 2505). &%lost_incoming_connection%&: A log line is written when an incoming SMTP connection is unexpectedly dropped. .next -.new .cindex "log" "millisecond timestamps" .cindex millisecond logging -.cindex timstamps "millisecond, in logs" +.cindex timestamps "millisecond, in logs" &%millisec%&: Timestamps have a period and three decimal places of finer granularity appended to the seconds value. -.wen .next .cindex "log" "outgoing interface" .cindex "log" "local interface" @@ -36372,7 +36966,7 @@ followed by IP address in square brackets. You can disable this by turning off the &%outgoing_interface%& option. .next .cindex "log" "outgoing remote port" -.cindex "port" "logging outgoint remote" +.cindex "port" "logging outgoing remote" .cindex "TCP/IP" "logging outgoing remote port" &%outgoing_port%&: The remote port number is added to delivery log lines (those containing => tags) following the IP address. @@ -36387,6 +36981,16 @@ local port is a random ephemeral port. &%pid%&: The current process id is added to every log line, in square brackets, immediately after the time and date. .next +.new +.cindex log pipelining +.cindex pipelining "logging outgoing" +&%pipelining%&: A field is added to delivery and accept +log lines when the ESMTP PIPELINING extension was used. +The field is a single "L". + +On accept lines, where PIPELINING was offered but not used by the client, +the field has a minus appended. +.next .cindex "log" "queue run" .cindex "queue runner" "logging" &%queue_run%&: The start and end of every queue run are logged. @@ -36407,6 +37011,12 @@ the local host is logged as QT=<&'time'&> on &"Completed"& lines, for example, &`QT=3m45s`&. The clock starts when Exim starts to receive the message, so it includes reception time as well as the total delivery time. .next +.cindex "log" "receive duration" +&%receive_time%&: For each message, the amount of real time it has taken to +perform the reception is logged as RT=<&'time'&>, for example, &`RT=1s`&. +If millisecond logging is enabled, short times will be shown with greater +precision, eg. &`RT=0.204s`&. +.next .cindex "log" "recipients" &%received_recipients%&: The recipients of a message are listed in the main log as soon as the message is received. The list appears at the end of the log line @@ -36558,9 +37168,14 @@ specifies whether characters with values greater than 127 should be logged unchanged, or whether they should be rendered as escape sequences. .next .cindex "log" "certificate verification" +.cindex log DANE +.cindex DANE logging &%tls_certificate_verified%&: An extra item is added to <= and => log lines when TLS is in use. The item is &`CV=yes`& if the peer's certificate was -verified, and &`CV=no`& if not. +verified +using a CA trust anchor, +&`CA=dane`& if using a DNS trust anchor, +and &`CV=no`& if not. .next .cindex "log" "TLS cipher" .cindex "TLS" "logging cipher" @@ -36639,7 +37254,7 @@ the next chapter. The utilities described here are: Another utility that might be of use to sites with many MTAs is Tom Kistner's &'exilog'&. It provides log visualizations across multiple Exim servers. See -&url(http://duncanthrax.net/exilog/) for details. +&url(https://duncanthrax.net/exilog/) for details. @@ -36907,8 +37522,8 @@ 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 supported by the &'Lire'& system produced by the -LogReport Foundation &url(http://www.logreport.org). +. --- 2018-09-07: LogReport's Lire appears to be dead; website is a Yahoo Japan +. --- 404 error and everything else points to that. The &'eximstats'& script has been hacked about quite a bit over time. The latest version is the result of some extensive revision by Steve Campbell. A @@ -38103,13 +38718,11 @@ the contents of files on the spool via the Exim monitor (which runs unprivileged), Exim must be built to allow group read access to its spool files. -.new By default, regular users are trusted to perform basic testing and introspection commands, as themselves. This setting can be tightened by setting the &%commandline_checks_require_admin%& option. This affects most of the checking options, such as &%-be%& and anything else &%-b*%&. -.wen .section "Spool files" "SECID275" @@ -38197,6 +38810,12 @@ two files contains the final component of its own name as its first line. This is insurance against disk crashes where the directory is lost but the files themselves are recoverable. +.new +The file formats may be changed, or new formats added, at any release. +Spool files are not intended as an interface to other programs +and should not be used as such. +.wen + Some people are tempted into editing -D files in order to modify messages. You need to be extremely careful if you do this; it is not recommended and you are on your own if you do it. Here are some of the pitfalls: @@ -38230,12 +38849,10 @@ 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. -.new Files whose names end with -K or .eml may also be seen in the spool. These are temporaries used for DKIM or malware processing, when that is used. They should be tidied up by normal operations; any old ones are probably relics of crashes and can be removed. -.wen .section "Format of the -H file" "SECID282" .cindex "uid (user id)" "in spool file" @@ -38397,13 +39014,11 @@ to ensure that the caller is displayed in queue listings). If a message was scanned by SpamAssassin, this is present. It records the value of &$spam_score_int$&. -.new .vitem &%-spool_file_wireformat%& The -D file for this message is in wire-format (for ESMTP CHUNKING) rather than Unix-format. The line-ending is CRLF rather than newline. There is still, however, no leading-dot-stuffing. -.wen .vitem &%-tls_certificate_verified%& A TLS certificate was received from the client that sent this message, and the @@ -38512,7 +39127,6 @@ unqualified domain &'foundation'&. .ecindex IIDforspo2 .ecindex IIDforspo3 -.new .section "Format of the -D file" "SECID282a" The data file is traditionally in Unix-standard format: lines are ended with an ASCII newline character. @@ -38524,19 +39138,24 @@ suitable for direct copying to the wire when transmitting using the ESMTP CHUNKING option, meaning lower processing overhead. Lines are terminated with an ASCII CRLF pair. There is no dot-stuffing (and no dot-termination). -.wen . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "Support for DKIM (DomainKeys Identified Mail)" "CHAPdkim" &&& - "DKIM Support" +.chapter "DKIM and SPF" "CHAPdkim" &&& + "DKIM and SPF Support" .cindex "DKIM" +.section "DKIM (DomainKeys Identified Mail)" SECDKIM + 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. +DKIM is documented in RFC 6376. + +As DKIM relies on the message being unchanged in transit, messages handled +by a mailing-list (which traditionally adds to the message) will not match +any original DKIM signature. DKIM support is compiled into Exim by default if TLS support is present. It can be disabled by setting DISABLE_DKIM=yes in &_Local/Makefile_&. @@ -38558,7 +39177,10 @@ 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, +on by default for logging (in the <= line) purposes. + +Additional log detail can be enabled using the &%dkim_verbose%& log_selector. +When set, 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 @@ -38567,6 +39189,7 @@ signature status. Here is an example (with line-breaks added for clarity): 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 @@ -38577,27 +39200,40 @@ senders). .section "Signing outgoing messages" "SECDKIMSIGN" .cindex "DKIM" "signing" +For signing to be usable you must have published a DKIM record in DNS. +Note that RFC 8301 says: +.code +rsa-sha1 MUST NOT be used for signing or verifying. + +Signers MUST use RSA keys of at least 1024 bits for all keys. +Signers SHOULD use RSA keys of at least 2048 bits. +.endd + +Note also that the key content (the 'p=' field) +in the DNS record is different between RSA and EC keys; +for the former it is the base64 of the ASN.1 for the RSA public key +(equivalent to the private-key .pem with the header/trailer stripped) +but for EC keys it is the base64 of the pure key; no ASN.1 wrapping. + Signing is enabled by setting private options on the SMTP transport. These options take (expandable) strings as arguments. .option dkim_domain smtp string list&!! unset The domain(s) you want to sign with. -.new After expansion, this can be a list. Each element in turn is put into the &%$dkim_domain%& expansion variable while expanding the remaining signing options. -.wen -If it is empty after expansion, DKIM signing is not done. +If it is empty after expansion, DKIM signing is not done, +and no error will result even if &%dkim_strict%& is set. .option dkim_selector smtp string list&!! unset This sets the key selector string. -.new After expansion, which can use &$dkim_domain$&, this can be a list. Each element in turn is put in the expansion variable &%$dkim_selector%& which may be used in the &%dkim_private_key%& option along with &%$dkim_domain%&. -If the option is empty after expansion, DKIM signing is not done for this domain. -.wen +If the option is empty after expansion, DKIM signing is not done for this domain, +and no error will result even if &%dkim_strict%& is set. .option dkim_private_key smtp string&!! unset This sets the private key to use. @@ -38605,21 +39241,80 @@ 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. +be a valid RSA private key in ASCII armor (.pem file), including line breaks +.next +with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later, +be a valid Ed25519 private key (same format as above) .next start with a slash, in which case it is treated as a file that contains -the private key. +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 -If the option is empty after expansion, DKIM signing is not done. -.new +To generate keys under OpenSSL: +.code +openssl genrsa -out dkim_rsa.private 2048 +openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM +.endd +Take the base-64 lines from the output of the second command, concatenated, +for the DNS TXT record. +See section 3.6 of RFC6376 for the record specification. + +Under GnuTLS: +.code +certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private +certtool --load-privkey=dkim_rsa.private --pubkey-info +.endd + +Note that RFC 8301 says: +.code +Signers MUST use RSA keys of at least 1024 bits for all keys. +Signers SHOULD use RSA keys of at least 2048 bits. +.endd + +Support for EC keys is being developed under +&url(https://datatracker.ietf.org/doc/draft-ietf-dcrup-dkim-crypto/). +They are considerably smaller than RSA keys for equivalent protection. +As they are a recent development, users should consider dual-signing +(by setting a list of selectors, and an expansion for this option) +for some transition period. +The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present +for EC keys. + +OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys: +.code +openssl genpkey -algorithm ed25519 -out dkim_ed25519.private +certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private +.endd + +To produce the required public key value for a DNS record: +.code +openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64 +certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64 +.endd + +Note that the format +of Ed25519 keys in DNS has not yet been decided; this release supports +both of the leading candidates at this time, a future release will +probably drop support for whichever proposal loses. + .option dkim_hash smtp string&!! sha256 -Can be set alternatively to &"sha1"& to use an alternate hash -method. Note that sha1 is now condidered insecure, and deprecated. +Can be set to any one of the supported hash methods, which are: +.ilist +&`sha1`& &-- should not be used, is old and insecure +.next +&`sha256`& &-- the default +.next +&`sha512`& &-- possibly more secure but less well supported +.endlist + +Note that RFC 8301 says: +.code +rsa-sha1 MUST NOT be used for signing or verifying. +.endd .option dkim_identity smtp string&!! unset If set after expansion, the value is used to set an "i=" tag in @@ -38627,13 +39322,12 @@ the signing header. The DKIM standards restrict the permissible syntax of this optional tag to a mail address, with possibly-empty local part, an @, and a domain identical to or subdomain of the "d=" tag value. Note that Exim does not check the value. -.wen .option dkim_canon smtp string&!! unset 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. +only supports signing with the same canonicalization method for both headers and body. .option dkim_strict smtp string&!! unset This option defines how Exim behaves when signing a message that @@ -38645,7 +39339,6 @@ variables here. .option dkim_sign_headers smtp string&!! "see below" If set, this option must expand to a colon-separated list of header names. -.new Headers with these names, or the absence or such a header, will be included in the message signature. When unspecified, the header names listed in RFC4871 will be used, @@ -38653,7 +39346,7 @@ whether or not each header is present in the message. The default list is available for the expansion in the macro "_DKIM_SIGN_HEADERS". -If a name is repeated, multiple headers by that name (or the absence therof) +If a name is repeated, multiple headers by that name (or the absence thereof) will be signed. The textually later headers in the headers part of the message are signed first, if there are multiples. @@ -38661,23 +39354,44 @@ A name can be prefixed with either an '=' or a '+' character. If an '=' prefix is used, all headers that are present with this name will be signed. If a '+' prefix if used, all headers that are present with this name -will be signed, and one signtature added for a missing header with the +will be signed, and one signature added for a missing header with the name will be appended. + +.new +.option dkim_timestamps smtp integer&!! unset +This option controls the inclusion of timestamp information in the signature. +If not set, no such information will be included. +Otherwise, must be an unsigned number giving an offset in seconds from the current time +for the expiry tag +(eg. 1209600 for two weeks); +both creation (t=) and expiry (x=) tags will be included. + +RFC 6376 lists these tags as RECOMMENDED. .wen -.section "Verifying DKIM signatures in incoming mail" "SECID514" +.section "Verifying DKIM signatures in incoming mail" "SECDKIMVFY" .cindex "DKIM" "verification" -Verification of DKIM signatures in SMTP incoming email is implemented via the -&%acl_smtp_dkim%& ACL. By default, this ACL is called once for each +.new +Verification of DKIM signatures in SMTP incoming email is done for all +messages for which an ACL control &%dkim_disable_verify%& has not been set. +.cindex authentication "expansion item" +Performing verification sets up information used by the +&$authresults$& expansion item. +.wen + +.new The results of that verification are then made available to the +&%acl_smtp_dkim%& ACL, &new(which can examine and modify them). +By default, this ACL is called once for each syntactically(!) correct signature in the incoming message. A missing ACL definition defaults to accept. If any ACL call does not accept, the message is not accepted. If a cutthrough delivery was in progress for the message, that is summarily dropped (having wasted the transmission effort). -To evaluate the signature in the ACL a large number of expansion variables +To evaluate the &new(verification result) 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. @@ -38712,10 +39426,8 @@ dkim_verify_signers = $sender_address_domain:$dkim_signers 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. -.new If multiple signatures match a domain (or identity), the ACL is called once for each matching signature. -.wen Inside the &%acl_smtp_dkim%&, the following expansion variables are @@ -38744,21 +39456,23 @@ available in &%$dkim_verify_reason%&. &%pass%&: The signature passed verification. It is valid. .endlist -.new This variable can be overwritten using an ACL 'set' modifier. This might, for instance, be done to enforce a policy restriction on hash-method or key-size: .code - warn condition = ${if eq {$dkim_algo}{rsa-sha1}} - condition = ${if eq {$dkim_verify_status}{pass}} - logwrite = NOTE: forcing dkim verify fail (was pass) - set dkim_verify_status = fail - set dkim_verify_reason = hash too weak + warn condition = ${if eq {$dkim_verify_status}{pass}} + condition = ${if eq {${length_3:$dkim_algo}}{rsa}} + condition = ${if or {{eq {$dkim_algo}{rsa-sha1}} \ + {< {$dkim_key_length}{1024}}}} + logwrite = NOTE: forcing DKIM verify fail (was pass) + set dkim_verify_status = fail + set dkim_verify_reason = hash too weak or key too short .endd -After all the DKIM ACL runs have completed, the value becomes a +So long as a DKIM ACL is defined (it need do no more than accept), +after all the DKIM ACL runs have completed, the value becomes a colon-separated list of the values after each run. -.wen +This is maintained for the mime, prdr and data ACLs. .vitem &%$dkim_verify_reason%& A string giving a little bit more detail when &%$dkim_verify_status%& is either @@ -38780,9 +39494,7 @@ 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 -.new -This variable can be overwritten using an ACL 'set' modifier. -.wen +This variable can be overwritten, with any value, using an ACL 'set' modifier. .vitem &%$dkim_domain%& The signing domain. IMPORTANT: This variable is only populated if there is @@ -38799,6 +39511,21 @@ The key record selector string. .vitem &%$dkim_algo%& The algorithm used. One of 'rsa-sha1' or 'rsa-sha256'. +If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later, +may also be 'ed25519-sha256'. +The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present +for EC keys. + +Note that RFC 8301 says: +.code +rsa-sha1 MUST NOT be used for signing or verifying. + +DKIM signatures identified as having been signed with historic +algorithms (currently, rsa-sha1) have permanently failed evaluation +.endd + +To enforce this you must have a DKIM ACL which checks this variable +and overwrites the &$dkim_verify_status$& variable as discussed above. .vitem &%$dkim_canon_body%& The body canonicalization method. One of 'relaxed' or 'simple'. @@ -38817,6 +39544,12 @@ strict enforcement should code the check explicitly. 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. +.new +&*Note:*& The presence of the signature tag specifying a signing body length +is one possible route to spoofing of valid DKIM signatures. +A paranoid implementation might wish to regard signature where this variable +shows less than the "no limit" return as being invalid. +.wen .vitem &%$dkim_created%& UNIX timestamp reflecting the date and time when the signature was created. @@ -38827,6 +39560,7 @@ 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. +Note that Exim does not check this value. .vitem &%$dkim_headernames%& A colon-separated list of names of headers included in the signature. @@ -38850,6 +39584,17 @@ Notes from the key record (tag n=). .vitem &%$dkim_key_length%& Number of bits in the key. + +Note that RFC 8301 says: +.code +Verifiers MUST NOT consider signatures using RSA keys of +less than 1024 bits as valid signatures. +.endd + +To enforce this you must have a DKIM ACL which checks this variable +and overwrites the &$dkim_verify_status$& variable as discussed above. +As EC keys are much smaller, the check should only do this for RSA keys. + .endlist In addition, two ACL conditions are provided: @@ -38889,6 +39634,179 @@ see the documentation of the &%$dkim_verify_status%& expansion variable above for more information of what they mean. .endlist + + + +.section "SPF (Sender Policy Framework)" SECSPF +.cindex SPF verification + +SPF is a mechanism whereby a domain may assert which IP addresses may transmit +messages with its domain in the envelope from, documented by RFC 7208. +For more information on SPF see &url(http://www.openspf.org). +. --- 2018-09-07: still not https + +Messages sent by a system not authorised will fail checking of such assertions. +This includes retransmissions done by traditional forwarders. + +SPF verification support is built into Exim if SUPPORT_SPF=yes is set in +&_Local/Makefile_&. The support uses the &_libspf2_& library +&url(https://www.libspf2.org/). +There is no Exim involvement in the transmission of messages; +publishing certain DNS records is all that is required. + +For verification, an ACL condition and an expansion lookup are provided. +.cindex authentication "expansion item" +Performing verification sets up information used by the +&$authresults$& expansion item. + + +.cindex SPF "ACL condition" +.cindex ACL "spf condition" +The ACL condition "spf" can be used at or after the MAIL ACL. +It takes as an argument a list of strings giving the outcome of the SPF check, +and will succeed for any matching outcome. +Valid strings are: +.vlist +.vitem &%pass%& +The SPF check passed, the sending host is positively verified by SPF. + +.vitem &%fail%& +The SPF check failed, the sending host is NOT allowed to send mail for the +domain in the envelope-from address. + +.vitem &%softfail%& +The SPF check failed, but the queried domain can't absolutely confirm that this +is a forgery. + +.vitem &%none%& +The queried domain does not publish SPF records. + +.vitem &%neutral%& +The SPF check returned a "neutral" state. This means the queried domain has +published a SPF record, but wants to allow outside servers to send mail under +its domain as well. This should be treated like "none". + +.vitem &%permerror%& +This indicates a syntax error in the SPF record of the queried domain. +You may deny messages when this occurs. + +.vitem &%temperror%& +This indicates a temporary error during all processing, including Exim's +SPF processing. You may defer messages when this occurs. +.endlist + +You can prefix each string with an exclamation mark to invert +its meaning, for example "!fail" will match all results but +"fail". The string list is evaluated left-to-right, in a +short-circuit fashion. + +Example: +.code +deny spf = fail + message = $sender_host_address is not allowed to send mail from \ + ${if def:sender_address_domain \ + {$sender_address_domain}{$sender_helo_name}}. \ + Please see http://www.openspf.org/Why?scope=\ + ${if def:sender_address_domain {mfrom}{helo}};\ + identity=${if def:sender_address_domain \ + {$sender_address}{$sender_helo_name}};\ + ip=$sender_host_address +.endd + +When the spf condition has run, it sets up several expansion +variables: + +.cindex SPF "verification variables" +.vlist +.vitem &$spf_header_comment$& +.vindex &$spf_header_comment$& + This contains a human-readable string describing the outcome + of the SPF check. You can add it to a custom header or use + it for logging purposes. + +.vitem &$spf_received$& +.vindex &$spf_received$& + This contains a complete Received-SPF: header that can be + added to the message. Please note that according to the SPF + draft, this header must be added at the top of the header + list. Please see section 10 on how you can do this. + + Note: in case of "Best-guess" (see below), the convention is + to put this string in a header called X-SPF-Guess: instead. + +.vitem &$spf_result$& +.vindex &$spf_result$& + This contains the outcome of the SPF check in string form, + one of pass, fail, softfail, none, neutral, permerror or + temperror. + +.vitem &$spf_result_guessed$& +.vindex &$spf_result_guessed$& + This boolean is true only if a best-guess operation was used + and required in order to obtain a result. + +.vitem &$spf_smtp_comment$& +.vindex &$spf_smtp_comment$& + This contains a string that can be used in a SMTP response + to the calling party. Useful for "fail". +.endlist + + +.cindex SPF "ACL condition" +.cindex ACL "spf_guess condition" +.cindex SPF "best guess" +In addition to SPF, you can also perform checks for so-called +"Best-guess". Strictly speaking, "Best-guess" is not standard +SPF, but it is supported by the same framework that enables SPF +capability. +Refer to &url(http://www.openspf.org/FAQ/Best_guess_record) +for a description of what it means. +. --- 2018-09-07: still not https: + +To access this feature, simply use the spf_guess condition in place +of the spf one. For example: + +.code +deny spf_guess = fail + message = $sender_host_address doesn't look trustworthy to me +.endd + +In case you decide to reject messages based on this check, you +should note that although it uses the same framework, "Best-guess" +is not SPF, and therefore you should not mention SPF at all in your +reject message. + +When the spf_guess condition has run, it sets up the same expansion +variables as when spf condition is run, described above. + +Additionally, since Best-guess is not standardized, you may redefine +what "Best-guess" means to you by redefining the main configuration +&%spf_guess%& option. +For example, the following: + +.code +spf_guess = v=spf1 a/16 mx/16 ptr ?all +.endd + +would relax host matching rules to a broader network range. + + +.cindex SPF "lookup expansion" +.cindex lookup spf +A lookup expansion is also available. It takes an email +address as the key and an IP address as the database: + +.code + ${lookup {username@domain} spf {ip.ip.ip.ip}} +.endd + +The lookup will return the same result strings as can appear in +&$spf_result$& (pass,fail,softfail,neutral,none,err_perm,err_temp). +Currently, only IPv4 addresses are supported. + + + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -38912,10 +39830,8 @@ that uses &"Proxy Protocol"& to speak to it. To include this support, include &"SUPPORT_PROXY=yes"& in Local/Makefile. -It was built on specifications from: -(&url(http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt)). -That URL was revised in May 2014 to version 2 spec: -(&url(http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e)). +It was built on the HAProxy specification, found at +&url(https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt). The purpose of this facility is so that an application load balancer, such as HAProxy, can sit in front of several Exim servers @@ -39050,7 +39966,7 @@ This will add a component tagged with &"PRX="& to the line. .cindex internationalisation "email address" .cindex EAI .cindex i18n -.cindex UTF-8 "mail name handling" +.cindex utf8 "mail name handling" Exim has support for Internationalised mail names. To include this it must be built with SUPPORT_I18N and the libidn library. @@ -39088,6 +40004,7 @@ form of the name. .cindex log protocol .cindex SMTPUTF8 logging +.cindex i18n logging Log lines and Received-by: header lines will acquire a "utf8" prefix on the protocol element, eg. utf8esmtp. @@ -39099,7 +40016,10 @@ ${utf8_localpart_to_alabel:str} ${utf8_localpart_from_alabel:str} .endd -ACLs may use the following modifier: +.cindex utf8 "address downconversion" +.cindex i18n "utf8 address downconversion" +The RCPT ACL +may use the following modifier: .display control = utf8_downconvert control = utf8_downconvert/ @@ -39117,6 +40037,12 @@ If a value is appended it may be: If mua_wrapper is set, the utf8_downconvert control is initially set to -1. +.new +The smtp transport has an option &%utf8_downconvert%&. +If set it must expand to one of the three values described above, +and it overrides any previously set value. +.wen + There is no explicit support for VRFY and EXPN. Configurations supporting these should inspect @@ -39143,7 +40069,7 @@ the "headers charset" command (in a filter file) or &%headers_charset%& main configuration option (otherwise), to the modified UTF-7 encoding specified by RFC 2060, -with the following exception: All occurences of +with the following exception: All occurrences of (which has to be a single character) are replaced with periods ("."), and all periods and slashes that are not and are not in the string are BASE64 encoded. @@ -39207,6 +40133,7 @@ expansion must check this, as it will be called for every possible event type. The current list of events is: .display +&`dane:fail after transport `& per connection &`msg:complete after main `& per message &`msg:delivery after transport `& per recipient &`msg:rcpt:host:defer after transport `& per recipient per host @@ -39229,15 +40156,16 @@ The second column in the table above describes whether the event fires before or after the action is associates with. Those which fire before can be used to affect that action (more on this below). -.new -The third column in the table above says what section of the configumration +The third column in the table above says what section of the configuration should define the event action. -.wen An additional variable, &$event_data$&, is filled with information varying with the event type: .display +&`dane:fail `& failure reason &`msg:delivery `& smtp confirmation message +&`msg:fail:internal `& failure reason +&`msg:fail:delivery `& smtp error message &`msg:rcpt:host:defer `& error string &`msg:rcpt:defer `& error string &`msg:host:defer `& error string @@ -39264,15 +40192,12 @@ The expansion of the event_action option should normally return an empty string. Should it return anything else the following will be forced: .display -&`msg:delivery `& (ignored) -&`msg:host:defer `& (ignored) -&`msg:fail:delivery`& (ignored) &`tcp:connect `& do not connect -&`tcp:close `& (ignored) &`tls:cert `& refuse verification &`smtp:connect `& close connection .endd -No other use is made of the result string. +All other message types ignore the result string, and +no other use is made of it. For a tcp:connect event, if the connection is being made to a proxy then the address and port variables will be that of the proxy and not