Docs: update note on host_reject_connection
[exim.git] / doc / doc-docbook / spec.xfpt
index ed0036e0c7a72e601691be2230d30b47c48c0c90..5b3436f7403759b3499d09619f8a90c599c8af69 100644 (file)
@@ -6602,7 +6602,7 @@ file that is searched could contain lines like this:
 When the lookup succeeds, the result of the expansion is a list of domains (and
 possibly other types of item that are allowed in domain lists).
 .cindex "tainted data" "de-tainting"
-.cindex "de-tainting" "using a lookup expansion""
+.cindex "de-tainting" "using a lookup expansion"
 The result of the expansion is not tainted.
 
 .next
@@ -6696,11 +6696,11 @@ libraries and header files before building Exim.
 .cindex "single-key lookup" "list of types"
 The following single-key lookup types are implemented:
 
-.ilist
+.subsection cdb
 .cindex "cdb" "description of"
 .cindex "lookup" "cdb"
 .cindex "binary zero" "in lookup key"
-&(cdb)&: The given file is searched as a Constant DataBase file, using the key
+The given file is searched as a Constant DataBase file, using the key
 string without a terminating binary zero. The cdb format is designed for
 indexed files that are read frequently and never updated, except by total
 re-creation. As such, it is particularly suitable for large files containing
@@ -6716,11 +6716,12 @@ 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
 you need to obtain a cdb distribution in order to do this.
-.next
+
+.subsection dbm
 .cindex "DBM" "lookup type"
 .cindex "lookup" "dbm"
 .cindex "binary zero" "in lookup key"
-&(dbm)&: Calls to DBM library functions are used to extract data from the given
+Calls to DBM library functions are used to extract data from the given
 DBM file by looking up the record with the given key. A terminating binary
 zero is included in the key that is passed to the DBM library. See section
 &<<SECTdb>>& for a discussion of DBM libraries.
@@ -6732,25 +6733,27 @@ using Berkeley DB versions 3 or 4, it opens existing databases for reading with
 the DB_UNKNOWN option. This enables it to handle any of the types of database
 that the library supports, and can be useful for accessing DBM files created by
 other applications. (For earlier DB versions, DB_HASH is always used.)
-.next
+
+.subsection dbmjz
 .cindex "lookup" "dbmjz"
 .cindex "lookup" "dbm &-- embedded NULs"
 .cindex "sasldb2"
 .cindex "dbmjz lookup type"
-&(dbmjz)&: This is the same as &(dbm)&, except that the lookup key is
+This is the same as &(dbm)&, except that the lookup key is
 interpreted as an Exim list; the elements of the list are joined together with
 ASCII NUL characters to form the lookup key.  An example usage would be to
 authenticate incoming SMTP calls using the passwords from Cyrus SASL's
 &_/etc/sasldb2_& file with the &(gsasl)& authenticator or Exim's own
 &(cram_md5)& authenticator.
-.next
+
+.subsection dbmnz
 .cindex "lookup" "dbmnz"
 .cindex "lookup" "dbm &-- terminating zero"
 .cindex "binary zero" "in lookup key"
 .cindex "Courier"
 .cindex "&_/etc/userdbshadow.dat_&"
 .cindex "dbmnz lookup type"
-&(dbmnz)&: This is the same as &(dbm)&, except that a terminating binary zero
+This is the same as &(dbm)&, except that a terminating binary zero
 is not included in the key that is passed to the DBM library. You may need this
 if you want to look up data in files that are created by or shared with some
 other application that does not use terminating zeros. For example, you need to
@@ -6758,15 +6761,13 @@ use &(dbmnz)& rather than &(dbm)& if you want to authenticate incoming SMTP
 calls using the passwords from Courier's &_/etc/userdbshadow.dat_& file. Exim's
 utility program for creating DBM files (&'exim_dbmbuild'&) includes the zeros
 by default, but has an option to omit them (see section &<<SECTdbmbuild>>&).
-.next
+
+.subsection dsearch
 .cindex "lookup" "dsearch"
 .cindex "dsearch lookup type"
-&(dsearch)&: The given file must be an
-absolute
-directory path; this is searched for an entry
+The given file must be an absolute directory path; this is searched for an entry
 whose name is the key by calling the &[lstat()]& function.
