X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/0c9940588360567d54bafa8259e23939c61db676..d629c90c1c83ef1136008a4d6afeed9b6db903fc:/doc/doc-docbook/spec.xfpt diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index a2a02df45..21c494329 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.88" +.set previousversion "4.91" .include ./local_params .set ACL "access control lists (ACLs)" .set I "    " .macro copyyear -2016 +2018 .endmacro . ///////////////////////////////////////////////////////////////////////////// @@ -371,11 +371,13 @@ contributors. .section "Exim documentation" "SECID1" . Keep this example change bar when updating the documentation! +.new .cindex "documentation" This edition of the Exim specification applies to version &version() of Exim. Substantive changes from the &previousversion; edition are marked in some renditions of the document; this paragraph is so marked if the rendition is capable of showing a change indicator. +.wen This document is very much a reference manual; it is not a tutorial. The reader is expected to have some familiarity with the SMTP mail transfer protocol and @@ -434,6 +436,7 @@ directory are: .row &_filter.txt_& "specification of the filter language" .row &_Exim3.upgrade_& "upgrade notes from release 2 to release 3" .row &_Exim4.upgrade_& "upgrade notes from release 3 to release 4" +.row &_openssl.txt_& "installing a current OpenSSL release" .endtable The main specification and the specification of the filtering language are also @@ -445,12 +448,9 @@ 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" @@ -459,12 +459,14 @@ differently formatted versions of the documentation. A recent addition to the online information is the Exim wiki (&url(http://wiki.exim.org)), which contains what used to be a separate FAQ, as well as various other examples, tips, and know-how that have been contributed by Exim users. +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(http://bugs.exim.org). You can use +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" @@ -490,18 +492,11 @@ via this web page: Please ask Debian-specific questions on this list and not on the general Exim lists. -.section "Exim training" "SECID4" -.cindex "training courses" -Training courses in Cambridge (UK) used to be run annually by the author of -Exim, before he retired. At the time of writing, there are no plans to run -further Exim courses in Cambridge. However, if that changes, relevant -information will be posted at &url(http://www-tus.csx.cam.ac.uk/courses/exim/). - .section "Bug reports" "SECID5" .cindex "bug reports" .cindex "reporting bugs" Reports of obvious bugs can be emailed to &'bugs@exim.org'& or reported -via the Bugzilla (&url(http://bugs.exim.org)). However, if you are unsure +via the Bugzilla (&url(https://bugs.exim.org)). However, if you are unsure whether some behaviour is a bug or not, the best thing to do is to post a message to the &'exim-dev'& mailing list and have it discussed. @@ -509,30 +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 -.display -&*ftp://ftp.csx.cam.ac.uk/pub/software/email/exim*& -.endd -This is mirrored by +.cindex "distribution" "https site" +The master distribution site for the Exim distribution is .display -&*ftp://ftp.exim.org/pub/exim*& +&*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 &'https://downloads.exim.org/'& is identical to the +content served at &'https://ftp.exim.org/pub/exim'& and +&'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" @@ -546,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 @@ -575,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" @@ -1675,6 +1678,9 @@ Symbolic links to the sources are installed in this directory, which is where the actual building takes place. In most cases, Exim can discover the machine architecture and operating system for itself, but the defaults can be overridden if necessary. +.cindex compiler requirements +.cindex compiler version +A C99-capable compiler will be required for the build. .section "PCRE library" "SECTpcre" @@ -2796,6 +2802,11 @@ 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. +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. + .vitem &%-bem%&&~<&'filename'&> .oindex "&%-bem%&" .cindex "testing" "string expansion" @@ -3162,6 +3173,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%&" @@ -3825,11 +3838,17 @@ 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 the remote host supports the ESMTP &_DSN_& extension. -.vitem &%-MCG%& +.vitem &%-MCG%&&~<&'queue&~name'&> .oindex "&%-MCG%&" 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 -alternate queue is used, named by the following option. +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 a +remote host supports the ESMTP &_CHUNKING_& extension. .vitem &%-MCP%& .oindex "&%-MCP%&" @@ -3859,6 +3878,13 @@ 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. +.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. + .vitem &%-Mc%&&~<&'message&~id'&>&~<&'message&~id'&>&~... .oindex "&%-Mc%&" .cindex "hints database" "not overridden by &%-Mc%&" @@ -4267,7 +4293,7 @@ or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard SMTP protocol names (see the description of &$received_protocol$& in section &<>&). For &%-bs%&, the protocol is always &"local-"& followed by one of those same names. For &%-bS%& (batched SMTP) however, the protocol can -be set by &%-oMr%&. +be set by &%-oMr%&. Repeated use of this option is not supported. .vitem &%-oMs%&&~<&'host&~name'&> .oindex "&%-oMs%&" @@ -4367,6 +4393,7 @@ host name and its colon can be omitted when only the protocol is to be set. Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer to embedded Perl. It is therefore impossible to set a protocol value of &`d`& or &`s`& using this option (but that does not seem a real limitation). +Repeated use of this option is not supported. .vitem &%-q%& .oindex "&%-q%&" @@ -4479,7 +4506,7 @@ will specify a queue to operate on. For example: .code exim -bp -qGquarantine -mailq -qGquarantime +mailq -qGquarantine exim -qGoffpeak -Rf @special.domain.example .endd @@ -4918,7 +4945,9 @@ using this syntax: .endd on a line by itself. Double quotes round the file name are optional. If you use the first form, a configuration error occurs if the file does not exist; the -second form does nothing for non-existent files. In all cases, an absolute file +second form does nothing for non-existent files. +The first form allows a relative name. It is resolved relative to +the directory of the including file. For the second form an absolute file name is required. Includes may be nested to any depth, but remember that Exim reads its @@ -4937,11 +4966,6 @@ Include processing happens after macro processing (see below). Its effect is to process the lines of the included file as if they occurred inline where the inclusion appears. -Relative names are allowed with &`.include`&, and are resolved -relative to the directory of the including file. For security reasons -this is not allowed with &`.include_if_exists`&. To avoid confusion, it -is strongly recommended to use absolute names only. - .section "Macros in the configuration file" "SECTmacrodefs" @@ -5568,19 +5592,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 @@ -6731,8 +6763,8 @@ PostgreSQL database. See section &<>&. .next .cindex "Redis lookup type" .cindex lookup Redis -&(redis)&: The format of the query is an SQL statement that is passed to a -Redis database. See section &<>&. +&(redis)&: The format of the query is either a simple get or simple set, +passed to a Redis database. See section &<>&. .next .cindex "sqlite lookup type" @@ -7110,7 +7142,7 @@ Retries for the dnsdb lookup can be controlled by a retry modifier. The form if &"retry_VAL"& where VAL is an integer. The default count is set by the main configuration option &%dns_retry%&. -.cindex cacheing "of dns lookup" +.cindex caching "of dns lookup" .cindex TTL "of dns lookup" .cindex DNS TTL Dnsdb lookup results are cached within a single process (and its children). @@ -7805,6 +7837,28 @@ are rejected after a timeout period, during which the SQLite library waits for the lock to be released. In Exim, the default timeout is set to 5 seconds, but it can be changed by means of the &%sqlite_lock_timeout%& option. + +.section "More about Redis" "SECTredis" +.cindex "lookup" "Redis" +.cindex "redis lookup type" +Redis is a non-SQL database. Commands are simple get and set. +Examples: +.code +${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 @@ -9103,9 +9157,34 @@ 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 cerificate fields" +.cindex "expansion" "extracting certificate fields" .cindex "&%certextract%&" "certificate fields" .cindex "certificate" "extracting fields" The <&'certificate'&> must be a variable of type certificate. @@ -9315,7 +9394,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. @@ -9355,11 +9434,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" @@ -9372,7 +9454,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 @@ -9380,6 +9462,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 @@ -9423,17 +9514,13 @@ filter. Header lines that are added to a particular copy of a message by a router or transport are not accessible. For incoming SMTP messages, no header lines are visible in -.new ACLs that are obeyed before the data phase completes, -.wen because the header structure is not set up until the message is received. They are visible in DKIM, PRDR and DATA ACLs. Header lines that are added in a RCPT ACL (for example) are saved until the message's incoming header lines are available, at which point they are added. -.new When any of the above ACLs ar -.wen running, however, header lines added by earlier ACLs are visible. Upper case and lower case letters are synonymous in header names. If the @@ -9761,7 +9848,7 @@ locks out the use of this expansion item in filter files. .vitem "&*${readsocket{*&<&'name'&>&*}{*&<&'request'&>&*}&&& - {*&<&'timeout'&>&*}{*&<&'eol&~string'&>&*}{*&<&'fail&~string'&>&*}}*&" + {*&<&'options'&>&*}{*&<&'eol&~string'&>&*}{*&<&'fail&~string'&>&*}}*&" .cindex "expansion" "inserting from a socket" .cindex "socket, use of in expansion" .cindex "&%readsocket%& expansion item" @@ -9791,6 +9878,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'&. +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: @@ -9943,7 +10050,7 @@ a regular expression, and a substitution string. For example: ${sg{abcdefabcdef}{abc}{xyz}} .endd yields &"xyzdefxyzdef"&. Because all three arguments are expanded before use, -if any $ or \ characters are required in the regular expression or in the +if any $, } or \ characters are required in the regular expression or in the substitution string, they have to be escaped. For example: .code ${sg{abcdef}{^(...)(...)\$}{\$2\$1}} @@ -10094,7 +10201,15 @@ character. For example: .code ${addresses:>& Chief , sec@base.ment (dogsbody)} .endd -expands to &`ceo@up.stairs&&sec@base.ment`&. Compare the &*address*& (singular) +expands to &`ceo@up.stairs&&sec@base.ment`&. The string is expanded +first, so if the expanded string starts with >, it may change the output +separator unintentionally. This can be avoided by setting the output +separator explicitly: +.code +${addresses:>:$h_from:} +.endd + +Compare the &*address*& (singular) expansion item, which extracts the working address from a single RFC2822 address. See the &*filter*&, &*map*&, and &*reduce*& items for ways of processing lists. @@ -10310,7 +10425,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. @@ -10602,7 +10717,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'&>&*}*& @@ -11011,9 +11128,12 @@ colon-separated components are permitted, each containing from one to four hexadecimal digits. There may be fewer than eight components if an empty component (adjacent colons) is present. Only one empty component is permitted. -&*Note*&: The checks are just on the form of the address; actual numerical -values are not considered. Thus, for example, 999.999.999.999 passes the IPv4 -check. The main use of these tests is to distinguish between IP addresses and +&*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. + +The main use of these tests is to distinguish between IP addresses and host names, or between IPv4 and IPv6 addresses. For example, you could use .code ${if isip4{$sender_host_address}... @@ -11170,8 +11290,8 @@ example is: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}} .endd In each case, the second argument may contain any of the allowable items for a -list of the appropriate type. Also, because the second argument (after -expansion) is a standard form of list, it is possible to refer to a named list. +list of the appropriate type. Also, because the second argument +is a standard form of list, it is possible to refer to a named list. Thus, you can use conditions like this: .code ${if match_domain{$domain}{+local_domains}{... @@ -11501,10 +11621,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 inforamtion used by the +&$authresults$& expansion item. .vitem &$authenticated_fail_id$& .cindex "authentication" "fail" "id" @@ -11621,8 +11744,11 @@ 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$& +Results of DKIM verification. +For details see section &<>&. + .vitem &$dkim_cur_signer$& &&& - &$dkim_verify_status$& &&& &$dkim_verify_reason$& &&& &$dkim_domain$& &&& &$dkim_identity$& &&& @@ -11642,13 +11768,13 @@ The name of the main configuration file Exim is using. &$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$& &&& @@ -11841,6 +11967,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$&. @@ -12042,6 +12173,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). +It is not valid if the &%spool_files_wireformat%& option is used. .vitem &$message_age$& .cindex "message" "age of" @@ -12084,6 +12216,10 @@ 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$&. +If the spool file is wireformat +(see the &%spool_files_wireformat%& main option) +the CRLF line-terminators are included in the count. + .vitem &$message_exim_id$& .vindex "&$message_exim_id$&" When a message is being received or delivered, this variable contains the @@ -12134,6 +12270,8 @@ 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. +This variable is not valid if the &%spool_files_wireformat%& option is used. + .vitem &$message_size$& .cindex "size" "of message" .cindex "message" "size" @@ -12210,7 +12348,7 @@ normally the gid of the Exim user. .cindex "uid (user id)" "of originating user" .cindex "sender" "uid" .vindex "&$caller_uid$&" -.vindex "&$originaltor_uid$&" +.vindex "&$originator_uid$&" The value of &$caller_uid$& that was set when the message was received. For messages received via the command line, this is the uid of the sending user. For messages received by SMTP over TCP/IP, this is normally the uid of the Exim @@ -12257,7 +12395,7 @@ qualified host name. See also &$smtp_active_hostname$&. &$proxy_local_port$& &&& &$proxy_session$& These variables are only available when built with Proxy Protocol -or Socks5 support +or SOCKS5 support. For details see chapter &<>&. .vitem &$prdr_requested$& @@ -12607,6 +12745,11 @@ validating resolver (e.g. unbound, or bind with suitable configuration). If you have changed &%host_lookup_order%& so that &`bydns`& is not the first mechanism in the list, then this variable will be false. +This requires that your system resolver library support EDNS0 (and that +DNSSEC flags exist in the system headers). If the resolver silently drops +all EDNS0 options, then this will have no effect. OpenBSD's asr resolver +is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3). + .vitem &$sender_host_name$& .vindex "&$sender_host_name$&" @@ -12749,6 +12892,13 @@ argument, that is, the text that follows the command name, with leading white space removed. Following the introduction of &$smtp_command$&, this variable is somewhat redundant, but is retained for backwards compatibility. +.vitem &$smtp_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. + .vitem &$smtp_count_at_connection_start$& .vindex "&$smtp_count_at_connection_start$&" This variable is set greater than zero only in processes spawned by the Exim @@ -12773,6 +12923,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$&" @@ -12828,13 +12985,17 @@ If TLS has not been negotiated, the value will be 0. .vitem &$tls_in_ourcert$& .vindex "&$tls_in_ourcert$&" -.cindex certificate veriables +.cindex certificate variables This variable refers to the certificate presented to the peer of an inbound connection when the message was received. It is only useful as the argument of a &%certextract%& expansion item, &%md5%&, &%sha1%& or &%sha256%& operator, or a &%def%& condition. +&*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. + .vitem &$tls_in_peercert$& .vindex "&$tls_in_peercert$&" This variable refers to the certificate presented by the peer of an @@ -12898,6 +13059,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 @@ -12963,6 +13128,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 @@ -13098,7 +13267,7 @@ initial startup, even if &%perl_at_start%& is set. .oindex "&%perl_taintmode%&" .cindex "Perl" "taintmode" To provide more security executing Perl code via the embedded Perl -interpeter, the &%perl_taintmode%& option can be set. This enables the +interpreter, the &%perl_taintmode%& option can be set. This enables the taint mode of the Perl interpreter. You are encouraged to set this option to a true value. To avoid breaking existing installations, it defaults to false. @@ -13337,23 +13506,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 @@ -13528,6 +13706,7 @@ listed in more than one group. .section "Miscellaneous" "SECID96" .table2 .row &%bi_command%& "to run for &%-bi%& command line option" +.row &%debug_store%& "do extra internal checks" .row &%disable_ipv6%& "do no IPv6 processing" .row &%keep_malformed%& "for broken files &-- should not happen" .row &%localhost_number%& "for unique message ids in clusters" @@ -13535,6 +13714,7 @@ listed in more than one group. .row &%message_body_visible%& "how much to show in &$message_body$&" .row &%mua_wrapper%& "run in &""MUA wrapper""& mode" .row &%print_topbitchars%& "top-bit characters are printing" +.row &%spool_wireformat%& "use wire-format spool data files when possible" .row &%timezone%& "force time zone" .endtable @@ -13554,6 +13734,7 @@ listed in more than one group. .section "Privilege controls" "SECID98" .table2 .row &%admin_groups%& "groups that are Exim admin users" +.row &%commandline_checks_require_admin%& "require admin for various checks" .row &%deliver_drop_privilege%& "drop root for delivery processes" .row &%local_from_check%& "insert &'Sender:'& if necessary" .row &%local_from_prefix%& "for testing &'From:'& for local sender" @@ -13703,6 +13884,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" @@ -14018,8 +14200,9 @@ acknowledgment is sent. See chapter &<>& for further details. .option acl_smtp_dkim main string&!! unset .cindex DKIM "ACL for" 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" @@ -14405,7 +14588,7 @@ it obviously cannot send an error message of any kind. There is a slight performance penalty for these checks. Versions of Exim preceding 4.88 had these disabled by default; -high-rate intallations confident they will never run out of resources +high-rate installations confident they will never run out of resources may wish to deliberately disable them. .option chunking_advertise_hosts main "host list&!!" * @@ -14415,6 +14598,19 @@ 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. +.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%&. + +.option debug_store main boolean &`false`& +.cindex debugging "memory corruption" +.cindex memory debugging +This option, when true, enables extra checking in Exim's internal memory +management. For use when a memory corruption issue is being investigated, +it should normally be left as default. + .option daemon_smtp_ports main string &`smtp`& .cindex "port" "for daemon" .cindex "TCP/IP" "setting listening ports" @@ -14539,7 +14735,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 @@ -14591,6 +14787,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" @@ -14605,6 +14814,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 @@ -14664,6 +14874,7 @@ record in the authoritative section is used instead. .option dns_use_edns0 main integer -1 .cindex "DNS" "resolver options" .cindex "DNS" "EDNS0" +.cindex "DNS" "OpenBSD If this option is set to a non-negative number then Exim will initialise the DNS resolver library to either use or not use EDNS0 extensions, overriding the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0 @@ -14671,6 +14882,10 @@ on. If the resolver library does not support EDNS0 then this option has no effect. +OpenBSD's asr resolver routines are known to ignore the EDNS0 option; this +means that DNSSEC will not work with Exim on that platform either, unless Exim +is linked against an alternative DNS client library. + .option drop_cr main boolean false This is an obsolete option that is now a no-op. It used to affect the way Exim @@ -14904,7 +15119,7 @@ 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/_&. @@ -15294,6 +15509,7 @@ connecting on a regular LDAP port. This is the LDAP equivalent of SMTP's of SSL-on-connect. In the event of failure to negotiate TLS, the action taken is controlled by &%ldap_require_cert%&. +This option is ignored for &`ldapi`& connections. .option ldap_version main integer unset @@ -15634,7 +15850,7 @@ harm. This option overrides the &%pipe_as_creator%& option of the &(pipe)& transport driver. -.option openssl_options main "string list" "+no_sslv2 +single_dh_use" +.option openssl_options main "string list" "+no_sslv2 +single_dh_use +no_ticket" .cindex "OpenSSL "compatibility options" This option allows an administrator to adjust the SSL options applied by OpenSSL to connections. It is given as a space-separated list of items, @@ -15883,12 +16099,13 @@ different spool directories. .option prod_requires_admin main boolean true +.cindex "restricting access to features" .oindex "&%-M%&" .oindex "&%-R%&" .oindex "&%-q%&" The &%-M%&, &%-R%&, and &%-q%& command-line options require the caller to be an admin user unless &%prod_requires_admin%& is set false. See also -&%queue_list_requires_admin%&. +&%queue_list_requires_admin%& and &%commandline_checks_require_admin%&. .option qualify_domain main string "see below" @@ -15927,10 +16144,12 @@ next queue run. See also &%hold_domains%& and &%queue_smtp_domains%&. .option queue_list_requires_admin main boolean true +.cindex "restricting access to features" .oindex "&%-bp%&" The &%-bp%& command-line option, which lists the messages that are on the queue, requires the caller to be an admin user unless -&%queue_list_requires_admin%& is set false. See also &%prod_requires_admin%&. +&%queue_list_requires_admin%& is set false. +See also &%prod_requires_admin%& and &%commandline_checks_require_admin%&. .option queue_only main boolean false @@ -16710,22 +16929,24 @@ example, instead of &"Administrative prohibition"&, it might give: .option smtputf8_advertise_hosts main "host list&!!" * .cindex "SMTPUTF8" "advertising" When Exim is built with support for internationalised mail names, -the availability therof is advertised in +the availability thereof is advertised in 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" @@ -16776,6 +16997,30 @@ 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. +.option spool_wireformat main boolean false +.cindex "spool directory" "file formats" +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 ESMTP CHUNKING +option. + +The following variables will not have useful values: +.code +$max_received_linelength +$body_linecount +$body_zerocount +.endd + +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 different formats potentially available. + +Using any of the ACL conditions noted will negate the reception benefit +(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" This option controls the timeout that the &(sqlite)& lookup uses when trying to @@ -16867,6 +17112,7 @@ generates any deliveries to files or pipes, or any new mail messages, the appropriate &%system_filter_..._transport%& option(s) must be set, to define which transports are to be used. Details of this facility are given in chapter &<>&. +A forced expansion failure results in no filter operation. .option system_filter_directory_transport main string&!! unset @@ -16981,11 +17227,13 @@ using the &%tls_certificate%& option. If TLS support for incoming connections is not required the &%tls_advertise_hosts%& option should be set empty. -.option tls_certificate main string&!! unset +.option tls_certificate main string list&!! unset .cindex "TLS" "server certificate; location of" .cindex "certificate" "server, location of" -The value of this option is expanded, and must then be the absolute path to a -file which contains the server's certificates. The server's private key is also +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. +The server's private key is also assumed to be in this file if &%tls_privatekey%& is unset. See chapter &<>& for further details. @@ -16994,6 +17242,16 @@ 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. +&*Note*&: If you use filenames based on IP addresses, change the list +separator in the usual way to avoid confusion under IPv6. + +&*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 Server Name Indication extension, then this option and others documented in @@ -17006,7 +17264,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. @@ -17109,7 +17373,8 @@ acceptable bound from 1024 to 2048. .option tls_eccurve main string&!! &`auto`& .cindex TLS "EC cryptography" -This option selects a EC curve for use by Exim. +This option selects a EC curve for use by Exim when used with OpenSSL. +It has no effect when Exim is used with GnuTLS. After expansion it must contain a valid EC curve parameter, such as &`prime256v1`&, &`secp384r1`&, or &`P-512`&. Consult your OpenSSL manual @@ -17132,21 +17397,26 @@ 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 &<>&. -.option tls_privatekey main string&!! unset +.option tls_privatekey main string list&!! unset .cindex "TLS" "server private key; location of" -The value of this option is expanded, and must then be the absolute path to a -file which contains the server's private key. If this option is unset, or if +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. +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 &<>& for further details. @@ -18592,7 +18862,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. @@ -18725,6 +18995,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" @@ -19329,8 +19615,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 @@ -19350,6 +19636,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: @@ -19369,6 +19659,10 @@ instead of TRY_AGAIN. That is why the default action is to try a DNS lookup first. Only if that gives a definite &"no such host"& is the local function called. +&*Compatibility*&: From Exim 4.85 until fixed for 4.90, there was an +inadvertent constraint that a transport name as an option had to be the last +option specified. + If no IP address for a host can be found, what happens is controlled by the @@ -20246,11 +20540,15 @@ relative path is then passed to the transport unmodified. .option forbid_blackhole redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, the &':blackhole:'& item may not appear in a redirection list. .option forbid_exim_filter redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is set true, only Sieve filters are permitted when &%allow_filter%& is true. @@ -20258,7 +20556,9 @@ If this option is set true, only Sieve filters are permitted when .option forbid_file redirect boolean false +.cindex "restricting access to features" .cindex "delivery" "to file; forbidding" +.cindex "filter" "locking out certain features" .cindex "Sieve filter" "forbidding delivery to a file" .cindex "Sieve filter" "&""keep""& facility; disabling" If this option is true, this router may not generate a new address that @@ -20269,17 +20569,22 @@ locks out the Sieve's &"keep"& facility. .option forbid_filter_dlfunc redirect boolean false +.cindex "restricting access to features" .cindex "filter" "locking out certain features" If this option is true, string expansions in Exim filters are not allowed to make use of the &%dlfunc%& expansion facility to run dynamically loaded functions. .option forbid_filter_existstest redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" .cindex "expansion" "statting a file" If this option is true, string expansions in Exim filters are not allowed to make use of the &%exists%& condition or the &%stat%& expansion item. .option forbid_filter_logwrite redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, use of the logging facility in Exim filters is not permitted. Logging is in any case available only if the filter is being run under some unprivileged uid (which is normally the case for ordinary users' @@ -20287,27 +20592,37 @@ under some unprivileged uid (which is normally the case for ordinary users' .option forbid_filter_lookup redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, string expansions in Exim filter files are not allowed to make use of &%lookup%& items. .option forbid_filter_perl redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" This option has an effect only if Exim is built with embedded Perl support. If it is true, string expansions in Exim filter files are not allowed to make use of the embedded Perl support. .option forbid_filter_readfile redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, string expansions in Exim filter files are not allowed to make use of &%readfile%& items. .option forbid_filter_readsocket redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, string expansions in Exim filter files are not allowed to make use of &%readsocket%& items. .option forbid_filter_reply redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, this router may not generate an automatic reply message. Automatic replies can be generated only from Exim or Sieve filter files, not from traditional forward files. This option is forced to be true if @@ -20315,11 +20630,15 @@ files, not from traditional forward files. This option is forced to be true if .option forbid_filter_run redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, string expansions in Exim filter files are not allowed to make use of &%run%& items. .option forbid_include redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is true, items of the form .code :include: @@ -20328,6 +20647,8 @@ are not permitted in non-filter redirection lists. .option forbid_pipe redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" .cindex "delivery" "to pipe; forbidding" If this option is true, this router may not generate a new address which specifies delivery to a pipe, either from an Exim filter or from a conventional @@ -20335,6 +20656,8 @@ forward file. This option is forced to be true if &%one_time%& is set. .option forbid_sieve_filter redirect boolean false +.cindex "restricting access to features" +.cindex "filter" "locking out certain features" If this option is set true, only Exim filters are permitted when &%allow_filter%& is true. @@ -21003,7 +21326,7 @@ The control does not apply to shadow transports. .cindex "hints database" "transport concurrency control" Exim implements this control by means of a hints database in which a record is -incremented whenever a transport process is beaing created. The record +incremented whenever a transport process is being created. The record is decremented and possibly removed when the process terminates. Obviously there is scope for records to get left lying around if there is a system or program crash. To @@ -21999,10 +22322,14 @@ the obvious value which users understand most easily. The value of the option is expanded, and must then be a numerical value (decimal point allowed), optionally followed by one of the letters K, M, or G, -for kilobytes, megabytes, or gigabytes. If Exim is running on a system with +for kilobytes, megabytes, or gigabytes, optionally followed by a slash +and further option modifiers. If Exim is running on a system with large file support (Linux and FreeBSD have this), mailboxes larger than 2G can be handled. +The option modifier &%no_check%& can be used to force delivery even if the over +quota condition is met. The quota gets updated as usual. + &*Note*&: A value of zero is interpreted as &"no quota"&. The expansion happens while Exim is running as root, before it changes uid for @@ -22037,6 +22364,8 @@ can only be used if &%quota%& is also set. The value is expanded; an expansion failure causes delivery to be deferred. A value of zero is interpreted as &"no quota"&. +The option modifier &%no_check%& can be used to force delivery even if the over +quota condition is met. The quota gets updated as usual. .option quota_is_inclusive appendfile boolean true See &%quota%& above. @@ -23261,9 +23590,7 @@ message_suffix = .option path pipe string&!! "/bin:/usr/bin" -.new This option is expanded and -.wen specifies the string that is set up in the PATH environment variable of the subprocess. If the &%command%& option does not yield an absolute path name, the command is @@ -23638,18 +23965,37 @@ 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_domain smtp string&!! unset -.option dkim_selector smtp string&!! unset -.option dkim_private_key smtp string&!! unset .option dkim_canon smtp string&!! unset +.option dkim_domain smtp string list&!! unset +.option dkim_hash smtp string&!! sha256 +.option dkim_identity smtp string&!! unset +.option dkim_private_key smtp string&!! unset +.option dkim_selector smtp string&!! unset .option dkim_strict smtp string&!! unset -.option dkim_sign_headers smtp string&!! unset +.option dkim_sign_headers smtp string&!! "per RFC" +.option dkim_timestamps smtp string&!! unset DKIM signing options. For details see section &<>&. @@ -23893,6 +24239,23 @@ 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. +.option hosts_noproxy_tls smtp "host list&!!" * +.cindex "TLS" "passing connection" +.cindex "multiple SMTP deliveries" +.cindex "TLS" "multiple message deliveries" +For any host that matches this list, a TLS session which has +been started will not be passed to a new delivery process for sending another +message on the same session. + +The traditional implementation closes down TLS and re-starts it in the new +process, on the same open TCP connection, for each successive message +sent. If permitted by this option a pipe to to the new process is set up +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. + + .option hosts_override smtp boolean false If this option is set and the &%hosts%& option is also set, any hosts that are @@ -23940,6 +24303,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 @@ -23967,12 +24339,22 @@ unauthenticated. See also &%hosts_require_auth%&, and chapter .cindex "RFC 3030" "CHUNKING" 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 conjuction with a transport filter. - -.option hosts_try_fastopen smtp "host list!!" unset -.option "fast open, TCP" "enabling, in client" -.option "TCP Fast Open" "enabling, in client" -.option "RFC 7413" "TCP Fast Open" +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" +.cindex "RFC 7413" "TCP Fast Open" This option provides a list of servers to which, provided the facility is supported by this system, Exim will attempt to perform a TCP Fast Open. @@ -23985,6 +24367,9 @@ 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 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&!!" * .cindex "PRDR" "enabling, optional in client" @@ -25771,6 +26156,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. + @@ -25861,6 +26250,17 @@ turned into a permanent error if you wish. In the second case, Exim tries to deliver the message unauthenticated. .endlist +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 +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. +No authentication will then be done, despite the names being identical. + +For such cases use a separate transport which always authenticates. + .cindex "AUTH" "on MAIL command" When Exim has authenticated itself to a remote server, it adds the AUTH parameter to the MAIL commands it sends, if it has an authenticated sender for @@ -26380,7 +26780,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: @@ -26430,15 +26830,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 @@ -26446,7 +26848,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" @@ -26834,22 +27240,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 @@ -26861,7 +27281,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. @@ -26916,6 +27336,9 @@ 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 +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. +.next Some other recently added features may only be available in one or the other. This should be documented with the feature. If the documentation does not explicitly state that the feature is infeasible in the other TLS @@ -27011,7 +27434,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 @@ -27071,6 +27497,22 @@ tls_require_ciphers = ${if =={$received_port}{25}\ {HIGH:!MD5:!SHA1}} .endd +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 .section "Requiring specific ciphers or other parameters in GnuTLS" &&& @@ -27132,10 +27574,12 @@ tls_require_ciphers = ${if =={$received_port}{25}\ .cindex "TLS" "configuring an Exim server" When Exim has been built with TLS support, it advertises the availability of the STARTTLS command to client hosts that match &%tls_advertise_hosts%&, -but not to any others. The default value of this option is unset, which means -that STARTTLS is not advertised at all. This default is chosen because you -need to set some other options in order to make TLS available, and also it is -sensible for systems that want to use TLS only as a client. +but not to any others. The default value of this option is *, which means +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. If a client issues a STARTTLS command and there is some configuration problem in the server, the command is rejected with a 454 error. If the client @@ -27157,8 +27601,7 @@ from someone able to intercept the communication. Further protection requires some further configuration at the server end. -It is rumoured that all existing clients that support TLS/SSL use RSA -encryption. To make this work you need to set, in the server, +To make TLS work you need to set, in the server, .code tls_certificate = /some/file/name tls_privatekey = /some/file/name @@ -27177,6 +27620,13 @@ 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. +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. + 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 few comments below in section &<>&.) @@ -27410,11 +27860,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%&. @@ -27512,19 +27961,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 @@ -27532,7 +27976,7 @@ Great care should be taken to deal with matters of case, various injection attacks in the string (&`../`& or SQL), and ensuring that a valid filename can always be referenced; it is important to remember that &$tls_in_sni$& is arbitrary unverified data provided prior to authentication. -Further, the initial cerificate is loaded before SNI is arrived, so +Further, the initial certificate is loaded before SNI is arrived, so an expansion for &%tls_certificate%& must have a default which is used when &$tls_in_sni$& is empty. @@ -27559,8 +28003,15 @@ 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 of TLS, because there is quite a lot of state information associated with a TLS connection, not just a socket identification. Passing all the state information -to a new process is not feasible. Consequently, Exim shuts down an existing TLS -session before passing the socket to a new process. The new process may then +to a new process is not feasible. Consequently, for sending using TLS Exim +starts an additional proxy process for handling the encryption, piping the +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 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 if AUTH is in use, before sending the next message. @@ -27681,6 +28132,202 @@ Open-source PKI book, available online at +.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 cerver 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). + + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -27888,7 +28535,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" @@ -28005,8 +28652,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. @@ -28076,6 +28723,9 @@ run. A &"discard"& return from the DATA or the non-SMTP ACL discards all the remaining recipients. The &"discard"& return is not permitted for the &%acl_smtp_predata%& ACL. +If the ACL for VRFY returns &"accept"&, a recipient verify (without callout) +is done on the address and the result determines the SMTP response. + .cindex "&[local_scan()]& function" "when all recipients discarded" The &[local_scan()]& function is always run, even if there are no remaining @@ -28763,6 +29413,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 @@ -28786,6 +29438,7 @@ This modifier puts a value into one of the ACL variables (see section .vitem &*udpsend*&&~=&~<&'parameters'&> +.cindex "UDP communications" This modifier sends a UDP packet, for purposes such as statistics collection or behaviour monitoring. The parameters are expanded, and the result of the expansion must be a colon-separated list consisting @@ -28885,6 +29538,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. +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. All the usual ACLs are called; if one results in the message being rejected, all effort spent in delivery (including the costs on @@ -28895,7 +29551,9 @@ message body. Cutthrough delivery is not supported via transport-filters or when DKIM signing of outgoing messages is done, because it sends data to the ultimate destination before the entire message has been received from the source. -It is not supported for messages received with the SMTP PRDR option in use. +It is not supported for messages received with the SMTP PRDR +or CHUNKING +options in use. Should the ultimate destination system positively accept or reject the mail, a corresponding indication is given to the source system and nothing is queued. @@ -28909,7 +29567,7 @@ This behaviour can be adjusted by appending the option &*defer=*&<&'value'&> to the control; the default value is &"spool"& and the alternate value &"pass"& copies an SMTP defer response from the target back to the initiator and does not queue the message. -Note that this is independent of any receipient verify conditions in the ACL. +Note that this is independent of any recipient verify conditions in the ACL. Delivery in this mode avoids the generation of a bounce mail to a (possibly faked) @@ -28920,12 +29578,14 @@ sender when the destination system is doing content-scan based rejection. .cindex "&ACL;" "enabling debug logging" .cindex "debugging" "enabling from an ACL" This control turns on debug logging, almost as though Exim had been invoked -with &`-d`&, with the output going to a new logfile, by default called -&'debuglog'&. The filename can be adjusted with the &'tag'& option, which +with &`-d`&, with the output going to a new logfile in the usual logs directory, +by default called &'debuglog'&. +The filename can be adjusted with the &'tag'& option, which may access any variables already defined. The logging may be adjusted with the &'opts'& option, which takes the same values as the &`-d`& command-line option. -Logging may be stopped, and the file removed, with the &'kill'& option. +Logging started this way may be stopped, and the file removed, +with the &'kill'& option. Some examples (which depend on variables that don't exist in all contexts): .code @@ -28941,7 +29601,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'&> @@ -29287,9 +29947,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 @@ -29746,6 +30407,13 @@ to avoid doing it more than once per message. .cindex "&%verify%& ACL condition" This is a variation of the previous option, in which a modified address is verified as a sender. + +Note that '/' is legal in local-parts; if the address may have such +(eg. is generated from the received message) +they must be protected from the options parsing by doubling: +.code +verify = sender=${sg{${address:$h_sender:}}{/}{//}} +.endd .endlist @@ -29805,7 +30473,7 @@ deny dnslists = blackholes.mail-abuse.org warn message = X-Warn: sending host is on dialups list dnslists = dialups.mail-abuse.org .endd -.cindex cacheing "of dns lookup" +.cindex caching "of dns lookup" .cindex DNS TTL DNS list lookups are cached by Exim for the duration of the SMTP session (but limited by the DNS return TTL value), @@ -29918,7 +30586,7 @@ multiple DNS records. The inner dnsdb lookup produces a list of MX hosts and the outer dnsdb lookup finds the IP addresses for these hosts. The result of expanding the condition might be something like this: .code -dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|... +dnslists = sbl.spamhaus.org/<|192.168.2.3|192.168.5.6|... .endd Thus, this example checks whether or not the IP addresses of the sender domain's mail servers are on the Spamhaus black list. @@ -30170,7 +30838,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 = \ @@ -30188,7 +30856,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 : \ @@ -30399,13 +31067,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 @@ -30576,6 +31246,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 + @@ -30808,6 +31487,21 @@ command when performing the callout, instead of an empty address. There is no 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. + +.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 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. +The advantage is only gained if there are no callout cache hits +(which could be enforced by the no_cache option), +if the use_sender option is used, +if neither the random nor the use_postmaster option is used, +and if no other callouts intervene. .endlist If you use any of the parameters that set a non-empty sender for the MAIL @@ -31041,6 +31735,7 @@ address and some time-based randomizing information. The &%prvs%& expansion item creates a signed address, and the &%prvscheck%& expansion item checks one. The syntax of these expansion items is described in section &<>&. +The validity period on signed addresses is seven days. As an example, suppose the secret per-address keys are stored in an MySQL database. A query to look up the key for an address could be defined as a macro @@ -31273,25 +31968,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 @@ -31308,6 +32013,9 @@ $ 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" @@ -31358,11 +32066,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 @@ -31442,6 +32148,16 @@ For example: .code av_scanner = f-protd:localhost 10200-10204 .endd +If you omit the argument, the default values shown above are used. + +.vitem &%f-prot6d%& +.cindex "virus scanners" "f-prot6d" +The f-prot6d scanner is accessed using the FPSCAND protocol over TCP. +One argument is taken, being a space-separated hostname and port number. +For example: +.code +av_scanner = f-prot6d:localhost 10200 +.endd If you omit the argument, the default values show above are used. .vitem &%fsecure%& @@ -31487,14 +32203,16 @@ an address (which may be an IP address and port, or the path of a Unix socket), a commandline to send (may include a single %s which will be replaced with the path to the mail file to be scanned), an RE to trigger on from the returned data, -an RE to extract malware_name from the returned data. +and an RE to extract malware_name from the returned data. For example: .code -av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$ +av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$ .endd -Default for the socket specifier is &_/tmp/malware.sock_&. -Default for the commandline is &_%s\n_&. -Both regular-expressions are required. +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. .vitem &%sophie%& .cindex "virus scanners" "Sophos and Sophie" @@ -32014,7 +32732,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 @@ -32127,10 +32845,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 @@ -32334,9 +33057,11 @@ C variables are as follows: .vlist .vitem &*int&~body_linecount*& This variable contains the number of lines in the message's body. +It is not valid if the &%spool_files_wireformat%& option is used. .vitem &*int&~body_zerocount*& This variable contains the number of binary zero bytes in the message's body. +It is not valid if the &%spool_files_wireformat%& option is used. .vitem &*unsigned&~int&~debug_selector*& This variable is set to zero when no debugging is taking place. Otherwise, it @@ -35660,6 +36385,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. +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. .cindex "delivery" "cutthrough; logging" .cindex "cutthrough" "logging" @@ -35764,6 +36493,7 @@ 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 @@ -35772,6 +36502,7 @@ the following table: &`I `& local interface used &`K `& CHUNKING extension used &`id `& message id for incoming message +&`M8S `& 8BITMIME status for incoming message &`P `& on &`<=`& lines: protocol used &` `& on &`=>`& and &`**`& lines: return path &`PRDR`& PRDR extension used @@ -35781,10 +36512,12 @@ 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 &`T `& on &`<=`& lines: message subject (topic) +&`TFO `& connection took advantage of TCP Fast Open &` `& on &`=>`& &`**`& and &`==`& lines: transport name &`U `& local user or RFC 1413 identity &`X `& TLS cipher suite @@ -35831,6 +36564,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 @@ -35858,6 +36595,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 @@ -35866,6 +36605,7 @@ 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 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 @@ -35873,6 +36613,7 @@ selection marked by asterisks: &` queue_time_overall `& time on queue for whole message &` pid `& Exim process id &` 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 @@ -35955,12 +36696,23 @@ process is started because &%queue_only%& is set or &%-odq%& was used. .cindex "log" "delivery duration" &%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.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)" @@ -36011,7 +36763,7 @@ The latter can be disabled by turning off the &%outgoing_interface%& option. &%proxy%&: The internal (closest to the system running Exim) IP address of the proxy, tagged by PRX=, on the &"<="& line for a message accepted on a proxied connection -or the &"=>"& line for a message delivered on a proxied connection.. +or the &"=>"& line for a message delivered on a proxied connection. See &<>& for more information. .next .cindex "log" "incoming remote port" @@ -36030,6 +36782,12 @@ 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 +.cindex "log" "millisecond timestamps" +.cindex millisecond logging +.cindex timestamps "millisecond, in logs" +&%millisec%&: Timestamps have a period and three decimal places of finer granularity +appended to the seconds value. +.next .cindex "log" "outgoing interface" .cindex "log" "local interface" .cindex "log" "local address and port" @@ -36041,8 +36799,8 @@ 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 "TCP/IP" "logging ougtoing remote port" +.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. The local port is also added if &%incoming_interface%& and @@ -36068,12 +36826,20 @@ includes reception time as well as the delivery time for the current address. This means that it may be longer than the difference between the arrival and delivery log line times, because the arrival log line is not written until the message has been successfully received. +If millisecond logging is enabled, short times will be shown with greater +precision, eg. &`QT=1.578s`&. .next &%queue_time_overall%&: The amount of time the message has been in the queue on 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 @@ -36225,9 +36991,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" @@ -36520,8 +37291,7 @@ autodetection of some well known compression extensions. .cindex "&'exipick'&" John Jetmore's &'exipick'& utility is included in the Exim distribution. It lists messages from the queue according to a variety of criteria. For details -of &'exipick'&'s facilities, visit the web page at -&url(http://www.exim.org/eximwiki/ToolExipickManPage) or run &'exipick'& with +of &'exipick'&'s facilities, run &'exipick'& with the &%--help%& option. @@ -37771,6 +38541,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. +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*%&. .section "Spool files" "SECID275" @@ -37871,9 +38646,8 @@ lock will be lost at the instant of rename. .next .vindex "&$body_linecount$&" If you change the number of lines in the file, the value of -&$body_linecount$&, which is stored in the -H file, will be incorrect. At -present, this value is not used by Exim, but there is no guarantee that this -will always be the case. +&$body_linecount$&, which is stored in the -H file, will be incorrect and can +cause incomplete transmission of messages or undeliverable messages. .next If the message is in MIME format, you must take care not to break it. .next @@ -37892,6 +38666,11 @@ 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. +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. + .section "Format of the -H file" "SECID282" .cindex "uid (user id)" "in spool file" .cindex "gid (group id)" "in spool file" @@ -37969,8 +38748,8 @@ The address of an authenticated sender &-- the value of the &$authenticated_sender$& variable. .vitem "&%-body_linecount%&&~<&'number'&>" -This records the number of lines in the body of the message, and is always -present. +This records the number of lines in the body of the message, and is +present unless &%-spool_file_wireformat%& is. .vitem "&%-body_zerocount%&&~<&'number'&>" This records the number of binary zero bytes in the body of the message, and is @@ -38052,6 +38831,12 @@ 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$&. +.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. + .vitem &%-tls_certificate_verified%& A TLS certificate was received from the client that sent this message, and the certificate was verified by the server. @@ -38159,17 +38944,35 @@ unqualified domain &'foundation'&. .ecindex IIDforspo2 .ecindex IIDforspo3 +.section "Format of the -D file" "SECID282a" +The data file is traditionally in Unix-standard format: lines are ended with +an ASCII newline character. +However, when the &%spool_wireformat%& main option is used some -D files +can have an alternate format. +This is flagged by a &%-spool_file_wireformat%& line in the corresponding -H file. +The -D file lines (not including the first name-component line) are +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). + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.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_&. @@ -38191,7 +38994,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 @@ -38200,6 +39006,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 @@ -38210,73 +39017,198 @@ 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&!! unset -MANDATORY: -The domain you want to sign with. The result of this expanded -option is put into the &%$dkim_domain%& expansion variable. -If it is empty after expansion, DKIM signing is not done. - -.option dkim_selector smtp string&!! unset -MANDATORY: -This sets the key selector string. You can use the &%$dkim_domain%& expansion -variable to look up a matching selector. The result is put in the expansion +.option dkim_domain smtp string list&!! unset +The domain(s) you want to sign with. +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. +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. +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, +and no error will result even if &%dkim_strict%& is set. .option dkim_private_key smtp string&!! unset -MANDATORY: -This sets the private key to use. You can use the &%$dkim_domain%& and +This sets the private key to use. +You can use the &%$dkim_domain%& and &%$dkim_selector%& expansion variables to determine the private key to use. The result can either .ilist -be a valid RSA private key in ASCII armor, including line breaks. +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 +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 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 +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. + .option dkim_canon smtp string&!! unset -OPTIONAL: This option sets the canonicalization method used when signing a message. The DKIM RFC currently supports two methods: "simple" and "relaxed". The option defaults to "relaxed" when unset. Note: the current implementation -only supports using the same canonicalization method for both headers and body. +only supports signing with the same canonicalization method for both headers and body. .option dkim_strict smtp string&!! unset -OPTIONAL: This option defines how Exim behaves when signing a message that should be signed fails for some reason. When the expansion evaluates to either "1" or "true", Exim will defer. Otherwise Exim will send the message unsigned. You can use the &%$dkim_domain%& and &%$dkim_selector%& expansion variables here. -.option dkim_sign_headers smtp string&!! unset -OPTIONAL: -When set, this option must expand to (or be specified as) a colon-separated -list of header names. Headers with these names will be included in the message -signature. When unspecified, the header names recommended in RFC4871 will be -used. +.option dkim_sign_headers smtp string&!! "see below" +If set, this option must expand to a colon-separated +list of header names. +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, +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 thereof) +will be signed. The textually later headers in the headers part of the +message are signed first, if there are multiples. + +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 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 it is +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. @@ -38311,6 +39243,9 @@ 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. +If multiple signatures match a domain (or identity), the ACL is called once +for each matching signature. + Inside the &%acl_smtp_dkim%&, the following expansion variables are available (from most to least important): @@ -38323,7 +39258,8 @@ an identity. This is one of the list items from the expanded main option &%dkim_verify_signers%& (see above). .vitem &%$dkim_verify_status%& -A string describing the general status of the signature. One of +Within the DKIM ACL, +a string describing the general status of the signature. One of .ilist &%none%&: There is no signature in the message for the current domain or identity (as reflected by &%$dkim_cur_signer%&). @@ -38337,6 +39273,24 @@ available in &%$dkim_verify_reason%&. &%pass%&: The signature passed verification. It is valid. .endlist +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_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 + +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. +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 "fail" or "invalid". One of @@ -38357,6 +39311,8 @@ 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 +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 an actual signature in the message for the current domain or identity (as @@ -38372,11 +39328,26 @@ 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'. -.vitem &%dkim_canon_headers%& +.vitem &%$dkim_canon_headers%& The header canonicalization method. One of 'relaxed' or 'simple'. .vitem &%$dkim_copiedheaders%& @@ -38390,6 +39361,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. @@ -38400,6 +39377,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. @@ -38423,6 +39401,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: @@ -38462,6 +39451,177 @@ 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). + +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(http://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. + +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. + + + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -38486,9 +39646,9 @@ To include this support, include &"SUPPORT_PROXY=yes"& in Local/Makefile. It was built on specifications from: -http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt +(&url(http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt)). That URL was revised in May 2014 to version 2 spec: -http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e +(&url(http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e)). The purpose of this facility is so that an application load balancer, such as HAProxy, can sit in front of several Exim servers @@ -38502,6 +39662,13 @@ recorded in an ACL (example is below). Use of a proxy is enabled by setting the &%hosts_proxy%& main configuration option to a hostlist; connections from these hosts will use Proxy Protocol. +Exim supports both version 1 and version 2 of the Proxy Protocol and +automatically determines which version is in use. + +The Proxy Protocol header is the first data received on a TCP connection +and is inserted before any TLS-on-connect handshake from the client; Exim +negotiates TLS between Exim-as-server and the remote client, not between +Exim and the proxy server. The following expansion variables are usable (&"internal"& and &"external"& here refer to the interfaces @@ -38509,9 +39676,9 @@ of the proxy): .display &'proxy_external_address '& IP of host being proxied or IP of remote interface of proxy &'proxy_external_port '& Port of host being proxied or Port on remote interface of proxy -&'proxy_local_address '& IP of proxy server inbound or IP of local interface of proxy -&'proxy_local_port '& Port of proxy server inbound or Port on local interface of proxy -&'proxy_session '& boolean: SMTP connection via proxy +&'proxy_local_address '& IP of proxy server inbound or IP of local interface of proxy +&'proxy_local_port '& Port of proxy server inbound or Port on local interface of proxy +&'proxy_session '& boolean: SMTP connection via proxy .endd If &$proxy_session$& is set but &$proxy_external_address$& is empty there was a protocol error. @@ -38616,12 +39783,16 @@ 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. Standards supported are RFCs 2060, 5890, 6530 and 6533. +If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not +instead of it) then IDNA2008 is supported; this adds an extra library +requirement, upon libidn2. + .section "MTA operations" SECTi18nMTA .cindex SMTPUTF8 "ESMTP option" The main configuration option &%smtputf8_advertise_hosts%& specifies @@ -38650,6 +39821,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. @@ -38661,7 +39833,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/ @@ -38705,7 +39880,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. @@ -38769,12 +39944,13 @@ 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 &`msg:rcpt:defer after transport `& per recipient &`msg:host:defer after transport `& per attempt -&`msg:fail:delivery after main `& per recipient +&`msg:fail:delivery after transport `& per recipient &`msg:fail:internal after main `& per recipient &`tcp:connect before transport `& per connection &`tcp:close after transport `& per connection @@ -38791,10 +39967,14 @@ 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). +The third column in the table above says what section of the configuration +should define the event action. + An additional variable, &$event_data$&, is filled with information varying with the event type: .display -&`msg:delivery `& smtp confirmation mssage +&`dane:fail `& failure reason +&`msg:delivery `& smtp confirmation message &`msg:rcpt:host:defer `& error string &`msg:rcpt:defer `& error string &`msg:host:defer `& error string @@ -38821,15 +40001,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