X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f5a39157bddc11662b93e06a9845c3d8a8dd7fa3..98820cd6053797a63f8daddd56c67ea6d8c13d46:/doc/doc-docbook/spec.xfpt diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index ed0036e0c..b8173a1b8 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -1,3 +1,4 @@ + . ///////////////////////////////////////////////////////////////////////////// . This is the primary source of the Exim Manual. It is an xfpt document that is . converted into DocBook XML for subsequent conversion into printable and online @@ -443,10 +444,11 @@ Please do not ask for configuration help in the bug-tracker. The following Exim mailing lists exist: .table2 140pt -.row &'exim-announce@exim.org'& "Moderated, low volume announcements list" -.row &'exim-users@exim.org'& "General discussion list" -.row &'exim-dev@exim.org'& "Discussion of bugs, enhancements, etc." -.row &'exim-cvs@exim.org'& "Automated commit messages from the VCS" +.row &'exim-announce@lists.exim.org'& "Moderated, low volume announcements list" +.row &'exim-users@lists.exim.org'& "General discussion list" +.row &'exim-users-de@lists.exim.org'& "General discussion list in German language" +.row &'exim-dev@lists.exim.org'& "Discussion of bugs, enhancements, etc." +.row &'exim-cvs@lists.exim.org'& "Automated commit messages from the VCS" .endtable You can subscribe to these lists, change your existing subscriptions, and view @@ -948,9 +950,10 @@ User filters are run as part of the routing process, described below. .cindex "base36" .cindex "Darwin" .cindex "Cygwin" +.cindex "exim_msgdate" Every message handled by Exim is given a &'message id'& which is sixteen characters long. It is divided into three parts, separated by hyphens, for -example &`16VDhn-0001bo-D3`&. Each part is a sequence of letters and digits, +example &`16VDhn-000000001bo-D342`&. Each part is a sequence of letters and digits, normally encoding numbers in base 62. However, in the Darwin operating system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36 (avoiding the use of lower case letters) is used instead, because the message @@ -971,21 +974,29 @@ started to be received, to a granularity of one second. That is, this field contains the number of seconds since the start of the epoch (the normal Unix way of representing the date and time of day). .next -After the first hyphen, the next six characters are the id of the process that -received the message. +After the first hyphen, the next +.new +eleven +.wen +characters are the id of the process that received the message. .next -There are two different possibilities for the final two characters: +.new +There are two different possibilities for the final four characters: .olist .oindex "&%localhost_number%&" If &%localhost_number%& is not set, this value is the fractional part of the -time of reception, normally in units of 1/2000 of a second, but for systems +time of reception, normally in units of +microseconds. +but for systems that must use base 36 instead of base 62 (because of case-insensitive file -systems), the units are 1/1000 of a second. +systems), the units are +2 us. .next -If &%localhost_number%& is set, it is multiplied by 200 (100) and added to -the fractional part of the time, which in this case is in units of 1/200 -(1/100) of a second. +If &%localhost_number%& is set, it is multiplied by +500000 (250000) and added to +the fractional part of the time, which in this case is in units of 2 us (4 us). .endlist +.wen .endlist After a message has been received, Exim waits for the clock to tick at the @@ -994,6 +1005,10 @@ received by the same process, or by another process with the same (re-used) pid, it is guaranteed that the time will be different. In most cases, the clock will already have ticked while the message was being received. +The exim_msgdate utility (see section &<>&) can be +used to display the date, and optionally the process id, of an Exim +Message ID. + .section "Receiving mail" "SECID13" .cindex "receiving mail" @@ -2810,6 +2825,14 @@ of Exim is installed. It is not necessary to do this when other files that are referenced from the configuration (for example, alias files) are changed, because these are reread each time they are used. +.new +Either a SIGTERM or a SIGINT signal should be used to cause the daemon +to cleanly shut down. +Subprocesses handling recceiving or delivering messages, +or for scanning the queue, +will not be affected by the termination of the daemon process. +.wen + .cmdopt -bdf This option has the same effect as &%-bd%& except that it never disconnects from the controlling terminal, even when no debugging is specified. @@ -3258,6 +3281,12 @@ to the standard output. It is restricted to admin users, unless &%queue_list_requires_admin%& is set false. +.cmdopt -bpi +.cindex queue "list of message IDs" +This option operates like &%-bp%&, but only outputs message ids +(one per line). + + .cmdopt -bpr This option operates like &%-bp%&, but the output is not sorted into chronological order of message arrival. This can speed it up when there are @@ -3267,6 +3296,9 @@ going to be post-processed in a way that doesn't need the sorting. .cmdopt -bpra This option is a combination of &%-bpr%& and &%-bpa%&. +.cmdopt -bpri +This option is a combination of &%-bpr%& and &%-bpi%&. + .cmdopt -bpru This option is a combination of &%-bpr%& and &%-bpu%&. @@ -4397,15 +4429,21 @@ It is only relevant when the &%-bd%& (start listening daemon) option is also given. Normally the daemon creates this socket, unless a &%-oX%& and &*no*& &%-oP%& option is also present. -If this option is given then the socket will not be created. This could be -required if the system is running multiple daemons. +.new +If this option is given then the socket will not be created. This is required +if the system is running multiple daemons, in which case it should +be used on all. +The features supported by the socket will not be available in such cases. The socket is currently used for .ilist fast ramp-up of queue runner processes .next +caching compiled regexes +.next obtaining a current queue size .endlist +.wen .cmdopt -pd .cindex "Perl" "starting the interpreter" @@ -4489,23 +4527,33 @@ every domain. Addresses are routed, local deliveries happen, but no remote transports are run. Performance will be best if the &%queue_run_in_order%& option is false. -If that is so and the &%queue_fast_ramp%& option is true then -in the first phase of the run, +If that is so and +the &%queue_fast_ramp%& option is true +and a daemon-notifier socket is available +then in the first phase of the run, once a threshold number of messages are routed for a given host, a delivery process is forked in parallel with the rest of the scan. .cindex "hints database" "remembering routing" The hints database that remembers which messages are waiting for specific hosts -is updated, as if delivery to those hosts had been deferred. After this is -complete, a second, normal queue scan happens, with routing and delivery taking -place as normal. Messages that are routed to the same host should mostly be +is updated, as if delivery to those hosts had been deferred. + +After the first queue scan complete, +a second, normal queue scan is done, with routing and delivery taking +place as normal. +Messages that are routed to the same host should mostly be delivered down a single SMTP .cindex "SMTP" "passed connection" .cindex "SMTP" "multiple deliveries" .cindex "multiple SMTP deliveries" connection because of the hints that were set up during the first queue scan. -This option may be useful for hosts that are connected to the Internet + +.new +Two-phase queue runs should be used on systems which, even intermittently, +have a large queue (such as mailing-list operators). +They may also be useful for hosts that are connected to the Internet intermittently. +.wen .vitem &%-q[q]i...%& .oindex "&%-qi%&" @@ -4591,6 +4639,15 @@ combined daemon at system boot time is to use a command such as Such a daemon listens for incoming SMTP calls, and also starts a queue runner process every 30 minutes. +.new +.cindex "named queues" "queue runners" +It is possible to set up runners for multiple named queues within one daemon, +For example: +.code +exim -qGhipri/2m -q10m -qqGmailinglist/1h +.endd +.wen + When a daemon is started by &%-q%& with a time value, but without &%-bd%&, no pid file is written unless one is explicitly requested by the &%-oP%& option. @@ -5103,6 +5160,10 @@ The following classes of macros are defined: &` _DRIVER_ROUTER_* `& router drivers &` _DRIVER_TRANSPORT_* `& transport drivers &` _DRIVER_AUTHENTICATOR_* `& authenticator drivers +&` _EXP_COND_* `& expansion conditions +&` _EXP_ITEM_* `& expansion items +&` _EXP_OP_* `& expansion operators +&` _EXP_VAR_* `& expansion variables &` _LOG_* `& log_selector values &` _OPT_MAIN_* `& main config options &` _OPT_ROUTERS_* `& generic router options @@ -6602,7 +6663,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 @@ -6671,6 +6732,12 @@ version of the lookup key. The &'query-style'& type accepts a generalized database query. No particular key value is assumed by Exim for query-style lookups. You can use whichever Exim variables you need to construct the database query. + +For the string-expansion kind of lookups, the query is given in the first +bracketed argument of the &${lookup ...}$& expansion. +For the list-argument kind of lookup the quury is given by the remainder of the +list item after the first semicolon. + .cindex "tainted data" "quoting for lookups" If tainted data is used in the query then it should be quuted by using the &*${quote_*&<&'lookup-type'&>&*:*&<&'string'&>&*}*& expansion operator @@ -6696,11 +6763,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 +6783,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 &<>& for a discussion of DBM libraries. @@ -6732,25 +6800,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 +6828,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 &<>&). -.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 +6863,11 @@ and symlinks. An example of how this lookup can be used to support virtual domains is given in section &<>&. -.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 +6900,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 +6919,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 +6938,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 +6973,17 @@ contents (see section &<>&). 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 +6999,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 .a.b +^\N\d+\.a\.b\N data for .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 .a.b +^\d+\.a\.b data for .a.b .endd The case-insensitive flag is set at the start of compiling the regular expression, but it can be turned off by using &`(-i)`& at an appropriate point. For example, to make the entire pattern case-sensitive: .code - ^(?-i)\d+\.a\.b data for .a.b +^(?-i)\d+\.a\.b data for .a.b .endd If the regular expression contains white space or colon characters, you must @@ -6976,7 +7042,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 +7055,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 &<>&. -.endlist ilist .section "Query-style lookup types" "SECTquerystylelookups" @@ -7004,44 +7069,50 @@ For details see section &<>&. 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 &<>&. -.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 &<>&. -.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 &<>&. -.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 &<>&. -.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 &<>&. -.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 +7120,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 &<>&. -.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 &<>&. -.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 &<>&. -.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 +7161,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 @@ -7307,10 +7378,15 @@ of the following form is provided: .code ${quote_:} .endd -For example, the safest way to write the NIS+ query is +For example, the way to write the NIS+ query is .code [name="${quote_nisplus:$local_part}"] .endd +.cindex "tainted data" "in lookups" +.new +&*All*& tainted data used in a quoery-style lookup must be quoted +using a mechanism appropriate for the lookup type. +.wen See chapter &<>& for full coverage of string expansions. The quote operator can be used for all lookup types, but has no effect for single-key lookups, since no quoting is ever needed in their key strings. @@ -7795,7 +7871,8 @@ connection timeout (the system timeout is used), no user or password, no limit on the number of entries returned, and no time limit on queries. When a DN is quoted in the USER= setting for LDAP authentication, Exim -removes any URL quoting that it may contain before passing it LDAP. Apparently +removes any URL quoting that it may contain before passing it to the LDAP library. +Apparently some libraries do this for themselves, but some do not. Removing the URL quoting has two advantages: @@ -9644,7 +9721,10 @@ 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. +This is safe even if no authentication results are available +.new +and would generally be placed in the DATA ACL. +.wen .vitem "&*${certextract{*&<&'field'&>&*}{*&<&'certificate'&>&*}&&& @@ -9902,8 +9982,12 @@ leading and trailing quotes are removed from the returned value. After expansion, <&'string'&> is interpreted as a list, colon-separated by default, but the separator can be changed in the usual way (&<>&). For each item -in this list, its value is place in &$item$&, and then the condition is -evaluated. If the condition is true, &$item$& is added to the output as an +in this list, its value is placed in &$item$&, and then the condition is +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 +9995,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'&>&*}}*& @@ -10430,6 +10515,11 @@ Defines whether or not a write-shutdown is done on the connection after sending the request. Values are &"yes"& (the default) or &"no"& (preferred, eg. by some webservers). +.next +&*sni*& +Controls the use of Server Name Identification on the connection. +Any nonempty value will be the SNI sent; TLS will be forced. + .next &*tls*& Controls the use of TLS on the connection. @@ -10502,16 +10592,28 @@ 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 &<>& above. -.vitem "&*${run <&'options'&> {*&<&'command&~arg&~list'&>&*}{*&<&'string1'&>&*}&&& +.vitem "&*${run<&'options'&> {*&<&'command&~arg&~list'&>&*}{*&<&'string1'&>&*}&&& {*&<&'string2'&>&*}}*&" .cindex "expansion" "running a command" .cindex "&%run%& expansion item" This item runs an external command, as a subprocess. -One option is supported after the word &'run'&, comma-separated. +One option is supported after the word &'run'&, comma-separated +and without whitespace. If the option &'preexpand'& is not used, the command string is split into individual arguments by spaces @@ -10993,6 +11095,24 @@ abbreviation &%h%& can be used when &%hash%& is used as an operator. +.new +.vitem &*${headerwrap_*&<&'cols'&>&*_*&<&'limit'&>&*:*&<&'string'&>&*}*& +.cindex header "wrapping operator" +.cindex expansion "header wrapping" +This operator line-wraps its argument in a way useful for headers. +The &'cols'& value gives the column number to wrap after, +the &'limit'& gives a limit number of result characters to truncate at. +Either just the &'limit'& and the preceding underbar, or both, can be omitted; +the defaults are 80 and 998. +Wrapping will be inserted at a space if possible before the +column number is reached. +Whitespace at a chosen wrap point is removed. +A line-wrap consists of a newline followed by a tab, +and the tab is counted as 8 columns. +.wen + + + .vitem &*${hex2b64:*&<&'hexstring'&>&*}*& .cindex "base64 encoding" "conversion from hex" .cindex "expansion" "hex to base64" @@ -11654,6 +11774,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. @@ -11738,8 +11859,8 @@ Case and collation order are defined per the system C locale. SRS decode. See SECT &<>& for details. -.vitem &*inlist&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& - &*inlisti&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& +.vitem &*inlist&~{*&<&'subject'&>&*}{*&<&'list'&>&*}*& &&& + &*inlisti&~{*&<&'subject'&>&*}{*&<&'list'&>&*}*& .cindex "string" "comparison" .cindex "list" "iterative conditions" Both strings are expanded; the second string is treated as a list of simple @@ -13350,7 +13471,8 @@ This is an obsolete name for &$bounce_return_size_limit$&. .cindex "router" "name" .cindex "name" "of router" .vindex "&$router_name$&" -During the running of a router this variable contains its name. +During the running of a router, or a transport called, +this variable contains the router name. .vitem &$runrc$& .cindex "return code" "from &%run%& expansion" @@ -13641,6 +13763,11 @@ there actually are, because many other connections may come and go while a single connection is being processed. When a child process terminates, the daemon decrements its copy of the variable. +.vitem &$smtp_notquit_reason$& +.vindex "&$smtp_notquit_reason$&" +When the not-QUIT ACL is running, this variable is set to a string +that indicates the reason for the termination of the SMTP connection. + .vitem "&$sn0$& &-- &$sn9$&" These variables are copies of the values of the &$n0$& &-- &$n9$& accumulators that were current at the end of the system filter file. This allows a system @@ -15592,7 +15719,12 @@ by a setting such as this: .code dns_again_means_nonexist = *.in-addr.arpa .endd -This option applies to all DNS lookups that Exim does. It also applies when the +This option applies to all DNS lookups that Exim does, +.new +except for TLSA lookups (where knowing about such failures +is security-relevant). +.wen +It also applies when the &[gethostbyname()]& or &[getipnodebyname()]& functions give temporary errors, since these are most likely to be caused by DNS lookup problems. The &(dnslookup)& router has some options of its own for controlling what happens @@ -15932,6 +16064,7 @@ search the file multiple times for non-existent users, and also cause delay. .option freeze_tell main "string list, comma separated" unset .cindex "freezing messages" "sending a message when freezing" +.cindex "frozen messages" "sending a message when freezing" On encountering certain errors, or when configured to do so in a system filter, ACL, or special router, Exim freezes a message. This means that no further delivery attempts take place until an administrator thaws the message, or the @@ -16172,6 +16305,11 @@ This option is obsolete, and retained only for backward compatibility, because nowadays the ACL specified by &%acl_smtp_connect%& can also reject incoming connections immediately. +.new +If the connection is on a TLS-on-connect port then the TCP connection is +just dropped. Otherwise, an SMTP error is sent first. +.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, sometimes without much delay. Normally, it is better to use an ACL to reject @@ -17662,13 +17800,18 @@ This facility is only available on Linux. .cindex "banner for SMTP" .cindex "welcome banner for SMTP" .cindex "customizing" "SMTP banner" -This string, which is expanded every time it is used, is output as the initial +If a connect ACL does not supply a message, +this string (which is expanded every time it is used) is output as the initial positive response to an SMTP connection. The default setting is: .code smtp_banner = $smtp_active_hostname ESMTP Exim \ $version_number $tod_full .endd -Failure to expand the string causes a panic error. If you want to create a +.new +Failure to expand the string causes a panic error; +a forced fail just closes the connection. +.wen +If you want to create a multiline response to the initial SMTP connection, use &"\n"& in the string at appropriate points, but not at the end. Note that the 220 code is not included in this string. Exim adds it automatically (several times in the case of a @@ -18410,20 +18553,27 @@ prior to the 4.80 release, as Debian used to patch Exim to raise the minimum acceptable bound from 1024 to 2048. -.option tls_eccurve main string&!! &`auto`& +.option tls_eccurve main string list&!! &`auto`& .cindex TLS "EC cryptography" -This option selects a EC curve for use by Exim when used with OpenSSL. -It has no effect when Exim is used with GnuTLS. +This option selects EC curves for use by Exim when used with OpenSSL. +It has no effect when Exim is used with GnuTLS +(the equivalent can be done using a priority string for the +&%tls_require_ciphers%& option). -After expansion it must contain a valid EC curve parameter, such as -&`prime256v1`&, &`secp384r1`&, or &`P-512`&. Consult your OpenSSL manual -for valid selections. +After expansion it must contain +.new +one or (only for OpenSSL versiona 1.1.1 onwards) more +.wen +EC curve names, such as &`prime256v1`&, &`secp384r1`&, or &`P-521`&. +Consult your OpenSSL manual for valid curve names. For OpenSSL versions before (and not including) 1.0.2, the string &`auto`& selects &`prime256v1`&. For more recent OpenSSL versions &`auto`& tells the library to choose. -If the option expands to an empty string, no EC curves will be enabled. +.new +If the option expands to an empty string, the effect is undefined. +.wen .option tls_ocsp_file main string&!! unset @@ -22358,7 +22508,7 @@ its removal from incoming messages, so that delivered messages can safely be resent to other recipients. &*Note:*& If used on a transport handling multiple recipients -(the smtp transport unless &%rcpt_max%& is 1, the appendfile, pipe or lmtp +(the smtp transport unless &%max_rcpt%& is 1, the appendfile, pipe or lmtp transport if &%batch_max%& is greater than 1) then information about Bcc recipients will be leaked. Doing so is generally not advised. @@ -22722,7 +22872,17 @@ example: transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}' .endd This runs the command &(/bin/cmd1)& if the host name is &'a.b.c'&, and -&(/bin/cmd2)& otherwise. If double quotes had been used, they would have been +&(/bin/cmd2)& otherwise. + +Option strings in general have any fully-surrounding double quote wrapping +removed early in parsing (see &<>&). +Then, for this option, quotes protect against whitespace being +regarded as a separator while splitting into the command argument vector. +Either double or single quotes can be used here; +the former interprets backlash-quoted charachters +and the latter does not. + +If double quotes had been used in this example, they would have been stripped by Exim when it read the option's value. When the value is used, if the single quotes were missing, the line would be split into two items, &`/bin/cmd${if`& and &`eq{$host}{a.b.c}{1}{2}`&, and an error would occur when @@ -25586,12 +25746,18 @@ hard failure if required. See also &%hosts_try_auth%&, and chapter &<>& 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 @@ -25733,12 +25899,22 @@ If this option is set true when the &%protocol%& option is set to &"lmtp"&, the string &`IGNOREQUOTA`& is added to RCPT commands, provided that the LMTP server has advertised support for IGNOREQUOTA in its response to the LHLO command. -.option max_rcpt smtp integer 100 +.option max_rcpt smtp integer&!! 100 .cindex "RCPT" "maximum number of outgoing" -This option limits the number of RCPT commands that are sent in a single -SMTP message transaction. Each set of addresses is treated independently, and +This option, +.new +after expansion, +.wen +limits the number of RCPT commands that are sent in a single +SMTP message transaction. +A value setting of zero disables the limit. + +.new +If a constant is given, +.wen +each set of addresses is treated independently, and so can cause parallel connections to the same host if &%remote_max_parallel%& -permits this. A value setting of zero disables the limit. +permits this. .option message_linelength_limit smtp integer 998 @@ -26011,7 +26187,8 @@ This option give a list of hosts for which, while verifying the server certificate, checks will be included on the host name (note that this will generally be the result of a DNS MX lookup) -versus Subject and Subject-Alternate-Name fields. Wildcard names are permitted +versus the Subject-Alternate-Name (or, if none, Subject-Name) fields. +Wildcard names are permitted, limited to being the initial component of a 3-or-more component FQDN. There is no equivalent checking on client certificates. @@ -26061,7 +26238,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 @@ -28202,7 +28379,7 @@ Dovecot 2 POP/IMAP server, which can support a number of authentication methods. Note that Dovecot must be configured to use auth-client not auth-userdb. If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful to use the same mechanisms for SMTP authentication. This is a server -authenticator only. There is only one option: +authenticator only. There is only one non-generic option: .option server_socket dovecot string unset @@ -28214,6 +28391,7 @@ authenticators for different mechanisms. For example: dovecot_plain: driver = dovecot public_name = PLAIN + server_advertise_condition = ${if def:tls_in_cipher} server_socket = /var/run/dovecot/auth-client server_set_id = $auth1 @@ -28223,6 +28401,13 @@ dovecot_ntlm: server_socket = /var/run/dovecot/auth-client server_set_id = $auth1 .endd + +.new +&*Note*&: plaintext authentication methods such as PLAIN and LOGIN +should not be advertised on cleartext SMTP connections. +See the discussion in section &<>&. +.wen + If the SMTP connection is encrypted, or if &$sender_host_address$& is equal to &$received_ip_address$& (that is, the connection is local), the &"secured"& option is passed in the Dovecot authentication command. If, for a TLS @@ -28821,9 +29006,10 @@ for which it must have been requested via the (see &<>&). If an authenticator of this type is configured it is -run before any SMTP-level communication is done, +run immediately after a TLS connection being negotiated +(due to either STARTTLS or TLS-on-connect) and can authenticate the connection. -If it does, SMTP authentication is not offered. +If it does, SMTP authentication is not subsequently offered. A maximum of one authenticator of this type may be present. @@ -29381,7 +29567,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 +29620,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 +29926,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 +29937,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 +29947,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 +30096,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 +30301,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 +30399,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 +30420,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 +30459,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 +30475,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 @@ -30432,8 +30639,11 @@ accepted by an &%accept%& verb that has a &%message%& modifier, the contents of the message override the banner message that is otherwise specified by the &%smtp_banner%& option. -For tls-on-connect connections, the ACL is run after the TLS connection -is accepted (however, &%host_reject_connection%& is tested before). +.new +For tls-on-connect connections, the ACL is run before the TLS connection +is accepted; if the ACL does not accept then the TCP connection is dropped without +any TLS startup attempt and without any SMTP response being transmitted. +.wen .subsection "The EHLO/HELO ACL" SECID192 @@ -31359,8 +31569,11 @@ the message modifier cannot override the 221 response code. The text in a &%message%& modifier is literal; any quotes are taken as literals, but because the string is expanded, backslash escapes are processed -anyway. If the message contains newlines, this gives rise to a multi-line SMTP +anyway. +If the message contains newlines, this gives rise to a multi-line SMTP response. +A long message line will also be split into multi-line SMTP responses, +on word boundaries if possible. .vindex "&$acl_verify_message$&" While the text is being expanded, the &$acl_verify_message$& variable @@ -31584,7 +31797,7 @@ pretrigger=<&'size'&> This option specifies a memory buffuer to be used immediate writes to file are done as normal. trigger=<&'reason'&> This option selects cause for the pretrigger buffer - see above) to be copied to file. A reason of $*now* + see above) to be copied to file. A reason of &*now*& take effect immediately; one of &*paniclog*& triggers on a write to the panic log. .endd @@ -31654,6 +31867,7 @@ work with. .vitem &*control&~=&~fakedefer/*&<&'message'&> .cindex "fake defer" .cindex "defer, fake" +.cindex fakedefer This control works in exactly the same way as &%fakereject%& (described below) except that it causes an SMTP 450 response after the message data instead of a 550 response. You must take care when using &%fakedefer%& because it causes the @@ -31663,6 +31877,7 @@ use &%fakedefer%& if the message is to be delivered normally. .vitem &*control&~=&~fakereject/*&<&'message'&> .cindex "fake rejection" .cindex "rejection, fake" +.cindex fakereject This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other words, only when an SMTP message is being received. If Exim accepts the message, instead the final 250 response, a 550 rejection message is sent. @@ -31964,8 +32179,24 @@ Headers will not be removed from the message if the modifier is used in DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing. More than one header can be removed at the same time by using a colon separated -list of header names. The header matching is case insensitive. Wildcards are -not permitted, nor is list expansion performed, so you cannot use hostlists to +list of header specifiers. +.new +If a specifier does not start with a circumflex (^) +then it is treated as a header name. +The header name matching is case insensitive. +If it does, then it is treated as a (front-anchored) +regular expression applied to the whole header. + +&*Note*&: The colon terminating a header name will need to be doubled +if used in an RE, and there can legitimately be whitepace before it. + +Example: +.code +remove_header = \N^(?i)Authentication-Results\s*::\s*example.org;\N +.endd +.wen + +List expansion is not performed, so you cannot use hostlists to create a list of headers, however both connection and message variable expansion are performed (&%$acl_c_*%& and &%$acl_m_*%&), illustrated in this example: .code @@ -31974,14 +32205,14 @@ warn hosts = +internal_hosts warn message = Remove internal headers remove_header = $acl_c_ihdrs .endd -Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs. +Header specifiers 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 -accumulated during the non-SMTP ACLs, and are removed from the message after +a non-existent header. Further header specifiers for removal may be accumulated +during the DATA and MIME ACLs, after which matching headers are removed +if present. In the case of non-SMTP messages, remove speifiers are +accumulated during the non-SMTP ACLs, and are acted on after all the ACLs have run. If a message is rejected after DATA or by the non-SMTP ACL, there really is no effect because there is no logging of what headers would have been removed. @@ -32964,7 +33195,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 +33313,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 +33337,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 +33347,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 &<>& below. +.vitem unique +.cindex "rate limiting" unique +This option is described in section &<>& below. +.endlist .subsection "Ratelimit update modes" ratoptupd @@ -35811,6 +36064,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. @@ -38790,7 +39044,7 @@ logging and the message has a DKIM signature header. .section "Reducing or increasing what is logged" "SECTlogselector" .cindex "log" "selectors" By setting the &%log_selector%& global option, you can disable some of Exim's -default logging, or you can request additional logging. The value of +default logging to the main log, or you can request additional logging. The value of &%log_selector%& is made up of names preceded by plus or minus characters. For example: .code @@ -38815,7 +39069,7 @@ selection marked by asterisks: .irow &`etrn`& * "ETRN commands" .irow &`host_lookup_failed`& * "as it says" .irow &`ident_timeout`&   "timeout for ident connection" -.irow &`incoming_interface`&   "local interface on <= and => lines" +.irow &`incoming_interface`&   "local interface & port on <= and => lines" .irow &`incoming_port`&   "remote port on <= lines" .irow &`lost_incoming_connection`& * "as it says (includes timeouts)" .irow &`millisec`&   "millisecond timestamps and RT,QT,DT,D times" @@ -39320,6 +39574,7 @@ the next chapter. The utilities described here are: .irow &<>& &'exim_tidydb'& "clean up a hints database" .irow &<>& &'exim_fixdb'& "patch a hints database" .irow &<>& &'exim_lock'& "lock a mailbox file" +.irow &<>& &'exim_msgdate'& "Message Ids for humans (exim_msgdate)" .endtable Another utility that might be of use to sites with many MTAs is Tom Kistner's @@ -39828,6 +40083,8 @@ Serializing delivery to a specific host (when &%serialize_hosts%& is set in an .next Limiting the concurrency of specific transports (when &%max_parallel%& is set in a transport) +.next +Recording EHLO-time facilities advertised by hosts .endlist @@ -40043,9 +40300,16 @@ exim_lock -q /var/spool/mail/spqr \ .endd Note that if a command is supplied, it must be entirely contained within the second argument &-- hence the quotes. -.ecindex IIDutils +.section "Message Ids for humans (exim_msgdate)" "SECTexim_msgdate" +.cindex "exim_msgdate" +The &'exim_msgdate'& utility is written by Andrew Aitchison and included in the Exim distribution. +This Perl script converts an Exim Mesage ID back into a human readable form. +For details of &'exim_msgdate'&'s options, run &'exim_msgdate'& with the &%--help%& option. + +Section &<>& (Message identification) describes Exim Mesage IDs. +.ecindex IIDutils . //////////////////////////////////////////////////////////////////////////// . //////////////////////////////////////////////////////////////////////////// @@ -42043,8 +42307,9 @@ Example usage: # one, plus the max_rcpt and return_path options remote_forwarded_smtp: driver = smtp - # modify the envelope from, for mails that we forward + # single-recipient so that $original_domain is valid max_rcpt = 1 + # modify the envelope from, for mails that we forward return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}} .endd @@ -42151,7 +42416,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