-The key may not
-contain any forward slash characters.
+The key may not contain any forward slash characters.
 If &[lstat()]& succeeds then so does the lookup.
 .cindex "tainted data" "dsearch result"
 The result is regarded as untainted.
@@ -6795,10 +6796,11 @@ and symlinks.
 An example of how this
 lookup can be used to support virtual domains is given in section
 &<<SECTvirtualdomains>>&.
-.next
+
+.subsection iplsearch
 .cindex "lookup" "iplsearch"
 .cindex "iplsearch lookup type"
-&(iplsearch)&: The given file is a text file containing keys and data. A key is
+The given file is a text file containing keys and data. A key is
 terminated by a colon or white space or the end of the line. The keys in the
 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
@@ -6831,11 +6833,11 @@ One option is supported, "ret=full", to request the return of the entire line
 rather than omitting the key portion.
 Note however that the key portion will have been de-quoted.
 
-.next
+.subsection json
 .cindex lookup json
 .cindex json "lookup type"
 .cindex JSON expansions
-&(json)&: The given file is a text file with a JSON structure.
+The given file is a text file with a JSON structure.
 An element of the structure is extracted, defined by the search key.
 The key is a list of subelement selectors
 (colon-separated by default but changeable in the usual way)
@@ -6850,11 +6852,11 @@ is returned.
 For elements of type string, the returned value is de-quoted.
 
 
-.next
+.subsection lmdb
 .cindex LMDB
 .cindex lookup lmdb
 .cindex database lmdb
