From: Wietse Venema
The following messages may be logged:
@@ -60,6 +60,9 @@ default setting append_dot_mydomain=yesUsing backwards-compatible +default setting smtpd_relay_restrictions = (empty)
+Using backwards-compatible default setting mynetworks_style=subnet
@@ -79,15 +82,19 @@ sections that follow.When no more backwards-compatible settings need to be made permanent, the system administrator should turn off the backwards-compatibility safety net as described at the -end of this document.
+end of this document.The append_dot_mydomain default value has changed from "yes" -to "no". As long as the append_dot_mydomain parameter is left at -its implicit default value, and the backwards-compatible default -setting is turned on, Postfix may log one of the following messages:
+to "no". This could result in unexpected non-delivery of email after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises. + +As long as the append_dot_mydomain parameter is left at +its implicit default value, and the compatibility_level setting is +less than 1, Postfix may log one of the following messages:
The master.cf chroot default value has changed from "y" (yes) -to "n" (no). As long as a master.cf chroot field is left at its -implicit default value, and the backwards-compatible default setting -is turned on, Postfix may log the following message while it +to "n" (no). The new default avoids the need for copies of system +files under the Postfix queue directory. However, sites with strict +security requirements may want to keep the chroot feature enabled +after updating Postfix from an older version. The backwards-compatibility +safety net is designed allow the administrator to choose if they +want to keep the old behavior.
+ +As long as a master.cf chroot field is left at its +implicit default value, and the compatibility_level setting +is less than 1, Postfix may log the following message while it reads the master.cf file:
@@ -160,15 +174,58 @@ setting for the "smtp inet" service:+
The smtpd_relay_restrictions feature was introduced with Postfix +version 2.10, as a safety mechanism for configuration errors in +smtpd_recipient_restrictions that could make Postfix an open relay. +
+ +The smtpd_relay_restrictions implicit default setting forbids +mail to remote destinations from clients that don't match +permit_mynetworks or permit_sasl_authenticated. This could result +in unexpected 'Relay access denied' errors after Postfix is updated +from an older Postfix version. The backwards-compatibility safety +net is designed to prevent such surprises.
+ +When the compatibility_level less than 1, and the +smtpd_relay_restrictions parameter is left at its implicit default +setting, Postfix may log the following message:
+ +++ ++postfix/smtpd[38463]: using backwards-compatible default setting + "smtpd_relay_restrictions = (empty)" to avoid "Relay access + denied" error for recipient "user@example.com" from client + "host.example.net[10.0.0.2]" ++
If this request should not be blocked, then the system +administrator should make the backwards-compatible setting +"smtpd_relay_restrictions=" (i.e. empty) permanent in main.cf: + +
+++# postconf smtpd_relay_restrictions= +# postfix reload ++
The mynetworks_style default value has changed from "subnet" to "host". This parameter is used to implement the "permit_mynetworks" -feature. As long as the mynetworks and mynetworks_style parameters -are left at their implicit default values, and the backwards-compatible -default setting is turned on, the Postfix SMTP server may log one -of the following messages:
+feature. The change could in unexpected 'access denied' errors after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises. + +As long as the mynetworks and mynetworks_style parameters are +left at their implicit default values, and the compatibility_level +setting is less than 2, the Postfix SMTP server may log one of the +following messages:
@@ -201,10 +258,14 @@ administrator should make the backwards-compatible setting setting relay_domains=$mydestinationThe relay_domains default value has changed from "$mydestination" -to the empty value. As long as the relay_domains parameter is left -at its implicit default value, and the backwards-compatible default -setting is turned on, Postfix may log one of the following messages. -
+to the empty value. This could result in unexpected 'Relay access +denied' errors or ETRN errors after Postfix is updated from an older +version. The backwards-compatibility safety net is designed to +prevent such surprises. + +As long as the relay_domains parameter is left at its implicit +default value, and the compatibility_level setting is less than 2, +Postfix may log one of the following messages.
@@ -268,13 +329,13 @@ setting smtputf8_enable=no
The smtputf8_enable default value has changed from "no" to "yes. With the new "yes" setting, the Postfix SMTP server rejects non-ASCII -addresses from clients that don't request SMTPUTF8 support. With -the old "no" setting, Postfix will accept such addresses, even if -such addresses are not permitted by traditional SMTP standards.
+addresses from clients that don't request SMTPUTF8 support, after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises.As long as the smtputf8_enable parameter is left at its implicit -default value, and the backwards-compatible default setting is -turned on, Postfix logs a warning each time an SMTP command uses a +default value, and the compatibility_level setting is +less than 1, Postfix logs a warning each time an SMTP command uses a non-ASCII address localpart without requesting SMTPUTF8 support:
diff --git a/postfix/proto/COMPATIBILITY_README.html b/postfix/proto/COMPATIBILITY_README.html index e8a3a60da..291979d98 100644 --- a/postfix/proto/COMPATIBILITY_README.html +++ b/postfix/proto/COMPATIBILITY_README.html @@ -48,7 +48,7 @@ continuity of service. Based on this logging the system administrator can decide if any backwards-compatible settings need to be made permanent in main.cf or master.cf, before turning off the backwards-compatibility safety net as described at the -end of this document. +end of this document.The following messages may be logged:
@@ -60,6 +60,9 @@ default setting append_dot_mydomain=yes- +
Using backwards-compatible +default setting smtpd_relay_restrictions = (empty)
+Using backwards-compatible default setting mynetworks_style=subnet
@@ -79,15 +82,19 @@ sections that follow.When no more backwards-compatible settings need to be made permanent, the system administrator should turn off the backwards-compatibility safety net as described at the -end of this document.
+end of this document.Using backwards-compatible default setting append_dot_mydomain=yes
The append_dot_mydomain default value has changed from "yes" -to "no". As long as the append_dot_mydomain parameter is left at -its implicit default value, and the backwards-compatible default -setting is turned on, Postfix may log one of the following messages:
+to "no". This could result in unexpected non-delivery of email after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises. + +As long as the append_dot_mydomain parameter is left at +its implicit default value, and the compatibility_level setting is +less than 1, Postfix may log one of the following messages:
@@ -136,9 +143,16 @@ in main.cf: setting chroot=y
The master.cf chroot default value has changed from "y" (yes) -to "n" (no). As long as a master.cf chroot field is left at its -implicit default value, and the backwards-compatible default setting -is turned on, Postfix may log the following message while it +to "n" (no). The new default avoids the need for copies of system +files under the Postfix queue directory. However, sites with strict +security requirements may want to keep the chroot feature enabled +after updating Postfix from an older version. The backwards-compatibility +safety net is designed allow the administrator to choose if they +want to keep the old behavior.
+ +As long as a master.cf chroot field is left at its +implicit default value, and the compatibility_level setting +is less than 1, Postfix may log the following message while it reads the master.cf file:
@@ -160,15 +174,58 @@ setting for the "smtp inet" service:+Using backwards-compatible default +setting smtpd_relay_restrictions = (empty)
+ +The smtpd_relay_restrictions feature was introduced with Postfix +version 2.10, as a safety mechanism for configuration errors in +smtpd_recipient_restrictions that could make Postfix an open relay. +
+ +The smtpd_relay_restrictions implicit default setting forbids +mail to remote destinations from clients that don't match +permit_mynetworks or permit_sasl_authenticated. This could result +in unexpected 'Relay access denied' errors after Postfix is updated +from an older Postfix version. The backwards-compatibility safety +net is designed to prevent such surprises.
+ +When the compatibility_level less than 1, and the +smtpd_relay_restrictions parameter is left at its implicit default +setting, Postfix may log the following message:
+ +++ ++postfix/smtpd[38463]: using backwards-compatible default setting + "smtpd_relay_restrictions = (empty)" to avoid "Relay access + denied" error for recipient "user@example.com" from client + "host.example.net[10.0.0.2]" ++If this request should not be blocked, then the system +administrator should make the backwards-compatible setting +"smtpd_relay_restrictions=" (i.e. empty) permanent in main.cf: + +
+++# postconf smtpd_relay_restrictions= +# postfix reload ++Using backwards-compatible default setting mynetworks_style=subnet
The mynetworks_style default value has changed from "subnet" to "host". This parameter is used to implement the "permit_mynetworks" -feature. As long as the mynetworks and mynetworks_style parameters -are left at their implicit default values, and the backwards-compatible -default setting is turned on, the Postfix SMTP server may log one -of the following messages:
+feature. The change could in unexpected 'access denied' errors after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises. + +As long as the mynetworks and mynetworks_style parameters are +left at their implicit default values, and the compatibility_level +setting is less than 2, the Postfix SMTP server may log one of the +following messages:
@@ -201,10 +258,14 @@ administrator should make the backwards-compatible setting setting relay_domains=$mydestinationThe relay_domains default value has changed from "$mydestination" -to the empty value. As long as the relay_domains parameter is left -at its implicit default value, and the backwards-compatible default -setting is turned on, Postfix may log one of the following messages. -
+to the empty value. This could result in unexpected 'Relay access +denied' errors or ETRN errors after Postfix is updated from an older +version. The backwards-compatibility safety net is designed to +prevent such surprises. + +As long as the relay_domains parameter is left at its implicit +default value, and the compatibility_level setting is less than 2, +Postfix may log one of the following messages.
@@ -268,13 +329,13 @@ setting smtputf8_enable=no
The smtputf8_enable default value has changed from "no" to "yes. With the new "yes" setting, the Postfix SMTP server rejects non-ASCII -addresses from clients that don't request SMTPUTF8 support. With -the old "no" setting, Postfix will accept such addresses, even if -such addresses are not permitted by traditional SMTP standards.
+addresses from clients that don't request SMTPUTF8 support, after +Postfix is updated from an older version. The backwards-compatibility +safety net is designed to prevent such surprises.As long as the smtputf8_enable parameter is left at its implicit -default value, and the backwards-compatible default setting is -turned on, Postfix logs a warning each time an SMTP command uses a +default value, and the compatibility_level setting is +less than 1, Postfix logs a warning each time an SMTP command uses a non-ASCII address localpart without requesting SMTPUTF8 support:
diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index a1bf336c1..8e69b9622 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -139,6 +139,7 @@ /* int warn_compat_break_app_dot_mydomain; /* int warn_compat_break_smtputf8_enable; /* int warn_compat_break_chroot; +/* int warn_compat_break_relay_restrictions; /* /* int warn_compat_break_relay_domains; /* int warn_compat_break_flush_domains; @@ -360,6 +361,7 @@ int warn_compat_break_mynetworks_style; int warn_compat_break_app_dot_mydomain; int warn_compat_break_smtputf8_enable; int warn_compat_break_chroot; +int warn_compat_break_relay_restrictions; /* check_myhostname - lookup hostname and validate */ @@ -613,6 +615,10 @@ static void check_legacy_defaults(void) if (mail_conf_lookup(VAR_MYNETWORKS) == 0 && mail_conf_lookup(VAR_MYNETWORKS_STYLE) == 0) warn_compat_break_mynetworks_style = 1; + } else { /* for 'postfix reload' */ + warn_compat_break_relay_domains = 0; + warn_compat_break_flush_domains = 0; + warn_compat_break_mynetworks_style = 0; } /* @@ -631,6 +637,17 @@ static void check_legacy_defaults(void) if (mail_conf_lookup(VAR_SMTPUTF8_ENABLE) == 0) warn_compat_break_smtputf8_enable = 1; warn_compat_break_chroot = 1; + + /* + * Grandfathered in to help sites migrating from Postfix <2.10. + */ + if (mail_conf_lookup(VAR_RELAY_CHECKS) == 0) + warn_compat_break_relay_restrictions = 1; + } else { /* for 'postfix reload' */ + warn_compat_break_app_dot_mydomain = 0; + warn_compat_break_smtputf8_enable = 0; + warn_compat_break_chroot = 0; + warn_compat_break_relay_restrictions = 0; } } diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index be6970a28..d156d29c7 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -55,6 +55,7 @@ extern int var_compat_level; extern int warn_compat_break_app_dot_mydomain; extern int warn_compat_break_smtputf8_enable; extern int warn_compat_break_chroot; +extern int warn_compat_break_relay_restrictions; /* Postfix 2.10. */ extern int warn_compat_break_relay_domains; extern int warn_compat_break_flush_domains; @@ -2072,11 +2073,20 @@ extern char *var_helo_checks; extern char *var_mail_checks; #define VAR_RELAY_CHECKS "smtpd_relay_restrictions" -#define DEF_RELAY_CHECKS PERMIT_MYNETWORKS ", " \ +#define DEF_RELAY_CHECKS "${{$compatibility_level} < {1} ? " \ + "{} : {" PERMIT_MYNETWORKS ", " \ PERMIT_SASL_AUTH ", " \ - DEFER_UNAUTH_DEST + DEFER_UNAUTH_DEST "}}" extern char *var_relay_checks; + /* + * For warn_compat_break_relay_domains check. Same as DEF_RELAY_CHECKS + * except that it evaluates to DUNNO instead of REJECT. + */ +#define FAKE_RELAY_CHECKS PERMIT_MYNETWORKS ", " \ + PERMIT_SASL_AUTH ", " \ + PERMIT_AUTH_DEST + #define VAR_RCPT_CHECKS "smtpd_recipient_restrictions" #define DEF_RCPT_CHECKS "" extern char *var_rcpt_checks; @@ -3301,6 +3311,7 @@ extern char *var_smtpd_milters; #define VAR_SMTPD_MILTER_MAPS "smtpd_milter_maps" #define DEF_SMTPD_MILTER_MAPS "" extern char *var_smtpd_milter_maps; + #define SMTPD_MILTERS_DISABLE "DISABLE" #define VAR_CLEANUP_MILTERS "non_smtpd_milters" diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index d7e69da27..cdcd3308c 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20171229" +#define MAIL_RELEASE_DATE "20180106" #define MAIL_VERSION_NUMBER "3.3" #ifdef SNAPSHOT diff --git a/postfix/src/local/mailbox.c b/postfix/src/local/mailbox.c index 887333c62..1fbbd9c77 100644 --- a/postfix/src/local/mailbox.c +++ b/postfix/src/local/mailbox.c @@ -97,7 +97,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) int deliver_status; int copy_flags; VSTRING *biff; - long end; + off_t end; struct stat st; uid_t spool_uid; gid_t spool_gid; @@ -202,7 +202,8 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) msg_warn("specify \"%s = no\" to ignore mailbox ownership mismatch", VAR_STRICT_MBOX_OWNER); } else { - end = vstream_fseek(mp->fp, (off_t) 0, SEEK_END); + if ((end = vstream_fseek(mp->fp, (off_t) 0, SEEK_END)) < 0) + msg_fatal("seek mailbox file %s: %m", myname, mailbox); mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), mp->fp, copy_flags, "\n", why); } diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index e16152238..94e8c0181 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -335,6 +335,7 @@ static ARGV *client_restrctions; static ARGV *helo_restrctions; static ARGV *mail_restrctions; static ARGV *relay_restrctions; +static ARGV *fake_relay_restrctions; static ARGV *rcpt_restrctions; static ARGV *etrn_restrctions; static ARGV *data_restrctions; @@ -845,6 +846,9 @@ void smtpd_check_init(void) var_mail_checks); relay_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL, var_relay_checks); + if (warn_compat_break_relay_restrictions) + fake_relay_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL, + FAKE_RELAY_CHECKS); rcpt_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL, var_rcpt_checks); etrn_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL, @@ -4958,15 +4962,31 @@ char *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient) * Apply restrictions in the order as specified. We allow relay * restrictions to be empty, for sites that require backwards * compatibility. + * + * If compatibility_level < 1 and smtpd_relay_restrictions is left at its + * default value, find out if the new smtpd_relay_restrictions default + * value would block the request, without logging REJECT messages. + * Approach: evaluate fake relay restrictions (permit_mynetworks, + * permit_sasl_authenticated, permit_auth_destination) and log a warning + * if the result is DUNNO instead of OK, i.e. a reject_unauth_destinatin + * at the end would have blocked the request. */ SMTPD_CHECK_RESET(); - restrctions[0] = relay_restrctions; - restrctions[1] = rcpt_restrctions; + restrctions[0] = rcpt_restrctions; + restrctions[1] = warn_compat_break_relay_restrictions ? + fake_relay_restrctions : relay_restrctions; for (n = 0; n < 2; n++) { status = setjmp(smtpd_check_buf); if (status == 0 && restrctions[n]->argc) status = generic_checks(state, restrctions[n], recipient, SMTPD_NAME_RECIPIENT, CHECK_RECIP_ACL); + if (n == 1 && warn_compat_break_relay_restrictions + && status == SMTPD_CHECK_DUNNO) { + msg_info("using backwards-compatible default setting \"" + VAR_RELAY_CHECKS " = (empty)\" to avoid \"Relay " + "access denied\" error for recipient \"%s\" from " + "client \"%s\"", state->recipient, state->namaddr); + } if (status == SMTPD_CHECK_REJECT) break; } diff --git a/postfix/src/virtual/mailbox.c b/postfix/src/virtual/mailbox.c index 9e826a0b8..19afca877 100644 --- a/postfix/src/virtual/mailbox.c +++ b/postfix/src/virtual/mailbox.c @@ -137,7 +137,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) VAR_STRICT_MBOX_OWNER); } else { if (vstream_fseek(mp->fp, (off_t) 0, SEEK_END) < 0) - msg_fatal("%s: seek queue file %s: %m", + msg_fatal("%s: seek mailbox file %s: %m", myname, VSTREAM_PATH(mp->fp)); mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), mp->fp, copy_flags, "\n", why);