From a4af8bc9fda126dd201e7ecb86fc4a1d448678aa Mon Sep 17 00:00:00 2001
From: Wietse Venema postscreen(8) should not be used on SMTP ports that receive
mail from end-user clients (MUAs). In a typical deployment,
postscreen(8) is used on the "port 25" service, while MUA clients
-submit mail via the submission service.
postscreen(8) is part of a multi-layer defense.
@@ -59,7 +60,7 @@ SpamAssassin, and Milter applications.
Each layer reduces the spam volume. The general strategy is to use the less expensive defenses first, and to use the more expensive -defenses for the spam that remains.
+defenses only for the spam that remains.Topics in this document:
@@ -233,21 +234,14 @@ parameters. Expired entries are silently renewed if possible.When the remote SMTP client is not on the static access list or temporary whitelist, postscreen(8) can implement a number of -whitelist tests before it grants the client a temporary whitelist -status to talk to a Postfix SMTP server process.
+whitelist tests, before it grants the client a temporary whitelist +status that allows it to talk to a Postfix SMTP server process.By listening on both primary and backup MX addresses, postscreen(8) can deny the temporary whitelist status to clients that connect -only to backup MX hosts (an old trick to take advantage of backup -MX hosts with weaker anti-spam policies).
- -Note 1: The status of this feature is still experimental, and -implementation details are likely to change.
- -Note 2: MX policy enforcement is currently supported only for -domains with one Postfix MTA. Support for domains with multiple -Postfix MTAs will have to wait until Postfix has a database client -that can update a shared postscreen(8) database.
+only to backup MX hosts (an old spammer trick to take advantage of +backup MX hosts with weaker anti-spam policies than primary MX +hosts).A list of local postscreen(8) server IP addresses where a non-whitelisted SMTP client can obtain postscreen(8)'s temporary -whitelist status to talk to a Postfix SMTP server process. By -default, a client can pass postscreen(8)'s whitelist tests on any -local postscreen(8) server IP address.
+whitelist status. This status is required before the client can +talk to a Postfix SMTP server process. By default, a client can +obtain postscreen(8)'s whitelist status on any local postscreen(8) +server IP address.When postscreen(8) listens on both primary and backup MX addresses, the postscreen_whitelist_interfaces parameter can be -used to disable whitelisting on backup MX addresses. With this -configuration, postscreen(8) denies whitelisting status to clients -that connect only to backup MX addresses, and prevents them from -talking to a Postfix SMTP server process.
+configured to give the temporary whitelist status only when a client +connects to a primary MX address. Once a client is whitelisted it +can talk to a Postfix SMTP server on any address. Thus, clients +that connect only to backup MX addresses will never become whitelisted, +and will never be allowed to talk to a Postfix SMTP server process. +Example:
diff --git a/postfix/html/postdrop.1.html b/postfix/html/postdrop.1.html index 2756476d0..f06fa329f 100644 --- a/postfix/html/postdrop.1.html +++ b/postfix/html/postdrop.1.html @@ -99,7 +99,7 @@ POSTDROP(1) POSTDROP(1) Available in Postfix version 2.2 and later: - authorized_submit_users (static:anyone) + authorized_submit_users (static:anyone) List of users who are authorized to submit mail with the sendmail(1) command (and with the privi- leged postdrop(1) helper command). diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 50630574b..4aecf46e1 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -4361,16 +4361,18 @@ This feature is available in Postfix 2.8. .SH postscreen_whitelist_interfaces (default: static:all) A list of local \fBpostscreen\fR(8) server IP addresses where a non-whitelisted SMTP client can obtain \fBpostscreen\fR(8)'s temporary -whitelist status to talk to a Postfix SMTP server process. By -default, a client can pass \fBpostscreen\fR(8)'s whitelist tests on any -local \fBpostscreen\fR(8) server IP address. +whitelist status. This status is required before the client can +talk to a Postfix SMTP server process. By default, a client can +obtain \fBpostscreen\fR(8)'s whitelist status on any local \fBpostscreen\fR(8) +server IP address. .PP When \fBpostscreen\fR(8) listens on both primary and backup MX addresses, the postscreen_whitelist_interfaces parameter can be -used to disable whitelisting on backup MX addresses. With this -configuration, \fBpostscreen\fR(8) denies whitelisting status to clients -that connect only to backup MX addresses, and prevents them from -talking to a Postfix SMTP server process. +configured to give the temporary whitelist status only when a client +connects to a primary MX address. Once a client is whitelisted it +can talk to a Postfix SMTP server on any address. Thus, clients +that connect only to backup MX addresses will never become whitelisted, +and will never be allowed to talk to a Postfix SMTP server process. .PP Example: .PP diff --git a/postfix/proto/POSTSCREEN_README.html b/postfix/proto/POSTSCREEN_README.html index c3249e6e8..6de1e7286 100644 --- a/postfix/proto/POSTSCREEN_README.html +++ b/postfix/proto/POSTSCREEN_README.html @@ -31,7 +31,8 @@ postscreen(8) minimizes its impact on legitimate email traffic.postscreen(8) should not be used on SMTP ports that receive mail from end-user clients (MUAs). In a typical deployment, postscreen(8) is used on the "port 25" service, while MUA clients -submit mail via the submission service.
+submit mail via the submission service (port 587) which normally +requires client authentication.postscreen(8) is part of a multi-layer defense.
@@ -59,7 +60,7 @@ SpamAssassin, and Milter applications.
Each layer reduces the spam volume. The general strategy is to use the less expensive defenses first, and to use the more expensive -defenses for the spam that remains.
+defenses only for the spam that remains.Topics in this document:
@@ -233,21 +234,14 @@ parameters. Expired entries are silently renewed if possible.When the remote SMTP client is not on the static access list or temporary whitelist, postscreen(8) can implement a number of -whitelist tests before it grants the client a temporary whitelist -status to talk to a Postfix SMTP server process.
+whitelist tests, before it grants the client a temporary whitelist +status that allows it to talk to a Postfix SMTP server process.By listening on both primary and backup MX addresses, postscreen(8) can deny the temporary whitelist status to clients that connect -only to backup MX hosts (an old trick to take advantage of backup -MX hosts with weaker anti-spam policies).
- -Note 1: The status of this feature is still experimental, and -implementation details are likely to change.
- -Note 2: MX policy enforcement is currently supported only for -domains with one Postfix MTA. Support for domains with multiple -Postfix MTAs will have to wait until Postfix has a database client -that can update a shared postscreen(8) database.
+only to backup MX hosts (an old spammer trick to take advantage of +backup MX hosts with weaker anti-spam policies than primary MX +hosts).A list of local postscreen(8) server IP addresses where a non-whitelisted SMTP client can obtain postscreen(8)'s temporary -whitelist status to talk to a Postfix SMTP server process. By -default, a client can pass postscreen(8)'s whitelist tests on any -local postscreen(8) server IP address.
+whitelist status. This status is required before the client can +talk to a Postfix SMTP server process. By default, a client can +obtain postscreen(8)'s whitelist status on any local postscreen(8) +server IP address.When postscreen(8) listens on both primary and backup MX addresses, the postscreen_whitelist_interfaces parameter can be -used to disable whitelisting on backup MX addresses. With this -configuration, postscreen(8) denies whitelisting status to clients -that connect only to backup MX addresses, and prevents them from -talking to a Postfix SMTP server process.
+configured to give the temporary whitelist status only when a client +connects to a primary MX address. Once a client is whitelisted it +can talk to a Postfix SMTP server on any address. Thus, clients +that connect only to backup MX addresses will never become whitelisted, +and will never be allowed to talk to a Postfix SMTP server process. +Example:
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 6327695a6..efb44e55a 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 "20110501" +#define MAIL_RELEASE_DATE "20110605" #define MAIL_VERSION_NUMBER "2.9" #ifdef SNAPSHOT diff --git a/postfix/src/master/master_ent.c b/postfix/src/master/master_ent.c index 4723251bd..cc0bb56d7 100644 --- a/postfix/src/master/master_ent.c +++ b/postfix/src/master/master_ent.c @@ -272,7 +272,7 @@ MASTER_SERV *get_master_ent() /* * Skip blank lines and comment lines. */ - do { + for (;;) { if (readlline(buf, master_fp, &master_line) == 0) { vstring_free(buf); vstring_free(junk); @@ -284,7 +284,9 @@ MASTER_SERV *get_master_ent() name = cp; transport = get_str_ent(&bufp, "transport type", (char *) 0); vstring_sprintf(junk, "%s.%s", name, transport); - } while (match_service_match(master_disable, vstring_str(junk)) != 0); + if (match_service_match(master_disable, vstring_str(junk)) == 0) + break; + } /* * Parse one logical line from the configuration file. Initialize service diff --git a/postfix/src/postdrop/postdrop.c b/postfix/src/postdrop/postdrop.c index 34e4fdf8e..a2df01ece 100644 --- a/postfix/src/postdrop/postdrop.c +++ b/postfix/src/postdrop/postdrop.c @@ -235,6 +235,7 @@ int main(int argc, char **argv) int saved_errno; int from_count = 0; int rcpt_count = 0; + int validate_input = 1; /* * Fingerprint executables and core dumps. @@ -453,6 +454,7 @@ int main(int argc, char **argv) && rec_type != REC_TYPE_EOF) if (rec_type == REC_TYPE_ERROR) msg_fatal("uid=%ld: malformed input", (long) uid); + validate_input = 0; errno = saved_errno; break; } @@ -478,7 +480,7 @@ int main(int argc, char **argv) * the segment terminator records, there aren't any other mandatory * records in a Postfix submission queue file. */ - if (from_count == 0 || rcpt_count == 0) { + if (validate_input && (from_count == 0 || rcpt_count == 0)) { status = CLEANUP_STAT_BAD; mail_stream_cleanup(dst); } diff --git a/postfix/src/postscreen/postscreen.h b/postfix/src/postscreen/postscreen.h index 7a82b3697..b378aaad4 100644 --- a/postfix/src/postscreen/postscreen.h +++ b/postfix/src/postscreen/postscreen.h @@ -81,7 +81,7 @@ typedef struct { #define PSC_STATE_FLAG_NEW (1<<3) /* some test was never passed */ #define PSC_STATE_FLAG_BLIST_FAIL (1<<4) /* blacklisted */ #define PSC_STATE_FLAG_HANGUP (1<<5) /* NOT a test failure */ -#define PSC_STATE_FLAG_CACHE_EXPIRED (1<<6) /* cache retention expired */ +/* unused */ #define PSC_STATE_FLAG_WLIST_FAIL (1<<7) /* do not whitelist */ /* diff --git a/postfix/src/postscreen/postscreen_state.c b/postfix/src/postscreen/postscreen_state.c index 51c3bf0c9..581647b6f 100644 --- a/postfix/src/postscreen/postscreen_state.c +++ b/postfix/src/postscreen/postscreen_state.c @@ -255,7 +255,7 @@ const char *psc_print_state_flags(int flags, const char *context) "NEW", PSC_STATE_FLAG_NEW, "BLIST_FAIL", PSC_STATE_FLAG_BLIST_FAIL, "HANGUP", PSC_STATE_FLAG_HANGUP, - "CACHE_EXPIRED", PSC_STATE_FLAG_CACHE_EXPIRED, + /* unused */ "WLIST_FAIL", PSC_STATE_FLAG_WLIST_FAIL, "PENAL_UPDATE", PSC_STATE_FLAG_PENAL_UPDATE, diff --git a/postfix/src/postscreen/postscreen_tests.c b/postfix/src/postscreen/postscreen_tests.c index ccc3241ba..57bfd6999 100644 --- a/postfix/src/postscreen/postscreen_tests.c +++ b/postfix/src/postscreen/postscreen_tests.c @@ -215,37 +215,44 @@ void psc_parse_tests(PSC_STATE *state, state->flags |= PSC_STATE_FLAG_NEW; /* - * Don't flag a cache entry as expired just because some test was never - * passed. - * * Don't flag disabled tests as "todo", because there would be no way to * make those bits go away. */ - if (PSC_PREGR_TEST_ENABLE() && time_value > state->pregr_stamp) { + if (PSC_PREGR_TEST_ENABLE() && time_value > state->pregr_stamp) state->flags |= PSC_STATE_FLAG_PREGR_TODO; - if (state->pregr_stamp > PSC_TIME_STAMP_DISABLED) - state->flags |= PSC_STATE_FLAG_CACHE_EXPIRED; - } - if (PSC_DNSBL_TEST_ENABLE() && time_value > state->dnsbl_stamp) { + if (PSC_DNSBL_TEST_ENABLE() && time_value > state->dnsbl_stamp) state->flags |= PSC_STATE_FLAG_DNSBL_TODO; - if (state->dnsbl_stamp > PSC_TIME_STAMP_DISABLED) - state->flags |= PSC_STATE_FLAG_CACHE_EXPIRED; - } - if (var_psc_pipel_enable && time_value > state->pipel_stamp) { + if (var_psc_pipel_enable && time_value > state->pipel_stamp) state->flags |= PSC_STATE_FLAG_PIPEL_TODO; - if (state->pipel_stamp > PSC_TIME_STAMP_DISABLED) - state->flags |= PSC_STATE_FLAG_CACHE_EXPIRED; - } - if (var_psc_nsmtp_enable && time_value > state->nsmtp_stamp) { + if (var_psc_nsmtp_enable && time_value > state->nsmtp_stamp) state->flags |= PSC_STATE_FLAG_NSMTP_TODO; - if (state->nsmtp_stamp > PSC_TIME_STAMP_DISABLED) - state->flags |= PSC_STATE_FLAG_CACHE_EXPIRED; - } - if (var_psc_barlf_enable && time_value > state->barlf_stamp) { + if (var_psc_barlf_enable && time_value > state->barlf_stamp) state->flags |= PSC_STATE_FLAG_BARLF_TODO; - if (state->barlf_stamp > PSC_TIME_STAMP_DISABLED) - state->flags |= PSC_STATE_FLAG_CACHE_EXPIRED; + + /* + * If any test has expired, proactively refresh tests that will expire + * soon. This can increase the occurrence of client-visible delays, but + * avoids questions about why a client can pass some test and then fail + * within seconds. The proactive refresh time is really a surrogate for + * the user's curiosity level, and therefore hard to choose optimally. + */ +#ifdef VAR_PSC_REFRESH_TIME + if ((state->flags & PSC_STATE_MASK_ANY_TODO) != 0 + && var_psc_refresh_time > 0) { + time_t refresh_time = time_value + var_psc_refresh_time; + + if (PSC_PREGR_TEST_ENABLE() && refresh_time > state->pregr_stamp) + state->flags |= PSC_STATE_FLAG_PREGR_TODO; + if (PSC_DNSBL_TEST_ENABLE() && refresh_time > state->dnsbl_stamp) + state->flags |= PSC_STATE_FLAG_DNSBL_TODO; + if (var_psc_pipel_enable && refresh_time > state->pipel_stamp) + state->flags |= PSC_STATE_FLAG_PIPEL_TODO; + if (var_psc_nsmtp_enable && refresh_time > state->nsmtp_stamp) + state->flags |= PSC_STATE_FLAG_NSMTP_TODO; + if (var_psc_barlf_enable && refresh_time > state->barlf_stamp) + state->flags |= PSC_STATE_FLAG_BARLF_TODO; } +#endif /* * Gratuitously make postscreen logging more useful by turning on all diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index e381a36f3..0768c61b7 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -3796,8 +3796,8 @@ static int generic_checks(SMTPD_STATE *state, ARGV *restrictions, state->helo_name, SMTPD_NAME_HELO); } } else if (strcasecmp(name, PERMIT_NAKED_IP_ADDR) == 0) { - msg_warn("restriction %s is deprecated. Use %s instead", - PERMIT_NAKED_IP_ADDR, PERMIT_MYNETWORKS); + msg_warn("restriction %s is deprecated. Use %s or %s instead", + PERMIT_NAKED_IP_ADDR, PERMIT_MYNETWORKS, PERMIT_SASL_AUTH); if (state->helo_name) { if (state->helo_name[strspn(state->helo_name, "0123456789.:")] == 0 && (status = reject_invalid_hostaddr(state, state->helo_name, -- 2.47.3