-&(lmdb)&: The given file is an LMDB database.
+The given file is an LMDB database.
 LMDB is a memory-mapped key-value store,
 with API modeled loosely on that of BerkeleyDB.
 See &url(https://symas.com/products/lightning-memory-mapped-database/)
@@ -6869,12 +6871,12 @@ You will need to separately create the LMDB database file,
 possibly using the &"mdb_load"& utility.
 
 
-.next
+.subsection lsearch
 .cindex "linear search"
 .cindex "lookup" "lsearch"
 .cindex "lsearch lookup type"
 .cindex "case sensitivity" "in lsearch lookup"
-&(lsearch)&: The given file is a text file that is searched linearly for a
+The given file is a text file that is searched linearly for a
 line beginning with the search key, terminated by a colon or white space or the
 end of the line. The search is case-insensitive; that is, upper and lower case
 letters are treated as the same. The first occurrence of the key that is found
@@ -6904,17 +6906,17 @@ contents (see section &<<SECTstrings>>&). An optional colon is permitted after
 quoted keys (exactly as for unquoted keys). There is no special handling of
 quotes for the data part of an &(lsearch)& line.
 
-.next
+.subsection nis
 .cindex "NIS lookup type"
 .cindex "lookup" "NIS"
 .cindex "binary zero" "in lookup key"
-&(nis)&: The given file is the name of a NIS map, and a NIS lookup is done with
+The given file is the name of a NIS map, and a NIS lookup is done with
 the given key, without a terminating binary zero. There is a variant called
 &(nis0)& which does include the terminating binary zero in the key. This is
 reportedly needed for Sun-style alias files. Exim does not recognize NIS
 aliases; the full map names must be used.
 
-.next
+.subsection (n)wildlsearch
 .cindex "wildlsearch lookup type"
 .cindex "lookup" "wildlsearch"
 .cindex "nwildlsearch lookup type"
@@ -6930,32 +6932,29 @@ Like &(lsearch)&, the testing is done case-insensitively. However, keys in the
 file that are regular expressions can be made case-sensitive by the use of
 &`(-i)`& within the pattern. The following forms of wildcard are recognized:
 
-. ==== As this is a nested list, any displays it contains must be indented
-. ==== as otherwise they are too far to the left.
-
 .olist
 The string may begin with an asterisk to mean &"ends with"&. For example:
 .code
-    *.a.b.c       data for anything.a.b.c
-    *fish         data for anythingfish
+*.a.b.c       data for anything.a.b.c
+*fish         data for anythingfish
 .endd
 .next
 The string may begin with a circumflex to indicate a regular expression. For
 example, for &(wildlsearch)&:
 .code
-    ^\N\d+\.a\.b\N    data for <digits>.a.b
+^\N\d+\.a\.b\N    data for <digits>.a.b
 .endd
 Note the use of &`\N`& to disable expansion of the contents of the regular
 expression. If you are using &(nwildlsearch)&, where the keys are not
 string-expanded, the equivalent entry is:
 .code
-    ^\d+\.a\.b        data for <digits>.a.b
+^\d+\.a\.b        data for <digits>.a.b
 .endd
 The case-insensitive flag is set at the start of compiling the regular
 expression, but it can be turned off by using &`(-i)`& at an appropriate point.
 For example, to make the entire pattern case-sensitive:
 .code
-    ^(?-i)\d+\.a\.b        data for <digits>.a.b
+^(?-i)\d+\.a\.b        data for <digits>.a.b
 .endd
 
 If the regular expression contains white space or colon characters, you must
@@ -6976,7 +6975,7 @@ is used to implement &((n)wildlsearch)& means that the string may begin with a
 lookup name terminated by a semicolon, and followed by lookup data. For
 example:
 .code
-    cdb;/some/file  data for keys that match the file
+cdb;/some/file  data for keys that match the file
 .endd
 The data that is obtained from the nested lookup is discarded.
 .endlist olist
@@ -6989,13 +6988,12 @@ be followed by optional colons.
 &((n)wildlsearch)& can &'not'& be turned into a DBM or cdb file, because those
 lookup types support only literal keys.
 
-.next
+.subsection spf
 .cindex "spf lookup type"
 .cindex "lookup" "spf"
-&(spf)&: If Exim is built with SPF support, manual lookups can be done
+If Exim is built with SPF support, manual lookups can be done
 (as opposed to the standard ACL condition method).
 For details see section &<<SECSPF>>&.
-.endlist ilist
 
 
 .section "Query-style lookup types" "SECTquerystylelookups"
@@ -7004,44 +7002,50 @@ For details see section &<<SECSPF>>&.
 The supported query-style lookup types are listed below. Further details about
 many of them are given in later sections.
 
-.ilist
+.subsection dnsdb
 .cindex "DNS" "as a lookup type"
 .cindex "lookup" "DNS"
-&(dnsdb)&: This does a DNS search for one or more records whose domain names
+This does a DNS search for one or more records whose domain names
 are given in the supplied query. The resulting data is the contents of the
 records. See section &<<SECTdnsdb>>&.
-.next
+
+.subsection ibase
 .cindex "InterBase lookup type"
 .cindex "lookup" "InterBase"
-&(ibase)&: This does a lookup in an InterBase database.
-.next
+This does a lookup in an InterBase database.
+
+.subsection ldap
 .cindex "LDAP" "lookup type"
 .cindex "lookup" "LDAP"
-&(ldap)&: This does an LDAP lookup using a query in the form of a URL, and
+This does an LDAP lookup using a query in the form of a URL, and
 returns attributes from a single entry. There is a variant called &(ldapm)&
 that permits values from multiple entries to be returned. A third variant
 called &(ldapdn)& returns the Distinguished Name of a single entry instead of
 any attribute values. See section &<<SECTldap>>&.
-.next
+
+.subsection mysql
 .cindex "MySQL" "lookup type"
 .cindex "lookup" "MySQL"
-&(mysql)&: The format of the query is an SQL statement that is passed to a
+The format of the query is an SQL statement that is passed to a
 MySQL database. See section &<<SECTsql>>&.
-.next
+
+.subsection nisplus
 .cindex "NIS+ lookup type"
 .cindex "lookup" "NIS+"
-&(nisplus)&: This does a NIS+ lookup using a query that can specify the name of
+This does a NIS+ lookup using a query that can specify the name of
 the field to be returned. See section &<<SECTnisplus>>&.
-.next
+
+.subsection oracle
 .cindex "Oracle" "lookup type"
 .cindex "lookup" "Oracle"
-&(oracle)&: The format of the query is an SQL statement that is passed to an
+The format of the query is an SQL statement that is passed to an
 Oracle database. See section &<<SECTsql>>&.
-.next
+
+.subsection passwd
 .cindex "lookup" "passwd"
 .cindex "passwd lookup type"
 .cindex "&_/etc/passwd_&"
-&(passwd)& is a query-style lookup with queries that are just user names. The
+This is a query-style lookup with queries that are just user names. The
 lookup calls &[getpwnam()]& to interrogate the system password data, and on
 success, the result string is the same as you would get from an &(lsearch)&
 lookup on a traditional &_/etc/passwd file_&, though with &`*`& for the
@@ -7049,32 +7053,33 @@ password value. For example:
 .code
 *:42:42:King Rat:/home/kr:/bin/bash
 .endd
-.next
+
+.subsection pgsql
 .cindex "PostgreSQL lookup type"
 .cindex "lookup" "PostgreSQL"
-&(pgsql)&: The format of the query is an SQL statement that is passed to a
+The format of the query is an SQL statement that is passed to a
 PostgreSQL database. See section &<<SECTsql>>&.
 
-.next
+.subsection redis
 .cindex "Redis lookup type"
 .cindex lookup Redis
-&(redis)&: The format of the query is either a simple get or simple set,
+The format of the query is either a simple get or simple set,
 passed to a Redis database. See section &<<SECTsql>>&.
 
-.next
+.subsection sqlite
 .cindex "sqlite lookup type"
 .cindex "lookup" "sqlite"
-&(sqlite)&: The format of the query is
+The format of the query is
 an SQL statement that is passed to an SQLite database. See section &<<SECTsqlite>>&.
 
-.next
-&(testdb)&: This is a lookup type that is used for testing Exim. It is
+.subsection testdb
+This is a lookup type that is used for testing Exim. It is
 not likely to be useful in normal operation.
-.next
+
+.subsection whoson
 .cindex "whoson lookup type"
 .cindex "lookup" "whoson"
-. --- still http:-only, 2018-09-07
-&(whoson)&: &'Whoson'& (&url(http://whoson.sourceforge.net)) is a protocol that
+&'Whoson'& (&url(http://whoson.sourceforge.net)) is a protocol that
 allows a server to check whether a particular (dynamically allocated) IP
 address is currently allocated to a known (trusted) user and, optionally, to
 obtain the identity of the said user. For SMTP servers, &'Whoson'& was popular
@@ -7089,7 +7094,6 @@ The query consists of a single IP address. The value returned is the name of
 the authenticated user, which is stored in the variable &$value$&. However, in
 this example, the data in &$value$& is not used; the result of the lookup is
 one of the fixed strings &"yes"& or &"no"&.
-.endlist
 
 
 
@@ -9903,7 +9907,11 @@ After expansion, <&'string'&> is interpreted as a list, colon-separated by
 default, but the separator can be changed in the usual way (&<<SECTlistsepchange>>&).
 For each item
 in this list, its value is place in &$item$&, and then the condition is
-evaluated. If the condition is true, &$item$& is added to the output as an
+evaluated.
+.new
+Any modification of &$value$& by this evaluation is discarded.
+.wen
+If the condition is true, &$item$& is added to the output as an
 item in a new list; if the condition is false, the item is discarded. The
 separator used for the output list is the same as the one used for the
 input, but a separator setting is not included in the output. For example:
@@ -9911,7 +9919,8 @@ 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'&>&*}}*&
@@ -10502,6 +10511,17 @@ At the end of a &*reduce*& expansion, the values of &$item$& and &$value$& are
 restored to what they were before. See also the &%filter%& and &%map%&
 expansion items.
 
+. A bit of a special-case logic error in writing an expansion;
+. probably not worth including in the mainline of documentation.
+. If only we had footnotes (the html output variant is the problem).
+.
+. .new
+. &*Note*&: if an &'expansion condition'& is used in <&'string3'&>
+. and that condition modifies &$value$&,
+. then the string expansions dependent on the condition cannot use
+. the &$value$& of the reduce iteration.
+. .wen
+
 .vitem &*$rheader_*&<&'header&~name'&>&*:*&&~or&~&*$rh_*&<&'header&~name'&>&*:*&
 This item inserts &"raw"& header lines. It is described with the &%header%&
 expansion item in section &<<SECTexpansionitems>>& above.
@@ -11654,6 +11674,7 @@ Consider using a dsearch lookup.
 .cindex "first delivery"
 .cindex "expansion" "first delivery test"
 .cindex "&%first_delivery%& expansion condition"
+.cindex retry condition
 This condition, which has no data, is true during a message's first delivery
 attempt. It is false during any subsequent delivery attempts.
 
@@ -16168,9 +16189,12 @@ case. That is why the default tries a DNS lookup first.
 .cindex "host" "rejecting connections from"
 If this option is set, incoming SMTP calls from the hosts listed are rejected
 as soon as the connection is made.
-This option is obsolete, and retained only for backward compatibility, because
+This option is mostly obsolete, retained for backward compatibility because
 nowadays the ACL specified by &%acl_smtp_connect%& can also reject incoming
-connections immediately.
+connections immediately
+.new
+(except for tls-on-connect connections).
+.wen
 
 The ability to give an immediate rejection (either by this option or using an
 ACL) is provided for use in unusual cases. Many hosts will just try again,
@@ -25586,12 +25610,18 @@ hard failure if required. See also &%hosts_try_auth%&, and chapter
 &<<CHAPSMTPAUTH>>& for details of authentication.
 
 
-.option hosts_request_ocsp smtp "host list&!!" *
+.option hosts_request_ocsp smtp "host list&!!" "see below"
 .cindex "TLS" "requiring for certain servers"
 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.
 
+.new
+The default is &"**"& if DANE is not in use for the connection,
+or if DANE-TA us used.
+It is empty if DANE-EE is used.
+.wen
+
 .option hosts_require_alpn smtp "host list&!!" unset
 .cindex ALPN "require negotiation in client"
 .cindex TLS ALPN
@@ -26061,7 +26091,7 @@ If both this option and &%tls_try_verify_hosts%& are unset
 operation is as if this option selected all hosts.
 &*Warning*&: Including a host in &%tls_verify_hosts%& does not require
 that connections use TLS.
-Fallback to in-clear communication will be done unless restricted by 
+Fallback to in-clear communication will be done unless restricted by
 the &%hosts_require_tls%& option.
 
 .option utf8_downconvert smtp integer&!! -1
@@ -29381,7 +29411,7 @@ For outgoing SMTP deliveries, &$tls_out_cipher$& is used and logged
 (again depending on the &%tls_cipher%& log selector).
 
 
-.subsection "Requesting and verifying client certificates" SECID183
+.subsection "Requesting and verifying client certificates"
 .cindex "certificate" "verification of client"
 .cindex "TLS" "client certificate verification"
 If you want an Exim server to request a certificate when negotiating a TLS
@@ -29434,86 +29464,7 @@ Because it is often a long text string, it is not included in the log line or
 certificate is supplied, &$tls_in_peerdn$& is empty.
 
 
-.section "Revoked certificates" "SECID184"
-.cindex "TLS" "revoked certificates"
-.cindex "revocation list"
-.cindex "certificate" "revocation list"
-.cindex "OCSP" "stapling"
-Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
-certificates are revoked. If you have such a list, you can pass it to an Exim
-server using the global option called &%tls_crl%& and to an Exim client using
-an identically named option for the &(smtp)& transport. In each case, the value
-of the option is expanded and must then be the name of a file that contains a
-CRL in PEM format.
-The downside is that clients have to periodically re-download a potentially huge
-file from every certificate authority they know of.
-
-The way with most moving parts at query time is Online Certificate
-Status Protocol (OCSP), where the client verifies the certificate
-against an OCSP server run by the CA.  This lets the CA track all
-usage of the certs.  It requires running software with access to the
-private key of the CA, to sign the responses to the OCSP queries.  OCSP
-is based on HTTP and can be proxied accordingly.
-
-The only widespread OCSP server implementation (known to this writer)
-comes as part of OpenSSL and aborts on an invalid request, such as
-connecting to the port and then disconnecting.  This requires
-re-entering the passphrase each time some random client does this.
-
-The third way is OCSP Stapling; in this, the server using a certificate
-issued by the CA periodically requests an OCSP proof of validity from
-the OCSP server, then serves it up inline as part of the TLS
-negotiation.   This approach adds no extra round trips, does not let the
-CA track users, scales well with number of certs issued by the CA and is
-resilient to temporary OCSP server failures, as long as the server
-starts retrying to fetch an OCSP proof some time before its current
-proof expires.  The downside is that it requires server support.
-
-Unless Exim is built with the support disabled,
-or with GnuTLS earlier than version 3.3.16 / 3.4.8
-support for OCSP stapling is included.
-
-There is a global option called &%tls_ocsp_file%&.
-The file specified therein is expected to be in DER format, and contain
-an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
-option will be re-expanded for SNI, if the &%tls_certificate%& option
-contains &`tls_in_sni`&, as per other TLS options.
-
-Exim does not at this time implement any support for fetching a new OCSP
-proof.  The burden is on the administrator to handle this, outside of
-Exim.  The file specified should be replaced atomically, so that the
-contents are always valid.  Exim will expand the &%tls_ocsp_file%& option
-on each connection, so a new file will be handled transparently on the
-next connection.
-
-When built with OpenSSL Exim will check for a valid next update timestamp
-in the OCSP proof; if not present, or if the proof has expired, it will be
-ignored.
-
-For the client to be able to verify the stapled OCSP the server must
-also supply, in its stapled information, any intermediate
-certificates for the chain leading to the OCSP proof from the signer
-of the server certificate.  There may be zero or one such. These
-intermediate certificates should be added to the server OCSP stapling
-file named by &%tls_ocsp_file%&.
-
-Note that the proof only covers the terminal server certificate,
-not any of the chain from CA to it.
-
-There is no current way to staple a proof for a client certificate.
-
-.code
-  A helper script "ocsp_fetch.pl" for fetching a proof from a CA
-  OCSP server is supplied.  The server URL may be included in the
-  server certificate, if the CA is helpful.
-
-  One failure mode seen was the OCSP Signer cert expiring before the end
-  of validity of the OCSP proof. The checking done by Exim/OpenSSL
-  noted this as invalid overall, but the re-fetch script did not.
-.endd
-
-
-.section "Caching of static server configuration items" "SECTserverTLScache"
+.subsection "Caching of static server configuration items" "SSECTserverTLScache"
 .cindex certificate caching
 .cindex privatekey caching
 .cindex crl caching
@@ -29819,6 +29770,7 @@ When Exim is built against GnuTLS, SNI support is available as of GnuTLS
 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
 built, then you have SNI support).
 
+.subsection ALPN
 .cindex TLS ALPN
 .cindex ALPN "general information"
 .cindex TLS "Application Layer Protocol Names"
@@ -29829,7 +29781,7 @@ connection.
 The client for the connection proposes a set of protocol names, and
 the server responds with a selected one.
 It is not, as of 2021, commonly used for SMTP connections.
-However, to guard against misirected or malicious use of web clients
+However, to guard against misdirected or malicious use of web clients
 (which often do use ALPN) against MTA ports, Exim by default check that
 there is no incompatible ALPN specified by a client for a TLS connection.
 If there is, the connection is rejected.
@@ -29839,7 +29791,7 @@ The behaviour of both client and server can be configured using the options
 &%tls_alpn%& and &%hosts_require_alpn%&.
 There are no variables providing observability.
 Some feature-specific logging may appear on denied connections, but this
-depends on the behavious of the peer
+depends on the behaviour of the peer
 (not all peers can send a feature-specific TLS Alert).
 
 This feature is available when Exim is built with
@@ -29988,6 +29940,94 @@ For information on creating self-signed CA certificates and using them to sign
 user certificates, see the &'General implementation overview'& chapter of the
 Open-source PKI book, available online at
 &url(https://sourceforge.net/projects/ospkibook/).
+
+
+.subsection "Revoked certificates"
+.cindex "TLS" "revoked certificates"
+.cindex "revocation list"
+.cindex "certificate" "revocation list"
+.cindex "OCSP" "stapling"
+There are three ways for a certificate to be made unusable
+before its expiry.
+
+.ilist
+Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
+certificates are revoked. If you have such a list, you can pass it to an Exim
+server using the global option called &%tls_crl%& and to an Exim client using
+an identically named option for the &(smtp)& transport. In each case, the value
+of the option is expanded and must then be the name of a file that contains a
+CRL in PEM format.
+The downside is that clients have to periodically re-download a potentially huge
+file from every certificate authority they know of.
+
+.next
+The way with most moving parts at query time is Online Certificate
+Status Protocol (OCSP), where the client verifies the certificate
+against an OCSP server run by the CA.  This lets the CA track all
+usage of the certs.  It requires running software with access to the
+private key of the CA, to sign the responses to the OCSP queries.  OCSP
+is based on HTTP and can be proxied accordingly.
+
+The only widespread OCSP server implementation (known to this writer)
+comes as part of OpenSSL and aborts on an invalid request, such as
+connecting to the port and then disconnecting.  This requires
+re-entering the passphrase each time some random client does this.
+
+.next
+The third way is OCSP Stapling; in this, the server using a certificate
+issued by the CA periodically requests an OCSP proof of validity from
+the OCSP server, then serves it up inline as part of the TLS
+negotiation.   This approach adds no extra round trips, does not let the
+CA track users, scales well with number of certs issued by the CA and is
+resilient to temporary OCSP server failures, as long as the server
+starts retrying to fetch an OCSP proof some time before its current
+proof expires.  The downside is that it requires server support.
+
+Unless Exim is built with the support disabled,
+or with GnuTLS earlier than version 3.3.16 / 3.4.8
+support for OCSP stapling is included.
+
+There is a global option called &%tls_ocsp_file%&.
+The file specified therein is expected to be in DER format, and contain
+an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
+option will be re-expanded for SNI, if the &%tls_certificate%& option
+contains &`tls_in_sni`&, as per other TLS options.
+
+Exim does not at this time implement any support for fetching a new OCSP
+proof.  The burden is on the administrator to handle this, outside of
+Exim.  The file specified should be replaced atomically, so that the
+contents are always valid.  Exim will expand the &%tls_ocsp_file%& option
+on each connection, so a new file will be handled transparently on the
+next connection.
+
+When built with OpenSSL Exim will check for a valid next update timestamp
+in the OCSP proof; if not present, or if the proof has expired, it will be
+ignored.
+
+For the client to be able to verify the stapled OCSP the server must
+also supply, in its stapled information, any intermediate
+certificates for the chain leading to the OCSP proof from the signer
+of the server certificate.  There may be zero or one such. These
+intermediate certificates should be added to the server OCSP stapling
+file named by &%tls_ocsp_file%&.
+
+Note that the proof only covers the terminal server certificate,
+not any of the chain from CA to it.
+
+There is no current way to staple a proof for a client certificate.
+
+.code
+  A helper script "ocsp_fetch.pl" for fetching a proof from a CA
+  OCSP server is supplied.  The server URL may be included in the
+  server certificate, if the CA is helpful.
+
+  One failure mode seen was the OCSP Signer cert expiring before the end
+  of validity of the OCSP proof. The checking done by Exim/OpenSSL
+  noted this as invalid overall, but the re-fetch script did not.
+.endd
+.endlist
+
+
 .ecindex IIDencsmtp1
 .ecindex IIDencsmtp2
 
@@ -30105,18 +30145,24 @@ DANE scales better than having to maintain (and communicate via side-channel) co
 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
+DANE requires a server operator to do three things:
+.olist
+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.
+.next
+Add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
+.next
+Offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
+.endlist
 
 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.
 
+.subsection "DNS records"
 A TLSA record consist of 4 fields, the "Certificate Usage", the
 "Selector", the "Matching type", and the "Certificate Association Data".
 For a detailed description of the TLSA record see
@@ -30197,6 +30243,7 @@ libraries.
 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
 interoperability (and probably the maximum too, in 2018).
 
+.subsection "Interaction with OCSP"
 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:
@@ -30217,6 +30264,7 @@ This modification of hosts_request_ocsp is only done if it has the default value
 those who use &%hosts_require_ocsp%&, should consider the interaction with DANE in their OCSP settings.
 
 
+.subsection "Client configuration"
 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
@@ -30255,6 +30303,7 @@ verification evaluation is wanted, the above variables should be set appropriate
 The router and transport option &%dnssec_request_domains%& must not be
 set to &"never"&, and &%dnssec_require_domains%& is ignored.
 
+.subsection Observability
 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
@@ -30270,11 +30319,13 @@ required.  This is intended to support TLS-reporting as defined in
 The &$event_data$& will be one of the Result Types defined in
 Section 4.3 of that document.
 
+.subsection General
 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
+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
@@ -32964,7 +33015,7 @@ address you should specify alternate list separators for both the outer
 The &%seen%& ACL condition can be used to test whether a
 situation has been previously met.
 It uses a hints database to record a timestamp against a key.
-host. The syntax of the condition is:
+The syntax of the condition is:
 .display
 &`seen =`& <&'optional flag'&><&'time interval'&> &`/`& <&'options'&>
 .endd
@@ -33082,16 +33133,23 @@ the &%count=%& option.
 
 .subsection "Ratelimit options for what is being measured" ratoptmea
 .cindex "rate limiting" "per_* options"
-The &%per_conn%& option limits the client's connection rate. It is not
+.vlist
+.vitem per_conn
+.cindex "rate limiting" per_conn
+This option limits the client's connection rate. It is not
 normally used in the &%acl_not_smtp%&, &%acl_not_smtp_mime%&, or
 &%acl_not_smtp_start%& ACLs.
 
-The &%per_mail%& option limits the client's rate of sending messages. This is
+.vitem per_mail
+.cindex "rate limiting" per_conn
+This option limits the client's rate of sending messages. This is
 the default if none of the &%per_*%& options is specified. It can be used in
 &%acl_smtp_mail%&, &%acl_smtp_rcpt%&, &%acl_smtp_predata%&, &%acl_smtp_mime%&,
 &%acl_smtp_data%&, or &%acl_not_smtp%&.
 
-The &%per_byte%& option limits the sender's email bandwidth. It can be used in
+.vitem per_byte
+.cindex "rate limiting" per_conn
+This option limits the sender's email bandwidth. It can be used in
 the same ACLs as the &%per_mail%& option, though it is best to use this option
 in the &%acl_smtp_mime%&, &%acl_smtp_data%& or &%acl_not_smtp%& ACLs; if it is
 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
@@ -33099,7 +33157,9 @@ in its MAIL command, which may be inaccurate or completely missing. You can
 follow the limit &'m'& in the configuration with K, M, or G to specify limits
 in kilobytes, megabytes, or gigabytes, respectively.
 
-The &%per_rcpt%& option causes Exim to limit the rate at which recipients are
+.vitem per_rcpt
+.cindex "rate limiting" per_rcpt
+This option causes Exim to limit the rate at which recipients are
 accepted. It can be used in the &%acl_smtp_rcpt%&, &%acl_smtp_predata%&,
 &%acl_smtp_mime%&, or &%acl_smtp_data%& ACLs. In
 &%acl_smtp_rcpt%& the rate is updated one recipient at a time; in the other
@@ -33107,24 +33167,37 @@ ACLs the rate is updated with the total (accepted) recipient count in one go. No
 in either case the rate limiting engine will see a message with many
 recipients as a large high-speed burst.
 
-The &%per_addr%& option is like the &%per_rcpt%& option, except it counts the
+.vitem per_addr
+.cindex "rate limiting" per_addr
+This option is like the &%per_rcpt%& option, except it counts the
 number of different recipients that the client has sent messages to in the
 last time period. That is, if the client repeatedly sends messages to the same
 recipient, its measured rate is not increased. This option can only be used in
 &%acl_smtp_rcpt%&.
 
-The &%per_cmd%& option causes Exim to recompute the rate every time the
+.vitem per_cmd
+.cindex "rate limiting" per_cmd
+This option causes Exim to recompute the rate every time the
 condition is processed. This can be used to limit the rate of any SMTP
 command. If it is used in multiple ACLs it can limit the aggregate rate of
 multiple different commands.
 
-The &%count=%& option can be used to alter how much Exim adds to the client's
-measured rate. For example, the &%per_byte%& option is equivalent to
-&`per_mail/count=$message_size`&. If there is no &%count=%& option, Exim
+.vitem count
+.cindex "rate limiting" count
+This option can be used to alter how much Exim adds to the client's
+measured rate.
+A value is required, after an equals sign.
+For example, the &%per_byte%& option is equivalent to
+&`per_mail/count=$message_size`&.
+If there is no &%count=%& option, Exim
 increases the measured rate by one (except for the &%per_rcpt%& option in ACLs
-other than &%acl_smtp_rcpt%&). The count does not have to be an integer.
+other than &%acl_smtp_rcpt%&).
+The count does not have to be an integer.
 
-The &%unique=%& option is described in section &<<ratoptuniq>>& below.
+.vitem unique
+.cindex "rate limiting" unique
+This option is described in section &<<ratoptuniq>>& below.
+.endlist
 
 
 .subsection "Ratelimit update modes" ratoptupd
@@ -35811,6 +35884,7 @@ The system filter is run at the start of a delivery attempt, before any routing
 is done. If a message fails to be completely delivered at the first attempt,
 the system filter is run again at the start of every retry.
 If you want your filter to do something only once per message, you can make use
+.cindex retry condition
 of the &%first_delivery%& condition in an &%if%& command in the filter to
 prevent it happening on retries.
 
@@ -42151,7 +42225,7 @@ the DATA acl.
 .subsection ACL SSECDMARCACL
 .cindex DMARC "ACL condition"
 
-DMARC checks cam be run on incoming SMTP  messages by using the
+DMARC checks can 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