From: Wietse Venema
+-CAUTION: when postscreen rejects mail, it's SMTP reply contains the +CAUTION: when postscreen rejects mail, its SMTP reply contains the DNSBL domain name. Use the postscreen_dnsbl_reply_map feature to hide "password" information in DNSBL domain names.
@@ -361,10 +361,10 @@ impact of this limitation, postscreen(8) gives d a relatively long expiration time.postscreen(8)'s built-in SMTP engine does not implement -the AUTH, STARTTLS, XCLIENT, and XFORWARD features. STARTTLS and -AUTH support may be added in a future version. In the mean time, -if you need to make these services available on port 25, then do -not enable the tests after the 220 server greeting.
+the AUTH, XCLIENT, and XFORWARD features. AUTH support may be added +in a future version. In the mean time, if you need to make these +services available on port 25, then do not enable the tests after +the 220 server greeting. @@ -672,6 +672,15 @@ service in master.cf. smtp inet n - n - 1 postscreen +Uncomment the new "tlsproxy unix ... tlsproxy" +service in master.cf. This service implements STARTTLS support for +postscreen(8).
+ ++/etc/postfix/master.cf: + tlsproxy unix - - n - 0 tlsproxy ++Uncomment the new "dnsblog unix ... dnsblog" service in master.cf. This service does DNSBL lookups for postscreen(8) and logs results.
@@ -775,8 +784,8 @@ disconnect.When the good client comes back in a later session, it is allowed to talk directly to a Postfix SMTP server. See "after_220 Tests after the 220 SMTP server greeting above -for limitations with STARTTLS, AUTH and other features that clients -may need.
+for limitations with AUTH and other features that clients may need. +An unexpected benefit from "deep protocol tests" is that some "good" clients don't return after the 4XX @@ -825,14 +834,23 @@ that follow.
# -o parameter=value ... +Comment out the "tlsproxy unix ... tlsproxy" +service in master.cf, including any "-o parameter=value" +entries that follow.
+ ++/etc/postfix/master.cf: + #tlsproxy unix - - n - 0 tlsproxy + # -o parameter=value ... +Uncomment the "smtp inet ... smtpd" service in master.cf, including any "-o parameter=value" entries that -follow.
+may follow./etc/postfix/master.cf: - smtp inet n - n - - smtpd + smtp inet n - n - - smtpd -o parameter=value ...diff --git a/postfix/html/TLS_README.html b/postfix/html/TLS_README.html index edf38f78b..b1cda2227 100644 --- a/postfix/html/TLS_README.html +++ b/postfix/html/TLS_README.html @@ -27,6 +27,11 @@ code. Assuming that OpenSSL is written as carefully as Wietse's own code, every 1000 lines introduce one additional bug into Postfix. +At this time, you should no longer be using OpenSSL releases prior +to the most recent 0.9.8 release unless all relevant security fixes have +been backported to the earlier release by you or your O/S vendor. OpenSSL +0.9.7 and earlier are no longer maintained by the OpenSSL team.
+What Postfix TLS support does for you
Transport Layer Security (TLS, formerly called SSL) provides @@ -852,6 +857,25 @@ secure for most situations.
Postfix 2.8 and later, in combination with OpenSSL 0.9.7 and later +allows TLS servers to preempt the TLS client's cipher preference list. +This is only possible with SSLv3, as in SSLv2 the client chooses the +cipher from a list supplied by the server.
+ +By default, the OpenSSL server selects the client's most preferred +cipher that the server supports. With SSLv3 and later, the server +may choose its own most preferred cipher that is supported (offered) +by the client. Setting "tls_preempt_cipherlist = yes" enables server +cipher preferences. The default OpenSSL behaviour applies with +"tls_preempt_cipherlist = no".
+ +While server cipher selection may in some cases lead to a more secure +or performant cipher choice, there is some risk of interoperability +issues. In the past, some SSL clients have listed lower priority ciphers +that they did not implement correctly. If the server chooses a cipher +that the client prefers less, it may select a cipher whose client +implementation is flawed.
+The smtpd_starttls_timeout parameter limits the time of Postfix @@ -867,6 +891,30 @@ handshake procedures.
+With Postfix 2.8 and later, the tls_disable_workarounds parameter +specifies a list or bit-mask of OpenSSL bug work-arounds to disable. This +may be necessary if one of the work-arounds enabled by default in +OpenSSL proves to pose a security risk, or introduces an unexpected +interoperability issue. Some bug work-arounds known to be problematic +are disabled in the default value of the parameter when linked with +an OpenSSL library that could be vulnerable.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_disable_workarounds = 0xFFFFFFFF + tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT ++
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this +time, lots of servers are still unpatched and Postfix is not +significantly vulnerable to the renegotiation issue in the TLS +protocol.
+Topics covered in this section:
diff --git a/postfix/html/lmtp.8.html b/postfix/html/lmtp.8.html index 1d14126e0..c61339475 100644 --- a/postfix/html/lmtp.8.html +++ b/postfix/html/lmtp.8.html @@ -551,29 +551,35 @@ SMTP(8) SMTP(8) an attacker prepends malicious HELO, MAIL, RCPT, DATA commands to a Postfix SMTP client TLS session. + Available in Postfix version 2.8 and later: + + tls_disable_workarounds (see 'postconf -d' output) + List or bit-mask of OpenSSL bug work-arounds to + disable. + OBSOLETE STARTTLS CONTROLS - The following configuration parameters exist for compati- + The following configuration parameters exist for compati- bility with Postfix versions before 2.3. Support for these will be removed in a future release. smtp_use_tls (no) - Opportunistic mode: use TLS when a remote SMTP - server announces STARTTLS support, otherwise send + Opportunistic mode: use TLS when a remote SMTP + server announces STARTTLS support, otherwise send the mail in the clear. smtp_enforce_tls (no) - Enforcement mode: require that remote SMTP servers - use TLS encryption, and never send mail in the + Enforcement mode: require that remote SMTP servers + use TLS encryption, and never send mail in the clear. smtp_tls_enforce_peername (yes) - With mandatory TLS encryption, require that the + With mandatory TLS encryption, require that the remote SMTP server hostname matches the information in the remote SMTP server certificate. smtp_tls_per_site (empty) Optional lookup tables with the Postfix SMTP client - TLS usage policy by next-hop destination and by + TLS usage policy by next-hop destination and by remote SMTP server hostname. smtp_tls_cipherlist (empty) @@ -583,27 +589,27 @@ SMTP(8) SMTP(8) RESOURCE AND RATE CONTROLS smtp_destination_concurrency_limit ($default_destina- tion_concurrency_limit) - The maximal number of parallel deliveries to the - same destination via the smtp message delivery + The maximal number of parallel deliveries to the + same destination via the smtp message delivery transport. smtp_destination_recipient_limit ($default_destina- tion_recipient_limit) - The maximal number of recipients per message for + The maximal number of recipients per message for the smtp message delivery transport. smtp_connect_timeout (30s) - The SMTP client time limit for completing a TCP + The SMTP client time limit for completing a TCP connection, or zero (use the operating system built-in time limit). smtp_helo_timeout (300s) - The SMTP client time limit for sending the HELO or - EHLO command, and for receiving the initial server + The SMTP client time limit for sending the HELO or + EHLO command, and for receiving the initial server response. lmtp_lhlo_timeout (300s) - The LMTP client time limit for sending the LHLO + The LMTP client time limit for sending the LHLO command, and for receiving the initial server response. @@ -612,30 +618,30 @@ SMTP(8) SMTP(8) command, and for receiving the server response. smtp_mail_timeout (300s) - The SMTP client time limit for sending the MAIL - FROM command, and for receiving the server + The SMTP client time limit for sending the MAIL + FROM command, and for receiving the server response. smtp_rcpt_timeout (300s) - The SMTP client time limit for sending the SMTP - RCPT TO command, and for receiving the server + The SMTP client time limit for sending the SMTP + RCPT TO command, and for receiving the server response. smtp_data_init_timeout (120s) - The SMTP client time limit for sending the SMTP - DATA command, and for receiving the server + The SMTP client time limit for sending the SMTP + DATA command, and for receiving the server response. smtp_data_xfer_timeout (180s) - The SMTP client time limit for sending the SMTP + The SMTP client time limit for sending the SMTP message content. smtp_data_done_timeout (600s) - The SMTP client time limit for sending the SMTP + The SMTP client time limit for sending the SMTP ".", and for receiving the server response. smtp_quit_timeout (300s) - The SMTP client time limit for sending the QUIT + The SMTP client time limit for sending the QUIT command, and for receiving the server response. Available in Postfix version 2.1 and later: @@ -646,12 +652,12 @@ SMTP(8) SMTP(8) lookups, or zero (no limit). smtp_mx_session_limit (2) - The maximal number of SMTP sessions per delivery - request before giving up or delivering to a fall- + The maximal number of SMTP sessions per delivery + request before giving up or delivering to a fall- back relay host, or zero (no limit). smtp_rset_timeout (20s) - The SMTP client time limit for sending the RSET + The SMTP client time limit for sending the RSET command, and for receiving the server response. Available in Postfix version 2.2 and earlier: @@ -663,11 +669,11 @@ SMTP(8) SMTP(8) Available in Postfix version 2.2 and later: smtp_connection_cache_destinations (empty) - Permanently enable SMTP connection caching for the + Permanently enable SMTP connection caching for the specified destinations. smtp_connection_cache_on_demand (yes) - Temporarily enable SMTP connection caching while a + Temporarily enable SMTP connection caching while a destination has a high volume of mail in the active queue. @@ -677,62 +683,62 @@ SMTP(8) SMTP(8) smtp_connection_cache_time_limit (2s) When SMTP connection caching is enabled, the amount - of time that an unused SMTP client socket is kept + of time that an unused SMTP client socket is kept open before it is closed. Available in Postfix version 2.3 and later: connection_cache_protocol_timeout (5s) - Time limit for connection cache connect, send or + Time limit for connection cache connect, send or receive operations. TROUBLE SHOOTING CONTROLS debug_peer_level (2) - The increment in verbose logging level when a - remote client or server matches a pattern in the + The increment in verbose logging level when a + remote client or server matches a pattern in the debug_peer_list parameter. debug_peer_list (empty) - Optional list of remote client or server hostname - or network address patterns that cause the verbose - logging level to increase by the amount specified + Optional list of remote client or server hostname + or network address patterns that 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 problems that are caused by policy, + The recipient of postmaster notifications about + mail delivery problems that are caused by policy, resource, software or protocol errors. internal_mail_filter_classes (empty) - What categories of Postfix-generated mail are sub- - ject to before-queue content inspection by + What categories of Postfix-generated mail are sub- + ject 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 + The list of error classes that are reported to the postmaster. MISCELLANEOUS CONTROLS best_mx_transport (empty) - Where the Postfix SMTP client should deliver mail + Where the Postfix SMTP client should deliver mail when it detects a "mail loops back to myself" error condition. config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. daemon_timeout (18000s) - How much time a Postfix daemon process may take to - handle a request before it is terminated by a + How much time a Postfix daemon process may take to + handle a request before it is terminated by a built-in watchdog timer. delay_logging_resolution_limit (2) - The maximal number of digits after the decimal + The maximal number of digits after the decimal point when logging sub-second delay values. disable_dns_lookups (no) - Disable DNS lookups in the Postfix SMTP and LMTP + Disable DNS lookups in the Postfix SMTP and LMTP clients. inet_interfaces (all) @@ -740,7 +746,7 @@ SMTP(8) SMTP(8) tem receives mail on. inet_protocols (ipv4) - The Internet protocols Postfix will attempt to use + The Internet protocols Postfix will attempt to use when making or accepting connections. ipc_timeout (3600s) @@ -748,87 +754,87 @@ SMTP(8) SMTP(8) over an internal communication channel. lmtp_assume_final (no) - When an LMTP server announces no DSN support, + When an LMTP server announces no DSN support, assume that the server performs final delivery, and - send "delivered" delivery status notifications + send "delivered" delivery status notifications instead of "relayed". lmtp_tcp_port (24) - The default TCP port that the Postfix LMTP client + The default TCP port that the Postfix LMTP client connects to. max_idle (100s) - The maximum amount of time that an idle Postfix - daemon process waits for an incoming connection + The maximum amount of time that an idle Postfix + daemon process waits for an incoming connection before terminating voluntarily. max_use (100) - The maximal number of incoming connections that a - Postfix daemon process will service before termi- + The maximal number of incoming connections that a + Postfix daemon process will service before termi- nating voluntarily. process_id (read-only) - The process ID of a Postfix command or daemon + The process ID of a Postfix command or daemon process. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. proxy_interfaces (empty) The network interface addresses that this mail sys- - tem receives mail on by way of a proxy or network + tem receives mail on by way of a proxy or network address translation unit. smtp_address_preference (ipv6) The address type ("ipv6", "ipv4" or "any") that the Postfix SMTP client will try first, when a destina- - tion has IPv6 and IPv4 addresses with equal MX + tion has IPv6 and IPv4 addresses with equal MX preference. smtp_bind_address (empty) - An optional numerical network address that the - Postfix SMTP client should bind to when making an + An optional numerical network address that the + Postfix SMTP client should bind to when making an IPv4 connection. smtp_bind_address6 (empty) - An optional numerical network address that the - Postfix SMTP client should bind to when making an + An optional numerical network address that the + Postfix SMTP client should bind to when making an IPv6 connection. smtp_helo_name ($myhostname) - The hostname to send in the SMTP EHLO or HELO com- + The hostname to send in the SMTP EHLO or HELO com- mand. lmtp_lhlo_name ($myhostname) The hostname to send in the LMTP LHLO command. smtp_host_lookup (dns) - What mechanisms the Postfix SMTP client uses to + What mechanisms the Postfix SMTP client uses to look up a host's IP address. smtp_randomize_addresses (yes) - Randomize the order of equal-preference MX host + Randomize the order of equal-preference MX host addresses. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (see 'postconf -d' output) - The mail system name that is prepended to the - process name in syslog records, so that "smtpd" + The mail system name that is prepended to the + process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd". Available with Postfix 2.2 and earlier: fallback_relay (empty) - Optional list of relay hosts for SMTP destinations + Optional list of relay hosts for SMTP destinations that can't be found or that are unreachable. Available with Postfix 2.3 and later: smtp_fallback_relay ($fallback_relay) - Optional list of relay hosts for SMTP destinations + Optional list of relay hosts for SMTP destinations that can't be found or that are unreachable. SEE ALSO @@ -849,7 +855,7 @@ SMTP(8) SMTP(8) TLS_README, Postfix STARTTLS howto LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 447473d1a..36e036254 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -6834,6 +6834,33 @@ protocol engine. This bounds the time to receive an entire command.This feature is available in Postfix 2.8.
+ + +Lookup tables, indexed by the remote SMTP client address, with +case insensitive lists of EHLO keywords (pipelining, starttls, auth, +etc.) that the postscreen(8) server will not send in the EHLO response +to a remote SMTP client. See smtpd_discard_ehlo_keywords for details. +The table is not searched by hostname for robustness reasons.
+ +This feature is available in Postfix 2.8 and later.
+ + +A case insensitive list of EHLO keywords (pipelining, starttls, +auth, etc.) that the postscreen(8) server will not send in the EHLO +response to a remote SMTP client. See smtpd_discard_ehlo_keywords +for details.
+ +This feature is available in Postfix 2.8 and later.
+ +This feature is available in Postfix 2.8.
+ + +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_postscreen_enforce_tls +for details.
+ +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead.
+ +This feature is available in Postfix 2.8.
+ + +The SMTP TLS security level for the postscreen(8) server; when +a non-empty value is specified, this overrides the obsolete parameters +postscreen_use_tls and postscreen_enforce_tls. See smtpd_tls_security_level +for details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption.
+ +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead.
+ +The time limit for Postfix SMTP server write and read operations -during TLS startup and shutdown handshake procedures.
+during TLS startup and shutdown handshake procedures. The current +default value is stress-dependent. Before Postfix version 2.8, it +was fixed at 300s.This feature is available in Postfix 2.2 and later.
@@ -14749,6 +14816,68 @@ bytes (equivalent to 256 bits) is sufficient to generate a 128bitThis feature is available in Postfix 2.2 and later.
+List or bit-mask of OpenSSL bug work-arounds to disable.
+ +The OpenSSL toolkit includes a set of work-arounds for buggy SSL/TLS +implementations. Applications, such as Postfix, that want to maximize +interoperability ask the OpenSSL library to enable the full set of +recommended work-arounds.
+ +From time to time, it is discovered that a work-around creates a +security issue, and should no longer be used. If upgrading OpenSSL +to a fixed version is not an option or an upgrade is not available +in a timely manner, or in closed environments where no buggy clients +or servers exist, it may be appropriate to disable some or all of the +OpenSSL interoperability work-arounds. This parameter specifies which +bug work-arounds to disable.
+ +If the value of the parameter is a hexadecimal long integer starting +with "0x", the bug work-arounds corresponding to the bits specified in +its value are removed from the SSL_OP_ALL work-around bit-mask +(see openssl/ssl.h and SSL_CTX_set_options(3)). You can specify more +bits than are present in SSL_OP_ALL, excess bits are ignored. Specifying +0xFFFFFFFF disables all bug-workarounds on a 32-bit system. This should +also be sufficient on 64-bit systems, until OpenSSL abandons support +for 32-bit systems and starts using the high 32 bits of a 64-bit +bug-workaround mask.
+ +Otherwise, the parameter is a white-space or comma separated list +of specific named bug work-arounds chosen from the list below. It +is possible that your OpenSSL version includes new bug work-arounds +added after your Postfix source code was last updated, in that case +you can only disable one of these via the hexadecimal syntax above.
+ +This feature is available in Postfix 2.8 and later.
+ +This feature is available in Postfix 2.3 and later.
+ + +With SSLv3 and later, use the server's cipher preference order +instead of the client's cipher preference order.
+ +By default, the OpenSSL server selects the client's most preferred +cipher that the server supports. With SSLv3 and later, the server may +choose its own most preferred cipher that is supported (offered) by +the client. Setting "tls_preempt_cipherlist = yes" enables server cipher +preferences.
+ +While server cipher selection may in some cases lead to a more secure +or performant cipher choice, there is some risk of interoperability +issues. In the past, some SSL clients have listed lower priority ciphers +that they did not implement correctly. If the server chooses a cipher +that the client prefers less, it may select a cipher whose client +implementation is flawed.
+ +This feature is available in Postfix 2.8 and later, in combination +with OpenSSL 0.9.7 and later.
+ +This feature is available in Postfix 2.2 and later.
+ + +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_enforce_tls for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +A file containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CAfile for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +A directory containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CApath for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Force the Postfix tlsproxy(8) server to issue a TLS session id, +even when TLS session caching is turned off. See +smtpd_tls_always_issue_session_ids for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Ask a remote SMTP client for a client certificate. See +smtpd_tls_ask_ccert for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The verification depth for remote SMTP client certificates. A +depth of 1 is sufficient if the issuing CA is listed in a local CA +file. See smtpd_tls_ccert_verifydepth for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server RSA certificate in PEM +format. This file may also contain the Postfix tlsproxy(8) server +private RSA key. See smtpd_tls_cert_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The minimum TLS cipher grade that the Postfix tlsproxy(8) server +will use with opportunistic TLS encryption. See smtpd_tls_ciphers +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server DSA certificate in PEM +format. This file may also contain the Postfix tlsproxy(8) server +private DSA key. See smtpd_tls_dcert_file for further details. +
+ +This feature is available in Postfix 2.8 and later.
+ + +File with DH parameters that the Postfix tlsproxy(8) server +should use with EDH ciphers. See smtpd_tls_dh1024_param_file for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with DH parameters that the Postfix tlsproxy(8) server +should use with EDH ciphers. See smtpd_tls_dh512_param_file for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server DSA private key in PEM +format. This file may be combined with the Postfix tlsproxy(8) +server DSA certificate file specified with $smtpd_tls_dcert_file. +See smtpd_tls_dkey_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server ECDSA certificate in +PEM format. This file may also contain the Postfix tlsproxy(8) +server private ECDSA key. See smtpd_tls_eccert_file for further +details.
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server ECDSA private key in +PEM format. This file may be combined with the Postfix tlsproxy(8) +server ECDSA certificate file specified with $smtpd_tls_eccert_file. +See smtpd_tls_eckey_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The Postfix tlsproxy(8) server security grade for ephemeral +elliptic-curve Diffie-Hellman (EECDH) key exchange. See +smtpd_tls_eecdh_grade for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +List of ciphers or cipher types to exclude from the tlsproxy(8) +server cipher list at all TLS security levels. See +smtpd_tls_exclude_ciphers for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The message digest algorithm used to construct client-certificate +fingerprints. See smtpd_tls_fingerprint_digest for further details. +
+ +This feature is available in Postfix 2.8 and later.
+ + +File with the Postfix tlsproxy(8) server RSA private key in PEM +format. This file may be combined with the Postfix tlsproxy(8) +server RSA certificate file specified with $smtpd_tls_cert_file. +See smtpd_tls_key_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Enable additional Postfix tlsproxy(8) server logging of TLS +activity. Each logging level also includes the information that +is logged at a lower logging level. See smtpd_tls_loglevel for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The minimum TLS cipher grade that the Postfix tlsproxy(8) server +will use with mandatory TLS encryption. See smtpd_tls_mandatory_ciphers +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Additional list of ciphers or cipher types to exclude from the +tlsproxy(8) server cipher list at mandatory TLS security levels. +See smtpd_tls_mandatory_exclude_ciphers for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The SSL/TLS protocols accepted by the Postfix tlsproxy(8) server +with mandatory TLS encryption. If the list is empty, the server +supports all available SSL/TLS protocol versions. See +smtpd_tls_mandatory_protocols for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +List of TLS protocols that the Postfix tlsproxy(8) server will +exclude or include with opportunistic TLS encryption. See +smtpd_tls_protocols for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +With mandatory TLS encryption, require a trusted remote SMTP +client certificate in order to allow TLS connections to proceed. +See smtpd_tls_req_ccert for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The SMTP TLS security level for the Postfix tlsproxy(8) server; +when a non-empty value is specified, this overrides the obsolete +parameters smtpd_use_tls and smtpd_enforce_tls. See +smtpd_tls_security_level for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +The expiration time of Postfix tlsproxy(8) server TLS session +cache information. A cache cleanup is performed periodically every +$smtpd_tls_session_cache_timeout seconds. See +smtpd_tls_session_cache_timeout for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. See smtpd_use_tls +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ + +How much time a tlsproxy(8) process may take to process local +or remote I/O before it is terminated by a built-in watchdog timer. +This is a safety mechanism that prevents tlsproxy(8) from becoming +non-responsive due to a bug in Postfix itself or in system software. +To avoid false alarms and unnecessary cache corruption this limit +cannot be set under 10s.
+ +Specify a non-zero time value (an integral value plus an optional +one-letter suffix that specifies the time unit). Time units: s +(seconds), m (minutes), h (hours), d (days), w (weeks).
+ +This feature is available in Postfix 2.8.
+ ++TLSPROXY(8) TLSPROXY(8) + +NAME + tlsproxy - Postfix TLS proxy + +SYNOPSIS + tlsproxy [generic Postfix daemon options] + +DESCRIPTION + The tlsproxy(8) server implements a server-side TLS proxy. + Its primary use is to talk plaintext SMTP with + postscreen(8), and to talk SMTP-over-TLS with remote SMTP + clients whose whitelist status has expired, but it should + also work for non-SMTP protocols. + + Although one tlsproxy(8) process can serve multiple ses- + sions at the same time, it is a good idea to allow the + number of processes to increase with load, so that the + service remains available. + +PROTOCOL EXAMPLE + The example below involves postscreen(8). However, the + tlsproxy(8) server is agnostic of the application proto- + col, and the example is easily adapted to other applica- + tions. + + The postscreen(8) server sends the remote SMTP client end- + point string, the requested role (server), and the + requested timeout to tlsproxy(8). postscreen(8) then + receives a "TLS available" indication from tlsproxy(8). + If the TLS service is available, postscreen(8) sends the + remote SMTP client file descriptor to tlsproxy(8), and + sends the plaintext 220 greeting to the remote SMTP + client. This triggers TLS negotiations between the remote + SMTP client and tlsproxy(8). Upon completion of the TLS- + level handshake, tlsproxy(8) translates between plaintext + from/to postscreen(8) and ciphertext to/from the remote + SMTP client. + +SECURITY + The tlsproxy(8) server is moderately security-sensitive. + It talks to untrusted clients on the network. The process + can be run chrooted at fixed low privilege. + +DIAGNOSTICS + Problems and transactions are logged to syslogd(8). + +CONFIGURATION PARAMETERS + Changes to main.cf are not picked up automatically, as + tlsproxy(8) processes may run for a long time depending on + mail server load. Use the command "postfix reload" to + speed up a change. + + The text below provides only a parameter summary. See + postconf(5) for more details including examples. + +STARTTLS SUPPORT CONTROLS + tlsproxy_tls_CAfile ($smtpd_tls_CAfile) + A file containing (PEM format) CA certificates of + root CAs trusted to sign either remote SMTP client + certificates or intermediate CA certificates. + + tlsproxy_tls_CApath ($smtpd_tls_CApath) + A directory containing (PEM format) CA certificates + of root CAs trusted to sign either remote SMTP + client certificates or intermediate CA certifi- + cates. + + tlsproxy_tls_always_issue_session_ids + ($smtpd_tls_always_issue_session_ids) + Force the Postfix tlsproxy(8) server to issue a TLS + session id, even when TLS session caching is turned + off. + + tlsproxy_tls_ask_ccert ($smtpd_tls_ask_ccert) + Ask a remote SMTP client for a client certificate. + + tlsproxy_tls_ccert_verifydepth ($smtpd_tls_ccert_verify- + depth) + The verification depth for remote SMTP client cer- + tificates. + + tlsproxy_tls_cert_file ($smtpd_tls_cert_file) + File with the Postfix tlsproxy(8) server RSA cer- + tificate in PEM format. + + tlsproxy_tls_ciphers ($smtpd_tls_ciphers) + The minimum TLS cipher grade that the Postfix + tlsproxy(8) server will use with opportunistic TLS + encryption. + + tlsproxy_tls_dcert_file ($smtpd_tls_dcert_file) + File with the Postfix tlsproxy(8) server DSA cer- + tificate in PEM format. + + tlsproxy_tls_dh1024_param_file + ($smtpd_tls_dh1024_param_file) + File with DH parameters that the Postfix + tlsproxy(8) server should use with EDH ciphers. + + tlsproxy_tls_dh512_param_file + ($smtpd_tls_dh512_param_file) + File with DH parameters that the Postfix + tlsproxy(8) server should use with EDH ciphers. + + tlsproxy_tls_dkey_file ($smtpd_tls_dkey_file) + File with the Postfix tlsproxy(8) server DSA pri- + vate key in PEM format. + + tlsproxy_tls_eccert_file ($smtpd_tls_eccert_file) + File with the Postfix tlsproxy(8) server ECDSA cer- + tificate in PEM format. + + tlsproxy_tls_eckey_file ($smtpd_tls_eckey_file) + File with the Postfix tlsproxy(8) server ECDSA pri- + vate key in PEM format. + + tlsproxy_tls_eecdh_grade ($smtpd_tls_eecdh_grade) + The Postfix tlsproxy(8) server security grade for + ephemeral elliptic-curve Diffie-Hellman (EECDH) key + exchange. + + tlsproxy_tls_exclude_ciphers ($smtpd_tls_exclude_ciphers) + List of ciphers or cipher types to exclude from the + tlsproxy(8) server cipher list at all TLS security + levels. + + tlsproxy_tls_fingerprint_digest ($smtpd_tls_finger- + print_digest) + The message digest algorithm used to construct + client-certificate fingerprints. + + tlsproxy_tls_key_file ($smtpd_tls_key_file) + File with the Postfix tlsproxy(8) server RSA pri- + vate key in PEM format. + + tlsproxy_tls_loglevel ($smtpd_tls_loglevel) + Enable additional Postfix tlsproxy(8) server log- + ging of TLS activity. + + tlsproxy_tls_mandatory_ciphers ($smtpd_tls_manda- + tory_ciphers) + The minimum TLS cipher grade that the Postfix + tlsproxy(8) server will use with mandatory TLS + encryption. + + tlsproxy_tls_mandatory_exclude_ciphers ($smtpd_tls_manda- + tory_exclude_ciphers) + Additional list of ciphers or cipher types to + exclude from the tlsproxy(8) server cipher list at + mandatory TLS security levels. + + tlsproxy_tls_mandatory_protocols ($smtpd_tls_manda- + tory_protocols) + The SSL/TLS protocols accepted by the Postfix + tlsproxy(8) server with mandatory TLS encryption. + + tlsproxy_tls_protocols ($smtpd_tls_protocols) + List of TLS protocols that the Postfix tlsproxy(8) + server will exclude or include with opportunistic + TLS encryption. + + tlsproxy_tls_req_ccert ($smtpd_tls_req_ccert) + With mandatory TLS encryption, require a trusted + remote SMTP client certificate in order to allow + TLS connections to proceed. + + tlsproxy_tls_security_level ($smtpd_tls_security_level) + The SMTP TLS security level for the Postfix + tlsproxy(8) server; when a non-empty value is spec- + ified, this overrides the obsolete parameters + smtpd_use_tls and smtpd_enforce_tls. + + tlsproxy_tls_session_cache_timeout ($smtpd_tls_ses- + sion_cache_timeout) + The expiration time of Postfix tlsproxy(8) server + TLS session cache information. + +OBSOLETE STARTTLS SUPPORT CONTROLS + These parameters are supported for compatibility with + smtpd(8) legacy parameters. + + tlsproxy_use_tls ($smtpd_use_tls) + Opportunistic TLS: announce STARTTLS support to + SMTP clients, but do not require that clients use + TLS encryption. + + tlsproxy_enforce_tls ($smtpd_enforce_tls) + Mandatory TLS: announce STARTTLS support to SMTP + clients, and require that clients use TLS encryp- + tion. + +RESOURCE CONTROLS + tlsproxy_watchdog_timeout (10s) + How much time a tlsproxy(8) process may take to + process local or remote I/O before it is terminated + by a built-in watchdog timer. + +MISCELLANEOUS CONTROLS + config_directory (see 'postconf -d' output) + The default location of the Postfix main.cf and + master.cf configuration files. + + process_id (read-only) + The process ID of a Postfix command or daemon + process. + + process_name (read-only) + The process name of a Postfix command or daemon + process. + + syslog_facility (mail) + The syslog facility of Postfix logging. + + syslog_name (see 'postconf -d' output) + The mail system name that is prepended to the + process name in syslog records, so that "smtpd" + becomes, for example, "postfix/smtpd". + +SEE ALSO + postscreen(8), Postfix zombie blocker + smtpd(8), Postfix SMTP server + postconf(5), configuration parameters + syslogd(5), system logging + +LICENSE + The Secure Mailer license must be distributed with this + software. + +HISTORY + This service was introduced with Postfix version 2.8. + +AUTHOR(S) + Wietse Venema + IBM T.J. Watson Research + P.O. Box 704 + Yorktown Heights, NY 10598, USA + + TLSPROXY(8) +diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index 4ab5008da..912ace409 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -8,7 +8,7 @@ DAEMONS = man8/bounce.8 man8/defer.8 man8/cleanup.8 man8/error.8 man8/local.8 \ man8/oqmgr.8 man8/spawn.8 man8/flush.8 man8/virtual.8 man8/qmqpd.8 \ man8/verify.8 man8/trace.8 man8/proxymap.8 man8/anvil.8 \ man8/scache.8 man8/discard.8 man8/tlsmgr.8 man8/postscreen.8 \ - man8/dnsblog.8 + man8/dnsblog.8 man8/tlsproxy.8 COMMANDS= man1/postalias.1 man1/postcat.1 man1/postconf.1 man1/postfix.1 \ man1/postkick.1 man1/postlock.1 man1/postlog.1 man1/postdrop.1 \ man1/postmap.1 man1/postmulti.1 man1/postqueue.1 man1/postsuper.1 \ @@ -147,6 +147,11 @@ man8/smtpd.8: ../src/smtpd/smtpd.c (cmp -s junk $? || mv junk $?) && rm -f junk ../mantools/srctoman $? >$@ +man8/tlsproxy.8: ../src/tlsproxy/tlsproxy.c + ../mantools/fixman ../proto/postconf.proto $? >junk && \ + (cmp -s junk $? || mv junk $?) && rm -f junk + ../mantools/srctoman $? >$@ + man8/virtual.8: ../src/virtual/virtual.c ../mantools/fixman ../proto/postconf.proto $? >junk && \ (cmp -s junk $? || mv junk $?) && rm -f junk diff --git a/postfix/man/man1/postfix.1 b/postfix/man/man1/postfix.1 index fc20df6dd..ac87b590f 100644 --- a/postfix/man/man1/postfix.1 +++ b/postfix/man/man1/postfix.1 @@ -274,7 +274,7 @@ master(8), Postfix master daemon oqmgr(8), old Postfix queue manager pickup(8), Postfix local mail pickup pipe(8), deliver mail to non-Postfix command -postscreen(8), Postfix SMTP triage server +postscreen(8), Postfix zombie blocker proxymap(8), Postfix lookup table proxy server qmgr(8), Postfix queue manager qmqpd(8), Postfix QMQP server @@ -284,6 +284,7 @@ smtp(8), lmtp(8), Postfix SMTP+LMTP client smtpd(8), Postfix SMTP server spawn(8), run non-Postfix server tlsmgr(8), Postfix TLS cache and randomness manager +tlsproxy(8), Postfix TLS proxy server trivial-rewrite(8), Postfix address rewriting verify(8), Postfix address verification virtual(8), Postfix virtual delivery agent diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 3e7023f9e..66beefb09 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -3845,6 +3845,21 @@ Disable the SMTP VRFY command in the \fBpostscreen\fR(8) daemon. See disable_vrfy_command for details. .PP This feature is available in Postfix 2.8. +.SH postscreen_discard_ehlo_keyword_address_maps (default: $smtpd_discard_ehlo_keyword_address_maps) +Lookup tables, indexed by the remote SMTP client address, with +case insensitive lists of EHLO keywords (pipelining, starttls, auth, +etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO response +to a remote SMTP client. See smtpd_discard_ehlo_keywords for details. +The table is not searched by hostname for robustness reasons. +.PP +This feature is available in Postfix 2.8 and later. +.SH postscreen_discard_ehlo_keywords (default: $smtpd_discard_ehlo_keywords) +A case insensitive list of EHLO keywords (pipelining, starttls, +auth, etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO +response to a remote SMTP client. See smtpd_discard_ehlo_keywords +for details. +.PP +This feature is available in Postfix 2.8 and later. .SH postscreen_dnsbl_action (default: ignore) The action that \fBpostscreen\fR(8) takes when an SMTP client's combined DNSBL score is equal to or greater than a threshold (as defined @@ -3972,6 +3987,13 @@ one-letter suffix that specifies the time unit). Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks). .PP This feature is available in Postfix 2.8. +.SH postscreen_enforce_tls (default: $smtpd_enforce_tls) +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_postscreen_enforce_tls +for details. +.PP +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead. .SH postscreen_forbidden_commands (default: $smtpd_forbidden_commands) List of commands that the \fBpostscreen\fR(8) server considers in violation of the SMTP protocol. See smtpd_forbidden_commands for @@ -4127,6 +4149,19 @@ process. When this queue is full, all non-whitelisted clients will receive a 421 reponse. .PP This feature is available in Postfix 2.8. +.SH postscreen_tls_security_level (default: $smtpd_tls_security_level) +The SMTP TLS security level for the \fBpostscreen\fR(8) server; when +a non-empty value is specified, this overrides the obsolete parameters +postscreen_use_tls and postscreen_enforce_tls. See smtpd_tls_security_level +for details. +.PP +This feature is available in Postfix 2.8 and later. +.SH postscreen_use_tls (default: $smtpd_use_tls) +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. +.PP +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead. .SH postscreen_watchdog_timeout (default: 10s) How much time a \fBpostscreen\fR(8) process may take to respond to an SMTP client command or to perform a cache operation before it @@ -8451,9 +8486,11 @@ delays all responses by $smtpd_error_sleep_time seconds. .IP \(bu With Postfix versions 2.0 and earlier, the Postfix SMTP server delays all responses by (number of errors) seconds. -.SH smtpd_starttls_timeout (default: 300s) +.SH smtpd_starttls_timeout (default: see "postconf -d" output) The time limit for Postfix SMTP server write and read operations -during TLS startup and shutdown handshake procedures. +during TLS startup and shutdown handshake procedures. The current +default value is stress-dependent. Before Postfix version 2.8, it +was fixed at 300s. .PP This feature is available in Postfix 2.2 and later. .SH smtpd_timeout (default: normal: 300s, overload: 10s) @@ -9389,6 +9426,58 @@ bytes (equivalent to 256 bits) is sufficient to generate a 128bit (or 168bit) session key. .PP This feature is available in Postfix 2.2 and later. +.SH tls_disable_workarounds (default: see "postconf -d" output) +List or bit-mask of OpenSSL bug work-arounds to disable. +.PP +The OpenSSL toolkit includes a set of work-arounds for buggy SSL/TLS +implementations. Applications, such as Postfix, that want to maximize +interoperability ask the OpenSSL library to enable the full set of +recommended work-arounds. +.PP +From time to time, it is discovered that a work-around creates a +security issue, and should no longer be used. If upgrading OpenSSL +to a fixed version is not an option or an upgrade is not available +in a timely manner, or in closed environments where no buggy clients +or servers exist, it may be appropriate to disable some or all of the +OpenSSL interoperability work-arounds. This parameter specifies which +bug work-arounds to disable. +.PP +If the value of the parameter is a hexadecimal long integer starting +with "0x", the bug work-arounds corresponding to the bits specified in +its value are removed from the \fBSSL_OP_ALL\fR work-around bit-mask +(see openssl/ssl.h and SSL_CTX_\fBset_options\fR(3)). You can specify more +bits than are present in SSL_OP_ALL, excess bits are ignored. Specifying +0xFFFFFFFF disables all bug-workarounds on a 32-bit system. This should +also be sufficient on 64-bit systems, until OpenSSL abandons support +for 32-bit systems and starts using the high 32 bits of a 64-bit +bug-workaround mask. +.PP +Otherwise, the parameter is a white-space or comma separated list +of specific named bug work-arounds chosen from the list below. It +is possible that your OpenSSL version includes new bug work-arounds +added after your Postfix source code was last updated, in that case +you can only disable one of these via the hexadecimal syntax above. +.IP "\fBMICROSOFT_SESS_ID_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBNETSCAPE_CHALLENGE_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBLEGACY_SERVER_CONNECT\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBNETSCAPE_REUSE_CIPHER_CHANGE_BUG\fR also aliased as +\fBCVE-2010-4180\fR. Postfix 2.8 disables this work-around by default +with OpenSSL versions that may predate the fix. Fixed in OpenSSL 0.9.8q +and OpenSSL 1.0.0c." +.IP "\fBSSLREF2_REUSE_CERT_TYPE_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBMICROSOFT_BIG_SSLV3_BUFFER\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBMSIE_SSLV2_RSA_PADDING\fR also aliased as +\fBCVE-2005-2969\fR. Postfix 2.8 disables this work-around by default +with OpenSSL versions that may predate the fix. Fixed in OpenSSL 0.9.7h +and OpenSSL 0.9.8a." +.IP "\fBSSLEAY_080_CLIENT_DH_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBTLS_D5_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBTLS_BLOCK_PADDING_BUG\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBTLS_ROLLBACK_BUG\fRSee SSL_CTX_\fBset_options\fR(3). This is disabled +in OpenSSL 0.9.7 and later. Nobody should still be using 0.9.6!" +.IP "\fBDONT_INSERT_EMPTY_FRAGMENTS\fRSee SSL_CTX_\fBset_options\fR(3)" +.IP "\fBCRYPTOPRO_TLSEXT_BUG\fRNew with GOST support in OpenSSL 1.0.0." +This feature is available in Postfix 2.8 and later. .SH tls_eecdh_strong_curve (default: prime256v1) The elliptic curve used by the SMTP server for sensibly strong ephemeral ECDH key exchange. This curve is used by the Postfix SMTP @@ -9484,6 +9573,25 @@ lmtp_tls_mandatory_ciphers. You are strongly encouraged to not change this setting. .PP This feature is available in Postfix 2.3 and later. +.SH tls_preempt_cipherlist (default: no) +With SSLv3 and later, use the server's cipher preference order +instead of the client's cipher preference order. +.PP +By default, the OpenSSL server selects the client's most preferred +cipher that the server supports. With SSLv3 and later, the server may +choose its own most preferred cipher that is supported (offered) by +the client. Setting "tls_preempt_cipherlist = yes" enables server cipher +preferences. +.PP +While server cipher selection may in some cases lead to a more secure +or performant cipher choice, there is some risk of interoperability +issues. In the past, some SSL clients have listed lower priority ciphers +that they did not implement correctly. If the server chooses a cipher +that the client prefers less, it may select a cipher whose client +implementation is flawed. +.PP +This feature is available in Postfix 2.8 and later, in combination +with OpenSSL 0.9.7 and later. .SH tls_random_bytes (default: 32) The number of bytes that \fBtlsmgr\fR(8) reads from $tls_random_source when (re)seeding the in-memory pseudo random number generator (PRNG) @@ -9530,6 +9638,187 @@ 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 tlsproxy_enforce_tls (default: $smtpd_enforce_tls) +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_enforce_tls for +further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_CAfile (default: $smtpd_tls_CAfile) +A file containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CAfile for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_CApath (default: $smtpd_tls_CApath) +A directory containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CApath for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_always_issue_session_ids (default: $smtpd_tls_always_issue_session_ids) +Force the Postfix \fBtlsproxy\fR(8) server to issue a TLS session id, +even when TLS session caching is turned off. See +smtpd_tls_always_issue_session_ids for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_ask_ccert (default: $smtpd_tls_ask_ccert) +Ask a remote SMTP client for a client certificate. See +smtpd_tls_ask_ccert for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_ccert_verifydepth (default: $smtpd_tls_ccert_verifydepth) +The verification depth for remote SMTP client certificates. A +depth of 1 is sufficient if the issuing CA is listed in a local CA +file. See smtpd_tls_ccert_verifydepth for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_cert_file (default: $smtpd_tls_cert_file) +File with the Postfix \fBtlsproxy\fR(8) server RSA certificate in PEM +format. This file may also contain the Postfix \fBtlsproxy\fR(8) server +private RSA key. See smtpd_tls_cert_file for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_ciphers (default: $smtpd_tls_ciphers) +The minimum TLS cipher grade that the Postfix \fBtlsproxy\fR(8) server +will use with opportunistic TLS encryption. See smtpd_tls_ciphers +for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_dcert_file (default: $smtpd_tls_dcert_file) +File with the Postfix \fBtlsproxy\fR(8) server DSA certificate in PEM +format. This file may also contain the Postfix \fBtlsproxy\fR(8) server +private DSA key. See smtpd_tls_dcert_file for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_dh1024_param_file (default: $smtpd_tls_dh1024_param_file) +File with DH parameters that the Postfix \fBtlsproxy\fR(8) server +should use with EDH ciphers. See smtpd_tls_dh1024_param_file for +further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_dh512_param_file (default: $smtpd_tls_dh512_param_file) +File with DH parameters that the Postfix \fBtlsproxy\fR(8) server +should use with EDH ciphers. See smtpd_tls_dh512_param_file for +further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_dkey_file (default: $smtpd_tls_dkey_file) +File with the Postfix \fBtlsproxy\fR(8) server DSA private key in PEM +format. This file may be combined with the Postfix \fBtlsproxy\fR(8) +server DSA certificate file specified with $smtpd_tls_dcert_file. +See smtpd_tls_dkey_file for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_eccert_file (default: $smtpd_tls_eccert_file) +File with the Postfix \fBtlsproxy\fR(8) server ECDSA certificate in +PEM format. This file may also contain the Postfix \fBtlsproxy\fR(8) +server private ECDSA key. See smtpd_tls_eccert_file for further +details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_eckey_file (default: $smtpd_tls_eckey_file) +File with the Postfix \fBtlsproxy\fR(8) server ECDSA private key in +PEM format. This file may be combined with the Postfix \fBtlsproxy\fR(8) +server ECDSA certificate file specified with $smtpd_tls_eccert_file. +See smtpd_tls_eckey_file for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_eecdh_grade (default: $smtpd_tls_eecdh_grade) +The Postfix \fBtlsproxy\fR(8) server security grade for ephemeral +elliptic-curve Diffie-Hellman (EECDH) key exchange. See +smtpd_tls_eecdh_grade for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_exclude_ciphers (default: $smtpd_tls_exclude_ciphers) +List of ciphers or cipher types to exclude from the \fBtlsproxy\fR(8) +server cipher list at all TLS security levels. See +smtpd_tls_exclude_ciphers for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_fingerprint_digest (default: $smtpd_tls_fingerprint_digest) +The message digest algorithm used to construct client-certificate +fingerprints. See smtpd_tls_fingerprint_digest for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_key_file (default: $smtpd_tls_key_file) +File with the Postfix \fBtlsproxy\fR(8) server RSA private key in PEM +format. This file may be combined with the Postfix \fBtlsproxy\fR(8) +server RSA certificate file specified with $smtpd_tls_cert_file. +See smtpd_tls_key_file for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_loglevel (default: $smtpd_tls_loglevel) +Enable additional Postfix \fBtlsproxy\fR(8) server logging of TLS +activity. Each logging level also includes the information that +is logged at a lower logging level. See smtpd_tls_loglevel for +further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_mandatory_ciphers (default: $smtpd_tls_mandatory_ciphers) +The minimum TLS cipher grade that the Postfix \fBtlsproxy\fR(8) server +will use with mandatory TLS encryption. See smtpd_tls_mandatory_ciphers +for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_mandatory_exclude_ciphers (default: $smtpd_tls_mandatory_exclude_ciphers) +Additional list of ciphers or cipher types to exclude from the +\fBtlsproxy\fR(8) server cipher list at mandatory TLS security levels. +See smtpd_tls_mandatory_exclude_ciphers for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_mandatory_protocols (default: $smtpd_tls_mandatory_protocols) +The SSL/TLS protocols accepted by the Postfix \fBtlsproxy\fR(8) server +with mandatory TLS encryption. If the list is empty, the server +supports all available SSL/TLS protocol versions. See +smtpd_tls_mandatory_protocols for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_protocols (default: $smtpd_tls_protocols) +List of TLS protocols that the Postfix \fBtlsproxy\fR(8) server will +exclude or include with opportunistic TLS encryption. See +smtpd_tls_protocols for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_req_ccert (default: $smtpd_tls_req_ccert) +With mandatory TLS encryption, require a trusted remote SMTP +client certificate in order to allow TLS connections to proceed. +See smtpd_tls_req_ccert for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_security_level (default: $smtpd_tls_security_level) +The SMTP TLS security level for the Postfix \fBtlsproxy\fR(8) server; +when a non-empty value is specified, this overrides the obsolete +parameters smtpd_use_tls and smtpd_enforce_tls. See +smtpd_tls_security_level for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_tls_session_cache_timeout (default: $smtpd_tls_session_cache_timeout) +The expiration time of Postfix \fBtlsproxy\fR(8) server TLS session +cache information. A cache cleanup is performed periodically every +$smtpd_tls_session_cache_timeout seconds. See +smtpd_tls_session_cache_timeout for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_use_tls (default: $smtpd_use_tls) +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. See smtpd_use_tls +for further details. +.PP +This feature is available in Postfix 2.8 and later. +.SH tlsproxy_watchdog_timeout (default: 10s) +How much time a \fBtlsproxy\fR(8) process may take to process local +or remote I/O before it is terminated by a built-in watchdog timer. +This is a safety mechanism that prevents \fBtlsproxy\fR(8) from becoming +non-responsive due to a bug in Postfix itself or in system software. +To avoid false alarms and unnecessary cache corruption this limit +cannot be set under 10s. +.PP +Specify a non-zero time value (an integral value plus an optional +one-letter suffix that specifies the time unit). Time units: s +(seconds), m (minutes), h (hours), d (days), w (weeks). +.PP +This feature is available in Postfix 2.8. .SH trace_service_name (default: trace) The name of the trace service. This service is implemented by the \fBbounce\fR(8) daemon and maintains a record diff --git a/postfix/man/man8/postscreen.8 b/postfix/man/man8/postscreen.8 index 7ff72096d..f8acab135 100644 --- a/postfix/man/man8/postscreen.8 +++ b/postfix/man/man8/postscreen.8 @@ -4,7 +4,7 @@ .SH NAME postscreen \- -Postfix SMTP triage server +Postfix zombie blocker .SH "SYNOPSIS" .na .nf @@ -51,8 +51,19 @@ can be run chrooted at fixed low privilege. .SH "STANDARDS" .na .nf -RFC 5321 (SMTP, including multi-line 220 greetings) +RFC 821 (SMTP protocol) +RFC 1123 (Host requirements) +RFC 1652 (8bit-MIME transport) +RFC 1869 (SMTP service extensions) +RFC 1870 (Message Size Declaration) +RFC 1985 (ETRN command) +RFC 2034 (SMTP Enhanced Error Codes) +RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) +RFC 3207 (STARTTLS command) +RFC 3461 (SMTP DSN Extension) +RFC 3463 (Enhanced Status Codes) +RFC 5321 (SMTP protocol, including multi-line 220 greetings) .SH DIAGNOSTICS .ad .fi @@ -61,9 +72,9 @@ Problems and transactions are logged to \fBsyslogd\fR(8). .ad .fi The \fBpostscreen\fR(8) built-in SMTP protocol engine -currently does not announce support for STARTTLS, AUTH, -XCLIENT or XFORWARD. -Support for STARTTLS and AUTH may be added in the future. +currently does not announce support for AUTH, XCLIENT or +XFORWARD. +Support for AUTH may be added in the future. In the mean time, if you need to make these services available on port 25, then do not enable the optional "after 220 server greeting" tests. @@ -93,11 +104,27 @@ change. The text below provides only a parameter summary. See \fBpostconf\fR(5) for more details including examples. -NOTE: Some \fBpostscreen\fR(8) parameters implement +NOTE: Some \fBpostscreen\fR(8) parameters implement stress-dependent behavior. This is supported only when the -default value is stress-dependent (that is, it looks like -${stress?X}${stress:Y}). Other parameters always evaluate -as if the stress value is the empty string. +default parameter value is stress-dependent (that is, it +looks like ${stress?X}${stress:Y}, or it is the $\fIname\fR +of an smtpd parameter with a stress-dependent default). +Other parameters always evaluate as if the \fBstress\fR +parameter value is the empty string. +.SH "COMPATIBILITY CONTROLS" +.na +.nf +.ad +.fi +.IP "\fBpostscreen_discard_ehlo_keyword_address_maps ($smtpd_discard_ehlo_keyword_address_maps)\fR" +Lookup tables, indexed by the remote SMTP client address, with +case insensitive lists of EHLO keywords (pipelining, starttls, auth, +etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO response +to a remote SMTP client. +.IP "\fBpostscreen_discard_ehlo_keywords ($smtpd_discard_ehlo_keywords)\fR" +A case insensitive list of EHLO keywords (pipelining, starttls, +auth, etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO +response to a remote SMTP client. .SH "TRIAGE PARAMETERS" .na .nf @@ -230,6 +257,28 @@ process. How much time a \fBpostscreen\fR(8) process may take to respond to an SMTP client command or to perform a cache operation before it is terminated by a built-in watchdog timer. +.SH "STARTTLS CONTROLS" +.na +.nf +.ad +.fi +.IP "\fBpostscreen_tls_security_level ($smtpd_tls_security_level)\fR" +The SMTP TLS security level for the \fBpostscreen\fR(8) server; when +a non-empty value is specified, this overrides the obsolete parameters +postscreen_use_tls and postscreen_enforce_tls. +.SH "OBSOLETE STARTTLS SUPPORT CONTROLS" +.na +.nf +.ad +.fi +These parameters are supported for compatibility with +\fBsmtpd\fR(8) legacy parameters. +.IP "\fBpostscreen_use_tls ($smtpd_use_tls)\fR" +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. +.IP "\fBpostscreen_enforce_tls ($smtpd_enforce_tls)\fR" +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. .SH "MISCELLANEOUS CONTROLS" .na .nf @@ -262,6 +311,7 @@ records, so that "smtpd" becomes, for example, "postfix/smtpd". .na .nf smtpd(8), Postfix SMTP server +tlsproxy(8), Postfix TLS proxy server dnsblog(8), temporary DNS helper syslogd(8), system logging .SH "README FILES" diff --git a/postfix/man/man8/smtp.8 b/postfix/man/man8/smtp.8 index 79c14c9b2..524edb3d5 100644 --- a/postfix/man/man8/smtp.8 +++ b/postfix/man/man8/smtp.8 @@ -443,6 +443,10 @@ Available in Postfix version 2.7 and later: Try to detect a mail hijacking attack based on a TLS protocol vulnerability (CVE-2009-3555), where an attacker prepends malicious HELO, MAIL, RCPT, DATA commands to a Postfix SMTP client TLS session. +.PP +Available in Postfix version 2.8 and later: +.IP "\fBtls_disable_workarounds (see 'postconf -d' output)\fR" +List or bit-mask of OpenSSL bug work-arounds to disable. .SH "OBSOLETE STARTTLS CONTROLS" .na .nf diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index 378605914..1dd8cc5ae 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -451,6 +451,13 @@ ephemeral ECDH key exchange. .IP "\fBtls_eecdh_ultra_curve (secp384r1)\fR" The elliptic curve used by the SMTP server for maximally strong ephemeral ECDH key exchange. +.PP +Available in Postfix version 2.8 and later: +.IP "\fBtls_preempt_cipherlist (no)\fR" +With SSLv3 and later, use the server's cipher preference order +instead of the client's cipher preference order. +.IP "\fBtls_disable_workarounds (see 'postconf -d' output)\fR" +List or bit-mask of OpenSSL bug work-arounds to disable. .SH "OBSOLETE STARTTLS CONTROLS" .na .nf diff --git a/postfix/man/man8/tlsproxy.8 b/postfix/man/man8/tlsproxy.8 new file mode 100644 index 000000000..aaf65762d --- /dev/null +++ b/postfix/man/man8/tlsproxy.8 @@ -0,0 +1,215 @@ +.TH TLSPROXY 8 +.ad +.fi +.SH NAME +tlsproxy +\- +Postfix TLS proxy +.SH "SYNOPSIS" +.na +.nf +\fBtlsproxy\fR [generic Postfix daemon options] +.SH DESCRIPTION +.ad +.fi +The \fBtlsproxy\fR(8) server implements a server-side TLS +proxy. Its primary use is to talk plaintext SMTP with +\fBpostscreen\fR(8), and to talk SMTP-over-TLS with remote +SMTP clients whose whitelist status has expired, but it +should also work for non-SMTP protocols. + +Although one \fBtlsproxy\fR(8) process can serve multiple +sessions at the same time, it is a good idea to allow the +number of processes to increase with load, so that the +service remains available. +.SH "PROTOCOL EXAMPLE" +.na +.nf +.ad +.fi +The example below involves \fBpostscreen\fR(8). However, +the \fBtlsproxy\fR(8) server is agnostic of the application +protocol, and the example is easily adapted to other +applications. + +The \fBpostscreen\fR(8) server sends the remote SMTP client +endpoint string, the requested role (server), and the +requested timeout to \fBtlsproxy\fR(8). \fBpostscreen\fR(8) +then receives a "TLS available" indication from \fBtlsproxy\fR(8). +If the TLS service is available, \fBpostscreen\fR(8) sends +the remote SMTP client file descriptor to \fBtlsproxy\fR(8), +and sends the plaintext 220 greeting to the remote SMTP +client. This triggers TLS negotiations between the remote +SMTP client and \fBtlsproxy\fR(8). Upon completion of the +TLS-level handshake, \fBtlsproxy\fR(8) translates between +plaintext from/to \fBpostscreen\fR(8) and ciphertext to/from +the remote SMTP client. +.SH "SECURITY" +.na +.nf +.ad +.fi +The \fBtlsproxy\fR(8) server is moderately security-sensitive. +It talks to untrusted clients on the network. The process +can be run chrooted at fixed low privilege. +.SH DIAGNOSTICS +.ad +.fi +Problems and transactions are logged to \fBsyslogd\fR(8). +.SH "CONFIGURATION PARAMETERS" +.na +.nf +.ad +.fi +Changes to \fBmain.cf\fR are not picked up automatically, +as \fBtlsproxy\fR(8) processes may run for a long time +depending on mail server load. Use the command "\fBpostfix +reload\fR" to speed up a change. + +The text below provides only a parameter summary. See +\fBpostconf\fR(5) for more details including examples. +.SH "STARTTLS SUPPORT CONTROLS" +.na +.nf +.ad +.fi +.IP "\fBtlsproxy_tls_CAfile ($smtpd_tls_CAfile)\fR" +A file containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. +.IP "\fBtlsproxy_tls_CApath ($smtpd_tls_CApath)\fR" +A directory containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. +.IP "\fBtlsproxy_tls_always_issue_session_ids ($smtpd_tls_always_issue_session_ids)\fR" +Force the Postfix \fBtlsproxy\fR(8) server to issue a TLS session id, +even when TLS session caching is turned off. +.IP "\fBtlsproxy_tls_ask_ccert ($smtpd_tls_ask_ccert)\fR" +Ask a remote SMTP client for a client certificate. +.IP "\fBtlsproxy_tls_ccert_verifydepth ($smtpd_tls_ccert_verifydepth)\fR" +The verification depth for remote SMTP client certificates. +.IP "\fBtlsproxy_tls_cert_file ($smtpd_tls_cert_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server RSA certificate in PEM +format. +.IP "\fBtlsproxy_tls_ciphers ($smtpd_tls_ciphers)\fR" +The minimum TLS cipher grade that the Postfix \fBtlsproxy\fR(8) server +will use with opportunistic TLS encryption. +.IP "\fBtlsproxy_tls_dcert_file ($smtpd_tls_dcert_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server DSA certificate in PEM +format. +.IP "\fBtlsproxy_tls_dh1024_param_file ($smtpd_tls_dh1024_param_file)\fR" +File with DH parameters that the Postfix \fBtlsproxy\fR(8) server +should use with EDH ciphers. +.IP "\fBtlsproxy_tls_dh512_param_file ($smtpd_tls_dh512_param_file)\fR" +File with DH parameters that the Postfix \fBtlsproxy\fR(8) server +should use with EDH ciphers. +.IP "\fBtlsproxy_tls_dkey_file ($smtpd_tls_dkey_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server DSA private key in PEM +format. +.IP "\fBtlsproxy_tls_eccert_file ($smtpd_tls_eccert_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server ECDSA certificate in +PEM format. +.IP "\fBtlsproxy_tls_eckey_file ($smtpd_tls_eckey_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server ECDSA private key in +PEM format. +.IP "\fBtlsproxy_tls_eecdh_grade ($smtpd_tls_eecdh_grade)\fR" +The Postfix \fBtlsproxy\fR(8) server security grade for ephemeral +elliptic-curve Diffie-Hellman (EECDH) key exchange. +.IP "\fBtlsproxy_tls_exclude_ciphers ($smtpd_tls_exclude_ciphers)\fR" +List of ciphers or cipher types to exclude from the \fBtlsproxy\fR(8) +server cipher list at all TLS security levels. +.IP "\fBtlsproxy_tls_fingerprint_digest ($smtpd_tls_fingerprint_digest)\fR" +The message digest algorithm used to construct client-certificate +fingerprints. +.IP "\fBtlsproxy_tls_key_file ($smtpd_tls_key_file)\fR" +File with the Postfix \fBtlsproxy\fR(8) server RSA private key in PEM +format. +.IP "\fBtlsproxy_tls_loglevel ($smtpd_tls_loglevel)\fR" +Enable additional Postfix \fBtlsproxy\fR(8) server logging of TLS +activity. +.IP "\fBtlsproxy_tls_mandatory_ciphers ($smtpd_tls_mandatory_ciphers)\fR" +The minimum TLS cipher grade that the Postfix \fBtlsproxy\fR(8) server +will use with mandatory TLS encryption. +.IP "\fBtlsproxy_tls_mandatory_exclude_ciphers ($smtpd_tls_mandatory_exclude_ciphers)\fR" +Additional list of ciphers or cipher types to exclude from the +\fBtlsproxy\fR(8) server cipher list at mandatory TLS security levels. +.IP "\fBtlsproxy_tls_mandatory_protocols ($smtpd_tls_mandatory_protocols)\fR" +The SSL/TLS protocols accepted by the Postfix \fBtlsproxy\fR(8) server +with mandatory TLS encryption. +.IP "\fBtlsproxy_tls_protocols ($smtpd_tls_protocols)\fR" +List of TLS protocols that the Postfix \fBtlsproxy\fR(8) server will +exclude or include with opportunistic TLS encryption. +.IP "\fBtlsproxy_tls_req_ccert ($smtpd_tls_req_ccert)\fR" +With mandatory TLS encryption, require a trusted remote SMTP +client certificate in order to allow TLS connections to proceed. +.IP "\fBtlsproxy_tls_security_level ($smtpd_tls_security_level)\fR" +The SMTP TLS security level for the Postfix \fBtlsproxy\fR(8) server; +when a non-empty value is specified, this overrides the obsolete +parameters smtpd_use_tls and smtpd_enforce_tls. +.IP "\fBtlsproxy_tls_session_cache_timeout ($smtpd_tls_session_cache_timeout)\fR" +The expiration time of Postfix \fBtlsproxy\fR(8) server TLS session +cache information. +.SH "OBSOLETE STARTTLS SUPPORT CONTROLS" +.na +.nf +.ad +.fi +These parameters are supported for compatibility with +\fBsmtpd\fR(8) legacy parameters. +.IP "\fBtlsproxy_use_tls ($smtpd_use_tls)\fR" +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. +.IP "\fBtlsproxy_enforce_tls ($smtpd_enforce_tls)\fR" +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. +.SH "RESOURCE CONTROLS" +.na +.nf +.ad +.fi +.IP "\fBtlsproxy_watchdog_timeout (10s)\fR" +How much time a \fBtlsproxy\fR(8) process may take to process local +or remote I/O before it is terminated by a built-in watchdog timer. +.SH "MISCELLANEOUS CONTROLS" +.na +.nf +.ad +.fi +.IP "\fBconfig_directory (see 'postconf -d' output)\fR" +The default location of the Postfix main.cf and master.cf +configuration files. +.IP "\fBprocess_id (read-only)\fR" +The process ID of a Postfix command or daemon process. +.IP "\fBprocess_name (read-only)\fR" +The process name of a Postfix command or daemon process. +.IP "\fBsyslog_facility (mail)\fR" +The syslog facility of Postfix logging. +.IP "\fBsyslog_name (see 'postconf -d' output)\fR" +The mail system name that is prepended to the process name in syslog +records, so that "smtpd" becomes, for example, "postfix/smtpd". +.SH "SEE ALSO" +.na +.nf +postscreen(8), Postfix zombie blocker +smtpd(8), Postfix SMTP server +postconf(5), configuration parameters +syslogd(5), system logging +.SH "LICENSE" +.na +.nf +.ad +.fi +The Secure Mailer license must be distributed with this software. +.SH "HISTORY" +.na +.nf +.ad +.fi +This service was introduced with Postfix version 2.8. +.SH "AUTHOR(S)" +.na +.nf +Wietse Venema +IBM T.J. Watson Research +P.O. Box 704 +Yorktown Heights, NY 10598, USA diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index a20e3c207..937495de4 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -497,8 +497,8 @@ while (<>) { s;\bsmtpd_data_restrictions\b;$&;g; s;\bsmtpd_delay_open_until_valid_rcpt\b;$&;g; s;\bsmtpd_delay_reject\b;$&;g; - s;\bsmtpd_discard_ehlo_keyword_address_maps\b;$&;g; - s;\bsmtpd_discard_ehlo_keywords\b;$&;g; + s;\bsmtpd_dis[-]*\n* *[
+-CAUTION: when postscreen rejects mail, it's SMTP reply contains the +CAUTION: when postscreen rejects mail, its SMTP reply contains the DNSBL domain name. Use the postscreen_dnsbl_reply_map feature to hide "password" information in DNSBL domain names.
@@ -361,10 +361,10 @@ impact of this limitation, postscreen(8) gives deep protocol tests a relatively long expiration time.postscreen(8)'s built-in SMTP engine does not implement -the AUTH, STARTTLS, XCLIENT, and XFORWARD features. STARTTLS and -AUTH support may be added in a future version. In the mean time, -if you need to make these services available on port 25, then do -not enable the tests after the 220 server greeting.
+the AUTH, XCLIENT, and XFORWARD features. AUTH support may be added +in a future version. In the mean time, if you need to make these +services available on port 25, then do not enable the tests after +the 220 server greeting. @@ -672,6 +672,15 @@ service in master.cf. smtp inet n - n - 1 postscreen +Uncomment the new "tlsproxy unix ... tlsproxy" +service in master.cf. This service implements STARTTLS support for +postscreen(8).
+ ++/etc/postfix/master.cf: + tlsproxy unix - - n - 0 tlsproxy ++Uncomment the new "dnsblog unix ... dnsblog" service in master.cf. This service does DNSBL lookups for postscreen(8) and logs results.
@@ -775,8 +784,8 @@ disconnect.When the good client comes back in a later session, it is allowed to talk directly to a Postfix SMTP server. See "after_220 Tests after the 220 SMTP server greeting above -for limitations with STARTTLS, AUTH and other features that clients -may need.
+for limitations with AUTH and other features that clients may need. +An unexpected benefit from "deep protocol tests" is that some "good" clients don't return after the 4XX @@ -825,14 +834,23 @@ that follow.
# -o parameter=value ... +Comment out the "tlsproxy unix ... tlsproxy" +service in master.cf, including any "-o parameter=value" +entries that follow.
+ ++/etc/postfix/master.cf: + #tlsproxy unix - - n - 0 tlsproxy + # -o parameter=value ... +Uncomment the "smtp inet ... smtpd" service in master.cf, including any "-o parameter=value" entries that -follow.
+may follow./etc/postfix/master.cf: - smtp inet n - n - - smtpd + smtp inet n - n - - smtpd -o parameter=value ...diff --git a/postfix/proto/TLS_README.html b/postfix/proto/TLS_README.html index b75bf9ed0..3a7a2ffcd 100644 --- a/postfix/proto/TLS_README.html +++ b/postfix/proto/TLS_README.html @@ -27,6 +27,11 @@ code. Assuming that OpenSSL is written as carefully as Wietse's own code, every 1000 lines introduce one additional bug into Postfix. +At this time, you should no longer be using OpenSSL releases prior +to the most recent 0.9.8 release unless all relevant security fixes have +been backported to the earlier release by you or your O/S vendor. OpenSSL +0.9.7 and earlier are no longer maintained by the OpenSSL team.
+What Postfix TLS support does for you
Transport Layer Security (TLS, formerly called SSL) provides @@ -852,6 +857,25 @@ secure for most situations.
Postfix 2.8 and later, in combination with OpenSSL 0.9.7 and later +allows TLS servers to preempt the TLS client's cipher preference list. +This is only possible with SSLv3, as in SSLv2 the client chooses the +cipher from a list supplied by the server.
+ +By default, the OpenSSL server selects the client's most preferred +cipher that the server supports. With SSLv3 and later, the server +may choose its own most preferred cipher that is supported (offered) +by the client. Setting "tls_preempt_cipherlist = yes" enables server +cipher preferences. The default OpenSSL behaviour applies with +"tls_preempt_cipherlist = no".
+ +While server cipher selection may in some cases lead to a more secure +or performant cipher choice, there is some risk of interoperability +issues. In the past, some SSL clients have listed lower priority ciphers +that they did not implement correctly. If the server chooses a cipher +that the client prefers less, it may select a cipher whose client +implementation is flawed.
+The smtpd_starttls_timeout parameter limits the time of Postfix @@ -867,6 +891,30 @@ handshake procedures.
+With Postfix 2.8 and later, the tls_disable_workarounds parameter +specifies a list or bit-mask of OpenSSL bug work-arounds to disable. This +may be necessary if one of the work-arounds enabled by default in +OpenSSL proves to pose a security risk, or introduces an unexpected +interoperability issue. Some bug work-arounds known to be problematic +are disabled in the default value of the parameter when linked with +an OpenSSL library that could be vulnerable.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_disable_workarounds = 0xFFFFFFFF + tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT ++
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this +time, lots of servers are still unpatched and Postfix is not +significantly vulnerable to the renegotiation issue in the TLS +protocol.
+Topics covered in this section:
diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index cb9fe1bf4..0a44cfdfc 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -9072,10 +9072,12 @@ smtpd_tls_dh512_param_file = /etc/postfix/dh_512.pemThis feature is available with Postfix version 2.2.
-%PARAM smtpd_starttls_timeout 300s +%PARAM smtpd_starttls_timeout see "postconf -d" outputThe time limit for Postfix SMTP server write and read operations -during TLS startup and shutdown handshake procedures.
+during TLS startup and shutdown handshake procedures. The current +default value is stress-dependent. Before Postfix version 2.8, it +was fixed at 300s.This feature is available in Postfix 2.2 and later.
@@ -13457,3 +13459,366 @@ Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks). The default time unit is s (seconds). +%PARAM tls_preempt_cipherlist no + +With SSLv3 and later, use the server's cipher preference order +instead of the client's cipher preference order.
+ +By default, the OpenSSL server selects the client's most preferred +cipher that the server supports. With SSLv3 and later, the server may +choose its own most preferred cipher that is supported (offered) by +the client. Setting "tls_preempt_cipherlist = yes" enables server cipher +preferences.
+ +While server cipher selection may in some cases lead to a more secure +or performant cipher choice, there is some risk of interoperability +issues. In the past, some SSL clients have listed lower priority ciphers +that they did not implement correctly. If the server chooses a cipher +that the client prefers less, it may select a cipher whose client +implementation is flawed.
+ +This feature is available in Postfix 2.8 and later, in combination +with OpenSSL 0.9.7 and later.
+ +%PARAM tls_disable_workarounds see "postconf -d" output + +List or bit-mask of OpenSSL bug work-arounds to disable.
+ +The OpenSSL toolkit includes a set of work-arounds for buggy SSL/TLS +implementations. Applications, such as Postfix, that want to maximize +interoperability ask the OpenSSL library to enable the full set of +recommended work-arounds.
+ +From time to time, it is discovered that a work-around creates a +security issue, and should no longer be used. If upgrading OpenSSL +to a fixed version is not an option or an upgrade is not available +in a timely manner, or in closed environments where no buggy clients +or servers exist, it may be appropriate to disable some or all of the +OpenSSL interoperability work-arounds. This parameter specifies which +bug work-arounds to disable.
+ +If the value of the parameter is a hexadecimal long integer starting +with "0x", the bug work-arounds corresponding to the bits specified in +its value are removed from the SSL_OP_ALL work-around bit-mask +(see openssl/ssl.h and SSL_CTX_set_options(3)). You can specify more +bits than are present in SSL_OP_ALL, excess bits are ignored. Specifying +0xFFFFFFFF disables all bug-workarounds on a 32-bit system. This should +also be sufficient on 64-bit systems, until OpenSSL abandons support +for 32-bit systems and starts using the high 32 bits of a 64-bit +bug-workaround mask.
+ +Otherwise, the parameter is a white-space or comma separated list +of specific named bug work-arounds chosen from the list below. It +is possible that your OpenSSL version includes new bug work-arounds +added after your Postfix source code was last updated, in that case +you can only disable one of these via the hexadecimal syntax above.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_watchdog_timeout 10s + +How much time a tlsproxy(8) process may take to process local +or remote I/O before it is terminated by a built-in watchdog timer. +This is a safety mechanism that prevents tlsproxy(8) from becoming +non-responsive due to a bug in Postfix itself or in system software. +To avoid false alarms and unnecessary cache corruption this limit +cannot be set under 10s.
+ +Specify a non-zero time value (an integral value plus an optional +one-letter suffix that specifies the time unit). Time units: s +(seconds), m (minutes), h (hours), d (days), w (weeks).
+ +This feature is available in Postfix 2.8.
+ +%PARAM postscreen_discard_ehlo_keywords $smtpd_discard_ehlo_keywords + +A case insensitive list of EHLO keywords (pipelining, starttls, +auth, etc.) that the postscreen(8) server will not send in the EHLO +response to a remote SMTP client. See smtpd_discard_ehlo_keywords +for details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM postscreen_discard_ehlo_keyword_address_maps $smtpd_discard_ehlo_keyword_address_maps + +Lookup tables, indexed by the remote SMTP client address, with +case insensitive lists of EHLO keywords (pipelining, starttls, auth, +etc.) that the postscreen(8) server will not send in the EHLO response +to a remote SMTP client. See smtpd_discard_ehlo_keywords for details. +The table is not searched by hostname for robustness reasons.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM postscreen_use_tls $smtpd_use_tls + +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption.
+ +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead.
+ +%PARAM postscreen_enforce_tls $smtpd_enforce_tls + +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_postscreen_enforce_tls +for details.
+ +This feature is available in Postfix 2.8 and later. +Preferably, use postscreen_tls_security_level instead.
+ +%PARAM postscreen_tls_security_level $smtpd_tls_security_level + +The SMTP TLS security level for the postscreen(8) server; when +a non-empty value is specified, this overrides the obsolete parameters +postscreen_use_tls and postscreen_enforce_tls. See smtpd_tls_security_level +for details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_enforce_tls $smtpd_enforce_tls + +Mandatory TLS: announce STARTTLS support to SMTP clients, and +require that clients use TLS encryption. See smtpd_enforce_tls for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_CAfile $smtpd_tls_CAfile + +A file containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CAfile for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_CApath $smtpd_tls_CApath + +A directory containing (PEM format) CA certificates of root CAs +trusted to sign either remote SMTP client certificates or intermediate +CA certificates. See smtpd_tls_CApath for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_always_issue_session_ids $smtpd_tls_always_issue_session_ids + +Force the Postfix tlsproxy(8) server to issue a TLS session id, +even when TLS session caching is turned off. See +smtpd_tls_always_issue_session_ids for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_ask_ccert $smtpd_tls_ask_ccert + +Ask a remote SMTP client for a client certificate. See +smtpd_tls_ask_ccert for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_ccert_verifydepth $smtpd_tls_ccert_verifydepth + +The verification depth for remote SMTP client certificates. A +depth of 1 is sufficient if the issuing CA is listed in a local CA +file. See smtpd_tls_ccert_verifydepth for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_cert_file $smtpd_tls_cert_file + +File with the Postfix tlsproxy(8) server RSA certificate in PEM +format. This file may also contain the Postfix tlsproxy(8) server +private RSA key. See smtpd_tls_cert_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_ciphers $smtpd_tls_ciphers + +The minimum TLS cipher grade that the Postfix tlsproxy(8) server +will use with opportunistic TLS encryption. See smtpd_tls_ciphers +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_dcert_file $smtpd_tls_dcert_file + +File with the Postfix tlsproxy(8) server DSA certificate in PEM +format. This file may also contain the Postfix tlsproxy(8) server +private DSA key. See smtpd_tls_dcert_file for further details. +
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_dh1024_param_file $smtpd_tls_dh1024_param_file + +File with DH parameters that the Postfix tlsproxy(8) server +should use with EDH ciphers. See smtpd_tls_dh1024_param_file for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_dh512_param_file $smtpd_tls_dh512_param_file + +File with DH parameters that the Postfix tlsproxy(8) server +should use with EDH ciphers. See smtpd_tls_dh512_param_file for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_dkey_file $smtpd_tls_dkey_file + +File with the Postfix tlsproxy(8) server DSA private key in PEM +format. This file may be combined with the Postfix tlsproxy(8) +server DSA certificate file specified with $smtpd_tls_dcert_file. +See smtpd_tls_dkey_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_eccert_file $smtpd_tls_eccert_file + +File with the Postfix tlsproxy(8) server ECDSA certificate in +PEM format. This file may also contain the Postfix tlsproxy(8) +server private ECDSA key. See smtpd_tls_eccert_file for further +details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_eckey_file $smtpd_tls_eckey_file + +File with the Postfix tlsproxy(8) server ECDSA private key in +PEM format. This file may be combined with the Postfix tlsproxy(8) +server ECDSA certificate file specified with $smtpd_tls_eccert_file. +See smtpd_tls_eckey_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_eecdh_grade $smtpd_tls_eecdh_grade + +The Postfix tlsproxy(8) server security grade for ephemeral +elliptic-curve Diffie-Hellman (EECDH) key exchange. See +smtpd_tls_eecdh_grade for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_exclude_ciphers $smtpd_tls_exclude_ciphers + +List of ciphers or cipher types to exclude from the tlsproxy(8) +server cipher list at all TLS security levels. See +smtpd_tls_exclude_ciphers for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_fingerprint_digest $smtpd_tls_fingerprint_digest + +The message digest algorithm used to construct client-certificate +fingerprints. See smtpd_tls_fingerprint_digest for further details. +
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_key_file $smtpd_tls_key_file + +File with the Postfix tlsproxy(8) server RSA private key in PEM +format. This file may be combined with the Postfix tlsproxy(8) +server RSA certificate file specified with $smtpd_tls_cert_file. +See smtpd_tls_key_file for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_loglevel $smtpd_tls_loglevel + +Enable additional Postfix tlsproxy(8) server logging of TLS +activity. Each logging level also includes the information that +is logged at a lower logging level. See smtpd_tls_loglevel for +further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_mandatory_ciphers $smtpd_tls_mandatory_ciphers + +The minimum TLS cipher grade that the Postfix tlsproxy(8) server +will use with mandatory TLS encryption. See smtpd_tls_mandatory_ciphers +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_mandatory_exclude_ciphers $smtpd_tls_mandatory_exclude_ciphers + +Additional list of ciphers or cipher types to exclude from the +tlsproxy(8) server cipher list at mandatory TLS security levels. +See smtpd_tls_mandatory_exclude_ciphers for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_mandatory_protocols $smtpd_tls_mandatory_protocols + +The SSL/TLS protocols accepted by the Postfix tlsproxy(8) server +with mandatory TLS encryption. If the list is empty, the server +supports all available SSL/TLS protocol versions. See +smtpd_tls_mandatory_protocols for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_protocols $smtpd_tls_protocols + +List of TLS protocols that the Postfix tlsproxy(8) server will +exclude or include with opportunistic TLS encryption. See +smtpd_tls_protocols for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_req_ccert $smtpd_tls_req_ccert + +With mandatory TLS encryption, require a trusted remote SMTP +client certificate in order to allow TLS connections to proceed. +See smtpd_tls_req_ccert for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_security_level $smtpd_tls_security_level + +The SMTP TLS security level for the Postfix tlsproxy(8) server; +when a non-empty value is specified, this overrides the obsolete +parameters smtpd_use_tls and smtpd_enforce_tls. See +smtpd_tls_security_level for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_tls_session_cache_timeout $smtpd_tls_session_cache_timeout + +The expiration time of Postfix tlsproxy(8) server TLS session +cache information. A cache cleanup is performed periodically every +$smtpd_tls_session_cache_timeout seconds. See +smtpd_tls_session_cache_timeout for further details.
+ +This feature is available in Postfix 2.8 and later.
+ +%PARAM tlsproxy_use_tls $smtpd_use_tls + +Opportunistic TLS: announce STARTTLS support to SMTP clients, +but do not require that clients use TLS encryption. See smtpd_use_tls +for further details.
+ +This feature is available in Postfix 2.8 and later.
+ diff --git a/postfix/src/global/ehlo_mask.c b/postfix/src/global/ehlo_mask.c index d7501934b..9c60dc749 100644 --- a/postfix/src/global/ehlo_mask.c +++ b/postfix/src/global/ehlo_mask.c @@ -90,7 +90,7 @@ int ehlo_mask(const char *mask_str) * can switch between Postfix versions without trouble. */ return (name_mask_opt("ehlo string mask", ehlo_mask_table, - mask_str, NAME_MASK_ANY_CASE)); + mask_str, NAME_MASK_ANY_CASE | NAME_MASK_IGNORE)); } /* str_ehlo_mask - mask to string */ diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index c88067ebd..a0796063b 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -1137,7 +1137,7 @@ extern char *var_smtpd_banner; extern int var_smtpd_tmout; #define VAR_SMTPD_STARTTLS_TMOUT "smtpd_starttls_timeout" -#define DEF_SMTPD_STARTTLS_TMOUT "300s" +#define DEF_SMTPD_STARTTLS_TMOUT "${stress?10}${stress:300}s" extern int var_smtpd_starttls_tmout; #define VAR_SMTPD_RCPT_LIMIT "smtpd_recipient_limit" @@ -2988,6 +2988,39 @@ extern char *var_tls_eecdh_strong; #define DEF_TLS_EECDH_ULTRA "secp384r1" extern char *var_tls_eecdh_ultra; +#define VAR_TLS_PREEMPT_CLIST "tls_preempt_cipherlist" +#define DEF_TLS_PREEMPT_CLIST 0 +extern bool var_tls_preempt_clist; + +#ifdef USE_TLS + + /* + * The tweak for CVE-2005-2969 is needed in some versions prior to 1.0.0 + */ +#if (OPENSSL_VERSION_NUMBER < 0x1000000fL) +#define TLS_BUG_TWEAK_A " CVE-2005-2969" +#else +#define TLS_BUG_TWEAK_A "" +#endif + + /* + * The tweak for CVE-2010-4180 is needed in some versions prior to 1.0.1 + */ +#if (OPENSSL_VERSION_NUMBER < 0x1000100fL) +#define TLS_BUG_TWEAK_B " CVE-2010-4180" +#else +#define TLS_BUG_TWEAK_B " " +#endif + +#else /* USE_TLS */ +#define TLS_BUG_TWEAK_A "" +#define TLS_BUG_TWEAK_B " " +#endif /* USE_TLS */ + +#define VAR_TLS_BUG_TWEAKS "tls_disable_workarounds" +#define DEF_TLS_BUG_TWEAKS ((TLS_BUG_TWEAK_A TLS_BUG_TWEAK_B)+1) +extern char *var_tls_bug_tweaks; + /* * Sendmail-style mail filter support. */ @@ -3226,154 +3259,301 @@ extern char *var_multi_cntrl_cmds; /* * postscreen(8) */ -#define VAR_PS_CACHE_MAP "postscreen_cache_map" -#define DEF_PS_CACHE_MAP "btree:$data_directory/ps_cache" -extern char *var_ps_cache_map; +#define VAR_PSC_CACHE_MAP "postscreen_cache_map" +#define DEF_PSC_CACHE_MAP "btree:$data_directory/psc_cache" +extern char *var_psc_cache_map; #define VAR_SMTPD_SERVICE "smtpd_service" #define DEF_SMTPD_SERVICE "smtpd" extern char *var_smtpd_service; -#define VAR_PS_POST_QLIMIT "postscreen_post_queue_limit" -#define DEF_PS_POST_QLIMIT "$" VAR_PROC_LIMIT -extern int var_ps_post_queue_limit; +#define VAR_PSC_POST_QLIMIT "postscreen_post_queue_limit" +#define DEF_PSC_POST_QLIMIT "$" VAR_PROC_LIMIT +extern int var_psc_post_queue_limit; + +#define VAR_PSC_PRE_QLIMIT "postscreen_pre_queue_limit" +#define DEF_PSC_PRE_QLIMIT "$" VAR_PROC_LIMIT +extern int var_psc_pre_queue_limit; + +#define VAR_PSC_CACHE_RET "postscreen_cache_retention_time" +#define DEF_PSC_CACHE_RET "7d" +extern int var_psc_cache_ret; + +#define VAR_PSC_CACHE_SCAN "postscreen_cache_cleanup_interval" +#define DEF_PSC_CACHE_SCAN "12h" +extern int var_psc_cache_scan; -#define VAR_PS_PRE_QLIMIT "postscreen_pre_queue_limit" -#define DEF_PS_PRE_QLIMIT "$" VAR_PROC_LIMIT -extern int var_ps_pre_queue_limit; +#define VAR_PSC_GREET_WAIT "postscreen_greet_wait" +#define DEF_PSC_GREET_WAIT "${stress?2}${stress:6}s" +extern int var_psc_greet_wait; -#define VAR_PS_CACHE_RET "postscreen_cache_retention_time" -#define DEF_PS_CACHE_RET "7d" -extern int var_ps_cache_ret; +#define VAR_PSC_PREGR_BANNER "postscreen_greet_banner" +#define DEF_PSC_PREGR_BANNER "$" VAR_SMTPD_BANNER +extern char *var_psc_pregr_banner; -#define VAR_PS_CACHE_SCAN "postscreen_cache_cleanup_interval" -#define DEF_PS_CACHE_SCAN "12h" -extern int var_ps_cache_scan; +#define VAR_PSC_PREGR_ENABLE "postscreen_greet_enable" +#define DEF_PSC_PREGR_ENABLE no +extern char *var_psc_pregr_enable; -#define VAR_PS_GREET_WAIT "postscreen_greet_wait" -#define DEF_PS_GREET_WAIT "${stress?2}${stress:6}s" -extern int var_ps_greet_wait; +#define VAR_PSC_PREGR_ACTION "postscreen_greet_action" +#define DEF_PSC_PREGR_ACTION "ignore" +extern char *var_psc_pregr_action; -#define VAR_PS_PREGR_BANNER "postscreen_greet_banner" -#define DEF_PS_PREGR_BANNER "$" VAR_SMTPD_BANNER -extern char *var_ps_pregr_banner; +#define VAR_PSC_PREGR_TTL "postscreen_greet_ttl" +#define DEF_PSC_PREGR_TTL "1d" +extern int var_psc_pregr_ttl; -#define VAR_PS_PREGR_ENABLE "postscreen_greet_enable" -#define DEF_PS_PREGR_ENABLE no -extern char *var_ps_pregr_enable; +#define VAR_PSC_DNSBL_SITES "postscreen_dnsbl_sites" +#define DEF_PSC_DNSBL_SITES "" +extern char *var_psc_dnsbl_sites; -#define VAR_PS_PREGR_ACTION "postscreen_greet_action" -#define DEF_PS_PREGR_ACTION "ignore" -extern char *var_ps_pregr_action; +#define VAR_PSC_DNSBL_THRESH "postscreen_dnsbl_threshold" +#define DEF_PSC_DNSBL_THRESH 1 +extern int var_psc_dnsbl_thresh; -#define VAR_PS_PREGR_TTL "postscreen_greet_ttl" -#define DEF_PS_PREGR_TTL "1d" -extern int var_ps_pregr_ttl; +#define VAR_PSC_DNSBL_ENABLE "postscreen_dnsbl_enable" +#define DEF_PSC_DNSBL_ENABLE 0 +extern char *var_psc_dnsbl_enable; -#define VAR_PS_DNSBL_SITES "postscreen_dnsbl_sites" -#define DEF_PS_DNSBL_SITES "" -extern char *var_ps_dnsbl_sites; +#define VAR_PSC_DNSBL_ACTION "postscreen_dnsbl_action" +#define DEF_PSC_DNSBL_ACTION "ignore" +extern char *var_psc_dnsbl_action; -#define VAR_PS_DNSBL_THRESH "postscreen_dnsbl_threshold" -#define DEF_PS_DNSBL_THRESH 1 -extern int var_ps_dnsbl_thresh; +#define VAR_PSC_DNSBL_TTL "postscreen_dnsbl_ttl" +#define DEF_PSC_DNSBL_TTL "1h" +extern int var_psc_dnsbl_ttl; -#define VAR_PS_DNSBL_ENABLE "postscreen_dnsbl_enable" -#define DEF_PS_DNSBL_ENABLE 0 -extern char *var_ps_dnsbl_enable; +#define VAR_PSC_DNSBL_REPLY "postscreen_dnsbl_reply_map" +#define DEF_PSC_DNSBL_REPLY "" +extern char *var_psc_dnsbl_reply; -#define VAR_PS_DNSBL_ACTION "postscreen_dnsbl_action" -#define DEF_PS_DNSBL_ACTION "ignore" -extern char *var_ps_dnsbl_action; +#define VAR_PSC_PIPEL_ENABLE "postscreen_pipelining_enable" +#define DEF_PSC_PIPEL_ENABLE 0 +extern bool var_psc_pipel_enable; -#define VAR_PS_DNSBL_TTL "postscreen_dnsbl_ttl" -#define DEF_PS_DNSBL_TTL "1h" -extern int var_ps_dnsbl_ttl; +#define VAR_PSC_PIPEL_ACTION "postscreen_pipelining_action" +#define DEF_PSC_PIPEL_ACTION "enforce" +extern char *var_psc_pipel_action; -#define VAR_PS_DNSBL_REPLY "postscreen_dnsbl_reply_map" -#define DEF_PS_DNSBL_REPLY "" -extern char *var_ps_dnsbl_reply; +#define VAR_PSC_PIPEL_TTL "postscreen_pipelining_ttl" +#define DEF_PSC_PIPEL_TTL "30d" +extern int var_psc_pipel_ttl; -#define VAR_PS_PIPEL_ENABLE "postscreen_pipelining_enable" -#define DEF_PS_PIPEL_ENABLE 0 -extern bool var_ps_pipel_enable; +#define VAR_PSC_NSMTP_ENABLE "postscreen_non_smtp_command_enable" +#define DEF_PSC_NSMTP_ENABLE 0 +extern bool var_psc_nsmtp_enable; -#define VAR_PS_PIPEL_ACTION "postscreen_pipelining_action" -#define DEF_PS_PIPEL_ACTION "enforce" -extern char *var_ps_pipel_action; +#define VAR_PSC_NSMTP_ACTION "postscreen_non_smtp_command_action" +#define DEF_PSC_NSMTP_ACTION "drop" +extern char *var_psc_nsmtp_action; -#define VAR_PS_PIPEL_TTL "postscreen_pipelining_ttl" -#define DEF_PS_PIPEL_TTL "30d" -extern int var_ps_pipel_ttl; +#define VAR_PSC_NSMTP_TTL "postscreen_non_smtp_command_ttl" +#define DEF_PSC_NSMTP_TTL "30d" +extern int var_psc_nsmtp_ttl; -#define VAR_PS_NSMTP_ENABLE "postscreen_non_smtp_command_enable" -#define DEF_PS_NSMTP_ENABLE 0 -extern bool var_ps_nsmtp_enable; +#define VAR_PSC_BARLF_ENABLE "postscreen_bare_newline_enable" +#define DEF_PSC_BARLF_ENABLE 0 +extern bool var_psc_barlf_enable; -#define VAR_PS_NSMTP_ACTION "postscreen_non_smtp_command_action" -#define DEF_PS_NSMTP_ACTION "drop" -extern char *var_ps_nsmtp_action; +#define VAR_PSC_BARLF_ACTION "postscreen_bare_newline_action" +#define DEF_PSC_BARLF_ACTION "ignore" +extern char *var_psc_barlf_action; -#define VAR_PS_NSMTP_TTL "postscreen_non_smtp_command_ttl" -#define DEF_PS_NSMTP_TTL "30d" -extern int var_ps_nsmtp_ttl; +#define VAR_PSC_BARLF_TTL "postscreen_bare_newline_ttl" +#define DEF_PSC_BARLF_TTL "30d" +extern int var_psc_barlf_ttl; -#define VAR_PS_BARLF_ENABLE "postscreen_bare_newline_enable" -#define DEF_PS_BARLF_ENABLE 0 -extern bool var_ps_barlf_enable; +#define VAR_PSC_WLIST_NETS "postscreen_whitelist_networks" +#define DEF_PSC_WLIST_NETS "$" VAR_MYNETWORKS +extern char *var_psc_wlist_nets; -#define VAR_PS_BARLF_ACTION "postscreen_bare_newline_action" -#define DEF_PS_BARLF_ACTION "ignore" -extern char *var_ps_barlf_action; +#define VAR_PSC_BLIST_NETS "postscreen_blacklist_networks" +#define DEF_PSC_BLIST_NETS "" +extern char *var_psc_blist_nets; -#define VAR_PS_BARLF_TTL "postscreen_bare_newline_ttl" -#define DEF_PS_BARLF_TTL "30d" -extern int var_ps_barlf_ttl; +#define VAR_PSC_BLIST_ACTION "postscreen_blacklist_action" +#define DEF_PSC_BLIST_ACTION "ignore" +extern char *var_psc_blist_nets; -#define VAR_PS_WLIST_NETS "postscreen_whitelist_networks" -#define DEF_PS_WLIST_NETS "$" VAR_MYNETWORKS -extern char *var_ps_wlist_nets; +#define VAR_PSC_CMD_COUNT "postscreen_command_count_limit" +#define DEF_PSC_CMD_COUNT 20 +extern int var_psc_cmd_count; -#define VAR_PS_BLIST_NETS "postscreen_blacklist_networks" -#define DEF_PS_BLIST_NETS "" -extern char *var_ps_blist_nets; +#define VAR_PSC_CMD_TIME "postscreen_command_time_limit" +#define DEF_PSC_CMD_TIME DEF_SMTPD_TMOUT +extern char *var_psc_cmd_time; -#define VAR_PS_BLIST_ACTION "postscreen_blacklist_action" -#define DEF_PS_BLIST_ACTION "ignore" -extern char *var_ps_blist_nets; +#define VAR_PSC_WATCHDOG "postscreen_watchdog_timeout" +#define DEF_PSC_WATCHDOG "10s" +extern int var_psc_watchdog; -#define VAR_PS_CMD_COUNT "postscreen_command_count_limit" -#define DEF_PS_CMD_COUNT 20 -extern int var_ps_cmd_count; +#define VAR_PSC_EHLO_DIS_WORDS "postscreen_discard_ehlo_keywords" +#define DEF_PSC_EHLO_DIS_WORDS "$" VAR_SMTPD_EHLO_DIS_WORDS +extern char *var_psc_ehlo_dis_words; -#define VAR_PS_CMD_TIME "postscreen_command_time_limit" -#define DEF_PS_CMD_TIME DEF_SMTPD_TMOUT -extern char *var_ps_cmd_time; +#define VAR_PSC_EHLO_DIS_MAPS "postscreen_discard_ehlo_keyword_address_maps" +#define DEF_PSC_EHLO_DIS_MAPS "$" VAR_SMTPD_EHLO_DIS_MAPS +extern char *var_psc_ehlo_dis_maps; -#define VAR_PS_WATCHDOG "postscreen_watchdog_timeout" -#define DEF_PS_WATCHDOG "10s" -extern int var_ps_watchdog; +#define VAR_PSC_TLS_LEVEL "postscreen_tls_security_level" +#define DEF_PSC_TLS_LEVEL "$" VAR_SMTPD_TLS_LEVEL +extern char *var_psc_tls_level; -#define VAR_PS_FORBID_CMDS "postscreen_forbidden_commands" -#define DEF_PS_FORBID_CMDS "$" VAR_SMTPD_FORBID_CMDS -extern char *var_ps_forbid_cmds; +#define VAR_PSC_USE_TLS "postscreen_use_tls" +#define DEF_PSC_USE_TLS "$" VAR_SMTPD_USE_TLS +extern bool var_psc_use_tls; -#define VAR_PS_HELO_REQUIRED "postscreen_helo_required" -#define DEF_PS_HELO_REQUIRED "$" VAR_HELO_REQUIRED -extern bool var_ps_helo_required; +#define VAR_PSC_ENFORCE_TLS "postscreen_enforce_tls" +#define DEF_PSC_ENFORCE_TLS "$" VAR_SMTPD_ENFORCE_TLS +extern bool var_psc_enforce_tls; -#define VAR_PS_DISABLE_VRFY "postscreen_disable_vrfy_command" -#define DEF_PS_DISABLE_VRFY "$" VAR_DISABLE_VRFY_CMD -extern bool var_ps_disable_vrfy; +#define VAR_PSC_FORBID_CMDS "postscreen_forbidden_commands" +#define DEF_PSC_FORBID_CMDS "$" VAR_SMTPD_FORBID_CMDS +extern char *var_psc_forbid_cmds; -#define VAR_PS_CCONN_LIMIT "postscreen_client_connection_count_limit" -#define DEF_PS_CCONN_LIMIT "$" VAR_SMTPD_CCONN_LIMIT -extern int var_ps_cconn_limit; +#define VAR_PSC_HELO_REQUIRED "postscreen_helo_required" +#define DEF_PSC_HELO_REQUIRED "$" VAR_HELO_REQUIRED +extern bool var_psc_helo_required; + +#define VAR_PSC_DISABLE_VRFY "postscreen_disable_vrfy_command" +#define DEF_PSC_DISABLE_VRFY "$" VAR_DISABLE_VRFY_CMD +extern bool var_psc_disable_vrfy; + +#define VAR_PSC_CCONN_LIMIT "postscreen_client_connection_count_limit" +#define DEF_PSC_CCONN_LIMIT "$" VAR_SMTPD_CCONN_LIMIT +extern int var_psc_cconn_limit; #define VAR_DNSBLOG_DELAY "dnsblog_reply_delay" #define DEF_DNSBLOG_DELAY "0s" extern int var_dnsblog_delay; +#define VAR_TLSP_WATCHDOG "tlsproxy_watchdog_timeout" +#define DEF_TLSP_WATCHDOG "10s" +extern int var_tlsp_watchdog; + +#define VAR_TLSP_TLS_LEVEL "tlsproxy_tls_security_level" +#define DEF_TLSP_TLS_LEVEL "$" VAR_SMTPD_TLS_LEVEL +extern char *var_tlsp_tls_level; + +#define VAR_TLSP_USE_TLS "tlsproxy_use_tls" +#define DEF_TLSP_USE_TLS "$" VAR_SMTPD_USE_TLS +extern bool var_tlsp_use_tls; + +#define VAR_TLSP_ENFORCE_TLS "tlsproxy_enforce_tls" +#define DEF_TLSP_ENFORCE_TLS "$" VAR_SMTPD_ENFORCE_TLS +extern bool var_tlsp_enforce_tls; + +#define VAR_TLSP_TLS_ACERT "tlsproxy_tls_ask_ccert" +#define DEF_TLSP_TLS_ACERT "$" VAR_SMTPD_TLS_ACERT +extern bool var_tlsp_tls_ask_ccert; + +#define VAR_TLSP_TLS_RCERT "tlsproxy_tls_req_ccert" +#define DEF_TLSP_TLS_RCERT "$" VAR_SMTPD_TLS_RCERT +extern bool var_tlsp_tls_req_ccert; + +#define VAR_TLSP_TLS_CCERT_VD "tlsproxy_tls_ccert_verifydepth" +#define DEF_TLSP_TLS_CCERT_VD "$" VAR_SMTPD_TLS_CCERT_VD +extern int var_tlsp_tls_ccert_vd; + +#define VAR_TLSP_TLS_CERT_FILE "tlsproxy_tls_cert_file" +#define DEF_TLSP_TLS_CERT_FILE "$" VAR_SMTPD_TLS_CERT_FILE +extern char *var_tlsp_tls_cert_file; + +#define VAR_TLSP_TLS_KEY_FILE "tlsproxy_tls_key_file" +#define DEF_TLSP_TLS_KEY_FILE "$" VAR_SMTPD_TLS_KEY_FILE +extern char *var_tlsp_tls_key_file; + +#define VAR_TLSP_TLS_DCERT_FILE "tlsproxy_tls_dcert_file" +#define DEF_TLSP_TLS_DCERT_FILE "$" VAR_SMTPD_TLS_DCERT_FILE +extern char *var_tlsp_tls_dcert_file; + +#define VAR_TLSP_TLS_DKEY_FILE "tlsproxy_tls_dkey_file" +#define DEF_TLSP_TLS_DKEY_FILE "$" VAR_SMTPD_TLS_DKEY_FILE +extern char *var_tlsp_tls_dkey_file; + +#define VAR_TLSP_TLS_ECCERT_FILE "tlsproxy_tls_eccert_file" +#define DEF_TLSP_TLS_ECCERT_FILE "$" VAR_SMTPD_TLS_ECCERT_FILE +extern char *var_tlsp_tls_eccert_file; + +#define VAR_TLSP_TLS_ECKEY_FILE "tlsproxy_tls_eckey_file" +#define DEF_TLSP_TLS_ECKEY_FILE "$" VAR_SMTPD_TLS_ECKEY_FILE +extern char *var_tlsp_tls_eckey_file; + +#define DEF_TLSP_TLS_ECKEY_FILE "$" VAR_SMTPD_TLS_ECKEY_FILE +extern char *var_tlsp_tls_eckey_file; + +#define VAR_TLSP_TLS_CA_FILE "tlsproxy_tls_CAfile" +#define DEF_TLSP_TLS_CA_FILE "$" VAR_SMTPD_TLS_CA_FILE +extern char *var_tlsp_tls_CAfile; + +#define VAR_TLSP_TLS_CA_PATH "tlsproxy_tls_CApath" +#define DEF_TLSP_TLS_CA_PATH "$" VAR_SMTPD_TLS_CA_PATH +extern char *var_tlsp_tls_CApath; + +#define VAR_TLSP_TLS_PROTO "tlsproxy_tls_protocols" +#define DEF_TLSP_TLS_PROTO "$" VAR_SMTPD_TLS_PROTO +extern char *var_tlsp_tls_proto; + +#define VAR_TLSP_TLS_MAND_PROTO "tlsproxy_tls_mandatory_protocols" +#define DEF_TLSP_TLS_MAND_PROTO "$" VAR_SMTPD_TLS_MAND_PROTO +extern char *var_tlsp_tls_mand_proto; + +#define VAR_TLSP_TLS_CIPH "tlsproxy_tls_ciphers" +#define DEF_TLSP_TLS_CIPH "$" VAR_SMTPD_TLS_CIPH +extern char *var_tlsp_tls_ciph; + +#define VAR_TLSP_TLS_MAND_CIPH "tlsproxy_tls_mandatory_ciphers" +#define DEF_TLSP_TLS_MAND_CIPH "$" VAR_SMTPD_TLS_MAND_CIPH +extern char *var_tlsp_tls_mand_ciph; + +#define VAR_TLSP_TLS_EXCL_CIPH "tlsproxy_tls_exclude_ciphers" +#define DEF_TLSP_TLS_EXCL_CIPH "$" VAR_SMTPD_TLS_EXCL_CIPH +extern char *var_tlsp_tls_excl_ciph; + +#define VAR_TLSP_TLS_MAND_EXCL "tlsproxy_tls_mandatory_exclude_ciphers" +#define DEF_TLSP_TLS_MAND_EXCL "$" VAR_SMTPD_TLS_MAND_EXCL +extern char *var_tlsp_tls_mand_excl; + +#define VAR_TLSP_TLS_FPT_DGST "tlsproxy_tls_fingerprint_digest" +#define DEF_TLSP_TLS_FPT_DGST "$" VAR_SMTPD_TLS_FPT_DGST +extern char *var_tlsp_tls_fpt_dgst; + +#define VAR_TLSP_TLS_512_FILE "tlsproxy_tls_dh512_param_file" +#define DEF_TLSP_TLS_512_FILE "$" VAR_SMTPD_TLS_512_FILE +extern char *var_tlsp_tls_dh512_param_file; + +#define VAR_TLSP_TLS_1024_FILE "tlsproxy_tls_dh1024_param_file" +#define DEF_TLSP_TLS_1024_FILE "$" VAR_SMTPD_TLS_1024_FILE +extern char *var_tlsp_tls_dh1024_param_file; + +#define VAR_TLSP_TLS_EECDH "tlsproxy_tls_eecdh_grade" +#ifdef SNAPSHOT +#define DEF_TLSP_TLS_EECDH "$" VAR_SMTPD_TLS_EECDH +#else +#define DEF_TLSP_TLS_EECDH "$" VAR_SMTPD_TLS_EECDH +#endif +extern char *var_tlsp_tls_eecdh; + +#define VAR_TLSP_TLS_LOGLEVEL "tlsproxy_tls_loglevel" +#define DEF_TLSP_TLS_LOGLEVEL "$" VAR_SMTPD_TLS_LOGLEVEL +extern int var_tlsp_tls_loglevel; + +#define VAR_TLSP_TLS_RECHEAD "tlsproxy_tls_received_header" +#define DEF_TLSP_TLS_RECHEAD "$" VAR_SMTPD_TLS_RECHEAD +extern bool var_tlsp_tls_received_header; + +#define VAR_TLSP_TLS_SCACHE_DB "tlsproxy_tls_session_cache_database" +#define DEF_TLSP_TLS_SCACHE_DB "$" VAR_SMTPD_TLS_SCACHE_DB +extern char *var_tlsp_tls_scache_db; + +#define VAR_TLSP_TLS_SCACHTIME "tlsproxy_tls_session_cache_timeout" +#define DEF_TLSP_TLS_SCACHTIME "$" VAR_SMTPD_TLS_SCACHTIME +extern int var_tlsp_tls_scache_timeout; + +#define VAR_TLSP_TLS_SET_SESSID "tlsproxy_tls_always_issue_session_ids" +#define DEF_TLSP_TLS_SET_SESSID "$" VAR_SMTPD_TLS_SET_SESSID +extern bool var_tlsp_tls_set_sessid; + /* LICENSE /* .ad /* .fi diff --git a/postfix/src/global/mail_proto.h b/postfix/src/global/mail_proto.h index c8b0e6a58..c3c97b5ad 100644 --- a/postfix/src/global/mail_proto.h +++ b/postfix/src/global/mail_proto.h @@ -236,6 +236,15 @@ extern char *mail_pathname(const char *, const char *); #define MAIL_ATTR_DSN_NOTIFY "notify_flags" /* dsn notify flags */ #define MAIL_ATTR_DSN_ORCPT "dsn_orig_rcpt" /* dsn original recipient */ + /* + * PROXY support. + */ +#define MAIL_ATTR_REMOTE_ENDPT "remote_endpoint" /* name[addr]:port */ +#define MAIL_ATTR_ROLE "role" /* requested role */ +#define MAIL_ATTR_ROLE_SERVER "server" +#define MAIL_ATTR_ROLE_CLIENT "client" +#define MAIL_ATTR_TIMEOUT "timeout" + /* LICENSE /* .ad /* .fi diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 0f4ffef58..c1e99f217 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 "20101217" +#define MAIL_RELEASE_DATE "20110102" #define MAIL_VERSION_NUMBER "2.8" #ifdef SNAPSHOT diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index b2ed31094..1e5f2f7ff 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -260,7 +260,7 @@ /* oqmgr(8), old Postfix queue manager /* pickup(8), Postfix local mail pickup /* pipe(8), deliver mail to non-Postfix command -/* postscreen(8), Postfix SMTP triage server +/* postscreen(8), Postfix zombie blocker /* proxymap(8), Postfix lookup table proxy server /* qmgr(8), Postfix queue manager /* qmqpd(8), Postfix QMQP server @@ -270,6 +270,7 @@ /* smtpd(8), Postfix SMTP server /* spawn(8), run non-Postfix server /* tlsmgr(8), Postfix TLS cache and randomness manager +/* tlsproxy(8), Postfix TLS proxy server /* trivial-rewrite(8), Postfix address rewriting /* verify(8), Postfix address verification /* virtual(8), Postfix virtual delivery agent diff --git a/postfix/src/postscreen/Makefile.in b/postfix/src/postscreen/Makefile.in index 227e211a5..b856fc5ff 100644 --- a/postfix/src/postscreen/Makefile.in +++ b/postfix/src/postscreen/Makefile.in @@ -1,10 +1,12 @@ SHELL = /bin/sh SRCS = postscreen.c postscreen_dict.c postscreen_dnsbl.c \ postscreen_early.c postscreen_smtpd.c postscreen_misc.c \ - postscreen_state.c postscreen_tests.c postscreen_send.c + postscreen_state.c postscreen_tests.c postscreen_send.c \ + postscreen_starttls.c OBJS = postscreen.o postscreen_dict.o postscreen_dnsbl.o \ postscreen_early.o postscreen_smtpd.o postscreen_misc.o \ - postscreen_state.o postscreen_tests.o postscreen_send.o + postscreen_state.o postscreen_tests.o postscreen_send.o \ + postscreen_starttls.o HDRS = TESTSRC = DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) @@ -12,7 +14,8 @@ CFLAGS = $(DEBUG) $(OPT) $(DEFS) TESTPROG= PROG = postscreen INC_DIR = ../../include -LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a +LIBS = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libglobal.a \ + ../../lib/libutil.a .c.o:; $(CC) $(CFLAGS) -c $*.c @@ -192,24 +195,52 @@ postscreen_smtpd.o: ../../include/argv.h postscreen_smtpd.o: ../../include/attr.h postscreen_smtpd.o: ../../include/dict.h postscreen_smtpd.o: ../../include/dict_cache.h +postscreen_smtpd.o: ../../include/ehlo_mask.h postscreen_smtpd.o: ../../include/events.h postscreen_smtpd.o: ../../include/htable.h postscreen_smtpd.o: ../../include/iostuff.h postscreen_smtpd.o: ../../include/is_header.h postscreen_smtpd.o: ../../include/mail_params.h postscreen_smtpd.o: ../../include/mail_proto.h +postscreen_smtpd.o: ../../include/maps.h postscreen_smtpd.o: ../../include/match_list.h postscreen_smtpd.o: ../../include/match_ops.h postscreen_smtpd.o: ../../include/msg.h postscreen_smtpd.o: ../../include/mymalloc.h +postscreen_smtpd.o: ../../include/name_code.h +postscreen_smtpd.o: ../../include/name_mask.h postscreen_smtpd.o: ../../include/string_list.h postscreen_smtpd.o: ../../include/stringops.h postscreen_smtpd.o: ../../include/sys_defs.h +postscreen_smtpd.o: ../../include/tls.h postscreen_smtpd.o: ../../include/vbuf.h postscreen_smtpd.o: ../../include/vstream.h postscreen_smtpd.o: ../../include/vstring.h postscreen_smtpd.o: postscreen.h postscreen_smtpd.o: postscreen_smtpd.c +postscreen_starttls.o: ../../include/addr_match_list.h +postscreen_starttls.o: ../../include/argv.h +postscreen_starttls.o: ../../include/attr.h +postscreen_starttls.o: ../../include/connect.h +postscreen_starttls.o: ../../include/dict.h +postscreen_starttls.o: ../../include/dict_cache.h +postscreen_starttls.o: ../../include/events.h +postscreen_starttls.o: ../../include/htable.h +postscreen_starttls.o: ../../include/iostuff.h +postscreen_starttls.o: ../../include/mail_params.h +postscreen_starttls.o: ../../include/mail_proto.h +postscreen_starttls.o: ../../include/match_list.h +postscreen_starttls.o: ../../include/match_ops.h +postscreen_starttls.o: ../../include/msg.h +postscreen_starttls.o: ../../include/mymalloc.h +postscreen_starttls.o: ../../include/string_list.h +postscreen_starttls.o: ../../include/stringops.h +postscreen_starttls.o: ../../include/sys_defs.h +postscreen_starttls.o: ../../include/vbuf.h +postscreen_starttls.o: ../../include/vstream.h +postscreen_starttls.o: ../../include/vstring.h +postscreen_starttls.o: postscreen.h +postscreen_starttls.o: postscreen_starttls.c postscreen_state.o: ../../include/addr_match_list.h postscreen_state.o: ../../include/argv.h postscreen_state.o: ../../include/attr.h diff --git a/postfix/src/postscreen/postscreen.c b/postfix/src/postscreen/postscreen.c index fed34fb4f..f40f25e01 100644 --- a/postfix/src/postscreen/postscreen.c +++ b/postfix/src/postscreen/postscreen.c @@ -2,7 +2,7 @@ /* NAME /* postscreen 8 /* SUMMARY -/* Postfix SMTP triage server +/* Postfix zombie blocker /* SYNOPSIS /* \fBpostscreen\fR [generic Postfix daemon options] /* DESCRIPTION @@ -41,15 +41,26 @@ /* It talks to untrusted clients on the network. The process /* can be run chrooted at fixed low privilege. /* STANDARDS -/* RFC 5321 (SMTP, including multi-line 220 greetings) +/* RFC 821 (SMTP protocol) +/* RFC 1123 (Host requirements) +/* RFC 1652 (8bit-MIME transport) +/* RFC 1869 (SMTP service extensions) +/* RFC 1870 (Message Size Declaration) +/* RFC 1985 (ETRN command) +/* RFC 2034 (SMTP Enhanced Error Codes) +/* RFC 2821 (SMTP protocol) /* RFC 2920 (SMTP Pipelining) +/* RFC 3207 (STARTTLS command) +/* RFC 3461 (SMTP DSN Extension) +/* RFC 3463 (Enhanced Status Codes) +/* RFC 5321 (SMTP protocol, including multi-line 220 greetings) /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* BUGS /* The \fBpostscreen\fR(8) built-in SMTP protocol engine -/* currently does not announce support for STARTTLS, AUTH, -/* XCLIENT or XFORWARD. -/* Support for STARTTLS and AUTH may be added in the future. +/* currently does not announce support for AUTH, XCLIENT or +/* XFORWARD. +/* Support for AUTH may be added in the future. /* In the mean time, if you need to make these services available /* on port 25, then do not enable the optional "after 220 /* server greeting" tests. @@ -77,11 +88,25 @@ /* The text below provides only a parameter summary. See /* \fBpostconf\fR(5) for more details including examples. /* -/* NOTE: Some \fBpostscreen\fR(8) parameters implement +/* NOTE: Some \fBpostscreen\fR(8) parameters implement /* stress-dependent behavior. This is supported only when the -/* default value is stress-dependent (that is, it looks like -/* ${stress?X}${stress:Y}). Other parameters always evaluate -/* as if the stress value is the empty string. +/* default parameter value is stress-dependent (that is, it +/* looks like ${stress?X}${stress:Y}, or it is the $\fIname\fR +/* of an smtpd parameter with a stress-dependent default). +/* Other parameters always evaluate as if the \fBstress\fR +/* parameter value is the empty string. +/* COMPATIBILITY CONTROLS +/* .ad +/* .fi +/* .IP "\fBpostscreen_discard_ehlo_keyword_address_maps ($smtpd_discard_ehlo_keyword_address_maps)\fR" +/* Lookup tables, indexed by the remote SMTP client address, with +/* case insensitive lists of EHLO keywords (pipelining, starttls, auth, +/* etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO response +/* to a remote SMTP client. +/* .IP "\fBpostscreen_discard_ehlo_keywords ($smtpd_discard_ehlo_keywords)\fR" +/* A case insensitive list of EHLO keywords (pipelining, starttls, +/* auth, etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO +/* response to a remote SMTP client. /* TRIAGE PARAMETERS /* .ad /* .fi @@ -208,6 +233,24 @@ /* How much time a \fBpostscreen\fR(8) process may take to respond to /* an SMTP client command or to perform a cache operation before it /* is terminated by a built-in watchdog timer. +/* STARTTLS CONTROLS +/* .ad +/* .fi +/* .IP "\fBpostscreen_tls_security_level ($smtpd_tls_security_level)\fR" +/* The SMTP TLS security level for the \fBpostscreen\fR(8) server; when +/* a non-empty value is specified, this overrides the obsolete parameters +/* postscreen_use_tls and postscreen_enforce_tls. +/* OBSOLETE STARTTLS SUPPORT CONTROLS +/* .ad +/* .fi +/* These parameters are supported for compatibility with +/* \fBsmtpd\fR(8) legacy parameters. +/* .IP "\fBpostscreen_use_tls ($smtpd_use_tls)\fR" +/* Opportunistic TLS: announce STARTTLS support to SMTP clients, +/* but do not require that clients use TLS encryption. +/* .IP "\fBpostscreen_enforce_tls ($smtpd_enforce_tls)\fR" +/* Mandatory TLS: announce STARTTLS support to SMTP clients, and +/* require that clients use TLS encryption. /* MISCELLANEOUS CONTROLS /* .ad /* .fi @@ -236,6 +279,7 @@ /* records, so that "smtpd" becomes, for example, "postfix/smtpd". /* SEE ALSO /* smtpd(8), Postfix SMTP server +/* tlsproxy(8), Postfix TLS proxy server /* dnsblog(8), temporary DNS helper /* syslogd(8), system logging /* README FILES @@ -303,93 +347,105 @@ int var_proc_limit; char *var_smtpd_service; char *var_smtpd_banner; -char *var_smtpd_forbid_cmds; bool var_disable_vrfy_cmd; bool var_helo_required; -char *var_ps_forbid_cmds; - -bool var_ps_disable_vrfy; -bool var_ps_helo_required; - -char *var_ps_cache_map; -int var_ps_cache_scan; -int var_ps_cache_ret; -int var_ps_post_queue_limit; -int var_ps_pre_queue_limit; -int var_ps_watchdog; - -char *var_ps_wlist_nets; -char *var_ps_blist_nets; -char *var_ps_blist_action; - -char *var_ps_greet_ttl; -int var_ps_greet_wait; - -char *var_ps_pregr_banner; -char *var_ps_pregr_action; -int var_ps_pregr_ttl; - -char *var_ps_dnsbl_sites; -char *var_ps_dnsbl_reply; -int var_ps_dnsbl_thresh; -char *var_ps_dnsbl_action; -int var_ps_dnsbl_ttl; - -bool var_ps_pipel_enable; -char *var_ps_pipel_action; -int var_ps_pipel_ttl; - -bool var_ps_nsmtp_enable; -char *var_ps_nsmtp_action; -int var_ps_nsmtp_ttl; - -bool var_ps_barlf_enable; -char *var_ps_barlf_action; -int var_ps_barlf_ttl; - -int var_ps_cmd_count; -char *var_ps_cmd_time; +char *var_smtpd_forbid_cmds; +char *var_psc_forbid_cmds; + +char *var_smtpd_ehlo_dis_words; +char *var_smtpd_ehlo_dis_maps; +char *var_psc_ehlo_dis_words; +char *var_psc_ehlo_dis_maps; + +char *var_smtpd_tls_level; +bool var_smtpd_use_tls; +bool var_smtpd_enforce_tls; +char *var_psc_tls_level; +bool var_psc_use_tls; +bool var_psc_enforce_tls; + +bool var_psc_disable_vrfy; +bool var_psc_helo_required; + +char *var_psc_cache_map; +int var_psc_cache_scan; +int var_psc_cache_ret; +int var_psc_post_queue_limit; +int var_psc_pre_queue_limit; +int var_psc_watchdog; + +char *var_psc_wlist_nets; +char *var_psc_blist_nets; +char *var_psc_blist_action; + +char *var_psc_greet_ttl; +int var_psc_greet_wait; + +char *var_psc_pregr_banner; +char *var_psc_pregr_action; +int var_psc_pregr_ttl; + +char *var_psc_dnsbl_sites; +char *var_psc_dnsbl_reply; +int var_psc_dnsbl_thresh; +char *var_psc_dnsbl_action; +int var_psc_dnsbl_ttl; + +bool var_psc_pipel_enable; +char *var_psc_pipel_action; +int var_psc_pipel_ttl; + +bool var_psc_nsmtp_enable; +char *var_psc_nsmtp_action; +int var_psc_nsmtp_ttl; + +bool var_psc_barlf_enable; +char *var_psc_barlf_action; +int var_psc_barlf_ttl; + +int var_psc_cmd_count; +char *var_psc_cmd_time; int var_smtpd_cconn_limit; -int var_ps_cconn_limit; +int var_psc_cconn_limit; /* * Global variables. */ -int ps_check_queue_length; /* connections being checked */ -int ps_post_queue_length; /* being sent to real SMTPD */ -DICT_CACHE *ps_cache_map; /* cache table handle */ -VSTRING *ps_temp; /* scratchpad */ -char *ps_smtpd_service_name; /* path to real SMTPD */ -int ps_pregr_action; /* PS_ACT_DROP/ENFORCE/etc */ -int ps_dnsbl_action; /* PS_ACT_DROP/ENFORCE/etc */ -int ps_pipel_action; /* PS_ACT_DROP/ENFORCE/etc */ -int ps_nsmtp_action; /* PS_ACT_DROP/ENFORCE/etc */ -int ps_barlf_action; /* PS_ACT_DROP/ENFORCE/etc */ -int ps_min_ttl; /* Update with new tests! */ -int ps_max_ttl; /* Update with new tests! */ -STRING_LIST *ps_forbid_cmds; /* CONNECT GET POST */ -int ps_stress_greet_wait; /* stressed greet wait */ -int ps_normal_greet_wait; /* stressed greet wait */ -int ps_stress_cmd_time_limit; /* stressed command limit */ -int ps_normal_cmd_time_limit; /* normal command time limit */ -int ps_stress; /* stress level */ -int ps_check_queue_length_lowat; /* stress low-water mark */ -int ps_check_queue_length_hiwat; /* stress high-water mark */ -DICT *ps_dnsbl_reply; /* DNSBL name mapper */ -HTABLE *ps_client_concurrency; /* per-client concurrency */ +int psc_check_queue_length; /* connections being checked */ +int psc_post_queue_length; /* being sent to real SMTPD */ +DICT_CACHE *psc_cache_map; /* cache table handle */ +VSTRING *psc_temp; /* scratchpad */ +char *psc_smtpd_service_name; /* path to real SMTPD */ +int psc_pregr_action; /* PSC_ACT_DROP/ENFORCE/etc */ +int psc_dnsbl_action; /* PSC_ACT_DROP/ENFORCE/etc */ +int psc_pipel_action; /* PSC_ACT_DROP/ENFORCE/etc */ +int psc_nsmtp_action; /* PSC_ACT_DROP/ENFORCE/etc */ +int psc_barlf_action; /* PSC_ACT_DROP/ENFORCE/etc */ +int psc_min_ttl; /* Update with new tests! */ +int psc_max_ttl; /* Update with new tests! */ +STRING_LIST *psc_forbid_cmds; /* CONNECT GET POST */ +int psc_stress_greet_wait; /* stressed greet wait */ +int psc_normal_greet_wait; /* stressed greet wait */ +int psc_stress_cmd_time_limit; /* stressed command limit */ +int psc_normal_cmd_time_limit; /* normal command time limit */ +int psc_stress; /* stress level */ +int psc_check_queue_length_lowat; /* stress low-water mark */ +int psc_check_queue_length_hiwat; /* stress high-water mark */ +DICT *psc_dnsbl_reply; /* DNSBL name mapper */ +HTABLE *psc_client_concurrency; /* per-client concurrency */ /* * Local variables. */ -static ADDR_MATCH_LIST *ps_wlist_nets; /* permanently whitelisted networks */ -static ADDR_MATCH_LIST *ps_blist_nets; /* permanently blacklisted networks */ -static int ps_blist_action; /* PS_ACT_DROP/ENFORCE/etc */ +static ADDR_MATCH_LIST *psc_wlist_nets; /* permanently whitelisted networks */ +static ADDR_MATCH_LIST *psc_blist_nets; /* permanently blacklisted networks */ +static int psc_blist_action; /* PSC_ACT_DROP/ENFORCE/etc */ -/* ps_dump - dump some statistics before exit */ +/* psc_dump - dump some statistics before exit */ -static void ps_dump(void) +static void psc_dump(void) { /* @@ -398,15 +454,15 @@ static void ps_dump(void) * distinguish between "postfix reload" (we should restart) or "maximal * idle time reached" (we could finish the cache cleanup first). */ - if (ps_cache_map) { - dict_cache_close(ps_cache_map); - ps_cache_map = 0; + if (psc_cache_map) { + dict_cache_close(psc_cache_map); + psc_cache_map = 0; } } -/* ps_drain - delayed exit after "postfix reload" */ +/* psc_drain - delayed exit after "postfix reload" */ -static void ps_drain(char *unused_service, char **unused_argv) +static void psc_drain(char *unused_service, char **unused_argv) { int count; @@ -427,9 +483,9 @@ static void ps_drain(char *unused_service, char **unused_argv) * XXX Some Berkeley DB versions break with close-after-fork. Every new * version is an improvement over its predecessor. */ - if (ps_cache_map != 0) { - dict_cache_close(ps_cache_map); - ps_cache_map = 0; + if (psc_cache_map != 0) { + dict_cache_close(psc_cache_map); + psc_cache_map = 0; } for (count = 0; /* see below */ ; count++) { if (count >= 5) { @@ -444,14 +500,14 @@ static void ps_drain(char *unused_service, char **unused_argv) } } -/* ps_service - handle new client connection */ +/* psc_service - handle new client connection */ -static void ps_service(VSTREAM *smtp_client_stream, - char *unused_service, - char **unused_argv) +static void psc_service(VSTREAM *smtp_client_stream, + char *unused_service, + char **unused_argv) { - const char *myname = "ps_service"; - PS_STATE *state; + const char *myname = "psc_service"; + PSC_STATE *state; struct sockaddr_storage addr_storage; SOCKADDR_SIZE addr_storage_len = sizeof(addr_storage); MAI_HOSTADDR_STR smtp_client_addr; @@ -475,7 +531,7 @@ static void ps_service(VSTREAM *smtp_client_stream, * connections so we have to invoke getpeername() to find out the remote * address and port. */ -#define PS_SERVICE_DISCONNECT_AND_RETURN(stream) do { \ +#define PSC_SERVICE_DISCONNECT_AND_RETURN(stream) do { \ event_server_disconnect(stream); \ return; \ } while (0); @@ -486,10 +542,10 @@ static void ps_service(VSTREAM *smtp_client_stream, if (getpeername(vstream_fileno(smtp_client_stream), (struct sockaddr *) & addr_storage, &addr_storage_len) < 0) { msg_warn("getpeername: %m -- dropping this connection"); - ps_send_reply(vstream_fileno(smtp_client_stream), - "unknown_address", "unknown_port", - "421 4.3.2 No system resources\r\n"); - PS_SERVICE_DISCONNECT_AND_RETURN(smtp_client_stream); + psc_send_reply(vstream_fileno(smtp_client_stream), + "unknown_address", "unknown_port", + "421 4.3.2 No system resources\r\n"); + PSC_SERVICE_DISCONNECT_AND_RETURN(smtp_client_stream); } /* @@ -502,17 +558,17 @@ static void ps_service(VSTREAM *smtp_client_stream, msg_warn("cannot convert client address/port to string: %s" " -- dropping this connection", MAI_STRERROR(aierr)); - ps_send_reply(vstream_fileno(smtp_client_stream), - "unknown_address", "unknown_port", - "421 4.3.2 No system resources\r\n"); - PS_SERVICE_DISCONNECT_AND_RETURN(smtp_client_stream); + psc_send_reply(vstream_fileno(smtp_client_stream), + "unknown_address", "unknown_port", + "421 4.3.2 No system resources\r\n"); + PSC_SERVICE_DISCONNECT_AND_RETURN(smtp_client_stream); } if (strncasecmp("::ffff:", smtp_client_addr.buf, 7) == 0) memmove(smtp_client_addr.buf, smtp_client_addr.buf + 7, sizeof(smtp_client_addr.buf) - 7); if (msg_verbose > 1) msg_info("%s: sq=%d cq=%d connect from [%s]:%s", - myname, ps_post_queue_length, ps_check_queue_length, + myname, psc_post_queue_length, psc_check_queue_length, smtp_client_addr.buf, smtp_client_port.buf); msg_info("CONNECT from [%s]:%s", smtp_client_addr.buf, smtp_client_port.buf); @@ -521,30 +577,30 @@ static void ps_service(VSTREAM *smtp_client_stream, * Bundle up all the loose session pieces. This zeroes all flags and time * stamps. */ - state = ps_new_session_state(smtp_client_stream, smtp_client_addr.buf, - smtp_client_port.buf); + state = psc_new_session_state(smtp_client_stream, smtp_client_addr.buf, + smtp_client_port.buf); /* * Reply with 421 when the client has too many open connections. */ - if (var_ps_cconn_limit > 0 - && state->client_concurrency > var_ps_cconn_limit) { + if (var_psc_cconn_limit > 0 + && state->client_concurrency > var_psc_cconn_limit) { msg_info("NOQUEUE: reject: CONNECT from [%s]:%s: too many connections", state->smtp_client_addr, state->smtp_client_port); - PS_DROP_SESSION_STATE(state, - "421 4.7.0 Error: too many connections\r\n"); + PSC_DROP_SESSION_STATE(state, + "421 4.7.0 Error: too many connections\r\n"); return; } /* * Reply with 421 when we can't forward more connections. */ - if (var_ps_post_queue_limit > 0 - && ps_post_queue_length >= var_ps_post_queue_limit) { + if (var_psc_post_queue_limit > 0 + && psc_post_queue_length >= var_psc_post_queue_limit) { msg_info("NOQUEUE: reject: CONNECT from [%s]:%s: all server ports busy", state->smtp_client_addr, state->smtp_client_port); - PS_DROP_SESSION_STATE(state, - "421 4.3.2 All server ports are busy\r\n"); + PSC_DROP_SESSION_STATE(state, + "421 4.3.2 All server ports are busy\r\n"); return; } @@ -552,10 +608,10 @@ static void ps_service(VSTREAM *smtp_client_stream, * The permanent whitelist has highest precedence (never block mail from * whitelisted sites, and never run tests against those sites). */ - if (ps_wlist_nets != 0 - && ps_addr_match_list_match(ps_wlist_nets, state->smtp_client_addr)) { - msg_info("WHITELISTED [%s]:%s", PS_CLIENT_ADDR_PORT(state)); - ps_conclude(state); + if (psc_wlist_nets != 0 + && psc_addr_match_list_match(psc_wlist_nets, state->smtp_client_addr)) { + msg_info("WHITELISTED [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); + psc_conclude(state); return; } @@ -564,26 +620,26 @@ static void ps_service(VSTREAM *smtp_client_stream, * permanently blacklisted, send some generic reply and hang up * immediately, or run more tests for logging purposes. */ - if (ps_blist_nets != 0 - && ps_addr_match_list_match(ps_blist_nets, state->smtp_client_addr)) { - msg_info("BLACKLISTED [%s]:%s", PS_CLIENT_ADDR_PORT(state)); - PS_FAIL_SESSION_STATE(state, PS_STATE_FLAG_BLIST_FAIL); - switch (ps_blist_action) { - case PS_ACT_DROP: - PS_DROP_SESSION_STATE(state, + if (psc_blist_nets != 0 + && psc_addr_match_list_match(psc_blist_nets, state->smtp_client_addr)) { + msg_info("BLACKLISTED [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); + PSC_FAIL_SESSION_STATE(state, PSC_STATE_FLAG_BLIST_FAIL); + switch (psc_blist_action) { + case PSC_ACT_DROP: + PSC_DROP_SESSION_STATE(state, "521 5.3.2 Service currently unavailable\r\n"); return; - case PS_ACT_ENFORCE: - PS_ENFORCE_SESSION_STATE(state, + case PSC_ACT_ENFORCE: + PSC_ENFORCE_SESSION_STATE(state, "550 5.3.2 Service currently unavailable\r\n"); break; - case PS_ACT_IGNORE: - PS_UNFAIL_SESSION_STATE(state, PS_STATE_FLAG_BLIST_FAIL); - /* Not: PS_PASS_SESSION_STATE. Repeat this test the next time. */ + case PSC_ACT_IGNORE: + PSC_UNFAIL_SESSION_STATE(state, PSC_STATE_FLAG_BLIST_FAIL); + /* Not: PSC_PASS_SESSION_STATE. Repeat this test the next time. */ break; default: msg_panic("%s: unknown blacklist action value %d", - myname, ps_blist_action); + myname, psc_blist_action); } } @@ -593,38 +649,39 @@ static void ps_service(VSTREAM *smtp_client_stream, * tests. Whitelist the client when all enabled test results are still * valid. */ - if ((state->flags & PS_STATE_MASK_ANY_FAIL) == 0 - && ps_cache_map != 0 - && (stamp_str = ps_cache_lookup(ps_cache_map, state->smtp_client_addr)) != 0) { + if ((state->flags & PSC_STATE_MASK_ANY_FAIL) == 0 + && psc_cache_map != 0 + && (stamp_str = psc_cache_lookup(psc_cache_map, state->smtp_client_addr)) != 0) { saved_flags = state->flags; - ps_parse_tests(state, stamp_str, event_time()); + psc_parse_tests(state, stamp_str, event_time()); state->flags |= saved_flags; if (msg_verbose) msg_info("%s: cached + recent flags: %s", - myname, ps_print_state_flags(state->flags, myname)); - if ((state->flags & PS_STATE_MASK_ANY_TODO_FAIL) == 0) { - msg_info("PASS OLD [%s]:%s", PS_CLIENT_ADDR_PORT(state)); - ps_conclude(state); + myname, psc_print_state_flags(state->flags, myname)); + if ((state->flags & PSC_STATE_MASK_ANY_TODO_FAIL) == 0) { + msg_info("PASS OLD [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); + psc_conclude(state); return; } } else { saved_flags = state->flags; - ps_new_tests(state); + psc_new_tests(state); state->flags |= saved_flags; if (msg_verbose) msg_info("%s: new + recent flags: %s", - myname, ps_print_state_flags(state->flags, myname)); + myname, psc_print_state_flags(state->flags, myname)); } /* * Reply with 421 when we can't analyze more connections. */ - if (var_ps_pre_queue_limit > 0 - && ps_check_queue_length - ps_post_queue_length >= var_ps_pre_queue_limit) { + if (var_psc_pre_queue_limit > 0 + && psc_check_queue_length - psc_post_queue_length + >= var_psc_pre_queue_limit) { msg_info("reject: connect from [%s]:%s: all screening ports busy", state->smtp_client_addr, state->smtp_client_port); - PS_DROP_SESSION_STATE(state, - "421 4.3.2 All screening ports are busy\r\n"); + PSC_DROP_SESSION_STATE(state, + "421 4.3.2 All screening ports are busy\r\n"); return; } @@ -644,21 +701,21 @@ static void ps_service(VSTREAM *smtp_client_stream, * If the client has no up-to-date results for some tests, do those tests * first. Otherwise, skip the tests and hand off the connection. */ - if (state->flags & PS_STATE_MASK_EARLY_TODO) - ps_early_tests(state); - else if (state->flags & (PS_STATE_MASK_SMTPD_TODO | PS_STATE_FLAG_NOFORWARD)) - ps_smtpd_tests(state); + if (state->flags & PSC_STATE_MASK_EARLY_TODO) + psc_early_tests(state); + else if (state->flags & (PSC_STATE_MASK_SMTPD_TODO | PSC_STATE_FLAG_NOFORWARD)) + psc_smtpd_tests(state); else - ps_conclude(state); + psc_conclude(state); } -/* ps_cache_validator - validate one cache entry */ +/* psc_cache_validator - validate one cache entry */ -static int ps_cache_validator(const char *client_addr, - const char *stamp_str, - char *unused_context) +static int psc_cache_validator(const char *client_addr, + const char *stamp_str, + char *unused_context) { - PS_STATE dummy; + PSC_STATE dummy; /* * This function is called by the cache cleanup pseudo thread. @@ -668,8 +725,8 @@ static int ps_cache_validator(const char *client_addr, * silly logging we remove the cache entry only after all tests have * expired longer ago than the cache retention time. */ - ps_parse_tests(&dummy, stamp_str, event_time() - var_ps_cache_ret); - return ((dummy.flags & PS_STATE_MASK_ANY_TODO) == 0); + psc_parse_tests(&dummy, stamp_str, event_time() - var_psc_cache_ret); + return ((dummy.flags & PSC_STATE_MASK_ANY_TODO) == 0); } /* pre_jail_init - pre-jail initialization */ @@ -682,16 +739,19 @@ static void pre_jail_init(char *unused_name, char **unused_argv) * Open read-only maps before dropping privilege, for consistency with * other Postfix daemons. */ - if (*var_ps_wlist_nets) - ps_wlist_nets = addr_match_list_init(MATCH_FLAG_NONE, var_ps_wlist_nets); - - if (*var_ps_blist_nets) - ps_blist_nets = addr_match_list_init(MATCH_FLAG_NONE, var_ps_blist_nets); - if (*var_ps_forbid_cmds) - ps_forbid_cmds = string_list_init(MATCH_FLAG_NONE, var_ps_forbid_cmds); - if (*var_ps_dnsbl_reply) - ps_dnsbl_reply = dict_open(var_ps_dnsbl_reply, O_RDONLY, - DICT_FLAG_DUP_WARN); + if (*var_psc_wlist_nets) + psc_wlist_nets = + addr_match_list_init(MATCH_FLAG_NONE, var_psc_wlist_nets); + + if (*var_psc_blist_nets) + psc_blist_nets = addr_match_list_init(MATCH_FLAG_NONE, + var_psc_blist_nets); + if (*var_psc_forbid_cmds) + psc_forbid_cmds = string_list_init(MATCH_FLAG_NONE, + var_psc_forbid_cmds); + if (*var_psc_dnsbl_reply) + psc_dnsbl_reply = dict_open(var_psc_dnsbl_reply, O_RDONLY, + DICT_FLAG_DUP_WARN); /* * Never, ever, get killed by a master signal, as that would corrupt the @@ -717,18 +777,45 @@ static void pre_jail_init(char *unused_name, char **unused_argv) * * Start the cache maintenance pseudo thread after dropping privileges. */ -#define PS_DICT_OPEN_FLAGS (DICT_FLAG_DUP_REPLACE | DICT_FLAG_SYNC_UPDATE) +#define PSC_DICT_OPEN_FLAGS (DICT_FLAG_DUP_REPLACE | DICT_FLAG_SYNC_UPDATE) - if (*var_ps_cache_map) - ps_cache_map = - dict_cache_open(data_redirect_map(redirect, var_ps_cache_map), - O_CREAT | O_RDWR, PS_DICT_OPEN_FLAGS); + if (*var_psc_cache_map) + psc_cache_map = + dict_cache_open(data_redirect_map(redirect, var_psc_cache_map), + O_CREAT | O_RDWR, PSC_DICT_OPEN_FLAGS); /* * Clean up and restore privilege. */ vstring_free(redirect); RESTORE_SAVED_EUGID(); + + /* + * Initialize the dummy SMTP engine. + */ + psc_smtpd_pre_jail_init(); +} + +/* pre_accept - see if tables have changed */ + +static void pre_accept(char *unused_name, char **unused_argv) +{ + static time_t last_event_time; + time_t new_event_time; + const char *name; + + /* + * If some table has changed then stop accepting new connections. Don't + * check the tables more than once a second. + */ + new_event_time = event_time(); + if (new_event_time >= last_event_time + 1 + && (name = dict_changed_name()) != 0) { + msg_info("table %s has changed - finishing in the background", name); + event_server_drain(); + } else { + last_event_time = new_event_time; + } } /* post_jail_init - post-jail initialization */ @@ -736,10 +823,10 @@ static void pre_jail_init(char *unused_name, char **unused_argv) static void post_jail_init(char *unused_name, char **unused_argv) { const NAME_CODE actions[] = { - PS_NAME_ACT_DROP, PS_ACT_DROP, - PS_NAME_ACT_ENFORCE, PS_ACT_ENFORCE, - PS_NAME_ACT_IGNORE, PS_ACT_IGNORE, - PS_NAME_ACT_CONT, PS_ACT_IGNORE,/* compatibility */ + PSC_NAME_ACT_DROP, PSC_ACT_DROP, + PSC_NAME_ACT_ENFORCE, PSC_ACT_ENFORCE, + PSC_NAME_ACT_IGNORE, PSC_ACT_IGNORE, + PSC_NAME_ACT_CONT, PSC_ACT_IGNORE, /* compatibility */ 0, -1, }; int cache_flags; @@ -754,31 +841,37 @@ static void post_jail_init(char *unused_name, char **unused_argv) /* * Other one-time initialization. */ - ps_temp = vstring_alloc(10); - vstring_sprintf(ps_temp, "%s/%s", MAIL_CLASS_PRIVATE, var_smtpd_service); - ps_smtpd_service_name = mystrdup(STR(ps_temp)); - ps_dnsbl_init(); - ps_early_init(); - ps_smtpd_init(); - - if ((ps_blist_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_blist_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_BLIST_ACTION, var_ps_blist_action); - if ((ps_dnsbl_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_dnsbl_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_DNSBL_ACTION, var_ps_dnsbl_action); - if ((ps_pregr_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_pregr_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_PREGR_ACTION, var_ps_pregr_action); - if ((ps_pipel_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_pipel_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_PIPEL_ACTION, var_ps_pipel_action); - if ((ps_nsmtp_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_nsmtp_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_NSMTP_ACTION, var_ps_nsmtp_action); - if ((ps_barlf_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_barlf_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_BARLF_ACTION, var_ps_barlf_action); + psc_temp = vstring_alloc(10); + vstring_sprintf(psc_temp, "%s/%s", MAIL_CLASS_PRIVATE, var_smtpd_service); + psc_smtpd_service_name = mystrdup(STR(psc_temp)); + psc_dnsbl_init(); + psc_early_init(); + psc_smtpd_init(); + + if ((psc_blist_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_blist_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_BLIST_ACTION, + var_psc_blist_action); + if ((psc_dnsbl_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_dnsbl_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_DNSBL_ACTION, + var_psc_dnsbl_action); + if ((psc_pregr_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_pregr_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_PREGR_ACTION, + var_psc_pregr_action); + if ((psc_pipel_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_pipel_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_PIPEL_ACTION, + var_psc_pipel_action); + if ((psc_nsmtp_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_nsmtp_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_NSMTP_ACTION, + var_psc_nsmtp_action); + if ((psc_barlf_action = name_code(actions, NAME_CODE_FLAG_NONE, + var_psc_barlf_action)) < 0) + msg_fatal("bad %s value: %s", VAR_PSC_BARLF_ACTION, + var_psc_barlf_action); /* * Start the cache maintenance pseudo thread last. Early cleanup makes @@ -788,52 +881,52 @@ static void post_jail_init(char *unused_name, char **unused_argv) cache_flags = DICT_CACHE_FLAG_STATISTICS; if (msg_verbose > 1) cache_flags |= DICT_CACHE_FLAG_VERBOSE; - if (ps_cache_map != 0 && var_ps_cache_scan > 0) - dict_cache_control(ps_cache_map, + if (psc_cache_map != 0 && var_psc_cache_scan > 0) + dict_cache_control(psc_cache_map, DICT_CACHE_CTL_FLAGS, cache_flags, - DICT_CACHE_CTL_INTERVAL, var_ps_cache_scan, - DICT_CACHE_CTL_VALIDATOR, ps_cache_validator, + DICT_CACHE_CTL_INTERVAL, var_psc_cache_scan, + DICT_CACHE_CTL_VALIDATOR, psc_cache_validator, DICT_CACHE_CTL_CONTEXT, (char *) 0, DICT_CACHE_CTL_END); /* * Pre-compute the minimal and maximal TTL. */ - ps_min_ttl = - PS_MIN(PS_MIN(var_ps_pregr_ttl, var_ps_dnsbl_ttl), - PS_MIN(PS_MIN(var_ps_pipel_ttl, var_ps_nsmtp_ttl), - var_ps_barlf_ttl)); - ps_max_ttl = - PS_MAX(PS_MAX(var_ps_pregr_ttl, var_ps_dnsbl_ttl), - PS_MAX(PS_MAX(var_ps_pipel_ttl, var_ps_nsmtp_ttl), - var_ps_barlf_ttl)); + psc_min_ttl = + PSC_MIN(PSC_MIN(var_psc_pregr_ttl, var_psc_dnsbl_ttl), + PSC_MIN(PSC_MIN(var_psc_pipel_ttl, var_psc_nsmtp_ttl), + var_psc_barlf_ttl)); + psc_max_ttl = + PSC_MAX(PSC_MAX(var_psc_pregr_ttl, var_psc_dnsbl_ttl), + PSC_MAX(PSC_MAX(var_psc_pipel_ttl, var_psc_nsmtp_ttl), + var_psc_barlf_ttl)); /* * Pre-compute the stress and normal command time limits. */ mail_conf_update(VAR_STRESS, "yes"); - ps_stress_cmd_time_limit = - get_mail_conf_time(VAR_PS_CMD_TIME, DEF_PS_CMD_TIME, 1, 0); - ps_stress_greet_wait = - get_mail_conf_time(VAR_PS_GREET_WAIT, DEF_PS_GREET_WAIT, 1, 0); + psc_stress_cmd_time_limit = + get_mail_conf_time(VAR_PSC_CMD_TIME, DEF_PSC_CMD_TIME, 1, 0); + psc_stress_greet_wait = + get_mail_conf_time(VAR_PSC_GREET_WAIT, DEF_PSC_GREET_WAIT, 1, 0); mail_conf_update(VAR_STRESS, ""); - ps_normal_cmd_time_limit = - get_mail_conf_time(VAR_PS_CMD_TIME, DEF_PS_CMD_TIME, 1, 0); - ps_normal_greet_wait = - get_mail_conf_time(VAR_PS_GREET_WAIT, DEF_PS_GREET_WAIT, 1, 0); + psc_normal_cmd_time_limit = + get_mail_conf_time(VAR_PSC_CMD_TIME, DEF_PSC_CMD_TIME, 1, 0); + psc_normal_greet_wait = + get_mail_conf_time(VAR_PSC_GREET_WAIT, DEF_PSC_GREET_WAIT, 1, 0); - ps_check_queue_length_lowat = .7 * var_ps_pre_queue_limit; - ps_check_queue_length_hiwat = .9 * var_ps_pre_queue_limit; + psc_check_queue_length_lowat = .7 * var_psc_pre_queue_limit; + psc_check_queue_length_hiwat = .9 * var_psc_pre_queue_limit; if (msg_verbose) - msg_info(VAR_PS_CMD_TIME ": stress=%d normal=%d lowat=%d hiwat=%d", - ps_stress_cmd_time_limit, ps_normal_cmd_time_limit, - ps_check_queue_length_lowat, ps_check_queue_length_hiwat); + msg_info(VAR_PSC_CMD_TIME ": stress=%d normal=%d lowat=%d hiwat=%d", + psc_stress_cmd_time_limit, psc_normal_cmd_time_limit, + psc_check_queue_length_lowat, psc_check_queue_length_hiwat); /* * Per-client concurrency. */ - ps_client_concurrency = htable_create(var_ps_pre_queue_limit); + psc_client_concurrency = htable_create(var_psc_pre_queue_limit); } MAIL_VERSION_STAMP_DECLARE; @@ -851,61 +944,71 @@ int main(int argc, char **argv) VAR_SMTPD_SERVICE, DEF_SMTPD_SERVICE, &var_smtpd_service, 1, 0, VAR_SMTPD_BANNER, DEF_SMTPD_BANNER, &var_smtpd_banner, 1, 0, VAR_SMTPD_FORBID_CMDS, DEF_SMTPD_FORBID_CMDS, &var_smtpd_forbid_cmds, 0, 0, - VAR_PS_CACHE_MAP, DEF_PS_CACHE_MAP, &var_ps_cache_map, 0, 0, - VAR_PS_PREGR_BANNER, DEF_PS_PREGR_BANNER, &var_ps_pregr_banner, 0, 0, - VAR_PS_PREGR_ACTION, DEF_PS_PREGR_ACTION, &var_ps_pregr_action, 1, 0, - VAR_PS_DNSBL_SITES, DEF_PS_DNSBL_SITES, &var_ps_dnsbl_sites, 0, 0, - VAR_PS_DNSBL_ACTION, DEF_PS_DNSBL_ACTION, &var_ps_dnsbl_action, 1, 0, - VAR_PS_PIPEL_ACTION, DEF_PS_PIPEL_ACTION, &var_ps_pipel_action, 1, 0, - VAR_PS_NSMTP_ACTION, DEF_PS_NSMTP_ACTION, &var_ps_nsmtp_action, 1, 0, - VAR_PS_BARLF_ACTION, DEF_PS_BARLF_ACTION, &var_ps_barlf_action, 1, 0, - VAR_PS_WLIST_NETS, DEF_PS_WLIST_NETS, &var_ps_wlist_nets, 0, 0, - VAR_PS_BLIST_NETS, DEF_PS_BLIST_NETS, &var_ps_blist_nets, 0, 0, - VAR_PS_BLIST_ACTION, DEF_PS_BLIST_ACTION, &var_ps_blist_action, 1, 0, - VAR_PS_FORBID_CMDS, DEF_PS_FORBID_CMDS, &var_ps_forbid_cmds, 0, 0, - VAR_PS_DNSBL_REPLY, DEF_PS_DNSBL_REPLY, &var_ps_dnsbl_reply, 0, 0, + VAR_SMTPD_EHLO_DIS_WORDS, DEF_SMTPD_EHLO_DIS_WORDS, &var_smtpd_ehlo_dis_words, 0, 0, + VAR_SMTPD_EHLO_DIS_MAPS, DEF_SMTPD_EHLO_DIS_MAPS, &var_smtpd_ehlo_dis_maps, 0, 0, + VAR_SMTPD_TLS_LEVEL, DEF_SMTPD_TLS_LEVEL, &var_smtpd_tls_level, 0, 0, + VAR_PSC_CACHE_MAP, DEF_PSC_CACHE_MAP, &var_psc_cache_map, 0, 0, + VAR_PSC_PREGR_BANNER, DEF_PSC_PREGR_BANNER, &var_psc_pregr_banner, 0, 0, + VAR_PSC_PREGR_ACTION, DEF_PSC_PREGR_ACTION, &var_psc_pregr_action, 1, 0, + VAR_PSC_DNSBL_SITES, DEF_PSC_DNSBL_SITES, &var_psc_dnsbl_sites, 0, 0, + VAR_PSC_DNSBL_ACTION, DEF_PSC_DNSBL_ACTION, &var_psc_dnsbl_action, 1, 0, + VAR_PSC_PIPEL_ACTION, DEF_PSC_PIPEL_ACTION, &var_psc_pipel_action, 1, 0, + VAR_PSC_NSMTP_ACTION, DEF_PSC_NSMTP_ACTION, &var_psc_nsmtp_action, 1, 0, + VAR_PSC_BARLF_ACTION, DEF_PSC_BARLF_ACTION, &var_psc_barlf_action, 1, 0, + VAR_PSC_WLIST_NETS, DEF_PSC_WLIST_NETS, &var_psc_wlist_nets, 0, 0, + VAR_PSC_BLIST_NETS, DEF_PSC_BLIST_NETS, &var_psc_blist_nets, 0, 0, + VAR_PSC_BLIST_ACTION, DEF_PSC_BLIST_ACTION, &var_psc_blist_action, 1, 0, + VAR_PSC_FORBID_CMDS, DEF_PSC_FORBID_CMDS, &var_psc_forbid_cmds, 0, 0, + VAR_PSC_EHLO_DIS_WORDS, DEF_PSC_EHLO_DIS_WORDS, &var_psc_ehlo_dis_words, 0, 0, + VAR_PSC_EHLO_DIS_MAPS, DEF_PSC_EHLO_DIS_MAPS, &var_psc_ehlo_dis_maps, 0, 0, + VAR_PSC_DNSBL_REPLY, DEF_PSC_DNSBL_REPLY, &var_psc_dnsbl_reply, 0, 0, + VAR_PSC_TLS_LEVEL, DEF_PSC_TLS_LEVEL, &var_psc_tls_level, 0, 0, 0, }; static const CONFIG_INT_TABLE int_table[] = { VAR_PROC_LIMIT, DEF_PROC_LIMIT, &var_proc_limit, 1, 0, - VAR_PS_DNSBL_THRESH, DEF_PS_DNSBL_THRESH, &var_ps_dnsbl_thresh, 0, 0, - VAR_PS_CMD_COUNT, DEF_PS_CMD_COUNT, &var_ps_cmd_count, 1, 0, + VAR_PSC_DNSBL_THRESH, DEF_PSC_DNSBL_THRESH, &var_psc_dnsbl_thresh, 0, 0, + VAR_PSC_CMD_COUNT, DEF_PSC_CMD_COUNT, &var_psc_cmd_count, 1, 0, VAR_SMTPD_CCONN_LIMIT, DEF_SMTPD_CCONN_LIMIT, &var_smtpd_cconn_limit, 0, 0, 0, }; static const CONFIG_NINT_TABLE nint_table[] = { - VAR_PS_POST_QLIMIT, DEF_PS_POST_QLIMIT, &var_ps_post_queue_limit, 5, 0, - VAR_PS_PRE_QLIMIT, DEF_PS_PRE_QLIMIT, &var_ps_pre_queue_limit, 10, 0, - VAR_PS_CCONN_LIMIT, DEF_PS_CCONN_LIMIT, &var_ps_cconn_limit, 0, 0, + VAR_PSC_POST_QLIMIT, DEF_PSC_POST_QLIMIT, &var_psc_post_queue_limit, 5, 0, + VAR_PSC_PRE_QLIMIT, DEF_PSC_PRE_QLIMIT, &var_psc_pre_queue_limit, 10, 0, + VAR_PSC_CCONN_LIMIT, DEF_PSC_CCONN_LIMIT, &var_psc_cconn_limit, 0, 0, 0, }; static const CONFIG_TIME_TABLE time_table[] = { - VAR_PS_GREET_WAIT, DEF_PS_GREET_WAIT, &var_ps_greet_wait, 1, 0, - VAR_PS_PREGR_TTL, DEF_PS_PREGR_TTL, &var_ps_pregr_ttl, 1, 0, - VAR_PS_DNSBL_TTL, DEF_PS_DNSBL_TTL, &var_ps_dnsbl_ttl, 1, 0, - VAR_PS_PIPEL_TTL, DEF_PS_PIPEL_TTL, &var_ps_pipel_ttl, 1, 0, - VAR_PS_NSMTP_TTL, DEF_PS_NSMTP_TTL, &var_ps_nsmtp_ttl, 1, 0, - VAR_PS_BARLF_TTL, DEF_PS_BARLF_TTL, &var_ps_barlf_ttl, 1, 0, - VAR_PS_CACHE_RET, DEF_PS_CACHE_RET, &var_ps_cache_ret, 1, 0, - VAR_PS_CACHE_SCAN, DEF_PS_CACHE_SCAN, &var_ps_cache_scan, 1, 0, - VAR_PS_WATCHDOG, DEF_PS_WATCHDOG, &var_ps_watchdog, 10, 0, + VAR_PSC_GREET_WAIT, DEF_PSC_GREET_WAIT, &var_psc_greet_wait, 1, 0, + VAR_PSC_PREGR_TTL, DEF_PSC_PREGR_TTL, &var_psc_pregr_ttl, 1, 0, + VAR_PSC_DNSBL_TTL, DEF_PSC_DNSBL_TTL, &var_psc_dnsbl_ttl, 1, 0, + VAR_PSC_PIPEL_TTL, DEF_PSC_PIPEL_TTL, &var_psc_pipel_ttl, 1, 0, + VAR_PSC_NSMTP_TTL, DEF_PSC_NSMTP_TTL, &var_psc_nsmtp_ttl, 1, 0, + VAR_PSC_BARLF_TTL, DEF_PSC_BARLF_TTL, &var_psc_barlf_ttl, 1, 0, + VAR_PSC_CACHE_RET, DEF_PSC_CACHE_RET, &var_psc_cache_ret, 1, 0, + VAR_PSC_CACHE_SCAN, DEF_PSC_CACHE_SCAN, &var_psc_cache_scan, 1, 0, + VAR_PSC_WATCHDOG, DEF_PSC_WATCHDOG, &var_psc_watchdog, 10, 0, 0, }; static const CONFIG_BOOL_TABLE bool_table[] = { VAR_HELO_REQUIRED, DEF_HELO_REQUIRED, &var_helo_required, VAR_DISABLE_VRFY_CMD, DEF_DISABLE_VRFY_CMD, &var_disable_vrfy_cmd, - VAR_PS_PIPEL_ENABLE, DEF_PS_PIPEL_ENABLE, &var_ps_pipel_enable, - VAR_PS_NSMTP_ENABLE, DEF_PS_NSMTP_ENABLE, &var_ps_nsmtp_enable, - VAR_PS_BARLF_ENABLE, DEF_PS_BARLF_ENABLE, &var_ps_barlf_enable, + VAR_SMTPD_USE_TLS, DEF_SMTPD_USE_TLS, &var_smtpd_use_tls, + VAR_SMTPD_ENFORCE_TLS, DEF_SMTPD_ENFORCE_TLS, &var_smtpd_enforce_tls, + VAR_PSC_PIPEL_ENABLE, DEF_PSC_PIPEL_ENABLE, &var_psc_pipel_enable, + VAR_PSC_NSMTP_ENABLE, DEF_PSC_NSMTP_ENABLE, &var_psc_nsmtp_enable, + VAR_PSC_BARLF_ENABLE, DEF_PSC_BARLF_ENABLE, &var_psc_barlf_enable, 0, }; static const CONFIG_RAW_TABLE raw_table[] = { - VAR_PS_CMD_TIME, DEF_PS_CMD_TIME, &var_ps_cmd_time, 1, 0, + VAR_PSC_CMD_TIME, DEF_PSC_CMD_TIME, &var_psc_cmd_time, 1, 0, 0, }; static const CONFIG_NBOOL_TABLE nbool_table[] = { - VAR_PS_HELO_REQUIRED, DEF_PS_HELO_REQUIRED, &var_ps_helo_required, - VAR_PS_DISABLE_VRFY, DEF_PS_DISABLE_VRFY, &var_ps_disable_vrfy, + VAR_PSC_HELO_REQUIRED, DEF_PSC_HELO_REQUIRED, &var_psc_helo_required, + VAR_PSC_DISABLE_VRFY, DEF_PSC_DISABLE_VRFY, &var_psc_disable_vrfy, + VAR_PSC_USE_TLS, DEF_PSC_USE_TLS, &var_psc_use_tls, + VAR_PSC_ENFORCE_TLS, DEF_PSC_ENFORCE_TLS, &var_psc_enforce_tls, 0, }; @@ -914,7 +1017,7 @@ int main(int argc, char **argv) */ MAIL_VERSION_STAMP_ALLOCATE; - event_server_main(argc, argv, ps_service, + event_server_main(argc, argv, psc_service, MAIL_SERVER_STR_TABLE, str_table, MAIL_SERVER_INT_TABLE, int_table, MAIL_SERVER_NINT_TABLE, nint_table, @@ -924,9 +1027,10 @@ int main(int argc, char **argv) MAIL_SERVER_NBOOL_TABLE, nbool_table, MAIL_SERVER_PRE_INIT, pre_jail_init, MAIL_SERVER_POST_INIT, post_jail_init, + MAIL_SERVER_PRE_ACCEPT, pre_accept, MAIL_SERVER_SOLITARY, - MAIL_SERVER_SLOW_EXIT, ps_drain, - MAIL_SERVER_EXIT, ps_dump, - MAIL_SERVER_WATCHDOG, &var_ps_watchdog, + MAIL_SERVER_SLOW_EXIT, psc_drain, + MAIL_SERVER_EXIT, psc_dump, + MAIL_SERVER_WATCHDOG, &var_psc_watchdog, 0); } diff --git a/postfix/src/postscreen/postscreen.h b/postfix/src/postscreen/postscreen.h index a93a036bb..c0885be85 100644 --- a/postfix/src/postscreen/postscreen.h +++ b/postfix/src/postscreen/postscreen.h @@ -30,7 +30,7 @@ /* * Preliminary stuff, to be fixed. */ -#define PS_READ_BUF_SIZE 1024 +#define PSC_READ_BUF_SIZE 1024 /* * Per-session state. @@ -64,23 +64,25 @@ typedef struct { char *sender; /* MAIL FROM */ VSTRING *cmd_buffer; /* command read buffer */ int read_state; /* command read state machine */ -} PS_STATE; - -#define PS_TIME_STAMP_NEW (0) /* test was never passed */ -#define PS_TIME_STAMP_DISABLED (1) /* never passed but disabled */ -#define PS_TIME_STAMP_INVALID (-1) /* must not be cached */ - -#define PS_STATE_FLAG_NOFORWARD (1<<0) /* don't forward this session */ -#define PS_STATE_FLAG_UNUSED1 (1<<1) /* use me! */ -#define PS_STATE_FLAG_UNUSED2 (1<<2) /* use me! */ -#define PS_STATE_FLAG_NEW (1<<3) /* some test was never passed */ -#define PS_STATE_FLAG_BLIST_FAIL (1<<4) /* blacklisted */ -#define PS_STATE_FLAG_HANGUP (1<<5) /* NOT a test failure */ -#define PS_STATE_FLAG_CACHE_EXPIRED (1<<6) /* cache retention expired */ + /* smtpd(8) compatibility */ + int ehlo_discard_mask; /* EHLO filter */ +} PSC_STATE; + +#define PSC_TIME_STAMP_NEW (0) /* test was never passed */ +#define PSC_TIME_STAMP_DISABLED (1) /* never passed but disabled */ +#define PSC_TIME_STAMP_INVALID (-1) /* must not be cached */ + +#define PSC_STATE_FLAG_NOFORWARD (1<<0) /* don't forward this session */ +#define PSC_STATE_FLAG_USING_TLS (1<<1) /* using the TLS proxy */ +#define PSC_STATE_FLAG_UNUSED2 (1<<2) /* use me! */ +#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 */ /* * Important: every MUMBLE_TODO flag must have a MUMBLE_PASS flag, such that - * MUMBLE_PASS == PS_STATE_FLAGS_TODO_TO_PASS(MUMBLE_TODO). + * MUMBLE_PASS == PSC_STATE_FLAGS_TODO_TO_PASS(MUMBLE_TODO). * * MUMBLE_TODO flags must not be cleared once raised. The _TODO_TO_PASS and * _TODO_TO_DONE macros depend on this to decide that a group of tests is @@ -97,107 +99,107 @@ typedef struct { * We use MUMBLE_SKIP to indicate that a decision was either "fail" or * forced "pass". */ -#define PS_STATE_FLAGS_TODO_TO_PASS(todo_flags) ((todo_flags) >> 1) -#define PS_STATE_FLAGS_TODO_TO_DONE(todo_flags) ((todo_flags) << 1) +#define PSC_STATE_FLAGS_TODO_TO_PASS(todo_flags) ((todo_flags) >> 1) +#define PSC_STATE_FLAGS_TODO_TO_DONE(todo_flags) ((todo_flags) << 1) -#define PS_STATE_FLAG_PENAL_UPDATE (1<<6) /* save new penalty */ -#define PS_STATE_FLAG_PENAL_FAIL (1<<7) /* penalty is active */ +#define PSC_STATE_FLAG_PENAL_UPDATE (1<<6) /* save new penalty */ +#define PSC_STATE_FLAG_PENAL_FAIL (1<<7) /* penalty is active */ -#define PS_STATE_FLAG_PREGR_FAIL (1<<8) /* failed pregreet test */ -#define PS_STATE_FLAG_PREGR_PASS (1<<9) /* passed pregreet test */ -#define PS_STATE_FLAG_PREGR_TODO (1<<10) /* pregreet test expired */ -#define PS_STATE_FLAG_PREGR_DONE (1<<11) /* decision is final */ +#define PSC_STATE_FLAG_PREGR_FAIL (1<<8) /* failed pregreet test */ +#define PSC_STATE_FLAG_PREGR_PASS (1<<9) /* passed pregreet test */ +#define PSC_STATE_FLAG_PREGR_TODO (1<<10) /* pregreet test expired */ +#define PSC_STATE_FLAG_PREGR_DONE (1<<11) /* decision is final */ -#define PS_STATE_FLAG_DNSBL_FAIL (1<<12) /* failed DNSBL test */ -#define PS_STATE_FLAG_DNSBL_PASS (1<<13) /* passed DNSBL test */ -#define PS_STATE_FLAG_DNSBL_TODO (1<<14) /* DNSBL test expired */ -#define PS_STATE_FLAG_DNSBL_DONE (1<<15) /* decision is final */ +#define PSC_STATE_FLAG_DNSBL_FAIL (1<<12) /* failed DNSBL test */ +#define PSC_STATE_FLAG_DNSBL_PASS (1<<13) /* passed DNSBL test */ +#define PSC_STATE_FLAG_DNSBL_TODO (1<<14) /* DNSBL test expired */ +#define PSC_STATE_FLAG_DNSBL_DONE (1<<15) /* decision is final */ /* Room here for one more after-handshake test. */ -#define PS_STATE_FLAG_PIPEL_FAIL (1<<20) /* failed pipelining test */ -#define PS_STATE_FLAG_PIPEL_PASS (1<<21) /* passed pipelining test */ -#define PS_STATE_FLAG_PIPEL_TODO (1<<22) /* pipelining test expired */ -#define PS_STATE_FLAG_PIPEL_SKIP (1<<23) /* action is already logged */ +#define PSC_STATE_FLAG_PIPEL_FAIL (1<<20) /* failed pipelining test */ +#define PSC_STATE_FLAG_PIPEL_PASS (1<<21) /* passed pipelining test */ +#define PSC_STATE_FLAG_PIPEL_TODO (1<<22) /* pipelining test expired */ +#define PSC_STATE_FLAG_PIPEL_SKIP (1<<23) /* action is already logged */ -#define PS_STATE_FLAG_NSMTP_FAIL (1<<24) /* failed non-SMTP test */ -#define PS_STATE_FLAG_NSMTP_PASS (1<<25) /* passed non-SMTP test */ -#define PS_STATE_FLAG_NSMTP_TODO (1<<26) /* non-SMTP test expired */ -#define PS_STATE_FLAG_NSMTP_SKIP (1<<27) /* action is already logged */ +#define PSC_STATE_FLAG_NSMTP_FAIL (1<<24) /* failed non-SMTP test */ +#define PSC_STATE_FLAG_NSMTP_PASS (1<<25) /* passed non-SMTP test */ +#define PSC_STATE_FLAG_NSMTP_TODO (1<<26) /* non-SMTP test expired */ +#define PSC_STATE_FLAG_NSMTP_SKIP (1<<27) /* action is already logged */ -#define PS_STATE_FLAG_BARLF_FAIL (1<<28) /* failed bare newline test */ -#define PS_STATE_FLAG_BARLF_PASS (1<<29) /* passed bare newline test */ -#define PS_STATE_FLAG_BARLF_TODO (1<<30) /* bare newline test expired */ -#define PS_STATE_FLAG_BARLF_SKIP (1<<31) /* action is already logged */ +#define PSC_STATE_FLAG_BARLF_FAIL (1<<28) /* failed bare newline test */ +#define PSC_STATE_FLAG_BARLF_PASS (1<<29) /* passed bare newline test */ +#define PSC_STATE_FLAG_BARLF_TODO (1<<30) /* bare newline test expired */ +#define PSC_STATE_FLAG_BARLF_SKIP (1<<31) /* action is already logged */ /* * Aggregates for individual tests. */ -#define PS_STATE_MASK_PREGR_TODO_FAIL \ - (PS_STATE_FLAG_PREGR_TODO | PS_STATE_FLAG_PREGR_FAIL) -#define PS_STATE_MASK_DNSBL_TODO_FAIL \ - (PS_STATE_FLAG_DNSBL_TODO | PS_STATE_FLAG_DNSBL_FAIL) -#define PS_STATE_MASK_PIPEL_TODO_FAIL \ - (PS_STATE_FLAG_PIPEL_TODO | PS_STATE_FLAG_PIPEL_FAIL) -#define PS_STATE_MASK_NSMTP_TODO_FAIL \ - (PS_STATE_FLAG_NSMTP_TODO | PS_STATE_FLAG_NSMTP_FAIL) -#define PS_STATE_MASK_BARLF_TODO_FAIL \ - (PS_STATE_FLAG_BARLF_TODO | PS_STATE_FLAG_BARLF_FAIL) - -#define PS_STATE_MASK_PIPEL_TODO_SKIP \ - (PS_STATE_FLAG_PIPEL_TODO | PS_STATE_FLAG_PIPEL_SKIP) -#define PS_STATE_MASK_NSMTP_TODO_SKIP \ - (PS_STATE_FLAG_NSMTP_TODO | PS_STATE_FLAG_NSMTP_SKIP) -#define PS_STATE_MASK_BARLF_TODO_SKIP \ - (PS_STATE_FLAG_BARLF_TODO | PS_STATE_FLAG_BARLF_SKIP) - -#define PS_STATE_MASK_PIPEL_TODO_PASS_FAIL \ - (PS_STATE_MASK_PIPEL_TODO_FAIL | PS_STATE_FLAG_PIPEL_PASS) -#define PS_STATE_MASK_NSMTP_TODO_PASS_FAIL \ - (PS_STATE_MASK_NSMTP_TODO_FAIL | PS_STATE_FLAG_NSMTP_PASS) -#define PS_STATE_MASK_BARLF_TODO_PASS_FAIL \ - (PS_STATE_MASK_BARLF_TODO_FAIL | PS_STATE_FLAG_BARLF_PASS) +#define PSC_STATE_MASK_PREGR_TODO_FAIL \ + (PSC_STATE_FLAG_PREGR_TODO | PSC_STATE_FLAG_PREGR_FAIL) +#define PSC_STATE_MASK_DNSBL_TODO_FAIL \ + (PSC_STATE_FLAG_DNSBL_TODO | PSC_STATE_FLAG_DNSBL_FAIL) +#define PSC_STATE_MASK_PIPEL_TODO_FAIL \ + (PSC_STATE_FLAG_PIPEL_TODO | PSC_STATE_FLAG_PIPEL_FAIL) +#define PSC_STATE_MASK_NSMTP_TODO_FAIL \ + (PSC_STATE_FLAG_NSMTP_TODO | PSC_STATE_FLAG_NSMTP_FAIL) +#define PSC_STATE_MASK_BARLF_TODO_FAIL \ + (PSC_STATE_FLAG_BARLF_TODO | PSC_STATE_FLAG_BARLF_FAIL) + +#define PSC_STATE_MASK_PIPEL_TODO_SKIP \ + (PSC_STATE_FLAG_PIPEL_TODO | PSC_STATE_FLAG_PIPEL_SKIP) +#define PSC_STATE_MASK_NSMTP_TODO_SKIP \ + (PSC_STATE_FLAG_NSMTP_TODO | PSC_STATE_FLAG_NSMTP_SKIP) +#define PSC_STATE_MASK_BARLF_TODO_SKIP \ + (PSC_STATE_FLAG_BARLF_TODO | PSC_STATE_FLAG_BARLF_SKIP) + +#define PSC_STATE_MASK_PIPEL_TODO_PASS_FAIL \ + (PSC_STATE_MASK_PIPEL_TODO_FAIL | PSC_STATE_FLAG_PIPEL_PASS) +#define PSC_STATE_MASK_NSMTP_TODO_PASS_FAIL \ + (PSC_STATE_MASK_NSMTP_TODO_FAIL | PSC_STATE_FLAG_NSMTP_PASS) +#define PSC_STATE_MASK_BARLF_TODO_PASS_FAIL \ + (PSC_STATE_MASK_BARLF_TODO_FAIL | PSC_STATE_FLAG_BARLF_PASS) /* * Separate aggregates for early tests and deep tests. */ -#define PS_STATE_MASK_EARLY_DONE \ - (PS_STATE_FLAG_PREGR_DONE | PS_STATE_FLAG_DNSBL_DONE) -#define PS_STATE_MASK_EARLY_TODO \ - (PS_STATE_FLAG_PREGR_TODO | PS_STATE_FLAG_DNSBL_TODO) -#define PS_STATE_MASK_EARLY_PASS \ - (PS_STATE_FLAG_PREGR_PASS | PS_STATE_FLAG_DNSBL_PASS) -#define PS_STATE_MASK_EARLY_FAIL \ - (PS_STATE_FLAG_PREGR_FAIL | PS_STATE_FLAG_DNSBL_FAIL) - -#define PS_STATE_MASK_SMTPD_TODO \ - (PS_STATE_FLAG_PIPEL_TODO | PS_STATE_FLAG_NSMTP_TODO | \ - PS_STATE_FLAG_BARLF_TODO) -#define PS_STATE_MASK_SMTPD_PASS \ - (PS_STATE_FLAG_PIPEL_PASS | PS_STATE_FLAG_NSMTP_PASS | \ - PS_STATE_FLAG_BARLF_PASS) -#define PS_STATE_MASK_SMTPD_FAIL \ - (PS_STATE_FLAG_PIPEL_FAIL | PS_STATE_FLAG_NSMTP_FAIL | \ - PS_STATE_FLAG_BARLF_FAIL) +#define PSC_STATE_MASK_EARLY_DONE \ + (PSC_STATE_FLAG_PREGR_DONE | PSC_STATE_FLAG_DNSBL_DONE) +#define PSC_STATE_MASK_EARLY_TODO \ + (PSC_STATE_FLAG_PREGR_TODO | PSC_STATE_FLAG_DNSBL_TODO) +#define PSC_STATE_MASK_EARLY_PASS \ + (PSC_STATE_FLAG_PREGR_PASS | PSC_STATE_FLAG_DNSBL_PASS) +#define PSC_STATE_MASK_EARLY_FAIL \ + (PSC_STATE_FLAG_PREGR_FAIL | PSC_STATE_FLAG_DNSBL_FAIL) + +#define PSC_STATE_MASK_SMTPD_TODO \ + (PSC_STATE_FLAG_PIPEL_TODO | PSC_STATE_FLAG_NSMTP_TODO | \ + PSC_STATE_FLAG_BARLF_TODO) +#define PSC_STATE_MASK_SMTPD_PASS \ + (PSC_STATE_FLAG_PIPEL_PASS | PSC_STATE_FLAG_NSMTP_PASS | \ + PSC_STATE_FLAG_BARLF_PASS) +#define PSC_STATE_MASK_SMTPD_FAIL \ + (PSC_STATE_FLAG_PIPEL_FAIL | PSC_STATE_FLAG_NSMTP_FAIL | \ + PSC_STATE_FLAG_BARLF_FAIL) /* * Super-aggregates for all tests combined. */ -#define PS_STATE_MASK_ANY_FAIL \ - (PS_STATE_FLAG_BLIST_FAIL | PS_STATE_FLAG_PENAL_FAIL | \ - PS_STATE_MASK_EARLY_FAIL | PS_STATE_MASK_SMTPD_FAIL) +#define PSC_STATE_MASK_ANY_FAIL \ + (PSC_STATE_FLAG_BLIST_FAIL | PSC_STATE_FLAG_PENAL_FAIL | \ + PSC_STATE_MASK_EARLY_FAIL | PSC_STATE_MASK_SMTPD_FAIL) -#define PS_STATE_MASK_ANY_PASS \ - (PS_STATE_MASK_EARLY_PASS | PS_STATE_MASK_SMTPD_PASS) +#define PSC_STATE_MASK_ANY_PASS \ + (PSC_STATE_MASK_EARLY_PASS | PSC_STATE_MASK_SMTPD_PASS) -#define PS_STATE_MASK_ANY_TODO \ - (PS_STATE_MASK_EARLY_TODO | PS_STATE_MASK_SMTPD_TODO) +#define PSC_STATE_MASK_ANY_TODO \ + (PSC_STATE_MASK_EARLY_TODO | PSC_STATE_MASK_SMTPD_TODO) -#define PS_STATE_MASK_ANY_TODO_FAIL \ - (PS_STATE_MASK_ANY_TODO | PS_STATE_MASK_ANY_FAIL) +#define PSC_STATE_MASK_ANY_TODO_FAIL \ + (PSC_STATE_MASK_ANY_TODO | PSC_STATE_MASK_ANY_FAIL) -#define PS_STATE_MASK_ANY_UPDATE \ - (PS_STATE_MASK_ANY_PASS | PS_STATE_FLAG_PENAL_UPDATE) +#define PSC_STATE_MASK_ANY_UPDATE \ + (PSC_STATE_MASK_ANY_PASS | PSC_STATE_FLAG_PENAL_UPDATE) /* * See log_adhoc.c for discussion. @@ -207,7 +209,7 @@ typedef struct { int dt_usec; /* make sure it's signed */ } DELTA_TIME; -#define PS_CALC_DELTA(x, y, z) \ +#define PSC_CALC_DELTA(x, y, z) \ do { \ (x).dt_sec = (y).tv_sec - (z).tv_sec; \ (x).dt_usec = (y).tv_usec - (z).tv_usec; \ @@ -229,25 +231,25 @@ typedef struct { * Event management. */ -/* PS_READ_EVENT_REQUEST - prepare for transition to next state */ +/* PSC_READ_EVENT_REQUEST - prepare for transition to next state */ -#define PS_READ_EVENT_REQUEST(fd, action, context, timeout) do { \ +#define PSC_READ_EVENT_REQUEST(fd, action, context, timeout) do { \ if (msg_verbose > 1) \ msg_info("%s: read-request fd=%d", myname, (fd)); \ event_enable_read((fd), (action), (context)); \ event_request_timer((action), (context), (timeout)); \ } while (0) -#define PS_READ_EVENT_REQUEST2(fd, read_act, time_act, context, timeout) do { \ +#define PSC_READ_EVENT_REQUEST2(fd, read_act, time_act, context, timeout) do { \ if (msg_verbose > 1) \ msg_info("%s: read-request fd=%d", myname, (fd)); \ event_enable_read((fd), (read_act), (context)); \ event_request_timer((time_act), (context), (timeout)); \ } while (0) -/* PS_CLEAR_EVENT_REQUEST - complete state transition */ +/* PSC_CLEAR_EVENT_REQUEST - complete state transition */ -#define PS_CLEAR_EVENT_REQUEST(fd, time_act, context) do { \ +#define PSC_CLEAR_EVENT_REQUEST(fd, time_act, context) do { \ if (msg_verbose > 1) \ msg_info("%s: clear-request fd=%d", myname, (fd)); \ event_disable_readwrite(fd); \ @@ -257,55 +259,55 @@ typedef struct { /* * Failure enforcement policies. */ -#define PS_NAME_ACT_DROP "drop" -#define PS_NAME_ACT_ENFORCE "enforce" -#define PS_NAME_ACT_IGNORE "ignore" -#define PS_NAME_ACT_CONT "continue" +#define PSC_NAME_ACT_DROP "drop" +#define PSC_NAME_ACT_ENFORCE "enforce" +#define PSC_NAME_ACT_IGNORE "ignore" +#define PSC_NAME_ACT_CONT "continue" -#define PS_ACT_DROP 1 -#define PS_ACT_ENFORCE 2 -#define PS_ACT_IGNORE 3 +#define PSC_ACT_DROP 1 +#define PSC_ACT_ENFORCE 2 +#define PSC_ACT_IGNORE 3 /* * Global variables. */ -extern int ps_check_queue_length; /* connections being checked */ -extern int ps_post_queue_length; /* being sent to real SMTPD */ -extern DICT_CACHE *ps_cache_map; /* cache table handle */ -extern VSTRING *ps_temp; /* scratchpad */ -extern char *ps_smtpd_service_name; /* path to real SMTPD */ -extern int ps_pregr_action; /* PS_ACT_DROP etc. */ -extern int ps_dnsbl_action; /* PS_ACT_DROP etc. */ -extern int ps_pipel_action; /* PS_ACT_DROP etc. */ -extern int ps_nsmtp_action; /* PS_ACT_DROP etc. */ -extern int ps_barlf_action; /* PS_ACT_DROP etc. */ -extern int ps_min_ttl; /* Update with new tests! */ -extern int ps_max_ttl; /* Update with new tests! */ -extern STRING_LIST *ps_forbid_cmds; /* CONNECT GET POST */ -extern int ps_stress_greet_wait; /* stressed greet wait */ -extern int ps_normal_greet_wait; /* stressed greet wait */ -extern int ps_stress_cmd_time_limit; /* stressed command limit */ -extern int ps_normal_cmd_time_limit; /* normal command time limit */ -extern int ps_stress; /* stress level */ -extern int ps_check_queue_length_lowat; /* stress low-water mark */ -extern int ps_check_queue_length_hiwat; /* stress high-water mark */ -extern DICT *ps_dnsbl_reply; /* DNSBL name mapper */ -extern HTABLE *ps_client_concurrency; /* per-client concurrency */ - -#define PS_EFF_GREET_WAIT \ - (ps_stress ? ps_stress_greet_wait : ps_normal_greet_wait) -#define PS_EFF_CMD_TIME_LIMIT \ - (ps_stress ? ps_stress_cmd_time_limit : ps_normal_cmd_time_limit) +extern int psc_check_queue_length; /* connections being checked */ +extern int psc_post_queue_length; /* being sent to real SMTPD */ +extern DICT_CACHE *psc_cache_map; /* cache table handle */ +extern VSTRING *psc_temp; /* scratchpad */ +extern char *psc_smtpd_service_name; /* path to real SMTPD */ +extern int psc_pregr_action; /* PSC_ACT_DROP etc. */ +extern int psc_dnsbl_action; /* PSC_ACT_DROP etc. */ +extern int psc_pipel_action; /* PSC_ACT_DROP etc. */ +extern int psc_nsmtp_action; /* PSC_ACT_DROP etc. */ +extern int psc_barlf_action; /* PSC_ACT_DROP etc. */ +extern int psc_min_ttl; /* Update with new tests! */ +extern int psc_max_ttl; /* Update with new tests! */ +extern STRING_LIST *psc_forbid_cmds; /* CONNECT GET POST */ +extern int psc_stress_greet_wait; /* stressed greet wait */ +extern int psc_normal_greet_wait; /* stressed greet wait */ +extern int psc_stress_cmd_time_limit; /* stressed command limit */ +extern int psc_normal_cmd_time_limit; /* normal command time limit */ +extern int psc_stress; /* stress level */ +extern int psc_check_queue_length_lowat;/* stress low-water mark */ +extern int psc_check_queue_length_hiwat;/* stress high-water mark */ +extern DICT *psc_dnsbl_reply; /* DNSBL name mapper */ +extern HTABLE *psc_client_concurrency; /* per-client concurrency */ + +#define PSC_EFF_GREET_WAIT \ + (psc_stress ? psc_stress_greet_wait : psc_normal_greet_wait) +#define PSC_EFF_CMD_TIME_LIMIT \ + (psc_stress ? psc_stress_cmd_time_limit : psc_normal_cmd_time_limit) /* * String plumbing macros. */ -#define PS_STRING_UPDATE(str, text) do { \ +#define PSC_STRING_UPDATE(str, text) do { \ if (str) myfree(str); \ (str) = ((text) ? mystrdup(text) : 0); \ } while (0) -#define PS_STRING_RESET(str) do { \ +#define PSC_STRING_RESET(str) do { \ if (str) { \ myfree(str); \ (str) = 0; \ @@ -321,126 +323,133 @@ extern HTABLE *ps_client_concurrency; /* per-client concurrency */ /* * postscreen_state.c */ -#define PS_CLIENT_ADDR_PORT(state) \ +#define PSC_CLIENT_ADDR_PORT(state) \ (state)->smtp_client_addr, (state)->smtp_client_port -#define PS_PASS_SESSION_STATE(state, what, bits) do { \ +#define PSC_PASS_SESSION_STATE(state, what, bits) do { \ if (msg_verbose) \ - msg_info("PASS %s [%s]:%s", (what), PS_CLIENT_ADDR_PORT(state)); \ + msg_info("PASS %s [%s]:%s", (what), PSC_CLIENT_ADDR_PORT(state)); \ (state)->flags |= (bits); \ } while (0) -#define PS_FAIL_SESSION_STATE(state, bits) do { \ +#define PSC_FAIL_SESSION_STATE(state, bits) do { \ if (msg_verbose) \ - msg_info("FAIL [%s]:%s", PS_CLIENT_ADDR_PORT(state)); \ + msg_info("FAIL [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); \ (state)->flags |= (bits); \ } while (0) -#define PS_SKIP_SESSION_STATE(state, what, bits) do { \ +#define PSC_SKIP_SESSION_STATE(state, what, bits) do { \ if (msg_verbose) \ - msg_info("SKIP %s [%s]:%s", (what), PS_CLIENT_ADDR_PORT(state)); \ + msg_info("SKIP %s [%s]:%s", (what), PSC_CLIENT_ADDR_PORT(state)); \ (state)->flags |= (bits); \ } while (0) -#define PS_DROP_SESSION_STATE(state, reply) do { \ +#define PSC_DROP_SESSION_STATE(state, reply) do { \ if (msg_verbose) \ - msg_info("DROP [%s]:%s", PS_CLIENT_ADDR_PORT(state)); \ - (state)->flags |= PS_STATE_FLAG_NOFORWARD; \ + msg_info("DROP [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); \ + (state)->flags |= PSC_STATE_FLAG_NOFORWARD; \ (state)->final_reply = (reply); \ - ps_conclude(state); \ + psc_conclude(state); \ } while (0) -#define PS_ENFORCE_SESSION_STATE(state, reply) do { \ +#define PSC_ENFORCE_SESSION_STATE(state, reply) do { \ if (msg_verbose) \ - msg_info("ENFORCE [%s]:%s", PS_CLIENT_ADDR_PORT(state)); \ + msg_info("ENFORCE [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); \ (state)->rcpt_reply = (reply); \ - (state)->flags |= PS_STATE_FLAG_NOFORWARD; \ + (state)->flags |= PSC_STATE_FLAG_NOFORWARD; \ } while (0) -#define PS_UNPASS_SESSION_STATE(state, bits) do { \ +#define PSC_UNPASS_SESSION_STATE(state, bits) do { \ if (msg_verbose) \ - msg_info("UNPASS [%s]:%s", PS_CLIENT_ADDR_PORT(state)); \ + msg_info("UNPASS [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); \ (state)->flags &= ~(bits); \ } while (0) -#define PS_UNFAIL_SESSION_STATE(state, bits) do { \ +#define PSC_UNFAIL_SESSION_STATE(state, bits) do { \ if (msg_verbose) \ - msg_info("UNFAIL [%s]:%s", PS_CLIENT_ADDR_PORT(state)); \ + msg_info("UNFAIL [%s]:%s", PSC_CLIENT_ADDR_PORT(state)); \ (state)->flags &= ~(bits); \ } while (0) -#define PS_ADD_SERVER_STATE(state, fd) do { \ +#define PSC_ADD_SERVER_STATE(state, fd) do { \ (state)->smtp_server_fd = (fd); \ - ps_post_queue_length++; \ + psc_post_queue_length++; \ } while (0) -#define PS_DEL_CLIENT_STATE(state) do { \ +#define PSC_DEL_CLIENT_STATE(state) do { \ event_server_disconnect((state)->smtp_client_stream); \ (state)->smtp_client_stream = 0; \ - ps_check_queue_length--; \ + psc_check_queue_length--; \ } while (0) -extern PS_STATE *ps_new_session_state(VSTREAM *, const char *, const char *); -extern void ps_free_session_state(PS_STATE *); -extern const char *ps_print_state_flags(int, const char *); +extern PSC_STATE *psc_new_session_state(VSTREAM *, const char *, const char *); +extern void psc_free_session_state(PSC_STATE *); +extern const char *psc_print_state_flags(int, const char *); /* * postscreen_dict.c */ -extern int ps_addr_match_list_match(ADDR_MATCH_LIST *, const char *); -extern const char *ps_cache_lookup(DICT_CACHE *, const char *); -extern void ps_cache_update(DICT_CACHE *, const char *, const char *); +extern int psc_addr_match_list_match(ADDR_MATCH_LIST *, const char *); +extern const char *psc_cache_lookup(DICT_CACHE *, const char *); +extern void psc_cache_update(DICT_CACHE *, const char *, const char *); /* * postscreen_dnsbl.c */ -extern void ps_dnsbl_init(void); -extern int ps_dnsbl_retrieve(const char *, const char **, int); -extern int ps_dnsbl_request(const char *, void (*) (int, char *), char *); +extern void psc_dnsbl_init(void); +extern int psc_dnsbl_retrieve(const char *, const char **, int); +extern int psc_dnsbl_request(const char *, void (*) (int, char *), char *); /* * postscreen_tests.c */ -#define PS_INIT_TESTS(dst) do { \ +#define PSC_INIT_TESTS(dst) do { \ (dst)->flags = 0; \ - (dst)->pregr_stamp = PS_TIME_STAMP_INVALID; \ - (dst)->dnsbl_stamp = PS_TIME_STAMP_INVALID; \ - (dst)->pipel_stamp = PS_TIME_STAMP_INVALID; \ - (dst)->barlf_stamp = PS_TIME_STAMP_INVALID; \ - (dst)->penal_stamp = PS_TIME_STAMP_INVALID; \ + (dst)->pregr_stamp = PSC_TIME_STAMP_INVALID; \ + (dst)->dnsbl_stamp = PSC_TIME_STAMP_INVALID; \ + (dst)->pipel_stamp = PSC_TIME_STAMP_INVALID; \ + (dst)->barlf_stamp = PSC_TIME_STAMP_INVALID; \ + (dst)->penal_stamp = PSC_TIME_STAMP_INVALID; \ } while (0) -#define PS_BEGIN_TESTS(state, name) do { \ +#define PSC_BEGIN_TESTS(state, name) do { \ (state)->test_name = (name); \ GETTIMEOFDAY(&(state)->start_time); \ } while (0) -extern void ps_new_tests(PS_STATE *); -extern void ps_parse_tests(PS_STATE *, const char *, time_t); -extern char *ps_print_tests(VSTRING *, PS_STATE *); -extern char *ps_print_grey_key(VSTRING *, const char *, const char *, const char *, const char *); +extern void psc_new_tests(PSC_STATE *); +extern void psc_parse_tests(PSC_STATE *, const char *, time_t); +extern char *psc_print_tests(VSTRING *, PSC_STATE *); +extern char *psc_print_grey_key(VSTRING *, const char *, const char *, + const char *, const char *); -#define PS_MIN(x, y) ((x) < (y) ? (x) : (y)) -#define PS_MAX(x, y) ((x) > (y) ? (x) : (y)) +#define PSC_MIN(x, y) ((x) < (y) ? (x) : (y)) +#define PSC_MAX(x, y) ((x) > (y) ? (x) : (y)) /* * postscreen_early.c */ -extern void ps_early_tests(PS_STATE *); -extern void ps_early_init(void); +extern void psc_early_tests(PSC_STATE *); +extern void psc_early_init(void); /* * postscreen_smtpd.c */ -extern void ps_smtpd_tests(PS_STATE *); -extern void ps_smtpd_init(void); +extern void psc_smtpd_tests(PSC_STATE *); +extern void psc_smtpd_init(void); +extern void psc_smtpd_pre_jail_init(void); /* * postscreen_misc.c */ -extern char *ps_format_delta_time(VSTRING *, struct timeval, DELTA_TIME *); -extern void ps_conclude(PS_STATE *); -extern void ps_hangup_event(PS_STATE *); +extern char *psc_format_delta_time(VSTRING *, struct timeval, DELTA_TIME *); +extern void psc_conclude(PSC_STATE *); +extern void psc_hangup_event(PSC_STATE *); /* * postscreen_send.c */ -#define PS_SEND_REPLY(state, text) \ - ps_send_reply(vstream_fileno((state)->smtp_client_stream), \ +#define PSC_SEND_REPLY(state, text) \ + psc_send_reply(vstream_fileno((state)->smtp_client_stream), \ (state)->smtp_client_addr, \ (state)->smtp_client_port, \ (text)) -extern int ps_send_reply(int, const char *, const char *, const char *); -extern void ps_send_socket(PS_STATE *); +extern int psc_send_reply(int, const char *, const char *, const char *); +extern void psc_send_socket(PSC_STATE *); + + /* + * postscreen_starttls.c + */ +extern void psc_starttls_open(PSC_STATE *, EVENT_NOTIFY_FN); /* LICENSE /* .ad diff --git a/postfix/src/postscreen/postscreen_dict.c b/postfix/src/postscreen/postscreen_dict.c index 03a92b7e2..92c0ba450 100644 --- a/postfix/src/postscreen/postscreen_dict.c +++ b/postfix/src/postscreen/postscreen_dict.c @@ -6,15 +6,15 @@ /* SYNOPSIS /* #include