From ffe80bd40324df4845f3b0705c6abc10d2a59d4b Mon Sep 17 00:00:00 2001
From: Viktor Dukhovni
If authorized user submissions require different header/body +checks than mail from remote MTAs, then this is possible as long +as you have separate mail streams for authorized users and for MX +service.
+ +The example below assumes that authorized users connect to TCP +port 587 (submission) or 465 (smtps), and that remote MTAs connect +to TCP port 25 (smtp).
+ +First, we define a few "user-defined" parameters that will +override settings for the submission and smtps services.
+ +++ ++/etc/postfix/main.cf: + mua_cleanup_service_name = mua_cleanup + mua_header_checks = pcre:/etc/postfix/mua_header_checks + mua_body_checks = pcre:/etc/postfix/mua_body_checks ++
Next, we define mua_cleanup as a dedicated cleanup service that +will be used only by the submission and smtps services. This service +uses the header_checks and body_checks overrides that were defined +above.
+ +++ ++/etc/postfix.master.cf: + # ================================================================= + # service type private unpriv chroot wakeup maxproc command + # (yes) (yes) (yes) (never) (100) + # ================================================================= + smtp inet n - n - - smtpd + mua_cleanup unix n - n - 0 cleanup + -o header_checks=$mua_header_checks + -o body_checks=$mua_body_checks + submission inet n - n - - smtpd + -o cleanup_service_name=$mua_cleanup_service_name + -o syslog_name=postfix/submission + ...[see sample master.cf file for more]... + smtps inet n - n - - smtpd + -o cleanup_service_name=$mua_cleanup_service_name + -o syslog_name=postfix/smtps + -o smtpd_tls_wrappermode=yes + ...[see sample master.cf file for more]... ++
By keeping the "mua_xxx" parameter settings in main.cf, you +keep your master.cf file simple, and you minimize the amount +of duplication.
+The following information applies to Postfix 2.1. Earlier diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index e4e47d80d..839386b98 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -17486,13 +17486,13 @@ gives timeout errors.
Algorithm used to encrypt RFC5077 TLS session tickets. This -algorithm must use CBC mode, have a 128-bit initialization vector -(IV), and must have a key length between 128 and 256 bits. The -default is aes-128-cbc. Sensible alternatives include aes-192-cbc -and aes-256-cbc.
+algorithm must use CBC mode, have a 128-bit block size, and must +have a key length between 128 and 256 bits. The default is +aes-256-cbc. Overriding the default to choose a different algorithm +is discouraged.Setting this parameter empty disables session ticket support in the Postfix SMTP server. Another way to disable session ticket diff --git a/postfix/html/smtp-sink.1.html b/postfix/html/smtp-sink.1.html index 8c676de7c..e58394ec3 100644 --- a/postfix/html/smtp-sink.1.html +++ b/postfix/html/smtp-sink.1.html @@ -116,6 +116,8 @@ SMTP-SINK(1) SMTP-SINK(1) -n count Terminate after count sessions. + -N Do not announce support for DSN. + -p Do not announce support for ESMTP command pipelining. -P Change the server greeting so that it appears to come through a diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index 7e6a24269..61ac92c30 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -541,7 +541,8 @@ SMTPD(8) SMTPD(8) Available in Postfix version 2.12 and later: - tls_session_ticket_cipher (aes-128-cbc) + tls_session_ticket_cipher (Postfix ≥ 2.12: aes-256-cbc, postfix < + 2.12: aes-128-cbc) Algorithm used to encrypt RFC5077 TLS session tickets. OBSOLETE STARTTLS CONTROLS diff --git a/postfix/man/man1/smtp-sink.1 b/postfix/man/man1/smtp-sink.1 index 7013c9299..da45ae7fd 100644 --- a/postfix/man/man1/smtp-sink.1 +++ b/postfix/man/man1/smtp-sink.1 @@ -112,6 +112,8 @@ connections will stay queued in the TCP/IP stack. Terminate after receiving \fIcount\fR messages. .IP "\fB-n \fIcount\fR" Terminate after \fIcount\fR sessions. +.IP \fB-N\fR +Do not announce support for DSN. .IP \fB-p\fR Do not announce support for ESMTP command pipelining. .IP \fB-P\fR diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index daeebcb9c..121cc5fbb 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -12024,12 +12024,12 @@ Note: on OpenBSD systems specify /dev/arandom when /dev/urandom gives timeout errors. .PP This feature is available in Postfix 2.2 and later. -.SH tls_session_ticket_cipher (default: aes-128-cbc) +.SH tls_session_ticket_cipher (default: Postfix >= 2.12: aes-256-cbc, postfix < 2.12: aes-128-cbc) Algorithm used to encrypt RFC5077 TLS session tickets. This -algorithm must use CBC mode, have a 128-bit initialization vector -(IV), and must have a key length between 128 and 256 bits. The -default is aes-128-cbc. Sensible alternatives include aes-192-cbc -and aes-256-cbc. +algorithm must use CBC mode, have a 128-bit block size, and must +have a key length between 128 and 256 bits. The default is +aes-256-cbc. Overriding the default to choose a different algorithm +is discouraged. .PP Setting this parameter empty disables session ticket support in the Postfix SMTP server. Another way to disable session ticket diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index 9ede39e7c..0a8d7c151 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -489,7 +489,7 @@ Available in Postfix version 2.11 and later: The name of the \fBtlsmgr\fR(8) service entry in master.cf. .PP Available in Postfix version 2.12 and later: -.IP "\fBtls_session_ticket_cipher (aes-128-cbc)\fR" +.IP "\fBtls_session_ticket_cipher (Postfix ≥ 2.12: aes-256-cbc, postfix < 2.12: aes-128-cbc)\fR" Algorithm used to encrypt RFC5077 TLS session tickets. .SH "OBSOLETE STARTTLS CONTROLS" .na diff --git a/postfix/proto/BUILTIN_FILTER_README.html b/postfix/proto/BUILTIN_FILTER_README.html index af959d298..4cccb87e4 100644 --- a/postfix/proto/BUILTIN_FILTER_README.html +++ b/postfix/proto/BUILTIN_FILTER_README.html @@ -126,6 +126,8 @@ same message repeatedly.
If authorized user submissions require different header/body +checks than mail from remote MTAs, then this is possible as long +as you have separate mail streams for authorized users and for MX +service.
+ +The example below assumes that authorized users connect to TCP +port 587 (submission) or 465 (smtps), and that remote MTAs connect +to TCP port 25 (smtp).
+ +First, we define a few "user-defined" parameters that will +override settings for the submission and smtps services.
+ +++ ++/etc/postfix/main.cf: + mua_cleanup_service_name = mua_cleanup + mua_header_checks = pcre:/etc/postfix/mua_header_checks + mua_body_checks = pcre:/etc/postfix/mua_body_checks ++
Next, we define mua_cleanup as a dedicated cleanup service that +will be used only by the submission and smtps services. This service +uses the header_checks and body_checks overrides that were defined +above.
+ +++ ++/etc/postfix.master.cf: + # ================================================================= + # service type private unpriv chroot wakeup maxproc command + # (yes) (yes) (yes) (never) (100) + # ================================================================= + smtp inet n - n - - smtpd + mua_cleanup unix n - n - 0 cleanup + -o header_checks=$mua_header_checks + -o body_checks=$mua_body_checks + submission inet n - n - - smtpd + -o cleanup_service_name=$mua_cleanup_service_name + -o syslog_name=postfix/submission + ...[see sample master.cf file for more]... + smtps inet n - n - - smtpd + -o cleanup_service_name=$mua_cleanup_service_name + -o syslog_name=postfix/smtps + -o smtpd_tls_wrappermode=yes + ...[see sample master.cf file for more]... ++
By keeping the "mua_xxx" parameter settings in main.cf, you +keep your master.cf file simple, and you minimize the amount +of duplication.
+The following information applies to Postfix 2.1. Earlier diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index d48128065..8624f3c67 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -15899,13 +15899,13 @@ anchor assertion) TLSA records.
This feature is available in Postfix 2.11 and later.
-%PARAM tls_session_ticket_cipher aes-128-cbc +%PARAM tls_session_ticket_cipher Postfix ≥ 2.12: aes-256-cbc, postfix < 2.12: aes-128-cbcAlgorithm used to encrypt RFC5077 TLS session tickets. This -algorithm must use CBC mode, have a 128-bit initialization vector -(IV), and must have a key length between 128 and 256 bits. The -default is aes-128-cbc. Sensible alternatives include aes-192-cbc -and aes-256-cbc.
+algorithm must use CBC mode, have a 128-bit block size, and must +have a key length between 128 and 256 bits. The default is +aes-256-cbc. Overriding the default to choose a different algorithm +is discouraged. Setting this parameter empty disables session ticket support
in the Postfix SMTP server. Another way to disable session ticket
diff --git a/postfix/src/cleanup/cleanup_addr.c b/postfix/src/cleanup/cleanup_addr.c
index f869f0357..c2fce82e9 100644
--- a/postfix/src/cleanup/cleanup_addr.c
+++ b/postfix/src/cleanup/cleanup_addr.c
@@ -204,6 +204,11 @@ void cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf)
if (state->flags & CLEANUP_FLAG_AUTOUTF8)
state->smtputf8 |= SMTPUTF8_FLAG_REQUESTED;
}
+ /* Fix 20141024: Don't fake up a "bare" DSN original rcpt in smtp(8). */
+ if (state->dsn_orcpt == 0 && *STR(clean_addr) != 0)
+ state->dsn_orcpt = concatenate((!allascii(STR(clean_addr))
+ && (state->smtputf8 & SMTPUTF8_FLAG_REQUESTED)) ?
+ "utf-8" : "rfc822", ";", STR(clean_addr), (char *) 0);
cleanup_out_recipient(state, state->dsn_orcpt, state->dsn_notify,
state->orig_rcpt, STR(clean_addr));
if (state->recip) /* This can happen */
diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h
index 383873e9f..a7b0fdb56 100644
--- a/postfix/src/global/mail_params.h
+++ b/postfix/src/global/mail_params.h
@@ -2329,7 +2329,12 @@ extern int var_local_rcpt_code;
" $" VAR_RCPT_BCC_MAPS \
" $" VAR_SMTP_GENERIC_MAPS \
" $" VAR_LMTP_GENERIC_MAPS \
- " $" VAR_ALIAS_MAPS
+ " $" VAR_ALIAS_MAPS \
+ " $" VAR_CLIENT_CHECKS \
+ " $" VAR_HELO_CHECKS \
+ " $" VAR_MAIL_CHECKS \
+ " $" VAR_RELAY_CHECKS \
+ " $" VAR_RCPT_CHECKS
extern char *var_proxy_read_maps;
#define VAR_PROXY_WRITE_MAPS "proxy_write_maps"
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index d51041b05..b0576b604 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 "20141020"
+#define MAIL_RELEASE_DATE "20141106"
#define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT
diff --git a/postfix/src/smtp/smtp_tls_policy.c b/postfix/src/smtp/smtp_tls_policy.c
index 6ae7ade9e..618ce577a 100644
--- a/postfix/src/smtp/smtp_tls_policy.c
+++ b/postfix/src/smtp/smtp_tls_policy.c
@@ -518,9 +518,11 @@ static void *policy_create(const char *unused_key, void *context)
switch (site_level) {
default:
tls->level = site_level;
+ /* FALLTHROUGH */
case TLS_LEV_NOTFOUND:
break;
case TLS_LEV_INVALID:
+ tls->level = site_level;
return ((void *) tls);
}
diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c
index 924340b20..c4b34aedc 100644
--- a/postfix/src/smtpd/smtpd.c
+++ b/postfix/src/smtpd/smtpd.c
@@ -455,7 +455,7 @@
/* The name of the \fBtlsmgr\fR(8) service entry in master.cf.
/* .PP
/* Available in Postfix version 2.12 and later:
-/* .IP "\fBtls_session_ticket_cipher (aes-128-cbc)\fR"
+/* .IP "\fBtls_session_ticket_cipher (Postfix ≥ 2.12: aes-256-cbc, postfix < 2.12: aes-128-cbc)\fR"
/* Algorithm used to encrypt RFC5077 TLS session tickets.
/* OBSOLETE STARTTLS CONTROLS
/* .ad
@@ -4614,6 +4614,22 @@ static void tls_reset(SMTPD_STATE *state)
#endif
+/* unimpl_cmd - dummy for functionality that is not compiled in */
+
+static int unimpl_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
+{
+
+ /*
+ * When a connection is closed we want to log the request counts for
+ * unimplemented STARTTLS or AUTH commands separately, instead of logging
+ * those commands as "unknown". By handling unimplemented commands with
+ * this dummy function, we avoid messing up the command processing loop.
+ */
+ state->error_mask |= MAIL_ERROR_PROTOCOL;
+ smtpd_chat_reply(state, "502 5.5.1 Error: command not implemented");
+ return (-1);
+}
+
/*
* The table of all SMTP commands that we know. Set the junk limit flag on
* any command that can be repeated an arbitrary number of times without
@@ -4638,9 +4654,13 @@ static SMTPD_CMD smtpd_cmd_table[] = {
{SMTPD_CMD_XFORWARD, xforward_cmd,},
#ifdef USE_TLS
{SMTPD_CMD_STARTTLS, starttls_cmd, SMTPD_CMD_FLAG_PRE_TLS,},
+#else
+ {SMTPD_CMD_STARTTLS, unimpl_cmd, SMTPD_CMD_FLAG_PRE_TLS,},
#endif
#ifdef USE_SASL_AUTH
{SMTPD_CMD_AUTH, smtpd_sasl_auth_cmd,},
+#else
+ {SMTPD_CMD_AUTH, unimpl_cmd,},
#endif
{SMTPD_CMD_MAIL, mail_cmd,},
{SMTPD_CMD_RCPT, rcpt_cmd,},
diff --git a/postfix/src/smtpstone/smtp-sink.c b/postfix/src/smtpstone/smtp-sink.c
index 68dd84039..8fd987c83 100644
--- a/postfix/src/smtpstone/smtp-sink.c
+++ b/postfix/src/smtpstone/smtp-sink.c
@@ -106,6 +106,8 @@
/* Terminate after receiving \fIcount\fR messages.
/* .IP "\fB-n \fIcount\fR"
/* Terminate after \fIcount\fR sessions.
+/* .IP \fB-N\fR
+/* Do not announce support for DSN.
/* .IP \fB-p\fR
/* Do not announce support for ESMTP command pipelining.
/* .IP \fB-P\fR
@@ -369,6 +371,7 @@ static int disable_saslauth;
static int disable_xclient;
static int disable_xforward;
static int disable_enh_status;
+static int disable_dsn;
static int max_client_count = DEF_MAX_CLIENT_COUNT;
static int client_count;
static int sock;
@@ -628,6 +631,8 @@ static void ehlo_response(SINK_STATE *state, const char *args)
smtp_printf(state->stream, "250-XFORWARD NAME ADDR PROTO HELO");
if (!disable_enh_status)
smtp_printf(state->stream, "250-ENHANCEDSTATUSCODES");
+ if (!disable_dsn)
+ smtp_printf(state->stream, "250-DSN");
/* RFC 821/2821/5321: Format is replycode