From: Wietse Venema Date: Sun, 30 Aug 2020 05:00:00 +0000 (-0500) Subject: postfix-3.6-20200830 X-Git-Tag: v3.6.0-RC1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3f7b853c3d2a72b5a5b7ea1c53076247a179880;p=thirdparty%2Fpostfix.git postfix-3.6-20200830 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index df330caf3..edede8a04 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -25056,3 +25056,18 @@ Apologies for any names omitted. utf-8. Files: mantools/makemanidx, mantools/make_soho_readme, mantools/man2html, mantools/readme2html, proto/*_README.html, proto/INSTALL.html, proto/postconf.html.prolog, html/index.html. + + Refactor: moved the SASL mechanism filter code from the + Postfix SMTP client to a library module, so that it can be + reused in the Postfix SMTP server. Files: smtp/smtp_sasl_proto.c, + global/sacl_mech_filter.[hc]. + + Bugfix (introduced: Postfix 2.0): smtp_sasl_mechamism_filter + ignored table lookup errors, treating as 'not found'. Found while + refactoring code. + + Feature: smtpd_sasl_mechanism_list (default: !external, + static:rest) to avoid confusing errors when a SASL backend + wants to anounce EXTERNAL support for which Postfix support + does not exist. Files: smtpd/smtpd.[hc], smtpd_sasl_glue.[hc], + global/mail_params.h, proto/postconf.proto, mantools/postlink. diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 44c37dcec..8707e5e29 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -1,5 +1,13 @@ Wish list: + smtp_sasl_tls_security_options = noanonymous, and make + smtp_sasl_security_options default dependent on the + smtp_sasl_tls_security_options default (i.e. reverse the + dependency). + + Add a configurable filter for SMTP command syntax. Maybe + time for some inline-pcre or inline-regexp map support? + Update makedefs and sys-defs.h for current Linux kernels and *BSD releases. diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 47e64cc04..da454c37f 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -16338,6 +16338,34 @@ Examples: + + +
smtpd_sasl_mechanism_filter +(default: !external, static:rest)
+ +

If non-empty, a filter for the SASL mechanism names that the +Postfix SMTP server will announce in the EHLO response. By default, +the Postfix SMTP server will not announce the EXTERNAL mechanism, +because Postfix support for that is not implemented.

+ +

Specify mechanism names, "/file/name" patterns, or "type:table" +lookup tables, separated by comma or whitespace. The right-hand +side result from "type:table" lookups is ignored. Specify "!pattern" +to exclude a mechanism name from the list.

+ +

+Examples: +

+ +
+smtpd_sasl_mechanism_filter = !external, !gssapi, static:rest
+smtpd_sasl_mechanism_filter = login, plain
+smtpd_sasl_mechanism_filter = /etc/postfix/smtpd_mechs
+
+ +

This feature is available in Postfix 3.6 and later.

+ +
smtpd_sasl_path diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index cbc276088..f4742141a 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -396,17 +396,23 @@ SMTPD(8) SMTPD(8) The maximum length of a SASL client's response to a server chal- lenge. + Available in Postfix 3.6 and later: + + smtpd_sasl_mechanism_filter (!external, static:rest) + If non-empty, a filter for the SASL mechanism names that the + Postfix SMTP server will announce in the EHLO response. + STARTTLS SUPPORT CONTROLS - Detailed information about STARTTLS configuration may be found in the + Detailed information about STARTTLS configuration may be found in the TLS_README document. smtpd_tls_security_level (empty) - The SMTP TLS security level for the Postfix SMTP server; when a + The SMTP TLS security level for the Postfix SMTP server; when a non-empty value is specified, this overrides the obsolete param- eters smtpd_use_tls and smtpd_enforce_tls. smtpd_sasl_tls_security_options ($smtpd_sasl_security_options) - The SASL authentication security options that the Postfix SMTP + The SASL authentication security options that the Postfix SMTP server uses for TLS encrypted SMTP sessions. smtpd_starttls_timeout (see 'postconf -d' output) @@ -414,25 +420,25 @@ SMTPD(8) SMTPD(8) during TLS startup and shutdown handshake procedures. smtpd_tls_CAfile (empty) - A file containing (PEM format) CA certificates of root CAs + A file containing (PEM format) CA certificates of root CAs trusted to sign either remote SMTP client certificates or inter- mediate CA certificates. smtpd_tls_CApath (empty) - A directory containing (PEM format) CA certificates of root CAs + A directory containing (PEM format) CA certificates of root CAs trusted to sign either remote SMTP client certificates or inter- mediate CA certificates. smtpd_tls_always_issue_session_ids (yes) - Force the Postfix SMTP server to issue a TLS session id, even - when TLS session caching is turned off (smtpd_tls_ses- + Force the Postfix SMTP server to issue a TLS session id, even + when TLS session caching is turned off (smtpd_tls_ses- sion_cache_database is empty). smtpd_tls_ask_ccert (no) Ask a remote SMTP client for a client certificate. smtpd_tls_auth_only (no) - When TLS encryption is optional in the Postfix SMTP server, do + When TLS encryption is optional in the Postfix SMTP server, do not announce or accept SASL authentication over unencrypted con- nections. @@ -443,18 +449,18 @@ SMTPD(8) SMTPD(8) File with the Postfix SMTP server RSA certificate in PEM format. smtpd_tls_exclude_ciphers (empty) - List of ciphers or cipher types to exclude from the SMTP server + List of ciphers or cipher types to exclude from the SMTP server cipher list at all TLS security levels. smtpd_tls_dcert_file (empty) File with the Postfix SMTP server DSA certificate in PEM format. smtpd_tls_dh1024_param_file (empty) - File with DH parameters that the Postfix SMTP server should use + File with DH parameters that the Postfix SMTP server should use with non-export EDH ciphers. smtpd_tls_dh512_param_file (empty) - File with DH parameters that the Postfix SMTP server should use + File with DH parameters that the Postfix SMTP server should use with export-grade EDH ciphers. smtpd_tls_dkey_file ($smtpd_tls_dcert_file) @@ -467,12 +473,12 @@ SMTPD(8) SMTPD(8) Enable additional Postfix SMTP server logging of TLS activity. smtpd_tls_mandatory_ciphers (medium) - The minimum TLS cipher grade that the Postfix SMTP server will + The minimum TLS cipher grade that the Postfix SMTP server will use with mandatory TLS encryption. smtpd_tls_mandatory_exclude_ciphers (empty) - Additional list of ciphers or cipher types to exclude from the - Postfix SMTP server cipher list at mandatory TLS security lev- + Additional list of ciphers or cipher types to exclude from the + Postfix SMTP server cipher list at mandatory TLS security lev- els. smtpd_tls_mandatory_protocols (see 'postconf -d' output) @@ -481,21 +487,21 @@ SMTPD(8) SMTPD(8) smtpd_tls_received_header (no) Request that the Postfix SMTP server produces Received: message - headers that include information about the protocol and cipher - used, as well as the remote SMTP client CommonName and client + headers that include information about the protocol and cipher + used, as well as the remote SMTP client CommonName and client certificate issuer CommonName. smtpd_tls_req_ccert (no) - With mandatory TLS encryption, require a trusted remote SMTP + With mandatory TLS encryption, require a trusted remote SMTP client certificate in order to allow TLS connections to proceed. smtpd_tls_wrappermode (no) - Run the Postfix SMTP server in the non-standard "wrapper" mode, + Run the Postfix SMTP server in the non-standard "wrapper" mode, instead of using the STARTTLS command. tls_daemon_random_bytes (32) - The number of pseudo-random bytes that an smtp(8) or smtpd(8) - process requests from the tlsmgr(8) server in order to seed its + The number of pseudo-random bytes that an smtp(8) or smtpd(8) + process requests from the tlsmgr(8) server in order to seed its internal pseudo random number generator (PRNG). tls_high_cipherlist (see 'postconf -d' output) @@ -511,41 +517,41 @@ SMTPD(8) SMTPD(8) The OpenSSL cipherlist for "export" or higher grade ciphers. tls_null_cipherlist (eNULL:!aNULL) - The OpenSSL cipherlist for "NULL" grade ciphers that provide + The OpenSSL cipherlist for "NULL" grade ciphers that provide authentication without encryption. Available in Postfix version 2.5 and later: smtpd_tls_fingerprint_digest (see 'postconf -d' output) - The message digest algorithm to construct remote SMTP - client-certificate fingerprints or public key fingerprints - (Postfix 2.9 and later) for check_ccert_access and per- + The message digest algorithm to construct remote SMTP + client-certificate fingerprints or public key fingerprints + (Postfix 2.9 and later) for check_ccert_access and per- mit_tls_clientcerts. Available in Postfix version 2.6 and later: smtpd_tls_protocols (see postconf -d output) - TLS protocols accepted by the Postfix SMTP server with oppor- + TLS protocols accepted by the Postfix SMTP server with oppor- tunistic TLS encryption. smtpd_tls_ciphers (medium) - The minimum TLS cipher grade that the Postfix SMTP server will + The minimum TLS cipher grade that the Postfix SMTP server will use with opportunistic TLS encryption. smtpd_tls_eccert_file (empty) - File with the Postfix SMTP server ECDSA certificate in PEM for- + File with the Postfix SMTP server ECDSA certificate in PEM for- mat. smtpd_tls_eckey_file ($smtpd_tls_eccert_file) - File with the Postfix SMTP server ECDSA private key in PEM for- + File with the Postfix SMTP server ECDSA private key in PEM for- mat. smtpd_tls_eecdh_grade (see 'postconf -d' output) - The Postfix SMTP server security grade for ephemeral ellip- + The Postfix SMTP server security grade for ephemeral ellip- tic-curve Diffie-Hellman (EECDH) key exchange. tls_eecdh_strong_curve (prime256v1) - The elliptic curve used by the Postfix SMTP server for sensibly + The elliptic curve used by the Postfix SMTP server for sensibly strong ephemeral ECDH key exchange. tls_eecdh_ultra_curve (secp384r1) @@ -556,7 +562,7 @@ SMTPD(8) SMTPD(8) tls_preempt_cipherlist (no) With SSLv3 and later, use the Postfix SMTP server's cipher pref- - erence order instead of the remote client's cipher preference + erence order instead of the remote client's cipher preference order. tls_disable_workarounds (see 'postconf -d' output) @@ -569,7 +575,7 @@ SMTPD(8) SMTPD(8) Available in Postfix version 3.0 and later: - tls_session_ticket_cipher (Postfix >= 3.0: aes-256-cbc, Postfix < 3.0: + tls_session_ticket_cipher (Postfix >= 3.0: aes-256-cbc, Postfix < 3.0: aes-128-cbc) Algorithm used to encrypt RFC5077 TLS session tickets. @@ -582,33 +588,33 @@ SMTPD(8) SMTPD(8) Available in Postfix version 3.4 and later: smtpd_tls_chain_files (empty) - List of one or more PEM files, each holding one or more private + List of one or more PEM files, each holding one or more private keys directly followed by a corresponding certificate chain. tls_server_sni_maps (empty) - Optional lookup tables that map names received from remote SMTP - clients via the TLS Server Name Indication (SNI) extension to + Optional lookup tables that map names received from remote SMTP + clients via the TLS Server Name Indication (SNI) extension to the appropriate keys and certificate chains. Available in Postfix 3.5, 3.4.6, 3.3.5, 3.2.10, 3.1.13 and later: tls_fast_shutdown_enable (yes) - A workaround for implementations that hang Postfix while shut- + A workaround for implementations that hang Postfix while shut- ting down a TLS session, until Postfix times out. Available in Postfix 3.5 and later: info_log_address_format (external) - The email address form that will be used in non-debug logging + The email address form that will be used in non-debug logging (info, warning, etc.). OBSOLETE STARTTLS CONTROLS - The following configuration parameters exist for compatibility with - Postfix versions before 2.3. Support for these will be removed in a + The following configuration parameters exist for compatibility with + Postfix versions before 2.3. Support for these will be removed in a future release. smtpd_use_tls (no) - Opportunistic TLS: announce STARTTLS support to remote SMTP + Opportunistic TLS: announce STARTTLS support to remote SMTP clients, but do not require that clients use TLS encryption. smtpd_enforce_tls (no) @@ -616,94 +622,94 @@ SMTPD(8) SMTPD(8) and require that clients use TLS encryption. smtpd_tls_cipherlist (empty) - Obsolete Postfix < 2.3 control for the Postfix SMTP server TLS + Obsolete Postfix < 2.3 control for the Postfix SMTP server TLS cipher list. SMTPUTF8 CONTROLS Preliminary SMTPUTF8 support is introduced with Postfix 3.0. smtputf8_enable (yes) - Enable preliminary SMTPUTF8 support for the protocols described + Enable preliminary SMTPUTF8 support for the protocols described in RFC 6531..6533. strict_smtputf8 (no) Enable stricter enforcement of the SMTPUTF8 protocol. smtputf8_autodetect_classes (sendmail, verify) - Detect that a message requires SMTPUTF8 support for the speci- + Detect that a message requires SMTPUTF8 support for the speci- fied mail origin classes. Available in Postfix version 3.2 and later: enable_idna2003_compatibility (no) - Enable 'transitional' compatibility between IDNA2003 and - IDNA2008, when converting UTF-8 domain names to/from the ASCII + Enable 'transitional' compatibility between IDNA2003 and + IDNA2008, when converting UTF-8 domain names to/from the ASCII form that is used for DNS lookups. VERP SUPPORT CONTROLS - With VERP style delivery, each recipient of a message receives a cus- - tomized copy of the message with his/her own recipient address encoded + With VERP style delivery, each recipient of a message receives a cus- + tomized copy of the message with his/her own recipient address encoded in the envelope sender address. The VERP_README file describes config- - uration and operation details of Postfix support for variable envelope - return path addresses. VERP style delivery is requested with the SMTP - XVERP command or with the "sendmail -V" command-line option and is + uration and operation details of Postfix support for variable envelope + return path addresses. VERP style delivery is requested with the SMTP + XVERP command or with the "sendmail -V" command-line option and is available in Postfix version 1.1 and later. default_verp_delimiters (+=) The two default VERP delimiter characters. verp_delimiter_filter (-=+) - The characters Postfix accepts as VERP delimiter characters on + The characters Postfix accepts as VERP delimiter characters on the Postfix sendmail(1) command line and in SMTP commands. Available in Postfix version 1.1 and 2.0: authorized_verp_clients ($mynetworks) - What remote SMTP clients are allowed to specify the XVERP com- + What remote SMTP clients are allowed to specify the XVERP com- mand. Available in Postfix version 2.1 and later: smtpd_authorized_verp_clients ($authorized_verp_clients) - What remote SMTP clients are allowed to specify the XVERP com- + What remote SMTP clients are allowed to specify the XVERP com- mand. TROUBLE SHOOTING CONTROLS - The DEBUG_README document describes how to debug parts of the Postfix - mail system. The methods vary from making the software log a lot of + The DEBUG_README document describes how to debug parts of the Postfix + mail system. The methods vary from making the software log a lot of detail, to running some daemon processes under control of a call tracer or debugger. debug_peer_level (2) - The increment in verbose logging level when a nexthop destina- - tion, remote client or server name or network address matches a + The increment in verbose logging level when a nexthop destina- + tion, remote client or server name or network address matches a pattern given with the debug_peer_list parameter. debug_peer_list (empty) - Optional list of nexthop destination, remote client or server - name or network address patterns that, if matched, cause the - verbose logging level to increase by the amount specified in + Optional list of nexthop destination, remote client or server + name or network address patterns that, if matched, cause the + verbose logging level to increase by the amount specified in $debug_peer_level. error_notice_recipient (postmaster) - The recipient of postmaster notifications about mail delivery + The recipient of postmaster notifications about mail delivery problems that are caused by policy, resource, software or proto- col errors. internal_mail_filter_classes (empty) - What categories of Postfix-generated mail are subject to - before-queue content inspection by non_smtpd_milters, + What categories of Postfix-generated mail are subject to + before-queue content inspection by non_smtpd_milters, header_checks and body_checks. notify_classes (resource, software) The list of error classes that are reported to the postmaster. smtpd_reject_footer (empty) - Optional information that is appended after each Postfix SMTP + Optional information that is appended after each Postfix SMTP server 4XX or 5XX response. soft_bounce (no) - Safety net to keep mail queued that would otherwise be returned + Safety net to keep mail queued that would otherwise be returned to the sender. Available in Postfix version 2.1 and later: @@ -714,109 +720,109 @@ SMTPD(8) SMTPD(8) Available in Postfix version 2.10 and later: smtpd_log_access_permit_actions (empty) - Enable logging of the named "permit" actions in SMTP server - access lists (by default, the SMTP server logs "reject" actions + Enable logging of the named "permit" actions in SMTP server + access lists (by default, the SMTP server logs "reject" actions but not "permit" actions). KNOWN VERSUS UNKNOWN RECIPIENT CONTROLS - As of Postfix version 2.0, the SMTP server rejects mail for unknown + As of Postfix version 2.0, the SMTP server rejects mail for unknown recipients. This prevents the mail queue from clogging up with undeliv- - erable MAILER-DAEMON messages. Additional information on this topic is + erable MAILER-DAEMON messages. Additional information on this topic is in the LOCAL_RECIPIENT_README and ADDRESS_CLASS_README documents. show_user_unknown_table_name (yes) - Display the name of the recipient table in the "User unknown" + Display the name of the recipient table in the "User unknown" responses. canonical_maps (empty) - Optional address mapping lookup tables for message headers and + Optional address mapping lookup tables for message headers and envelopes. recipient_canonical_maps (empty) - Optional address mapping lookup tables for envelope and header + Optional address mapping lookup tables for envelope and header recipient addresses. sender_canonical_maps (empty) - Optional address mapping lookup tables for envelope and header + Optional address mapping lookup tables for envelope and header sender addresses. Parameters concerning known/unknown local recipients: mydestination ($myhostname, localhost.$mydomain, localhost) - The list of domains that are delivered via the $local_transport + The list of domains that are delivered via the $local_transport mail delivery transport. inet_interfaces (all) - The network interface addresses that this mail system receives + The network interface addresses that this mail system receives mail on. proxy_interfaces (empty) - The network interface addresses that this mail system receives + The network interface addresses that this mail system receives mail on by way of a proxy or network address translation unit. inet_protocols (all) - The Internet protocols Postfix will attempt to use when making + The Internet protocols Postfix will attempt to use when making or accepting connections. local_recipient_maps (proxy:unix:passwd.byname $alias_maps) Lookup tables with all names or addresses of local recipients: a - recipient address is local when its domain matches $mydestina- + recipient address is local when its domain matches $mydestina- tion, $inet_interfaces or $proxy_interfaces. unknown_local_recipient_reject_code (550) The numerical Postfix SMTP server response code when a recipient - address is local, and $local_recipient_maps specifies a list of + address is local, and $local_recipient_maps specifies a list of lookup tables that does not match the recipient. Parameters concerning known/unknown recipients of relay destinations: relay_domains (Postfix >= 3.0: empty, Postfix < 3.0: $mydestination) - What destination domains (and subdomains thereof) this system + What destination domains (and subdomains thereof) this system will relay mail to. relay_recipient_maps (empty) - Optional lookup tables with all valid addresses in the domains + Optional lookup tables with all valid addresses in the domains that match $relay_domains. unknown_relay_recipient_reject_code (550) - The numerical Postfix SMTP server reply code when a recipient - address matches $relay_domains, and relay_recipient_maps speci- - fies a list of lookup tables that does not match the recipient + The numerical Postfix SMTP server reply code when a recipient + address matches $relay_domains, and relay_recipient_maps speci- + fies a list of lookup tables that does not match the recipient address. - Parameters concerning known/unknown recipients in virtual alias + Parameters concerning known/unknown recipients in virtual alias domains: virtual_alias_domains ($virtual_alias_maps) - Postfix is final destination for the specified list of virtual - alias domains, that is, domains for which all addresses are + Postfix is final destination for the specified list of virtual + alias domains, that is, domains for which all addresses are aliased to addresses in other local or remote domains. virtual_alias_maps ($virtual_maps) - Optional lookup tables that alias specific mail addresses or + Optional lookup tables that alias specific mail addresses or domains to other local or remote address. unknown_virtual_alias_reject_code (550) - The Postfix SMTP server reply code when a recipient address - matches $virtual_alias_domains, and $virtual_alias_maps speci- - fies a list of lookup tables that does not match the recipient + The Postfix SMTP server reply code when a recipient address + matches $virtual_alias_domains, and $virtual_alias_maps speci- + fies a list of lookup tables that does not match the recipient address. Parameters concerning known/unknown recipients in virtual mailbox domains: virtual_mailbox_domains ($virtual_mailbox_maps) - Postfix is final destination for the specified list of domains; - mail is delivered via the $virtual_transport mail delivery + Postfix is final destination for the specified list of domains; + mail is delivered via the $virtual_transport mail delivery transport. virtual_mailbox_maps (empty) - Optional lookup tables with all valid addresses in the domains + Optional lookup tables with all valid addresses in the domains that match $virtual_mailbox_domains. unknown_virtual_mailbox_reject_code (550) - The Postfix SMTP server reply code when a recipient address - matches $virtual_mailbox_domains, and $virtual_mailbox_maps + The Postfix SMTP server reply code when a recipient address + matches $virtual_mailbox_domains, and $virtual_mailbox_maps specifies a list of lookup tables that does not match the recip- ient address. @@ -825,7 +831,7 @@ SMTPD(8) SMTPD(8) control client request rates. line_length_limit (2048) - Upon input, long lines are chopped up into pieces of at most + Upon input, long lines are chopped up into pieces of at most this length; upon delivery, long lines are reconstructed. queue_minfree (0) @@ -833,58 +839,58 @@ SMTPD(8) SMTPD(8) tem that is needed to receive mail. message_size_limit (10240000) - The maximal size in bytes of a message, including envelope + The maximal size in bytes of a message, including envelope information. smtpd_recipient_limit (1000) - The maximal number of recipients that the Postfix SMTP server + The maximal number of recipients that the Postfix SMTP server accepts per message delivery request. smtpd_timeout (normal: 300s, overload: 10s) - The time limit for sending a Postfix SMTP server response and + The time limit for sending a Postfix SMTP server response and for receiving a remote SMTP client request. smtpd_history_flush_threshold (100) - The maximal number of lines in the Postfix SMTP server command - history before it is flushed upon receipt of EHLO, RSET, or end + The maximal number of lines in the Postfix SMTP server command + history before it is flushed upon receipt of EHLO, RSET, or end of DATA. Available in Postfix version 2.3 and later: smtpd_peername_lookup (yes) - Attempt to look up the remote SMTP client hostname, and verify + Attempt to look up the remote SMTP client hostname, and verify that the name matches the client IP address. The per SMTP client connection count and request rate limits are imple- - mented in co-operation with the anvil(8) service, and are available in + mented in co-operation with the anvil(8) service, and are available in Postfix version 2.2 and later. smtpd_client_connection_count_limit (50) - How many simultaneous connections any client is allowed to make + How many simultaneous connections any client is allowed to make to this service. smtpd_client_connection_rate_limit (0) - The maximal number of connection attempts any client is allowed + The maximal number of connection attempts any client is allowed to make to this service per time unit. smtpd_client_message_rate_limit (0) - The maximal number of message delivery requests that any client - is allowed to make to this service per time unit, regardless of + The maximal number of message delivery requests that any client + is allowed to make to this service per time unit, regardless of whether or not Postfix actually accepts those messages. smtpd_client_recipient_rate_limit (0) - The maximal number of recipient addresses that any client is - allowed to send to this service per time unit, regardless of + The maximal number of recipient addresses that any client is + allowed to send to this service per time unit, regardless of whether or not Postfix actually accepts those recipients. smtpd_client_event_limit_exceptions ($mynetworks) - Clients that are excluded from smtpd_client_*_count/rate_limit + Clients that are excluded from smtpd_client_*_count/rate_limit restrictions. Available in Postfix version 2.3 and later: smtpd_client_new_tls_session_rate_limit (0) - The maximal number of new (i.e., uncached) TLS sessions that a + The maximal number of new (i.e., uncached) TLS sessions that a remote SMTP client is allowed to negotiate with this service per time unit. @@ -892,68 +898,68 @@ SMTPD(8) SMTPD(8) smtpd_per_record_deadline (normal: no, overload: yes) Change the behavior of the smtpd_timeout and smtpd_start- - tls_timeout time limits, from a time limit per read or write - system call, to a time limit to send or receive a complete - record (an SMTP command line, SMTP response line, SMTP message + tls_timeout time limits, from a time limit per read or write + system call, to a time limit to send or receive a complete + record (an SMTP command line, SMTP response line, SMTP message content line, or TLS protocol message). Available in Postfix version 3.1 and later: smtpd_client_auth_rate_limit (0) - The maximal number of AUTH commands that any client is allowed - to send to this service per time unit, regardless of whether or + The maximal number of AUTH commands that any client is allowed + to send to this service per time unit, regardless of whether or not Postfix actually accepts those commands. TARPIT CONTROLS - When a remote SMTP client makes errors, the Postfix SMTP server can - insert delays before responding. This can help to slow down run-away - software. The behavior is controlled by an error counter that counts + When a remote SMTP client makes errors, the Postfix SMTP server can + insert delays before responding. This can help to slow down run-away + software. The behavior is controlled by an error counter that counts the number of errors within an SMTP session that a client makes without delivering mail. smtpd_error_sleep_time (1s) - With Postfix version 2.1 and later: the SMTP server response - delay after a client has made more than $smtpd_soft_error_limit - errors, and fewer than $smtpd_hard_error_limit errors, without + With Postfix version 2.1 and later: the SMTP server response + delay after a client has made more than $smtpd_soft_error_limit + errors, and fewer than $smtpd_hard_error_limit errors, without delivering mail. smtpd_soft_error_limit (10) - The number of errors a remote SMTP client is allowed to make - without delivering mail before the Postfix SMTP server slows + The number of errors a remote SMTP client is allowed to make + without delivering mail before the Postfix SMTP server slows down all its responses. smtpd_hard_error_limit (normal: 20, overload: 1) - The maximal number of errors a remote SMTP client is allowed to + The maximal number of errors a remote SMTP client is allowed to make without delivering mail. smtpd_junk_command_limit (normal: 100, overload: 1) - The number of junk commands (NOOP, VRFY, ETRN or RSET) that a - remote SMTP client can send before the Postfix SMTP server + The number of junk commands (NOOP, VRFY, ETRN or RSET) that a + remote SMTP client can send before the Postfix SMTP server starts to increment the error counter with each junk command. Available in Postfix version 2.1 and later: smtpd_recipient_overshoot_limit (1000) - The number of recipients that a remote SMTP client can send in + The number of recipients that a remote SMTP client can send in excess of the limit specified with $smtpd_recipient_limit, - before the Postfix SMTP server increments the per-session error + before the Postfix SMTP server increments the per-session error count for each excess recipient. ACCESS POLICY DELEGATION CONTROLS - As of version 2.1, Postfix can be configured to delegate access policy - decisions to an external server that runs outside Postfix. See the + As of version 2.1, Postfix can be configured to delegate access policy + decisions to an external server that runs outside Postfix. See the file SMTPD_POLICY_README for more information. smtpd_policy_service_max_idle (300s) - The time after which an idle SMTPD policy service connection is + The time after which an idle SMTPD policy service connection is closed. smtpd_policy_service_max_ttl (1000s) - The time after which an active SMTPD policy service connection + The time after which an active SMTPD policy service connection is closed. smtpd_policy_service_timeout (100s) - The time limit for connecting to, writing to, or receiving from + The time limit for connecting to, writing to, or receiving from a delegated SMTPD policy server. Available in Postfix version 3.0 and later: @@ -963,81 +969,81 @@ SMTPD(8) SMTPD(8) The default action when an SMTPD policy service request fails. smtpd_policy_service_request_limit (0) - The maximal number of requests per SMTPD policy service connec- + The maximal number of requests per SMTPD policy service connec- tion, or zero (no limit). smtpd_policy_service_try_limit (2) - The maximal number of attempts to send an SMTPD policy service + The maximal number of attempts to send an SMTPD policy service request before giving up. smtpd_policy_service_retry_delay (1s) - The delay between attempts to resend a failed SMTPD policy ser- + The delay between attempts to resend a failed SMTPD policy ser- vice request. Available in Postfix version 3.1 and later: smtpd_policy_service_policy_context (empty) - Optional information that the Postfix SMTP server specifies in - the "policy_context" attribute of a policy service request - (originally, to share the same service endpoint among multiple + Optional information that the Postfix SMTP server specifies in + the "policy_context" attribute of a policy service request + (originally, to share the same service endpoint among multiple check_policy_service clients). ACCESS CONTROLS - The SMTPD_ACCESS_README document gives an introduction to all the SMTP + The SMTPD_ACCESS_README document gives an introduction to all the SMTP server access control features. smtpd_delay_reject (yes) - Wait until the RCPT TO command before evaluating + Wait until the RCPT TO command before evaluating $smtpd_client_restrictions, $smtpd_helo_restrictions and $smtpd_sender_restrictions, or wait until the ETRN command - before evaluating $smtpd_client_restrictions and + before evaluating $smtpd_client_restrictions and $smtpd_helo_restrictions. parent_domain_matches_subdomains (see 'postconf -d' output) - A list of Postfix features where the pattern "example.com" also - matches subdomains of example.com, instead of requiring an + A list of Postfix features where the pattern "example.com" also + matches subdomains of example.com, instead of requiring an explicit ".example.com" pattern. smtpd_client_restrictions (empty) - Optional restrictions that the Postfix SMTP server applies in + Optional restrictions that the Postfix SMTP server applies in the context of a client connection request. smtpd_helo_required (no) - Require that a remote SMTP client introduces itself with the - HELO or EHLO command before sending the MAIL command or other + Require that a remote SMTP client introduces itself with the + HELO or EHLO command before sending the MAIL command or other commands that require EHLO negotiation. smtpd_helo_restrictions (empty) - Optional restrictions that the Postfix SMTP server applies in + Optional restrictions that the Postfix SMTP server applies in the context of a client HELO command. smtpd_sender_restrictions (empty) - Optional restrictions that the Postfix SMTP server applies in + Optional restrictions that the Postfix SMTP server applies in the context of a client MAIL FROM command. smtpd_recipient_restrictions (see 'postconf -d' output) - Optional restrictions that the Postfix SMTP server applies in - the context of a client RCPT TO command, after + Optional restrictions that the Postfix SMTP server applies in + the context of a client RCPT TO command, after smtpd_relay_restrictions. smtpd_etrn_restrictions (empty) - Optional restrictions that the Postfix SMTP server applies in + Optional restrictions that the Postfix SMTP server applies in the context of a client ETRN command. allow_untrusted_routing (no) - Forward mail with sender-specified routing - (user[@%!]remote[@%!]site) from untrusted clients to destina- + Forward mail with sender-specified routing + (user[@%!]remote[@%!]site) from untrusted clients to destina- tions matching $relay_domains. smtpd_restriction_classes (empty) User-defined aliases for groups of access restrictions. smtpd_null_access_lookup_key (<>) - The lookup key to be used in SMTP access(5) tables instead of + The lookup key to be used in SMTP access(5) tables instead of the null sender address. permit_mx_backup_networks (empty) - Restrict the use of the permit_mx_backup SMTP access feature to + Restrict the use of the permit_mx_backup SMTP access feature to only domains whose primary MX hosts match the listed networks. Available in Postfix version 2.0 and later: @@ -1047,19 +1053,19 @@ SMTPD(8) SMTPD(8) applies in the context of the SMTP DATA command. smtpd_expansion_filter (see 'postconf -d' output) - What characters are allowed in $name expansions of RBL reply + What characters are allowed in $name expansions of RBL reply templates. Available in Postfix version 2.1 and later: smtpd_reject_unlisted_sender (no) - Request that the Postfix SMTP server rejects mail from unknown - sender addresses, even when no explicit reject_unlisted_sender + Request that the Postfix SMTP server rejects mail from unknown + sender addresses, even when no explicit reject_unlisted_sender access restriction is specified. smtpd_reject_unlisted_recipient (yes) - Request that the Postfix SMTP server rejects mail for unknown - recipient addresses, even when no explicit + Request that the Postfix SMTP server rejects mail for unknown + recipient addresses, even when no explicit reject_unlisted_recipient access restriction is specified. Available in Postfix version 2.2 and later: @@ -1073,17 +1079,17 @@ SMTPD(8) SMTPD(8) smtpd_relay_restrictions (permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination) Access restrictions for mail relay control that the Postfix SMTP - server applies in the context of the RCPT TO command, before + server applies in the context of the RCPT TO command, before smtpd_recipient_restrictions. SENDER AND RECIPIENT ADDRESS VERIFICATION CONTROLS - Postfix version 2.1 introduces sender and recipient address verifica- + Postfix version 2.1 introduces sender and recipient address verifica- tion. This feature is implemented by sending probe email messages that are not actually delivered. This feature is requested via the - reject_unverified_sender and reject_unverified_recipient access - restrictions. The status of verification probes is maintained by the - verify(8) server. See the file ADDRESS_VERIFICATION_README for infor- - mation about how to configure and operate the Postfix sender/recipient + reject_unverified_sender and reject_unverified_recipient access + restrictions. The status of verification probes is maintained by the + verify(8) server. See the file ADDRESS_VERIFICATION_README for infor- + mation about how to configure and operate the Postfix sender/recipient address verification service. address_verify_poll_count (normal: 3, overload: 1) @@ -1095,7 +1101,7 @@ SMTPD(8) SMTPD(8) fication request in progress. address_verify_sender ($double_bounce_sender) - The sender address to use in address verification probes; prior + The sender address to use in address verification probes; prior to Postfix 2.5 the default was "postmaster". unverified_sender_reject_code (450) @@ -1103,18 +1109,18 @@ SMTPD(8) SMTPD(8) address is rejected by the reject_unverified_sender restriction. unverified_recipient_reject_code (450) - The numerical Postfix SMTP server response when a recipient - address is rejected by the reject_unverified_recipient restric- + The numerical Postfix SMTP server response when a recipient + address is rejected by the reject_unverified_recipient restric- tion. Available in Postfix version 2.6 and later: unverified_sender_defer_code (450) - The numerical Postfix SMTP server response code when a sender + The numerical Postfix SMTP server response code when a sender address probe fails due to a temporary error condition. unverified_recipient_defer_code (450) - The numerical Postfix SMTP server response when a recipient + The numerical Postfix SMTP server response when a recipient address probe fails due to a temporary error condition. unverified_sender_reject_reason (empty) @@ -1126,17 +1132,17 @@ SMTPD(8) SMTPD(8) reject_unverified_recipient. unverified_sender_tempfail_action ($reject_tempfail_action) - The Postfix SMTP server's action when reject_unverified_sender + The Postfix SMTP server's action when reject_unverified_sender fails due to a temporary error condition. unverified_recipient_tempfail_action ($reject_tempfail_action) - The Postfix SMTP server's action when reject_unverified_recipi- + The Postfix SMTP server's action when reject_unverified_recipi- ent fails due to a temporary error condition. Available with Postfix 2.9 and later: address_verify_sender_ttl (0s) - The time between changes in the time-dependent portion of + The time between changes in the time-dependent portion of address verification probe sender addresses. ACCESS CONTROL RESPONSES @@ -1148,36 +1154,36 @@ SMTPD(8) SMTPD(8) map "reject" action. defer_code (450) - The numerical Postfix SMTP server response code when a remote + The numerical Postfix SMTP server response code when a remote SMTP client request is rejected by the "defer" restriction. invalid_hostname_reject_code (501) - The numerical Postfix SMTP server response code when the client - HELO or EHLO command parameter is rejected by the + The numerical Postfix SMTP server response code when the client + HELO or EHLO command parameter is rejected by the reject_invalid_helo_hostname restriction. maps_rbl_reject_code (554) - The numerical Postfix SMTP server response code when a remote - SMTP client request is blocked by the reject_rbl_client, + The numerical Postfix SMTP server response code when a remote + SMTP client request is blocked by the reject_rbl_client, reject_rhsbl_client, reject_rhsbl_reverse_client, reject_rhsbl_sender or reject_rhsbl_recipient restriction. non_fqdn_reject_code (504) - The numerical Postfix SMTP server reply code when a client - request is rejected by the reject_non_fqdn_helo_hostname, + The numerical Postfix SMTP server reply code when a client + request is rejected by the reject_non_fqdn_helo_hostname, reject_non_fqdn_sender or reject_non_fqdn_recipient restriction. plaintext_reject_code (450) - The numerical Postfix SMTP server response code when a request + The numerical Postfix SMTP server response code when a request is rejected by the reject_plaintext_session restriction. reject_code (554) - The numerical Postfix SMTP server response code when a remote + The numerical Postfix SMTP server response code when a remote SMTP client request is rejected by the "reject" restriction. relay_domains_reject_code (554) - The numerical Postfix SMTP server response code when a client - request is rejected by the reject_unauth_destination recipient + The numerical Postfix SMTP server response code when a client + request is rejected by the reject_unauth_destination recipient restriction. unknown_address_reject_code (450) @@ -1185,24 +1191,24 @@ SMTPD(8) SMTPD(8) a sender or recipient address because its domain is unknown. unknown_client_reject_code (450) - The numerical Postfix SMTP server response code when a client - without valid address <=> name mapping is rejected by the + The numerical Postfix SMTP server response code when a client + without valid address <=> name mapping is rejected by the reject_unknown_client_hostname restriction. unknown_hostname_reject_code (450) - The numerical Postfix SMTP server response code when the host- - name specified with the HELO or EHLO command is rejected by the + The numerical Postfix SMTP server response code when the host- + name specified with the HELO or EHLO command is rejected by the reject_unknown_helo_hostname restriction. Available in Postfix version 2.0 and later: default_rbl_reply (see 'postconf -d' output) - The default Postfix SMTP server response template for a request + The default Postfix SMTP server response template for a request that is rejected by an RBL-based restriction. multi_recipient_bounce_reject_code (550) - The numerical Postfix SMTP server response code when a remote - SMTP client request is blocked by the reject_multi_recipi- + The numerical Postfix SMTP server response code when a remote + SMTP client request is blocked by the reject_multi_recipi- ent_bounce restriction. rbl_reply_maps (empty) @@ -1212,52 +1218,52 @@ SMTPD(8) SMTPD(8) access_map_defer_code (450) The numerical Postfix SMTP server response code for an access(5) - map "defer" action, including "defer_if_permit" or + map "defer" action, including "defer_if_permit" or "defer_if_reject". reject_tempfail_action (defer_if_permit) - The Postfix SMTP server's action when a reject-type restriction + The Postfix SMTP server's action when a reject-type restriction fails due to a temporary error condition. unknown_helo_hostname_tempfail_action ($reject_tempfail_action) - The Postfix SMTP server's action when reject_unknown_helo_host- + The Postfix SMTP server's action when reject_unknown_helo_host- name fails due to a temporary error condition. unknown_address_tempfail_action ($reject_tempfail_action) - The Postfix SMTP server's action when - reject_unknown_sender_domain or reject_unknown_recipient_domain + The Postfix SMTP server's action when + reject_unknown_sender_domain or reject_unknown_recipient_domain fail due to a temporary error condition. MISCELLANEOUS CONTROLS config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and master.cf con- + The default location of the Postfix main.cf and master.cf con- figuration files. daemon_timeout (18000s) - How much time a Postfix daemon process may take to handle a + How much time a Postfix daemon process may take to handle a request before it is terminated by a built-in watchdog timer. command_directory (see 'postconf -d' output) The location of all postfix administrative commands. double_bounce_sender (double-bounce) - The sender address of postmaster notifications that are gener- + The sender address of postmaster notifications that are gener- ated by the mail system. ipc_timeout (3600s) - The time limit for sending or receiving information over an + The time limit for sending or receiving information over an internal communication channel. mail_name (Postfix) - The mail system name that is displayed in Received: headers, in + The mail system name that is displayed in Received: headers, in the SMTP greeting banner, and in bounced mail. mail_owner (postfix) - The UNIX system account that owns the Postfix queue and most + The UNIX system account that owns the Postfix queue and most Postfix daemon processes. max_idle (100s) - The maximum amount of time that an idle Postfix daemon process + The maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily. max_use (100) @@ -1268,11 +1274,11 @@ SMTPD(8) SMTPD(8) The internet hostname of this mail system. mynetworks (see 'postconf -d' output) - The list of "trusted" remote SMTP clients that have more privi- + The list of "trusted" remote SMTP clients that have more privi- leges than "strangers". myorigin ($myhostname) - The domain name that locally-posted mail appears to come from, + The domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to. process_id (read-only) @@ -1285,25 +1291,25 @@ SMTPD(8) SMTPD(8) The location of the Postfix top-level queue directory. recipient_delimiter (empty) - The set of characters that can separate a user name from its - extension (example: user+foo), or a .forward file name from its + The set of characters that can separate a user name from its + extension (example: user+foo), or a .forward file name from its extension (example: .forward+foo). smtpd_banner ($myhostname ESMTP $mail_name) - The text that follows the 220 status code in the SMTP greeting + The text that follows the 220 status code in the SMTP greeting banner. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (see 'postconf -d' output) - A prefix that is prepended to the process name in syslog + A prefix that is prepended to the process name in syslog records, so that, for example, "smtpd" becomes "prefix/smtpd". Available in Postfix version 2.2 and later: smtpd_forbidden_commands (CONNECT, GET, POST) - List of commands that cause the Postfix SMTP server to immedi- + List of commands that cause the Postfix SMTP server to immedi- ately terminate the session with a 221 code. Available in Postfix version 2.5 and later: @@ -1320,7 +1326,7 @@ SMTPD(8) SMTPD(8) Available in Postfix 3.4 and later: smtpd_reject_footer_maps (empty) - Lookup tables, indexed by the complete Postfix SMTP server 4xx + Lookup tables, indexed by the complete Postfix SMTP server 4xx or 5xx response, with reject footer templates. SEE ALSO diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index fa078b88a..95ea21483 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -11178,6 +11178,30 @@ smtpd_sasl_local_domain = $myhostname .fi .ad .ft R +.SH smtpd_sasl_mechanism_filter (default: !external, static:rest) +If non\-empty, a filter for the SASL mechanism names that the +Postfix SMTP server will announce in the EHLO response. By default, +the Postfix SMTP server will not announce the EXTERNAL mechanism, +because Postfix support for that is not implemented. +.PP +Specify mechanism names, "/file/name" patterns, or "type:table" +lookup tables, separated by comma or whitespace. The right\-hand +side result from "type:table" lookups is ignored. Specify "!pattern" +to exclude a mechanism name from the list. +.PP +Examples: +.PP +.nf +.na +.ft C +smtpd_sasl_mechanism_filter = !external, !gssapi, static:rest +smtpd_sasl_mechanism_filter = login, plain +smtpd_sasl_mechanism_filter = /etc/postfix/smtpd_mechs +.fi +.ad +.ft R +.PP +This feature is available in Postfix 3.6 and later. .SH smtpd_sasl_path (default: smtpd) Implementation\-specific information that the Postfix SMTP server passes through to diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index 868621847..299bf33da 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -377,6 +377,11 @@ selected with \fBsmtpd_sasl_type\fR and \fBsmtpd_sasl_path\fR. Available in Postfix version 3.4 and later: .IP "\fBsmtpd_sasl_response_limit (12288)\fR" The maximum length of a SASL client's response to a server challenge. +.PP +Available in Postfix 3.6 and later: +.IP "\fBsmtpd_sasl_mechanism_filter (!external, static:rest)\fR" +If non\-empty, a filter for the SASL mechanism names that the +Postfix SMTP server will announce in the EHLO response. .SH "STARTTLS SUPPORT CONTROLS" .na .nf diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index 46f187e91..b87e1eb80 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -700,6 +700,7 @@ while (<>) { s;\bsmtpd_enforce_tls\b;$&;g; s;\bsmtpd_sasl_tls_security_options\b;$&;g; s;\bsmtpd_sasl_type\b;$&;g; + s;\bsmtpd_sasl_mechanism_filter\b;$&;g; s;\bsmtpd_start[-]*\n* *[]*tls_timeout\b;$&;g; s;\bsmtpd_tls_CAfile\b;$&;g; s;\bsmtpd_tls_CApath\b;$&;g; diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 7d9accaf2..d317f43de 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -17818,3 +17818,27 @@ with quotes and backslashes. An attacker should not be able to use such games to circumvent Postfix access policies.

This feature is available in Postfix 3.5 and later.

+ +%PARAM smtpd_sasl_mechanism_filter !external, static:rest + +

If non-empty, a filter for the SASL mechanism names that the +Postfix SMTP server will announce in the EHLO response. By default, +the Postfix SMTP server will not announce the EXTERNAL mechanism, +because Postfix support for that is not implemented.

+ +

Specify mechanism names, "/file/name" patterns, or "type:table" +lookup tables, separated by comma or whitespace. The right-hand +side result from "type:table" lookups is ignored. Specify "!pattern" +to exclude a mechanism name from the list.

+ +

+Examples: +

+ +
+smtpd_sasl_mechanism_filter = !external, !gssapi, static:rest
+smtpd_sasl_mechanism_filter = login, plain
+smtpd_sasl_mechanism_filter = /etc/postfix/smtpd_mechs
+
+ +

This feature is available in Postfix 3.6 and later.

diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index 7984512d0..44bb046fd 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -36,7 +36,7 @@ SRCS = abounce.c anvil_clnt.c been_here.c bounce.c bounce_log.c \ smtputf8.c mail_conf_over.c mail_parm_split.c midna_adomain.c \ mail_addr_form.c quote_flags.c maillog_client.c \ normalize_mailhost_addr.c map_search.c reject_deliver_request.c \ - info_log_addr_form.c + info_log_addr_form.c sasl_mech_filter.c OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \ canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \ clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \ @@ -74,7 +74,7 @@ OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \ smtputf8.o attr_override.o mail_parm_split.o midna_adomain.o \ $(NON_PLUGIN_MAP_OBJ) mail_addr_form.o quote_flags.o maillog_client.o \ normalize_mailhost_addr.o map_search.o reject_deliver_request.o \ - info_log_addr_form.o + info_log_addr_form.o sasl_mech_filter.o # MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf. # When hard-linking these maps, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ), # otherwise it sets the PLUGIN_* macros. @@ -109,7 +109,7 @@ HDRS = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \ haproxy_srvr.h dsn_filter.h dynamicmaps.h uxtext.h smtputf8.h \ attr_override.h mail_parm_split.h midna_adomain.h mail_addr_form.h \ maillog_client.h normalize_mailhost_addr.h map_search.h \ - info_log_addr_form.h + info_log_addr_form.h sasl_mech_filter.h TESTSRC = rec2stream.c stream2rec.c recdump.c DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) CFLAGS = $(DEBUG) $(OPT) $(DEFS) @@ -2574,6 +2574,18 @@ safe_ultostr.o: ../../include/vbuf.h safe_ultostr.o: ../../include/vstring.h safe_ultostr.o: safe_ultostr.c safe_ultostr.o: safe_ultostr.h +sasl_mech_filter.o: ../../include/argv.h +sasl_mech_filter.o: ../../include/check_arg.h +sasl_mech_filter.o: ../../include/match_list.h +sasl_mech_filter.o: ../../include/msg.h +sasl_mech_filter.o: ../../include/mymalloc.h +sasl_mech_filter.o: ../../include/stringops.h +sasl_mech_filter.o: ../../include/sys_defs.h +sasl_mech_filter.o: ../../include/vbuf.h +sasl_mech_filter.o: ../../include/vstring.h +sasl_mech_filter.o: sasl_mech_filter.c +sasl_mech_filter.o: sasl_mech_filter.h +sasl_mech_filter.o: string_list.h scache.o: ../../include/argv.h scache.o: ../../include/check_arg.h scache.o: ../../include/events.h diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 21e2fd981..2578c7af1 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -1699,6 +1699,15 @@ extern char *var_smtpd_snd_auth_maps; #define DEF_SMTPD_SASL_RESP_LIMIT 12288 extern int var_smtpd_sasl_resp_limit; + /* + * Some backends claim to support EXTERNAL authentication, but Postfix does + * not have code to provide the backend with such credentials. To avoid + * confusing errors, do not announce the EXTERNAL mechanism. + */ +#define VAR_SMTPD_SASL_MECH_FILTER "smtpd_sasl_mechanism_filter" +#define DEF_SMTPD_SASL_MECH_FILTER "!external, static:rest" +extern char *var_smtpd_sasl_mech_filter; + /* * SASL authentication support, SMTP client side. */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index d6e18fd13..6605b5043 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 "20200829" +#define MAIL_RELEASE_DATE "20200830" #define MAIL_VERSION_NUMBER "3.6" #ifdef SNAPSHOT diff --git a/postfix/src/global/sasl_mech_filter.c b/postfix/src/global/sasl_mech_filter.c new file mode 100644 index 000000000..b67c3051e --- /dev/null +++ b/postfix/src/global/sasl_mech_filter.c @@ -0,0 +1,113 @@ +/*++ +/* NAME +/* sasl_mech_filter 3 +/* SUMMARY +/* Filter SASL mechanism names +/* SYNOPSIS +/* #include sasl_mech_filter.h +/* +/* const char *sasl_mech_filter( +/* STRING_LIST *filter, +/* const char *words) +/* DESCRIPTION +/* sasl_mech_filter() applies the specified filter to a list +/* of SASL mechanism names. The filter is case-insensitive, +/* but preserves the case of input words. +/* +/* Arguments: +/* .IP filter +/* Null pointer or filter specification. If this is a nulll +/* pointer, no filter will be applied. +/* .IP words +/* List of SASL authentication mechanisms (separated by blanks). +/* If the string is empty, the filter will not be applied. +/* DIAGNOSTICS +/* Fatal errors: memory allocation, table lookup error. +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Original author: +/* Till Franke +/* SuSE Rhein/Main AG +/* 65760 Eschborn, Germany +/* +/* Adopted by: +/* Wietse Venema +/* IBM T.J. Watson Research +/* P.O. Box 704 +/* Yorktown Heights, NY 10598, USA +/* +/* Wietse Venema +/* Google, Inc. +/* 111 8th Avenue +/* New York, NY 10011, USA +/*--*/ + +/* System library. */ + +#include +#include +#ifdef STRCASECMP_IN_STRINGS_H +#include +#endif + +/* Utility library. */ + +#include +#include +#include + +/* Global library. */ + +#include + +#ifdef USE_SASL_AUTH + +/* sasl_mech_filter - filter a SASL mechanism list */ + +const char *sasl_mech_filter(STRING_LIST *filter, + const const char *words) +{ + const char myname[] = "sasl_mech_filter"; + static VSTRING *buf; + char *mech_list; + char *save_mech; + char *mech; + + /* + * NOOP if there is no filter, or if the mechanism list is empty. + */ + if (filter == 0 || *words == 0) + return (words); + + if (buf == 0) + buf = vstring_alloc(10); + + VSTRING_RESET(buf); + VSTRING_TERMINATE(buf); + + save_mech = mech_list = mystrdup(words); + + while ((mech = mystrtok(&mech_list, " \t")) != 0) { + if (string_list_match(filter, mech)) { + if (VSTRING_LEN(buf) > 0) + VSTRING_ADDCH(buf, ' '); + vstring_strcat(buf, mech); + if (msg_verbose) + msg_info("%s: keep SASL mechanism: '%s'", myname, mech); + } else if (filter->error) { + msg_fatal("%s: SASL mechanism filter failed for: '%s'", + myname, mech); + } else { + if (msg_verbose) + msg_info("%s: drop SASL mechanism: '%s'", myname, mech); + } + } + myfree(save_mech); + + return (vstring_str(buf)); +} + +#endif diff --git a/postfix/src/global/sasl_mech_filter.h b/postfix/src/global/sasl_mech_filter.h new file mode 100644 index 000000000..29f9bfea5 --- /dev/null +++ b/postfix/src/global/sasl_mech_filter.h @@ -0,0 +1,35 @@ +#ifndef _SASL_MECH_FILTER_H_INCLUDED_ +#define _SASL_MECH_FILTER_H_INCLUDED_ + +/*++ +/* NAME +/* sasl_mech_filter 3h +/* SUMMARY +/* string array utilities +/* SYNOPSIS +/* #include "sasl_mech_filter.h" +/* DESCRIPTION +/* .nf + + /* + * Utility library. + */ +#include + + /* + * External interface. + */ +extern const char *sasl_mech_filter(STRING_LIST *, const char *); + +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Wietse Venema +/* Google, Inc. +/* 111 8th Avenue +/* New York, NY 10011, USA +/*--*/ + +#endif diff --git a/postfix/src/smtp/Makefile.in b/postfix/src/smtp/Makefile.in index 30d028011..dae3d9b28 100644 --- a/postfix/src/smtp/Makefile.in +++ b/postfix/src/smtp/Makefile.in @@ -658,6 +658,7 @@ smtp_sasl_proto.o: ../../include/name_mask.h smtp_sasl_proto.o: ../../include/nvtable.h smtp_sasl_proto.o: ../../include/recipient_list.h smtp_sasl_proto.o: ../../include/resolve_clnt.h +smtp_sasl_proto.o: ../../include/sasl_mech_filter.h smtp_sasl_proto.o: ../../include/scache.h smtp_sasl_proto.o: ../../include/sock_addr.h smtp_sasl_proto.o: ../../include/string_list.h diff --git a/postfix/src/smtp/smtp_sasl_proto.c b/postfix/src/smtp/smtp_sasl_proto.c index c49e85cab..30ae9eca6 100644 --- a/postfix/src/smtp/smtp_sasl_proto.c +++ b/postfix/src/smtp/smtp_sasl_proto.c @@ -47,6 +47,11 @@ /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA +/* +/* Wietse Venema +/* Google, Inc. +/* 111 8th Avenue +/* New York, NY 10011, USA /*--*/ /* System library. */ @@ -66,6 +71,7 @@ /* Global library. */ #include +#include /* Application-specific. */ @@ -74,46 +80,11 @@ #ifdef USE_SASL_AUTH -/* smtp_sasl_compat_mechs - Trim server's mechanism list */ - -static const char *smtp_sasl_compat_mechs(const char *words) -{ - static VSTRING *buf; - char *mech_list; - char *save_mech; - char *mech; - - /* - * Use server's mechanisms if no filter specified - */ - if (smtp_sasl_mechs == 0 || *words == 0) - return (words); - - if (buf == 0) - buf = vstring_alloc(10); - - VSTRING_RESET(buf); - VSTRING_TERMINATE(buf); - - save_mech = mech_list = mystrdup(words); - - while ((mech = mystrtok(&mech_list, " \t")) != 0) { - if (string_list_match(smtp_sasl_mechs, mech)) { - if (VSTRING_LEN(buf) > 0) - VSTRING_ADDCH(buf, ' '); - vstring_strcat(buf, mech); - } - } - myfree(save_mech); - - return (vstring_str(buf)); -} - /* smtp_sasl_helo_auth - handle AUTH option in EHLO reply */ void smtp_sasl_helo_auth(SMTP_SESSION *session, const char *words) { - const char *mech_list = smtp_sasl_compat_mechs(words); + const char *mech_list = sasl_mech_filter(smtp_sasl_mechs, words); char *junk; /* diff --git a/postfix/src/smtpd/Makefile.in b/postfix/src/smtpd/Makefile.in index 009f5bd17..e4d23b7a6 100644 --- a/postfix/src/smtpd/Makefile.in +++ b/postfix/src/smtpd/Makefile.in @@ -280,6 +280,7 @@ smtpd_chat.o: ../../include/mail_params.h smtpd_chat.o: ../../include/mail_proto.h smtpd_chat.o: ../../include/mail_stream.h smtpd_chat.o: ../../include/maps.h +smtpd_chat.o: ../../include/match_list.h smtpd_chat.o: ../../include/milter.h smtpd_chat.o: ../../include/msg.h smtpd_chat.o: ../../include/myaddrinfo.h @@ -295,6 +296,7 @@ smtpd_chat.o: ../../include/smtp_reply_footer.h smtpd_chat.o: ../../include/smtp_stream.h smtpd_chat.o: ../../include/smtputf8.h smtpd_chat.o: ../../include/sock_addr.h +smtpd_chat.o: ../../include/string_list.h smtpd_chat.o: ../../include/stringops.h smtpd_chat.o: ../../include/sys_defs.h smtpd_chat.o: ../../include/tls.h @@ -398,6 +400,7 @@ smtpd_expand.o: ../../include/mac_parse.h smtpd_expand.o: ../../include/mail_params.h smtpd_expand.o: ../../include/mail_proto.h smtpd_expand.o: ../../include/mail_stream.h +smtpd_expand.o: ../../include/match_list.h smtpd_expand.o: ../../include/milter.h smtpd_expand.o: ../../include/msg.h smtpd_expand.o: ../../include/myaddrinfo.h @@ -406,6 +409,7 @@ smtpd_expand.o: ../../include/name_code.h smtpd_expand.o: ../../include/name_mask.h smtpd_expand.o: ../../include/nvtable.h smtpd_expand.o: ../../include/sock_addr.h +smtpd_expand.o: ../../include/string_list.h smtpd_expand.o: ../../include/stringops.h smtpd_expand.o: ../../include/sys_defs.h smtpd_expand.o: ../../include/tls.h @@ -424,6 +428,7 @@ smtpd_haproxy.o: ../../include/htable.h smtpd_haproxy.o: ../../include/iostuff.h smtpd_haproxy.o: ../../include/mail_params.h smtpd_haproxy.o: ../../include/mail_stream.h +smtpd_haproxy.o: ../../include/match_list.h smtpd_haproxy.o: ../../include/milter.h smtpd_haproxy.o: ../../include/msg.h smtpd_haproxy.o: ../../include/myaddrinfo.h @@ -433,6 +438,7 @@ smtpd_haproxy.o: ../../include/name_mask.h smtpd_haproxy.o: ../../include/nvtable.h smtpd_haproxy.o: ../../include/smtp_stream.h smtpd_haproxy.o: ../../include/sock_addr.h +smtpd_haproxy.o: ../../include/string_list.h smtpd_haproxy.o: ../../include/stringops.h smtpd_haproxy.o: ../../include/sys_defs.h smtpd_haproxy.o: ../../include/tls.h @@ -450,6 +456,7 @@ smtpd_milter.o: ../../include/dns.h smtpd_milter.o: ../../include/htable.h smtpd_milter.o: ../../include/mail_params.h smtpd_milter.o: ../../include/mail_stream.h +smtpd_milter.o: ../../include/match_list.h smtpd_milter.o: ../../include/milter.h smtpd_milter.o: ../../include/myaddrinfo.h smtpd_milter.o: ../../include/mymalloc.h @@ -461,6 +468,7 @@ smtpd_milter.o: ../../include/quote_flags.h smtpd_milter.o: ../../include/resolve_clnt.h smtpd_milter.o: ../../include/sock_addr.h smtpd_milter.o: ../../include/split_at.h +smtpd_milter.o: ../../include/string_list.h smtpd_milter.o: ../../include/stringops.h smtpd_milter.o: ../../include/sys_defs.h smtpd_milter.o: ../../include/tls.h @@ -483,6 +491,7 @@ smtpd_peer.o: ../../include/iostuff.h smtpd_peer.o: ../../include/mail_params.h smtpd_peer.o: ../../include/mail_proto.h smtpd_peer.o: ../../include/mail_stream.h +smtpd_peer.o: ../../include/match_list.h smtpd_peer.o: ../../include/milter.h smtpd_peer.o: ../../include/msg.h smtpd_peer.o: ../../include/myaddrinfo.h @@ -492,6 +501,7 @@ smtpd_peer.o: ../../include/name_mask.h smtpd_peer.o: ../../include/nvtable.h smtpd_peer.o: ../../include/sock_addr.h smtpd_peer.o: ../../include/split_at.h +smtpd_peer.o: ../../include/string_list.h smtpd_peer.o: ../../include/stringops.h smtpd_peer.o: ../../include/sys_defs.h smtpd_peer.o: ../../include/tls.h @@ -515,6 +525,7 @@ smtpd_proxy.o: ../../include/mail_params.h smtpd_proxy.o: ../../include/mail_proto.h smtpd_proxy.o: ../../include/mail_queue.h smtpd_proxy.o: ../../include/mail_stream.h +smtpd_proxy.o: ../../include/match_list.h smtpd_proxy.o: ../../include/milter.h smtpd_proxy.o: ../../include/msg.h smtpd_proxy.o: ../../include/myaddrinfo.h @@ -526,6 +537,7 @@ smtpd_proxy.o: ../../include/rec_type.h smtpd_proxy.o: ../../include/record.h smtpd_proxy.o: ../../include/smtp_stream.h smtpd_proxy.o: ../../include/sock_addr.h +smtpd_proxy.o: ../../include/string_list.h smtpd_proxy.o: ../../include/stringops.h smtpd_proxy.o: ../../include/sys_defs.h smtpd_proxy.o: ../../include/tls.h @@ -562,6 +574,7 @@ smtpd_sasl_glue.o: ../../include/dns.h smtpd_sasl_glue.o: ../../include/htable.h smtpd_sasl_glue.o: ../../include/mail_params.h smtpd_sasl_glue.o: ../../include/mail_stream.h +smtpd_sasl_glue.o: ../../include/match_list.h smtpd_sasl_glue.o: ../../include/milter.h smtpd_sasl_glue.o: ../../include/msg.h smtpd_sasl_glue.o: ../../include/myaddrinfo.h @@ -569,7 +582,9 @@ smtpd_sasl_glue.o: ../../include/mymalloc.h smtpd_sasl_glue.o: ../../include/name_code.h smtpd_sasl_glue.o: ../../include/name_mask.h smtpd_sasl_glue.o: ../../include/nvtable.h +smtpd_sasl_glue.o: ../../include/sasl_mech_filter.h smtpd_sasl_glue.o: ../../include/sock_addr.h +smtpd_sasl_glue.o: ../../include/string_list.h smtpd_sasl_glue.o: ../../include/stringops.h smtpd_sasl_glue.o: ../../include/sys_defs.h smtpd_sasl_glue.o: ../../include/tls.h @@ -592,6 +607,7 @@ smtpd_sasl_proto.o: ../../include/mail_error.h smtpd_sasl_proto.o: ../../include/mail_params.h smtpd_sasl_proto.o: ../../include/mail_proto.h smtpd_sasl_proto.o: ../../include/mail_stream.h +smtpd_sasl_proto.o: ../../include/match_list.h smtpd_sasl_proto.o: ../../include/milter.h smtpd_sasl_proto.o: ../../include/msg.h smtpd_sasl_proto.o: ../../include/myaddrinfo.h @@ -600,6 +616,7 @@ smtpd_sasl_proto.o: ../../include/name_code.h smtpd_sasl_proto.o: ../../include/name_mask.h smtpd_sasl_proto.o: ../../include/nvtable.h smtpd_sasl_proto.o: ../../include/sock_addr.h +smtpd_sasl_proto.o: ../../include/string_list.h smtpd_sasl_proto.o: ../../include/stringops.h smtpd_sasl_proto.o: ../../include/sys_defs.h smtpd_sasl_proto.o: ../../include/tls.h @@ -624,6 +641,7 @@ smtpd_state.o: ../../include/mail_error.h smtpd_state.o: ../../include/mail_params.h smtpd_state.o: ../../include/mail_proto.h smtpd_state.o: ../../include/mail_stream.h +smtpd_state.o: ../../include/match_list.h smtpd_state.o: ../../include/milter.h smtpd_state.o: ../../include/msg.h smtpd_state.o: ../../include/myaddrinfo.h @@ -632,6 +650,7 @@ smtpd_state.o: ../../include/name_code.h smtpd_state.o: ../../include/name_mask.h smtpd_state.o: ../../include/nvtable.h smtpd_state.o: ../../include/sock_addr.h +smtpd_state.o: ../../include/string_list.h smtpd_state.o: ../../include/sys_defs.h smtpd_state.o: ../../include/tls.h smtpd_state.o: ../../include/vbuf.h @@ -657,6 +676,7 @@ smtpd_xforward.o: ../../include/htable.h smtpd_xforward.o: ../../include/iostuff.h smtpd_xforward.o: ../../include/mail_proto.h smtpd_xforward.o: ../../include/mail_stream.h +smtpd_xforward.o: ../../include/match_list.h smtpd_xforward.o: ../../include/milter.h smtpd_xforward.o: ../../include/msg.h smtpd_xforward.o: ../../include/myaddrinfo.h @@ -665,6 +685,7 @@ smtpd_xforward.o: ../../include/name_code.h smtpd_xforward.o: ../../include/name_mask.h smtpd_xforward.o: ../../include/nvtable.h smtpd_xforward.o: ../../include/sock_addr.h +smtpd_xforward.o: ../../include/string_list.h smtpd_xforward.o: ../../include/sys_defs.h smtpd_xforward.o: ../../include/tls.h smtpd_xforward.o: ../../include/vbuf.h diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 943e40e9d..bcd285c13 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -345,6 +345,11 @@ /* Available in Postfix version 3.4 and later: /* .IP "\fBsmtpd_sasl_response_limit (12288)\fR" /* The maximum length of a SASL client's response to a server challenge. +/* .PP +/* Available in Postfix 3.6 and later: +/* .IP "\fBsmtpd_sasl_mechanism_filter (!external, static:rest)\fR" +/* If non-empty, a filter for the SASL mechanism names that the +/* Postfix SMTP server will announce in the EHLO response. /* STARTTLS SUPPORT CONTROLS /* .ad /* .fi @@ -1316,6 +1321,7 @@ char *var_smtpd_sasl_realm; int var_smtpd_sasl_resp_limit; char *var_smtpd_sasl_exceptions_networks; char *var_smtpd_sasl_type; +char *var_smtpd_sasl_mech_filter; char *var_filter_xport; bool var_broken_auth_clients; char *var_perm_mx_networks; @@ -6477,6 +6483,7 @@ int main(int argc, char **argv) #endif VAR_SMTPD_TLS_LEVEL, DEF_SMTPD_TLS_LEVEL, &var_smtpd_tls_level, 0, 0, VAR_SMTPD_SASL_TYPE, DEF_SMTPD_SASL_TYPE, &var_smtpd_sasl_type, 1, 0, + VAR_SMTPD_SASL_MECH_FILTER, DEF_SMTPD_SASL_MECH_FILTER, &var_smtpd_sasl_mech_filter, 0, 0, VAR_SMTPD_MILTERS, DEF_SMTPD_MILTERS, &var_smtpd_milters, 0, 0, VAR_MILT_CONN_MACROS, DEF_MILT_CONN_MACROS, &var_milt_conn_macros, 0, 0, VAR_MILT_HELO_MACROS, DEF_MILT_HELO_MACROS, &var_milt_helo_macros, 0, 0, diff --git a/postfix/src/smtpd/smtpd_sasl_glue.c b/postfix/src/smtpd/smtpd_sasl_glue.c index 020c830fa..2c5271916 100644 --- a/postfix/src/smtpd/smtpd_sasl_glue.c +++ b/postfix/src/smtpd/smtpd_sasl_glue.c @@ -137,6 +137,8 @@ /* Global library. */ #include +#include +#include /* XSASL library. */ @@ -150,6 +152,11 @@ #ifdef USE_SASL_AUTH + /* + * SASL mechanism filter. + */ +static STRING_LIST *smtpd_sasl_mech_filter; + /* * Silly little macros. */ @@ -178,6 +185,12 @@ void smtpd_sasl_initialize(void) var_smtpd_sasl_path)) == 0) msg_fatal("SASL per-process initialization failed"); + /* + * Initialize the SASL mechanism filter. + */ + smtpd_sasl_mech_filter = string_list_init(VAR_SMTPD_SASL_MECH_FILTER, + MATCH_FLAG_NONE, + var_smtpd_sasl_mech_filter); } /* smtpd_sasl_activate - per-connection initialization */ @@ -186,6 +199,7 @@ void smtpd_sasl_activate(SMTPD_STATE *state, const char *sasl_opts_name, const char *sasl_opts_val) { const char *mechanism_list; + const char *filtered_mechanism_list; XSASL_SERVER_CREATE_ARGS create_args; int tls_flag; @@ -239,7 +253,12 @@ void smtpd_sasl_activate(SMTPD_STATE *state, const char *sasl_opts_name, if ((mechanism_list = xsasl_server_get_mechanism_list(state->sasl_server)) == 0) msg_fatal("no SASL authentication mechanisms"); - state->sasl_mechanism_list = mystrdup(mechanism_list); + filtered_mechanism_list = + sasl_mech_filter(smtpd_sasl_mech_filter, mechanism_list); + if (*filtered_mechanism_list == 0) + msg_fatal("%s discards all mechanisms in '%s'", + VAR_SMTPD_SASL_MECH_FILTER, mechanism_list); + state->sasl_mechanism_list = mystrdup(filtered_mechanism_list); } /* smtpd_sasl_state_init - initialize state to allow extern authentication. */