From: Wietse Venema
Using backwards-compatible -default setting smtpd_relay_restrictions = (empty)
+default setting "smtpd_relay_restrictions = (empty)"Using backwards-compatible default setting mynetworks_style=subnet
@@ -81,6 +81,9 @@ default setting smtp_tls_fingerprint_digest=md5Using backwards-compatible default setting lmtp_tls_fingerprint_digest=md5
+Using backwards-compatible +default setting smtpd_relay_before_recipient_restrictions=no
+If such a message is logged in the context of a legitimate @@ -461,6 +464,45 @@ warnings, you can update your compatibility level. +
The smtpd_relay_before_recipient_restrictions feature was +introduced in Postfix version 3.6, to evaluate smtpd_relay_restrictions +before smtpd_recipient_restrictions. Historically, smtpd_relay_restrictions +was evaluated after smtpd_recipient_restrictions, contradicting +documented behavior.
+ ++ +Background: smtpd_relay_restrictions is +primarily designed to enforce a mail relaying policy, while +smtpd_recipient_restrictions is primarily designed to enforce spam +blocking policy. Both are evaluated while replying to the RCPT TO +command, and both support the same features.
When the compatibility_level less than 3.6, and the +smtpd_relay_before_recipient_restrictions parameter is left at its +implicit default setting, Postfix may log the following message:
+ +++ ++postfix/smtpd[54696]: using backwards-compatible default setting + smtpd_relay_before_recipient_restrictions=no to reject recipient + "user@example.com" from client "host.example.net[10.0.0.2]" ++
If Postfix should keep evaluating smtpd_recipient_restrictions +before smtpd_relay_restrictions, then the system +administrator should make the backwards-compatible setting +"smtpd_relay_before_recipient_restrictions=no" permanent in main.cf:
+ ++++# postconf smtpd_relay_before_recipient_restrictions=no +# postfix reload ++
Backwards compatibility is turned off by updating the diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index de49f00c3..6753f0ed7 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -3102,7 +3102,8 @@ cached. If Postfix runs on a network where the DNS root zone is not reachable, specify a different probe, or specify an empty dnssec_probe value to disable the feature.
-This feature is available in Postfix 3.6 and later.
+This feature is available in Postfix 3.6 and later. It was backported +to Postfix versions 3.5.9, 3.4.19, 3.3.16. 3.2.21.
@@ -12589,8 +12590,10 @@ authentication succeeds, it will be logged only as "Trusted", notThe default setting for Postfix ≥ 3.6 is "dane" with -"smtp_tls_security_level = dane", otherwise "may". With earlier -Postfix versions the defauult setting was always "dane".
+"smtp_tls_security_level = dane", otherwise "may". This behavior +was backported to Postfix versions 3.5.9, 3.4.19, 3.3.16. 3.2.21. +With earlier Postfix versions the default setting was always "dane". +Though with "insecure" MX records an active attacker can compromise SMTP transport security by returning forged MX records, @@ -16281,6 +16284,24 @@ This feature is available in Postfix 2.1 and later.
+ + +Evaluate smtpd_relay_restrictions before smtpd_recipient_restrictions. +Historically, smtpd_relay_restrictions was evaluated after +smtpd_recipient_restrictions, contradicting documented behavior.
+ +Background: the smtpd_relay_restrictions feature is primarily +designed to enforce a mail relaying policy, while +smtpd_recipient_restrictions is primarily designed to enforce spam +blocking policy. Both are evaluated while replying to the RCPT TO +command, and both support the same features.
+ +This feature is available in Postfix 3.6 and later.
+ +Using backwards-compatible -default setting smtpd_relay_restrictions = (empty)
+default setting "smtpd_relay_restrictions = (empty)"Using backwards-compatible default setting mynetworks_style=subnet
@@ -81,6 +81,9 @@ default setting smtp_tls_fingerprint_digest=md5Using backwards-compatible default setting lmtp_tls_fingerprint_digest=md5
+Using backwards-compatible +default setting smtpd_relay_before_recipient_restrictions=no
+If such a message is logged in the context of a legitimate @@ -461,6 +464,45 @@ warnings, you can update your compatibility level. +
The smtpd_relay_before_recipient_restrictions feature was +introduced in Postfix version 3.6, to evaluate smtpd_relay_restrictions +before smtpd_recipient_restrictions. Historically, smtpd_relay_restrictions +was evaluated after smtpd_recipient_restrictions, contradicting +documented behavior.
+ ++ +Background: smtpd_relay_restrictions is +primarily designed to enforce a mail relaying policy, while +smtpd_recipient_restrictions is primarily designed to enforce spam +blocking policy. Both are evaluated while replying to the RCPT TO +command, and both support the same features.
When the compatibility_level is less than 3.6, and the +smtpd_relay_before_recipient_restrictions parameter is left at its +implicit default setting, Postfix may log the following message:
+ +++ ++postfix/smtpd[54696]: using backwards-compatible default setting + smtpd_relay_before_recipient_restrictions=no to reject recipient + "user@example.com" from client "host.example.net[10.0.0.2]" ++
If Postfix should keep evaluating smtpd_recipient_restrictions +before smtpd_relay_restrictions, then the system +administrator should make the backwards-compatible setting +"smtpd_relay_before_recipient_restrictions=no" permanent in main.cf:
+ ++++# postconf smtpd_relay_before_recipient_restrictions=no +# postfix reload ++
Backwards compatibility is turned off by updating the diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index e95a10bae..39e2b8901 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -16983,8 +16983,10 @@ authentication succeeds, it will be logged only as "Trusted", not
The default setting for Postfix ≥ 3.6 is "dane" with -"smtp_tls_security_level = dane", otherwise "may". With earlier -Postfix versions the defauult setting was always "dane".
+"smtp_tls_security_level = dane", otherwise "may". This behavior +was backported to Postfix versions 3.5.9, 3.4.19, 3.3.16. 3.2.21. +With earlier Postfix versions the default setting was always "dane". +Though with "insecure" MX records an active attacker can compromise SMTP transport security by returning forged MX records, @@ -17923,7 +17925,8 @@ cached. If Postfix runs on a network where the DNS root zone is not reachable, specify a different probe, or specify an empty dnssec_probe value to disable the feature.
-This feature is available in Postfix 3.6 and later.
+This feature is available in Postfix 3.6 and later. It was backported +to Postfix versions 3.5.9, 3.4.19, 3.3.16. 3.2.21.
%PARAM local_login_sender_maps static:* @@ -18007,3 +18010,17 @@ instead of deleting only the non-delivery notification.This feature is available in Postfix 3.6 and later.
+ +%PARAM smtpd_relay_before_recipient_restrictions see "postconf -d" output + +Evaluate smtpd_relay_restrictions before smtpd_recipient_restrictions. +Historically, smtpd_relay_restrictions was evaluated after +smtpd_recipient_restrictions, contradicting documented behavior.
+ +Background: the smtpd_relay_restrictions feature is primarily +designed to enforce a mail relaying policy, while +smtpd_recipient_restrictions is primarily designed to enforce spam +blocking policy. Both are evaluated while replying to the RCPT TO +command, and both support the same features.
+ +This feature is available in Postfix 3.6 and later.
diff --git a/postfix/proto/transport b/postfix/proto/transport index 49b3441d8..1cd30b3ce 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -79,7 +79,8 @@ # starts with whitespace continues a logical line. # .PP # The \fIpattern\fR specifies an email address, a domain name, or -# a domain name hierarchy, as described in section "TABLE LOOKUP". +# a domain name hierarchy, as described in section "TABLE +# SEARCH ORDER". # # The \fIresult\fR is of the form \fItransport:nexthop\fR and # specifies how or where to deliver mail. This is described in diff --git a/postfix/src/dns/dns.h b/postfix/src/dns/dns.h index 26a346279..5f53dbc8f 100644 --- a/postfix/src/dns/dns.h +++ b/postfix/src/dns/dns.h @@ -335,7 +335,7 @@ const char *dns_str_resflags(unsigned long); #define DNS_SEC_STATS_SET(flags) (dns_sec_stats |= (flags)) #define DNS_SEC_STATS_TEST(flags) (dns_sec_stats & (flags)) -extern int dns_sec_stats; /* See flags below */ +extern int dns_sec_stats; /* See DNS_SEC_FLAG_XXX above */ extern void dns_sec_probe(int); /* LICENSE diff --git a/postfix/src/dns/dns_sec.c b/postfix/src/dns/dns_sec.c index e6d7bb740..849627e4b 100644 --- a/postfix/src/dns/dns_sec.c +++ b/postfix/src/dns/dns_sec.c @@ -117,7 +117,7 @@ void dns_sec_probe(int rflags) VAR_DNSSEC_PROBE, var_dnssec_probe); why = vstring_alloc(100); - dns_status = dns_lookup(qname, qtype, rflags, &rrlist, (char) 0, why); + dns_status = dns_lookup(qname, qtype, rflags, &rrlist, (VSTRING *) 0, why); if (!DNS_SEC_STATS_TEST(DNS_SEC_FLAG_AVAILABLE)) msg_warn("DNSSEC validation may be unavailable"); else if (msg_verbose) diff --git a/postfix/src/flush/flush.c b/postfix/src/flush/flush.c index 30e5d2b2a..372f2cf20 100644 --- a/postfix/src/flush/flush.c +++ b/postfix/src/flush/flush.c @@ -229,7 +229,7 @@ static DOMAIN_LIST *flush_domains; * Silly little macros. */ #define STR(x) vstring_str(x) -#define STREQ(x,y) ((x) == (y) || strcmp(x,y) == 0) +#define STREQ(x,y) (STRREF(x) == STRREF(y) || strcmp(x,y) == 0) /* * Forward declarations resulting from breaking up routines according to diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index 95c91ccc8..09e0884b9 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -152,6 +152,7 @@ /* int warn_compat_break_smtpd_tls_fpt_dgst; /* int warn_compat_break_smtp_tls_fpt_dgst; /* int warn_compat_break_lmtp_tls_fpt_dgst; +/* int warn_compat_relay_before_rcpt_checks; /* /* char *var_maillog_file; /* char *var_maillog_file_pfxs; @@ -160,6 +161,7 @@ /* char *var_postlog_service; /* /* char *var_dnssec_probe; +/* bool var_relay_before_rcpt_checks; /* DESCRIPTION /* This module (actually the associated include file) defines /* the names and defaults of all mail configuration parameters. @@ -372,15 +374,17 @@ char *var_maillog_file_stamp; char *var_postlog_service; char *var_dnssec_probe; +bool var_relay_before_rcpt_checks; const char null_format_string[1] = ""; /* - * Compatibility level 3. + * Compatibility level 3.6. */ int warn_compat_break_smtpd_tls_fpt_dgst; int warn_compat_break_smtp_tls_fpt_dgst; int warn_compat_break_lmtp_tls_fpt_dgst; +int warn_compat_relay_before_rcpt_checks; /* * Compatibility level 2. @@ -652,10 +656,13 @@ static void check_legacy_defaults(void) warn_compat_break_smtp_tls_fpt_dgst = 1; if (mail_conf_lookup(VAR_LMTP_TLS_FPT_DGST) == 0) warn_compat_break_lmtp_tls_fpt_dgst = 1; + if (mail_conf_lookup(VAR_RELAY_BEFORE_RCPT_CHECKS) == 0) + warn_compat_relay_before_rcpt_checks = 1; } else { warn_compat_break_smtpd_tls_fpt_dgst = 0; warn_compat_break_smtp_tls_fpt_dgst = 0; warn_compat_break_lmtp_tls_fpt_dgst = 0; + warn_compat_relay_before_rcpt_checks = 0; } /* @@ -742,6 +749,7 @@ void mail_params_init() /* read and process the following before opening tables. */ VAR_SMTPUTF8_ENABLE, DEF_SMTPUTF8_ENABLE, &var_smtputf8_enable, VAR_IDNA2003_COMPAT, DEF_IDNA2003_COMPAT, &var_idna2003_compat, + VAR_RELAY_BEFORE_RCPT_CHECKS, DEF_RELAY_BEFORE_RCPT_CHECKS, &var_relay_before_rcpt_checks, 0, }; static const CONFIG_STR_FN_TABLE function_str_defaults[] = { diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 046252be9..f1b5c69a3 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -72,6 +72,7 @@ extern int warn_compat_break_mynetworks_style; extern int warn_compat_break_smtpd_tls_fpt_dgst; extern int warn_compat_break_smtp_tls_fpt_dgst; extern int warn_compat_break_lmtp_tls_fpt_dgst; +extern int warn_compat_relay_before_rcpt_checks; extern long compat_level; @@ -2174,6 +2175,11 @@ extern char *var_relay_checks; #define DEF_RCPT_CHECKS "" extern char *var_rcpt_checks; +#define VAR_RELAY_BEFORE_RCPT_CHECKS "smtpd_relay_before_recipient_restrictions" +#define DEF_RELAY_BEFORE_RCPT_CHECKS "${{$compatibility_level}