diff --git a/postfix/HISTORY b/postfix/HISTORY index 19eb9d8a2..4f5b2edcd 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -25896,3 +25896,90 @@ Apologies for any names omitted. return "not found" instead of "error" during the time that all MySQL server connections were turned down after error. Found during code maintenance. File: global/dict_mysql.c. + +20230428 + + Bugfix (defect introduced: Postfix 1.0): the command "postconf + .. name=v1 .. name=v2 .." (multiple instances of the same + parameter name) created multiple name=value entries with + the same parameter name. It now logs a warning and skips + the earlier update. Found during code maintenance. File: + postconf/postconf_edit.c + + Bugfix (defect introduced: Postfix 3.3): the command "postconf + -M name1/type1='name2 type2 ...'" died with a segmentation + violation when the request matched multiple master.cf + entries. The master.cf file was not damaged. Problem reported + by SATOH Fumiyasu. File: postconf/postconf_master.c. + +20230502 + + Bugfix (defect introduced: Postfix 2.11): the command + "postconf -M name1/type1='name2 type2 ...'" could add a + service definition to master.cf that conflicted with an + already existing service definition. It now replaces all + existing service definitions that match the service pattern + 'name1/type1' or the service name and type in 'name2 type2 + ...' with a single service definition 'name2 type2 ...'. + Problem reported by SATOH Fumiyasu. File: postconf/postconf_edit.c. + +20230519 + + Bitrot: preliminary support for OpenSSL configuration files, + primarily OpenSSL 1.1.1b and later. This introduces new + parameters "tls_config_file" and "tls_config_name", which + can be used to limit collateral damage from OS distributions + that crank up security to 11, increasing the number of + plaintext email deliveries. Details are in the postconf(5) + manpage under "tls_config_file" and "tls_config_name". + Viktor Dukhovni. Files: mantools/postlink, proto/postconf.proto, + global/mail_params.h, posttls-finger/posttls-finger.c, + smtp/smtp.c, smtp/smtp_proto.c, tls/tls_client.c, tls/tls.h, + tls/tls_misc.c, tls/tls_proxy_client_print.c, + tls/tls_proxy_client_scan.c, tls/tls_proxy.h, tls/tls_server.c, + tlsproxy/tlsproxy.c. + +20230523 + + Cleanup: use TLS_CLIENT_PARAMS to pass the OpensSSL 'init' + configurations. This information is independent from the + client or server TLS context, and therefore does not belong + in tls_*_init() or tls_*_start() calls. The tlsproxy(8) + server uses TLS_CLIENT_PARAMS to report differences between + its own global TLS settings, and those from its clients. + Files: posttls-finger/posttls-finger.c, smtp/smtp.c, + smtp/smtp_proto.c, tls/tls.h, tls/tls_proxy_client_misc.c, + tls/tls_proxy_client_print.c, tls/tls_proxy_client_scan.c, + tls/tls_proxy.h, tlsproxy/tlsproxy.c. + +20230524 + + Cleanup: reverted cosmetic-only changes to minimize the + patch footprint for OpenSSL INI file support; updated daemon + manpages with the new tls_config_file and tls_config_name + configuration parameters. Files: smtp/smtp.c, smtpd/smtpd.c, + tls/tls_client.c, tls/tls.h, tls/tls_server.c, tlsproxy/tlsproxy.c, + +20230529 + + Cleanup: made OpenSSL 'default' INI file support error + handling consistent with OpenSSL default behavior. Viktor + Dukhovni. Files: proto/postconf.proto, tls/tls_misc.c. + +20230602 + + Backwards compatibility for stable releases that originally + had no OpenSSL INI support. Skip the new OpenSSL INI support + code, unless the Postfix configuration actually specifies + non-default tls_config_xxx settings. File: tls/tls_misc.c. + + Cleanup: added a multiple initialization guard in the + tls_library_init() function, and made an initialization + error sticky. File: tls/tls_misc.c. + +20230605 + + Security: new parameter smtpd_forbid_unauth_pipelining + (default: no) to disconnect remote SMTP clients that violate + RFC 2920 (or 5321) command pipelining constraints. Files: + global/mail_params.h, smtpd/smtpd.c, proto/postconf.proto. diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index d8ac90cc7..63d395d3f 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -25,6 +25,23 @@ more recent Eclipse Public License 2.0. Recipients can choose to take the software under the license of their choice. Those who are more comfortable with the IPL can continue with that license. +Major changes with Postfix 3.6.10 +================================= + +Security: the Postfix SMTP server optionally disconnects remote +SMTP clients that violate RFC 2920 (or 5321) command pipelining +constraints. The server replies with "554 5.5.0 Error: SMTP protocol +synchronization" and logs the unexpected remote SMTP client input. +Specify "smtpd_forbid_unauth_pipelining = yes" to enable. This +feature is enabled by default in Postfix 3.9 and later. + +Workaround to limit collateral damage from OS distributions that +crank up security to 11, increasing the number of plaintext email +deliveries. This introduces basic OpenSSL configuration file support, +with two new parameters "tls_config_file" and "tls_config_name". +Details are in the postconf(5) manpage under "tls_config_file" and +"tls_config_name". + Major changes - internal protocol identification ------------------------------------------------ diff --git a/postfix/html/lmtp.8.html b/postfix/html/lmtp.8.html index f8bde52a3..a9d512dda 100644 --- a/postfix/html/lmtp.8.html +++ b/postfix/html/lmtp.8.html @@ -668,6 +668,15 @@ SMTP(8) SMTP(8) A workaround for implementations that hang Postfix while shut- ting down a TLS session, until Postfix times out. + Available in Postfix 3.9, 3.8.1, 3.7.6, 3.6.10, 3.5.20 and later: + + tls_config_file (default) + Optional configuration file with baseline OpenSSL settings. + + tls_config_name (empty) + The application name passed by Postfix to OpenSSL library ini- + tialization functions. + OBSOLETE STARTTLS CONTROLS The following configuration parameters exist for compatibility with Postfix versions before 2.3. Support for these will be removed in a diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 2d1875aa5..b66b20bd0 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -15296,6 +15296,22 @@ This feature is available in Postfix 2.0 and later.
+ + +Disconnect remote SMTP clients that violate RFC 2920 (or 5321) +command pipelining constraints. The server replies with "554 5.5.0 +Error: SMTP protocol synchronization" and logs the unexpected remote +SMTP client input. Specify "smtpd_forbid_unauth_pipelining = yes" +to enable. This feature is enabled by default with Postfix ≥ +3.9.
+ +This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
+ +Optional configuration file with baseline OpenSSL settings. +OpenSSL loads any SSL settings found in the configuration file for +the selected application name (see tls_config_name) or else the +built-in application name "openssl_conf" when no application name is +specified, or no corresponding configuration section is present. +
+ +With OpenSSL releases 1.1.1 and 1.1.1a, applications (including +Postfix) can neither specify an alternative configuration file, nor +avoid loading the default configuration file.
+ +With OpenSSL 1.1.1b or later, this parameter may be set to one of: +
+ +Failures in processing of the built-in default configuration file, +are silently ignored. Any errors in loading a non-default configuration +file are detected by Postfix, and cause TLS support to be disabled. +
+ +The OpenSSL configuration file format is not documented here, +beyond giving two examples.
+ +
Example: Default settings for all applications.
+ +++ ++# The name 'openssl_conf' is the default application name +# The section name to the right of the '=' sign is arbitrary, +# any name will do, so long as it refers to the desired section. +# +# The name 'system_default' selects the settings applied internally +# by the SSL library as part of SSL object creation. Applications +# can then apply any additional settings of their choice. +# +# In this example, TLS versions prior to 1.2 are disabled by default. +# +openssl_conf = system_wide_settings +[system_wide_settings] +ssl_conf = ssl_library_settings +[ssl_library_settings] +system_default = initial_ssl_settings +[initial_ssl_settings] +MinProtocol = TLSv1.2 ++
Example: Custom settings for an application named "postfix".
+ +++ ++# The mapping from an application name to the corresponding configuration +# section must appear near the top of the file, (in what is sometimes called +# the "default section") prior to the start of any explicitly named +# "[sections]". The named sections can appear in any order and don't nest. +# +postfix = postfix_settings +[postfix_settings] +ssl_conf = postfix_ssl_settings +[postfix_ssl_settings] +system_default = baseline_postfix_settings +[baseline_postfix_settings] +MinProtocol = TLSv1 ++
This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
+ + +The application name passed by Postfix to OpenSSL library +initialization functions. This name is used to select the desired +configuration "section" in the OpenSSL configuration file specified +via the tls_config_file parameter. When empty, or when the +selected name is not present in the configuration file, the default +application name ("openssl_conf") is used as a fallback.
+ +This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
+ +This feature is available in Postfix 3.6 and later.
+ +%PARAM tls_config_name + +The application name passed by Postfix to OpenSSL library +initialization functions. This name is used to select the desired +configuration "section" in the OpenSSL configuration file specified +via the tls_config_file parameter. When empty, or when the +selected name is not present in the configuration file, the default +application name ("openssl_conf") is used as a fallback.
+ +This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
+ +%PARAM tls_config_file default + +Optional configuration file with baseline OpenSSL settings. +OpenSSL loads any SSL settings found in the configuration file for +the selected application name (see tls_config_name) or else the +built-in application name "openssl_conf" when no application name is +specified, or no corresponding configuration section is present. +
+ +With OpenSSL releases 1.1.1 and 1.1.1a, applications (including +Postfix) can neither specify an alternative configuration file, nor +avoid loading the default configuration file.
+ +With OpenSSL 1.1.1b or later, this parameter may be set to one of: +
+ +Failures in processing of the built-in default configuration file, +are silently ignored. Any errors in loading a non-default configuration +file are detected by Postfix, and cause TLS support to be disabled. +
+ +The OpenSSL configuration file format is not documented here, +beyond giving two examples.
+ +
Example: Default settings for all applications.
+ +++ ++# The name 'openssl_conf' is the default application name +# The section name to the right of the '=' sign is arbitrary, +# any name will do, so long as it refers to the desired section. +# +# The name 'system_default' selects the settings applied internally +# by the SSL library as part of SSL object creation. Applications +# can then apply any additional settings of their choice. +# +# In this example, TLS versions prior to 1.2 are disabled by default. +# +openssl_conf = system_wide_settings +[system_wide_settings] +ssl_conf = ssl_library_settings +[ssl_library_settings] +system_default = initial_ssl_settings +[initial_ssl_settings] +MinProtocol = TLSv1.2 ++
Example: Custom settings for an application named "postfix".
+ +++ ++# The mapping from an application name to the corresponding configuration +# section must appear near the top of the file, (in what is sometimes called +# the "default section") prior to the start of any explicitly named +# "[sections]". The named sections can appear in any order and don't nest. +# +postfix = postfix_settings +[postfix_settings] +ssl_conf = postfix_ssl_settings +[postfix_ssl_settings] +system_default = baseline_postfix_settings +[baseline_postfix_settings] +MinProtocol = TLSv1 ++
This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
+ +%PARAM smtpd_forbid_unauth_pipelining Postfix ≥ 3.9: yes + +Disconnect remote SMTP clients that violate RFC 2920 (or 5321) +command pipelining constraints. The server replies with "554 5.5.0 +Error: SMTP protocol synchronization" and logs the unexpected remote +SMTP client input. Specify "smtpd_forbid_unauth_pipelining = yes" +to enable. This feature is enabled by default with Postfix ≥ +3.9.
+ +This feature is available in Postfix ≥ 3.9, 3.8.1, 3.7.6, +3.6.10, and 3.5.20.
diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 44ddf5369..8697899dc 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -2430,6 +2430,10 @@ extern char *var_smtpd_exp_filter; #define DEF_SMTPD_PEERNAME_LOOKUP 1 extern bool var_smtpd_peername_lookup; +#define VAR_SMTPD_FORBID_UNAUTH_PIPE "smtpd_forbid_unauth_pipelining" +#define DEF_SMTPD_FORBID_UNAUTH_PIPE 0 +extern bool var_smtpd_forbid_unauth_pipe; + /* * Heuristic to reject unknown local recipients at the SMTP port. */ @@ -3313,8 +3317,17 @@ extern bool var_smtp_sender_auth; extern bool var_smtp_cname_overr; /* - * TLS cipherlists + * TLS library settings */ +#define VAR_TLS_CNF_FILE "tls_config_file" +#define DEF_TLS_CNF_FILE "default" +extern char *var_tls_cnf_file; + +#define VAR_TLS_CNF_NAME "tls_config_name" +#define DEF_TLS_CNF_NAME "" +extern char *var_tls_cnf_name; + + #define VAR_TLS_HIGH_CLIST "tls_high_cipherlist" #define DEF_TLS_HIGH_CLIST "aNULL:-aNULL:HIGH:@STRENGTH" extern char *var_tls_high_clist; diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 17cef036d..a54432e62 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20230418" -#define MAIL_VERSION_NUMBER "3.6.9" +#define MAIL_RELEASE_DATE "20230605" +#define MAIL_VERSION_NUMBER "3.6.10" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/postconf/postconf_edit.c b/postfix/src/postconf/postconf_edit.c index c60cb06f5..2f9a60731 100644 --- a/postfix/src/postconf/postconf_edit.c +++ b/postfix/src/postconf/postconf_edit.c @@ -192,6 +192,11 @@ void pcf_edit_main(int mode, int argc, char **argv) } else { msg_panic("pcf_edit_main: unknown mode %d", mode); } + if ((cvalue = htable_find(table, pattern)) != 0) { + msg_warn("ignoring earlier request: '%s = %s'", + pattern, cvalue->value); + htable_delete(table, pattern, myfree); + } cvalue = (struct cvalue *) mymalloc(sizeof(*cvalue)); cvalue->value = edit_value; cvalue->found = 0; @@ -459,8 +464,38 @@ void pcf_edit_master(int mode, int argc, char **argv) /* * Match each service pattern. + * + * Additional care is needed when a request adds or replaces an + * entire service definition, instead of a specific field or + * parameter. Given a command "postconf -M name1/type1='name2 + * type2 ...'", where name1 and name2 may differ, and likewise + * for type1 and type2: + * + * - First, if an existing service definition a) matches the service + * pattern 'name1/type1', or b) matches the name and type in the + * new service definition 'name2 type2 ...', remove the service + * definition. + * + * - Then, after an a) or b) type match, add a new service + * definition for 'name2 type2 ...', but only after the first + * match. + * + * - Finally, if a request had no a) or b) type match for any + * master.cf service definition, add a new service definition for + * 'name2 type2 ...'. */ for (req = edit_reqs; req < edit_reqs + num_reqs; req++) { + PCF_MASTER_ENT *tentative_entry = 0; + int use_tentative_entry = 0; + + /* Additional care for whole service definition requests. */ + if ((mode & PCF_MASTER_ENTRY) && (mode & PCF_EDIT_CONF)) { + tentative_entry = (PCF_MASTER_ENT *) + mymalloc(sizeof(*tentative_entry)); + if ((err = pcf_parse_master_entry(tentative_entry, + req->edit_value)) != 0) + msg_fatal("%s: \"%s\"", err, req->raw_text); + } if (PCF_MATCH_SERVICE_PATTERN(req->service_pattern, service_name, service_type)) { @@ -506,18 +541,30 @@ void pcf_edit_master(int mode, int argc, char **argv) * Replace entire master.cf entry. */ case PCF_MASTER_ENTRY: - if (new_entry != 0) - pcf_free_master_entry(new_entry); - new_entry = (PCF_MASTER_ENT *) - mymalloc(sizeof(*new_entry)); - if ((err = pcf_parse_master_entry(new_entry, - req->edit_value)) != 0) - msg_fatal("%s: \"%s\"", err, req->raw_text); + if (req->match_count == 1) + use_tentative_entry = 1; break; default: msg_panic("%s: unknown edit mode %d", myname, mode); } } + } else if (tentative_entry != 0 + && PCF_MATCH_SERVICE_PATTERN(tentative_entry->argv, + service_name, + service_type)) { + service_name_type_matched = 1; /* Sticky flag */ + req->match_count += 1; + if (req->match_count == 1) + use_tentative_entry = 1; + } + if (tentative_entry != 0) { + if (use_tentative_entry) { + if (new_entry != 0) + pcf_free_master_entry(new_entry); + new_entry = tentative_entry; + } else { + pcf_free_master_entry(tentative_entry); + } } } diff --git a/postfix/src/postconf/postconf_master.c b/postfix/src/postconf/postconf_master.c index 1a70b5dcf..e571d5e3a 100644 --- a/postfix/src/postconf/postconf_master.c +++ b/postfix/src/postconf/postconf_master.c @@ -156,6 +156,7 @@ #include