X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/9e55176d9aab057a530bc584f6486ebf9d91b13d..5169b5fa9104c024a3d3b31b163bfa3b9ec14c9c:/doc/doc-docbook/spec.xfpt diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index f7e930c08..ea90259f0 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -52,7 +52,7 @@ .set I "    " .macro copyyear -2018 +2018, 2019 .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 this 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 @@ -1886,11 +1888,10 @@ to your &_Local/Makefile_& and rebuild Exim. .section "Including TLS/SSL encryption support" "SECTinctlsssl" .cindex "TLS" "including support for TLS" .cindex "encryption" "including support for" -.cindex "SUPPORT_TLS" .cindex "OpenSSL" "building Exim with" .cindex "GnuTLS" "building Exim with" -Exim can be built to support encrypted SMTP connections, using the STARTTLS -command as per RFC 2487. It can also support legacy clients that expect to +Exim is usually built to support encrypted SMTP connections, using the STARTTLS +command as per RFC 2487. It can also support clients that expect to start a TLS session immediately on connection to a non-standard port (see the &%tls_on_connect_ports%& runtime option and the &%-tls-on-connect%& command line option). @@ -1899,35 +1900,43 @@ If you want to build Exim with TLS support, you must first install either the OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for implementing SSL. +.new +If you do not want TLS support you should set +.code +DISABLE_TLS=yes +.endd +in &_Local/Makefile_&. +.wen + +.new If OpenSSL is installed, you should set .code -SUPPORT_TLS=yes +USE_OPENSL=yes TLS_LIBS=-lssl -lcrypto .endd in &_Local/Makefile_&. You may also need to specify the locations of the OpenSSL library and include files. For example: .code -SUPPORT_TLS=yes +USE_OPENSSL=yes TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto TLS_INCLUDE=-I/usr/local/openssl/include/ .endd .cindex "pkg-config" "OpenSSL" If you have &'pkg-config'& available, then instead you can just use: .code -SUPPORT_TLS=yes +USE_OPENSSL=yes USE_OPENSSL_PC=openssl .endd +.wen .cindex "USE_GNUTLS" If GnuTLS is installed, you should set .code -SUPPORT_TLS=yes USE_GNUTLS=yes TLS_LIBS=-lgnutls -ltasn1 -lgcrypt .endd in &_Local/Makefile_&, and again you may need to specify the locations of the library and include files. For example: .code -SUPPORT_TLS=yes USE_GNUTLS=yes TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt TLS_INCLUDE=-I/usr/gnu/include @@ -1935,7 +1944,6 @@ TLS_INCLUDE=-I/usr/gnu/include .cindex "pkg-config" "GnuTLS" If you have &'pkg-config'& available, then instead you can just use: .code -SUPPORT_TLS=yes USE_GNUTLS=yes USE_GNUTLS_PC=gnutls .endd @@ -3959,6 +3967,20 @@ is sent to the sender, containing the text &"cancelled by administrator"&. Bounce messages are just discarded. This option can be used only by an admin user. +.new +.vitem &%-MG%&&~<&'queue&~name'&>&~<&'message&~id'&>&~<&'message&~id'&>&~... +.oindex "&%-MG%&" +.cindex queue named +.cindex "named queues" +.cindex "queue" "moving messages" +This option requests that each listed message be moved from its current +queue to the given named queue. +The destination queue name argument is required, but can be an empty +string to define the default queue. +If the messages are not currently located in the default queue, +a &%-qG%& option will be required to define the source queue. +.wen + .vitem &%-Mmad%&&~<&'message&~id'&>&~<&'message&~id'&>&~... .oindex "&%-Mmad%&" .cindex "delivery" "cancelling all" @@ -6109,9 +6131,6 @@ dnslookup: domains = ! +local_domains transport = remote_smtp ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 -.ifdef _HAVE_DNSSEC - dnssec_request_domains = * -.endif no_more .endd The &%domains%& option behaves as per smarthost, above. @@ -6262,9 +6281,6 @@ Two remote transports and four local transports are defined. remote_smtp: driver = smtp message_size_limit = ${if > {$max_received_linelength}{998} {1}{0}} -.ifdef _HAVE_DANE - hosts_try_dane = * -.endif .ifdef _HAVE_PRDR hosts_try_prdr = * .endif @@ -6272,9 +6288,7 @@ remote_smtp: This transport is used for delivering messages over SMTP connections. The list of remote hosts comes from the router. The &%message_size_limit%& usage is a hack to avoid sending on messages -with over-long lines. The built-in macro _HAVE_DANE guards configuration -to use DANE for delivery; -see section &<>& for more details. +with over-long lines. The &%hosts_try_prdr%& option enables an efficiency SMTP option. It is negotiated between client and server and not expected to cause problems @@ -6665,11 +6679,10 @@ aliases or other indexed data referenced by an MTA. Information about cdb and tools for building the files can be found in several places: .display &url(https://cr.yp.to/cdb.html) -&url(http://www.corpit.ru/mjt/tinycdb.html) +&url(https://www.corpit.ru/mjt/tinycdb.html) &url(https://packages.debian.org/stable/utils/freecdb) &url(https://github.com/philpennock/cdbtools) (in Go) .endd -. --- 2018-09-07: corpit.ru http:-only A cdb distribution is not needed in order to build Exim with cdb support, because the code for reading cdb files is included directly in Exim itself. However, no means of building or testing cdb files is provided with Exim, so @@ -7331,7 +7344,9 @@ with the lookup. With &"strict"& a response from the DNS resolver that is not labelled as authenticated data is treated as equivalent to a temporary DNS error. -The default is &"never"&. +.new +The default is &"lax"&. +.wen See also the &$lookup_dnssec_authenticated$& variable. @@ -9377,7 +9392,7 @@ If the ACL returns defer the result is a forced-fail. Otherwise the expansion f .cindex headers "authentication-results:" .cindex authentication "expansion item" This item returns a string suitable for insertion as an -&'Authentication-Results"'& +&'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. @@ -9474,9 +9489,15 @@ set in &_Local/Makefile_&. Once loaded, Exim remembers the dynamically loaded object so that it doesn't reload the same object file in the same Exim process (but of course Exim does start new processes frequently). -There may be from zero to eight arguments to the function. When compiling -a local function that is to be called in this way, &_local_scan.h_& should be -included. The Exim variables and functions that are defined by that API +There may be from zero to eight arguments to the function. + +.new +When compiling +a local function that is to be called in this way, +first &_DLFUNC_IMPL_& should be defined, +and second &_local_scan.h_& should be included. +.wen +The Exim variables and functions that are defined by that API are also available for dynamically loaded functions. The function itself must have the following type: .code @@ -9661,7 +9682,7 @@ input, but a separator setting is not included in the output. For example: ${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. +to what it was before. See also the &%map%& and &%reduce%& expansion items. .vitem &*${hash{*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*& @@ -10012,8 +10033,8 @@ setting is not included in the output. For example: ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}} .endd expands to &`[a]:[b]:[c] (x)-(y)-(z)`&. At the end of the expansion, the -value of &$item$& is restored to what it was before. See also the &*filter*& -and &*reduce*& expansion items. +value of &$item$& is restored to what it was before. See also the &%filter%& +and &%reduce%& expansion items. .vitem &*${nhash{*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*& .cindex "expansion" "numeric hash" @@ -10212,7 +10233,7 @@ assigned to the &$value$& variable. After this, each item in the <&'string1'&> list is assigned to &$item$&, in turn, and <&'string3'&> is expanded for each of them. The result of that expansion is assigned to &$value$& before the next iteration. When the end of the list is reached, the final value of &$value$& is -added to the expansion output. The &*reduce*& expansion item can be used in a +added to the expansion output. The &%reduce%& expansion item can be used in a number of ways. For example, to add up a list of numbers: .code ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}} @@ -10223,7 +10244,7 @@ can be found: ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}} .endd At the end of a &*reduce*& expansion, the values of &$item$& and &$value$& are -restored to what they were before. See also the &*filter*& and &*map*& +restored to what they were before. See also the &%filter%& and &%map%& expansion items. .vitem &*$rheader_*&<&'header&~name'&>&*:*&&~or&~&*$rh_*&<&'header&~name'&>&*:*& @@ -10483,9 +10504,9 @@ separator explicitly: ${addresses:>:$h_from:} .endd -Compare the &*address*& (singular) +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 +address. See the &%filter%&, &%map%&, and &%reduce%& items for ways of processing lists. To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows @@ -11378,7 +11399,7 @@ list separator is changed to a comma: .code ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}} .endd -The value of &$item$& is saved and restored while &*forany*& or &*forall*& is +The value of &$item$& is saved and restored while &%forany%& or &%forall%& is being processed, to enable these expansion items to be nested. To scan a named list, expand it with the &*listnamed*& operator. @@ -12079,6 +12100,15 @@ 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. +.new +.vitem &$dmarc_domain_policy$& &&& + &$dmarc_status$& &&& + &$dmarc_status_text$& &&& + &$dmarc_used_domains$& +Results of DMARC verification. +For details see section &<>&. +.wen + .vitem &$dkim_verify_status$& Results of DKIM verification. For details see section &<>&. @@ -12306,7 +12336,7 @@ the result, the name is not accepted, and &$host_lookup_deferred$& is set to .cindex authentication "expansion item" Performing these checks sets up information used by the -&$authresults$& expansion item. +&%authresults%& expansion item. .vitem &$host_lookup_failed$& @@ -13344,6 +13374,9 @@ 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. +.new +The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions. +.wen .vitem &$tls_in_peercert$& .vindex "&$tls_in_peercert$&" @@ -13414,7 +13447,7 @@ 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. -,new +.new .vitem &$tls_out_cipher_std$& .vindex "&$tls_out_cipher_std$&" As above, but returning the RFC standard name for the cipher suite. @@ -13493,6 +13526,19 @@ the transport. .vindex &$tls_out_tlsa_usage$& Bitfield of TLSA record types found. See section &<>&. +.new +.vitem &$tls_in_ver$& +.vindex "&$tls_in_ver$&" +When a message is received from a remote host over an encrypted SMTP connection +this variable is set to the protocol version, eg &'TLS1.2'&. + +.vitem &$tls_out_ver$& +.vindex "&$tls_out_ver$&" +When a message is being delivered to a remote host over an encrypted SMTP connection +this variable is set to the protocol version. +.wen + + .vitem &$tod_bsdinbox$& .vindex "&$tod_bsdinbox$&" The time of day and the date, in the format required for BSD-style mailbox @@ -14637,8 +14683,10 @@ received. See chapter &<>& for further details. .option add_environment main "string list" empty .cindex "environment" "set values" -This option allows to set individual environment variables that the -currently linked libraries and programs in child processes use. +This option adds individual environment variables that the +currently linked libraries and programs in child processes may use. +Each list element should be of the form &"name=value"&. + See &<>& for the environment of &(pipe)& transports. .option admin_groups main "string list&!!" unset @@ -14682,13 +14730,20 @@ recommended, except when you have no other choice. .cindex "UTF-8" "in domain name" Lots of discussion is going on about internationalized domain names. One camp is strongly in favour of just using UTF-8 characters, and it seems -that at least two other MTAs permit this. This option allows Exim users to -experiment if they wish. +that at least two other MTAs permit this. +This option allows Exim users to experiment if they wish. If it is set true, Exim's domain parsing function allows valid UTF-8 multicharacters to appear in domain name components, in addition to -letters, digits, and hyphens. However, just setting this option is not -enough; if you want to look up these domain names in the DNS, you must also +letters, digits, and hyphens. + +.new +If Exim is built with internationalization support +and the SMTPUTF8 ESMTP option is in use (see chapter &<>&) +this option can be left as default. +.wen +Without that, +if you want to look up such domain names in the DNS, you must also adjust the value of &%dns_check_names_pattern%& to match the extended form. A suitable setting is: .code @@ -15415,12 +15470,14 @@ not also supplied, the gid is taken from the result of &[getpwnam()]& if it is used. See chapter &<>& for a discussion of security issues. +.new .option exim_version main string "current version" .cindex "Exim version" .cindex customizing "version number" .cindex "version number of Exim" override -This option allows to override the &$version_number$&/&$exim_version$& Exim reports in -various places. Use with care, this may fool stupid security scanners. +This option overrides the &$version_number$&/&$exim_version$& that Exim reports in +various places. Use with care; this may fool stupid security scanners. +.wen .option extra_local_interfaces main "string list" unset @@ -16253,7 +16310,7 @@ harm. This option overrides the &%pipe_as_creator%& option of the &(pipe)& transport driver. -.option openssl_options main "string list" "+no_sslv2 +no_sslv3 +single_dh_use +no_ticket" +.option openssl_options main "string list" "+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation" .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, @@ -16394,9 +16451,9 @@ interpreter. See chapter &<>& for details of its use. This option is available only when Exim is built with an embedded Perl interpreter. See chapter &<>& for details of its use. -.option perl_startup main boolean false +.option perl_taintmode main boolean false .cindex "Perl" -This Option enables the taint mode of the embedded Perl interpreter. +This option enables the taint mode of the embedded Perl interpreter. .option pgsql_servers main "string list" unset @@ -16443,6 +16500,8 @@ and from which pipeline early-connection (before MAIL) SMTP commands are acceptable. When used, the pipelining saves on roundtrip times. +See also the &%hosts_pipe_connect%& smtp transport option. + Currently the option name &"X_PIPE_CONNECT"& is used. .wen @@ -16718,6 +16777,7 @@ received_header_text = Received: \ ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\ by $primary_hostname \ ${if def:received_protocol {with $received_protocol }}\ + ${if def:tls_ver { ($tls_ver)}}\ ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\ (Exim $version_number)\n\t\ ${if def:sender_address \ @@ -16904,12 +16964,6 @@ it qualifies them only if the message came from a host that matches &%sender_unqualified_hosts%&, or if the message was submitted locally (not using TCP/IP), and the &%-bnq%& option was not set. -.option add_environment main "string list" empty -.cindex "environment" -This option allows to add individual environment variables that the -currently linked libraries and programs in child processes use. The -default list is empty. - .option slow_lookup_log main integer 0 .cindex "logging" "slow lookups" @@ -17667,9 +17721,9 @@ separator in the usual way (&<>&) to avoid confusion under IP &*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. +.new +The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions. +.wen 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 @@ -17720,7 +17774,14 @@ larger prime than requested. The value of this option is expanded and indicates the source of DH parameters to be used by Exim. -&*Note: The Exim Maintainers strongly recommend using a filename with site-generated +.new +This option is ignored for GnuTLS version 3.6.0 and later. +The library manages parameter negotiation internally. +.wen + +&*Note: The Exim Maintainers strongly recommend, +for other TLS library versions, +using a filename with site-generated local DH parameters*&, which has been supported across all versions of Exim. The other specific constants available are a fallback so that even when "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS. @@ -17815,11 +17876,37 @@ status proof for the server's certificate, as obtained from the Certificate Authority. Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later). +.new +The macro "_HAVE_TLS_OCSP" will be defined for those versions. +.wen -For GnuTLS 3.5.6 or later the expanded value of this option can be a list +.new +For OpenSSL 1.1.0 or later, and +.wen +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. +.new +The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions. +.wen +.new +The file(s) should be in DER format, +except for GnuTLS 3.6.3 or later +or for OpenSSL, +when an optional filetype prefix can be used. +The prefix must be one of "DER" or "PEM", followed by +a single space. If one is used it sets the format for subsequent +files in the list; the initial format is DER. +If multiple proofs are wanted, for multiple chain elements +(this only works under TLS1.3) +they must be coded as a combined OCSP response. + +Although GnuTLS will accept PEM files with multiple separate +PEM blobs (ie. separate OCSP responses), it sends them in the +TLS Certificate record interleaved with the certificates of the chain; +although a GnuTLS client is happy with that, an OpenSSL client is not. +.wen .option tls_on_connect_ports main "string list" unset .cindex SSMTP @@ -18337,7 +18424,7 @@ or for any deliveries caused by this router. You should not set this option unless you really, really know what you are doing. See also the generic transport option of the same name. -.option dnssec_request_domains routers "domain list&!!" unset +.option dnssec_request_domains routers "domain list&!!" * .cindex "MX record" "security" .cindex "DNSSEC" "MX lookup" .cindex "security" "MX lookup" @@ -19067,7 +19154,7 @@ because of this the list aspect is mostly irrelevant. The list separator is a semicolon but can be changed in the usual way. -Each list-element given must be of the form $"name = value"$ +Each list-element given must be of the form &"name = value"& and the names used must start with the string &"r_"&. Values containing a list-separator should have them doubled. When a router runs, the strings are evaluated in order, @@ -19078,7 +19165,7 @@ The variables can be used by the router options (not including any preconditions) and by the transport. Later definitions of a given named variable will override former ones. -Varible use is via the usual &$r_...$& syntax. +Variable use is via the usual &$r_...$& syntax. This is similar to the &%address_data%& option, except that many independent variables can be used, with choice of naming. @@ -24526,7 +24613,7 @@ See the &%search_parents%& option in chapter &<>& for more details. -.option dnssec_request_domains smtp "domain list&!!" unset +.option dnssec_request_domains smtp "domain list&!!" * .cindex "MX record" "security" .cindex "DNSSEC" "MX lookup" .cindex "security" "MX lookup" @@ -24705,6 +24792,8 @@ When used, the pipelining saves on roundtrip times. It also turns SMTP into a client-first protocol so combines well with TCP Fast Open. +See also the &%pipelining_connect_advertise_hosts%& main option. + Note: When the facility is used, the transport &%helo_data%& option will be expanded before the &$sending_ip_address$& variable @@ -26705,7 +26794,7 @@ no successful authentication. .cindex authentication "expansion item" Successful authentication sets up information used by the -&$authresults$& expansion item. +&%authresults%& expansion item. @@ -26841,7 +26930,21 @@ security risk; you are strongly advised to insist on the use of SMTP encryption use unencrypted plain text, you should not use the same passwords for SMTP connections as you do for login accounts. -.section "Plaintext options" "SECID171" +.new +.section "Avoiding cleartext use" "SECTplain_TLS" +The following generic option settings will disable &(plaintext)& authenticators when +TLS is not being used: +.code + server_advertise_condition = ${if def:tls_in_cipher } + client_condition = ${if def:tls_out_cipher} +.endd + +&*Note*&: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping, +but is still vulnerable to a Man In The Middle attack unless certificates +(including their names) have been properly verified. +.wen + +.section "Plaintext server options" "SECID171" .cindex "options" "&(plaintext)& authenticator (server)" When configured as a server, &(plaintext)& uses the following options: @@ -26849,7 +26952,7 @@ When configured as a server, &(plaintext)& uses the following options: This is actually a global authentication option, but it must be set in order to configure the &(plaintext)& driver as a server. Its use is described below. -.option server_prompts plaintext string&!! unset +.option server_prompts plaintext "string list&!!" unset The contents of this option, after expansion, must be a colon-separated list of prompt strings. If expansion fails, a temporary authentication rejection is given. @@ -27664,6 +27767,7 @@ msn: . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// +.new .chapter "The external authenticator" "CHAPexternauth" .scindex IIDexternauth1 "&(external)& authenticator" .scindex IIDexternauth2 "authenticators" "&(external)&" @@ -27765,11 +27869,10 @@ of your configured trust-anchors (which usually means the full set of public CAs) and which has a mail-SAN matching the claimed identity sent by the client. -Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN, +&*Note*&: up to TLS1.2, the client cert is on the wire in-clear, including the SAN. The account name is therefore guessable by an opponent. TLS 1.3 protects both server and client certificates, and is not vulnerable in this way. -Likewise, a traditional plaintext SMTP AUTH done inside TLS is not. .section "Using external in a client" "SECTexternclient" @@ -27793,6 +27896,7 @@ ext_ccert: .ecindex IIDexternauth1 .ecindex IIDexternauth2 +.wen @@ -27982,16 +28086,21 @@ There is also a &%-tls-on-connect%& command line option. This overrides .section "OpenSSL vs GnuTLS" "SECTopenvsgnu" .cindex "TLS" "OpenSSL &'vs'& GnuTLS" -The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS -followed later, when the first versions of GnuTLS were released. To build Exim -to use GnuTLS, you need to set +TLS is supported in Exim using either the OpenSSL or GnuTLS library. +.new +To build Exim to use OpenSSL you need to set .code -USE_GNUTLS=yes +USE_OPENSSL=yes .endd -in Local/Makefile, in addition to +in Local/Makefile. +.wen + +To build Exim to use GnuTLS, you need to set .code -SUPPORT_TLS=yes +USE_GNUTLS=yes .endd +in Local/Makefile. + You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the include files and libraries for GnuTLS can be found. @@ -28550,9 +28659,9 @@ if it requests it. If the server is Exim, it will request a certificate only if &%tls_verify_hosts%& or &%tls_try_verify_hosts%& matches the client. .new -Do not use a certificate which has the OCSP-must-staple extension, +&*Note*&: Do not use a certificate which has the OCSP-must-staple extension, for client use (they are usable for server use). -As TLS has no means for the client to staple before TLS 1.3 it will result +As the TLS protocol has no means for the client to staple before TLS 1.3 it will result in failed connections. .wen @@ -28976,7 +29085,7 @@ those who use &%hosts_require_ocsp%&, should consider the interaction with DANE 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 +The &"require"& variant will result in failure if the target host is not DNSSEC-secured. To get DNSSEC-secured hostname resolution, use the &%dnssec_request_domains%& router or transport option. @@ -29008,7 +29117,8 @@ If DANE is requested and useable (see above) the following transport options are 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 (router or transport options) &%dnssec_request_domains%& must be active and &%dnssec_require_domains%& is ignored. +The router and transport option &%dnssec_request_domains%& must not be +set to &"never"&, 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". @@ -30327,6 +30437,13 @@ This control turns off DKIM verification processing entirely. For details on the operation and configuration of DKIM, see section &<>&. +.vitem &*control&~=&~dmarc_disable_verify*& +.cindex "disable DMARC verify" +.cindex "DMARC" "disable verify" +This control turns off DMARC verification processing entirely. For details on +the operation and configuration of DMARC, see section &<>&. + + .vitem &*control&~=&~dscp/*&<&'value'&> .cindex "&ACL;" "setting DSCP value" .cindex "DSCP" "inbound" @@ -30891,7 +31008,9 @@ the next &%local_parts%& test. .cindex "&ACL;" "virus scanning" .cindex "&ACL;" "scanning for viruses" This condition is available only when Exim is compiled with the -content-scanning extension. It causes the incoming message to be scanned for +content-scanning extension +and only after a DATA command. +It causes the incoming message to be scanned for viruses. For details, see chapter &<>&. .vitem &*mime_regex&~=&~*&<&'list&~of&~regular&~expressions'&> @@ -32679,6 +32798,15 @@ It supports a &"generic"& interface to scanners called via the shell, and specialized interfaces for &"daemon"& type virus scanners, which are resident in memory and thus are much faster. +.new +Since message data needs to have arrived, +the condition may be only called in ACL defined by +&%acl_smtp_data%&, +&%acl_smtp_data_prdr%&, +&%acl_smtp_mime%& or +&%acl_smtp_dkim%& +.wen + A timeout of 2 minutes is applied to a scanner call (by default); if it expires then a defer action is taken. @@ -34217,8 +34345,10 @@ with translation. This function is used in conjunction with &'smtp_printf()'&, as described below. -.vitem &*void&~smtp_printf(char&~*,&~...)*& -The arguments of this function are like &[printf()]&; it writes to the SMTP +.new +.vitem &*void&~smtp_printf(char&~*,BOOL,&~...)*& +The arguments of this function are almost like &[printf()]&; it writes to the SMTP +.wen output stream. You should use this function only when there is an SMTP output stream, that is, when the incoming message is being received via interactive SMTP. This is the case when &%smtp_input%& is TRUE and &%smtp_batched_input%& @@ -34230,6 +34360,17 @@ is involved. If an SMTP TLS connection is established, &'smtp_printf()'& uses the TLS output function, so it can be used for all forms of SMTP connection. +.new +The second argument is used to request that the data be buffered +(when TRUE) or flushed (along with any previously buffered, when FALSE). +This is advisory only, but likely to save on system-calls and packets +sent when a sequence of calls to the function are made. + +The argument was added in Exim version 4.90 - changing the API/ABI. +Nobody noticed until 4.93 was imminent, at which point the +ABI version number was incremented. +.wen + Strings that are written by &'smtp_printf()'& from within &[local_scan()]& must start with an appropriate response code: 550 if you are going to return LOCAL_SCAN_REJECT, 451 if you are going to return @@ -34247,7 +34388,11 @@ the data returned via the &%return_text%& argument. The added value of using multiple output lines. The &'smtp_printf()'& function does not return any error indication, because it -does not automatically flush pending output, and therefore does not test +does not +.new +guarantee a flush of +.wen +pending output, and therefore does not test the state of the stream. (In the main code of Exim, flushing and error detection is done when Exim is ready for the next SMTP input command.) If you want to flush the output and check for an error (for example, the @@ -34255,12 +34400,18 @@ dropping of a TCP/IP connection), you can call &'smtp_fflush()'&, which has no arguments. It flushes the output stream, and returns a non-zero value if there is an error. -.vitem &*void&~*store_get(int)*& +.new +.vitem &*void&~*store_get(int,BOOL)*& This function accesses Exim's internal store (memory) manager. It gets a new -chunk of memory whose size is given by the argument. Exim bombs out if it ever +chunk of memory whose size is given by the first argument. +The second argument should be given as TRUE if the memory will be used for +data possibly coming from an attacker (eg. the message content), +FALSE if it is locally-sourced. +Exim bombs out if it ever runs out of memory. See the next section for a discussion of memory handling. +.wen -.vitem &*void&~*store_get_perm(int)*& +.vitem &*void&~*store_get_perm(int,BOOL)*& This function is like &'store_get()'&, but it always gets memory from the permanent pool. See the next section for a discussion of memory handling. @@ -39740,11 +39891,11 @@ There is no dot-stuffing (and no dot-termination). . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// -.chapter "DKIM and SPF" "CHAPdkim" &&& - "DKIM and SPF Support" -.cindex "DKIM" +.chapter "DKIM, SPF and DMARC" "CHAPdkim" &&& + "DKIM, SPF and DMARC Support" .section "DKIM (DomainKeys Identified Mail)" SECDKIM +.cindex "DKIM" DKIM is a mechanism by which messages sent by some entity can be provably linked to a domain which that entity controls. It permits reputation to @@ -39988,7 +40139,7 @@ processing for a message once the first passing signature is found. .cindex authentication "expansion item" Performing verification sets up information used by the -&$authresults$& expansion item. +&%authresults%& expansion item. .new For most purposes the default option settings suffice and the remainder @@ -40266,8 +40417,12 @@ for more information of what they mean. SPF is a mechanism whereby a domain may assert which IP addresses may transmit messages with its domain in the envelope from, documented by RFC 7208. -For more information on SPF see &url(http://www.openspf.org). -. --- 2018-09-07: still not https +For more information on SPF see &url(http://www.open-spf.org), a static copy of +the &url(http://openspf.org). +. --- 2019-10-28: still not https, open-spf.org is told to be a +. --- web-archive copy of the now dead openspf.org site +. --- See https://www.mail-archive.com/mailop@mailop.org/msg08019.html for a +. --- discussion. Messages sent by a system not authorised will fail checking of such assertions. This includes retransmissions done by traditional forwarders. @@ -40281,7 +40436,7 @@ 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. +&%authresults%& expansion item. .cindex SPF "ACL condition" @@ -40330,7 +40485,7 @@ 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=\ + Please see http://www.open-spf.org/Why?scope=\ ${if def:sender_address_domain {mfrom}{helo}};\ identity=${if def:sender_address_domain \ {$sender_address}{$sender_helo_name}};\ @@ -40383,9 +40538,9 @@ 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) +Refer to &url(http://www.open-spf.org/FAQ/Best_guess_record) for a description of what it means. -. --- 2018-09-07: still not https: +. --- 2019-10-28: still not https: To access this feature, simply use the spf_guess condition in place of the spf one. For example: @@ -40434,6 +40589,243 @@ The lookup will return the same result strings as can appear in + +.new +.section DMARC SECDMARC +.cindex DMARC verification + +DMARC combines feedback from SPF, DKIM, and header From: in order +to attempt to provide better indicators of the authenticity of an +email. This document does not explain the fundamentals; you +should read and understand how it works by visiting the website at +&url(http://www.dmarc.org/). + +If Exim is built with DMARC support, +the libopendmarc library is used. + +For building Exim yourself, obtain the library from +&url(http://sourceforge.net/projects/opendmarc/) +to obtain a copy, or find it in your favorite package +repository. You will need to attend to the local/Makefile feature +SUPPORT_DMARC and the associated LDFLAGS addition. +This description assumes +that headers will be in /usr/local/include, and that the libraries +are in /usr/local/lib. + +. subsection + +There are three main-configuration options: +.cindex DMARC "configuration options" + +The &%dmarc_tld_file%& option +.oindex &%dmarc_tld_file%& +defines the location of a text file of valid +top level domains the opendmarc library uses +during domain parsing. Maintained by Mozilla, +the most current version can be downloaded +from a link at &url(https://publicsuffix.org/list/, currently pointing +at https://publicsuffix.org/list/public_suffix_list.dat) +See also util/renew-opendmarc-tlds.sh script. +The default for the option is /etc/exim/opendmarc.tlds. + + +The &%dmarc_history_file%& option, if set +.oindex &%dmarc_history_file%& +defines the location of a file to log results +of dmarc verification on inbound emails. The +contents are importable by the opendmarc tools +which will manage the data, send out DMARC +reports, and expire the data. Make sure the +directory of this file is writable by the user +exim runs as. +The default is unset. + +The &%dmarc_forensic_sender%& option +.oindex &%dmarc_forensic_sender%& +defines an alternate email address to use when sending a +forensic report detailing alignment failures +if a sender domain's dmarc record specifies it +and you have configured Exim to send them. +If set, this is expanded and used for the +From: header line; the address is extracted +from it and used for the envelope from. +If not set (the default), the From: header is expanded from +the dsn_from option, and <> is used for the +envelope from. + +. I wish we had subsections... + +.cindex DMARC controls +By default, the DMARC processing will run for any remote, +non-authenticated user. It makes sense to only verify DMARC +status of messages coming from remote, untrusted sources. You can +use standard conditions such as hosts, senders, etc, to decide that +DMARC verification should *not* be performed for them and disable +DMARC with an ACL control modifier: +.code + control = dmarc_disable_verify +.endd +A DMARC record can also specify a "forensic address", which gives +exim an email address to submit reports about failed alignment. +Exim does not do this by default because in certain conditions it +results in unintended information leakage (what lists a user might +be subscribed to, etc). You must configure exim to submit forensic +reports to the owner of the domain. If the DMARC record contains a +forensic address and you specify the control statement below, then +exim will send these forensic emails. It is also advised that you +configure a &%dmarc_forensic_sender%& because the default sender address +construction might be inadequate. +.code + control = dmarc_enable_forensic +.endd +(AGAIN: You can choose not to send these forensic reports by simply +not putting the dmarc_enable_forensic control line at any point in +your exim config. If you don't tell exim to send them, it will not +send them.) + +There are no options to either control. Both must appear before +the DATA acl. + +. subsection + +DMARC checks cam be run on incoming SMTP messages by using the +&"dmarc_status"& ACL condition in the DATA ACL. You are required to +call the &"spf"& condition first in the ACLs, then the &"dmarc_status"& +condition. Putting this condition in the ACLs is required in order +for a DMARC check to actually occur. All of the variables are set +up before the DATA ACL, but there is no actual DMARC check that +occurs until a &"dmarc_status"& condition is encountered in the ACLs. + +The &"dmarc_status"& condition takes a list of strings on its +right-hand side. These strings describe recommended action based +on the DMARC check. To understand what the policy recommendations +mean, refer to the DMARC website above. Valid strings are: +.display +&'accept '& The DMARC check passed and the library recommends accepting the email. +&'reject '& The DMARC check failed and the library recommends rejecting the email. +&'quarantine '& The DMARC check failed and the library recommends keeping it for further inspection. +&'none '& The DMARC check passed and the library recommends no specific action, neutral. +&'norecord '& No policy section in the DMARC record for this sender domain. +&'nofrom '& Unable to determine the domain of the sender. +&'temperror '& Library error or dns error. +&'off '& The DMARC check was disabled for this email. +.endd +You can prefix each string with an exclamation mark to invert its +meaning, for example "!accept" will match all results but +"accept". The string list is evaluated left-to-right in a +short-circuit fashion. When a string matches the outcome of the +DMARC check, the condition succeeds. If none of the listed +strings matches the outcome of the DMARC check, the condition +fails. + +Of course, you can also use any other lookup method that Exim +supports, including LDAP, Postgres, MySQL, etc, as long as the +result is a list of colon-separated strings. + +Performing the check sets up information used by the +&%authresults%& expansion item. + +Several expansion variables are set before the DATA ACL is +processed, and you can use them in this ACL. The following +expansion variables are available: + +.vlist +.vitem &$dmarc_status$& +.vindex &$dmarc_status$& +.cindex DMARC result +A one word status indicating what the DMARC library +thinks of the email. It is a combination of the results of +DMARC record lookup and the SPF/DKIM/DMARC processing results +(if a DMARC record was found). The actual policy declared +in the DMARC record is in a separate expansion variable. + +.vitem &$dmarc_status_text$& +.vindex &$dmarc_status_text$& +Slightly longer, human readable status. + +.vitem &$dmarc_used_domain$& +.vindex &$dmarc_used_domain$& +The domain which DMARC used to look up the DMARC policy record. + +.vitem &$dmarc_domain_policy$& +.vindex &$dmarc_domain_policy$& +The policy declared in the DMARC record. Valid values +are "none", "reject" and "quarantine". It is blank when there +is any error, including no DMARC record. +.endlist + +. subsection + +By default, Exim's DMARC configuration is intended to be +non-intrusive and conservative. To facilitate this, Exim will not +create any type of logging files without explicit configuration by +you, the admin. Nor will Exim send out any emails/reports about +DMARC issues without explicit configuration by you, the admin (other +than typical bounce messages that may come about due to ACL +processing or failure delivery issues). + +In order to log statistics suitable to be imported by the opendmarc +tools, you need to: +.ilist +Configure the global option &%dmarc_history_file%& +.next +Configure cron jobs to call the appropriate opendmarc history +import scripts and truncating the dmarc_history_file +.endlist + +In order to send forensic reports, you need to: +.ilist +Configure the global option &%dmarc_forensic_sender%& +.next +Configure, somewhere before the DATA ACL, the control option to +enable sending DMARC forensic reports +.endlist + +. subsection + +Example usage: +.code +(RCPT ACL) + warn domains = +local_domains + hosts = +local_hosts + control = dmarc_disable_verify + + warn !domains = +screwed_up_dmarc_records + control = dmarc_enable_forensic + + warn condition = (lookup if destined to mailing list) + set acl_m_mailing_list = 1 + +(DATA ACL) + warn dmarc_status = accept : none : off + !authenticated = * + log_message = DMARC DEBUG: $dmarc_status $dmarc_used_domain + + warn dmarc_status = !accept + !authenticated = * + log_message = DMARC DEBUG: '$dmarc_status' for $dmarc_used_domain + + warn dmarc_status = quarantine + !authenticated = * + set $acl_m_quarantine = 1 + # Do something in a transport with this flag variable + + deny condition = ${if eq{$dmarc_domain_policy}{reject}} + condition = ${if eq{$acl_m_mailing_list}{1}} + message = Messages from $dmarc_used_domain break mailing lists + + deny dmarc_status = reject + !authenticated = * + message = Message from $dmarc_used_domain failed sender's DMARC policy, REJECT + + warn add_header = :at_start:${authresults {$primary_hostname}} +.endd + +.wen + + + + . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -40758,7 +41150,9 @@ Events have names which correspond to the point in process at which they fire. The name is placed in the variable &$event_name$& and the event action expansion must check this, as it will be called for every possible event type. +.new The current list of events is: +.wen .display &`dane:fail after transport `& per connection &`msg:complete after main `& per message @@ -40772,6 +41166,7 @@ The current list of events is: &`tcp:close after transport `& per connection &`tls:cert before both `& per certificate in verification chain &`smtp:connect after transport `& per connection +&`smtp:ehlo after transport `& per connection .endd New event types may be added in future. @@ -40798,6 +41193,7 @@ with the event type: &`msg:host:defer `& error string &`tls:cert `& verification chain depth &`smtp:connect `& smtp banner +&`smtp:ehlo `& smtp ehlo response .endd The :defer events populate one extra variable: &$event_defer_errno$&.