From: Wietse Venema Date: Wed, 3 Feb 2010 05:00:00 +0000 (-0500) Subject: postfix-2.7.0-RC1 X-Git-Tag: v2.7.0-RC1^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=724c95b1d6a5bf1dcba30ec7bbbfa852a95508d4;p=thirdparty%2Fpostfix.git postfix-2.7.0-RC1 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 4c0e83677..9522f47f1 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -15675,3 +15675,37 @@ Apologies for any names omitted. with Postfix 2.6 and earlier, or specify a non-empty next-hop filter destination. Files: *qmgr/qmgr_message.c proto/access, proto/header_checks, proto/postconf.proto, proto/FILTER_README. + +20100120 + + Cleanup: detect illegal pipelining after HELO, EHLO. File: + smtpd/smtpd.c. + +20100128 + + Documentation: streamlined the decriptions of protocol and + cipher tweaks. Victor Duchovni. Files: proto/TLS_README, + proto/postconf.proto. + +20100131 + + Documentation: the address verification database is now + persistent by default. This, combined with the now default + stress-dependent configuration, improves the performance + limits and simplifies database maintenance. Files: + proto/ADDRESS_VERIFICATION_README, verify/verify.c. + + Cleanup: undo the proxymap and trivial-rewrite max_idle=1s + override that was introduced with Postfix 2.3. It did not + help to retire long-lived proxymap or trivial-rewrite + processes on busy servers, and worsened performance on + low-traffic servers. The reduced ipc_ttl value (introduced + with Postfix 2.4) already solves the problem of retiring + long-lived proxymap or trivial-rewrite processes. Files: + proxymap/proxymap.c, trivial-rewrite/trivial-rewrite.c. + +20100202 + + Documentation: major revision of SASL_README with many + details on how to configure Cyrus SASL internals. Patrick + Koetter. File: proto/SASL_README.html diff --git a/postfix/Makefile.in b/postfix/Makefile.in index c5efb2165..87a77d8da 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -9,7 +9,7 @@ DIRS = src/util src/global src/dns src/tls src/xsasl src/milter src/master \ src/postkick src/postlock src/postlog src/postmap src/postqueue \ src/postsuper src/qmqpd src/spawn src/flush src/verify \ src/virtual src/proxymap src/anvil src/scache src/discard src/tlsmgr \ - src/postmulti src/postscreen src/dnsblog + src/postmulti MANDIRS = proto man html LIBEXEC = libexec/post-install libexec/postfix-files libexec/postfix-script \ libexec/postfix-wrapper libexec/main.cf libexec/master.cf \ diff --git a/postfix/README_FILES/ADDRESS_VERIFICATION_README b/postfix/README_FILES/ADDRESS_VERIFICATION_README index 4baf27a46..97dd381c3 100644 --- a/postfix/README_FILES/ADDRESS_VERIFICATION_README +++ b/postfix/README_FILES/ADDRESS_VERIFICATION_README @@ -4,10 +4,10 @@ PPoossttffiixx AAddddrreessss VVeerriiffiiccaattiioonn WWAARRNNIINNGG -The sender/recipient address verification feature described in this document is -suitable only for low-traffic sites. It performs poorly under high load; -excessive sender address verification activity may even cause your site to be -blacklisted by some providers. See the "Limitations" section below for details. +Recipient address verification may cause an increased load on down-stream +servers in the case of a dictionary attack or a flood of backscatter bounces. +Sender address verification may cause your site to be blacklisted by some +providers. See also the "Limitations" section below for more. WWhhaatt PPoossttffiixx aaddddrreessss vveerriiffiiccaattiioonn ccaann ddoo ffoorr yyoouu @@ -18,8 +18,8 @@ verified to be deliverable. The technique has obvious uses to reject junk mail with an unreplyable sender address. -The technique may also be useful to block mail for undeliverable recipients, -for example on a mail relay host that does not have a list of all the valid +The technique is also useful to block mail for undeliverable recipients, for +example on a mail relay host that does not have a list of all the valid recipient addresses. This prevents undeliverable junk mail from entering the queue, so that Postfix doesn't have to waste resources trying to send MAILER- DAEMON messages back. @@ -47,18 +47,26 @@ the Postfix MTA itself, or it could be a remote MTA (SMTP interruptus). Probe messages are like normal mail, except that they are never delivered, deferred or bounced; probe messages are always discarded. - Postfix Postfix Address - Internet -> SMTP <-> verify <-> verification - server server database - - | ^ - probe delivery - messages status - v | - - Postfix Postfix - queue -> delivery - agents + + probe Postfix + message -> mail + queue + Postfix Postfix -> + Internet -> SMTP <-> verify + server server | + v + + <- Postfix + probe <- delivery -> Local + status agents -> Remote + ^ + | + v + + + Address + verification + database With Postfix address verification turned on, normal mail will suffer only a short delay of up to 6 seconds while an address is being verified for the first @@ -77,7 +85,8 @@ LLiimmiittaattiioonnss ooff aaddddrreessss vveerriiffi address, without actually delivering mail to it. If the nearest MTA accepts the address, then Postfix assumes that the address is deliverable. In reality, mail for a remote address can bounce AFTER the nearest MTA accepts - the recipient address. + the recipient address, or AFTER the nearest MTA accepts the message + content. * Some sites may blacklist you when you are probing them too often (a probe is an SMTP session that does not deliver mail), or when you are probing @@ -95,30 +104,31 @@ LLiimmiittaattiioonnss ooff aaddddrreessss vveerriiffi * Postfix assumes that an address is undeliverable when the nearest MTA for the address rejects the probe, regardless of the reason for rejection (client rejected, HELO rejected, MAIL FROM rejected, etc.). Thus, Postfix - rejects mail when the sender's MTA rejects mail from your machine. This is - a good thing. + rejects an address when the nearest MTA for that address rejects mail from + your machine for any reason. This is not a limitation, but it is mentioned + here just in case people believe that it is a limitation. - * Unfortunately, some major sites such as YAHOO do not reject unknown - addresses in reply to the RCPT TO command, but report a delivery failure in - response to end of DATA after a message is transferred. Postfix address - verification does not work with such sites. + * Unfortunately, some sites do not reject unknown addresses in reply to the + RCPT TO command, but report a delivery failure in response to end of DATA + after a message is transferred. Postfix address verification does not work + with such sites. - * By default, Postfix probe messages have "double-bounce@$myorigin" as the - sender address (with Postfix versions before 2.5, the default is + * By default, Postfix probe messages have a sender address "double- + bounce@$myorigin" (with Postfix versions before 2.5, the default is "postmaster@$myorigin"). This is SAFE because the Postfix SMTP server does not reject mail for this address. - You can change this into the null address ("address_verify_sender ="). This - is UNSAFE because address probes will fail with mis-configured sites that - reject MAIL FROM: <>, while probes from "postmaster@$myorigin" would - succeed. + You can change the probe sender address into the null address + ("address_verify_sender ="). This is UNSAFE because address probes will + fail with mis-configured sites that reject MAIL FROM: <>, while probes from + "postmaster@$myorigin" would succeed. RReecciippiieenntt aaddddrreessss vveerriiffiiccaattiioonn -As mentioned earlier, recipient address verification may be useful to block -mail for undeliverable recipients on a mail relay host that does not have a -list of all valid recipient addresses. This can help to prevent the mail queue -from filling up with MAILER-DAEMON messages. +As mentioned earlier, recipient address verification is useful to block mail +for undeliverable recipients on a mail relay host that does not have a list of +all valid recipient addresses. This can help to prevent the mail queue from +filling up with MAILER-DAEMON messages. Recipient address verification is relatively straightforward and there are no surprises. If a recipient probe fails, then Postfix rejects mail for the @@ -127,9 +137,10 @@ the recipient address. However, recipient address verification probes can increase the load on down-stream MTAs when you're being flooded by backscatter bounces, or when some spammer is mounting a dictionary attack. -By default, address verification results are not saved. To avoid probing the -same address repeatedly, you can store the result in a persistent database as -described later. +By default, address verification results are saved in a persistent database +(Postfix version 2.7 and later; with earlier versions, specify the database in +main.cf as described later). The persistent database helps to avoid probing the +same address repeatedly. /etc/postfix/main.cf: smtpd_recipient_restrictions = @@ -177,11 +188,13 @@ verification for specific domains that often appear in forged email. # Postfix 2.6 and later. # unverified_sender_defer_code = 250 + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify /etc/postfix/sender_access: + # Don't do this when you handle lots of email. aol.com reject_unverified_sender hotmail.com reject_unverified_sender bigfoot.com reject_unverified_sender @@ -216,6 +229,7 @@ be blocked: # Postfix 2.6 and later. # unverified_sender_reject_reason = Address verification failed + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify @@ -262,10 +276,11 @@ probe fails with some temporary error. AAddddrreessss vveerriiffiiccaattiioonn ddaattaabbaassee To improve performance, the Postfix verify(8) daemon can save address -verification results to a persistent database. The address_verify_map (NOTE: -singular) configuration parameter specifies persistent storage for sender or -recipient address verification results. If you specify an empty value, all -address verification results are lost after "postfix reload" or "postfix stop". +verification results to a persistent database. This is enabled by default with +Postfix 2.7 and later. The address_verify_map (NOTE: singular) configuration +parameter specifies persistent storage for sender or recipient address +verification results. If you specify an empty value, all address verification +results are lost after "postfix reload" or "postfix stop". /etc/postfix/main.cf: # Default setting for Postfix 2.7 and later. diff --git a/postfix/README_FILES/OVERVIEW b/postfix/README_FILES/OVERVIEW index 9b01a8439..95a3056b9 100644 --- a/postfix/README_FILES/OVERVIEW +++ b/postfix/README_FILES/OVERVIEW @@ -336,19 +336,60 @@ queues. * The verify(8) server verifies that a sender or recipient address is deliverable before the smtpd(8) server accepts it. The verify(8) server - injects probe messages into the Postfix queue and processes status updates - from delivery agents and/or queue manager. This process is described in the - ADDRESS_VERIFICATION_README document. The verify(8) service is available - with Postfix version 2.1 and later. - - qmgr(8) Delivery - Network -> smtpd(8) <-> verify(8) -> cleanup(8) -> Postfix -> agents - queue - - \ | / - v - \ / - <- <- + queries a cache with address verification results. If a result is not + found, the verify(8) server injects a probe message into the Postfix queue + and processes the status update from a delivery agent or queue manager. + This process is described in the ADDRESS_VERIFICATION_README document. The + verify(8) service is available with Postfix version 2.1 and later. + + + probe Postfix + message -> mail + queue + Network -> smtpd(8) <-> verify(8) -> + + | + v + + <- probe Postfix -> Local + status <- delivery -> Network + ^ agents + | + v + + + Address + verification + cache + + * The postscreen(8) server can be put "in front" of Postfix smtpd(8) + processes. Its purpose is to accept connections from the network and to + decide what SMTP clients are allowed to talk to Postfix. According to the + 2008 MessageLabs annual report, 81% of all email was spam, and 90% of that + was sent by botnets. While postscreen(8) keeps the zombies away, more smtpd + (8) processes remain available for legitimate clients. + + The postscreen(8) server is still evolving, and is likely to undergo + changes that break compatibility with earlier versions. For this reason the + postscreen(8) server is not installed with the stable Postfix release. + + zombie + + \ + + zombie - - smtpd(8) + + \ / + + other --- postscreen(8) + + / \ + + other - - smtpd(8) + + / + + zombie PPoossttffiixx ssuuppppoorrtt ccoommmmaannddss diff --git a/postfix/README_FILES/SASL_README b/postfix/README_FILES/SASL_README index bc57d5025..9f7c4289d 100644 --- a/postfix/README_FILES/SASL_README +++ b/postfix/README_FILES/SASL_README @@ -2,368 +2,884 @@ PPoossttffiixx SSAASSLL HHoowwttoo ------------------------------------------------------------------------------- -WWAARRNNIINNGG +WWaarrnniinngg People who go to the trouble of installing Postfix may have the expectation -that Postfix is more secure than some other mailers. The Cyrus SASL library is -a lot of code. With this, Postfix becomes as secure as other mail systems that -use the Cyrus SASL library. Dovecot provides an alternative that may be worth -considering. - -HHooww PPoossttffiixx uusseess SSAASSLL aauutthheennttiiccaattiioonn iinnffoorrmmaattiioonn - -Postfix SASL support (RFC 4954, formerly RFC 2554) can be used to authenticate -remote SMTP clients to the Postfix SMTP server, and to authenticate the Postfix -SMTP client to a remote SMTP server. - -When receiving mail, the Postfix SMTP server logs the client-provided username, -authentication method, and sender address to the maillog file, and optionally -grants mail access via the permit_sasl_authenticated UCE restriction. - -When sending mail, the Postfix SMTP client can look up the remote SMTP server -hostname or destination domain (the address right-hand part) in a SASL password -table, and if a username/password is found, it will use that username and -password to authenticate to the remote SMTP server. And as of version 2.3, -Postfix can be configured to search its SASL password table by the sender email -address. - -This document covers the following topics: - - * What SASL implementations are supported - * Building Postfix with Dovecot SASL support - * Building the Cyrus SASL library - * Building Postfix with Cyrus SASL support - * Enabling SASL authentication in the Postfix SMTP server - * Dovecot SASL configuration for the Postfix SMTP server - * Cyrus SASL configuration for the Postfix SMTP server - * Testing SASL authentication in the Postfix SMTP server - * Trouble shooting the SASL internals - * Enabling SASL authentication in the Postfix SMTP client - * Supporting multiple ISP accounts in the Postfix SMTP client +that Postfix is more secure than some other mailers. The Cyrus SASL library +contains a lot of code. With this, Postfix becomes as secure as other mail +systems that use the Cyrus SASL library. Dovecot provides an alternative that +may be worth considering. + +HHooww PPoossttffiixx uusseess SSAASSLL aauutthheennttiiccaattiioonn + +When an SMTP client connects to an SMTP server, the server needs to decide +whether that client is authorized to send mail to remote destinations, or +whether the client can send mail only to the destinations that the server +itself is responsible for. Usually, the SMTP server will allow mail to remote +destinations only if the client's IP address is in the "same network" as the +server's IP address. + +Sometimes the SMTP client and server are in different networks, but the client +still needs "same network" privileges. To address this problem, Postfix +supports SASL authentication (RFC 4954, formerly RFC 2554). With this a remote +SMTP client can authenticate to the Postfix SMTP server, and the Postfix SMTP +client can authenticate to a remote SMTP server. Once the client is +authenticated the server can give it "same network" privileges. + +Postfix does not implement SASL itself, but instead uses existing +implementations as building blocks. This means that some SASL-related +configuration will involve files that belong to Postfix, while other +configuration will involve files that belong to the specific SASL +implementation that Postfix will use. This document covers both the Postfix and +non-Postfix configuration. + +You can read more about the following topics: + + * Configuring SASL authentication in the Postfix SMTP server + * Configuring SASL authentication in the Postfix SMTP/LMTP client + * Building Postfix with SASL support + * Using Cyrus SASL version 1.5.x * Credits -WWhhaatt SSAASSLL iimmpplleemmeennttaattiioonnss aarree ssuuppppoorrtteedd +CCoonnffiigguurriinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr -This document describes Postfix with the following SASL implementations: +As mentioned earlier, SASL is implemented separately from Postfix. For this +reason, configuring SASL authentication in the Postfix SMTP server involves two +different steps: - * Cyrus SASL version 1 (client and server). + * Configuring the SASL implementation to offer a list of mechanisms that are + suitable for SASL authentication and, depending on the SASL implementation + used, configuring authentication backends that verify the remote SMTP + client's authentication data against the system password file or some other + database. - * Cyrus SASL version 2 (client and server). + * Configuring the Postfix SMTP server to enable SASL authentication, and to + authorize clients to relay mail or to control what envelope sender + addresses the client may use. - * Dovecot protocol version 1 (server only, Postfix version 2.3 and later) +Successful authentication in the Postfix SMTP server requires a functional SASL +framework. Configuring SASL should therefore always be the first step. -Postfix version 2.3 introduces a plug-in mechanism that provides support for -multiple SASL implementations. To find out what implementations are built into -Postfix, use the following commands: +You can read more about the following topics: - % postconf -a (SASL support in the SMTP server) - % postconf -A (SASL support in the SMTP+LMTP client) + * Which SASL Implementations are supported? + * Configuring Dovecot SASL -Needless to say, these commands are not available in earlier Postfix versions. + o Postfix to Dovecot SASL communication -BBuuiillddiinngg PPoossttffiixx wwiitthh DDoovveeccoott SSAASSLL ssuuppppoorrtt + * Configuring Cyrus SASL -These instructions assume that you build Postfix from source code as described -in the INSTALL document. Some modification may be required if you build Postfix -from a vendor-specific source package. + o Cyrus SASL configuration file name + o Cyrus SASL configuration file location + o Postfix to Cyrus SASL communication -Support for the Dovecot version 1 SASL protocol is available in Postfix 2.3 and -later. At the time of writing, only server-side SASL support is available, so -you can't use it to authenticate to your network provider's server. Dovecot -uses its own daemon process for authentication. This keeps the Postfix build -process simple, because there is no need to link extra libraries into Postfix. + * Enabling SASL authentication and authorization in the Postfix SMTP server -To generate the necessary Makefiles, execute the following in the Postfix top- -level directory: + o Enabling SASL authentication in the Postfix SMTP server + o Postfix SMTP Server Authentication Policy + o Enabling SASL authorization in the Postfix SMTP server + o Additional SMTP Server SASL options - % make makefiles CCARGS='-DUSE_SASL_AUTH - - DDEF_SERVER_SASL_TYPE=\"dovecot\"' + * Testing SASL authentication in the Postfix SMTP server -After this, proceed with "make" as described in the INSTALL document. +WWhhiicchh SSAASSLL IImmpplleemmeennttaattiioonnss aarree ssuuppppoorrtteedd?? -Notes: +Currently the Postfix SMTP server supports the Cyrus SASL and Dovecot SASL +implementations. - * The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just makes Postfix - configuration a little more convenient because you don't have to specify - the SASL plug-in type in the Postfix main.cf file. + NNoottee - * If you also want support for LDAP or TLS, you will have to merge their - CCARGS and AUXLIBS into the above command line. + Before Postfix version 2.3, Postfix had support only for Cyrus SASL. + Current Postfix versions have a plug-in architecture that can support + multiple SASL implementations. -BBuuiillddiinngg tthhee CCyyrruuss SSAASSLL lliibbrraarryy +To find out what SASL implementations are compiled into Postfix, use the +following commands: -Postfix appears to work with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, which are -available from: + % ppoossttccoonnff --aa (SASL support in the SMTP server) + % ppoossttccoonnff --AA (SASL support in the SMTP+LMTP client) - ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ +These commands are available only with Postfix version 2.3 and later. -IMPORTANT: if you install the Cyrus SASL libraries as per the default, you will -have to symlink /usr/lib/sasl -> /usr/local/lib/sasl for version 1.5.x or /usr/ -lib/sasl2 -> /usr/local/lib/sasl2 for version 2.1.x. +CCoonnffiigguurriinngg DDoovveeccoott SSAASSLL -Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN -authentication method. To enable this authentication method, specify ``./ -configure --enable-login''. +Dovecot is a POP/IMAP server that must be configured to authenticate POP/IMAP +clients. When the Postfix SMTP server uses Dovecot SASL, it also reuses this +configuration. Consult the Dovecot documentation for how to configure and +operate the Dovecot authentication server. -BBuuiillddiinngg PPoossttffiixx wwiitthh CCyyrruuss SSAASSLL ssuuppppoorrtt +PPoossttffiixx ttoo DDoovveeccoott SSAASSLL ccoommmmuunniiccaattiioonn -These instructions assume that you build Postfix from source code as described -in the INSTALL document. Some modification may be required if you build Postfix -from a vendor-specific source package. +Communication between the Postfix SMTP server and Dovecot SASL happens via a +UNIX-domain socket. The socket pathname and the list of mechanisms offered to +Postfix need to be specified on the Dovecot server side in dovecot.conf. -The following assumes that the Cyrus SASL include files are in /usr/local/ -include, and that the Cyrus SASL libraries are in /usr/local/lib. +The following example assumes that the Postfix queue is under /var/spool/ +postfix/. -On some systems this generates the necessary Makefile definitions: + 1 /etc/dovecot.conf: + 2 auth default { + 3 mechanisms = plain login + 4 passdb pam { + 5 } + 6 userdb passwd { + 7 } + 8 socket listen { + 9 client { + 10 path = /var/spool/postfix/private/auth + 11 mode = 0660 + 12 user = postfix + 13 group = postfix + 14 } + 15 } + 16 } -(for Cyrus SASL version 1.5.x): +Line 3 provides plain and login as mechanisms for the Postfix SMTP server, line +10 places the Dovecot SASL socket in /var/spool/postfix/private/auth, and lines +11-13 limit read+write permissions to user and group postfix only. - % make tidy # if you have left-over files from a previous build - % make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ - -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl" +Proceed with the section "Enabling SASL authentication and authorization in the +Postfix SMTP server" to turn on and use SASL in the Postfix SMTP server. -(for Cyrus SASL version 2.1.x): +CCoonnffiigguurriinngg CCyyrruuss SSAASSLL - % make tidy # if you have left-over files from a previous build - % make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ - -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2" +The Cyrus SASL framework was supports a wide variety of applications. Different +applications may require different configurations. As a consequence each +application may have its own configuration file. -On Solaris 2.x you need to specify run-time link information, otherwise ld.so -will not find the SASL shared library: +The first step configuring Cyrus SASL is to determine name and location of a +configuration file that describes how the Postfix SMTP server will use the SASL +framework. -(for Cyrus SASL version 1.5.x): +CCyyrruuss SSAASSLL ccoonnffiigguurraattiioonn ffiillee nnaammee - % make tidy # if you have left-over files from a previous build - % make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ - -I/usr/local/include" AUXLIBS="-L/usr/local/lib \ - -R/usr/local/lib -lsasl" +The name of the configuration file (default: smtpd.conf) is configurable. It is +a concatenation from a value that the Postfix SMTP server sends to the Cyrus +SASL library, and the suffix .conf, added by Cyrus SASL. -(for Cyrus SASL version 2.1.x): +The value sent by Postfix is the name of the server component that will use +Cyrus SASL. It defaults to smtpd and is configured with one of the following +variables: - % make tidy # if you have left-over files from a previous build - % make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ - -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \ - -R/usr/local/lib -lsasl2" + /etc/postfix/main.cf: + # Postfix 2.3 and later + smtpd_sasl_path = smtpd -EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr + # Postfix < 2.3 + smtpd_sasl_application_name = smtpd + +CCyyrruuss SSAASSLL ccoonnffiigguurraattiioonn ffiillee llooccaattiioonn + +The location where Cyrus SASL searches for the named file depends on the Cyrus +SASL version and the OS/distribution used. + +You can read more about the following topics: + + * Cyrus SASL version 2.x searches for the configuration file in /usr/lib/ + sasl2/. + + * Cyrus SASL version 2.1.22 and newer additionally search in /etc/sasl2/. + + * Some Postfix distributions are modified and look for the Cyrus SASL + configuration file in /etc/postfix/sasl/, /var/lib/sasl2/ etc. See the + distribution-specific documentation to determine the expected location. + + NNoottee + + Cyrus SASL searches /usr/lib/sasl2/ first. If it finds the specified + configuration file there, it will not examine other locations. + +PPoossttffiixx ttoo CCyyrruuss SSAASSLL ccoommmmuunniiccaattiioonn + +As the Postfix SMTP server is linked with the Cyrus SASL library libsasl, +communication between Postfix and Cyrus SASL takes place by calling functions +in the SASL library. + +The SASL library may use an external password verification service, or an +internal plugin to connect to authentication backends and verify the SMTP +client's authentication data against the system password file or other +databases. + +The following table shows typical combinations discussed in this document: + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + | aauutthheennttiiccaattiioonn bbaacckkeenndd |ppaasssswwoorrdd vveerriiffiiccaattiioonn sseerrvviiccee // pplluuggiinn| + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |/etc/shadow |saslauthd | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |PAM |saslauthd | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |IMAP server |saslauthd | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |sasldb |sasldb | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |MySQL, PostgreSQL, SQLite|sql | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |LDAP |ldapdb | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + + NNoottee + + Read the Cyrus SASL documentation for other backends it can use. + +ssaassllaauutthhdd -- CCyyrruuss SSAASSLL ppaasssswwoorrdd vveerriiffiiccaattiioonn sseerrvviiccee + +Communication between the Postfix SMTP server (read: Cyrus SASL's libsasl) and +the saslauthd server takes place over a UNIX-domain socket. + +saslauthd usually establishes the UNIX domain socket in /var/run/saslauthd/ and +waits for authentication requests. The Postfix SMTP server must have +read+execute permission to this directory or authentication attempts will fail. + + IImmppoorrttaanntt + + Some distributions require the user postfix to be member of a special group + e.g. sasl, otherwise it will not be able to access the saslauthd socket + directory. + +The following example configures the Cyrus SASL library to contact saslauthd as +its password verification service: + + /etc/sasl2/smtpd.conf: + pwcheck_method: saslauthd + mech_list: PLAIN LOGIN + + IImmppoorrttaanntt + + Do not specify any other mechanisms in mech_list than PLAIN or LOGIN when + using saslauthd! It can only handle these two mechanisms, and + authentication will fail if clients are allowed to choose other mechanisms. + + IImmppoorrttaanntt + + Plaintext mechanisms (PLAIN, LOGIN) send credentials unencrypted. This + information should be protected by an additional security layer such as a + TLS-encrypted SMTP session (see: TLS_README). + +Additionally the saslauthd server itself must be configured. It must be told +which authentication backend to turn to for password verification. The backend +is choosen as a command line option when saslauthd is started and will be shown +in the following examples. + + NNoottee + + Some distributions use a configuration file to provide saslauthd command + line options to set e.g. the authentication backend. Typical locations are + /etc/sysconfig/saslauthd or /etc/default/saslauthd. + +UUssiinngg ssaassllaauutthhdd wwiitthh //eettcc//sshhaaddooww + +Access to the /etc/shadow system password file requires root privileges. The +Postfix SMTP server (and in consequence libsasl linked to the server) runs with +the least privilege possible. Direct access to /etc/shadow would not be +possible without breaking the Postfix security architecture. + +The saslauthd socket builds a safe bridge. Postfix, running as limited user +postfix, can access the UNIX-domain socket that saslauthd receives commands on; +saslauthd, running as privileged user root, has the privileges required to +access the shadow file. + +The saslauthd server verifies passwords against the authentication backend / +etc/shadow if started like this: + + % ssaassllaauutthhdd --aa sshhaaddooww + +See section "Testing saslauthd authentication" for test instructions. + +UUssiinngg ssaassllaauutthhdd wwiitthh PPAAMM + +Cyrus SASL can use the PAM framework to authenticate credentials. saslauthd +uses the PAM framework when started like this: + + % ssaassllaauutthhdd --aa ppaamm + + NNoottee + + PAM configuration for the Postfix SMTP server is usually given in /etc/ + pam.d/smtp and is beyond the scope of this document. + +See section "Testing saslauthd authentication" for test instructions. + +UUssiinngg ssaassllaauutthhdd wwiitthh aann IIMMAAPP sseerrvveerr + +saslauthd can verify the SMTP client credentials by using them to log into an +IMAP server. If the login succeeds, SASL authentication also succeeds. +saslauthd contacts an IMAP server when started like this: + + % ssaassllaauutthhdd --aa rriimmaapp --OO iimmaapp..eexxaammppllee..ccoomm + + NNoottee + + The option "-O imap.example.com" specifies the IMAP server saslauthd should + contact when it verifies credentials. + + IImmppoorrttaanntt + + saslauthd sends IMAP login information unencrypted. Any IMAP session + leaving the local host should be protected by an additional security layer + such as an SSL tunnel. + +See section "Testing saslauthd authentication" for test instructions. + +TTeessttiinngg ssaassllaauutthhdd aauutthheennttiiccaattiioonn + +Cyrus SASL provides the testsaslauthd utility to test saslauthd authentication. +The username and password are given as command line arguments. The example +shows the response when authentication is successful: + + % tteessttssaassllaauutthhdd --uu uusseerrnnaammee --pp ppaasssswwoorrdd + 0: OK "Success." + + NNoottee + + Sometimes the testsaslauthd program is not distributed with a the Cyrus + SASL main package. In that case, it may be distributed with -devel, -dev or + -debug packages. + +Specify an additional "-s smtp" if saslauthd was configured to contact the PAM +authentication framework and an additional "-f //ppaatthh//ttoo//ssoocckkeettddiirr//mmuuxx" if +saslauthd establishes the UNIX-domain socket in a non-default location. + +If authentication succeeds, proceed with the section "Enabling SASL +authentication and authorization in the Postfix SMTP server". + +CCyyrruuss SSAASSLL PPlluuggiinnss -- aauuxxiilliiaarryy pprrooppeerrttyy pplluuggiinnss + +Cyrus SASL uses a plugin infrastructure (called auxprop) to expand libsasl's +capabilities. Currently Cyrus SASL sources provide three authentication +plugins. + + sasldb + Accounts are stored stored in a Cyrus SASL Berkeley DB database + + sql + Accounts are stored in a SQL database + + ldapdb + Accounts are stored stored in an LDAP database -In order to enable SASL support in the Postfix SMTP server: + IImmppoorrttaanntt + + These three plugins support shared-secret mechanisms i.e. CRAM-MD5, DIGEST- + MD5 and NTLM. These mechanisms send credentials encrypted but their + verification process requires the password to be available in plaintext. + Consequently passwords cannot (!) be stored in encrypted form. + +TThhee ssaassllddbb pplluuggiinn + +The sasldb auxprop plugin authenticates credentials stored in a Berkeley DB +database. The database schema is specific to Cyrus SASL. The database is +usually located at /etc/sasldb2. + + NNoottee + + The sasldb2 file contains passwords in plaintext, and should have + read+write access only to user postfix or a group that postfix is member + of. + +The saslpasswd2 command-line utility creates and maintains the database: + + % ssaassllppaasssswwdd22 --cc --uu eexxaammppllee..ccoomm uusseerrnnaammee + Password: + Again (for verification): + +This command creates an account uusseerrnnaammee@@eexxaammppllee..ccoomm. + + IImmppoorrttaanntt + + users must specify uusseerrnnaammee@@eexxaammppllee..ccoomm as login name, not uusseerrnnaammee. + +Run the following command to reuse the Postfix mydomain parameter value as the +login domain: + + % ssaassllppaasssswwdd22 --cc --uu ``ppoossttccoonnff --hh mmyyddoommaaiinn`` uusseerrnnaammee + Password: + Again (for verification): + + NNoottee + + Run saslpasswd2 without any options for further help on how to use the + command. + +The sasldblistusers2 command lists all existing users in the sasldb database: + + % ssaassllddbblliissttuusseerrss22 + username1@example.com: password1 + username2@example.com: password2 + +Configure libsasl to use sasldb with the following instructions: + + /etc/sasl2/smtpd.conf: + pwcheck_method: auxprop + auxprop_plugin: sasldb + mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM + + NNoottee + + In the above example adjust mech_list to the mechanisms that are applicable + for your environment. + +TThhee ssqqll pplluuggiinn + +The sql auxprop plugin is a generic SQL plugin. It provides access to +credentials stored in a MySQL, a PostgreSQL or a SQLite database. + + NNoottee + + The shared-secret mechanisms (CRAM-MD5, etc.) require that the SASL client + passwords are stored as plaintext. + + TTiipp + + Use "saslauthd > pam > (pam database module)" to verify encrypted passwords + in an SQL database. + +The following example configures libsasl to use the sql plugin and connects it +to a PostgreSQL server: + + /etc/sasl2/smtpd.conf: + pwcheck_method: auxprop + auxprop_plugin: sql + mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM + sql_engine: pgsql + sql_hostnames: 127.0.0.1, 192.0.2.1 sql_user: username + sql_passwd: secret + sql_database: dbname + sql_select: SELECT password FROM users WHERE user = '%u'@'%r' + + NNoottee + + Set appropriate permissions if smtpd.conf contains a password. The file + should be readable by the postfix user. + + NNoottee + + In the above example, adjust mech_list to the mechanisms that are + applicable for your environment. + +The sql plugin has the following configuration options: + + sql_engine + Specify mysql to connect to a MySQL server, pgsql for a PostgreSQL + server or sqlite for an SQLite database + + sql_hostnames + Specify one or more servers (hostname or hostname:port) separated by + commas. + + NNoottee + + With MySQL servers, specify localhost to connect over a UNIX-domain + socket, and specify 127.0.0.1 to connect over a TCP socket. + + sql_user + The login name to gain access to the database. + + sql_passwd + The password to gain access to the database. + + sql_database + The name of the database to connect to. + + sql_select + The SELECT statement that should retrieve the plaintext password from a + database table. + + IImmppoorrttaanntt + + Do not enclose the statement in quotes! Use single quotes to escape + macros! + +The sql plugin provides macros to build sql_select statements. They will be +replaced with arguments sent from the client. The following macros are +available: + + %u + The name of the user whose properties are being selected. + + %p + The name of the property being selected. While this could technically + be anything, Cyrus SASL will try userPassword and cmusaslsecretMECHNAME + (where MECHNAME is the name of a SASL mechanism). + + %r + The name of the realm to which the user belongs. This could be the + KERBEROS realm, the fully-qualified domain name of the computer the + SASL application is running on, or the domain after the "@" in a + username. + +TThhee llddaappddbb pplluuggiinn + +The ldapdb auxprop plugin provides access to credentials stored in an OpenLDAP +LDAP server. It is the only plugin that implements proxy authorization. + +Proxy authorization in this context means: The ldapdb plugin must SASL +authenticate with the OpenLDAP server. The server then decides if the ldapdb +plugin should be authorized to read the authenticating user's password. Once +the ldapdb plugin has gone through proxy authorization it may proceed and +authenticate the remote SMTP client's credentials. + +In a nutshell: Configuring ldapdb means authentication and authorization must +be configured twice - once in the Postfix SMTP server to authenticate and +authorize the remote SMTP client, and once in the OpenLDAP slapd server to +authenticate and authorize the ldapdb plugin. + +This example configures libsasl to use the ldapdb plugin and the plugin to +connect to an OpenLDAP server: + + /etc/sasl2/smtpd.conf: + pwcheck_method: auxprop + auxprop_plugin: ldapdb + mech_list: PLAIN LOGIN NTLM CRAM-MD5 DIGEST-MD5 + ldapdb_uri: ldap://localhost + ldapdb_id: proxyuser + ldapdb_pw: password + ldapdb_mech: DIGEST-MD5 + + IImmppoorrttaanntt + + Set appropriate permissions if smtpd.conf contains a password. The file + should be readable by the postfix user. + + NNoottee + + The shared-secret mechanisms (CRAM-MD5, etc.) require that the SASL client + passwords are stored as plaintext. + +The following is a summary of applicable smtpd.conf file entries: + + auxprop_plugin + Specify ldapdb to enable the plugin. + + ldapdb_uri + Specify either ldapi:// for to connect over a UNIX-domain socket, ldap: + // for an unencrypted TCP connection or ldaps:// for an encrypted TCP + connection. + + ldapdb_id + The login name to authenticate the ldapdb plugin to the LDAP server + (proxy authorization). + + ldapdb_pw + The password (in plaintext) to authenticate the ldapdb plugin to the + LDAP server (proxy authorization). + + ldapdb_mech + The mechanism to authenticate the ldapdb plugin to the OpenLDAP slapd + server. + + NNoottee + + Specify a mechanism here that is supported by the OpenLDAP slapd + server. + + ldapdb_rc (optional) + The path to a file containing individual configuration options for the + ldapdb LDAP client (libldap). This allows to specify a TLS client + certificate which in turn can be used to use the SASL EXTERNAL + mechanism. + + NNoottee + + This mechanism supports authentication over an encrypted transport + layer, which is recommended if the plugin must connect to an + OpenLDAP server on a remote machine. + + ldapdb_starttls (optional) + The TLS policy for connecting to the LDAP server. Specify either try or + demand. If the option is try the plugin will attempt to establish a + TLS-encrypted connection with the LDAP server, and will fallback to an + unencrypted connection if TLS fails. If the policy is demand and a TLS- + encrypted connection cannot be established, the connection fails + immediately. + +When the ldapdb plugin connects to the OpenLDAP server and successfully +authenticates, the OpenLDAP server decides if the plugin user is authorized to +read SASL account information. + +The following configuration gives an example of authorization configuration in +the OpenLDAP slapd server: + + /etc/openldap/slapd.conf: + authz-regexp + uid=(.*),cn=.*,cn=auth + ldap:///dc=example,dc=com??sub?cn=$1 + authz-policy to + +Here, the authz-regexp option serves for authentication of the ldapdb user. It +maps its login name to a DN in the LDAP directory tree where slapd can look up +the SASL account information. The authz-policy options defines the +authentication policy. In this case it grants authentication privileges "to" +the ldapdb plugin. + +The last configuration step is to tell the OpenLDAP slapd server where ldapdb +may search for usernames matching the one given by the mail client. The example +below adds an additional attribute ldapdb user object (here: authzTo because +the authz-policy is "to") and configures the scope where the login name +"proxyuser" may search: + + dn: cn=proxyuser,dc=example,dc=com + changetype: modify + add: authzTo + authzTo: dn.regex:uniqueIdentifier=(.*),ou=people,dc=example,dc=com + +Use the ldapmodify or ldapadd command to add the above attribute. + + NNoottee + + Read the chapter "Using SASL" in the OpenLDAP Admin Guide for more detailed + instructions to set up SASL authentication in OpenLDAP. + +EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn aanndd aauutthhoorriizzaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr + +By default the Postfix SMTP server uses the Cyrus SASL implementation. If the +Dovecot SASL implementation should be used, specify an smtpd_sasl_type value of +dovecot instead of cyrus: /etc/postfix/main.cf: - smtpd_sasl_auth_enable = yes + smtpd_sasl_type = dovecot -In order to allow mail relaying by authenticated remote SMTP clients: +Additionally set the path where the Postfix SMTP server can find the Dovecot +SASL socket: /etc/postfix/main.cf: - smtpd_recipient_restrictions = - permit_mynetworks - permit_sasl_authenticated - reject_unauth_destination + smtpd_sasl_path = private/auth -To report SASL login names in Received: message headers (Postfix version 2.3 -and later): + NNoottee + + This example uses a pathname relative to the Postfix queue directory, so + that it will work whether or not the Postfix SMTP server runs chrooted. + +EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr + +Regardless of the SASL implementation type, enabling SMTP authentication in the +Postfix SMTP server always requires seting the smtpd_sasl_auth_enable option: /etc/postfix/main.cf: - smtpd_sasl_authenticated_header = yes + smtpd_sasl_auth_enable = yes + +After a "postfix reload", SMTP clients will see the additional capability AUTH +in an SMTP session, followed by a list of authentication mechanisms the server +supports: + + % tteellnneett sseerrvveerr..eexxaammppllee..ccoomm 2255 + ... + 220 server.example.com ESMTP Postfix + EEHHLLOO cclliieenntt..eexxaammppllee..ccoomm + 250-server.example.com + 250-PIPELINING + 250-SIZE 10240000 + 250-AUTH DIGEST-MD5 PLAIN CRAM-MD5 + ... -Note: the SASL login names will be shared with the entire world. +However not all clients recognize the AUTH capability as defined by the SASL +authentication RFC. Some historical implementations expect the server to send +an "=" as separator between the AUTH verb and the list of mechanisms that +follows it. -Older Microsoft SMTP client software implements a non-standard version of the -AUTH protocol syntax, and expects that the SMTP server replies to EHLO with -"250 AUTH=mechanism-list" instead of "250 AUTH mechanism-list". To accommodate -such clients (in addition to conformant clients) use the following: +The broken_sasl_auth_clients configuration option lets Postfix repeat the AUTH +statement in a form that these broken clients understand: /etc/postfix/main.cf: broken_sasl_auth_clients = yes -DDoovveeccoott SSAASSLL ccoonnffiigguurraattiioonn ffoorr tthhee PPoossttffiixx SSMMTTPP sseerrvveerr + NNoottee -Dovecot SASL support is available in Postfix 2.3 and later. On the Postfix side -you need to specify the location of the Dovecot authentication daemon socket. -We use a pathname relative to the Postfix queue directory, so that it will work -whether or not the Postfix SMTP server runs chrooted: + Enable this option for Outlook up to and including version 2003 and Outlook + Express up to version 6. This option does not hurt other clients. - /etc/postfix/main.cf: - smtpd_sasl_type = dovecot - smtpd_sasl_path = private/auth +After "postfix reload", the Postfix SMTP server will propagate the AUTH +capability twice - once for compliant and once for broken clients: -On the Dovecot side you also need to specify the Dovecot authentication daemon -socket. In this case we specify an absolute pathname. In the example we assume -that the Postfix queue is under /var/spool/postfix/. - - /some/where/dovecot.conf: - auth default { - mechanisms = plain login - passdb pam { - } - userdb passwd { - } - socket listen { - client { - path = /var/spool/postfix/private/auth - mode = 0660 - user = postfix - group = postfix - } - } - } - -See the Dovecot documentation for how to configure and operate the Dovecot -authentication server. - -CCyyrruuss SSAASSLL ccoonnffiigguurraattiioonn ffoorr tthhee PPoossttffiixx SSMMTTPP sseerrvveerr - -You need to configure how the Cyrus SASL library should authenticate a remote -SMTP client's username and password. These settings must be stored in a -separate configuration file. - -The name of the configuration file (default: smtpd.conf) will be constructed -from a value that the Postfix SMTP server sends to the Cyrus SASL library, -which adds the suffix .conf. The value is configured using one of the following -variables: + % tteellnneett sseerrvveerr..eexxaammppllee..ccoomm 2255 + ... + EEHHLLOO cclliieenntt..eexxaammppllee..ccoomm + 250-server.example.com + 250-PIPELINING + 250-SIZE 10240000 + 250-AUTH DIGEST-MD5 PLAIN CRAM-MD5 + 250-AUTH=DIGEST-MD5 PLAIN CRAM-MD5 + ... + +PPoossttffiixx SSMMTTPP SSeerrvveerr AAuutthheennttiiccaattiioonn PPoolliiccyy + +The Postfix SMTP server provides a way to specify the properties of SASL +mechanisms that can be made available to the remote SMTP client. + +UUnneennccrryypptteedd SSMMTTPP sseessssiioonn + +The default policy is to allow any mechanism in the Postfix SMTP server except +for those based on anonymous authentication: /etc/postfix/main.cf: - # Postfix 2.3 and later - smtpd_sasl_path = smtpd - # Postfix < 2.3 - smtpd_sasl_application_name = smtpd + # Specify a list of properties separated by comma or whitespace + smtpd_sasl_security_options = noanonymous + + IImmppoorrttaanntt + + Always set at least the noanonymous option. Otherwise, the Postfix SMTP + server can give strangers the same authorization as a properly- + authenticated client. + +Postfix can enforce the following policies on SASL authentication mechanisms: + + noanonymous + Don't use mechanisms that permit anonymous authentication. -Cyrus SASL searches for the configuration file in /usr/local/lib/sasl/ (Cyrus -SASL version 1.5.5) or /usr/local/lib/sasl2/ (Cyrus SASL version 2.1.x). + noplaintext + Don't use mechanisms that transmit unencrypted username and password + information. -Note: some Postfix distributions are modified and look for the smtpd.conf file -in /etc/postfix/sasl. + nodictionary + Don't use mechanisms that are vulnerable to dictionary attacks. -Note: some Cyrus SASL distributions look for the smtpd.conf file in /etc/sasl2. + forward_secrecy + Use only mechanisms that support forward secrecy (Dovecot SASL only). + + mutual_auth + Use only mechanisms that authenticate both the client and the server to + each other. + +EEnnccrryypptteedd SSMMTTPP sseessssiioonn ((TTLLSS)) + +A separate parameter controls Postfix SASL mechanism policy during a TLS- +encrypted SMTP session. The default is to copy the settings from the +unencrypted session: + + /etc/postfix/main.cf: + smtpd_sasl_tls_security_options = $smtpd_sasl_security_options - * To authenticate against the UNIX password database, use: +A more sophisticated policy allows plaintext mechanisms, but only over a TLS- +encrypted connection: - (Cyrus SASL version 1.5.x) + /etc/postfix/main.cf: + smtpd_sasl_security_options = noanonymous, noplaintext + smtpd_sasl_tls_security_options = noanonymous - /usr/local/lib/sasl/smtpd.conf: - pwcheck_method: pwcheck +To offer SASL authentication only after a TLS-encrypted session has been +established specify this: - IMPORTANT: pwcheck establishes a UNIX domain socket in /var/pwcheck and - waits for authentication requests. The Postfix SMTP server must have - read+execute permission to this directory or authentication attempts - will fail. + /etc/postfix/main.cf: + smtpd_tls_auth_only = yes - The pwcheck daemon is contained in the cyrus-sasl source tarball. +EEnnaabblliinngg SSAASSLL aauutthhoorriizzaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr - (Cyrus SASL version 1.5.26) +After the client has authenticated with SASL, the Postfix SMTP server decides +what the remote SMTP client will be authorized for. Examples of possible SMTP +clients authorizations are: - /usr/local/lib/sasl/smtpd.conf: - pwcheck_method: saslauthd + * Send a message to a remote recipient. - (Cyrus SASL version 2.1.x) + * Use a specific envelope sender in the MAIL FROM command. - /usr/local/lib/sasl2/smtpd.conf: - pwcheck_method: saslauthd - mech_list: PLAIN LOGIN +These permissions are not enabled by default. - The saslauthd daemon is also contained in the cyrus-sasl source tarball. It - is more flexible than the pwcheck daemon, in that it can authenticate - against PAM and various other sources. To use PAM, start saslauthd with "- - a pam". +MMaaiill rreellaayy aauutthhoorriizzaattiioonn - IMPORTANT: saslauthd usually establishes a UNIX domain socket in /var/run/ - saslauthd and waits for authentication requests. The Postfix SMTP server - must have read+execute permission to this directory or authentication - attempts will fail. +The permit_sasl_authenticated restriction allows SASL-authenticated SMTP +clients to send mail to remote destinations. Add it to the list of +smtpd_recipient_restrictions as follows: - Note: The directory where saslauthd puts the socket is configurable. See - the command-line option "-m /path/to/socket" in the saslauthd --help - listing. + /etc/postfix/main.cf: + smtpd_recipient_restrictions = + ... + permit_mynetworks + ppeerrmmiitt__ssaassll__aauutthheennttiiccaatteedd + reject_unauth_destination + ... - * To authenticate against Cyrus SASL's own password database: +EEnnvveellooppee sseennddeerr aaddddrreessss aauutthhoorriizzaattiioonn - (Cyrus SASL version 1.5.x) +By default an SMTP client may specify any envelope sender address in the MAIL +FROM command. That is because the Postfix SMTP server only knows the remte SMTP +client hostname and IP address, but not the user who controls the remote SMTP +client. - /usr/local/lib/sasl/smtpd.conf: - pwcheck_method: sasldb +This changes the moment an SMTP client uses SASL authentication. Now, the +Postfix SMTP server knows who the sender is. Given a table of envelope sender +addresses and SASL login names, the Postfix SMTP server can decide if the SASL +authenticated client is allowed to use a particular envelope sender address: - (Cyrus SASL version 2.1.x) + /etc/postfix/main.cf: + ssmmttppdd__sseennddeerr__llooggiinn__mmaappss == hhaasshh:://eettcc//ppoossttffiixx//ccoonnttrroolllleedd__eennvveellooppee__sseennddeerrss - /usr/local/lib/sasl2/smtpd.conf: - pwcheck_method: auxprop - auxprop_plugin: sasldb - mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 + smtpd_recipient_restrictions = + ... + rreejjeecctt__sseennddeerr__llooggiinn__mmiissmmaattcchh + permit_sasl_authenticated + permit_mynetworks + reject_unauth_destination + ... - This will use the Cyrus SASL password file (default: /etc/sasldb in version - 1.5.x, or /etc/sasldb2 in version 2.1.x), which is maintained with the - saslpasswd or saslpasswd2 command (part of the Cyrus SASL software). On - some poorly-supported systems the saslpasswd command needs to be run - multiple times before it stops complaining. The Postfix SMTP server needs - read access to the sasldb file - you may have to play games with group - access permissions. With the OTP authentication mechanism, the Postfix SMTP - server also needs WRITE access to /etc/sasldb2 or /etc/sasldb (or the back - end SQL database, if used). +The controlled_envelope_senders table specifies the binding between the sender +envelope addresses and its their SASL login names: - IMPORTANT: To get sasldb running, make sure that you set the SASL domain - (realm) to a fully qualified domain name. + /etc/postfix/controlled_envelope_senders + # envelope sender owners (SASL login names) + john@example.com john@example.com + helpdesk@example.com john@example.com, mary@example.com + postmaster admin@example.com + @example.net barney, fred, john@example.com, + mary@example.com - EXAMPLE: +With this, the reject_sender_login_mismatch restriction above will reject the +sender address in the MAIL FROM command if smtpd_sender_login_maps does not +specify the SMTP client's login name as an owner of that address. - (Cyrus SASL version 1.5.x) +See also reject_authenticated_sender_login_mismatch and +reject_unauthenticated_sender_login_mismatch for additional control over the +SASL login name and the envelope sender. - % saslpasswd -c -u `postconf -h myhostname` exampleuser +AAddddiittiioonnaall SSMMTTPP SSeerrvveerr SSAASSLL ooppttiioonnss - (Cyrus SASL version 2.1.x) +Postfix provides a wide range of SASL authentication configuration options. The +next section lists a few that are discussed frequently. See postconf(5) for a +complete list. - % saslpasswd2 -c -u `postconf -h myhostname` exampleuser +DDeeffaauulltt aauutthheennttiiccaattiioonn ddoommaaiinn - You can find out SASL's idea about the realms of the users in sasldb with - sasldblistusers (Cyrus SASL version 1.5.x) or sasldblistusers2 (Cyrus SASL - version 2.1.x). +Postfix can append a domain name (or any other string) to a SASL login name +that does not have a domain part, e.g. "john" instead of "john@example.com": - On the Postfix side, you can have only one realm per smtpd(8) instance, and - only the users belonging to that realm would be able to authenticate. The - Postfix variable smtpd_sasl_local_domain controls the realm used by smtpd - (8): + /etc/postfix/main.cf: + smtpd_sasl_local_domain = example.com - /etc/postfix/main.cf: - smtpd_sasl_local_domain = $myhostname +This is useful as a default setting and safety net for misconfigured clients, +or during a migration to an authentication method/backend that requires an +authentication REALM or domain name, before all SMTP clients are configured to +send such information. -IMPORTANT: The Cyrus SASL password verification services pwcheck and saslauthd -can only support the plaintext mechanisms PLAIN or LOGIN. However, the Cyrus -SASL library doesn't know this, and will happily advertise other authentication -mechanisms that the SASL library implements, such as DIGEST-MD5. As a result, -if a remote SMTP client chooses any mechanism other than PLAIN or LOGIN while -pwcheck or saslauthd are used, authentication will fail. Thus you may need to -limit the list of mechanisms advertised by the Postfix SMTP server. +HHiiddiinngg SSAASSLL aauutthheennttiiccaattiioonn ffrroomm cclliieennttss oorr nneettwwoorrkkss - * With older Cyrus SASL versions you remove the corresponding library files - from the SASL plug-in directory (and again whenever the system is updated). +Some clients insist on using SASL authentication if it is offered, even when +they are not configured to send credentials - and therefore they will always +fail and disconnect. - * With Cyrus SASL version 2.1.x or later the mech_list variable can specify a - list of authentication mechanisms that Cyrus SASL may offer: +Postfix can hide the AUTH capability from these clients/networks: - /usr/local/lib/sasl2/smtpd.conf: - mech_list: plain login + /etc/postfix/main.cf: + smtpd_sasl_exceptions_networks = !192.0.2.171/32, 192.0.2.0/24 -For the same reasons you might want to limit the list of plugins used for -authentication. +AAddddiinngg tthhee SSAASSLL llooggiinn nnaammee ttoo mmaaiill hheeaaddeerrss - * With Cyrus SASL version 1.5.x your only choice is to delete the - corresponding library files from the SASL plug-in directory. +To report SASL login names in Received: message headers (Postfix version 2.3 +and later): - * With SASL version 2.1.x: + /etc/postfix/main.cf: + smtpd_sasl_authenticated_header = yes - /usr/local/lib/sasl2/smtpd.conf: - pwcheck_method: auxprop - auxprop_plugin: sql + NNoottee -To run software chrooted with SASL support is an interesting exercise. It -probably is not worth the trouble. + The SASL login names will be shared with the entire world. -TTeessttiinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP sseerrvveerr +TTeessttiinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP SSeerrvveerr To test the server side, connect (for example, with telnet) to the Postfix SMTP server port and you should be able to have a conversation as shown below. Information sent by the client (that is, you) is shown in bold font. - $ tteellnneett sseerrvveerr..eexxaammppllee..ccoomm 2255 - . . . + % tteellnneett sseerrvveerr..eexxaammppllee..ccoomm 2255 + ... 220 server.example.com ESMTP Postfix EEHHLLOO cclliieenntt..eexxaammppllee..ccoomm 250-server.example.com @@ -375,181 +891,421 @@ Information sent by the client (that is, you) is shown in bold font. AAUUTTHH PPLLAAIINN AAHHRRllcc33QQAAddGGVVzzddHHBBhhcc33MM== 235 Authentication successful -Instead of AHRlc3QAdGVzdHBhc3M=, specify the base64 encoded form of +Instead of AHRlc3QAdGVzdHBhc3M=, specify the base64-encoded form of \0username\0password (the \0 is a null byte). The example above is for a user named `test' with password `testpass'. -In order to generate base64 encoded authentication information you can use one -of the following commands: + CCaauuttiioonn + + When posting logs of the SASL negotiations to public lists, please keep in + mind that username/password information is trivial to recover from the + base64-encoded form. + +You can use one of the following commands to generate base64 encoded +authentication information: - % printf '\0username\0password' | mmencode + % ggeenn--aauutthh ppllaaiinn + username: uusseerrnnaammee + password: - % perl -MMIME::Base64 -e \ - 'print encode_base64("\0username\0password");' +The ggeenn--aauutthh Perl script was written by John Jetmore and can be found at http:/ +/jetmore.org/john/code/gen-auth. -The mmencode command is part of the metamail software. MIME::Base64 is -available from http://www.cpan.org/. + % pprriinnttff ''\\00uusseerrnnaammee\\00ppaasssswwoorrdd'' || mmmmeennccooddee -Caution: when posting logs of the SASL negotiations to public lists, please -keep in mind that username/password information is trivial to recover from the -base64-encoded form. +The mmmmeennccooddee command is part of the metamail software. -TTrroouubbllee sshhoooottiinngg tthhee SSAASSLL iinntteerrnnaallss + % ppeerrll --MMMMIIMMEE::::BBaassee6644 --ee \\ + ''pprriinntt eennccooddee__bbaassee6644((""\\00uusseerrnnaammee\\00ppaasssswwoorrdd""));;'' -In the Cyrus SASL sources you'll find a subdirectory named "sample". Run make -there, then create a symbolic link from sample.conf to smtpd.conf in your Cyrus -SASL library directory /usr/local/lib/sasl2. "su" to the user postfix (or -whatever your mail_owner directive is set to): +MIME::Base64 is available from http://www.cpan.org/. - % su postfix +CCoonnffiigguurriinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP//LLMMTTPP cclliieenntt -then run the resulting sample Cyrus SASL server and client in separate -terminals. The sample applications send log messages to the syslog facility -auth. Check the log to fix the problem or run strace / ktrace / truss on the -server to see what makes it unhappy. Repeat the previous step until you can -successfully authenticate with the sample Cyrus SASL client. Only then get back -to Postfix. +The Postfix SMTP and the LMTP client can authenticate with a remote SMTP server +via the Cyrus SASL framework. At this time, the Dovecot SASL implementation +does not provide client functionality. -EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP cclliieenntt + NNoottee -Turn on client-side SASL authentication, and specify a table with per-host or -per-destination username and password information. The Postfix SMTP client -first searches the table for an entry with the remote SMTP server hostname; if -no entry is found, then the Postfix SMTP client searches the table for an entry -with the next-hop destination. Usually, that is the right-hand part of an email -address, but it can also be the information that is specified with the -relayhost parameter or with a transport(5) table. + The examples in this section discuss only the SMTP client. Replace smtp_ + with lmtp_ to get the corresponding LMTP client configuration. + +You can read more about the following topics: + + * Enabling SASL authentication in the Postfix SMTP/LMTP client + * Configuring sender-dependent SASL authentication + * Postfix SMTP/LMTP client authentication policy + * Filtering server mechanism names in the Postfix SMTP/LMTP client + +EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP//LLMMTTPP cclliieenntt + +This section shows a typical scenario where the Postfix SMTP client sends all +messages via a mail gateway server that requires SASL authentication. To make +the example more readable we introduce it in two parts. /etc/postfix/main.cf: smtp_sasl_auth_enable = yes - smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd - smtp_sasl_type = cyrus - relayhost = [mail.myisp.net] + relayhost = [mail.isp.example] # Alternative form: - # relayhost = [mail.myisp.net]:submission - - /etc/postfix/sasl_passwd: - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password + # relayhost = [mail.isp.example]:submission + smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd -Notes: + * The smtp_sasl_auth_enable setting enables client-side authentication. We + will configure the client's username and password information in the second + part of the example. - * The "submission" destination port tells Postfix to send mail via TCP - network port 587, which is normally reserved for email clients. The default - is to send mail to the "smtp" destination port (TCP port 25), which is used - for receiving mail across the internet. If you use an explicit destination - port in main.cf, then you must use the same form also in the - smtp_sasl_password_maps file. + * The relayhost setting forces the Postfix SMTP to send all remote messages + to the specified mail server instead of trying to deliver them directly to + their destination. - * Postfix does not deliver mail via TCP port 465 (the obsolete "wrappermode" - protocol). See TLS_README for a solution that uses the "stunnel" command. + * In the relayhost setting, the "[" and "]" prevent the Postfix SMTP client + from looking up MX (mail exchanger) records for the enclosed name. - * The "[" and "]" prevent Postfix from looking up the MX (mail exchanger) - records for the enclosed name. If you use this form in main.cf, then you - must use the same form also in the smtp_sasl_password_maps file. + * The relayhost destination may also specify a non-default TCP port. For + example, the alternative form [mail.isp.example]:submission tells Postfix + to connect to TCP network port 587, which is reserved for email client + applications. - * The Postfix SMTP client opens the SASL client password file before entering - the optional chroot jail, so you can keep the file in /etc/postfix and set - permissions read / write only for root to keep the username:password - combinations away from other system users. + * The Postfix SMTP client is compatible with SMTP servers that use the non- + standard "AUTH=mmeetthhoodd....." syntax in response to the EHLO command; this + requires no additional Postfix client configuration. - * Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb - files. To find out what lookup tables Postfix supports, use the command - "ppoossttccoonnff --mm". + * The Postfix SMTP client does not support the obsolete "wrappermode" + protocol, which uses TCP port 465 on the SMTP server. See TLS_README for a + solution that uses the stunnel command. - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ssaassll__ppaasssswwdd" whenever you change - the sasl_passwd table. + * With the smtp_sasl_password_maps parameter, we configure the Postfix SMTP + client to send username and password information to the mail gateway + server. As discussed in the next section, the Postfix SMTP client supports + multiple ISP accounts. For this reason the username and password are stored + in a table that contains one username/password combination for each mail + gateway server. -Workarounds: + /etc/postfix/sasl_passwd: + # destination credentials + [mail.isp.example] username:password + # Alternative form: + # [mail.isp.example]:submission username:password - * Some remote SMTP servers support PLAIN or LOGIN authentication only. By - default, the Postfix SMTP client does not use authentication methods that - send plaintext passwords, and defers delivery with the following error - message: "Authentication failed: cannot SASL authenticate to server". To - enable plaintext authentication specify, for example: + IImmppoorrttaanntt - /etc/postfix/main.cf: - smtp_sasl_security_options = noanonymous + Keep the SASL client password file in /etc/postfix, and make the file + read+write only for root to protect the username/password combinations + against other users. The Postfix SMTP client will still be able to read the + SASL client passwords. It opens the file as user root before it drops + privileges, and before entering an optional chroot jail. - * Some remote SMTP servers announce authentication mechanisms that don't - actually work. It is possible via the smtp_sasl_mechanism_filter parameter - to restrict the list of server mechanisms that the Postfix SMTP client will - take into consideration: + * Use the postmap command whenever you change the /etc/postfix/sasl_passwd + file. - /etc/postfix/main.cf: - smtp_sasl_mechanism_filter = !gssapi, !external, static:all + * If you specify the "[" and "]" in the relayhost destination, then you must + use the same form in the smtp_sasl_password_maps file. - In the above example, the Postfix SMTP client will decline to use - mechanisms that require special infrastructure such as Kerberos or TLS. + * If you specify a non-default TCP Port (such as ":submission" or ":587") in + the relayhost destination, then you must use the same form in the + smtp_sasl_password_maps file. - * The Postfix SMTP client is backwards compatible with SMTP servers that use - the non-standard "AUTH=method..." syntax in response to the EHLO command; - there is no Postfix client configuration needed to work around it. +CCoonnffiigguurriinngg SSeennddeerr--DDeeppeennddeenntt SSAASSLL aauutthheennttiiccaattiioonn -SSuuppppoorrttiinngg mmuullttiippllee IISSPP aaccccoouunnttss iinn tthhee PPoossttffiixx SSMMTTPP cclliieenntt +Postfix supports different ISP accounts for different sender addresses (version +2.3 and later). This can be useful when one person uses the same machine for +work and for personal use, or when people with different ISP accounts share the +same Postfix server. -Postfix version 2.3 supports multiple ISP accounts. This can be useful when one -person uses the same machine for work and for personal use, or when people with -different ISP accounts share the same Postfix server. To make this possible, -Postfix 2.3 supports per-sender SASL passwords and per-sender relay hosts. In -the example below, Postfix will search the SASL password file by sender before -it searches that same file by destination. Likewise, Postfix will search the -per-sender relayhost file, and use the default relayhost only as a final -resort. +To make this possible, Postfix supports per-sender SASL passwords and per- +sender relay hosts. In the example below, the Postfix SMTP client will search +the SASL password file by sender address before it searches that same file by +destination. Likewise, the Postfix trivial-rewrite(8) daemon will search the +per-sender relayhost file, and use the default relayhost setting only as a +final resort. /etc/postfix/main.cf: smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd - relayhost = [mail.myisp.net] + relayhost = [mail.isp.example] # Alternative form: - # relayhost = [mail.myisp.net]:submission + # relayhost = [mail.isp.example]:submission /etc/postfix/sasl_passwd: # Per-sender authentication; see also /etc/postfix/sender_relay. - user1@example.com username2:password2 - user2@example.net username2:password2 + user1@example.com username2:password2 + user2@example.net username2:password2 # Login information for the default relayhost. - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password + [mail.isp.example] username:password + # Alternative form: + # [mail.isp.example]:submission username:password /etc/postfix/sender_relay: # Per-sender provider; see also /etc/postfix/sasl_passwd. - user1@example.com [mail.example.com]:submission - user2@example.net [mail.example.net] - -Notes: + user1@example.com [mail.example.com]:submission + user2@example.net [mail.example.net] * If you are creative, then you can try to combine the two tables into one single MySQL database, and configure different Postfix queries to extract the appropriate information. - * Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb + * Specify dbm instead of hash if your system uses dbm files instead of db files. To find out what lookup tables Postfix supports, use the command - "ppoossttccoonnff --mm". + "postconf -m". - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ssaassll__ppaasssswwdd" whenever you change + * Execute the command "postmap /etc/postfix/sasl_passwd" whenever you change the sasl_passwd table. - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//sseennddeerr__rreellaayy" whenever you change + * Execute the command "postmap /etc/postfix/sender_relay" whenever you change the sender_relay table. +PPoossttffiixx SSMMTTPP//LLMMTTPP cclliieenntt aauutthheennttiiccaattiioonn ppoolliiccyy + +Just like the Postfix SMTP server, the SMTP client has a policy that determines +which SASL mechanisms are acceptable and which are not. + +UUnneennccrryypptteedd SSMMTTPP sseessssiioonn + +The default policy is stricter than that of the Postfix SMTP server - plaintext +mechanisms are not allowed (nor is any anonymous mechanism): + + /etc/postfix/main.cf: + smtp_sasl_security_options = noplaintext, noanonymous + +Postfix can enforce the following policies on SASL authentication mechanisms: + + noanonymous + Don't use mechanisms that permit anonymous authentication. + + noplaintext + Don't use mechanisms that transmit unencrypted username and password + information. + + nodictionary + Don't use mechanisms that are vulnerable to dictionary attacks. + + mutual_auth + Use only mechanisms that authenticate both the client and the server to + each other. + +With the default policy shown above, the Postfix SMTP client will not send its +password over an unencrypted connection. This sometimes leads to authentication +failures if the remote server only offers plaintext authentication mechanisms. +In such cases the SMTP client will log the following error message: + + SASL authentication failure: No worthy mechs found + +The less secure approach to deal with this is to lower the security standards +and permit plaintext authentication mechanisms: + + /etc/postfix/main.cf: + smtp_sasl_security_options = noanonymous + +Needless to say, sending a username and password over an insecure channel is +undesirable. + +If the remote server supports TLS, you can protect the plaintext username and +password by turning on TLS in the Postfix SMTP client (see: TLS_README), and +configuring the client as discussed next. + +EEnnccrryypptteedd SSMMTTPP sseessssiioonn ((TTLLSS)) + +A separate parameter controls Postfix SASL mechanism policy during a TLS- +encrypted SMTP session. The default is to copy the settings from the +unencrypted session: + + /etc/postfix/main.cf: + smtp_sasl_tls_security_options = $smtp_sasl_security_options + +A more sophisticated policy allows plaintext mechanisms, but only over a TLS- +encrypted connection: + + /etc/postfix/main.cf: + smtpd_sasl_security_options = noanonymous, noplaintext + smtpd_sasl_tls_security_options = noanonymous + +FFiilltteerriinngg sseerrvveerr mmeecchhaanniissmm nnaammeess iinn tthhee PPoossttffiixx SSMMTTPP//LLMMTTPP cclliieenntt + +Cyrus SASL always attempts to use the most secure authentication mechanism that +the remote SMTP server offers - even if the client side was not configured to +handle it! In such cases authentication will definitely fail. + +To prevent this, the Postfix SMTP client can filter the list of authentication +mechanism names from the remote SMTP server. Used correctly, the filter hides +unwanted mechanisms from the Cyrus SASL library, forcing the library to choose +from the mechanisms the Postfix filter passes through. + +The following example filters out everything but the mechanisms PLAIN and +LOGIN: + + /etc/postfix/main.cf: + smtp_sasl_mechanism_filter = plain, login + + NNoottee + + If the remote server does not offer any of the mechanisms on the filter + list, authentication will fail. + +We close this section with an example that passes every mechanism except for +GSSAPI and LOGIN: + + /etc/postfix/main.cf: + smtp_sasl_mechanism_filter = !gssapi, !login, static:all + +BBuuiillddiinngg PPoossttffiixx wwiitthh SSAASSLL ssuuppppoorrtt + +As mentioned elsewhere, Postfix supports two SASL implementations: Cyrus SASL +(SMTP client and server) and Dovecot SASL (SMTP server only). Both +implementations can be built into Postfix simultaneously. + + * Building Dovecot SASL support + * Building Cyrus SASL support + +BBuuiillddiinngg DDoovveeccoott SSAASSLL ssuuppppoorrtt + +These instructions assume that you build Postfix from source code as described +in the INSTALL document. Some modification may be required if you build Postfix +from a vendor-specific source package. + +Support for the Dovecot version 1 SASL protocol is available in Postfix 2.3 and +later. At the time of writing, only server-side SASL support is available, so +you can't use it to authenticate the Postfix SMTP client to your network +provider's server. + +Dovecot uses its own daemon process for authentication. This keeps the Postfix +build process simple, because there is no need to link extra libraries into +Postfix. + +To generate the necessary Makefiles, execute the following in the Postfix top- +level directory: + + % mmaakkee ttiiddyy # if you have left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==''--DDUUSSEE__SSAASSLL__AAUUTTHH \\ + --DDDDEEFF__SSEERRVVEERR__SSAASSLL__TTYYPPEE==\\""ddoovveeccoott\\""'' + +After this, proceed with "make" as described in the INSTALL document. + +NNoottee + + * The -DDEF_SERVER_SASL_TYPE=\"dovecot\" is not necessary; it just makes + Postfix configuration a little more convenient because you don't have to + specify the SASL plug-in type in the Postfix main.cf file (but this may + cause surprises when you switch to a later Postfix version that is built + with the default SASL type of sasl). + + * If you also want support for LDAP or TLS (or for Cyrus SASL), you need to + merge their CCARGS and AUXLIBS options into the above command line; see the + LDAP_README and TLS_README for details. + + % mmaakkee ttiiddyy # if you have left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==''--DDUUSSEE__SSAASSLL__AAUUTTHH \\ + --DDDDEEFF__SSEERRVVEERR__SSAASSLL__TTYYPPEE==\\""ddoovveeccoott\\"" \\ + ......CCCCAARRGGSS ooppttiioonnss ffoorr LLDDAAPP oorr TTLLSS eettcc........'' \\ + AAUUXXLLIIBBSS==''......AAUUXXLLIIBBSS ooppttiioonnss ffoorr LLDDAAPP oorr TTLLSS eettcc........'' + +BBuuiillddiinngg CCyyrruuss SSAASSLL ssuuppppoorrtt + +BBuuiillddiinngg tthhee CCyyrruuss SSAASSLL lliibbrraarryy + +Postfix works with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, which are available +from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/. + + IImmppoorrttaanntt + + If you install the Cyrus SASL libraries as per the default, you will have + to create a symlink /usr/lib/sasl -> /usr/local/lib/sasl for version 1.5.x + or /usr/lib/sasl2 -> /usr/local/lib/sasl2 for version 2.1.x. + +Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN and/or +NTLM authentication mechanism. To enable these authentication mechanisms, build +the Cyrus SASL libraries with: + + % ..//ccoonnffiigguurree ----eennaabbllee--llooggiinn ----eennaabbllee--nnttllmm + +BBuuiillddiinngg PPoossttffiixx wwiitthh CCyyrruuss SSAASSLL ssuuppppoorrtt + +These instructions assume that you build Postfix from source code as described +in the INSTALL document. Some modification may be required if you build Postfix +from a vendor-specific source package. + +The following assumes that the Cyrus SASL include files are in /usr/local/ +include, and that the Cyrus SASL libraries are in /usr/local/lib. + +On some systems this generates the necessary Makefile definitions: + +Cyrus SASL version 2.1.x + + % mmaakkee ttiiddyy # if you have left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__SSAASSLL__AAUUTTHH --DDUUSSEE__CCYYRRUUSS__SSAASSLL \\ + --II//uussrr//llooccaall//iinncclluuddee//ssaassll"" AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb --llssaassll22"" + +Cyrus SASL version 1.5.x + + % mmaakkee ttiiddyy # if you have left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__SSAASSLL__AAUUTTHH --DDUUSSEE__CCYYRRUUSS__SSAASSLL \\ + --II//uussrr//llooccaall//iinncclluuddee"" AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb --llssaassll"" + +On Solaris 2.x you need to specify run-time link information, otherwise the +ld.so run-time linker will not find the SASL shared library: + +Cyrus SASL version 2.1.x + + % mmaakkee ttiiddyy # remove left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__SSAASSLL__AAUUTTHH --DDUUSSEE__CCYYRRUUSS__SSAASSLL \\ + --II//uussrr//llooccaall//iinncclluuddee//ssaassll"" AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb \\ + --RR//uussrr//llooccaall//lliibb --llssaassll22"" + +Cyrus SASL version 1.5.x + + % mmaakkee ttiiddyy # if you have left-over files from a previous build + % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__SSAASSLL__AAUUTTHH --DDUUSSEE__CCYYRRUUSS__SSAASSLL \\ + --II//uussrr//llooccaall//iinncclluuddee"" AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb \\ + --RR//uussrr//llooccaall//lliibb --llssaassll"" + +UUssiinngg CCyyrruuss SSAASSLL vveerrssiioonn 11..55..xx + +Postfix supports Cyrus SASL version 1.x, but you shouldn't use it unless you +are forced to. The makers of Cyrus SASL write: + + This library is being deprecated and applications should transition to + using the SASLv2 library (source: Project Cyrus: Downloads). + +If you still need to set it up, here's a quick rundown: + +Read the regular section on SMTP server configurations for the Cyrus SASL +framework. The differences are: + + * Cyrus SASL version 1.5.x searches for configuration (smtpd.conf) in /usr/ + lib/sasl/ only. You must place the configuration in that directory. Some + systems may have modified Cyrus SASL and put the files into e.g. /var/lib/ + sasl/. + + * Use the saslpasswd command instead of saslpasswd2 to create users in + sasldb. + + * Use the sasldblistusers command instead of sasldblistusers2 to find users + in sasldb. + + * In the smtpd.conf file you can't use mech_list to limit the range of + mechanisms offered. Instead, remove their libraries from /usr/lib/sasl/ + (and remember remove those files again when a system update re-installs new + versions). + CCrreeddiittss * Postfix SASL support was originally implemented by Till Franke of SuSE Rhein/Main AG. * Wietse trimmed down the code to only the bare necessities. * Support for Cyrus SASL version 2 was contributed by Jason Hoos. - * Liviu Daia added smtpd_sasl_application_name, split + * Liviu Daia added smtpd_sasl_application_name, separated reject_sender_login_mismatch into reject_authenticated_sender_login_mismatch and reject_unauthenticated_sender_login_mismatch, and revised the docs. * Wietse made another iteration through the code to add plug-in support for - multiple SASL implementations, and changed smtpd_sasl_application_name into - smtpd_sasl_path. + multiple SASL implementations, and for reasons that have been lost, also + changed smtpd_sasl_application_name into smtpd_sasl_path. * The Dovecot SMTP server-only plug-in was originally implemented by Timo Sirainen of Procontrol, Finland. * Patrick Ben Koetter revised this document for Postfix 2.4 and made much needed updates. + * Patrick Ben Koetter revised this document again for Postfix 2.7 and made + much needed updates. diff --git a/postfix/README_FILES/SOHO_README b/postfix/README_FILES/SOHO_README index 191cffb53..3c40eb560 100644 --- a/postfix/README_FILES/SOHO_README +++ b/postfix/README_FILES/SOHO_README @@ -19,7 +19,7 @@ outside the scope of the Postfix documentation. Selected topics from the SASL_README document: o Enabling SASL authentication in the Postfix SMTP client - o Supporting multiple ISP accounts in the Postfix SMTP client + o Configuring Sender-Dependent SASL authentication See the SASL_README and STANDARD_CONFIGURATION_README documents for further information on these topics. @@ -149,128 +149,122 @@ canonical table. Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//vviirrttuuaall" whenever you change the virtual table. -EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP cclliieenntt +EEnnaabblliinngg SSAASSLL aauutthheennttiiccaattiioonn iinn tthhee PPoossttffiixx SSMMTTPP//LLMMTTPP cclliieenntt -Turn on client-side SASL authentication, and specify a table with per-host or -per-destination username and password information. The Postfix SMTP client -first searches the table for an entry with the remote SMTP server hostname; if -no entry is found, then the Postfix SMTP client searches the table for an entry -with the next-hop destination. Usually, that is the right-hand part of an email -address, but it can also be the information that is specified with the -relayhost parameter or with a transport(5) table. +This section shows a typical scenario where the Postfix SMTP client sends all +messages via a mail gateway server that requires SASL authentication. To make +the example more readable we introduce it in two parts. /etc/postfix/main.cf: smtp_sasl_auth_enable = yes - smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd - smtp_sasl_type = cyrus - relayhost = [mail.myisp.net] + relayhost = [mail.isp.example] # Alternative form: - # relayhost = [mail.myisp.net]:submission - - /etc/postfix/sasl_passwd: - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password + # relayhost = [mail.isp.example]:submission + smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd -Notes: + * The smtp_sasl_auth_enable setting enables client-side authentication. We + will configure the client's username and password information in the second + part of the example. - * The "submission" destination port tells Postfix to send mail via TCP - network port 587, which is normally reserved for email clients. The default - is to send mail to the "smtp" destination port (TCP port 25), which is used - for receiving mail across the internet. If you use an explicit destination - port in main.cf, then you must use the same form also in the - smtp_sasl_password_maps file. + * The relayhost setting forces the Postfix SMTP to send all remote messages + to the specified mail server instead of trying to deliver them directly to + their destination. - * Postfix does not deliver mail via TCP port 465 (the obsolete "wrappermode" - protocol). See TLS_README for a solution that uses the "stunnel" command. + * In the relayhost setting, the "[" and "]" prevent the Postfix SMTP client + from looking up MX (mail exchanger) records for the enclosed name. - * The "[" and "]" prevent Postfix from looking up the MX (mail exchanger) - records for the enclosed name. If you use this form in main.cf, then you - must use the same form also in the smtp_sasl_password_maps file. + * The relayhost destination may also specify a non-default TCP port. For + example, the alternative form [mail.isp.example]:submission tells Postfix + to connect to TCP network port 587, which is reserved for email client + applications. - * The Postfix SMTP client opens the SASL client password file before entering - the optional chroot jail, so you can keep the file in /etc/postfix and set - permissions read / write only for root to keep the username:password - combinations away from other system users. + * The Postfix SMTP client is compatible with SMTP servers that use the non- + standard "AUTH=mmeetthhoodd....." syntax in response to the EHLO command; this + requires no additional Postfix client configuration. - * Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb - files. To find out what lookup tables Postfix supports, use the command - "ppoossttccoonnff --mm". + * The Postfix SMTP client does not support the obsolete "wrappermode" + protocol, which uses TCP port 465 on the SMTP server. See TLS_README for a + solution that uses the stunnel command. - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ssaassll__ppaasssswwdd" whenever you change - the sasl_passwd table. + * With the smtp_sasl_password_maps parameter, we configure the Postfix SMTP + client to send username and password information to the mail gateway + server. As discussed in the next section, the Postfix SMTP client supports + multiple ISP accounts. For this reason the username and password are stored + in a table that contains one username/password combination for each mail + gateway server. -Workarounds: + /etc/postfix/sasl_passwd: + # destination credentials + [mail.isp.example] username:password + # Alternative form: + # [mail.isp.example]:submission username:password - * Some remote SMTP servers support PLAIN or LOGIN authentication only. By - default, the Postfix SMTP client does not use authentication methods that - send plaintext passwords, and defers delivery with the following error - message: "Authentication failed: cannot SASL authenticate to server". To - enable plaintext authentication specify, for example: + IImmppoorrttaanntt - /etc/postfix/main.cf: - smtp_sasl_security_options = noanonymous + Keep the SASL client password file in /etc/postfix, and make the file + read+write only for root to protect the username/password combinations + against other users. The Postfix SMTP client will still be able to read the + SASL client passwords. It opens the file as user root before it drops + privileges, and before entering an optional chroot jail. - * Some remote SMTP servers announce authentication mechanisms that don't - actually work. It is possible via the smtp_sasl_mechanism_filter parameter - to restrict the list of server mechanisms that the Postfix SMTP client will - take into consideration: + * Use the postmap command whenever you change the /etc/postfix/sasl_passwd + file. - /etc/postfix/main.cf: - smtp_sasl_mechanism_filter = !gssapi, !external, static:all + * If you specify the "[" and "]" in the relayhost destination, then you must + use the same form in the smtp_sasl_password_maps file. - In the above example, the Postfix SMTP client will decline to use - mechanisms that require special infrastructure such as Kerberos or TLS. + * If you specify a non-default TCP Port (such as ":submission" or ":587") in + the relayhost destination, then you must use the same form in the + smtp_sasl_password_maps file. - * The Postfix SMTP client is backwards compatible with SMTP servers that use - the non-standard "AUTH=method..." syntax in response to the EHLO command; - there is no Postfix client configuration needed to work around it. +CCoonnffiigguurriinngg SSeennddeerr--DDeeppeennddeenntt SSAASSLL aauutthheennttiiccaattiioonn -SSuuppppoorrttiinngg mmuullttiippllee IISSPP aaccccoouunnttss iinn tthhee PPoossttffiixx SSMMTTPP cclliieenntt +Postfix supports different ISP accounts for different sender addresses (version +2.3 and later). This can be useful when one person uses the same machine for +work and for personal use, or when people with different ISP accounts share the +same Postfix server. -Postfix version 2.3 supports multiple ISP accounts. This can be useful when one -person uses the same machine for work and for personal use, or when people with -different ISP accounts share the same Postfix server. To make this possible, -Postfix 2.3 supports per-sender SASL passwords and per-sender relay hosts. In -the example below, Postfix will search the SASL password file by sender before -it searches that same file by destination. Likewise, Postfix will search the -per-sender relayhost file, and use the default relayhost only as a final -resort. +To make this possible, Postfix supports per-sender SASL passwords and per- +sender relay hosts. In the example below, the Postfix SMTP client will search +the SASL password file by sender address before it searches that same file by +destination. Likewise, the Postfix trivial-rewrite(8) daemon will search the +per-sender relayhost file, and use the default relayhost setting only as a +final resort. /etc/postfix/main.cf: smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd - relayhost = [mail.myisp.net] + relayhost = [mail.isp.example] # Alternative form: - # relayhost = [mail.myisp.net]:submission + # relayhost = [mail.isp.example]:submission /etc/postfix/sasl_passwd: # Per-sender authentication; see also /etc/postfix/sender_relay. - user1@example.com username2:password2 - user2@example.net username2:password2 + user1@example.com username2:password2 + user2@example.net username2:password2 # Login information for the default relayhost. - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password + [mail.isp.example] username:password + # Alternative form: + # [mail.isp.example]:submission username:password /etc/postfix/sender_relay: # Per-sender provider; see also /etc/postfix/sasl_passwd. - user1@example.com [mail.example.com]:submission - user2@example.net [mail.example.net] - -Notes: + user1@example.com [mail.example.com]:submission + user2@example.net [mail.example.net] * If you are creative, then you can try to combine the two tables into one single MySQL database, and configure different Postfix queries to extract the appropriate information. - * Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb + * Specify dbm instead of hash if your system uses dbm files instead of db files. To find out what lookup tables Postfix supports, use the command - "ppoossttccoonnff --mm". + "postconf -m". - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ssaassll__ppaasssswwdd" whenever you change + * Execute the command "postmap /etc/postfix/sasl_passwd" whenever you change the sasl_passwd table. - * Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//sseennddeerr__rreellaayy" whenever you change + * Execute the command "postmap /etc/postfix/sender_relay" whenever you change the sender_relay table. diff --git a/postfix/README_FILES/TLS_README b/postfix/README_FILES/TLS_README index 9102c6a48..241e08990 100644 --- a/postfix/README_FILES/TLS_README +++ b/postfix/README_FILES/TLS_README @@ -1659,7 +1659,7 @@ by the smtp_tls_mandatory_ciphers configuration parameter. This setting controls the minimum acceptable SMTP client TLS cipher grade for use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may want to enforce TLS, and is beyond the reach of -today's crypt-analytic methods. See smtp_tls_policy_maps for information on how +today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis. By default anonymous ciphers are allowed, and automatically disabled when diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index db765d560..8632638f7 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -1,10 +1,10 @@ -The stable Postfix release is called postfix-2.6.x where 2=major -release number, 6=minor release number, x=patchlevel. The stable +The stable Postfix release is called postfix-2.7.x where 2=major +release number, 7=minor release number, x=patchlevel. The stable release never changes except for patches that address bugs or emergencies. Patches change the patchlevel and the release date. New features are developed in snapshot releases. These are called -postfix-2.7-yyyymmdd where yyyymmdd is the release date (yyyy=year, +postfix-2.8-yyyymmdd where yyyymmdd is the release date (yyyy=year, mm=month, dd=day). Patches are never issued for snapshot releases; instead, a new snapshot is released. @@ -14,89 +14,22 @@ specifies the release date of a stable release or snapshot release. If you upgrade from Postfix 2.5 or earlier, read RELEASE_NOTES-2.6 before proceeding. -Incompatibility with snapshot 20100117 -====================================== +Major changes - performance +--------------------------- -The meaning of an empty content filter next-hop destination has -changed. Postfix now uses the recipient domain, instead of using -$myhostname as in Postfix 2.6 and earlier. To get the old behavior -use "default_filter_nexthop = $myhostname", or specify a non-empty -next-hop content filter destination. - -Major changes with snapshot 20100117 -==================================== - -The FILTER action in access maps or header/body_checks now supports -sender reputation schemes that dynamically choose the SMTP source -IP address. - -This is implemented by specifying FILTER actions with empty next-hop -destinations in access maps or header/body_checks, and by configuring -in master.cf one Postfix SMTP client for each SMTP source IP address, -where each client has its own "-o myhostname" and "-o smtp_bind_address" -settings. - -Incompatibility with snapshot 20100101 -====================================== - -The verify(8) service now uses a persistent cache by default -(address_verify_map = btree:$data_directory/verify_cache). To -disable, specify "address_verify_map =" in main.cf. - -When periodic cache cleanup is enabled (the default), the postscreen(8) -and verify(8) servers now require that their cache databases support -the "delete" and "sequence" operations. To disable periodic cache -cleanup specify a zero xxx_cache_cleanup_interval value. - -Major changes with snapshot 20100101 -==================================== - -Periodic cache cleanup for the postscreen(8) and verify(8) cache -databases. The time between cache cleanup runs is controlled with -the address_verify_cache_cleanup_interval (default: 12h) and -postscreen_cache_cleanup_interval (default: 12h) parameters. Cache -cleanup increases the database access latency, so this should not -be run more often than necessary. - -In addition, the postscreen_cache_retention_time (default: 1d) -parameter specifies how long to keep an expired entry in the cache. -This prevents a client from being logged as "NEW" after its record -expired only a little while ago. - -Incompatibility with snapshot 20091209 -====================================== +[Feature 20100101] Periodic cache cleanup for the verify(8) cache +database. The time between cache cleanup runs is controlled with +the address_verify_cache_cleanup_interval (default: 12h) parameter. +Cache cleanup increases the database access latency, so this should +not be run more often than necessary. -The postscreen daemon now checks the permanent whitelist before -the permanent blacklist. This makes the whitelist easier to use -for its intended purpose, which is to receive mail. - -Major changes with snapshot 20091209 -==================================== - -sender_dependent_default_transport_maps, a per-sender override for -default_transport. It's original motivation is to use different -output channels (with different source IP addresses) for different -sender addresses, in order to keep their IP-based reputations -separate from each other. - -The result value syntax is that of default_transport, not transport_maps. -Thus, sender_dependent_default_transport_maps does not support the -special transport_maps result value syntax for null transport, null -nexthop, or null email address. - -This feature makes sender_dependent_relayhost_maps pretty much -redundant (though sender_dependent_relayhost_maps will often be -easier to use because that is the only thing people want to override). - -Major changes with snapshot 20091109 -==================================== - -Improved before-queue filter performance. With "smtpd_proxy_options -= speed_adjust", the Postfix SMTP server receives the entire message -before it connects to a before-queue content filter. This means you -can run more SMTP server processes with the same number of running -content filter processes, and thus, handle more mail. This feature -is off by default until it is proven to create no new problems. +[Feature 20091109] Improved before-queue filter performance. With +"smtpd_proxy_options = speed_adjust", the Postfix SMTP server +receives the entire message before it connects to a before-queue +content filter. This means you can run more SMTP server processes +with the same number of running content filter processes, and thus, +handle more mail. This feature is off by default until it is proven +to create no new problems. This addresses a concern of people in Europe who want to reject all bad mail with a before-queue filter. The alternative, an after-queue @@ -116,107 +49,127 @@ To keep the performance overhead low, the same temporary file is reused with successive mail transactions (the file is of course truncated before reuse, so there is no information leakage). -Incompatibility with snapshot 20091008 -====================================== - -NOTE: You must stop and start the Postfix master daemon before you -can use the postscreen(8) daemon. This is needed because the Postfix -"pass" master service type did not work reliably on some systems. +Major changes - sender reputation +--------------------------------- -Major changes with snapshot 20091008 -==================================== +[Feature 20100117] The FILTER action in access maps or header/body_checks +now supports sender reputation schemes that dynamically choose the +SMTP source IP address. Typically, mail is split into classes, and +all mail in class X is sent out from an SMTP client IP address that +is reserved for class X. -Prototype postscreen(8) server that runs a number of time-consuming -checks in parallel for all incoming SMTP connections, before clients -are allowed to talk to a real Postfix SMTP server. It detects -clients that start talking too soon, or clients that appear on DNS -blocklists, or clients that hang up without sending any command. +This is implemented by specifying FILTER actions with empty next-hop +destinations in access maps or header/body_checks, and by configuring +in master.cf one Postfix SMTP client for each SMTP source IP address, +where each client has its own "-o myhostname" and "-o smtp_bind_address" +settings. -By doing these checks in a single postscreen(8) process, Postfix -can avoid wasting one SMTP server process per connection. A side -benefit of postscreen(8)'s DNSBL lookups is that DNS records are -already cached before the Postfix SMTP server looks them up later. +[Feature 20091209] sender_dependent_default_transport_maps, a +per-sender override for default_transport. The original motivation +is to use different output channels (with different source IP +addresses) for different sender addresses, in order to keep their +IP-based reputations separate from each other. -postscreen(8) maintains a temporary whitelist of positive decisions. -Once an SMTP client is whitelisted, it is immediately forwarded -to a real Postfix SMTP server process without further checking. +The result value syntax is that of default_transport, not transport_maps. +Thus, sender_dependent_default_transport_maps does not support the +special transport_maps result value syntax for null transport, null +nexthop, or null email address. -By default, the program logs only statistics, and it does not run -any checks on clients in mynetworks (primarily, to avoid problems -with buggy SMTP implementations in network appliances). The logging -function alone is already useful for research. +This feature makes sender_dependent_relayhost_maps pretty much +redundant (though sender_dependent_relayhost_maps will often be +easier to use because that is the only thing people want to override). -postscreen(8) can be configured to drop clients that start talking -too soon, or clients that appear on DNS blocklists. For details, -see below. +Major changes - address verification +------------------------------------ -postscreen(8) has been tested on FreeBSD and Linux systems. It -probably needs additional work before it can be used on Solaris. +[Incompat 20100101] The verify(8) service now uses a persistent +cache by default (address_verify_map = btree:$data_directory/verify_cache). +To disable, specify "address_verify_map =" in main.cf. -This snapshot adds three new entries to the master.cf file. +When periodic cache cleanup is enabled (the default), the verify(8) +server now requires that the cache database supports the "delete" +and "sequence" operations. To disable periodic cache cleanup specify +a zero address_verify_cache_cleanup_interval value. -To enable the postscreen(8) service and log client information -without blocking mail: +[Feature 20100101] Periodic cache cleanup for the verify(8) cache +database. The time between cache cleanup runs is controlled with +the address_verify_cache_cleanup_interval (default: 12h) parameter. +Cache cleanup increases the database access latency, so this should +not be run more often than necessary. -1 - Comment out the "smtp inet ... smtpd" service in master.cf, - including any "-o parameter=value" entries that follow. +Major changes - content filter +------------------------------ -2 - Uncomment the new "smtpd pass ... smtpd" service in master.cf, - and duplicate any "-o parameter=value" entries from the smtpd - service that was commented out in step 1. +[Incompat 20100117] The meaning of an empty filter next-hop destination +has changed (for example, "content_filter = foo:" or "FILTER foo:"). +Postfix now uses the recipient domain, instead of using $myhostname +as in Postfix 2.6 and earlier. To restore the old behavior specify +"default_filter_nexthop = $myhostname", or specify a non-empty +next-hop content filter destination. -3 - Uncomment the the new "smtp inet ... postscreen" service in - master.cf. +This compatibility option is not needed with SMTP-based content +filters, because these always have an explicit next-hop destination. -4 - Uncomment the new "dnsblog unix ... dnsblog" service in - master.cf. This service does DNSBL lookups for postscreen(8) - and logs results. +With pipe-based filters that specify no next-hop destination, the +compatibility option restores the FIFO order of deliveries. Without +the compatibility option, the delivery order for filters without +next-hop destination changes to round-robin domain selection. -5 - To enable DNSBL lookups, list some DNS blocklist sites in - main.cf, e.g., "postscreen_dnsbl_sites = zen.spamhaus.org". - Separate domain names with comma or whitespace. +[Feature 20100117] The FILTER action in access maps or header/body_checks +now supports sender reputation schemes that dynamically choose the +SMTP source IP address. Typically, mail is split into classes, and +all mail in class X is sent out from an SMTP client IP address that +is reserved for class X. -Note: you must stop and start the master daemon. This is needed -because the Postfix "pass" master service type did not work reliably -on all systems. +This is implemented by specifying FILTER actions with empty next-hop +destinations in access maps or header/body_checks, and by configuring +in master.cf one Postfix SMTP client for each SMTP source IP address, +where each client has its own "-o myhostname" and "-o smtp_bind_address" +settings. -To use the postscreen(8) service to block mail, edit main.cf and -specify one or more of: +[Feature 20091109] Improved before-queue filter performance. With +"smtpd_proxy_options = speed_adjust", the Postfix SMTP server +receives the entire message before it connects to a before-queue +content filter. This means you can run more SMTP server processes +with the same number of running content filter processes, and thus, +handle more mail. This feature is off by default until it is proven +to create no new problems. -- "postscreen_greet_action = drop", to drop clients that talk before - their turn. This alone stops about one third of all known-to-be - illegitimate connections to Wietse's mail server. +This addresses a concern of people in Europe who want to reject all +bad mail with a before-queue filter. The alternative, an after-queue +filter, means they would have to discard bad mail (which is illegal) +or bounce bad mail (which violates good network citizenship). -- "postscreen_hangup_action = drop", to waste no time on clients - that hang up without sending a command. On Wietse's server, only - one percent of illegitimate connections behaves like this. +NOTE 1: When this feature is turned on, a filter cannot selectively +reject recipients of a multi-recipient message. It is OK to reject +all recipients of the same multi-recipient message, as is deferring +or accepting all recipients of the same multi-recipient message. -- "postscreen_dnsbl_action = drop", to drop clients that are on DNS - blocklists. Different blocklists cover different client categories. +NOTE 2: This feature increases the minimum amount of free queue +space by $message_size_limit. The extra space is needed to save the +message to a temporary file. -There is also support for permanent blacklists and whitelists; see -the postscreen(8) manual page for details. +To keep the performance overhead low, the same temporary file is +reused with successive mail transactions (the file is of course +truncated before reuse, so there is no information leakage). -Note: right now, postscreen(8) "drop" actions disconnect the client -without reporting sender and recipient information. In a future -implementation, the connection may instead be passed to a dummy -SMTP protocol engine that logs sender and recipient information -before dropping the connection. +Major changes - milter +---------------------- -Incompatibility with snapshot 20090606 -====================================== +[Feature 20090606] Support for header checks on Milter-generated +message headers. This can be used, for example, to control mail +flow with Milter-generated headers that carry indicators for badness +or goodness. For details, see the postconf(5) section for +"milter_header_checks". Currently, all header_checks features are +implemented except PREPEND. -The "postmulti -e destroy" command no longer attempts to remove -files that are created AFTER "postmulti -e create". It still works -as expected immediately after creating an instance by mistake. -Trying to automatically remove other files is too risky because -Postfix-owned directories are by design not trusted. +Major changes - multi-instance support +-------------------------------------- -Major changes with snapshot 20090606 -==================================== +[Incompat 20090606] The "postmulti -e destroy" command no longer +attempts to remove files that are created AFTER "postmulti -e +create". It still works as expected immediately after creating an +instance by mistake. Trying to automatically remove other files +is too risky because Postfix-owned directories are by design not +trusted. -Support for header checks on Milter-generated message headers. This -can be used, for example, to control mail flow with Milter-generated -headers with indicators for badness or goodness. For details, see -the postconf(5) section for "milter_header_checks". Currently, all -header_checks features are implemented except PREPEND. diff --git a/postfix/WISHLIST b/postfix/WISHLIST deleted file mode 100644 index 89d05f77f..000000000 --- a/postfix/WISHLIST +++ /dev/null @@ -1,471 +0,0 @@ -Wish list: - - Remove this file from the stable release. - - Should the postscreen temporary cache remember hosts that - are listed in the permanent white/black lists, and be queried - first? Skipping white/black list lookups will speed up the - handling of "good" clients without a permanent whitelist - entry. Of course, this means that updates to the white/black - lists do not immediately take effect. Workarounds: 1) ignore - cached white/black list lookup results after "postfix - reload"; 2) use a short temporary cache TTL for clients on - the permanent black/white lists; 3) adjust the logging, for - example "WHITELISTED address (cached)" and "BLACKLISTED - address (cached)" to eliminate surprises. Comparing the - cache entry time with the white/blacklist file modification - time is not foolproof: for example, pcre or CIDR tables are - read only once. - - It would be nice if the generic dict_cache(3) cache manager - could postpone process suicide until cache cleanup is - completed (but that is not possible when postscreen forks - into the background to finish already-accepted connections, - and it is not desirable when a host is being shut down). - - When postscreen drops a connection, a 521 "greeting" should - be of the form "521 servername..." and not have an enhanced - status code. The "521 5.7.1" form can be used after EHLO. - Of course no spammer is going to complain about Postfix - SMTP compliance. - - Find a place to document all the mail routing mechanisms - in one place so people can figure out how Postfix works. - - owner-listname does not work for shell commands. - - Investigate viability of Sendmail socket maps (the moral - equivalent of tcp_table(5)), and dns maps. - - The BCC action is marked "not stable", perhaps because - people would also expect BCC actions in header/body_checks. - How much would it take to make the queue file editing code - generally usable? - - Move smtpd_command_filter into smtpd_chat_query() and update - the session transcript (see smtp_chat_reply() for an example). - - Add smtpd_sender_login_maps to proxy_read_maps. - - SMTP connection caching without storing connections, to - improve TLS mail delivery performance. - - postscreen has separate socket budgets for whitelisted - clients and for other clients. If we add a dummy SMTP engine - then we extend the session length for non-whitelisted clients - and need to increase the socket budget (or create a new - budget class, which complicates the user interface). - - Should not milter8_mail_event() unset the "hold" default - reply? Better, the default reply should not be used for - this purpose. - - Unescape the pregreeter's HELO command argument so that - don't show up as ??. - - Make postscreen logging easier. Always log connect, then log - why the connection is or is not forwarded. - - Don't send MASTER_STAT_TAKEN/MASTER_STAT_AVAIL when a server - runs with process limit of 1. But this means the master - never learns that the process is successful and will always - pause $service_throttle_time before restarting a failed service. - - Don't bother maintaining a per-service lockfile when a - server runs with process limit of 1. The purpose of the - lockfile is to avoid thundering herd problems when the kernel - wakes up multiple processes for each new client connection. - - Concurrency/speed-matching: invoke a before-queue (smtpd_proxy) - filter after the entire message is received, so that fewer - filter processes will be running simultaneously. In some - parts of the world, after-queue filtering is problematic. - - This is different than the MailChannels patented solution - to multiplex many slow SMTP connections over a few fast - SMTP connections. We simply postpone opening the connection - to the filter, and rely on the before-filter SMTP server - to reject invalid recipients. MailChannels uses one - connection-to-MTA to discover invalid recipients, receives - the email message with a potentially reduced bitrate, and - then uses another connection-to-MTA to deliver the message - quickly. - - Implement PREPEND action for milter_header_checks. Save the - to-be-prepended text to buffer, then emit it along with the - new header. - - Fix the header_body_checks API, so that the name of the map - class (e.g. milter_header_checks) is available for logging. - - Fix the mime_state and header_body_checks APIs, so that - they use VSTRINGs. This simplifies REPLACE actions. - - Update FILTER_README for multi-instance support, and rename - the old document to FILTER_LEGACY_README. - - Need to sign delivery status notifications, to avoid surprises - when eventually people start enforcing DKIM etc. signatures. - - Either document or remove the internal_mail_filter_classes - feature (it's disabled by default). - - "postconf -N" option to print user-defined parameter names - (these have no defaults, since they exist only when - specified in main.cf or with "-o name=value"). - - Make the "unknown recipient" test configurable as - first|last|never, with "yes"=="last" for backwards - compatibility. The "first" setting is good for performance - (stress=yes) when all users are defined in local files; but - it may perform worse when users are in networked tables. - - Cleanup: make DNSBL query format configurable beyond the - client's reversed IP address. - - With 'final delivery' in the LMTP client, need an option - to also add delivered-to and other pipe(8) features. This - requires making mail_copy() functionality available in - non-mailbox context. - - Cleanup: modernize the "add missing From: header" code, to - ``phrase '' form. Most likely, quote the entire phrase - if it contains any text that is special, then rfc822_externalize - the whole thing. - - SMTP server: make the server_addr and server_port available - to policy server, Dovecot, and perhaps Milters. - - Med: local and remote source port and IP address for smtpd - policy hook. - - Maybe change maps_rbl_reject_code default to 521, and - update wording in STRESS_README. - - Encapsulate time_t comparisons so that they can be made - system dependent (use difftime() where available). - - Encapsulate time_t conversions (e.g. REC_TYPE_TIME) so that - they can be made system dependent. - - Plan for time_t larger than long, or wait for LP64 to - dominate the world? - - Make "AUTH=<>" appendage to MAIL FROM configurable, enabled - by default. - - To support ternary operator without a huge parsing effort, - consider ${value?{xxx}:{yyy}} where ${name} is existing - syntax, and where ?{text} and :{text} are new syntax that - is unlikely to break existing configurations. Or perhaps - it's just too ugly. - - Write delivery rate delay example (which _README?) and auth - failure cache example (SASL_README). Then include them in - SOHO_README. - - Look for alternatives for the use of non_smtpd_milters. - This involves some way to force local submissions to go - through a local SMTP client and server, without triggering - "mail loops back to myself" false alarms. The advantage is - that it makes smtpd_mumble_restrictions available for local - and remote mail; the disadvantage is that it makes local - submissions more dependent on networking. One possibility - is to use "pickup -o content_filter=smtp:127.0.0.1:10025", - or a dedicated SMTP client/server on UNIX-domain sockets; - we could also decide to always suppress "mail loop" detection - for loopback connections. Another option is to have the - pickup or cleanup server drive an SMTP client directly; - this would require extension of the mail_stream() interface, - plus a way to handle bounced/deferred recipients intelligently, - but it would be at odds with Postfix design where delivery - agents access queue files directly; exposing delivery agents - to raw queue files violates another Postfix design principle. - - Consolidate duplicated code in *_server_accept_{pass,inet}(). - - Consolidate duplicated code in {inet,unix,upass}_trigger.c. - - In the SMTP client, handle 421 replies in smtp_loop() by - having the input function raise a flag after detecting 421 - (kill connection caching and be sure to do the right thing - with RSET probes), leave the smtp_loop() per-command reply - handlers unchanged, and have the smtp_loop() reader loop - bail out with smtp_site_fail("server disconnected after - %s", where), but only in the case that it isn't already in - the final state. But first we need to clean up the handling - of do/don't cache, expired, bad and dead sessions. - - Combine smtpd_peer.c and qmqpd_peer.c into a single function - that produces a client context object, and provide attribute - print/scan routines that pass these client context objects - around. With this, we no longer have to update multiple - pieces of code when a client attribute is added. Ditto for - SASL and TLS context. - - Make TLS_BIO_BUFSIZE run-time adjustable, to future-proof - Postfix for remote connections with MSS > 8 kbytes. - - Don't log "warning: XXXXX: undeliverable postmaster - notification discarded" for spam from outside. - - Really need a cleanup driver that allows testing against - Milter applications instead of synthetic events. This would - have to provide stubs for clients that talk to Postfix - daemon processes. See if this approach can also be used for - other daemons. - - smtpd(8) exempts $address_verify_sender from access controls, - but it doesn't know whether cleanup(8) or delivery agents - modify the sender. Would it be possible to "calibrate" this - exemption, perhaps by having delivery agents pass the probe - sender to the verify server, keeping in mind that the probe - sender may differ per delivery agent due to output rewriting. - - Update attr_print/scan() so they can send/receive file - descriptors. This simplifies kludgy code in many daemons. - - Would there be a problem adding $smtpd_mumble_restrictions - and $smtpd_sender_login_maps to the default proxy_read_maps - settings? - - Remove defer(8) and trace(8) references and man pages. These - are services not program names. On the other hand we have - man pages for lmtp(8) and smtp(8), but not for relay(8). - Likewise, retry(8) does not have a man page. - - Bind all deliveries to the same local delivery process, - making Postfix perform as poorly as monolithic mailers, but - giving a possibility to eliminate duplicate deliveries. - - Maybe declare loop when resolve_local(mxhost) is true? - - Update message content length when adding/removing headers. - - Need scache size limit. - - Make postcat header/body aware so people can grep headers. - What headers? primary, mime, nested? What body? Does it - include the mime and attached headers? - - REDIRECT should override original recipient info, and - probably override DSN as well. - - Find out if with Sendmail, a Milter "add recipient" request - results in NOTIFY=NONE as Postfix does now. - - Update FILTER_README with mailing list suggestions to tag - with a badness indicator and then filter down-stream. - - Make null local-part handling configurable: either expand - into mailer-daemon (current bahavior) or disallow (strict - behavior, currently implemented only in the SMTP server). - - The type of var_message_limit (and other file size/offset - configuration parameters or internal protocol attributes) - should be changed from int to off_t. This also requires - checking all expressions in which var_message_limit etc. - appears: qmqpd, netstring, deliver_request, ... - - Add M flag (enable multi-recipient delivery) to pipe daemon. - - The usage of TLScontext->cache_type is unclear. It specifies - a TLS session cache type (smtpd, smtp, or lmtp), but it is - sometimes used as an indicator that TLS session caching is - unavailable. In reality, that decision is made by not - registering call-back functions for cache maintenance. - - Postfix TLS library code should copy any strings that it - receives from the application, instead of passing them - around as pointers. TLScontext->cache_type is a case in - point. - - Are transport:nexthop null fields the same as in the case - of default_transport etc. parameters? - - Don't lose bits when converting st_dev into maildir file - name. It's 64 bits on Linux. Found with the BEAM source - code analyzer. Is this really a problem, or are they just - using 64 bits for upwards compatibility with LP64 systems? - - Do or don't introduce unknown_reverse_client_reject_code. - - Check that "UINT32 == unsigned int" choice is ok (i.e. LP64 - UNIX). - - Tempfail when a Milter application tries to negotiate content - access, while it is configured in an SMTP server that runs - before the smtpd_proxy filter. - - Log DSN original recipient when rejecting mail. - - Keep whitespace between label and ":"? - - Make the map case folding/locking options configurable, if - not at run-time then at least at compile time so we get - consistent behavior across applications. - - Investigate what it would take to eliminate oqmgr, and to - make the old behavior configurable in a unified queue - manager. This would shave another 2.7 KLOC from the source - footprint. - - Document the case folding strategy for match_list like - features. - - Eliminate the (incoming,deferred)->active rename operation. - This requires an in-memory hash of queue file names to avoid - duplicate open() operations. - - Softbounce fallback-to-ISP for SOHO users. This heuristic - assumes that when direct-to-MX delivery fails with 5XX, - delivery via the ISP may still succeed. This could be - implemented by enabling soft bounces for destinations other - than the smtp_fallback_relay. So the only benefit of this - over the existing soft_bounce feature is that it has no - effect on smtp_fallback_relay deliveries. - - Centralize main.cf parameter input so that defaults work - consistently. What about parameter names that are prefixed - with mail delivery transport names? - - Fix default time unit handling so that we can have a default - bounce lifetime of $maximal_queue_lifetime, without causing - panics when a non-default maximal_queue_lifetime setting - includes no time unit. - - After the 20051222 ISASCII paranoia, lowercase() lowercases - ASCII text only. - - Privacy: remove local command/pathname details from remote - delivery status reports, and log them via local msg_warn(). - - Is it safe to cache a connection after it has been used for - more than some number of address verification probes? - - Try to recognize that Resent- headers appear in blocks, - newest block first. But don't break on incorrect header - block organization. - - Hard limits on cache sizes (anvil, specifically). - - Laptop friendliness: make the qmgr remember when the next - deferred queue scan needs to be done, and have the pickup - server stat() the maildrop directory before searching it. - - Low: replace_sender/replace_recipient actions in access - maps, so they can be used in policy servers? - - Low: configurable order of local(8) delivery methods. - - Med: smtp_connect_timeout_budget (default: 3x smtp_connect_timeout) - to limit the total time spent trying to connect. - - Med: transform IPv4-in-IPv6 address literals to IPv4 form - when comparing against local IP addresses? - - Med: transform IPv4-in-IPv6 address literals to IPv4 form - when eliminating MX mailer loops? - - Med: Postfix requires [] around IPv6 address information - in match lists such as mynetworks, debug_peer_list etc., - but the [] must not be specified in access(5) maps. Other - places don't care. For now, this gotcha is documented in - IPV6_README and in postconf(5) with each feature that may - use IPv6 address information. The general recommendation - is not to use [] unless absolutely necessary. - - Med: the partial address matching of IPv6 addresses in - access(5) maps is a bit lame: it repeatedly truncates the - last ":octetpair" from the printable address representation - until a match is found or until truncation is no longer - possible. Since one or more ":" are usually omitted from - the printable IPv6 address representation, this does not - really try all the possibilities that one might expect to - be tried. For now, this gotcha is documented in access(5). - - Low: reject HELO with any domain name or IP address that - this MTA is the final destination for. - - Low: should the Delivered-To: test in local(8) be configurable? - - Low: make mail_addr_find() lookup configurable. - - Low: update events.c so that 1-second timer requests do not - suffer from rounding errors. This is needed for 1-second - SMTP session caching time limits. A 1-second interval would - become arbitrarily short when an event is scheduled just - before the current second rolls over. - - Low: configurable internal/system locking method. - - Low: add INSTALL section for pre-existing Postfix systems. - - Low: add INSTALL section for pre-existing RPM Postfixes. - - Low: disallow smtpd_recipient_limit < 100 (the RFC minimum). - - Low: noise filter: allow smtp(8) to retry immediately if - all MXes return a quick ECONNRESET or 4xx reply during the - initial handshake. Retry once? How many times? - - Low: make post-install a "postfix-only script" so it can - take data from the environment instead of main.cf. - - Low: randomize deferred mail backoff. - - Med: separate ulimit for delivery to command? - - Med: postsuper -r should do something with recipients in - bounce logfiles, to make sure the sender will be notified. - To be perfectly safe, no process other than the queue manager - should move a queue file away from the active queue. - - This could involve tagging a queue file, and use up another - permission bit (postsuper tags a "hot" file, qmgr requeues it). - - Low: postsuper re-run after renaming files, but only a - limited number of times. - - Low: smtp-source may block when sending large test messages. - - Med: find a way to log the sender address when MAIL FROM - is rejected due to lack of disk space. - - Low: revise other local delivery agent duplicate filters. - - Low: all table lookups should consistently use internalized - (unquoted) or externalized (quoted) forms as lookup keys. - smtpd, qmgr, local, etc. use unquoted address forms as keys. - cleanup uses quoted forms. - - Low: have a configurable list of errno values for mailbox - or maildir delivery that result in deferral rather than - bouncing mail. What about "killed by signal" exits? - - Low: after reorganizing configuration parameters, add flags - to all parameters whose value can be read from file. - - Medium: need in-process caching for map lookups. LDAP servers - seem to need this in particular. Need a way to expire cached - results that are too old. - - Low: generic showq protocol, to allow for more intelligent - processing than just mailq. Maybe marry this with postsuper. - - Low: default domain for appending to unqualified recipients, - so that unqualified names can be delivered locally. - - Low: The $process_id_directory setting is not used anywhere - in Postfix. Problem reported by Michael Smith, texas.net. - This should be documented, or better, the code should warn - about attempts to set read-only parameters. - - Low: postconf -e edits parameters that postconf won't list. - - Low: while converting 8bit text to quoted-printable, perhaps - use =46rom to avoid having to produce >From when delivering - to mailbox. - - virtual_mailbox_path expression like forward_path, so that - people can specify prefix and suffix. diff --git a/postfix/conf/master.cf b/postfix/conf/master.cf index 82f976751..9f0b7552e 100644 --- a/postfix/conf/master.cf +++ b/postfix/conf/master.cf @@ -9,9 +9,6 @@ # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - - smtpd -#smtp inet n - n - 1 postscreen -#smtpd pass - - n - - smtpd -#dnsblog unix - - n - 0 dnsblog #submission inet n - n - - smtpd # -o smtpd_tls_security_level=encrypt # -o smtpd_sasl_auth_enable=yes diff --git a/postfix/conf/post-install b/postfix/conf/post-install index 6e818671a..446c57f90 100644 --- a/postfix/conf/post-install +++ b/postfix/conf/post-install @@ -737,36 +737,6 @@ q EOF } - # Postfix 2.7. - # Add missing postscreen service to master.cf. - - grep '^#*smtp.*postscreen' $config_directory/master.cf >/dev/null || { - echo Editing $config_directory/master.cf, adding missing entry for postscreen TCP service - cat >>$config_directory/master.cf </dev/null || { - echo Editing $config_directory/master.cf, adding missing entry for smtpd unix-domain service - cat >>$config_directory/master.cf </dev/null || { - echo Editing $config_directory/master.cf, adding missing entry for dnsblog unix-domain service - cat >>$config_directory/master.cf <WARNING -

The sender/recipient address verification feature described in this -document is suitable only for low-traffic sites. It performs poorly -under high load; excessive sender address verification activity may -even cause your site to be blacklisted by some -providers. See the "Limitations" section -below for details.

+

Recipient address verification may cause an increased load on +down-stream servers in the case of a dictionary attack or a flood +of backscatter bounces. Sender address verification may cause your +site to be blacklisted by some providers. See also the "Limitations" section below for more.

What Postfix address verification can do for you

@@ -35,7 +34,7 @@ until the address has been verified to be deliverable.

The technique has obvious uses to reject junk mail with an unreplyable sender address.

-

The technique may also be useful to block mail for undeliverable +

The technique is also useful to block mail for undeliverable recipients, for example on a mail relay host that does not have a list of all the valid recipient addresses. This prevents undeliverable junk mail from entering the queue, so that Postfix doesn't have to @@ -86,74 +85,96 @@ always discarded.

- +
- + + - + - + - + - + + + + + + + + + + + - - + - + - + - + - + - + + + - + - + + + - - - + - + - + - + - + - + - + - + @@ -181,7 +202,8 @@ details.

MTA for that address, without actually delivering mail to it. If the nearest MTA accepts the address, then Postfix assumes that the address is deliverable. In reality, mail for a remote address can -bounce AFTER the nearest MTA accepts the recipient address.

+bounce AFTER the nearest MTA accepts the recipient address, or AFTER +the nearest MTA accepts the message content.

  • Some sites may blacklist you when you are probing them too often (a probe is an SMTP session that does not deliver mail), @@ -200,21 +222,25 @@ mail routing and for possible limitations when you have to do this.

  • Postfix assumes that an address is undeliverable when the nearest MTA for the address rejects the probe, regardless of the reason for rejection (client rejected, HELO rejected, MAIL FROM -rejected, etc.). Thus, Postfix rejects mail when the sender's MTA -rejects mail from your machine. This is a good thing.

    +rejected, etc.). Thus, Postfix rejects an address when the nearest +MTA for that address rejects mail from your machine for any reason. +This is not a limitation, but it is mentioned here just in case +people believe that it is a limitation.

    -
  • Unfortunately, some major sites such as YAHOO do not reject +

  • Unfortunately, some sites do not reject unknown addresses in reply to the RCPT TO command, but report a delivery failure in response to end of DATA after a message is transferred. Postfix address verification does not work with such sites.

    -
  • By default, Postfix probe messages have "double-bounce@$myorigin" -as the sender address (with Postfix versions before 2.5, the default +

  • By default, Postfix probe messages have a sender address +"double-bounce@$myorigin" (with Postfix versions before 2.5, the +default is "postmaster@$myorigin"). This is SAFE because the Postfix SMTP server does not reject mail for this address.

    -

    You can change this into the null address ("address_verify_sender +

    You can change the probe sender address into the null address +("address_verify_sender ="). This is UNSAFE because address probes will fail with mis-configured sites that reject MAIL FROM: <>, while probes from "postmaster@$myorigin" would succeed.

    @@ -223,7 +249,7 @@ probes from "postmaster@$myorigin" would

    Recipient address verification

    -

    As mentioned earlier, recipient address verification may be +

    As mentioned earlier, recipient address verification is useful to block mail for undeliverable recipients on a mail relay host that does not have a list of all valid recipient addresses. This can help to prevent the mail queue from filling up with @@ -237,9 +263,11 @@ However, recipient address verification probes can increase the load on down-stream MTAs when you're being flooded by backscatter bounces, or when some spammer is mounting a dictionary attack.

    -

    By default, address verification results are not saved. To avoid -probing the same address repeatedly, you can store the result in a -persistent database as described later.

    +

    By default, address verification results are saved in a persistent database (Postfix version 2.7 and +later; with earlier versions, specify the database in main.cf as +described later). The persistent database helps to avoid probing +the same address repeatedly.

    @@ -299,11 +327,13 @@ in forged email.  

    # Postfix 2.6 and later. # unverified_sender_defer_code = 250 + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify /etc/postfix/sender_access: + # Don't do this when you handle lots of email. aol.com reject_unverified_sender hotmail.com reject_unverified_sender bigfoot.com reject_unverified_sender @@ -344,6 +374,7 @@ you can see what mail would be blocked:

    # Postfix 2.6 and later. # unverified_sender_reject_reason = Address verification failed + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify @@ -403,7 +434,8 @@ sender address verification probe fails with some temporary error.

    Address verification database

    To improve performance, the Postfix verify(8) daemon can save -address verification results to a persistent database. The +address verification results to a persistent database. This is +enabled by default with Postfix 2.7 and later. The address_verify_map (NOTE: singular) configuration parameter specifies persistent storage for sender or recipient address verification results. If you specify an empty value, all address verification diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in index e1d73f93a..05604adec 100644 --- a/postfix/html/Makefile.in +++ b/postfix/html/Makefile.in @@ -7,8 +7,7 @@ DAEMONS = bounce.8.html cleanup.8.html defer.8.html error.8.html local.8.html \ showq.8.html smtp.8.html smtpd.8.html trivial-rewrite.8.html \ oqmgr.8.html spawn.8.html flush.8.html virtual.8.html qmqpd.8.html \ trace.8.html verify.8.html proxymap.8.html anvil.8.html \ - scache.8.html discard.8.html tlsmgr.8.html postscreen.8.html \ - dnsblog.8.html + scache.8.html discard.8.html tlsmgr.8.html COMMANDS= mailq.1.html newaliases.1.html postalias.1.html postcat.1.html \ postconf.1.html postfix.1.html postkick.1.html postlock.1.html \ postlog.1.html postdrop.1.html postmap.1.html postmulti.1.html \ diff --git a/postfix/html/OVERVIEW.html b/postfix/html/OVERVIEW.html index 7a332d9c1..689b340fb 100644 --- a/postfix/html/OVERVIEW.html +++ b/postfix/html/OVERVIEW.html @@ -651,31 +651,126 @@ align="center" bgcolor="#f0f0ff"> smtp
    session
    cache

  • The verify(8) server verifies that a sender or recipient address is deliverable before the smtpd(8) server accepts it. The -verify(8) server injects probe messages into the Postfix queue and -processes status updates from delivery agents and/or queue manager. +verify(8) server queries a cache with address verification results. +If a result is not found, the verify(8) server injects a probe +message into the Postfix queue and processes the status update from +a delivery agent or queue manager. This process is described in the ADDRESS_VERIFICATION_README document. The verify(8) service is available with Postfix version 2.1 and later.

  • Internet + +   -> -> probe
    + message
    Postfix
    SMTP
    server
    -> + <-> - + Postfix
    mail
    queue
    - Postfix
    verify
    server
    -
    Internet -> + + Postfix
    SMTP
    server
    <-> + <-> Address
    - verification
    database
    + Postfix
    verify
    server
    +
        |
    + v
    |
    - probe
    messages
    v
    ^
    delivery
    - status
    |
    <- + probe
    + status
    <- + + Postfix
    delivery
    agents
    -> + Local
    -> Remote
    +   + ^
    |
    v
    - Postfix
    queue
    ->
     
    - Postfix
    delivery
    agents
      + Address
    verification
    database
    - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Network -> smtpd(8) <-> verify(8) --> cleanup(8) - -> -qmgr(8)
    Postfix
    queue
    -> Delivery
    agents
    +   + -> probe
    message
    -> + Postfix
    mail
    queue
    -\
    \
    -
    <- <- - |
    v
    - /
    /
    +
    Network -> + smtpd(8) <-> verify(8) +
    |
    v
    <- + probe
    + status
    + <- Postfix
    delivery
    agents +
    -> + Local
    -> Network
    +   + ^
    |
    v
     
      Address
    + verification
    cache
    + +
  • The postscreen(8) server can be put "in front" of Postfix +smtpd(8) processes. Its purpose is to accept connections from the +network and to decide what SMTP clients are allowed to talk to +Postfix. According to the 2008 MessageLabs annual report, 81% of +all email was spam, and 90% of that was sent by botnets. While +postscreen(8) keeps the zombies away, more smtpd(8) processes remain +available for legitimate clients.

    + +

    The postscreen(8) server is still evolving, and is likely to +undergo changes that break compatibility with earlier versions. +For this reason the postscreen(8) server is not installed with the +stable Postfix release.

    + + + + + + + + + + + + + + + + + + + + + + + +
    zombie
    \
    zombie - + - smtpd(8)
    \ /
    other +--- +postscreen(8)
    / \
    other + - + - smtpd(8)
    /
    zombie
    diff --git a/postfix/html/SASL_README.html b/postfix/html/SASL_README.html index 7d314e901..b475ab3d7 100644 --- a/postfix/html/SASL_README.html +++ b/postfix/html/SASL_README.html @@ -1,8 +1,6 @@ - - Postfix SASL Howto @@ -17,803 +15,2116 @@
    -

    WARNING

    +

    Warning

    People who go to the trouble of installing Postfix may have the expectation that Postfix is more secure than some other mailers. -The Cyrus SASL library is a lot of code. With this, Postfix becomes -as secure as other mail systems that use the Cyrus SASL library. -Dovecot provides an alternative that may be worth considering. -

    +The Cyrus SASL library contains a lot of code. With this, Postfix +becomes as secure as other mail systems that use the Cyrus SASL +library. Dovecot provides an alternative that may be worth +considering.

    + +

    How Postfix uses SASL authentication

    + +

    When an SMTP client connects to an SMTP server, the server needs +to decide whether that client is authorized to send mail to remote +destinations, or whether the client can send mail only to the +destinations that the server itself is responsible for. Usually, +the SMTP server will allow mail to remote destinations only if the +client's IP address is in the "same network" as the server's IP +address.

    + +

    Sometimes the SMTP client and server are in different networks, +but the client still needs "same network" privileges. To address +this problem, Postfix supports SASL authentication (RFC 4954, +formerly RFC 2554). With this a remote SMTP client can authenticate +to the Postfix SMTP server, and the Postfix SMTP client can +authenticate to a remote SMTP server. Once the client is authenticated +the server can give it "same network" privileges.

    + +

    Postfix does not implement SASL itself, but instead uses existing +implementations as building blocks. This means that some SASL-related +configuration will involve files that belong to Postfix, while other +configuration will involve files that belong to the specific SASL +implementation that Postfix will use. This document covers both the +Postfix and non-Postfix configuration.

    + +

    You can read more about the following topics:

    -

    How Postfix uses SASL authentication information

    +
  • -

    Postfix version 2.3 introduces a plug-in mechanism that provides -support for multiple SASL implementations. To find out what -implementations are built into Postfix, use the following commands: -

    +
  • Enabling SASL authentication and +authorization in the Postfix SMTP server -
    -
    -% postconf -a (SASL support in the SMTP server)
    -% postconf -A (SASL support in the SMTP+LMTP client)
    -
    -
    +
  • -
    -
    -% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
    -
    -
    +
  • Testing SASL authentication in the Postfix +SMTP server
  • + + -

    After this, proceed with "make" as described in the -INSTALL document.

    -

    Notes:

    +

    Which SASL Implementations are supported?

    -
      +

      Currently the Postfix SMTP server supports the Cyrus SASL and +Dovecot SASL implementations.

      -
    • The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just -makes Postfix configuration a little more convenient because you -don't have to specify the SASL plug-in type in the Postfix main.cf -file.

      +
      -
    • If you also want support for LDAP or TLS, you will have to merge -their CCARGS and AUXLIBS into the above command line.

      +Note -
    +

    Before Postfix version 2.3, Postfix had support only for Cyrus +SASL. Current Postfix versions have a plug-in architecture that +can support multiple SASL implementations.

    -

    Building the Cyrus SASL library

    +
    -

    Postfix appears to work with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, -which are available from:

    +

    To find out what SASL implementations are compiled into Postfix, +use the following commands:

    -ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
    +% postconf -a (SASL support in the SMTP server)
    +% postconf -A (SASL support in the SMTP+LMTP client)
     
    -

    IMPORTANT: if you install the Cyrus SASL libraries as per the -default, you will have to symlink /usr/lib/sasl -> /usr/local/lib/sasl -for version 1.5.x or /usr/lib/sasl2 -> /usr/local/lib/sasl2 for -version 2.1.x.

    - -

    Reportedly, Microsoft Outlook (Express) requires the -non-standard LOGIN authentication method. To enable this -authentication method, specify ``./configure --enable-login''.

    +

    These commands are available only with Postfix version 2.3 and +later.

    -

    Building Postfix with Cyrus SASL support

    +

    Configuring Dovecot SASL

    -

    These instructions assume that you build Postfix from source -code as described in the INSTALL document. Some modification may -be required if you build Postfix from a vendor-specific source -package.

    +

    Dovecot is a POP/IMAP server that must be configured to +authenticate POP/IMAP clients. When the Postfix SMTP server uses +Dovecot SASL, it also reuses this configuration. Consult the Dovecot documentation for how +to configure and operate the Dovecot authentication server.

    -

    The following -assumes that the Cyrus SASL include files are in /usr/local/include, -and that the Cyrus SASL libraries are in /usr/local/lib.

    +

    Postfix to Dovecot SASL communication

    -

    On some systems this generates the necessary Makefile definitions: +

    Communication between the Postfix SMTP server +and Dovecot SASL happens via a UNIX-domain socket. The socket +pathname and the list of mechanisms offered to Postfix need to be +specified on the Dovecot server side in dovecot.conf.

    -
    - -
    (for Cyrus SASL version 1.5.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"
    -
    +

    The following example assumes that the Postfix queue is under +/var/spool/postfix/.

    -
    (for Cyrus SASL version 2.1.x): -
    +
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"
    + 1 /etc/dovecot.conf:
    + 2     auth default {
    + 3       mechanisms = plain login
    + 4         passdb pam {
    + 5         }
    + 6         userdb passwd {
    + 7         }
    + 8         socket listen {
    + 9         client {
    +10           path = /var/spool/postfix/private/auth
    +11           mode = 0660
    +12           user = postfix
    +13           group = postfix
    +14         }
    +15       }
    +16     }
     
    +
    -
    +

    Line 3 provides plain and login as +mechanisms for the Postfix SMTP server, line 10 places the Dovecot +SASL socket in /var/spool/postfix/private/auth, and +lines 11-13 limit read+write permissions to user and group +postfix only.

    -

    On Solaris 2.x you need to specify run-time link information, -otherwise ld.so will not find the SASL shared library:

    +

    Proceed with the section "Enabling SASL authentication and +authorization in the Postfix SMTP server" to turn on and use +SASL in the Postfix SMTP server.

    -
    +

    Configuring Cyrus SASL

    -
    (for Cyrus SASL version 1.5.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include" AUXLIBS="-L/usr/local/lib \
    -    -R/usr/local/lib -lsasl"
    -
    +

    The Cyrus SASL framework was supports a wide variety of +applications. Different applications may require different +configurations. As a consequence each application may have its own +configuration file.

    -
    (for Cyrus SASL version 2.1.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \
    -    -R/usr/local/lib -lsasl2"
    -
    +

    The first step configuring Cyrus SASL is to determine name and +location of a configuration file that describes how the Postfix +SMTP server will use the SASL framework.

    -
    +

    Cyrus SASL configuration file name

    -

    Enabling SASL authentication in the Postfix -SMTP server

    +

    The name of the configuration file (default: smtpd.conf) +is configurable. It is a concatenation from a value that the Postfix +SMTP server sends to the Cyrus SASL library, and the suffix +.conf, added by Cyrus SASL.

    -

    In order to enable SASL support in the Postfix SMTP server:

    +

    The value sent by Postfix is the name of the server component +that will use Cyrus SASL. It defaults to smtpd and +is configured with one of the following variables:

     /etc/postfix/main.cf:
    -    smtpd_sasl_auth_enable = yes
    -
    -
    - -

    In order to allow mail relaying by authenticated remote SMTP -clients:

    + # Postfix 2.3 and later + smtpd_sasl_path = smtpd -
    -
    -/etc/postfix/main.cf:
    -    smtpd_recipient_restrictions = 
    -        permit_mynetworks 
    -        permit_sasl_authenticated 
    -        reject_unauth_destination
    +    # Postfix < 2.3
    +    smtpd_sasl_application_name = smtpd
     
    -

    To report SASL login names in Received: message headers -(Postfix version 2.3 and later):

    +

    Cyrus SASL configuration file +location

    -
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_authenticated_header = yes
    -
    -
    +

    The location where Cyrus SASL searches for the named file depends +on the Cyrus SASL version and the OS/distribution used.

    -

    Note: the SASL login names will be shared with the entire world. -

    +

    You can read more about the following topics:

    -

    Older Microsoft SMTP client software implements a non-standard -version of the AUTH protocol syntax, and expects that the SMTP -server replies to EHLO with "250 AUTH=mechanism-list" instead of -"250 AUTH mechanism-list". To accommodate such clients (in addition -to conformant -clients) use the following:

    +
      -
      -
      -/etc/postfix/main.cf:
      -    broken_sasl_auth_clients = yes
      -
      -
      +
    • Cyrus SASL version 2.x searches for the configuration file +in /usr/lib/sasl2/.

    • -

      Dovecot SASL configuration for the -Postfix SMTP server

      +
    • Cyrus SASL version 2.1.22 and newer additionally search +in /etc/sasl2/.

    • -

      Dovecot SASL support is available in Postfix 2.3 and later. On -the Postfix side you need to specify the location of the -Dovecot authentication daemon socket. We use a pathname relative -to the Postfix queue directory, so that it will work whether or not -the Postfix SMTP server runs chrooted:

      +
    • Some Postfix distributions are modified and look for the +Cyrus SASL configuration file in /etc/postfix/sasl/, +/var/lib/sasl2/ etc. See the distribution-specific +documentation to determine the expected location.

    • + +
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_type = dovecot
    -    smtpd_sasl_path = private/auth
    -
    -
    -

    On the Dovecot side you also need to specify the Dovecot -authentication daemon socket. In this case we specify an -absolute pathname. In the example we assume that the -Postfix queue is under /var/spool/postfix/.

    +Note + +

    Cyrus SASL searches /usr/lib/sasl2/ first. If it +finds the specified configuration file there, it will not examine +other locations.

    -
    -
    -/some/where/dovecot.conf:
    -    auth default {
    -      mechanisms = plain login
    -      passdb pam {
    -      }
    -      userdb passwd {
    -      }
    -      socket listen {
    -        client {
    -          path = /var/spool/postfix/private/auth
    -          mode = 0660
    -          user = postfix
    -          group = postfix
    -        }
    -      }
    -    }
    -
    -

    See the Dovecot documentation for how to configure and operate -the Dovecot authentication server.

    +

    Postfix to Cyrus SASL communication

    -

    Cyrus SASL configuration for the Postfix -SMTP server

    +

    As the Postfix SMTP server is linked with the Cyrus SASL library +libsasl, communication between Postfix and Cyrus SASL +takes place by calling functions in the SASL library.

    -

    You need to configure how the Cyrus SASL library should -authenticate a remote SMTP client's username and password. These -settings must -be stored in a separate configuration file.

    +

    The SASL library may use an external password verification +service, or an internal plugin to connect to authentication backends +and verify the SMTP client's authentication data against the system +password file or other databases.

    -

    The name of the configuration file (default: smtpd.conf) will -be constructed from a value that the Postfix SMTP server sends to -the Cyrus SASL -library, which adds the suffix .conf. The value is configured using -one of the following variables:

    +

    The following table shows typical combinations discussed in +this document:

    -
    -/etc/postfix/main.cf:
    -    # Postfix 2.3 and later
    -    smtpd_sasl_path = smtpd
    -    # Postfix < 2.3
    -    smtpd_sasl_application_name = smtpd
    -
    -
    -

    Cyrus SASL searches for the configuration file in /usr/local/lib/sasl/ -(Cyrus SASL version 1.5.5) or /usr/local/lib/sasl2/ (Cyrus SASL -version 2.1.x).

    + -

    Note: some Postfix distributions are modified and look for -the smtpd.conf file in /etc/postfix/sasl.

    + -

    Note: some Cyrus SASL distributions look for the smtpd.conf -file in /etc/sasl2.

    + -
      +
    -
  • To authenticate against the UNIX password database, use:

    +
  • -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: pwcheck
    +
    - + -

    IMPORTANT: pwcheck establishes a UNIX domain socket in /var/pwcheck -and waits for authentication requests. The Postfix SMTP server must have -read+execute permission to this directory or authentication attempts -will fail.

    + -

    The pwcheck daemon is contained in the cyrus-sasl source tarball.

    + -
    (Cyrus SASL version 1.5.26) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: saslauthd
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -/usr/local/lib/sasl2/smtpd.conf:
    -    pwcheck_method: saslauthd
    -    mech_list: PLAIN LOGIN
    -
    +
    - + -

    The saslauthd daemon is also contained in the cyrus-sasl source -tarball. It is more flexible than the pwcheck daemon, in that it -can authenticate against PAM and various other sources. To use PAM, -start saslauthd with "-a pam".

    + -

    IMPORTANT: saslauthd usually establishes a UNIX domain socket -in /var/run/saslauthd and waits for authentication requests. The Postfix -SMTP server must have read+execute permission to this directory or -authentication attempts will fail.

    + -

    Note: The directory where saslauthd puts the socket is configurable. -See the command-line option "-m /path/to/socket" in the saslauthd ---help listing.

    + -
  • To authenticate against Cyrus SASL's own password database:

    +
  • -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: sasldb
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -/usr/local/lib/sasl2/smtpd.conf:
    -    pwcheck_method: auxprop
    -    auxprop_plugin: sasldb
    -    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
    -
    +
    - + -

    This will use the Cyrus SASL password file (default: /etc/sasldb in -version 1.5.x, or /etc/sasldb2 in version 2.1.x), which is maintained -with the saslpasswd or saslpasswd2 command (part of the Cyrus SASL -software). On some poorly-supported systems the saslpasswd command needs -to be run multiple times before it stops complaining. The Postfix SMTP -server needs read access to the sasldb file - you may have to play games -with group access permissions. With the OTP authentication mechanism, -the Postfix SMTP server also needs WRITE access to /etc/sasldb2 or -/etc/sasldb -(or the back end SQL database, if used).

    + -

    IMPORTANT: To get sasldb running, make sure that you set the SASL -domain (realm) to a fully qualified domain name.

    + -

    EXAMPLE:

    + -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -% saslpasswd -c -u `postconf -h myhostname` exampleuser
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -% saslpasswd2 -c -u `postconf -h myhostname` exampleuser
    -
    +
    - + -

    You can find out SASL's idea about the realms of the users -in sasldb with sasldblistusers (Cyrus SASL version 1.5.x) or -sasldblistusers2 (Cyrus SASL version 2.1.x).

    + -

    On the Postfix side, you can have only one realm per smtpd(8) -instance, and only the users belonging to that realm would be able to -authenticate. The Postfix variable smtpd_sasl_local_domain controls the -realm used by smtpd(8):

    + -
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_local_domain = $myhostname
    -
    -
    + - + -

    IMPORTANT: The Cyrus SASL password verification services pwcheck -and saslauthd can only support the plaintext mechanisms PLAIN or -LOGIN. However, the Cyrus SASL library doesn't know this, and will -happily advertise other authentication mechanisms that the SASL -library implements, such as DIGEST-MD5. As a result, if a remote SMTP -client chooses any mechanism other than PLAIN or LOGIN while pwcheck -or saslauthd are used, authentication will fail. Thus you may need -to limit the list of mechanisms advertised by the Postfix SMTP -server.

    +
    authentication backendpassword verification service / plugin
    /etc/shadowsaslauthd
    PAMsaslauthd
    IMAP serversaslauthd
    sasldbsasldb
    MySQL, PostgreSQL, SQLitesql
    LDAPldapdb
    + + -
      +
      -
    • With older Cyrus SASL versions you remove the corresponding -library files from the SASL plug-in directory (and again whenever -the system is updated).

      +Note -
    • With Cyrus SASL version 2.1.x or later the mech_list variable -can specify a list of authentication mechanisms that Cyrus SASL may -offer:

      +

      Read the Cyrus SASL documentation for other backends it can +use.

      -
      -
      -/usr/local/lib/sasl2/smtpd.conf:
      -    mech_list: plain login
      -
      -
    +

    saslauthd - Cyrus SASL password verification service

    -

    For the same reasons you might want to limit the list of plugins -used for authentication.

    +

    Communication between the Postfix SMTP server (read: Cyrus SASL's +libsasl) and the saslauthd server takes +place over a UNIX-domain socket.

    -
      +

      saslauthd usually establishes the UNIX domain +socket in /var/run/saslauthd/ and waits for authentication +requests. The Postfix SMTP server must have read+execute permission +to this directory or authentication attempts will fail.

      + +
      -
    • With Cyrus SASL version 1.5.x your only choice is to -delete the corresponding library files from the SASL plug-in -directory.

      +Important -
    • With SASL version 2.1.x:

      +

      Some distributions require the user postfix to be +member of a special group e.g. sasl, otherwise it +will not be able to access the saslauthd socket +directory.

      + +
    • + +

      The following example configures the Cyrus SASL library to +contact saslauthd as its password verification service: +

      -/usr/local/lib/sasl2/smtpd.conf:
      -    pwcheck_method: auxprop
      -    auxprop_plugin: sql
      +/etc/sasl2/smtpd.conf:
      +    pwcheck_method: saslauthd
      +    mech_list: PLAIN LOGIN
       
      -
    +
    -

    To run software chrooted with SASL support is an interesting -exercise. It probably is not worth the trouble.

    +Important -

    Testing SASL authentication in the Postfix -SMTP server

    +

    Do not specify any other mechanisms in mech_list +than PLAIN or LOGIN when using +saslauthd! It can only handle these two mechanisms, +and authentication will fail if clients are allowed to choose other +mechanisms.

    -

    To test the server side, connect (for example, with telnet) to the -Postfix SMTP server port and you should -be able to have a conversation as shown below. Information sent by the -client (that is, you) is shown in bold font.

    +
    -
    -$ telnet server.example.com 25
    -. . .
    -220 server.example.com ESMTP Postfix
    -EHLO client.example.com
    -250-server.example.com
    -250-PIPELINING
    -250-SIZE 10240000
    -250-ETRN
    -250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    -250 8BITMIME
    -AUTH PLAIN AHRlc3QAdGVzdHBhc3M=
    -235 Authentication successful
    -
    -
    -

    Instead of AHRlc3QAdGVzdHBhc3M=, specify the base64 encoded -form of \0username\0password (the \0 is a null byte). The -example above is for a user named `test' with password `testpass'. -

    +Important -

    In order to generate base64 encoded authentication information -you can use one of the following commands:

    +

    Plaintext mechanisms (PLAIN, LOGIN) +send credentials unencrypted. This information should be protected +by an additional security layer such as a TLS-encrypted SMTP session +(see: TLS_README).

    -
    -
    -% printf '\0username\0password' | mmencode 
    -
    +

    Additionally the saslauthd server itself must be +configured. It must be told which authentication backend to turn +to for password verification. The backend is choosen as a command +line option when saslauthd is started and will be shown +in the following examples.

    +
    -
    -% perl -MMIME::Base64 -e \
    -    'print encode_base64("\0username\0password");'
    -
    + +Note + +

    Some distributions use a configuration file to provide saslauthd +command line options to set e.g. the authentication backend. Typical +locations are /etc/sysconfig/saslauthd or +/etc/default/saslauthd.

    +
    -

    The mmencode command is part of the metamail software. -MIME::Base64 is available from http://www.cpan.org/.

    +

    Using saslauthd with /etc/shadow

    -

    Caution: when posting logs of the SASL negotiations to public -lists, -please keep in mind that username/password information is trivial -to recover from the base64-encoded form.

    +

    Access to the /etc/shadow system password file +requires root privileges. The Postfix SMTP server +(and in consequence libsasl linked to the server) runs +with the least privilege possible. Direct access to +/etc/shadow would not be possible without breaking the +Postfix security architecture.

    -

    Trouble shooting the SASL internals

    +

    The saslauthd socket builds a safe bridge. Postfix, +running as limited user postfix, can access the +UNIX-domain socket that saslauthd receives commands +on; saslauthd, running as privileged user root, +has the privileges required to access the shadow file.

    -

    In the Cyrus SASL sources you'll find a subdirectory named -"sample". Run make there, then create a symbolic link from sample.conf -to smtpd.conf in your Cyrus SASL library directory /usr/local/lib/sasl2. -"su" to the user postfix (or whatever your mail_owner -directive is set to):

    +

    The saslauthd server verifies passwords against the +authentication backend /etc/shadow if started like this:

    -% su postfix
    +% saslauthd -a shadow
     
    -

    then run the resulting sample Cyrus SASL server and client in -separate terminals. The sample applications send log messages to -the syslog -facility auth. Check the log to fix the problem or run strace / -ktrace / truss on the server to see what makes it unhappy. Repeat -the previous step until you can successfully authenticate with the -sample Cyrus SASL client. Only then get back to Postfix.

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -

    Enabling SASL authentication in the -Postfix SMTP client

    +

    Using saslauthd with PAM

    -

    Turn on client-side SASL authentication, and specify a table -with per-host or per-destination username and password information. -The Postfix SMTP client first searches the table for an entry with -the remote SMTP server hostname; if no entry is found, then the -Postfix SMTP client searches the table for -an entry with the next-hop destination. Usually, that is the -right-hand part of an email address, but it can also be the information -that is specified with the relayhost parameter or with a transport(5) -table.

    +

    Cyrus SASL can use the PAM framework to authenticate credentials. +saslauthd uses the PAM framework when started like +this:

    -/etc/postfix/main.cf:
    -    smtp_sasl_auth_enable = yes
    -    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    -    smtp_sasl_type = cyrus
    -    relayhost = [mail.myisp.net]
    -    # Alternative form:
    -    # relayhost = [mail.myisp.net]:submission
    -
    -/etc/postfix/sasl_passwd:
    -    [mail.myisp.net]            username:password
    -    [mail.myisp.net]:submission username:password
    +% saslauthd -a pam
     
    -

    Notes:

    - -
      +
      -
    • The "submission" destination port tells Postfix to send -mail via TCP network port 587, which is normally reserved for email -clients. The default is to send mail to the "smtp" destination port -(TCP port 25), which is used for receiving mail across the internet. -If you use an explicit destination port in main.cf, then you must -use the same form also in the smtp_sasl_password_maps file.

      - -
    • Postfix does not deliver mail via TCP port 465 (the obsolete -"wrappermode" protocol). See TLS_README for a solution that uses the -"stunnel" command.

      - -
    • The "[" and "]" prevent Postfix from looking up the MX -(mail exchanger) records for the enclosed name. If you use this -form in main.cf, then you must use the same form also in the -smtp_sasl_password_maps file.

      - -
    • The Postfix SMTP client opens the SASL client password -file before entering the optional chroot jail, so you can keep the -file in /etc/postfix and set permissions read / write only for root -to keep the username:password combinations away from other system -users.

      - -
    • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

      +Note -
    • Execute the command "postmap /etc/postfix/sasl_passwd" -whenever you change the sasl_passwd table.

      +

      PAM configuration for the Postfix SMTP server is usually given +in /etc/pam.d/smtp and is beyond the scope of this +document.

      -
    + -

    Workarounds:

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -
      +

      Using saslauthd with an IMAP server

      -
    • Some remote SMTP servers support PLAIN or LOGIN authentication only. -By default, the Postfix SMTP client does not use authentication -methods that send plaintext passwords, and defers delivery with -the following error message: "Authentication failed: cannot SASL -authenticate to server". To enable plaintext authentication specify, -for example:

      +

      saslauthd can verify the SMTP client credentials +by using them to log into an IMAP server. If the login succeeds, +SASL authentication also succeeds. saslauthd contacts +an IMAP server when started like this:

      -/etc/postfix/main.cf:
      -    smtp_sasl_security_options = noanonymous
      +% saslauthd -a rimap -O imap.example.com
       
      -
    • Some remote SMTP servers announce authentication mechanisms -that don't actually work. It is possible via the smtp_sasl_mechanism_filter -parameter to restrict the list of server mechanisms that the Postfix -SMTP client will take into consideration:

      -
      -
      -/etc/postfix/main.cf:
      -    smtp_sasl_mechanism_filter = !gssapi, !external, static:all
      -
      + +Note + +

      The option "-O imap.example.com" specifies the +IMAP server saslauthd should contact when it verifies +credentials.

      +
      -

      In the above example, the Postfix SMTP client will decline to -use mechanisms -that require special infrastructure such as Kerberos or TLS.

      +
      -
    • The Postfix SMTP client is backwards compatible with SMTP -servers that use the non-standard "AUTH=method..." syntax in response -to the EHLO command; there is no Postfix client configuration needed -to work around it.

      +Important -
    +

    saslauthd sends IMAP login information unencrypted. +Any IMAP session leaving the local host should be protected by an +additional security layer such as an SSL tunnel.

    -

    Supporting multiple ISP accounts -in the Postfix SMTP client

    + -

    Postfix version 2.3 supports multiple ISP accounts. This can -be useful when one person uses the same machine for work and for -personal use, or when people with different ISP accounts share the -same Postfix server. To make this possible, Postfix 2.3 supports -per-sender SASL passwords and per-sender relay hosts. In the example -below, Postfix will search the SASL password file by sender before -it searches that same file by destination. Likewise, Postfix will -search the per-sender relayhost file, and use the default relayhost -only as a final resort.

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -
    -
    -/etc/postfix/main.cf:
    -    smtp_sender_dependent_authentication = yes
    -    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
    -    smtp_sasl_auth_enable = yes
    -    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    -    relayhost = [mail.myisp.net]
    -    # Alternative form:
    -    # relayhost = [mail.myisp.net]:submission
    +

    Testing saslauthd authentication

    -/etc/postfix/sasl_passwd: - # Per-sender authentication; see also /etc/postfix/sender_relay. - user1@example.com username2:password2 - user2@example.net username2:password2 - # Login information for the default relayhost. - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password +

    Cyrus SASL provides the testsaslauthd utility to +test saslauthd authentication. The username and password +are given as command line arguments. The example shows the response +when authentication is successful:

    -/etc/postfix/sender_relay: - # Per-sender provider; see also /etc/postfix/sasl_passwd. - user1@example.com [mail.example.com]:submission - user2@example.net [mail.example.net] +
    +
    +% testsaslauthd -u username -p password
    +0: OK "Success."
     
    -

    Notes:

    +
    -
      +Note -
    • If you are creative, then you can try to combine the two -tables into one single MySQL database, and configure different -Postfix queries to extract the appropriate information.

      +

      Sometimes the testsaslauthd program is not distributed +with a the Cyrus SASL main package. In that case, it may be +distributed with -devel, -dev or -debug packages.

      -
    • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

      +
    -
  • Execute the command "postmap /etc/postfix/sasl_passwd" -whenever you change the sasl_passwd table.

    +

    Specify an additional "-s smtp" if saslauthd +was configured to contact the PAM authentication framework and an +additional "-f /path/to/socketdir/mux" if +saslauthd establishes the UNIX-domain socket in a +non-default location.

    -
  • Execute the command "postmap /etc/postfix/sender_relay" -whenever you change the sender_relay table.

    +

    If authentication succeeds, proceed with the section "Enabling SASL authentication and authorization +in the Postfix SMTP server".

    - +

    Cyrus SASL Plugins - auxiliary property +plugins

    -

    Credits

    +

    Cyrus SASL uses a plugin infrastructure (called auxprop) +to expand libsasl's capabilities. Currently Cyrus +SASL sources provide three authentication plugins.

    -
      +
      -
    • Postfix SASL support was originally implemented by Till Franke -of SuSE Rhein/Main AG. +
      -
    • Wietse trimmed down the code to only the bare necessities. +
      sasldb
      -
    • Support for Cyrus SASL version 2 was contributed by Jason Hoos. +

      Accounts are stored stored in a Cyrus SASL Berkeley DB +database

      -
    • Liviu Daia added smtpd_sasl_application_name, split -reject_sender_login_mismatch into -reject_authenticated_sender_login_mismatch and -reject_unauthenticated_sender_login_mismatch, and revised the docs. +
      sql
      -
    • Wietse made another iteration through the code to add plug-in -support for multiple SASL implementations, and changed -smtpd_sasl_application_name into smtpd_sasl_path. +

      Accounts are stored in a SQL database

      -
    • The Dovecot SMTP server-only plug-in was originally implemented by -Timo Sirainen of Procontrol, Finland. +
      ldapdb
      -
    • Patrick Ben Koetter revised this document for Postfix 2.4 and -made much needed updates. +

      Accounts are stored stored in an LDAP database

      -
    + - +
  • + +
    + +Important + +

    These three plugins support shared-secret mechanisms i.e. +CRAM-MD5, DIGEST-MD5 and NTLM. These mechanisms send credentials +encrypted but their verification process requires the password to +be available in plaintext. Consequently passwords cannot (!) be +stored in encrypted form.

    + +
    + +

    The sasldb plugin

    + +

    The sasldb auxprop plugin authenticates credentials stored in a Berkeley +DB database. The database schema is specific to Cyrus SASL. The +database is usually located at /etc/sasldb2.

    + +
    + +Note + +

    The sasldb2 file contains passwords in +plaintext, and should have read+write access only to user +postfix or a group that postfix is member +of.

    + +
    + +

    The saslpasswd2 command-line utility creates +and maintains the database:

    + +
    +
    +% saslpasswd2 -c -u example.com username
    +Password:
    +Again (for verification):
    +
    +
    + +

    This command creates an account +username@example.com.

    + +
    + +Important + +

    users must specify username@example.com +as login name, not username.

    + +
    + +

    Run the following command to reuse the Postfix mydomain +parameter value as the login domain:

    + +
    +
    +% saslpasswd2 -c -u `postconf -h mydomain` username
    +Password:
    +Again (for verification):
    +
    +
    + +
    + +Note + +

    Run saslpasswd2 without any options for further +help on how to use the command.

    + +
    + +

    The sasldblistusers2 command lists all existing +users in the sasldb database:

    + +
    +
    +% sasldblistusers2
    +username1@example.com: password1
    +username2@example.com: password2
    +
    +
    + +

    Configure libsasl to use sasldb with the following instructions:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: sasldb
    +    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
    +
    +
    + +
    + +Note + +

    In the above example adjust mech_list to the +mechanisms that are applicable for your environment.

    + +
    + +

    The sql plugin

    + +

    The sql auxprop plugin is a generic SQL plugin. It provides +access to credentials stored in a MySQL, a PostgreSQL or a SQLite +database.

    + +
    + +Note + +

    The shared-secret mechanisms (CRAM-MD5, etc.) require that the +SASL client passwords are stored as plaintext.

    + +
    + +
    + +Tip + + + +

    Use "saslauthd > pam > (pam database module)" to +verify encrypted passwords in an SQL database.

    + +
    + +

    The following example configures libsasl to use the sql plugin and connects +it to a PostgreSQL server:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: sql
    +    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
    +    sql_engine: pgsql
    +    sql_hostnames: 127.0.0.1, 192.0.2.1 sql_user: username
    +    sql_passwd: secret
    +    sql_database: dbname
    +    sql_select: SELECT password FROM users WHERE user = '%u'@'%r'
    +
    +
    + +
    + +Note + +

    Set appropriate permissions if smtpd.conf contains +a password. The file should be readable by the postfix +user.

    + +
    + +
    + +Note + +

    In the above example, adjust mech_list to the +mechanisms that are applicable for your environment.

    + +
    + +

    The sql plugin has the following configuration options:

    + +
    + +
    + +
    sql_engine
    + +
    + +

    Specify mysql to connect to a MySQL server, +pgsql for a PostgreSQL server or sqlite +for an SQLite database

    + +
    + +
    sql_hostnames
    + +
    + +

    Specify one or more servers (hostname or hostname:port) separated +by commas.

    + +
    + +Note + +

    With MySQL servers, specify localhost to connect +over a UNIX-domain socket, and specify 127.0.0.1 to +connect over a TCP socket.

    + +
    + +
    + +
    sql_user
    + +
    + +

    The login name to gain access to the database.

    + +
    + +
    sql_passwd
    + +
    + +

    The password to gain access to the database.

    + +
    + +
    sql_database
    + +
    + +

    The name of the database to connect to.

    + +
    + +
    sql_select
    + +
    + +

    The SELECT statement that should retrieve the plaintext password +from a database table.

    + +
    + +Important + +

    Do not enclose the statement in quotes! Use single quotes to +escape macros!

    + +
    + +
    + +
    + +
    + +

    The sql plugin provides macros to build sql_select +statements. They will be replaced with arguments sent from the client. The +following macros are available:

    + +
    + +
    + +
    %u
    + +
    + +

    The name of the user whose properties are being selected.

    + +
    + +
    %p
    + +
    + +

    The name of the property being selected. While this could technically be +anything, Cyrus SASL will try userPassword and cmusaslsecretMECHNAME (where +MECHNAME is the name of a SASL mechanism).

    + +
    + +
    %r
    + +
    + +

    The name of the realm to which the user belongs. This could be +the KERBEROS realm, the fully-qualified domain name of the computer +the SASL application is running on, or the domain after the "@" in a +username.

    + +
    + +
    + +
    + +

    The ldapdb plugin

    + +

    The ldapdb auxprop plugin provides access to credentials stored +in an OpenLDAP LDAP server. It is the only plugin that implements +proxy authorization.

    + +

    Proxy authorization in this context means: The ldapdb plugin +must SASL authenticate with the OpenLDAP server. The server then +decides if the ldapdb plugin should be authorized to read the +authenticating user's password. Once the ldapdb plugin has gone +through proxy authorization it may proceed and authenticate the +remote SMTP client's credentials.

    + +

    In a nutshell: Configuring ldapdb means authentication and +authorization must be configured twice - once in the Postfix SMTP +server to authenticate and authorize the remote SMTP client, and +once in the OpenLDAP slapd server to authenticate and +authorize the ldapdb plugin.

    + +

    This example configures libsasl to use the ldapdb plugin and +the plugin to connect to an OpenLDAP server:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: ldapdb
    +    mech_list: PLAIN LOGIN NTLM CRAM-MD5 DIGEST-MD5
    +    ldapdb_uri: ldap://localhost
    +    ldapdb_id: proxyuser
    +    ldapdb_pw: password
    +    ldapdb_mech: DIGEST-MD5
    +
    +
    + +
    + +Important + +

    Set appropriate permissions if smtpd.conf contains a +password. The file should be readable by the postfix +user.

    + +
    + +
    + +Note + +

    The shared-secret mechanisms (CRAM-MD5, etc.) require that the +SASL client passwords are stored as plaintext.

    + +
    + +

    The following is a summary of applicable smtpd.conf +file entries:

    + +
    + +
    + +
    auxprop_plugin
    + +

    Specify ldapdb to enable the plugin.

    + +
    ldapdb_uri
    + +

    Specify either ldapi:// for to connect over +a UNIX-domain socket, ldap:// for an unencrypted TCP +connection or ldaps:// for an encrypted TCP connection. +

    + +
    ldapdb_id
    + +

    The login name to authenticate the ldapdb plugin to the +LDAP server (proxy authorization).

    + +
    ldapdb_pw
    + +

    The password (in plaintext) to authenticate the ldapdb +plugin to the LDAP server (proxy authorization).

    + +
    ldapdb_mech
    + +

    The mechanism to authenticate the ldapdb plugin to the +OpenLDAP slapd server.

    + +
    + +Note + +

    Specify a mechanism here that is supported by the OpenLDAP slapd +server.

    + +
    + +
    + +
    ldapdb_rc (optional)
    + +

    The path to a file containing individual configuration +options for the ldapdb LDAP client (libldap). This allows to specify +a TLS client certificate which in turn can be used to use the SASL +EXTERNAL mechanism.

    + +
    + +Note + +

    This mechanism supports authentication over an encrypted transport +layer, which is recommended if the plugin must connect to an OpenLDAP +server on a remote machine.

    + +
    + +
    + +
    ldapdb_starttls (optional)
    + +

    The TLS policy for connecting to the LDAP server. Specify +either try or demand. If the option is +try the plugin will attempt to establish a TLS-encrypted +connection with the LDAP server, and will fallback to an unencrypted +connection if TLS fails. If the policy is demand and +a TLS-encrypted connection cannot be established, the connection +fails immediately.

    + +
    + +
    + +

    When the ldapdb plugin connects to the OpenLDAP server and +successfully authenticates, the OpenLDAP server decides if the +plugin user is authorized to read SASL account information.

    + +

    The following configuration gives an example of authorization configuration +in the OpenLDAP slapd server:

    + +
    +
    +/etc/openldap/slapd.conf:
    +    authz-regexp
    +    uid=(.*),cn=.*,cn=auth
    +    ldap:///dc=example,dc=com??sub?cn=$1
    +    authz-policy to
    +
    +
    + +

    Here, the authz-regexp option serves for authentication +of the ldapdb user. It maps its login name to a DN in the LDAP +directory tree where slapd can look up the SASL account +information. The authz-policy options defines the +authentication policy. In this case it grants authentication +privileges "to" the ldapdb plugin.

    + +

    The last configuration step is to tell the OpenLDAP slapd +server where ldapdb may search for usernames matching the one given +by the mail client. The example below adds an additional attribute +ldapdb user object (here: authzTo because the authz-policy +is "to") and configures the scope where the login name +"proxyuser" may search:

    + +
    +
    +dn: cn=proxyuser,dc=example,dc=com
    +changetype: modify
    +add: authzTo
    +authzTo: dn.regex:uniqueIdentifier=(.*),ou=people,dc=example,dc=com
    +
    +
    + +

    Use the ldapmodify or ldapadd command +to add the above attribute.

    + +
    + +Note + +

    Read the chapter "Using SASL" in the OpenLDAP Admin Guide +for more detailed instructions to set up SASL authentication in +OpenLDAP.

    + +
    + +

    Enabling SASL authentication and +authorization in the Postfix SMTP server

    + +

    By default the Postfix SMTP server uses the Cyrus SASL +implementation. If the Dovecot SASL implementation should be used, +specify an smtpd_sasl_type value of dovecot +instead of cyrus:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_type = dovecot
    +
    +
    + +

    Additionally set the path where the Postfix SMTP server can +find the Dovecot SASL socket:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_path = private/auth
    +
    +
    + +
    + +Note + +

    This example uses a pathname relative to the Postfix queue +directory, so that it will work whether or not the Postfix SMTP +server runs chrooted.

    + +
    + +

    Enabling SASL authentication +in the Postfix SMTP server

    + +

    Regardless of the SASL implementation type, enabling SMTP +authentication in the Postfix SMTP server always requires seting +the smtpd_sasl_auth_enable option:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_auth_enable = yes
    +
    +
    + +

    After a "postfix reload", SMTP clients will see the additional +capability AUTH in an SMTP session, followed by a list of +authentication mechanisms the server supports:

    + +
    +
    +% telnet server.example.com 25
    +...
    +220 server.example.com ESMTP Postfix
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +...
    +
    +
    + +

    However not all clients recognize the AUTH capability as defined +by the SASL authentication RFC. Some historical implementations expect the +server to send an "=" as separator between the AUTH +verb and the list of mechanisms that follows it.

    + +

    The broken_sasl_auth_clients configuration option +lets Postfix repeat the AUTH statement in a form that these broken +clients understand:

    + +
    +
    +/etc/postfix/main.cf:
    +    broken_sasl_auth_clients = yes
    +
    +
    + +
    + +Note + +

    Enable this option for Outlook up to and including version 2003 +and Outlook Express up to version 6. This option does not hurt other +clients.

    + +
    + +

    After "postfix reload", the Postfix SMTP server will propagate +the AUTH capability twice - once for compliant and once for broken +clients:

    + +
    +
    +% telnet server.example.com 25
    +...
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +250-AUTH=DIGEST-MD5 PLAIN CRAM-MD5
    +...
    +
    +
    + +

    Postfix SMTP Server +Authentication Policy

    + +

    The Postfix SMTP server provides a way to specify the properties +of SASL mechanisms that can be made available to the remote SMTP +client.

    + +

    Unencrypted SMTP session

    + +

    The default policy is to allow any mechanism in the Postfix SMTP server +except for those based on anonymous authentication:

    + +
    +
    +/etc/postfix/main.cf:
    +    # Specify a list of properties separated by comma or whitespace
    +    smtpd_sasl_security_options = noanonymous
    +
    +
    + +
    + +Important + +

    Always set at least the noanonymous option. +Otherwise, the Postfix SMTP server can give strangers the same +authorization as a properly-authenticated client.

    + +
    + +

    Postfix can enforce the following policies on SASL authentication +mechanisms:

    + +
    + +
    + +
    noanonymous
    + +

    Don't use mechanisms that permit anonymous authentication. +

    + +
    noplaintext
    + +

    Don't use mechanisms that transmit unencrypted username +and password information.

    + +
    nodictionary
    + +

    Don't use mechanisms that are vulnerable to dictionary +attacks.

    + +
    + +
    forward_secrecy
    + +

    Use only mechanisms that support forward secrecy (Dovecot +SASL only).

    + +
    + +
    mutual_auth
    + +

    Use only mechanisms that authenticate both the client and +the server to each other.

    + +
    + +
    + +

    Encrypted SMTP session (TLS)

    + +

    A separate parameter controls Postfix SASL mechanism policy +during a TLS-encrypted SMTP session. The default is to copy the +settings from the unencrypted session:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
    +
    +
    + +

    A more sophisticated policy allows plaintext mechanisms, but +only over a TLS-encrypted connection:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_security_options = noanonymous, noplaintext
    +    smtpd_sasl_tls_security_options = noanonymous
    +
    +
    + +

    To offer SASL authentication only after a TLS-encrypted session has been +established specify this:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_tls_auth_only = yes
    +
    +
    + +

    Enabling SASL authorization in the Postfix +SMTP server

    + +

    After the client has authenticated with SASL, the Postfix SMTP +server decides what the remote SMTP client will be authorized +for. Examples of possible SMTP clients authorizations are:

    + +
      + +
    • Send a message to a remote recipient.

    • + +
    • Use a specific envelope sender in the MAIL FROM command.

    • + +
    + +

    These permissions are not enabled by default.

    + +

    Mail relay authorization

    + +

    The permit_sasl_authenticated restriction allows +SASL-authenticated SMTP clients to send mail to remote destinations. +Add it to the list of smtpd_recipient_restrictions as +follows:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_recipient_restrictions =
    +    ...
    +    permit_mynetworks
    +    permit_sasl_authenticated
    +    reject_unauth_destination
    +    ...
    +
    +
    + +

    Envelope sender address authorization

    + +

    By default an SMTP client may specify any envelope sender address +in the MAIL FROM command. That is because the Postfix SMTP server +only knows the remte SMTP client hostname and IP address, but not +the user who controls the remote SMTP client.

    + +

    This changes the moment an SMTP client uses SASL authentication. +Now, the Postfix SMTP server knows who the sender is. Given a table +of envelope sender addresses and SASL login names, the Postfix SMTP +server can decide if the SASL authenticated client is allowed to +use a particular envelope sender address:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sender_login_maps = hash:/etc/postfix/controlled_envelope_senders
    +
    +    smtpd_recipient_restrictions =
    +        ...
    +        reject_sender_login_mismatch
    +        permit_sasl_authenticated
    +        permit_mynetworks
    +        reject_unauth_destination
    +        ...
    +
    +
    + +

    The controlled_envelope_senders table specifies +the binding between the sender envelope addresses and its their +SASL login names:

    + +
    +
    +/etc/postfix/controlled_envelope_senders
    +    # envelope sender           owners (SASL login names)
    +    john@example.com            john@example.com
    +    helpdesk@example.com        john@example.com, mary@example.com
    +    postmaster                  admin@example.com
    +    @example.net                barney, fred, john@example.com, mary@example.com
    +
    +
    + +

    With this, the reject_sender_login_mismatch +restriction above will reject the sender address in the MAIL FROM +command if smtpd_sender_login_maps does not specify +the SMTP client's login name as an owner of that address.

    + +

    See also reject_authenticated_sender_login_mismatch and +reject_unauthenticated_sender_login_mismatch for additional +control over the SASL login name and the envelope sender.

    + +

    Additional SMTP Server SASL options

    + +

    Postfix provides a wide range of SASL authentication configuration +options. The next section lists a few that are discussed frequently. +See postconf(5) for a complete list.

    + +

    Default authentication domain

    + +

    Postfix can append a domain name (or any other string) to a +SASL login name that does not have a domain part, e.g. "john" +instead of "john@example.com":

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_local_domain = example.com
    +
    +
    + +

    This is useful as a default setting and safety net for misconfigured +clients, or during a migration to an authentication method/backend +that requires an authentication REALM or domain name, before all +SMTP clients are configured to send such information.

    + +

    Hiding SASL authentication from clients or +networks

    + +

    Some clients insist on using SASL authentication if it is offered, even +when they are not configured to send credentials - and therefore +they will always fail and disconnect.

    + +

    Postfix can hide the AUTH capability from these clients/networks:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_exceptions_networks = !192.0.2.171/32, 192.0.2.0/24
    +
    +
    + +

    Adding the SASL login name to mail headers

    + +

    To report SASL login names in Received: message headers (Postfix +version 2.3 and later):

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_authenticated_header = yes
    +
    +
    + +
    + +Note + +

    The SASL login names will be shared with the entire world.

    + +
    + +

    Testing SASL authentication in the Postfix SMTP Server

    + +

    To test the server side, connect (for example, with +telnet) to the Postfix SMTP server port and you should +be able to have a conversation as shown below. Information sent by +the client (that is, you) is shown in bold font.

    + +
    +
    +% telnet server.example.com 25
    +...
    +220 server.example.com ESMTP Postfix
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-ETRN
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +250 8BITMIME
    +AUTH PLAIN AHRlc3QAdGVzdHBhc3M=
    +235 Authentication successful
    +
    +
    + +

    Instead of AHRlc3QAdGVzdHBhc3M=, specify the +base64-encoded form of \0username\0password (the \0 +is a null byte). The example above is for a user named `test' +with password `testpass'.

    +
    + +Caution + +

    When posting logs of the SASL negotiations to public lists, +please keep in mind that username/password information is trivial +to recover from the base64-encoded form.

    + +
    + +

    You can use one of the following commands to generate base64 +encoded authentication information:

    + +
    +
    +% gen-auth plain
    +username: username
    +password:
    +
    +
    + +

    The gen-auth Perl script was written by John +Jetmore and can be found at http://jetmore.org/john/code/gen-auth.

    + +
    +
    +% printf '\0username\0password' | mmencode
    +
    +
    + +

    The mmencode command is part of the metamail +software.

    + +
    +
    +% perl -MMIME::Base64 -e \
    +    'print encode_base64("\0username\0password");'
    +
    +
    + +

    MIME::Base64 is available from http://www.cpan.org/.

    + +

    Configuring SASL authentication in the Postfix SMTP/LMTP client

    + +

    The Postfix SMTP and the LMTP client can authenticate with a +remote SMTP server via the Cyrus SASL framework. At this time, the +Dovecot SASL implementation does not provide client functionality. +

    + +
    + +Note + +

    The examples in this section discuss only the SMTP client. +Replace smtp_ with lmtp_ to get the +corresponding LMTP client configuration.

    + +
    + +

    You can read more about the following topics:

    + + + +

    Enabling SASL authentication in the +Postfix SMTP/LMTP client

    + +

    This section shows a typical scenario where the Postfix SMTP +client sends all messages via a mail gateway server that requires +SASL authentication. To make the example more readable we introduce +it in two parts.

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_auth_enable = yes
    +    relayhost = [mail.isp.example]
    +    # Alternative form:
    +    # relayhost = [mail.isp.example]:submission
    +    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    +
    +
    + +
      + +
    • The smtp_sasl_auth_enable setting enables +client-side authentication. We will configure the client's username +and password information in the second part of the example.

      +
    • + +
    • The relayhost setting forces the Postfix SMTP +to send all remote messages to the specified mail server instead +of trying to deliver them directly to their destination.

    • + +
    • In the relayhost setting, the "[" +and "]" prevent the Postfix SMTP client from looking +up MX (mail exchanger) records for the enclosed name.

    • + +
    • The relayhost destination may also specify a +non-default TCP port. For example, the alternative form +[mail.isp.example]:submission tells Postfix to connect +to TCP network port 587, which is reserved for email client +applications.

    • + +
    • The Postfix SMTP client is compatible with SMTP servers +that use the non-standard "AUTH=method...." +syntax in response to the EHLO command; this requires no additional +Postfix client configuration.

    • + +
    • The Postfix SMTP client does not support the obsolete +"wrappermode" protocol, which uses TCP port 465 on the +SMTP server. See TLS_README for a solution that uses the +stunnel command.

    • + +
    • With the smtp_sasl_password_maps parameter, +we configure the Postfix SMTP client to send username and password +information to the mail gateway server. As discussed in the next +section, the Postfix SMTP client supports multiple ISP accounts. +For this reason the username and password are stored in a table +that contains one username/password combination for each mail gateway +server.

      + +
    + +
    +
    +/etc/postfix/sasl_passwd:
    +    # destination                   credentials
    +    [mail.isp.example]              username:password
    +    # Alternative form:
    +    # [mail.isp.example]:submission username:password
    +
    +
    + +
    + +Important + +

    Keep the SASL client password file in /etc/postfix, +and make the file read+write only for root to protect +the username/password combinations against other users. The Postfix +SMTP client will still be able to read the SASL client passwords. +It opens the file as user root before it drops privileges, +and before entering an optional chroot jail.

    + +
    + +
      + +
    • Use the postmap command whenever you +change the /etc/postfix/sasl_passwd file.

    • + +
    • If you specify the "[" and "]" +in the relayhost destination, then you must use the +same form in the smtp_sasl_password_maps file.

      +
    • + +
    • If you specify a non-default TCP Port (such as +":submission" or ":587") in the +relayhost destination, then you must use the same form +in the smtp_sasl_password_maps file.

    • + +
    + +

    Configuring Sender-Dependent SASL +authentication

    + +

    Postfix supports different ISP accounts for different sender +addresses (version 2.3 and later). This can be useful when one +person uses the same machine for work and for personal use, or when +people with different ISP accounts share the same Postfix server. +

    + +

    To make this possible, Postfix supports per-sender SASL passwords +and per-sender relay hosts. In the example below, the Postfix SMTP +client will search the SASL password file by sender address before +it searches that same file by destination. Likewise, the Postfix +trivial-rewrite(8) daemon will search the per-sender relayhost file, +and use the default relayhost setting only as a final +resort.

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sender_dependent_authentication = yes
    +    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
    +    smtp_sasl_auth_enable = yes
    +    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    +    relayhost = [mail.isp.example]
    +    # Alternative form:
    +    # relayhost = [mail.isp.example]:submission
    +
    +
    + +
    +
    +/etc/postfix/sasl_passwd:
    +    # Per-sender authentication; see also /etc/postfix/sender_relay.
    +    user1@example.com               username2:password2
    +    user2@example.net               username2:password2
    +    # Login information for the default relayhost.
    +    [mail.isp.example]              username:password
    +    # Alternative form:
    +    # [mail.isp.example]:submission username:password
    +
    +
    + +
    +
    +/etc/postfix/sender_relay:
    +    # Per-sender provider; see also /etc/postfix/sasl_passwd.
    +    user1@example.com               [mail.example.com]:submission
    +    user2@example.net               [mail.example.net]
    +
    +
    + +
      + +
    • If you are creative, then you can try to combine the two +tables into one single MySQL database, and configure different +Postfix queries to extract the appropriate information.

      + +
    • Specify dbm instead of hash if your system uses dbm files +instead of db files. To find out what lookup tables Postfix supports, +use the command "postconf -m".

      + +
    • Execute the command "postmap /etc/postfix/sasl_passwd" +whenever you change the sasl_passwd table.

      + +
    • Execute the command "postmap /etc/postfix/sender_relay" +whenever you change the sender_relay table.

      + +
    + +

    Postfix SMTP/LMTP client authentication +policy

    + +

    Just like the Postfix SMTP server, the SMTP client has a policy +that determines which SASL mechanisms are acceptable and which are +not.

    + +

    Unencrypted SMTP session

    + +

    The default policy is stricter than that of the Postfix SMTP +server - plaintext mechanisms are not allowed (nor is any anonymous +mechanism):

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_security_options = noplaintext, noanonymous
    +
    +
    + +

    Postfix can enforce the following policies on SASL authentication +mechanisms:

    + +
    + +
    + +
    noanonymous
    + +

    Don't use mechanisms that permit anonymous authentication. +

    + +
    noplaintext
    + +

    Don't use mechanisms that transmit unencrypted username +and password information.

    + +
    nodictionary
    + +

    Don't use mechanisms that are vulnerable to dictionary +attacks.

    + +
    + +
    +
    mutual_auth
    + +

    Use only mechanisms that authenticate both the client and +the server to each other.

    + +
    + +
    + +

    With the default policy shown above, the Postfix SMTP client +will not send its password over an unencrypted connection. This +sometimes leads to authentication failures if the remote server +only offers plaintext authentication mechanisms. In such cases the +SMTP client will log the following error message:

    + +
    +
    +SASL authentication failure: No worthy mechs found
    +
    +
    + +

    The less secure approach to deal with this is to lower the +security standards and permit plaintext authentication mechanisms: +

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_security_options = noanonymous
    +
    +
    + +

    Needless to say, sending a username and password over an insecure +channel is undesirable.

    + +

    If the remote server supports TLS, you can protect the plaintext +username and password by turning on TLS in the Postfix SMTP client +(see: TLS_README), and configuring the client as discussed next. + +

    Encrypted SMTP session (TLS)

    + +

    A separate parameter controls Postfix SASL mechanism policy +during a TLS-encrypted SMTP session. The default is to copy the +settings from the unencrypted session:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_tls_security_options = $smtp_sasl_security_options
    +
    +
    + +

    A more sophisticated policy allows plaintext mechanisms, but +only over a TLS-encrypted connection:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_security_options = noanonymous, noplaintext
    +    smtpd_sasl_tls_security_options = noanonymous
    +
    +
    + +

    Filtering server mechanism names in +the Postfix SMTP/LMTP client

    + +

    Cyrus SASL always attempts to use the most secure authentication +mechanism that the remote SMTP server offers - even if the client +side was not configured to handle it! In such cases authentication +will definitely fail.

    + +

    To prevent this, the Postfix SMTP client can filter the list +of authentication mechanism names from the remote SMTP server. Used +correctly, the filter hides unwanted mechanisms from the Cyrus SASL +library, forcing the library to choose from the mechanisms the +Postfix filter passes through.

    + +

    The following example filters out everything but the mechanisms +PLAIN and LOGIN:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_mechanism_filter = plain, login
    +
    +
    + +
    + +Note + +

    If the remote server does not offer any of the mechanisms on +the filter list, authentication will fail.

    + +
    + +

    We close this section with an example that passes every mechanism +except for GSSAPI and LOGIN:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_mechanism_filter = !gssapi, !login, static:all
    +
    +
    + +

    Building Postfix with SASL support

    + +

    As mentioned elsewhere, Postfix supports two SASL implementations: +Cyrus SASL (SMTP client and server) and Dovecot SASL (SMTP server +only). Both implementations can be built into Postfix simultaneously. +

    + + + +

    Building Dovecot SASL support

    + +

    These instructions assume that you build Postfix from source +code as described in the INSTALL document. Some modification may +be required if you build Postfix from a vendor-specific source +package.

    + +

    Support for the Dovecot version 1 SASL protocol is available +in Postfix 2.3 and later. At the time of writing, only server-side +SASL support is available, so you can't use it to authenticate the +Postfix SMTP client to your network provider's server.

    + +

    Dovecot uses its own daemon process for authentication. This +keeps the Postfix build process simple, because there is no need +to link extra libraries into Postfix.

    + +

    To generate the necessary Makefiles, execute the following in +the Postfix top-level directory:

    + +
    +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS='-DUSE_SASL_AUTH \
    +    -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
    +
    +
    + +

    After this, proceed with "make" as described in +the INSTALL document.

    + +Note + +
      + +
    • + +

      The -DDEF_SERVER_SASL_TYPE=\"dovecot\" is not +necessary; it just makes Postfix configuration a little more +convenient because you don't have to specify the SASL plug-in type +in the Postfix main.cf file (but this may cause surprises when you +switch to a later Postfix version that is built with the default +SASL type of sasl).

      + +
    • + +
    • + +

      If you also want support for LDAP or TLS (or for Cyrus SASL), +you need to merge their CCARGS and AUXLIBS +options into the above command line; see the LDAP_README and +TLS_README for details.

      + +
      +
      +% make tidy # if you have left-over files from a previous build
      +% make makefiles CCARGS='-DUSE_SASL_AUTH \
      +    -DDEF_SERVER_SASL_TYPE=\"dovecot\" \
      +    ...CCARGS options for LDAP or TLS etc....' \
      +   AUXLIBS='...AUXLIBS options for LDAP or TLS etc....'
      +
      +
      + +
    • + +
    + +

    Building Cyrus SASL support

    + +

    Building the Cyrus SASL library

    + +

    Postfix works with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, which are +available from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.

    + +
    + +Important + +

    If you install the Cyrus SASL libraries as per the default, you will have +to create a symlink /usr/lib/sasl -> +/usr/local/lib/sasl for version 1.5.x or +/usr/lib/sasl2 -> /usr/local/lib/sasl2 +for version 2.1.x.

    + +
    + +

    Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN +and/or NTLM authentication mechanism. To enable these authentication +mechanisms, build the Cyrus SASL libraries with:

    + +
    +
    +% ./configure --enable-login --enable-ntlm
    +
    +
    + +

    Building Postfix with Cyrus SASL support

    + +

    These instructions assume that you build Postfix from source +code as described in the INSTALL document. Some modification may +be required if you build Postfix from a vendor-specific source +package.

    + +

    The following assumes that the Cyrus SASL include files are in +/usr/local/include, and that the Cyrus SASL libraries are in +/usr/local/lib.

    + +

    On some systems this generates the necessary Makefile +definitions:

    + +
    + +
    Cyrus SASL version 2.1.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"
    +
    + +
    + +
    Cyrus SASL version 1.5.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"
    +
    + +
    + +
    + +

    On Solaris 2.x you need to specify run-time link information, +otherwise the ld.so run-time linker will not find the SASL shared +library:

    + +
    + +
    Cyrus SASL version 2.1.x
    + +
    + +
    +% make tidy # remove left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \
    +    -R/usr/local/lib -lsasl2"
    +
    + +
    + +
    Cyrus SASL version 1.5.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include" AUXLIBS="-L/usr/local/lib \
    +    -R/usr/local/lib -lsasl"
    +
    + +
    + +
    + +

    Using Cyrus SASL version 1.5.x

    + +

    Postfix supports Cyrus SASL version 1.x, but you shouldn't use +it unless you are forced to. The makers of Cyrus SASL write:

    + +
    This library is being deprecated and applications +should transition to using the SASLv2 library (source: Project Cyrus: +Downloads).
    + +

    If you still need to set it up, here's a quick rundown:

    + +

    Read the regular section on SMTP server configurations for the +Cyrus SASL framework. The differences are:

    + +
      + +
    • Cyrus SASL version 1.5.x searches for configuration +(smtpd.conf) in /usr/lib/sasl/ only. You +must place the configuration in that directory. Some systems may +have modified Cyrus SASL and put the files into e.g. +/var/lib/sasl/.

    • + +
    • Use the saslpasswd command instead of +saslpasswd2 to create users in sasldb. +

    • + +
    • Use the sasldblistusers command instead of +sasldblistusers2 to find users in sasldb. +

    • + +
    • In the smtpd.conf file you can't use +mech_list to limit the range of mechanisms offered. +Instead, remove their libraries from /usr/lib/sasl/ +(and remember remove those files again when a system update +re-installs new versions).

    • + +
    + +

    Credits

    + +
      + +
    • Postfix SASL support was originally implemented by Till Franke +of SuSE Rhein/Main AG.
    • + +
    • Wietse trimmed down the code to only the bare necessities. +
    • + +
    • Support for Cyrus SASL version 2 was contributed by Jason Hoos. +
    • + +
    • Liviu Daia added smtpd_sasl_application_name, separated +reject_sender_login_mismatch into +reject_authenticated_sender_login_mismatch and +reject_unauthenticated_sender_login_mismatch, and revised the docs. +
    • + +
    • Wietse made another iteration through the code to add plug-in +support for multiple SASL implementations, and for reasons that +have been lost, also changed smtpd_sasl_application_name into +smtpd_sasl_path.
    • + +
    • The Dovecot SMTP server-only plug-in was originally implemented +by Timo Sirainen of Procontrol, Finland.
    • + +
    • Patrick Ben Koetter revised this document for Postfix 2.4 and +made much needed updates.
    • + +
    • Patrick Ben Koetter revised this document again for Postfix +2.7 and made much needed updates.
    • + +
    + + + diff --git a/postfix/html/SOHO_README.html b/postfix/html/SOHO_README.html index 6d59437bc..d4458aeeb 100644 --- a/postfix/html/SOHO_README.html +++ b/postfix/html/SOHO_README.html @@ -44,11 +44,11 @@ Internet hostname @@ -214,124 +214,122 @@ whenever you change the canonical table.

    Execute the command "postmap /etc/postfix/virtual" whenever you change the virtual table.

    -

    Enabling SASL authentication in the -Postfix SMTP client

    +

    Enabling SASL authentication in the +Postfix SMTP/LMTP client

    -

    Turn on client-side SASL authentication, and specify a table -with per-host or per-destination username and password information. -The Postfix SMTP client first searches the table for an entry with -the remote SMTP server hostname; if no entry is found, then the -Postfix SMTP client searches the table for -an entry with the next-hop destination. Usually, that is the -right-hand part of an email address, but it can also be the information -that is specified with the relayhost parameter or with a transport(5) -table.

    +

    This section shows a typical scenario where the Postfix SMTP +client sends all messages via a mail gateway server that requires +SASL authentication. To make the example more readable we introduce +it in two parts.

     /etc/postfix/main.cf:
         smtp_sasl_auth_enable = yes
    -    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    -    smtp_sasl_type = cyrus
    -    relayhost = [mail.myisp.net]
    +    relayhost = [mail.isp.example]
         # Alternative form:
    -    # relayhost = [mail.myisp.net]:submission
    -
    -/etc/postfix/sasl_passwd:
    -    [mail.myisp.net]            username:password
    -    [mail.myisp.net]:submission username:password
    +    # relayhost = [mail.isp.example]:submission
    +    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
     
    -

    Notes:

    -
      -
    • The "submission" destination port tells Postfix to send -mail via TCP network port 587, which is normally reserved for email -clients. The default is to send mail to the "smtp" destination port -(TCP port 25), which is used for receiving mail across the internet. -If you use an explicit destination port in main.cf, then you must -use the same form also in the smtp_sasl_password_maps file.

      - -
    • Postfix does not deliver mail via TCP port 465 (the obsolete -"wrappermode" protocol). See TLS_README for a solution that uses the -"stunnel" command.

      - -
    • The "[" and "]" prevent Postfix from looking up the MX -(mail exchanger) records for the enclosed name. If you use this -form in main.cf, then you must use the same form also in the -smtp_sasl_password_maps file.

      - -
    • The Postfix SMTP client opens the SASL client password -file before entering the optional chroot jail, so you can keep the -file in /etc/postfix and set permissions read / write only for root -to keep the username:password combinations away from other system -users.

      - -
    • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

      - -
    • Execute the command "postmap /etc/postfix/sasl_passwd" -whenever you change the sasl_passwd table.

      +
    • The smtp_sasl_auth_enable setting enables +client-side authentication. We will configure the client's username +and password information in the second part of the example.

      +
    • + +
    • The relayhost setting forces the Postfix SMTP +to send all remote messages to the specified mail server instead +of trying to deliver them directly to their destination.

    • + +
    • In the relayhost setting, the "[" +and "]" prevent the Postfix SMTP client from looking +up MX (mail exchanger) records for the enclosed name.

    • + +
    • The relayhost destination may also specify a +non-default TCP port. For example, the alternative form +[mail.isp.example]:submission tells Postfix to connect +to TCP network port 587, which is reserved for email client +applications.

    • + +
    • The Postfix SMTP client is compatible with SMTP servers +that use the non-standard "AUTH=method...." +syntax in response to the EHLO command; this requires no additional +Postfix client configuration.

    • + +
    • The Postfix SMTP client does not support the obsolete +"wrappermode" protocol, which uses TCP port 465 on the +SMTP server. See TLS_README for a solution that uses the +stunnel command.

    • + +
    • With the smtp_sasl_password_maps parameter, +we configure the Postfix SMTP client to send username and password +information to the mail gateway server. As discussed in the next +section, the Postfix SMTP client supports multiple ISP accounts. +For this reason the username and password are stored in a table +that contains one username/password combination for each mail gateway +server.

    -

    Workarounds:

    - -
      - -
    • Some remote SMTP servers support PLAIN or LOGIN authentication only. -By default, the Postfix SMTP client does not use authentication -methods that send plaintext passwords, and defers delivery with -the following error message: "Authentication failed: cannot SASL -authenticate to server". To enable plaintext authentication specify, -for example:

      -
      -/etc/postfix/main.cf:
      -    smtp_sasl_security_options = noanonymous
      +/etc/postfix/sasl_passwd:
      +    # destination                   credentials
      +    [mail.isp.example]              username:password
      +    # Alternative form:
      +    # [mail.isp.example]:submission username:password
       
      -
    • Some remote SMTP servers announce authentication mechanisms -that don't actually work. It is possible via the smtp_sasl_mechanism_filter -parameter to restrict the list of server mechanisms that the Postfix -SMTP client will take into consideration:

      -
      -
      -/etc/postfix/main.cf:
      -    smtp_sasl_mechanism_filter = !gssapi, !external, static:all
      -
      + +Important + +

      Keep the SASL client password file in /etc/postfix, +and make the file read+write only for root to protect +the username/password combinations against other users. The Postfix +SMTP client will still be able to read the SASL client passwords. +It opens the file as user root before it drops privileges, +and before entering an optional chroot jail.

      +
      -

      In the above example, the Postfix SMTP client will decline to -use mechanisms -that require special infrastructure such as Kerberos or TLS.

      +
        + +
      • Use the postmap command whenever you +change the /etc/postfix/sasl_passwd file.

      • -
      • The Postfix SMTP client is backwards compatible with SMTP -servers that use the non-standard "AUTH=method..." syntax in response -to the EHLO command; there is no Postfix client configuration needed -to work around it.

        +
      • If you specify the "[" and "]" +in the relayhost destination, then you must use the +same form in the smtp_sasl_password_maps file.

        +
      • + +
      • If you specify a non-default TCP Port (such as +":submission" or ":587") in the +relayhost destination, then you must use the same form +in the smtp_sasl_password_maps file.

      -

      Supporting multiple ISP accounts -in the Postfix SMTP client

      +

      Configuring Sender-Dependent SASL +authentication

      + +

      Postfix supports different ISP accounts for different sender +addresses (version 2.3 and later). This can be useful when one +person uses the same machine for work and for personal use, or when +people with different ISP accounts share the same Postfix server. +

      -

      Postfix version 2.3 supports multiple ISP accounts. This can -be useful when one person uses the same machine for work and for -personal use, or when people with different ISP accounts share the -same Postfix server. To make this possible, Postfix 2.3 supports -per-sender SASL passwords and per-sender relay hosts. In the example -below, Postfix will search the SASL password file by sender before -it searches that same file by destination. Likewise, Postfix will -search the per-sender relayhost file, and use the default relayhost -only as a final resort.

      +

      To make this possible, Postfix supports per-sender SASL passwords +and per-sender relay hosts. In the example below, the Postfix SMTP +client will search the SASL password file by sender address before +it searches that same file by destination. Likewise, the Postfix +trivial-rewrite(8) daemon will search the per-sender relayhost file, +and use the default relayhost setting only as a final +resort.

      @@ -340,42 +338,48 @@ only as a final resort.  

      sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd - relayhost = [mail.myisp.net] + relayhost = [mail.isp.example] # Alternative form: - # relayhost = [mail.myisp.net]:submission + # relayhost = [mail.isp.example]:submission +
      +
      +
      +
       /etc/postfix/sasl_passwd:
           # Per-sender authentication; see also /etc/postfix/sender_relay.
      -    user1@example.com           username2:password2
      -    user2@example.net           username2:password2
      +    user1@example.com               username2:password2
      +    user2@example.net               username2:password2
           # Login information for the default relayhost.
      -    [mail.myisp.net]            username:password
      -    [mail.myisp.net]:submission username:password
      +    [mail.isp.example]              username:password
      +    # Alternative form:
      +    # [mail.isp.example]:submission username:password
      +
      +
      +
      +
       /etc/postfix/sender_relay:
           # Per-sender provider; see also /etc/postfix/sasl_passwd.
      -    user1@example.com           [mail.example.com]:submission
      -    user2@example.net           [mail.example.net]
      +    user1@example.com               [mail.example.com]:submission
      +    user2@example.net               [mail.example.net]
       
      -

      Notes:

      -
      • If you are creative, then you can try to combine the two tables into one single MySQL database, and configure different Postfix queries to extract the appropriate information.

        -
      • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

        +
      • Specify dbm instead of hash if your system uses dbm files +instead of db files. To find out what lookup tables Postfix supports, +use the command "postconf -m".

        -
      • Execute the command "postmap /etc/postfix/sasl_passwd" +

      • Execute the command "postmap /etc/postfix/sasl_passwd" whenever you change the sasl_passwd table.

        -
      • Execute the command "postmap /etc/postfix/sender_relay" +

      • Execute the command "postmap /etc/postfix/sender_relay" whenever you change the sender_relay table.

      diff --git a/postfix/html/TLS_README.html b/postfix/html/TLS_README.html index fa6571940..edf38f78b 100644 --- a/postfix/html/TLS_README.html +++ b/postfix/html/TLS_README.html @@ -2237,7 +2237,7 @@ as specified by the smtp_tl parameter. This setting controls the minimum acceptable SMTP client TLS cipher grade for use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may -want to enforce TLS, and is beyond the reach of today's crypt-analytic +want to enforce TLS, and is beyond the reach of today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis.

      diff --git a/postfix/html/dnsblog.8.html b/postfix/html/dnsblog.8.html deleted file mode 100644 index d455de14a..000000000 --- a/postfix/html/dnsblog.8.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - Postfix manual - dnsblog(8) -
      -DNSBLOG(8)                                                          DNSBLOG(8)
      -
      -NAME
      -       dnsblog - Postfix DNS blocklist logger
      -
      -SYNOPSIS
      -       dnsblog [generic Postfix daemon options]
      -
      -DESCRIPTION
      -       The  dnsblog(8)  server implements an ad-hoc DNS blocklist
      -       lookup service that will eventually be replaced by an  UDP
      -       client  that  is  built  directly  into  the postscreen(8)
      -       server.
      -
      -       With each connection, the dnsblog(8) server receives a DNS
      -       blocklist domain name and an IP address. If the address is
      -       listed under the DNS blocklist, the dnsblog(8) server logs
      -       the match and replies with the query arguments plus a non-
      -       zero status.  Otherwise it replies with  the  query  argu-
      -       ments  plus a zero status.  Finally, The dnsblog(8) server
      -       closes the connection.
      -
      -DIAGNOSTICS
      -       Problems and transactions are logged to syslogd(8).
      -
      -CONFIGURATION PARAMETERS
      -       Changes to main.cf are picked up  automatically,  as  dns-
      -       blog(8)  processes  run for only a limited amount of time.
      -       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.
      -
      -       config_directory (see 'postconf -d' output)
      -              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
      -              built-in watchdog timer.
      -
      -       postscreen_dnsbl_sites (empty)
      -              Optional list of DNS blocklist domains.
      -
      -       ipc_timeout (3600s)
      -              The time limit for sending or receiving information
      -              over an internal communication channel.
      -
      -       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.
      -
      -       queue_directory (see 'postconf -d' output)
      -              The  location of the Postfix top-level queue direc-
      -              tory.
      -
      -       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
      -       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 is temporary with Postfix version 2.7.
      -
      -AUTHOR(S)
      -       Wietse Venema
      -       IBM T.J. Watson Research
      -       P.O. Box 704
      -       Yorktown Heights, NY 10598, USA
      -
      -                                                                    DNSBLOG(8)
      -
      diff --git a/postfix/html/pcre_table.5.html b/postfix/html/pcre_table.5.html index a15207d0b..004b0a152 100644 --- a/postfix/html/pcre_table.5.html +++ b/postfix/html/pcre_table.5.html @@ -80,10 +80,10 @@ PCRE_TABLE(5) PCRE_TABLE(5) cal line. Each pattern is a perl-like regular expression. The - expression delimiter can be any character, except white- - space or characters that have special meaning (tradition- - ally the forward slash is used). The regular expression - can contain whitespace. + expression delimiter can be any non-alphanumerical charac- + ter, except whitespace or characters that have special + meaning (traditionally the forward slash is used). The + regular expression can contain whitespace. By default, matching is case-insensitive, and newlines are not treated as special characters. The behavior is con- diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index db5c78f15..5e3702529 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -2291,8 +2291,8 @@ domain.

      Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

      @@ -2615,7 +2615,7 @@ for showq(8) queue displays.

      empty_address_default_transport_maps_lookup_key -(default: <>)
      +(default: <>)

      The sender_dependent_default_transport_maps search string that will be used instead of the null sender address.

      @@ -4930,8 +4930,8 @@ which is just the name of a service that is defined the

      Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

      @@ -6574,284 +6574,6 @@ and enabled instances are processed in reverse order.

      This feature is available in Postfix 2.6 and later.

      -
      - -
      postscreen_blacklist_action -(default: continue)
      - -

      The action that postscreen(8) takes when an SMTP client is -permanently blacklisted with the postscreen_blacklist_networks -parameter. Specify one of the following:

      - -
      - -
      continue
      - -
      Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client triggers a PREGREET or HANGUP -error, or whether the client is listed at the DNSBL sites specified -with the postscreen_dnsbl_sites parameter. Take the corresponding -action, or forward the connection to a real SMTP server process. -

      - -
      drop
      - -
      Drop the connection immediately with a 521 SMTP reply, without -reporting PREGREET, HANGUP or DNSBL results.
      - -
      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_blacklist_networks -(default: empty)
      - -

      Network addresses that are permanently blacklisted; see the -postscreen_blacklist_action parameter for possible actions. This -parameter uses the same address syntax as the mynetworks parameter. -The blacklist has higher precedence than whitelists. This feature -never uses the remote SMTP client hostname.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_cache_cleanup_interval -(default: 12h)
      - -

      The amount of time between postscreen(8) cache cleanup runs. -Cache cleanup increases the load on the cache database and should -therefore not be run frequently. This feature requires that the -cache database supports the "delete" and "sequence" operators. -Specify a zero interval to disable cache cleanup.

      - -

      After each cache cleanup run, the postscreen(8) daemon logs the -number of entries that were retained and dropped. A cleanup run is -logged as "partial" when the daemon terminates early after "postfix -reload", "postfix stop", or no requests for $max_idle -seconds.

      - -

      Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks).

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_cache_map -(default: btree:$data_directory/ps_whitelist)
      - -

      Persistent storage for the postscreen(8) server decisions.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_cache_retention_time -(default: 1d)
      - -

      The amount of time that postscreen(8) will cache an expired -temporary whitelist entry before it is removed. This prevents clients -from being logged as "NEW" just because their cache entry expired -an hour ago.

      - -

      Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks).

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_cache_ttl -(default: 1d)
      - -

      The amount of time that postscreen(8) will cache a decision for -a specific SMTP client IP address. During this time, the client IP -address is excluded from tests. If possible, expired decisions are -renewed automatically. 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.7.

      - - -
      - -
      postscreen_dnsbl_action -(default: continue)
      - -

      The action that postscreen(8) takes when an SMTP client is listed -at the DNS blocklist domains specified with the postscreen_dnsbl_sites -parameter. Specify one of the following:

      - -
      - -
      continue
      - -
      Forward the connection to a real SMTP server process.

      - -
      drop
      - -
      Drop the connection with a 521 SMTP reply.
      - -
      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_dnsbl_sites -(default: empty)
      - -

      Optional list of DNS blocklist domains. When the list is non-enpty, -the dnsblog(8) daemon will query these domains with the IP addresses -of non-whitelisted postscreen(8) clients. Specify a list of domain -names, separated by comma or whitespace.

      - - -
      - -
      postscreen_greet_action -(default: continue)
      - -

      The action that postscreen(8) takes when an SMTP client speaks -before its turn within the time specified with the postscreen_greet_wait -parameter. Specify one of the following:

      - -
      - -
      continue
      - -
      Continue waiting until the postscreen_greet_wait time has -elapsed. If the client is listed at the DNS blocklist domains -specified with the postscreen_dnsbl_sites parameter, execute the -action specified with the postscreen_dnsbl_action parameter, otherwise -forward the connection to a real SMTP server process.

      - -
      drop
      - -
      Drop the connection immediately with a 521 SMTP reply, without -examining DNSBL lookup results.
      - -
      - -

      In either case, postscreen(8) will not whitelist the SMTP client -IP address.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_greet_banner -(default: $smtpd_banner)
      - -

      The text in the optional "220-text..." server -response that -postscreen(8) sends ahead of the real Postfix SMTP server's "220 -text..." response, in an attempt to confuse bad SMTP clients so -that they speak before their turn (pre-greet). Specify an empty -value to disable this feature.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_greet_wait -(default: 4s)
      - -

      The amount of time that postscreen(8) will wait for an SMTP -client to send a command before its turn, and for DNS blocklist -lookup results to arrive. This is done only when the SMTP client -IP address is not permanently whitelisted, and when it has no cached -decision. 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.7.

      - - -
      - -
      postscreen_hangup_action -(default: continue)
      - -

      The action that postscreen(8) takes when an SMTP client disconnects -without sending data, within the time specified with the -postscreen_greet_wait parameter. Specify one of the following: -

      - -
      - -
      continue
      - -
      Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client is listed at the DNSBL sites -specified with the postscreen_dnsbl_sites parameter. Do not -forward the broken connection to a real SMTP server process.

      - -
      drop
      - -
      Drop the connection immediately, without reporting DNSBL lookup -results.
      - -
      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_post_queue_limit -(default: $default_process_limit)
      - -

      The number of clients that can be waiting for service from a -real SMTP server process. When this queue is full, all clients will -receive a 421 reponse.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_pre_queue_limit -(default: $default_process_limit)
      - -

      The number of non-whitelisted clients that can be waiting for -a decision whether they will receive service from a real SMTP server -process. When this queue is full, all non-whitelisted clients will -receive a 421 reponse.

      - -

      This feature is available in Postfix 2.7.

      - - -
      - -
      postscreen_whitelist_networks -(default: $mynetworks)
      - -

      Network addresses that are permanently whitelisted, and that -will not be subjected to postscreen(8) checks. This parameter uses -the same address syntax as the mynetworks parameter. This feature -never uses the remote SMTP client hostname.

      - -

      This feature is available in Postfix 2.7.

      - -
      prepend_delivered_header @@ -7690,8 +7412,8 @@ the transport(5) table.

      Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

      @@ -7812,10 +7534,10 @@ clients at all.

      (default: no)

      -Whether or not a local(8) recipient's home directory must exist +Require that a local(8) recipient's home directory exists before mail delivery is attempted. By default this test is disabled. It can be useful for environments that import home directories to -the mail server (NOT RECOMMENDED). +the mail server (IMPORTING HOME DIRECTORIES IS NOT RECOMMENDED).

      @@ -9886,7 +9608,7 @@ loglevel 4 is strongly discouraged.

      use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may want to enforce TLS, and -is beyond the reach of today's crypt-analytic methods. See +is beyond the reach of today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis.

      @@ -9894,47 +9616,32 @@ on a per-destination basis.

      export
      -
      Enable the mainstream "EXPORT" grade or better OpenSSL -ciphers. This is always used for opportunistic encryption. It is +
      Enable "EXPORT" grade or better OpenSSL +ciphers. This is the default for opportunistic encryption. It is not recommended for mandatory encryption unless you must enforce TLS with "crippled" peers. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_export_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the client is configured to verify server certificates. If you must -exclude anonymous ciphers also at the "encrypt" security level, set -"smtp_tls_mandatory_exclude_ciphers = aNULL".
      +encouraged to not change.
      low
      -
      Enable the mainstream "LOW" grade or better OpenSSL ciphers. This +
      Enable "LOW" grade or better OpenSSL ciphers. This setting is only appropriate for internal mail servers. The underlying cipherlist is specified via the tls_low_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_low_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL".
      +parameter, which you are strongly encouraged to not change.
      medium
      -
      Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. +
      Enable "MEDIUM" grade or better OpenSSL ciphers. The underlying cipherlist is specified via the tls_medium_cipherlist configuration parameter, which you are strongly encouraged to not change. -The default value of tls_medium_cipherlist includes anonymous ciphers, -but these are automatically filtered out if the client is configured to -verify server certificates. If you must exclude anonymous ciphers also -at the "encrypt" security level, set "smtp_tls_mandatory_exclude_ciphers -= aNULL".
      +
      high
      -
      Enable only the mainstream "HIGH" grade OpenSSL ciphers. This -setting is appropriate when all mandatory TLS destinations support -some of "HIGH" grade ciphers, this is not uncommon. The underlying -cipherlist is specified via the tls_high_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_high_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL".
      +
      Enable only "HIGH" grade OpenSSL ciphers. This setting may +be appropriate when all mandatory TLS destinations (e.g. when all +mail is routed to a suitably capable relayhost) support at least one +"HIGH" grade cipher. The underlying cipherlist is specified via the +tls_high_cipherlist configuration parameter, which you are strongly +encouraged to not change.
      null
      Enable only the "NULL" OpenSSL ciphers, these provide authentication @@ -9944,12 +9651,20 @@ in TLS servers). A plausible use-case is an LMTP server listening on a UNIX-domain socket that is configured to support "NULL" ciphers. The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly encouraged to not -change. The default value of tls_null_cipherlist excludes anonymous -ciphers (OpenSSL 0.9.8 has NULL ciphers that offer data integrity without -encryption or authentication).
      +change. +

      The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +Postfix SMTP client is configured to verify server certificates. +You are very unlikely to need to take any steps to exclude anonymous +ciphers, they are excluded automatically as necessary. If you must +exclude anonymous ciphers at the "may" or "encrypt" security levels, +when the Postfix SMTP client does not need or use peer certificates, set +"smtp_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only when +TLS is enforced, set "smtp_tls_mandatory_exclude_ciphers = aNULL".

      +

      This feature is available in Postfix 2.3 and later.

      @@ -10424,7 +10139,7 @@ Examples: # Opportunistic TLS. smtp_tls_security_level = may # Postfix ≥ 2.6: -# Do not tweak opportunistic ciphers unless it is essential +# Do not tweak opportunistic ciphers or protocol unless it is essential # to do so (if a security vulnerability is found in the SSL library that # can be mitigated by disabling a particular protocol or raising the # cipher grade from "export" to "low" or "medium"). @@ -11978,7 +11693,7 @@ more of the following, separated by comma or whitespace.

      speed_adjust
      -
      Do not connect to a before-queue content filter until an entire +

      Do not connect to a before-queue content filter until an entire message has been received. This reduces the number of simultaneous before-queue content filter processes.

      @@ -12505,7 +12220,7 @@ the SASL plug-in implementation that is selected with configuration file or rendezvous point.

      This feature is available in Postfix 2.3 and later. In earlier -releases it was called smtpd_sasl_application_name.

      +releases it was called smtpd_sasl_application_name.

      @@ -12807,18 +12522,6 @@ Examples: - - -
      smtpd_service -(default: smtpd)
      - -

      The internal service that postscreen(8) forwards allowed -connections to. In a future version there may be different -classes of SMTP service.

      - -

      This feature is available in Postfix 2.7.

      - -
      smtpd_soft_error_limit @@ -13435,65 +13138,46 @@ loglevel 4 is strongly discouraged.

      smtpd_tls_mandatory_ciphers (default: medium)
      -

      The minimum TLS cipher grade that the Postfix SMTP server -will use with mandatory TLS encryption. Cipher types listed in -smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are -excluded from the base definition of the selected cipher grade. See -smtpd_tls_ciphers for cipher controls that apply to opportunistic -TLS.

      +

      The minimum TLS cipher grade that the Postfix SMTP server will +use with mandatory TLS encryption. The default grade ("medium") is +sufficiently strong that any benefit from globally restricting TLS +sessions to a more stringent grade is likely negligible, especially +given the fact that many implementations still do not offer any stronger +("high" grade) ciphers, while those that do, will always use "high" +grade ciphers. So insisting on "high" grade ciphers is generally +counter-productive. Allowing "export" or "low" ciphers is typically +not a good idea, as systems limited to just these are limited to +obsolete browsers. No known SMTP clients fail to support at least +one "medium" or "high" grade cipher.

      The following cipher grades are supported:

      export
      -
      Enable the mainstream "EXPORT" grade or better OpenSSL ciphers. +
      Enable "EXPORT" grade or stronger OpenSSL ciphers. This is the most appropriate setting for public MX hosts, and is always used with opportunistic TLS encryption. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, -which you are strongly encouraged to not change. The default value -of tls_export_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the server is configured to ask for -client certificates. If you must always exclude anonymous ciphers, -set "smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers -only when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = -aNULL".
      +which you are strongly encouraged to not change.
      low
      -
      Enable the mainstream "LOW" grade or better OpenSSL ciphers. The +
      Enable "LOW" grade or stronger OpenSSL ciphers. The underlying cipherlist is specified via the tls_low_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_low_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
      +not change.
      medium
      -
      Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. These -are essentially the 128-bit or stronger ciphers. This is the default -minimum strength for mandatory TLS encryption. MSAs that enforce -TLS and have clients that do not support any "MEDIUM" or "HIGH" -grade ciphers, may need to configure a weaker ("low" or "export") -minimum cipher grade. The underlying cipherlist is specified via the -tls_medium_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_medium_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
      +
      Enable "MEDIUM" grade or stronger OpenSSL ciphers. These use 128-bit +or longer symmetric bulk-encryption keys. This is the default minimum +strength for mandatory TLS encryption. The underlying cipherlist is +specified via the tls_medium_cipherlist configuration parameter, which +you are strongly encouraged to not change.
      high
      -
      Enable only the mainstream "HIGH" grade OpenSSL ciphers. The +
      Enable only "HIGH" grade OpenSSL ciphers. The underlying cipherlist is specified via the tls_high_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_high_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
      +not change.
      null
      Enable only the "NULL" OpenSSL ciphers, these provide authentication @@ -13501,12 +13185,25 @@ without encryption. This setting is only appropriate in the rare case that all clients are prepared to use NULL ciphers (not normally enabled in TLS clients). The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_null_cipherlist -excludes anonymous ciphers (OpenSSL 0.9.8 has NULL ciphers that offer -data integrity without encryption or authentication).
      +encouraged to not change. +

      Cipher types listed in +smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are +excluded from the base definition of the selected cipher grade. See +smtpd_tls_ciphers for cipher controls that apply to opportunistic +TLS.

      + +

      The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +server is configured to ask for client certificates. You are very +unlikely to need to take any steps to exclude anonymous ciphers, they +are excluded automatically as required. If you must exclude anonymous +ciphers even when Postfix does not need or use peer certificates, set +"smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only +when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = aNULL".

      +

      This feature is available in Postfix 2.3 and later.

      @@ -15203,8 +14900,8 @@ This information can be overruled with the transport(

      Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

      diff --git a/postfix/html/postfix-manuals.html b/postfix/html/postfix-manuals.html index 655bc7db6..92fc12202 100644 --- a/postfix/html/postfix-manuals.html +++ b/postfix/html/postfix-manuals.html @@ -196,8 +196,6 @@ the following convention:

    • pipe(8), deliver mail to non-Postfix command -
    • postscreen(8), Postfix SMTP triage server -
    • proxymap(8), Postfix lookup table proxy server
    • qmgr(8), Postfix queue manager diff --git a/postfix/html/postfix.1.html b/postfix/html/postfix.1.html index 8415435d4..2339142f0 100644 --- a/postfix/html/postfix.1.html +++ b/postfix/html/postfix.1.html @@ -315,7 +315,6 @@ POSTFIX(1) POSTFIX(1) 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 proxymap(8), Postfix lookup table proxy server qmgr(8), Postfix queue manager qmqpd(8), Postfix QMQP server diff --git a/postfix/html/postqueue.1.html b/postfix/html/postqueue.1.html index fe9cbd131..a49832868 100644 --- a/postfix/html/postqueue.1.html +++ b/postfix/html/postqueue.1.html @@ -60,10 +60,8 @@ POSTQUEUE(1) POSTQUEUE(1) size, arrival time, sender, and the recipients that still need to be delivered. If mail could not be delivered upon the last attempt, the reason for - failure is shown. This mode of operation is imple- - mented by executing the postqueue(1) command. The - queue ID string is followed by an optional status - character: + failure is shown. The queue ID string is followed + by an optional status character: * The message is in the active queue, i.e. the message is selected for delivery. diff --git a/postfix/html/postscreen.8.html b/postfix/html/postscreen.8.html deleted file mode 100644 index b90d47a14..000000000 --- a/postfix/html/postscreen.8.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - Postfix manual - postscreen(8) -
      -POSTSCREEN(8)                                                    POSTSCREEN(8)
      -
      -NAME
      -       postscreen - Postfix SMTP triage server
      -
      -SYNOPSIS
      -       postscreen [generic Postfix daemon options]
      -
      -DESCRIPTION
      -       The Postfix postscreen(8) server performs triage on multi-
      -       ple  inbound   SMTP   connections   in   parallel.   While
      -       postscreen(8)  keeps  zombies and other bogus clients away
      -       from Postfix SMTP  server  processes,  more  Postfix  SMTP
      -       server  processes remain available for legitimate clients.
      -
      -GENERAL OPERATION
      -       The triage process involves a  number  of  tests,  in  the
      -       order as described below.  Some tests introduce a delay of
      -       a few seconds.  Once a client passes  all  tests,  its  IP
      -       address  is temporarily excluded from the tests, typically
      -       for 24 hours.  This minimizes the impact of the  tests  on
      -       legitimate mail clients.
      -
      -       After  logging  the  result of its tests, postscreen(8) by
      -       default forwards all connections to  a  real  SMTP  server
      -       process.  This mode is useful for non-destructive testing.
      -
      -       In a typical production setting, postscreen(8) is  config-
      -       ured to disconnect clients that fail some tests.  A future
      -       implementation may pass the connection  to  a  dummy  SMTP
      -       protocol engine that logs sender and recipient information
      -       before hanging up.
      -
      -       Note: postscreen(8) is not an SMTP proxy; this  is  inten-
      -       tional.  The  purpose  is to prioritize legitimate clients
      -       with as little overhead as possible.
      -
      -1. PERMANENT WHITELIST TEST
      -       The  postscreen_whitelist_networks   parameter   (default:
      -       $mynetworks)  specifies  a  permanent  whitelist  for SMTP
      -       client IP addresses.
      -
      -       When  the  SMTP  client  address  matches  the   permanent
      -       whitelist, this is logged as:
      -
      -       WHITELISTED address
      -
      -       The  action  is  not configurable: immediately forward the
      -       connection to a real SMTP server process.
      -
      -2. PERMANENT BLACKLIST TEST
      -       The  postscreen_blacklist_networks   parameter   (default:
      -       empty)  specifies a permanent blacklist for SMTP client IP
      -       addresses.  The address syntax is as with mynetworks.
      -
      -       When the SMTP client address matches the permanent  black-
      -       list, this is logged as:
      -
      -       BLACKLISTED address
      -
      -       The  postscreen_blacklist_action  parameter  specifies the
      -       action that is taken next:
      -
      -       continue (default)
      -              Continue with the SMTP GREETING PHASE TESTS  below.
      -
      -       drop   Drop  the  connection  immediately  with a 521 SMTP
      -              reply.  In a future implementation, the  connection
      -              may  instead  be  passed  to  a dummy SMTP protocol
      -              engine that logs sender and recipient  information.
      -
      -3. TEMPORARY WHITELIST TEST
      -       The  postscreen(8)  daemon maintains a temporary whitelist
      -       for SMTP client IP addresses  that  have  passed  all  the
      -       tests  described below. The postscreen_cache_map parameter
      -       specifies the location of the  temporary  whitelist.   The
      -       temporary  whitelist is not used for SMTP client addresses
      -       that appear on the permanent blacklist or whitelist.
      -
      -       When the SMTP client  address  appears  on  the  temporary
      -       whitelist, this is logged as:
      -
      -       PASS OLD address
      -
      -       The  action  is  not configurable: immediately forward the
      -       connection to a real SMTP server process.  The  client  is
      -       excluded  from further tests until its temporary whitelist
      -       entry expires, as controlled with the postscreen_cache_ttl
      -       parameter.  Expired entries are silently renewed if possi-
      -       ble.
      -
      -4. SMTP GREETING PHASE TESTS
      -       The  postscreen_greet_wait  parameter  specifies  a   time
      -       interval during which postscreen(8) runs a number of tests
      -       in parallel.  These tests are described below, and are run
      -       before  the  client  may  see  the real SMTP server's "220
      -       text..." server greeting.
      -
      -       When the SMTP client passes all greeting-phase tests, this
      -       is logged as:
      -
      -       PASS NEW address
      -
      -       The  action  is  to  forward the connection to a real SMTP
      -       server process and to create a temporary  whitelist  entry
      -       that  excludes  the  client  IP address from further tests
      -       until the temporary whitelist entry expires, as controlled
      -       with the postscreen_cache_ttl parameter.
      -
      -       In  a  future  implementation, the connection may first be
      -       passed to a dummy SMTP  protocol  engine  that  implements
      -       more  protocol  tests  including  greylisting,  before the
      -       client is allowed to talk to a real SMTP server process.
      -
      -4A. PREGREET TEST
      -       The postscreen_greet_banner parameter specifies  the  text
      -       portion   of   a  "220-text..."  teaser  banner  (default:
      -       $smtpd_banner).   The  postscreen(8)  daemon  sends   this
      -       before  the  postscreen_greet_wait  timer is started.  The
      -       purpose of the teaser banner is to confuse SPAM clients so
      -       that  they  speak  before  their turn. It has no effect on
      -       SMTP clients that correctly implement the protocol.
      -
      -       To avoid problems with  broken  SMTP  engines  in  network
      -       appliances,  either  exclude  them from all tests with the
      -       postscreen_whitelist_networks feature or else  specify  an
      -       empty   postscreen_greet_banner   value   to  disable  the
      -       "220-text..."  teaser banner.
      -
      -       When  an  SMTP  client  sends   a   command   before   the
      -       postscreen_greet_wait time has elapsed, this is logged as:
      -
      -       PREGREET count after time from address text...
      -
      -       Translation: the client at address sent count bytes before
      -       its  turn  to  speak, and this happened time seconds after
      -       the postscreen_greet_wait timer was started.  The text  is
      -       what  the  client  sent  (truncated to 100 bytes, and with
      -       non-printable characters replaced with "?").
      -
      -       The postscreen_greet_action parameter specifies the action
      -       that is taken next:
      -
      -       continue (default)
      -              Wait   until  the  postscreen_greet_wait  time  has
      -              elapsed, then report DNSBL lookup results if appli-
      -              cable. Either perform DNSBL-related actions or for-
      -              ward the connection to a real SMTP server  process.
      -
      -       drop   Drop  the  connection  immediately  with a 521 SMTP
      -              reply.  In a future implementation, the  connection
      -              may  instead  be  passed  to  a dummy SMTP protocol
      -              engine that logs sender and recipient  information.
      -
      -4B. HANGUP TEST
      -       When  the  SMTP  client  hangs up without sending any data
      -       before the postscreen_greet_wait time has elapsed, this is
      -       logged as:
      -
      -       HANGUP after time from address
      -
      -       The  postscreen_hangup_action specifies the action that is
      -       taken next:
      -
      -       continue (default)
      -              Wait  until  the  postscreen_greet_wait  time   has
      -              elapsed, then report DNSBL lookup results if appli-
      -              cable. Do not forward the broken  connection  to  a
      -              real SMTP server process.
      -
      -       drop   Drop the connection immediately.
      -
      -4C. DNS BLOCKLIST TEST
      -       The   postscreen_dnsbl_sites  parameter  (default:  empty)
      -       specifies a list of DNS blocklist servers.  These  lookups
      -       are made in parallel.
      -
      -       When  the  postscreen_greet_wait time has elapsed, and the
      -       SMTP client address is listed with at least one  of  these
      -       blocklists, this is logged as:
      -
      -       DNSBL rank count for address
      -
      -       Translation:  the  client  at address is listed with count
      -       DNSBL servers. The count does not depend on the number  of
      -       DNS records that an individual DNSBL server returns.
      -
      -       The postscreen_dnsbl_action parameter specifies the action
      -       that is taken next:
      -
      -       continue (default)
      -              Forward  the  connection  to  a  real  SMTP  server
      -              process.
      -
      -       drop   Drop  the  connection  immediately  with a 521 SMTP
      -              reply.  In a future implementation, the  connection
      -              may  instead  be  passed  to  a dummy SMTP protocol
      -              engine that logs sender and recipient  information.
      -
      -SECURITY
      -       The postscreen(8) server is moderately security-sensitive.
      -       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 2920 (SMTP Pipelining)
      -
      -DIAGNOSTICS
      -       Problems and transactions are logged to syslogd(8).
      -
      -CONFIGURATION PARAMETERS
      -       Changes  to  main.cf  are  not picked up automatically, as
      -       postscreen(8) processes may run for  several  hours.   Use
      -       the command "postfix reload" after a configuration change.
      -
      -       The text below provides  only  a  parameter  summary.  See
      -       postconf(5) for more details including examples.
      -
      -TRIAGE PARAMETERS
      -       postscreen_blacklist_action (continue)
      -              The  action  that  postscreen(8) takes when an SMTP
      -              client  is   permanently   blacklisted   with   the
      -              postscreen_blacklist_networks parameter.
      -
      -       postscreen_blacklist_networks (empty)
      -              Network addresses that are permanently blacklisted;
      -              see the postscreen_blacklist_action  parameter  for
      -              possible actions.
      -
      -       postscreen_dnsbl_action (continue)
      -              The  action  that  postscreen(8) takes when an SMTP
      -              client is listed at the DNS blocklist domains spec-
      -              ified with the postscreen_dnsbl_sites parameter.
      -
      -       postscreen_dnsbl_sites (empty)
      -              Optional list of DNS blocklist domains.
      -
      -       postscreen_greet_action (continue)
      -              The  action  that  postscreen(8) takes when an SMTP
      -              client speaks before its turn within the time spec-
      -              ified with the postscreen_greet_wait parameter.
      -
      -       postscreen_greet_banner ($smtpd_banner)
      -              The  text  in  the  optional  "220-text..."  server
      -              response that postscreen(8) sends ahead of the real
      -              Postfix SMTP server's "220 text..." response, in an
      -              attempt to confuse bad SMTP clients  so  that  they
      -              speak before their turn (pre-greet).
      -
      -       postscreen_greet_wait (4s)
      -              The amount of time that postscreen(8) will wait for
      -              an SMTP client to send a command before  its  turn,
      -              and for DNS blocklist lookup results to arrive.
      -
      -       postscreen_hangup_action (continue)
      -              The  action  that  postscreen(8) takes when an SMTP
      -              client disconnects without sending data, within the
      -              time   specified   with  the  postscreen_greet_wait
      -              parameter.
      -
      -       postscreen_post_queue_limit ($default_process_limit)
      -              The number of clients that can be waiting for  ser-
      -              vice from a real SMTP server process.
      -
      -       postscreen_pre_queue_limit ($default_process_limit)
      -              The  number  of non-whitelisted clients that can be
      -              waiting for a decision whether  they  will  receive
      -              service from a real SMTP server process.
      -
      -       postscreen_whitelist_networks ($mynetworks)
      -              Network addresses that are permanently whitelisted,
      -              and that will not  be  subjected  to  postscreen(8)
      -              checks.
      -
      -       smtpd_service (smtpd)
      -              The  internal  service  that postscreen(8) forwards
      -              allowed connections to.
      -
      -CACHE CONTROLS
      -       postscreen_cache_cleanup_interval (12h)
      -              The amount  of  time  between  postscreen(8)  cache
      -              cleanup runs.
      -
      -       postscreen_cache_map (btree:$data_directory/ps_whitelist)
      -              Persistent  storage  for  the  postscreen(8) server
      -              decisions.
      -
      -       postscreen_cache_retention_time (1d)
      -              The amount of time that postscreen(8) will cache an
      -              expired  temporary  whitelist  entry  before  it is
      -              removed.
      -
      -       postscreen_cache_ttl (1d)
      -              The amount of time that postscreen(8) will cache  a
      -              decision for a specific SMTP client IP address.
      -
      -MISCELLANEOUS CONTROLS
      -       config_directory (see 'postconf -d' output)
      -              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
      -              built-in watchdog timer.
      -
      -       delay_logging_resolution_limit (2)
      -              The maximal number  of  digits  after  the  decimal
      -              point when logging sub-second delay values.
      -
      -       command_directory (see 'postconf -d' output)
      -              The  location  of  all  postfix administrative com-
      -              mands.
      -
      -       ipc_timeout (3600s)
      -              The time limit for sending or receiving information
      -              over an internal communication channel.
      -
      -       max_idle (100s)
      -              The  maximum  amount  of  time that an idle Postfix
      -              daemon process waits  for  an  incoming  connection
      -              before terminating voluntarily.
      -
      -       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
      -       smtpd(8), Postfix SMTP server
      -       dnsblog(8), temporary DNS helper
      -       syslogd(8), system logging
      -
      -LICENSE
      -       The  Secure  Mailer  license must be distributed with this
      -       software.
      -
      -AUTHOR(S)
      -       Wietse Venema
      -       IBM T.J. Watson Research
      -       P.O. Box 704
      -       Yorktown Heights, NY 10598, USA
      -
      -                                                                 POSTSCREEN(8)
      -
      diff --git a/postfix/html/regexp_table.5.html b/postfix/html/regexp_table.5.html index 3261a4b90..cff60ba8a 100644 --- a/postfix/html/regexp_table.5.html +++ b/postfix/html/regexp_table.5.html @@ -85,10 +85,10 @@ REGEXP_TABLE(5) REGEXP_TABLE(5) Solaris, and in regex(7) with Linux. Other systems may use other document names. - The expression delimiter can be any character, except - whitespace or characters that have special meaning (tradi- - tionally the forward slash is used). The regular expres- - sion can contain whitespace. + The expression delimiter can be any non-alphanumerical + character, except whitespace or characters that have spe- + cial meaning (traditionally the forward slash is used). + The regular expression can contain whitespace. By default, matching is case-insensitive, and newlines are not treated as special characters. The behavior is con- diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index b47f92c0d..746389669 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -105,52 +105,54 @@ SMTPD(8) SMTPD(8) as if the local hostname were specified, instead of rejecting the address as invalid. - smtpd_command_filter (empty) - A mechanism to transform commands from remote SMTP - clients. - smtpd_reject_unlisted_sender (no) - Request that the Postfix SMTP server rejects mail - from unknown sender addresses, even when no - explicit reject_unlisted_sender access restriction + Request that the Postfix SMTP server rejects mail + from unknown sender addresses, even when no + explicit reject_unlisted_sender access restriction is specified. smtpd_sasl_exceptions_networks (empty) - What remote SMTP clients the Postfix SMTP server + What remote SMTP clients the Postfix SMTP server will not offer AUTH support to. Available in Postfix version 2.2 and later: smtpd_discard_ehlo_keyword_address_maps (empty) - Lookup tables, indexed by the remote SMTP client - address, with case insensitive lists of EHLO key- - words (pipelining, starttls, auth, etc.) that the + Lookup tables, indexed by the remote SMTP client + address, with case insensitive lists of EHLO key- + words (pipelining, starttls, auth, etc.) that the SMTP server will not send in the EHLO response to a remote SMTP client. smtpd_discard_ehlo_keywords (empty) - A case insensitive list of EHLO keywords (pipelin- - ing, starttls, auth, etc.) that the SMTP server + A case insensitive list of EHLO keywords (pipelin- + ing, starttls, auth, etc.) that the SMTP server will not send in the EHLO response to a remote SMTP client. smtpd_delay_open_until_valid_rcpt (yes) - Postpone the start of an SMTP mail transaction + Postpone the start of an SMTP mail transaction until a valid RCPT TO command is received. Available in Postfix version 2.3 and later: smtpd_tls_always_issue_session_ids (yes) - Force the Postfix SMTP server to issue a TLS ses- - sion id, even when TLS session caching is turned + Force the Postfix SMTP server to issue a TLS ses- + sion id, even when TLS session caching is turned off (smtpd_tls_session_cache_database is empty). Available in Postfix version 2.6 and later: tcp_windowsize (0) - An optional workaround for routers that break TCP + An optional workaround for routers that break TCP window scaling. + Available in Postfix version 2.7 and later: + + smtpd_command_filter (empty) + A mechanism to transform commands from remote SMTP + clients. + ADDRESS REWRITING CONTROLS See the ADDRESS_REWRITING_README document for a detailed discussion of Postfix address rewriting. diff --git a/postfix/html/verify.8.html b/postfix/html/verify.8.html index 7fa70cdf2..3b6396dfc 100644 --- a/postfix/html/verify.8.html +++ b/postfix/html/verify.8.html @@ -40,7 +40,7 @@ VERIFY(8) VERIFY(8) query address Look up the status and text for the specified - address. If the status is unknown, a probe is sent + address. If the status is unknown, a probe is sent and an "in progress" status is returned. SECURITY @@ -50,9 +50,9 @@ VERIFY(8) VERIFY(8) low privilege. The address verification server can be coerced to store - unlimited amounts of garbage. Limiting the cache size - trades one problem (disk space exhaustion) for another one - (poor response time to client requests). + unlimited amounts of garbage. Limiting the cache expiry + time trades one problem (disk space exhaustion) for + another one (poor response time to client requests). With Postfix version 2.5 and later, the verify(8) server no longer uses root privileges when opening the @@ -66,12 +66,12 @@ VERIFY(8) VERIFY(8) Problems and transactions are logged to syslogd(8). BUGS - The address verification service is suitable only for - sites that handle a low mail volume. Verification probes - add additional traffic to the mail queue and perform - poorly under high load. Servers may blacklist sites that - probe excessively, or that probe excessively for non-exis- - tent recipient addresses. + Address verification probe messages add additional traffic + to the mail queue. Recipient verification may cause an + increased load on down-stream servers in the case of a + dictionary attack or a flood of backscatter bounces. + Sender address verification may cause your site to be + blacklisted by some providers. If the persistent database ever gets corrupted then the world comes to an end and human intervention is needed. @@ -79,7 +79,7 @@ VERIFY(8) VERIFY(8) CONFIGURATION PARAMETERS Changes to main.cf are not picked up automatically, as - verify(8) processes are persistent. Use the command "post- + verify(8) processes are long-lived. Use the command "post- fix reload" after a configuration change. The text below provides only a parameter summary. See diff --git a/postfix/makedefs b/postfix/makedefs index dd486cc9b..b2158197b 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -610,7 +610,7 @@ ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \ export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS # Snapshot only. -CCARGS="$CCARGS -DSNAPSHOT" +#CCARGS="$CCARGS -DSNAPSHOT" # Non-production: needs thorough testing, or major changes are still # needed before the code stabilizes. diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index 1e359ea51..6270ac219 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -7,8 +7,7 @@ DAEMONS = man8/bounce.8 man8/defer.8 man8/cleanup.8 man8/error.8 man8/local.8 \ man8/showq.8 man8/smtp.8 man8/smtpd.8 man8/trivial-rewrite.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/scache.8 man8/discard.8 man8/tlsmgr.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 \ diff --git a/postfix/man/man1/postfix.1 b/postfix/man/man1/postfix.1 index c8d601941..f1d59b8c7 100644 --- a/postfix/man/man1/postfix.1 +++ b/postfix/man/man1/postfix.1 @@ -273,7 +273,6 @@ 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 proxymap(8), Postfix lookup table proxy server qmgr(8), Postfix queue manager qmqpd(8), Postfix QMQP server diff --git a/postfix/man/man1/postqueue.1 b/postfix/man/man1/postqueue.1 index 83df565c5..c0db9145f 100644 --- a/postfix/man/man1/postqueue.1 +++ b/postfix/man/man1/postqueue.1 @@ -54,8 +54,7 @@ by contacting the Postfix \fBshowq\fR(8) daemon. Each queue entry shows the queue file ID, message size, arrival time, sender, and the recipients that still need to be delivered. If mail could not be delivered upon the last attempt, -the reason for failure is shown. This mode of operation is implemented -by executing the \fBpostqueue\fR(1) command. The queue ID string +the reason for failure is shown. The queue ID string is followed by an optional status character: .RS .IP \fB*\fR diff --git a/postfix/man/man5/pcre_table.5 b/postfix/man/man5/pcre_table.5 index 71bc0ad27..9399450be 100644 --- a/postfix/man/man5/pcre_table.5 +++ b/postfix/man/man5/pcre_table.5 @@ -76,7 +76,8 @@ A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. .PP Each pattern is a perl-like regular expression. The expression -delimiter can be any character, except whitespace or characters +delimiter can be any non-alphanumerical character, except +whitespace or characters that have special meaning (traditionally the forward slash is used). The regular expression can contain whitespace. diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 3ffbf62d8..8745757e3 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -1315,8 +1315,8 @@ domain. .PP Specify a string of the form \fItransport:nexthop\fR, where \fItransport\fR is the name of a mail delivery transport defined in master.cf. -The \fI:nexthop\fR part is optional. For more details see the -\fBtransport\fR(5) manual page. +The \fI:nexthop\fR destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent. .PP Example: .PP @@ -2718,8 +2718,8 @@ which is just the name of a service that is defined the master.cf file. .PP Specify a string of the form \fItransport:nexthop\fR, where \fItransport\fR is the name of a mail delivery transport defined in master.cf. -The \fI:nexthop\fR part is optional. For more details see the -\fBtransport\fR(5) manual page. +The \fI:nexthop\fR destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent. .PP Beware: if you override the default local delivery agent then you need to review the LOCAL_RECIPIENT_README document, otherwise the @@ -3695,160 +3695,6 @@ as "stop" commands. For these commands, disabled instances are skipped, and enabled instances are processed in reverse order. .PP This feature is available in Postfix 2.6 and later. -.SH postscreen_blacklist_action (default: continue) -The action that \fBpostscreen\fR(8) takes when an SMTP client is -permanently blacklisted with the postscreen_blacklist_networks -parameter. Specify one of the following: -.IP "continue" -Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client triggers a PREGREET or HANGUP -error, or whether the client is listed at the DNSBL sites specified -with the postscreen_dnsbl_sites parameter. Take the corresponding -action, or forward the connection to a real SMTP server process. -.IP "drop" -Drop the connection immediately with a 521 SMTP reply, without -reporting PREGREET, HANGUP or DNSBL results. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_blacklist_networks (default: empty) -Network addresses that are permanently blacklisted; see the -postscreen_blacklist_action parameter for possible actions. This -parameter uses the same address syntax as the mynetworks parameter. -The blacklist has higher precedence than whitelists. This feature -never uses the remote SMTP client hostname. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_cache_cleanup_interval (default: 12h) -The amount of time between \fBpostscreen\fR(8) cache cleanup runs. -Cache cleanup increases the load on the cache database and should -therefore not be run frequently. This feature requires that the -cache database supports the "delete" and "sequence" operators. -Specify a zero interval to disable cache cleanup. -.PP -After each cache cleanup run, the \fBpostscreen\fR(8) daemon logs the -number of entries that were retained and dropped. A cleanup run is -logged as "partial" when the daemon terminates early after "\fBpostfix -reload\fR", "\fBpostfix stop\fR", or no requests for $max_idle -seconds. -.PP -Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks). -.PP -This feature is available in Postfix 2.7. -.SH postscreen_cache_map (default: btree:$data_directory/ps_whitelist) -Persistent storage for the \fBpostscreen\fR(8) server decisions. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_cache_retention_time (default: 1d) -The amount of time that \fBpostscreen\fR(8) will cache an expired -temporary whitelist entry before it is removed. This prevents clients -from being logged as "NEW" just because their cache entry expired -an hour ago. -.PP -Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks). -.PP -This feature is available in Postfix 2.7. -.SH postscreen_cache_ttl (default: 1d) -The amount of time that \fBpostscreen\fR(8) will cache a decision for -a specific SMTP client IP address. During this time, the client IP -address is excluded from tests. If possible, expired decisions are -renewed automatically. Specify a non-zero time value (an integral -value plus an optional one-letter suffix that specifies the time -unit). -.PP -Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks). -.PP -This feature is available in Postfix 2.7. -.SH postscreen_dnsbl_action (default: continue) -The action that \fBpostscreen\fR(8) takes when an SMTP client is listed -at the DNS blocklist domains specified with the postscreen_dnsbl_sites -parameter. Specify one of the following: -.IP "continue" -Forward the connection to a real SMTP server process. -.IP "drop" -Drop the connection with a 521 SMTP reply. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_dnsbl_sites (default: empty) -Optional list of DNS blocklist domains. When the list is non-enpty, -the \fBdnsblog\fR(8) daemon will query these domains with the IP addresses -of non-whitelisted \fBpostscreen\fR(8) clients. Specify a list of domain -names, separated by comma or whitespace. -.SH postscreen_greet_action (default: continue) -The action that \fBpostscreen\fR(8) takes when an SMTP client speaks -before its turn within the time specified with the postscreen_greet_wait -parameter. Specify one of the following: -.IP "continue" -Continue waiting until the postscreen_greet_wait time has -elapsed. If the client is listed at the DNS blocklist domains -specified with the postscreen_dnsbl_sites parameter, execute the -action specified with the postscreen_dnsbl_action parameter, otherwise -forward the connection to a real SMTP server process. -.IP "drop" -Drop the connection immediately with a 521 SMTP reply, without -examining DNSBL lookup results. -.PP -In either case, \fBpostscreen\fR(8) will not whitelist the SMTP client -IP address. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_greet_banner (default: $smtpd_banner) -The \fItext\fR in the optional "220-\fItext\fR..." server -response that -\fBpostscreen\fR(8) sends ahead of the real Postfix SMTP server's "220 -text..." response, in an attempt to confuse bad SMTP clients so -that they speak before their turn (pre-greet). Specify an empty -value to disable this feature. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_greet_wait (default: 4s) -The amount of time that \fBpostscreen\fR(8) will wait for an SMTP -client to send a command before its turn, and for DNS blocklist -lookup results to arrive. This is done only when the SMTP client -IP address is not permanently whitelisted, and when it has no cached -decision. Specify a non-zero time value (an integral value plus -an optional one-letter suffix that specifies the time unit). -.PP -Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks). -.PP -This feature is available in Postfix 2.7. -.SH postscreen_hangup_action (default: continue) -The action that \fBpostscreen\fR(8) takes when an SMTP client disconnects -without sending data, within the time specified with the -postscreen_greet_wait parameter. Specify one of the following: -.IP "continue" -Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client is listed at the DNSBL sites -specified with the postscreen_dnsbl_sites parameter. Do not -forward the broken connection to a real SMTP server process. -.IP "drop" -Drop the connection immediately, without reporting DNSBL lookup -results. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_post_queue_limit (default: $default_process_limit) -The number of clients that can be waiting for service from a -real SMTP server process. When this queue is full, all clients will -receive a 421 reponse. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_pre_queue_limit (default: $default_process_limit) -The number of non-whitelisted clients that can be waiting for -a decision whether they will receive service from a real SMTP server -process. When this queue is full, all non-whitelisted clients will -receive a 421 reponse. -.PP -This feature is available in Postfix 2.7. -.SH postscreen_whitelist_networks (default: $mynetworks) -Network addresses that are permanently whitelisted, and that -will not be subjected to \fBpostscreen\fR(8) checks. This parameter uses -the same address syntax as the mynetworks parameter. This feature -never uses the remote SMTP client hostname. -.PP -This feature is available in Postfix 2.7. .SH prepend_delivered_header (default: command, file, forward) The message delivery contexts where the Postfix \fBlocal\fR(8) delivery agent prepends a Delivered-To: message header with the address @@ -4331,8 +4177,8 @@ the \fBtransport\fR(5) table. .PP Specify a string of the form \fItransport:nexthop\fR, where \fItransport\fR is the name of a mail delivery transport defined in master.cf. -The \fI:nexthop\fR part is optional. For more details see the -\fBtransport\fR(5) manual page. +The \fI:nexthop\fR destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent. .PP See also the relay domains address class in the ADDRESS_CLASS_README file. @@ -4423,10 +4269,10 @@ remote_header_rewrite_domain = .ft R .in -4 .SH require_home_directory (default: no) -Whether or not a \fBlocal\fR(8) recipient's home directory must exist +Require that a \fBlocal\fR(8) recipient's home directory exists before mail delivery is attempted. By default this test is disabled. It can be useful for environments that import home directories to -the mail server (NOT RECOMMENDED). +the mail server (IMPORTING HOME DIRECTORIES IS NOT RECOMMENDED). .SH resolve_dequoted_address (default: yes) Resolve a recipient address safely instead of correctly, by looking inside quotes. @@ -5800,50 +5646,34 @@ The minimum TLS cipher grade that the Postfix SMTP client will use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may want to enforce TLS, and -is beyond the reach of today's crypt-analytic methods. See +is beyond the reach of today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis. .PP The following cipher grades are supported: .IP "\fBexport\fR" -Enable the mainstream "EXPORT" grade or better OpenSSL -ciphers. This is always used for opportunistic encryption. It is +Enable "EXPORT" grade or better OpenSSL +ciphers. This is the default for opportunistic encryption. It is not recommended for mandatory encryption unless you must enforce TLS with "crippled" peers. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_export_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the client is configured to verify server certificates. If you must -exclude anonymous ciphers also at the "encrypt" security level, set -"smtp_tls_mandatory_exclude_ciphers = aNULL". +encouraged to not change. .IP "\fBlow\fR" -Enable the mainstream "LOW" grade or better OpenSSL ciphers. This +Enable "LOW" grade or better OpenSSL ciphers. This setting is only appropriate for internal mail servers. The underlying cipherlist is specified via the tls_low_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_low_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL". +parameter, which you are strongly encouraged to not change. .IP "\fBmedium\fR" -Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. +Enable "MEDIUM" grade or better OpenSSL ciphers. The underlying cipherlist is specified via the tls_medium_cipherlist configuration parameter, which you are strongly encouraged to not change. -The default value of tls_medium_cipherlist includes anonymous ciphers, -but these are automatically filtered out if the client is configured to -verify server certificates. If you must exclude anonymous ciphers also -at the "encrypt" security level, set "smtp_tls_mandatory_exclude_ciphers -= aNULL". .IP "\fBhigh\fR" -Enable only the mainstream "HIGH" grade OpenSSL ciphers. This -setting is appropriate when all mandatory TLS destinations support -some of "HIGH" grade ciphers, this is not uncommon. The underlying -cipherlist is specified via the tls_high_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_high_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL". +Enable only "HIGH" grade OpenSSL ciphers. This setting may +be appropriate when all mandatory TLS destinations (e.g. when all +mail is routed to a suitably capable relayhost) support at least one +"HIGH" grade cipher. The underlying cipherlist is specified via the +tls_high_cipherlist configuration parameter, which you are strongly +encouraged to not change. .IP "\fBnull\fR" Enable only the "NULL" OpenSSL ciphers, these provide authentication without encryption. This setting is only appropriate in the rare case @@ -5852,9 +5682,17 @@ in TLS servers). A plausible use-case is an LMTP server listening on a UNIX-domain socket that is configured to support "NULL" ciphers. The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly encouraged to not -change. The default value of tls_null_cipherlist excludes anonymous -ciphers (OpenSSL 0.9.8 has NULL ciphers that offer data integrity without -encryption or authentication). +change. +.PP +The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +Postfix SMTP client is configured to verify server certificates. +You are very unlikely to need to take any steps to exclude anonymous +ciphers, they are excluded automatically as necessary. If you must +exclude anonymous ciphers at the "may" or "encrypt" security levels, +when the Postfix SMTP client does not need or use peer certificates, set +"smtp_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only when +TLS is enforced, set "smtp_tls_mandatory_exclude_ciphers = aNULL". .PP This feature is available in Postfix 2.3 and later. .SH smtp_tls_mandatory_exclude_ciphers (default: empty) @@ -6285,7 +6123,7 @@ smtp_tls_security_level = none # Opportunistic TLS. smtp_tls_security_level = may # Postfix >= 2.6: -# Do not tweak opportunistic ciphers unless it is essential +# Do not tweak opportunistic ciphers or protocol unless it is essential # to do so (if a security vulnerability is found in the SSL library that # can be mitigated by disabling a particular protocol or raising the # cipher grade from "export" to "low" or "medium"). @@ -7949,12 +7787,6 @@ smtpd_sender_restrictions = reject_unknown_sender_domain, .fi .ad .ft R -.SH smtpd_service (default: smtpd) -The internal service that \fBpostscreen\fR(8) forwards allowed -connections to. In a future version there may be different -classes of SMTP service. -.PP -This feature is available in Postfix 2.7. .SH smtpd_soft_error_limit (default: 10) The number of errors a remote SMTP client is allowed to make without delivering mail before the Postfix SMTP server slows down all its @@ -8465,69 +8297,63 @@ loglevel 4 is strongly discouraged. .PP This feature is available in Postfix 2.2 and later. .SH smtpd_tls_mandatory_ciphers (default: medium) -The minimum TLS cipher grade that the Postfix SMTP server -will use with mandatory TLS encryption. Cipher types listed in -smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are -excluded from the base definition of the selected cipher grade. See -smtpd_tls_ciphers for cipher controls that apply to opportunistic -TLS. +The minimum TLS cipher grade that the Postfix SMTP server will +use with mandatory TLS encryption. The default grade ("medium") is +sufficiently strong that any benefit from globally restricting TLS +sessions to a more stringent grade is likely negligible, especially +given the fact that many implementations still do not offer any stronger +("high" grade) ciphers, while those that do, will always use "high" +grade ciphers. So insisting on "high" grade ciphers is generally +counter-productive. Allowing "export" or "low" ciphers is typically +not a good idea, as systems limited to just these are limited to +obsolete browsers. No known SMTP clients fail to support at least +one "medium" or "high" grade cipher. .PP The following cipher grades are supported: .IP "\fBexport\fR" -Enable the mainstream "EXPORT" grade or better OpenSSL ciphers. +Enable "EXPORT" grade or stronger OpenSSL ciphers. This is the most appropriate setting for public MX hosts, and is always used with opportunistic TLS encryption. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, -which you are strongly encouraged to not change. The default value -of tls_export_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the server is configured to ask for -client certificates. If you must always exclude anonymous ciphers, -set "smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers -only when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = -aNULL". +which you are strongly encouraged to not change. .IP "\fBlow\fR" -Enable the mainstream "LOW" grade or better OpenSSL ciphers. The +Enable "LOW" grade or stronger OpenSSL ciphers. The underlying cipherlist is specified via the tls_low_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_low_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL". +not change. .IP "\fBmedium\fR" -Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. These -are essentially the 128-bit or stronger ciphers. This is the default -minimum strength for mandatory TLS encryption. MSAs that enforce -TLS and have clients that do not support any "MEDIUM" or "HIGH" -grade ciphers, may need to configure a weaker ("low" or "export") -minimum cipher grade. The underlying cipherlist is specified via the -tls_medium_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_medium_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL". +Enable "MEDIUM" grade or stronger OpenSSL ciphers. These use 128-bit +or longer symmetric bulk-encryption keys. This is the default minimum +strength for mandatory TLS encryption. The underlying cipherlist is +specified via the tls_medium_cipherlist configuration parameter, which +you are strongly encouraged to not change. .IP "\fBhigh\fR" -Enable only the mainstream "HIGH" grade OpenSSL ciphers. The +Enable only "HIGH" grade OpenSSL ciphers. The underlying cipherlist is specified via the tls_high_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_high_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL". +not change. .IP "\fBnull\fR" Enable only the "NULL" OpenSSL ciphers, these provide authentication without encryption. This setting is only appropriate in the rare case that all clients are prepared to use NULL ciphers (not normally enabled in TLS clients). The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_null_cipherlist -excludes anonymous ciphers (OpenSSL 0.9.8 has NULL ciphers that offer -data integrity without encryption or authentication). +encouraged to not change. +.PP +Cipher types listed in +smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are +excluded from the base definition of the selected cipher grade. See +smtpd_tls_ciphers for cipher controls that apply to opportunistic +TLS. +.PP +The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +server is configured to ask for client certificates. You are very +unlikely to need to take any steps to exclude anonymous ciphers, they +are excluded automatically as required. If you must exclude anonymous +ciphers even when Postfix does not need or use peer certificates, set +"smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only +when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = aNULL". .PP This feature is available in Postfix 2.3 and later. .SH smtpd_tls_mandatory_exclude_ciphers (default: empty) @@ -9521,8 +9347,8 @@ This information can be overruled with the \fBtransport\fR(5) table. .PP Specify a string of the form \fItransport:nexthop\fR, where \fItransport\fR is the name of a mail delivery transport defined in master.cf. -The \fI:nexthop\fR part is optional. For more details see the -\fBtransport\fR(5) manual page. +The \fI:nexthop\fR destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent. .PP This feature is available in Postfix 2.0 and later. .SH virtual_uid_maps (default: empty) diff --git a/postfix/man/man5/regexp_table.5 b/postfix/man/man5/regexp_table.5 index d67d710a8..991088d33 100644 --- a/postfix/man/man5/regexp_table.5 +++ b/postfix/man/man5/regexp_table.5 @@ -80,7 +80,8 @@ delimiters. The regular expression syntax is documented in \fBre_format\fR(7) with 4.4BSD, in \fBregex\fR(5) with Solaris, and in \fBregex\fR(7) with Linux. Other systems may use other document names. -The expression delimiter can be any character, except whitespace +The expression delimiter can be any non-alphanumerical +character, except whitespace or characters that have special meaning (traditionally the forward slash is used). The regular expression can contain whitespace. diff --git a/postfix/man/man8/dnsblog.8 b/postfix/man/man8/dnsblog.8 deleted file mode 100644 index f18b81c3b..000000000 --- a/postfix/man/man8/dnsblog.8 +++ /dev/null @@ -1,89 +0,0 @@ -.TH DNSBLOG 8 -.ad -.fi -.SH NAME -dnsblog -\- -Postfix DNS blocklist logger -.SH "SYNOPSIS" -.na -.nf -\fBdnsblog\fR [generic Postfix daemon options] -.SH DESCRIPTION -.ad -.fi -The \fBdnsblog\fR(8) server implements an ad-hoc DNS blocklist -lookup service that will eventually be replaced by an UDP -client that is built directly into the \fBpostscreen\fR(8) -server. - -With each connection, the \fBdnsblog\fR(8) server receives -a DNS blocklist domain name and an IP address. If the address -is listed under the DNS blocklist, the \fBdnsblog\fR(8) -server logs the match and replies with the query arguments -plus a non-zero status. Otherwise it replies with the query -arguments plus a zero status. Finally, The \fBdnsblog\fR(8) -server closes the connection. -.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 picked up automatically, as -\fBdnsblog\fR(8) processes run for only a limited amount -of time. 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. -.IP "\fBconfig_directory (see 'postconf -d' output)\fR" -The default location of the Postfix main.cf and master.cf -configuration files. -.IP "\fBdaemon_timeout (18000s)\fR" -How much time a Postfix daemon process may take to handle a -request before it is terminated by a built-in watchdog timer. -.IP "\fBpostscreen_dnsbl_sites (empty)\fR" -Optional list of DNS blocklist domains. -.IP "\fBipc_timeout (3600s)\fR" -The time limit for sending or receiving information over an internal -communication channel. -.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 "\fBqueue_directory (see 'postconf -d' output)\fR" -The location of the Postfix top-level queue directory. -.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 -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 is temporary with Postfix version 2.7. -.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/man/man8/postscreen.8 b/postfix/man/man8/postscreen.8 deleted file mode 100644 index ea3e7d941..000000000 --- a/postfix/man/man8/postscreen.8 +++ /dev/null @@ -1,365 +0,0 @@ -.TH POSTSCREEN 8 -.ad -.fi -.SH NAME -postscreen -\- -Postfix SMTP triage server -.SH "SYNOPSIS" -.na -.nf -\fBpostscreen\fR [generic Postfix daemon options] -.SH DESCRIPTION -.ad -.fi -The Postfix \fBpostscreen\fR(8) server performs triage on -multiple inbound SMTP connections in parallel. While -\fBpostscreen\fR(8) keeps zombies and other bogus clients -away from Postfix SMTP server processes, more Postfix SMTP -server processes remain available for legitimate clients. -.SH "GENERAL OPERATION" -.na -.nf -.ad -.fi -The triage process involves a number of tests, in the order -as described below. Some tests introduce a delay of a few -seconds. Once a client passes all tests, its IP address -is temporarily excluded from the tests, typically for 24 -hours. This minimizes the impact of the tests on legitimate -mail clients. - -After logging the result of its tests, \fBpostscreen\fR(8) -by default forwards all connections to a real SMTP server -process. This mode is useful for non-destructive testing. - -In a typical production setting, \fBpostscreen\fR(8) is -configured to disconnect clients that fail some tests. A -future implementation may pass the connection to a dummy -SMTP protocol engine that logs sender and recipient information -before hanging up. - -Note: \fBpostscreen\fR(8) is not an SMTP proxy; this is -intentional. The purpose is to prioritize legitimate clients -with as little overhead as possible. -.SH 1. PERMANENT WHITELIST TEST -.ad -.fi -The postscreen_whitelist_networks parameter (default: -$mynetworks) specifies a permanent whitelist for SMTP client -IP addresses. - -When the SMTP client address matches the permanent whitelist, -this is logged as: -.sp -.nf -\fBWHITELISTED \fIaddress\fR -.fi -.sp -The action is not configurable: immediately forward the -connection to a real SMTP server process. -.SH 2. PERMANENT BLACKLIST TEST -.ad -.fi -The postscreen_blacklist_networks parameter (default: empty) -specifies a permanent blacklist for SMTP client IP addresses. -The address syntax is as with mynetworks. - -When the SMTP client address matches the permanent blacklist, -this is logged as: -.sp -.nf -\fBBLACKLISTED \fIaddress\fR -.fi -.sp -The postscreen_blacklist_action parameter specifies the -action that is taken next: -.IP "\fBcontinue\fR (default)" -Continue with the SMTP GREETING PHASE TESTS below. -.IP \fBdrop\fR -Drop the connection immediately with a 521 SMTP reply. In -a future implementation, the connection may instead be -passed to a dummy SMTP protocol engine that logs sender and -recipient information. -.SH 3. TEMPORARY WHITELIST TEST -.ad -.fi -The \fBpostscreen\fR(8) daemon maintains a \fItemporary\fR -whitelist for SMTP client IP addresses that have passed all -the tests described below. The postscreen_cache_map parameter -specifies the location of the temporary whitelist. The -temporary whitelist is not used for SMTP client addresses -that appear on the \fIpermanent\fR blacklist or whitelist. - -When the SMTP client address appears on the temporary -whitelist, this is logged as: -.sp -.nf -\fBPASS OLD \fIaddress\fR -.fi -.sp -The action is not configurable: immediately forward the -connection to a real SMTP server process. The client is -excluded from further tests until its temporary whitelist -entry expires, as controlled with the postscreen_cache_ttl -parameter. Expired entries are silently renewed if possible. -.SH 4. SMTP GREETING PHASE TESTS -.ad -.fi -The postscreen_greet_wait parameter specifies a time interval -during which \fBpostscreen\fR(8) runs a number of tests in -parallel. These tests are described below, and are run -before the client may see the real SMTP server's "220 -text..." server greeting. - -When the SMTP client passes all greeting-phase tests, this -is logged as: -.sp -.nf -\fBPASS NEW \fIaddress\fR -.fi -.sp -The action is to forward the connection to a real SMTP -server process and to create a temporary whitelist entry -that excludes the client IP address from further tests until -the temporary whitelist entry expires, as controlled with -the postscreen_cache_ttl parameter. - -In a future implementation, the connection may first be passed to -a dummy SMTP protocol engine that implements more protocol -tests including greylisting, before the client is allowed -to talk to a real SMTP server process. -.SH 4A. PREGREET TEST -.ad -.fi -The postscreen_greet_banner parameter specifies the \fItext\fR -portion of a "220-\fItext\fR..." teaser banner (default: -$smtpd_banner). -The \fBpostscreen\fR(8) daemon sends this before the -postscreen_greet_wait timer is started. The purpose of the -teaser banner is to confuse SPAM clients so that they speak -before their turn. It has no effect on SMTP clients that -correctly implement the protocol. - -To avoid problems with broken SMTP engines in network -appliances, either exclude them from all tests with the -postscreen_whitelist_networks feature or else specify an -empty postscreen_greet_banner value to disable the "220-text..." -teaser banner. - -When an SMTP client sends a command before the -postscreen_greet_wait time has elapsed, this is logged as: -.sp -.nf -\fBPREGREET \fIcount \fBafter \fItime \fBfrom \fIaddress text...\fR -.fi -.sp -Translation: the client at \fIaddress\fR sent \fIcount\fR -bytes before its turn to speak, and this happened \fItime\fR -seconds after the postscreen_greet_wait timer was started. -The \fItext\fR is what the client sent (truncated to 100 -bytes, and with non-printable characters replaced with "?"). - -The postscreen_greet_action parameter specifies the action -that is taken next: -.IP "\fBcontinue\fR (default)" -Wait until the postscreen_greet_wait time has elapsed, then -report DNSBL lookup results if applicable. Either perform -DNSBL-related actions or forward the connection to a real -SMTP server process. -.IP \fBdrop\fR -Drop the connection immediately with a 521 SMTP reply. -In a future implementation, the connection may instead be passed -to a dummy SMTP protocol engine that logs sender and recipient -information. -.SH 4B. HANGUP TEST -.ad -.fi -When the SMTP client hangs up without sending any data -before the postscreen_greet_wait time has elapsed, this is -logged as: -.sp -.nf -\fBHANGUP after \fItime \fBfrom \fIaddress\fR -.fi -.sp -The postscreen_hangup_action specifies the action -that is taken next: -.IP "\fBcontinue\fR (default)" -Wait until the postscreen_greet_wait time has elapsed, then -report DNSBL lookup results if applicable. Do not forward -the broken connection to a real SMTP server process. -.IP \fBdrop\fR -Drop the connection immediately. -.SH 4C. DNS BLOCKLIST TEST -.ad -.fi -The postscreen_dnsbl_sites parameter (default: empty) -specifies a list of DNS blocklist servers. These lookups -are made in parallel. - -When the postscreen_greet_wait time has elapsed, and the -SMTP client address is listed with at least one of these -blocklists, this is logged as: -.sp -.nf -\fBDNSBL rank \fIcount \fBfor \fIaddress\fR -.fi -.sp -Translation: the client at \fIaddress\fR is listed with -\fIcount\fR DNSBL servers. The \fIcount\fR does not -depend on the number of DNS records that an individual DNSBL -server returns. - -The postscreen_dnsbl_action parameter specifies the action -that is taken next: -.IP "\fBcontinue\fR (default)" -Forward the connection to a real SMTP server process. -.IP \fBdrop\fR -Drop the connection immediately with a 521 SMTP reply. -In a future implementation, the connection may instead be passed -to a dummy SMTP protocol engine that logs sender and recipient -information. -.SH "SECURITY" -.na -.nf -.ad -.fi -The \fBpostscreen\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 "STANDARDS" -.na -.nf -RFC 5321 (SMTP, including multi-line 220 greetings) -RFC 2920 (SMTP Pipelining) -.SH DIAGNOSTICS -.ad -.fi -Problems and transactions are logged to \fBsyslogd\fR(8). -.SH "CONFIGURATION PARAMETERS" -.na -.nf -.ad -.fi -Changes to main.cf are not picked up automatically, as -\fBpostscreen\fR(8) processes may run for several hours. -Use the command "postfix reload" after a configuration -change. - -The text below provides only a parameter summary. See -\fBpostconf\fR(5) for more details including examples. -.SH "TRIAGE PARAMETERS" -.na -.nf -.ad -.fi -.IP "\fBpostscreen_blacklist_action (continue)\fR" -The action that \fBpostscreen\fR(8) takes when an SMTP client is -permanently blacklisted with the postscreen_blacklist_networks -parameter. -.IP "\fBpostscreen_blacklist_networks (empty)\fR" -Network addresses that are permanently blacklisted; see the -postscreen_blacklist_action parameter for possible actions. -.IP "\fBpostscreen_dnsbl_action (continue)\fR" -The action that \fBpostscreen\fR(8) takes when an SMTP client is listed -at the DNS blocklist domains specified with the postscreen_dnsbl_sites -parameter. -.IP "\fBpostscreen_dnsbl_sites (empty)\fR" -Optional list of DNS blocklist domains. -.IP "\fBpostscreen_greet_action (continue)\fR" -The action that \fBpostscreen\fR(8) takes when an SMTP client speaks -before its turn within the time specified with the postscreen_greet_wait -parameter. -.IP "\fBpostscreen_greet_banner ($smtpd_banner)\fR" -The \fItext\fR in the optional "220-\fItext\fR..." server -response that -\fBpostscreen\fR(8) sends ahead of the real Postfix SMTP server's "220 -text..." response, in an attempt to confuse bad SMTP clients so -that they speak before their turn (pre-greet). -.IP "\fBpostscreen_greet_wait (4s)\fR" -The amount of time that \fBpostscreen\fR(8) will wait for an SMTP -client to send a command before its turn, and for DNS blocklist -lookup results to arrive. -.IP "\fBpostscreen_hangup_action (continue)\fR" -The action that \fBpostscreen\fR(8) takes when an SMTP client disconnects -without sending data, within the time specified with the -postscreen_greet_wait parameter. -.IP "\fBpostscreen_post_queue_limit ($default_process_limit)\fR" -The number of clients that can be waiting for service from a -real SMTP server process. -.IP "\fBpostscreen_pre_queue_limit ($default_process_limit)\fR" -The number of non-whitelisted clients that can be waiting for -a decision whether they will receive service from a real SMTP server -process. -.IP "\fBpostscreen_whitelist_networks ($mynetworks)\fR" -Network addresses that are permanently whitelisted, and that -will not be subjected to \fBpostscreen\fR(8) checks. -.IP "\fBsmtpd_service (smtpd)\fR" -The internal service that \fBpostscreen\fR(8) forwards allowed -connections to. -.SH "CACHE CONTROLS" -.na -.nf -.ad -.fi -.IP "\fBpostscreen_cache_cleanup_interval (12h)\fR" -The amount of time between \fBpostscreen\fR(8) cache cleanup runs. -.IP "\fBpostscreen_cache_map (btree:$data_directory/ps_whitelist)\fR" -Persistent storage for the \fBpostscreen\fR(8) server decisions. -.IP "\fBpostscreen_cache_retention_time (1d)\fR" -The amount of time that \fBpostscreen\fR(8) will cache an expired -temporary whitelist entry before it is removed. -.IP "\fBpostscreen_cache_ttl (1d)\fR" -The amount of time that \fBpostscreen\fR(8) will cache a decision for -a specific SMTP client IP address. -.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 "\fBdaemon_timeout (18000s)\fR" -How much time a Postfix daemon process may take to handle a -request before it is terminated by a built-in watchdog timer. -.IP "\fBdelay_logging_resolution_limit (2)\fR" -The maximal number of digits after the decimal point when logging -sub-second delay values. -.IP "\fBcommand_directory (see 'postconf -d' output)\fR" -The location of all postfix administrative commands. -.IP "\fBipc_timeout (3600s)\fR" -The time limit for sending or receiving information over an internal -communication channel. -.IP "\fBmax_idle (100s)\fR" -The maximum amount of time that an idle Postfix daemon process waits -for an incoming connection before terminating voluntarily. -.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 -smtpd(8), Postfix SMTP server -dnsblog(8), temporary DNS helper -syslogd(8), system logging -.SH "LICENSE" -.na -.nf -.ad -.fi -The Secure Mailer license must be distributed with this software. -.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/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index e8970b1f9..9c812e944 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -108,8 +108,6 @@ Available in Postfix version 2.1 and later: Resolve an address that ends in the "@" null domain as if the local hostname were specified, instead of rejecting the address as invalid. -.IP "\fBsmtpd_command_filter (empty)\fR" -A mechanism to transform commands from remote SMTP clients. .IP "\fBsmtpd_reject_unlisted_sender (no)\fR" Request that the Postfix SMTP server rejects mail from unknown sender addresses, even when no explicit reject_unlisted_sender @@ -141,6 +139,10 @@ is empty). Available in Postfix version 2.6 and later: .IP "\fBtcp_windowsize (0)\fR" An optional workaround for routers that break TCP window scaling. +.PP +Available in Postfix version 2.7 and later: +.IP "\fBsmtpd_command_filter (empty)\fR" +A mechanism to transform commands from remote SMTP clients. .SH "ADDRESS REWRITING CONTROLS" .na .nf diff --git a/postfix/man/man8/verify.8 b/postfix/man/man8/verify.8 index f6646a7c3..8806b5911 100644 --- a/postfix/man/man8/verify.8 +++ b/postfix/man/man8/verify.8 @@ -36,7 +36,8 @@ The \fBverify\fR(8) server implements the following requests: .IP "\fBupdate\fI address status text\fR" Update the status and text of the specified address. .IP "\fBquery\fI address\fR" -Look up the \fIstatus\fR and \fItext\fR for the specified address. +Look up the \fIstatus\fR and \fItext\fR for the specified +\fIaddress\fR. If the status is unknown, a probe is sent and an "in progress" status is returned. .SH "SECURITY" @@ -49,7 +50,8 @@ not talk to the network, and it does not talk to local users. The verify server can run chrooted at fixed low privilege. The address verification server can be coerced to store -unlimited amounts of garbage. Limiting the cache size +unlimited amounts of garbage. Limiting the cache expiry +time trades one problem (disk space exhaustion) for another one (poor response time to client requests). @@ -67,11 +69,13 @@ Problems and transactions are logged to \fBsyslogd\fR(8). .SH BUGS .ad .fi -The address verification service is suitable only for sites that -handle a low mail volume. Verification probes add additional -traffic to the mail queue and perform poorly under high load. -Servers may blacklist sites that probe excessively, or that -probe excessively for non-existent recipient addresses. +Address verification probe messages add additional traffic +to the mail queue. +Recipient verification may cause an increased load on +down-stream servers in the case of a dictionary attack or +a flood of backscatter bounces. +Sender address verification may cause your site to be +blacklisted by some providers. If the persistent database ever gets corrupted then the world comes to an end and human intervention is needed. This violates @@ -83,7 +87,7 @@ a basic Postfix principle. .fi Changes to \fBmain.cf\fR are not picked up automatically, as \fBverify\fR(8) -processes are persistent. Use the command "\fBpostfix reload\fR" after +processes are long-lived. Use the command "\fBpostfix reload\fR" after a configuration change. The text below provides only a parameter summary. See diff --git a/postfix/mantools/make-relnotes b/postfix/mantools/make-relnotes index 2cc5b4fe3..4d07e6632 100755 --- a/postfix/mantools/make-relnotes +++ b/postfix/mantools/make-relnotes @@ -18,7 +18,7 @@ $append_to = \%leader; while (<>) { - if (/^Incompatible changes with/) { + if (/^(Incompatible changes|Incompatibility) with/) { die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/; $append_to = \%body; $prefix = "[Incompat $1] "; diff --git a/postfix/mantools/make_soho_readme b/postfix/mantools/make_soho_readme index 3d018dbb2..abeddde74 100755 --- a/postfix/mantools/make_soho_readme +++ b/postfix/mantools/make_soho_readme @@ -47,11 +47,11 @@ Internet hostname @@ -72,8 +72,9 @@ sed -n '/^

      /,${ p }' STANDARD_CONFIGURATION_README.html -sed -n '/^

      /,${ - /^

      /h2>/g p }' SASL_README.html diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index 583a66cb8..de775e6e1 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -523,6 +523,7 @@ while (<>) { s;\bsmtpd_reject_unlisted_recip[-]*\n* *[]*ient\b;$&;g; s;\bsmtpd_reject_unlisted_sender\b;$&;g; s;\bsmtpd_restriction_classes\b;$&;g; + s;\bsmtpd_sasl_application_name\b;$&;g; s;\bsmtpd_sasl_path\b;$&;g; s;\bcyrus_sasl_config_path\b;$&;g; s;\bsmtpd_sasl_auth_enable\b;$&;g; diff --git a/postfix/proto/ADDRESS_VERIFICATION_README.html b/postfix/proto/ADDRESS_VERIFICATION_README.html index e8f50df60..4507b8bce 100644 --- a/postfix/proto/ADDRESS_VERIFICATION_README.html +++ b/postfix/proto/ADDRESS_VERIFICATION_README.html @@ -19,12 +19,11 @@

      WARNING

      -

      The sender/recipient address verification feature described in this -document is suitable only for low-traffic sites. It performs poorly -under high load; excessive sender address verification activity may -even cause your site to be blacklisted by some -providers. See the "Limitations" section -below for details.

      +

      Recipient address verification may cause an increased load on +down-stream servers in the case of a dictionary attack or a flood +of backscatter bounces. Sender address verification may cause your +site to be blacklisted by some providers. See also the "Limitations" section below for more.

      What Postfix address verification can do for you

      @@ -35,7 +34,7 @@ until the address has been verified to be deliverable.

      The technique has obvious uses to reject junk mail with an unreplyable sender address.

      -

      The technique may also be useful to block mail for undeliverable +

      The technique is also useful to block mail for undeliverable recipients, for example on a mail relay host that does not have a list of all the valid recipient addresses. This prevents undeliverable junk mail from entering the queue, so that Postfix doesn't have to @@ -86,74 +85,96 @@ always discarded.

      - +
      - + + - + - + - + - + + + + + + + + + + + - - + - + - + - + - + - + + + - + - + + + - - - + - + - + - + - + - + - + - + @@ -181,7 +202,8 @@ details.

      MTA for that address, without actually delivering mail to it. If the nearest MTA accepts the address, then Postfix assumes that the address is deliverable. In reality, mail for a remote address can -bounce AFTER the nearest MTA accepts the recipient address.

      +bounce AFTER the nearest MTA accepts the recipient address, or AFTER +the nearest MTA accepts the message content.

    • Some sites may blacklist you when you are probing them too often (a probe is an SMTP session that does not deliver mail), @@ -200,21 +222,25 @@ mail routing and for possible limitations when you have to do this.

    • Postfix assumes that an address is undeliverable when the nearest MTA for the address rejects the probe, regardless of the reason for rejection (client rejected, HELO rejected, MAIL FROM -rejected, etc.). Thus, Postfix rejects mail when the sender's MTA -rejects mail from your machine. This is a good thing.

      +rejected, etc.). Thus, Postfix rejects an address when the nearest +MTA for that address rejects mail from your machine for any reason. +This is not a limitation, but it is mentioned here just in case +people believe that it is a limitation.

      -
    • Unfortunately, some major sites such as YAHOO do not reject +

    • Unfortunately, some sites do not reject unknown addresses in reply to the RCPT TO command, but report a delivery failure in response to end of DATA after a message is transferred. Postfix address verification does not work with such sites.

      -
    • By default, Postfix probe messages have "double-bounce@$myorigin" -as the sender address (with Postfix versions before 2.5, the default +

    • By default, Postfix probe messages have a sender address +"double-bounce@$myorigin" (with Postfix versions before 2.5, the +default is "postmaster@$myorigin"). This is SAFE because the Postfix SMTP server does not reject mail for this address.

      -

      You can change this into the null address ("address_verify_sender +

      You can change the probe sender address into the null address +("address_verify_sender ="). This is UNSAFE because address probes will fail with mis-configured sites that reject MAIL FROM: <>, while probes from "postmaster@$myorigin" would succeed.

      @@ -223,7 +249,7 @@ probes from "postmaster@$myorigin" would succeed.

      Recipient address verification

      -

      As mentioned earlier, recipient address verification may be +

      As mentioned earlier, recipient address verification is useful to block mail for undeliverable recipients on a mail relay host that does not have a list of all valid recipient addresses. This can help to prevent the mail queue from filling up with @@ -237,9 +263,11 @@ However, recipient address verification probes can increase the load on down-stream MTAs when you're being flooded by backscatter bounces, or when some spammer is mounting a dictionary attack.

      -

      By default, address verification results are not saved. To avoid -probing the same address repeatedly, you can store the result in a -persistent database as described later.

      +

      By default, address verification results are saved in a persistent database (Postfix version 2.7 and +later; with earlier versions, specify the database in main.cf as +described later). The persistent database helps to avoid probing +the same address repeatedly.

      @@ -299,11 +327,13 @@ in forged email.  

      # Postfix 2.6 and later. # unverified_sender_defer_code = 250 + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify /etc/postfix/sender_access: + # Don't do this when you handle lots of email. aol.com reject_unverified_sender hotmail.com reject_unverified_sender bigfoot.com reject_unverified_sender @@ -344,6 +374,7 @@ you can see what mail would be blocked:

      # Postfix 2.6 and later. # unverified_sender_reject_reason = Address verification failed + # Default setting for Postfix 2.7 and later. # Note 1: Be sure to read the "Caching" section below! # Note 2: Avoid hash files here. Use btree instead. address_verify_map = btree:/var/lib/postfix/verify @@ -403,7 +434,8 @@ sender address verification probe fails with some temporary error.

      Address verification database

      To improve performance, the Postfix verify(8) daemon can save -address verification results to a persistent database. The +address verification results to a persistent database. This is +enabled by default with Postfix 2.7 and later. The address_verify_map (NOTE: singular) configuration parameter specifies persistent storage for sender or recipient address verification results. If you specify an empty value, all address verification diff --git a/postfix/proto/OVERVIEW.html b/postfix/proto/OVERVIEW.html index ac8bbd476..062d460ab 100644 --- a/postfix/proto/OVERVIEW.html +++ b/postfix/proto/OVERVIEW.html @@ -651,31 +651,126 @@ align="center" bgcolor="#f0f0ff"> smtp
      session
      cache

    • The verify(8) server verifies that a sender or recipient address is deliverable before the smtpd(8) server accepts it. The -verify(8) server injects probe messages into the Postfix queue and -processes status updates from delivery agents and/or queue manager. +verify(8) server queries a cache with address verification results. +If a result is not found, the verify(8) server injects a probe +message into the Postfix queue and processes the status update from +a delivery agent or queue manager. This process is described in the ADDRESS_VERIFICATION_README document. The verify(8) service is available with Postfix version 2.1 and later.

    • Internet + +   -> -> probe
      + message
      Postfix
      SMTP
      server
      -> + <-> - + Postfix
      mail
      queue
      - Postfix
      verify
      server
      -
      Internet -> + + Postfix
      SMTP
      server
      <-> + <-> Address
      - verification
      database
      + Postfix
      verify
      server
      +
          |
      + v
      |
      - probe
      messages
      v
      ^
      delivery
      - status
      |
      <- + probe
      + status
      <- + + Postfix
      delivery
      agents
      -> + Local
      -> Remote
      +   + ^
      |
      v
      - Postfix
      queue
      ->
       
      - Postfix
      delivery
      agents
        + Address
      verification
      database
      - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Network -> smtpd(8) <-> verify(8) --> cleanup(8) - -> -qmgr(8)
      Postfix
      queue
      -> Delivery
      agents
      +   + -> probe
      message
      -> + Postfix
      mail
      queue
      -\
      \
      -
      <- <- - |
      v
      - /
      /
      +
      Network -> + smtpd(8) <-> verify(8) +
      |
      v
      <- + probe
      + status
      + <- Postfix
      delivery
      agents +
      -> + Local
      -> Network
      +   + ^
      |
      v
       
        Address
      + verification
      cache
      + +
    • The postscreen(8) server can be put "in front" of Postfix +smtpd(8) processes. Its purpose is to accept connections from the +network and to decide what SMTP clients are allowed to talk to +Postfix. According to the 2008 MessageLabs annual report, 81% of +all email was spam, and 90% of that was sent by botnets. While +postscreen(8) keeps the zombies away, more smtpd(8) processes remain +available for legitimate clients.

      + +

      The postscreen(8) server is still evolving, and is likely to +undergo changes that break compatibility with earlier versions. +For this reason the postscreen(8) server is not installed with the +stable Postfix release.

      + + + + + + + + + + + + + + + + + + + + + + + +
      zombie
      \
      zombie - + - smtpd(8)
      \ /
      other +--- +postscreen(8)
      / \
      other + - + - smtpd(8)
      /
      zombie
    diff --git a/postfix/proto/SASL_README.html b/postfix/proto/SASL_README.html index f62692288..3c6e558e9 100644 --- a/postfix/proto/SASL_README.html +++ b/postfix/proto/SASL_README.html @@ -1,8 +1,6 @@ - - Postfix SASL Howto @@ -17,803 +15,2116 @@
    -

    WARNING

    +

    Warning

    People who go to the trouble of installing Postfix may have the expectation that Postfix is more secure than some other mailers. -The Cyrus SASL library is a lot of code. With this, Postfix becomes -as secure as other mail systems that use the Cyrus SASL library. -Dovecot provides an alternative that may be worth considering. -

    +The Cyrus SASL library contains a lot of code. With this, Postfix +becomes as secure as other mail systems that use the Cyrus SASL +library. Dovecot provides an alternative that may be worth +considering.

    + +

    How Postfix uses SASL authentication

    + +

    When an SMTP client connects to an SMTP server, the server needs +to decide whether that client is authorized to send mail to remote +destinations, or whether the client can send mail only to the +destinations that the server itself is responsible for. Usually, +the SMTP server will allow mail to remote destinations only if the +client's IP address is in the "same network" as the server's IP +address.

    + +

    Sometimes the SMTP client and server are in different networks, +but the client still needs "same network" privileges. To address +this problem, Postfix supports SASL authentication (RFC 4954, +formerly RFC 2554). With this a remote SMTP client can authenticate +to the Postfix SMTP server, and the Postfix SMTP client can +authenticate to a remote SMTP server. Once the client is authenticated +the server can give it "same network" privileges.

    + +

    Postfix does not implement SASL itself, but instead uses existing +implementations as building blocks. This means that some SASL-related +configuration will involve files that belong to Postfix, while other +configuration will involve files that belong to the specific SASL +implementation that Postfix will use. This document covers both the +Postfix and non-Postfix configuration.

    + +

    You can read more about the following topics:

    -

    How Postfix uses SASL authentication information

    + -

    Postfix version 2.3 introduces a plug-in mechanism that provides -support for multiple SASL implementations. To find out what -implementations are built into Postfix, use the following commands: -

    +
  • Enabling SASL authentication and +authorization in the Postfix SMTP server -
    -
    -% postconf -a (SASL support in the SMTP server)
    -% postconf -A (SASL support in the SMTP+LMTP client)
    -
    -
    +
  • -
    -
    -% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
    -
    -
    +
  • Testing SASL authentication in the Postfix +SMTP server
  • + + -

    After this, proceed with "make" as described in the -INSTALL document.

    -

    Notes:

    +

    Which SASL Implementations are supported?

    -
      +

      Currently the Postfix SMTP server supports the Cyrus SASL and +Dovecot SASL implementations.

      -
    • The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just -makes Postfix configuration a little more convenient because you -don't have to specify the SASL plug-in type in the Postfix main.cf -file.

      +
      -
    • If you also want support for LDAP or TLS, you will have to merge -their CCARGS and AUXLIBS into the above command line.

      +Note -
    +

    Before Postfix version 2.3, Postfix had support only for Cyrus +SASL. Current Postfix versions have a plug-in architecture that +can support multiple SASL implementations.

    -

    Building the Cyrus SASL library

    + -

    Postfix appears to work with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, -which are available from:

    +

    To find out what SASL implementations are compiled into Postfix, +use the following commands:

    -ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
    +% postconf -a (SASL support in the SMTP server)
    +% postconf -A (SASL support in the SMTP+LMTP client)
     
    -

    IMPORTANT: if you install the Cyrus SASL libraries as per the -default, you will have to symlink /usr/lib/sasl -> /usr/local/lib/sasl -for version 1.5.x or /usr/lib/sasl2 -> /usr/local/lib/sasl2 for -version 2.1.x.

    - -

    Reportedly, Microsoft Outlook (Express) requires the -non-standard LOGIN authentication method. To enable this -authentication method, specify ``./configure --enable-login''.

    +

    These commands are available only with Postfix version 2.3 and +later.

    -

    Building Postfix with Cyrus SASL support

    +

    Configuring Dovecot SASL

    -

    These instructions assume that you build Postfix from source -code as described in the INSTALL document. Some modification may -be required if you build Postfix from a vendor-specific source -package.

    +

    Dovecot is a POP/IMAP server that must be configured to +authenticate POP/IMAP clients. When the Postfix SMTP server uses +Dovecot SASL, it also reuses this configuration. Consult the Dovecot documentation for how +to configure and operate the Dovecot authentication server.

    -

    The following -assumes that the Cyrus SASL include files are in /usr/local/include, -and that the Cyrus SASL libraries are in /usr/local/lib.

    +

    Postfix to Dovecot SASL communication

    -

    On some systems this generates the necessary Makefile definitions: +

    Communication between the Postfix SMTP server +and Dovecot SASL happens via a UNIX-domain socket. The socket +pathname and the list of mechanisms offered to Postfix need to be +specified on the Dovecot server side in dovecot.conf.

    -
    - -
    (for Cyrus SASL version 1.5.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"
    -
    +

    The following example assumes that the Postfix queue is under +/var/spool/postfix/.

    -
    (for Cyrus SASL version 2.1.x): -
    +
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"
    + 1 /etc/dovecot.conf:
    + 2     auth default {
    + 3       mechanisms = plain login
    + 4         passdb pam {
    + 5         }
    + 6         userdb passwd {
    + 7         }
    + 8         socket listen {
    + 9         client {
    +10           path = /var/spool/postfix/private/auth
    +11           mode = 0660
    +12           user = postfix
    +13           group = postfix
    +14         }
    +15       }
    +16     }
     
    +
    -
    +

    Line 3 provides plain and login as +mechanisms for the Postfix SMTP server, line 10 places the Dovecot +SASL socket in /var/spool/postfix/private/auth, and +lines 11-13 limit read+write permissions to user and group +postfix only.

    -

    On Solaris 2.x you need to specify run-time link information, -otherwise ld.so will not find the SASL shared library:

    +

    Proceed with the section "Enabling SASL authentication and +authorization in the Postfix SMTP server" to turn on and use +SASL in the Postfix SMTP server.

    -
    +

    Configuring Cyrus SASL

    -
    (for Cyrus SASL version 1.5.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include" AUXLIBS="-L/usr/local/lib \
    -    -R/usr/local/lib -lsasl"
    -
    +

    The Cyrus SASL framework was supports a wide variety of +applications. Different applications may require different +configurations. As a consequence each application may have its own +configuration file.

    -
    (for Cyrus SASL version 2.1.x): -
    -
    -% make tidy # if you have left-over files from a previous build
    -% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    -    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \
    -    -R/usr/local/lib -lsasl2"
    -
    +

    The first step configuring Cyrus SASL is to determine name and +location of a configuration file that describes how the Postfix +SMTP server will use the SASL framework.

    -
    +

    Cyrus SASL configuration file name

    -

    Enabling SASL authentication in the Postfix -SMTP server

    +

    The name of the configuration file (default: smtpd.conf) +is configurable. It is a concatenation from a value that the Postfix +SMTP server sends to the Cyrus SASL library, and the suffix +.conf, added by Cyrus SASL.

    -

    In order to enable SASL support in the Postfix SMTP server:

    +

    The value sent by Postfix is the name of the server component +that will use Cyrus SASL. It defaults to smtpd and +is configured with one of the following variables:

     /etc/postfix/main.cf:
    -    smtpd_sasl_auth_enable = yes
    -
    -
    - -

    In order to allow mail relaying by authenticated remote SMTP -clients:

    + # Postfix 2.3 and later + smtpd_sasl_path = smtpd -
    -
    -/etc/postfix/main.cf:
    -    smtpd_recipient_restrictions = 
    -        permit_mynetworks 
    -        permit_sasl_authenticated 
    -        reject_unauth_destination
    +    # Postfix < 2.3
    +    smtpd_sasl_application_name = smtpd
     
    -

    To report SASL login names in Received: message headers -(Postfix version 2.3 and later):

    +

    Cyrus SASL configuration file +location

    -
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_authenticated_header = yes
    -
    -
    +

    The location where Cyrus SASL searches for the named file depends +on the Cyrus SASL version and the OS/distribution used.

    -

    Note: the SASL login names will be shared with the entire world. -

    +

    You can read more about the following topics:

    -

    Older Microsoft SMTP client software implements a non-standard -version of the AUTH protocol syntax, and expects that the SMTP -server replies to EHLO with "250 AUTH=mechanism-list" instead of -"250 AUTH mechanism-list". To accommodate such clients (in addition -to conformant -clients) use the following:

    +
      -
      -
      -/etc/postfix/main.cf:
      -    broken_sasl_auth_clients = yes
      -
      -
      +
    • Cyrus SASL version 2.x searches for the configuration file +in /usr/lib/sasl2/.

    • -

      Dovecot SASL configuration for the -Postfix SMTP server

      +
    • Cyrus SASL version 2.1.22 and newer additionally search +in /etc/sasl2/.

    • + +
    • Some Postfix distributions are modified and look for the +Cyrus SASL configuration file in /etc/postfix/sasl/, +/var/lib/sasl2/ etc. See the distribution-specific +documentation to determine the expected location.

    • -

      Dovecot SASL support is available in Postfix 2.3 and later. On -the Postfix side you need to specify the location of the -Dovecot authentication daemon socket. We use a pathname relative -to the Postfix queue directory, so that it will work whether or not -the Postfix SMTP server runs chrooted:

      +
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_type = dovecot
    -    smtpd_sasl_path = private/auth
    -
    -
    -

    On the Dovecot side you also need to specify the Dovecot -authentication daemon socket. In this case we specify an -absolute pathname. In the example we assume that the -Postfix queue is under /var/spool/postfix/.

    +Note + +

    Cyrus SASL searches /usr/lib/sasl2/ first. If it +finds the specified configuration file there, it will not examine +other locations.

    -
    -
    -/some/where/dovecot.conf:
    -    auth default {
    -      mechanisms = plain login
    -      passdb pam {
    -      }
    -      userdb passwd {
    -      }
    -      socket listen {
    -        client {
    -          path = /var/spool/postfix/private/auth
    -          mode = 0660
    -          user = postfix
    -          group = postfix
    -        }
    -      }
    -    }
    -
    -

    See the Dovecot documentation for how to configure and operate -the Dovecot authentication server.

    +

    Postfix to Cyrus SASL communication

    -

    Cyrus SASL configuration for the Postfix -SMTP server

    +

    As the Postfix SMTP server is linked with the Cyrus SASL library +libsasl, communication between Postfix and Cyrus SASL +takes place by calling functions in the SASL library.

    -

    You need to configure how the Cyrus SASL library should -authenticate a remote SMTP client's username and password. These -settings must -be stored in a separate configuration file.

    +

    The SASL library may use an external password verification +service, or an internal plugin to connect to authentication backends +and verify the SMTP client's authentication data against the system +password file or other databases.

    -

    The name of the configuration file (default: smtpd.conf) will -be constructed from a value that the Postfix SMTP server sends to -the Cyrus SASL -library, which adds the suffix .conf. The value is configured using -one of the following variables:

    +

    The following table shows typical combinations discussed in +this document:

    -
    -/etc/postfix/main.cf:
    -    # Postfix 2.3 and later
    -    smtpd_sasl_path = smtpd
    -    # Postfix < 2.3
    -    smtpd_sasl_application_name = smtpd
    -
    -
    -

    Cyrus SASL searches for the configuration file in /usr/local/lib/sasl/ -(Cyrus SASL version 1.5.5) or /usr/local/lib/sasl2/ (Cyrus SASL -version 2.1.x).

    + -

    Note: some Postfix distributions are modified and look for -the smtpd.conf file in /etc/postfix/sasl.

    + -

    Note: some Cyrus SASL distributions look for the smtpd.conf -file in /etc/sasl2.

    + -
      +
    -
  • To authenticate against the UNIX password database, use:

    +
  • -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: pwcheck
    +
    - + -

    IMPORTANT: pwcheck establishes a UNIX domain socket in /var/pwcheck -and waits for authentication requests. The Postfix SMTP server must have -read+execute permission to this directory or authentication attempts -will fail.

    + -

    The pwcheck daemon is contained in the cyrus-sasl source tarball.

    + -
    (Cyrus SASL version 1.5.26) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: saslauthd
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -/usr/local/lib/sasl2/smtpd.conf:
    -    pwcheck_method: saslauthd
    -    mech_list: PLAIN LOGIN
    -
    +
    - + -

    The saslauthd daemon is also contained in the cyrus-sasl source -tarball. It is more flexible than the pwcheck daemon, in that it -can authenticate against PAM and various other sources. To use PAM, -start saslauthd with "-a pam".

    + -

    IMPORTANT: saslauthd usually establishes a UNIX domain socket -in /var/run/saslauthd and waits for authentication requests. The Postfix -SMTP server must have read+execute permission to this directory or -authentication attempts will fail.

    + -

    Note: The directory where saslauthd puts the socket is configurable. -See the command-line option "-m /path/to/socket" in the saslauthd ---help listing.

    + -
  • To authenticate against Cyrus SASL's own password database:

    +
  • -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -/usr/local/lib/sasl/smtpd.conf:
    -    pwcheck_method: sasldb
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -/usr/local/lib/sasl2/smtpd.conf:
    -    pwcheck_method: auxprop
    -    auxprop_plugin: sasldb
    -    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
    -
    +
    - + -

    This will use the Cyrus SASL password file (default: /etc/sasldb in -version 1.5.x, or /etc/sasldb2 in version 2.1.x), which is maintained -with the saslpasswd or saslpasswd2 command (part of the Cyrus SASL -software). On some poorly-supported systems the saslpasswd command needs -to be run multiple times before it stops complaining. The Postfix SMTP -server needs read access to the sasldb file - you may have to play games -with group access permissions. With the OTP authentication mechanism, -the Postfix SMTP server also needs WRITE access to /etc/sasldb2 or -/etc/sasldb -(or the back end SQL database, if used).

    + -

    IMPORTANT: To get sasldb running, make sure that you set the SASL -domain (realm) to a fully qualified domain name.

    + -

    EXAMPLE:

    + -
    -
    (Cyrus SASL version 1.5.x) -
    -
    -% saslpasswd -c -u `postconf -h myhostname` exampleuser
    -
    +
    -
    (Cyrus SASL version 2.1.x) -
    -
    -% saslpasswd2 -c -u `postconf -h myhostname` exampleuser
    -
    +
    - + -

    You can find out SASL's idea about the realms of the users -in sasldb with sasldblistusers (Cyrus SASL version 1.5.x) or -sasldblistusers2 (Cyrus SASL version 2.1.x).

    + -

    On the Postfix side, you can have only one realm per smtpd(8) -instance, and only the users belonging to that realm would be able to -authenticate. The Postfix variable smtpd_sasl_local_domain controls the -realm used by smtpd(8):

    + -
    -
    -/etc/postfix/main.cf:
    -    smtpd_sasl_local_domain = $myhostname
    -
    -
    + - + -

    IMPORTANT: The Cyrus SASL password verification services pwcheck -and saslauthd can only support the plaintext mechanisms PLAIN or -LOGIN. However, the Cyrus SASL library doesn't know this, and will -happily advertise other authentication mechanisms that the SASL -library implements, such as DIGEST-MD5. As a result, if a remote SMTP -client chooses any mechanism other than PLAIN or LOGIN while pwcheck -or saslauthd are used, authentication will fail. Thus you may need -to limit the list of mechanisms advertised by the Postfix SMTP -server.

    +
    authentication backendpassword verification service / plugin
    /etc/shadowsaslauthd
    PAMsaslauthd
    IMAP serversaslauthd
    sasldbsasldb
    MySQL, PostgreSQL, SQLitesql
    LDAPldapdb
    -
      + -
    • With older Cyrus SASL versions you remove the corresponding -library files from the SASL plug-in directory (and again whenever -the system is updated).

      +
      -
    • With Cyrus SASL version 2.1.x or later the mech_list variable -can specify a list of authentication mechanisms that Cyrus SASL may -offer:

      +Note + +

      Read the Cyrus SASL documentation for other backends it can +use.

      -
      -
      -/usr/local/lib/sasl2/smtpd.conf:
      -    mech_list: plain login
      -
      -
    +

    saslauthd - Cyrus SASL password verification service

    -

    For the same reasons you might want to limit the list of plugins -used for authentication.

    +

    Communication between the Postfix SMTP server (read: Cyrus SASL's +libsasl) and the saslauthd server takes +place over a UNIX-domain socket.

    -
      +

      saslauthd usually establishes the UNIX domain +socket in /var/run/saslauthd/ and waits for authentication +requests. The Postfix SMTP server must have read+execute permission +to this directory or authentication attempts will fail.

      + +
      + +Important + +

      Some distributions require the user postfix to be +member of a special group e.g. sasl, otherwise it +will not be able to access the saslauthd socket +directory.

      -
    • With Cyrus SASL version 1.5.x your only choice is to -delete the corresponding library files from the SASL plug-in -directory.

      +
    • -
    • With SASL version 2.1.x:

      +

      The following example configures the Cyrus SASL library to +contact saslauthd as its password verification service: +

      -/usr/local/lib/sasl2/smtpd.conf:
      -    pwcheck_method: auxprop
      -    auxprop_plugin: sql
      +/etc/sasl2/smtpd.conf:
      +    pwcheck_method: saslauthd
      +    mech_list: PLAIN LOGIN
       
      -
    +
    -

    To run software chrooted with SASL support is an interesting -exercise. It probably is not worth the trouble.

    +Important -

    Testing SASL authentication in the Postfix -SMTP server

    +

    Do not specify any other mechanisms in mech_list +than PLAIN or LOGIN when using +saslauthd! It can only handle these two mechanisms, +and authentication will fail if clients are allowed to choose other +mechanisms.

    -

    To test the server side, connect (for example, with telnet) to the -Postfix SMTP server port and you should -be able to have a conversation as shown below. Information sent by the -client (that is, you) is shown in bold font.

    +
    -
    -$ telnet server.example.com 25
    -. . .
    -220 server.example.com ESMTP Postfix
    -EHLO client.example.com
    -250-server.example.com
    -250-PIPELINING
    -250-SIZE 10240000
    -250-ETRN
    -250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    -250 8BITMIME
    -AUTH PLAIN AHRlc3QAdGVzdHBhc3M=
    -235 Authentication successful
    -
    -
    -

    Instead of AHRlc3QAdGVzdHBhc3M=, specify the base64 encoded -form of \0username\0password (the \0 is a null byte). The -example above is for a user named `test' with password `testpass'. -

    +Important -

    In order to generate base64 encoded authentication information -you can use one of the following commands:

    +

    Plaintext mechanisms (PLAIN, LOGIN) +send credentials unencrypted. This information should be protected +by an additional security layer such as a TLS-encrypted SMTP session +(see: TLS_README).

    -
    -
    -% printf '\0username\0password' | mmencode 
    -
    +

    Additionally the saslauthd server itself must be +configured. It must be told which authentication backend to turn +to for password verification. The backend is choosen as a command +line option when saslauthd is started and will be shown +in the following examples.

    +
    -
    -% perl -MMIME::Base64 -e \
    -    'print encode_base64("\0username\0password");'
    -
    + +Note + +

    Some distributions use a configuration file to provide saslauthd +command line options to set e.g. the authentication backend. Typical +locations are /etc/sysconfig/saslauthd or +/etc/default/saslauthd.

    +
    -

    The mmencode command is part of the metamail software. -MIME::Base64 is available from http://www.cpan.org/.

    +

    Using saslauthd with /etc/shadow

    -

    Caution: when posting logs of the SASL negotiations to public -lists, -please keep in mind that username/password information is trivial -to recover from the base64-encoded form.

    +

    Access to the /etc/shadow system password file +requires root privileges. The Postfix SMTP server +(and in consequence libsasl linked to the server) runs +with the least privilege possible. Direct access to +/etc/shadow would not be possible without breaking the +Postfix security architecture.

    -

    Trouble shooting the SASL internals

    +

    The saslauthd socket builds a safe bridge. Postfix, +running as limited user postfix, can access the +UNIX-domain socket that saslauthd receives commands +on; saslauthd, running as privileged user root, +has the privileges required to access the shadow file.

    -

    In the Cyrus SASL sources you'll find a subdirectory named -"sample". Run make there, then create a symbolic link from sample.conf -to smtpd.conf in your Cyrus SASL library directory /usr/local/lib/sasl2. -"su" to the user postfix (or whatever your mail_owner -directive is set to):

    +

    The saslauthd server verifies passwords against the +authentication backend /etc/shadow if started like this:

    -% su postfix
    +% saslauthd -a shadow
     
    -

    then run the resulting sample Cyrus SASL server and client in -separate terminals. The sample applications send log messages to -the syslog -facility auth. Check the log to fix the problem or run strace / -ktrace / truss on the server to see what makes it unhappy. Repeat -the previous step until you can successfully authenticate with the -sample Cyrus SASL client. Only then get back to Postfix.

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -

    Enabling SASL authentication in the -Postfix SMTP client

    +

    Using saslauthd with PAM

    -

    Turn on client-side SASL authentication, and specify a table -with per-host or per-destination username and password information. -The Postfix SMTP client first searches the table for an entry with -the remote SMTP server hostname; if no entry is found, then the -Postfix SMTP client searches the table for -an entry with the next-hop destination. Usually, that is the -right-hand part of an email address, but it can also be the information -that is specified with the relayhost parameter or with a transport(5) -table.

    +

    Cyrus SASL can use the PAM framework to authenticate credentials. +saslauthd uses the PAM framework when started like +this:

    -/etc/postfix/main.cf:
    -    smtp_sasl_auth_enable = yes
    -    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    -    smtp_sasl_type = cyrus
    -    relayhost = [mail.myisp.net]
    -    # Alternative form:
    -    # relayhost = [mail.myisp.net]:submission
    -
    -/etc/postfix/sasl_passwd:
    -    [mail.myisp.net]            username:password
    -    [mail.myisp.net]:submission username:password
    +% saslauthd -a pam
     
    -

    Notes:

    - -
      +
      -
    • The "submission" destination port tells Postfix to send -mail via TCP network port 587, which is normally reserved for email -clients. The default is to send mail to the "smtp" destination port -(TCP port 25), which is used for receiving mail across the internet. -If you use an explicit destination port in main.cf, then you must -use the same form also in the smtp_sasl_password_maps file.

      - -
    • Postfix does not deliver mail via TCP port 465 (the obsolete -"wrappermode" protocol). See TLS_README for a solution that uses the -"stunnel" command.

      - -
    • The "[" and "]" prevent Postfix from looking up the MX -(mail exchanger) records for the enclosed name. If you use this -form in main.cf, then you must use the same form also in the -smtp_sasl_password_maps file.

      - -
    • The Postfix SMTP client opens the SASL client password -file before entering the optional chroot jail, so you can keep the -file in /etc/postfix and set permissions read / write only for root -to keep the username:password combinations away from other system -users.

      - -
    • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

      +Note -
    • Execute the command "postmap /etc/postfix/sasl_passwd" -whenever you change the sasl_passwd table.

      +

      PAM configuration for the Postfix SMTP server is usually given +in /etc/pam.d/smtp and is beyond the scope of this +document.

      -
    + -

    Workarounds:

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -
      +

      Using saslauthd with an IMAP server

      -
    • Some remote SMTP servers support PLAIN or LOGIN authentication only. -By default, the Postfix SMTP client does not use authentication -methods that send plaintext passwords, and defers delivery with -the following error message: "Authentication failed: cannot SASL -authenticate to server". To enable plaintext authentication specify, -for example:

      +

      saslauthd can verify the SMTP client credentials +by using them to log into an IMAP server. If the login succeeds, +SASL authentication also succeeds. saslauthd contacts +an IMAP server when started like this:

      -/etc/postfix/main.cf:
      -    smtp_sasl_security_options = noanonymous
      +% saslauthd -a rimap -O imap.example.com
       
      -
    • Some remote SMTP servers announce authentication mechanisms -that don't actually work. It is possible via the smtp_sasl_mechanism_filter -parameter to restrict the list of server mechanisms that the Postfix -SMTP client will take into consideration:

      -
      -
      -/etc/postfix/main.cf:
      -    smtp_sasl_mechanism_filter = !gssapi, !external, static:all
      -
      + +Note + +

      The option "-O imap.example.com" specifies the +IMAP server saslauthd should contact when it verifies +credentials.

      +
      -

      In the above example, the Postfix SMTP client will decline to -use mechanisms -that require special infrastructure such as Kerberos or TLS.

      +
      -
    • The Postfix SMTP client is backwards compatible with SMTP -servers that use the non-standard "AUTH=method..." syntax in response -to the EHLO command; there is no Postfix client configuration needed -to work around it.

      +Important -
    +

    saslauthd sends IMAP login information unencrypted. +Any IMAP session leaving the local host should be protected by an +additional security layer such as an SSL tunnel.

    -

    Supporting multiple ISP accounts -in the Postfix SMTP client

    + -

    Postfix version 2.3 supports multiple ISP accounts. This can -be useful when one person uses the same machine for work and for -personal use, or when people with different ISP accounts share the -same Postfix server. To make this possible, Postfix 2.3 supports -per-sender SASL passwords and per-sender relay hosts. In the example -below, Postfix will search the SASL password file by sender before -it searches that same file by destination. Likewise, Postfix will -search the per-sender relayhost file, and use the default relayhost -only as a final resort.

    +

    See section "Testing saslauthd +authentication" for test instructions.

    -
    -
    -/etc/postfix/main.cf:
    -    smtp_sender_dependent_authentication = yes
    -    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
    -    smtp_sasl_auth_enable = yes
    -    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    -    relayhost = [mail.myisp.net]
    -    # Alternative form:
    -    # relayhost = [mail.myisp.net]:submission
    +

    Testing saslauthd authentication

    -/etc/postfix/sasl_passwd: - # Per-sender authentication; see also /etc/postfix/sender_relay. - user1@example.com username2:password2 - user2@example.net username2:password2 - # Login information for the default relayhost. - [mail.myisp.net] username:password - [mail.myisp.net]:submission username:password +

    Cyrus SASL provides the testsaslauthd utility to +test saslauthd authentication. The username and password +are given as command line arguments. The example shows the response +when authentication is successful:

    -/etc/postfix/sender_relay: - # Per-sender provider; see also /etc/postfix/sasl_passwd. - user1@example.com [mail.example.com]:submission - user2@example.net [mail.example.net] +
    +
    +% testsaslauthd -u username -p password
    +0: OK "Success."
     
    -

    Notes:

    +
    -
      +Note -
    • If you are creative, then you can try to combine the two -tables into one single MySQL database, and configure different -Postfix queries to extract the appropriate information.

      +

      Sometimes the testsaslauthd program is not distributed +with a the Cyrus SASL main package. In that case, it may be +distributed with -devel, -dev or -debug packages.

      -
    • Specify dbm instead of hash if your system -uses dbm files instead of db files. To find out what -lookup tables Postfix supports, use the command "postconf -m". -

      +
    -
  • Execute the command "postmap /etc/postfix/sasl_passwd" -whenever you change the sasl_passwd table.

    +

    Specify an additional "-s smtp" if saslauthd +was configured to contact the PAM authentication framework and an +additional "-f /path/to/socketdir/mux" if +saslauthd establishes the UNIX-domain socket in a +non-default location.

    -
  • Execute the command "postmap /etc/postfix/sender_relay" -whenever you change the sender_relay table.

    +

    If authentication succeeds, proceed with the section "Enabling SASL authentication and authorization +in the Postfix SMTP server".

    - +

    Cyrus SASL Plugins - auxiliary property +plugins

    -

    Credits

    +

    Cyrus SASL uses a plugin infrastructure (called auxprop) +to expand libsasl's capabilities. Currently Cyrus +SASL sources provide three authentication plugins.

    -
      +
      -
    • Postfix SASL support was originally implemented by Till Franke -of SuSE Rhein/Main AG. +
      -
    • Wietse trimmed down the code to only the bare necessities. +
      sasldb
      -
    • Support for Cyrus SASL version 2 was contributed by Jason Hoos. +

      Accounts are stored stored in a Cyrus SASL Berkeley DB +database

      -
    • Liviu Daia added smtpd_sasl_application_name, split -reject_sender_login_mismatch into -reject_authenticated_sender_login_mismatch and -reject_unauthenticated_sender_login_mismatch, and revised the docs. +
      sql
      -
    • Wietse made another iteration through the code to add plug-in -support for multiple SASL implementations, and changed -smtpd_sasl_application_name into smtpd_sasl_path. +

      Accounts are stored in a SQL database

      -
    • The Dovecot SMTP server-only plug-in was originally implemented by -Timo Sirainen of Procontrol, Finland. +
      ldapdb
      -
    • Patrick Ben Koetter revised this document for Postfix 2.4 and -made much needed updates. +

      Accounts are stored stored in an LDAP database

      -
    + + +
  • + +
    + +Important + +

    These three plugins support shared-secret mechanisms i.e. +CRAM-MD5, DIGEST-MD5 and NTLM. These mechanisms send credentials +encrypted but their verification process requires the password to +be available in plaintext. Consequently passwords cannot (!) be +stored in encrypted form.

    + +
    + +

    The sasldb plugin

    + +

    The sasldb auxprop plugin authenticates credentials stored in a Berkeley +DB database. The database schema is specific to Cyrus SASL. The +database is usually located at /etc/sasldb2.

    + +
    + +Note + +

    The sasldb2 file contains passwords in +plaintext, and should have read+write access only to user +postfix or a group that postfix is member +of.

    + +
    + +

    The saslpasswd2 command-line utility creates +and maintains the database:

    + +
    +
    +% saslpasswd2 -c -u example.com username
    +Password:
    +Again (for verification):
    +
    +
    + +

    This command creates an account +username@example.com.

    + +
    + +Important + +

    users must specify username@example.com +as login name, not username.

    + +
    + +

    Run the following command to reuse the Postfix mydomain +parameter value as the login domain:

    + +
    +
    +% saslpasswd2 -c -u `postconf -h mydomain` username
    +Password:
    +Again (for verification):
    +
    +
    + +
    + +Note + +

    Run saslpasswd2 without any options for further +help on how to use the command.

    + +
    + +

    The sasldblistusers2 command lists all existing +users in the sasldb database:

    + +
    +
    +% sasldblistusers2
    +username1@example.com: password1
    +username2@example.com: password2
    +
    +
    + +

    Configure libsasl to use sasldb with the following instructions:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: sasldb
    +    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
    +
    +
    + +
    + +Note + +

    In the above example adjust mech_list to the +mechanisms that are applicable for your environment.

    + +
    + +

    The sql plugin

    + +

    The sql auxprop plugin is a generic SQL plugin. It provides +access to credentials stored in a MySQL, a PostgreSQL or a SQLite +database.

    + +
    + +Note + +

    The shared-secret mechanisms (CRAM-MD5, etc.) require that the +SASL client passwords are stored as plaintext.

    + +
    + +
    + +Tip + + + +

    Use "saslauthd > pam > (pam database module)" to +verify encrypted passwords in an SQL database.

    + +
    + +

    The following example configures libsasl to use the sql plugin and connects +it to a PostgreSQL server:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: sql
    +    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
    +    sql_engine: pgsql
    +    sql_hostnames: 127.0.0.1, 192.0.2.1 sql_user: username
    +    sql_passwd: secret
    +    sql_database: dbname
    +    sql_select: SELECT password FROM users WHERE user = '%u'@'%r'
    +
    +
    + +
    + +Note + +

    Set appropriate permissions if smtpd.conf contains +a password. The file should be readable by the postfix +user.

    + +
    + +
    + +Note + +

    In the above example, adjust mech_list to the +mechanisms that are applicable for your environment.

    + +
    + +

    The sql plugin has the following configuration options:

    + +
    + +
    + +
    sql_engine
    + +
    + +

    Specify mysql to connect to a MySQL server, +pgsql for a PostgreSQL server or sqlite +for an SQLite database

    + +
    + +
    sql_hostnames
    + +
    + +

    Specify one or more servers (hostname or hostname:port) separated +by commas.

    + +
    + +Note + +

    With MySQL servers, specify localhost to connect +over a UNIX-domain socket, and specify 127.0.0.1 to +connect over a TCP socket.

    + +
    + +
    + +
    sql_user
    + +
    + +

    The login name to gain access to the database.

    + +
    + +
    sql_passwd
    + +
    + +

    The password to gain access to the database.

    + +
    + +
    sql_database
    + +
    + +

    The name of the database to connect to.

    + +
    + +
    sql_select
    + +
    + +

    The SELECT statement that should retrieve the plaintext password +from a database table.

    + +
    + +Important + +

    Do not enclose the statement in quotes! Use single quotes to +escape macros!

    + +
    + +
    + +
    + +
    + +

    The sql plugin provides macros to build sql_select +statements. They will be replaced with arguments sent from the client. The +following macros are available:

    + +
    + +
    + +
    %u
    + +
    + +

    The name of the user whose properties are being selected.

    + +
    + +
    %p
    + +
    + +

    The name of the property being selected. While this could technically be +anything, Cyrus SASL will try userPassword and cmusaslsecretMECHNAME (where +MECHNAME is the name of a SASL mechanism).

    + +
    + +
    %r
    + +
    + +

    The name of the realm to which the user belongs. This could be +the KERBEROS realm, the fully-qualified domain name of the computer +the SASL application is running on, or the domain after the "@" in a +username.

    + +
    + +
    + +
    + +

    The ldapdb plugin

    + +

    The ldapdb auxprop plugin provides access to credentials stored +in an OpenLDAP LDAP server. It is the only plugin that implements +proxy authorization.

    + +

    Proxy authorization in this context means: The ldapdb plugin +must SASL authenticate with the OpenLDAP server. The server then +decides if the ldapdb plugin should be authorized to read the +authenticating user's password. Once the ldapdb plugin has gone +through proxy authorization it may proceed and authenticate the +remote SMTP client's credentials.

    + +

    In a nutshell: Configuring ldapdb means authentication and +authorization must be configured twice - once in the Postfix SMTP +server to authenticate and authorize the remote SMTP client, and +once in the OpenLDAP slapd server to authenticate and +authorize the ldapdb plugin.

    + +

    This example configures libsasl to use the ldapdb plugin and +the plugin to connect to an OpenLDAP server:

    + +
    +
    +/etc/sasl2/smtpd.conf:
    +    pwcheck_method: auxprop
    +    auxprop_plugin: ldapdb
    +    mech_list: PLAIN LOGIN NTLM CRAM-MD5 DIGEST-MD5
    +    ldapdb_uri: ldap://localhost
    +    ldapdb_id: proxyuser
    +    ldapdb_pw: password
    +    ldapdb_mech: DIGEST-MD5
    +
    +
    + +
    + +Important + +

    Set appropriate permissions if smtpd.conf contains a +password. The file should be readable by the postfix +user.

    + +
    + +
    + +Note + +

    The shared-secret mechanisms (CRAM-MD5, etc.) require that the +SASL client passwords are stored as plaintext.

    + +
    + +

    The following is a summary of applicable smtpd.conf +file entries:

    + +
    + +
    + +
    auxprop_plugin
    + +

    Specify ldapdb to enable the plugin.

    + +
    ldapdb_uri
    + +

    Specify either ldapi:// for to connect over +a UNIX-domain socket, ldap:// for an unencrypted TCP +connection or ldaps:// for an encrypted TCP connection. +

    + +
    ldapdb_id
    + +

    The login name to authenticate the ldapdb plugin to the +LDAP server (proxy authorization).

    + +
    ldapdb_pw
    + +

    The password (in plaintext) to authenticate the ldapdb +plugin to the LDAP server (proxy authorization).

    + +
    ldapdb_mech
    + +

    The mechanism to authenticate the ldapdb plugin to the +OpenLDAP slapd server.

    + +
    + +Note + +

    Specify a mechanism here that is supported by the OpenLDAP slapd +server.

    + +
    + +
    + +
    ldapdb_rc (optional)
    + +

    The path to a file containing individual configuration +options for the ldapdb LDAP client (libldap). This allows to specify +a TLS client certificate which in turn can be used to use the SASL +EXTERNAL mechanism.

    + +
    + +Note + +

    This mechanism supports authentication over an encrypted transport +layer, which is recommended if the plugin must connect to an OpenLDAP +server on a remote machine.

    + +
    + +
    + +
    ldapdb_starttls (optional)
    + +

    The TLS policy for connecting to the LDAP server. Specify +either try or demand. If the option is +try the plugin will attempt to establish a TLS-encrypted +connection with the LDAP server, and will fallback to an unencrypted +connection if TLS fails. If the policy is demand and +a TLS-encrypted connection cannot be established, the connection +fails immediately.

    + +
    + +
    + +

    When the ldapdb plugin connects to the OpenLDAP server and +successfully authenticates, the OpenLDAP server decides if the +plugin user is authorized to read SASL account information.

    + +

    The following configuration gives an example of authorization configuration +in the OpenLDAP slapd server:

    + +
    +
    +/etc/openldap/slapd.conf:
    +    authz-regexp
    +    uid=(.*),cn=.*,cn=auth
    +    ldap:///dc=example,dc=com??sub?cn=$1
    +    authz-policy to
    +
    +
    + +

    Here, the authz-regexp option serves for authentication +of the ldapdb user. It maps its login name to a DN in the LDAP +directory tree where slapd can look up the SASL account +information. The authz-policy options defines the +authentication policy. In this case it grants authentication +privileges "to" the ldapdb plugin.

    + +

    The last configuration step is to tell the OpenLDAP slapd +server where ldapdb may search for usernames matching the one given +by the mail client. The example below adds an additional attribute +ldapdb user object (here: authzTo because the authz-policy +is "to") and configures the scope where the login name +"proxyuser" may search:

    + +
    +
    +dn: cn=proxyuser,dc=example,dc=com
    +changetype: modify
    +add: authzTo
    +authzTo: dn.regex:uniqueIdentifier=(.*),ou=people,dc=example,dc=com
    +
    +
    + +

    Use the ldapmodify or ldapadd command +to add the above attribute.

    + +
    + +Note + +

    Read the chapter "Using SASL" in the OpenLDAP Admin Guide +for more detailed instructions to set up SASL authentication in +OpenLDAP.

    + +
    + +

    Enabling SASL authentication and +authorization in the Postfix SMTP server

    + +

    By default the Postfix SMTP server uses the Cyrus SASL +implementation. If the Dovecot SASL implementation should be used, +specify an smtpd_sasl_type value of dovecot +instead of cyrus:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_type = dovecot
    +
    +
    + +

    Additionally set the path where the Postfix SMTP server can +find the Dovecot SASL socket:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_path = private/auth
    +
    +
    + +
    + +Note + +

    This example uses a pathname relative to the Postfix queue +directory, so that it will work whether or not the Postfix SMTP +server runs chrooted.

    + +
    + +

    Enabling SASL authentication +in the Postfix SMTP server

    + +

    Regardless of the SASL implementation type, enabling SMTP +authentication in the Postfix SMTP server always requires seting +the smtpd_sasl_auth_enable option:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_auth_enable = yes
    +
    +
    + +

    After a "postfix reload", SMTP clients will see the additional +capability AUTH in an SMTP session, followed by a list of +authentication mechanisms the server supports:

    + +
    +
    +% telnet server.example.com 25
    +...
    +220 server.example.com ESMTP Postfix
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +...
    +
    +
    + +

    However not all clients recognize the AUTH capability as defined +by the SASL authentication RFC. Some historical implementations expect the +server to send an "=" as separator between the AUTH +verb and the list of mechanisms that follows it.

    + +

    The broken_sasl_auth_clients configuration option +lets Postfix repeat the AUTH statement in a form that these broken +clients understand:

    + +
    +
    +/etc/postfix/main.cf:
    +    broken_sasl_auth_clients = yes
    +
    +
    + +
    + +Note + +

    Enable this option for Outlook up to and including version 2003 +and Outlook Express up to version 6. This option does not hurt other +clients.

    + +
    + +

    After "postfix reload", the Postfix SMTP server will propagate +the AUTH capability twice - once for compliant and once for broken +clients:

    + +
    +
    +% telnet server.example.com 25
    +...
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +250-AUTH=DIGEST-MD5 PLAIN CRAM-MD5
    +...
    +
    +
    + +

    Postfix SMTP Server +Authentication Policy

    + +

    The Postfix SMTP server provides a way to specify the properties +of SASL mechanisms that can be made available to the remote SMTP +client.

    + +

    Unencrypted SMTP session

    + +

    The default policy is to allow any mechanism in the Postfix SMTP server +except for those based on anonymous authentication:

    + +
    +
    +/etc/postfix/main.cf:
    +    # Specify a list of properties separated by comma or whitespace
    +    smtpd_sasl_security_options = noanonymous
    +
    +
    + +
    + +Important + +

    Always set at least the noanonymous option. +Otherwise, the Postfix SMTP server can give strangers the same +authorization as a properly-authenticated client.

    + +
    + +

    Postfix can enforce the following policies on SASL authentication +mechanisms:

    + +
    + +
    + +
    noanonymous
    + +

    Don't use mechanisms that permit anonymous authentication. +

    + +
    noplaintext
    + +

    Don't use mechanisms that transmit unencrypted username +and password information.

    + +
    nodictionary
    + +

    Don't use mechanisms that are vulnerable to dictionary +attacks.

    + +
    + +
    forward_secrecy
    + +

    Use only mechanisms that support forward secrecy (Dovecot +SASL only).

    + +
    + +
    mutual_auth
    + +

    Use only mechanisms that authenticate both the client and +the server to each other.

    + +
    + +
    + +

    Encrypted SMTP session (TLS)

    + +

    A separate parameter controls Postfix SASL mechanism policy +during a TLS-encrypted SMTP session. The default is to copy the +settings from the unencrypted session:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
    +
    +
    + +

    A more sophisticated policy allows plaintext mechanisms, but +only over a TLS-encrypted connection:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_security_options = noanonymous, noplaintext
    +    smtpd_sasl_tls_security_options = noanonymous
    +
    +
    + +

    To offer SASL authentication only after a TLS-encrypted session has been +established specify this:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_tls_auth_only = yes
    +
    +
    + +

    Enabling SASL authorization in the Postfix +SMTP server

    + +

    After the client has authenticated with SASL, the Postfix SMTP +server decides what the remote SMTP client will be authorized +for. Examples of possible SMTP clients authorizations are:

    + +
      + +
    • Send a message to a remote recipient.

    • + +
    • Use a specific envelope sender in the MAIL FROM command.

    • + +
    + +

    These permissions are not enabled by default.

    + +

    Mail relay authorization

    + +

    The permit_sasl_authenticated restriction allows +SASL-authenticated SMTP clients to send mail to remote destinations. +Add it to the list of smtpd_recipient_restrictions as +follows:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_recipient_restrictions =
    +    ...
    +    permit_mynetworks
    +    permit_sasl_authenticated
    +    reject_unauth_destination
    +    ...
    +
    +
    + +

    Envelope sender address authorization

    + +

    By default an SMTP client may specify any envelope sender address +in the MAIL FROM command. That is because the Postfix SMTP server +only knows the remte SMTP client hostname and IP address, but not +the user who controls the remote SMTP client.

    + +

    This changes the moment an SMTP client uses SASL authentication. +Now, the Postfix SMTP server knows who the sender is. Given a table +of envelope sender addresses and SASL login names, the Postfix SMTP +server can decide if the SASL authenticated client is allowed to +use a particular envelope sender address:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sender_login_maps = hash:/etc/postfix/controlled_envelope_senders
    +
    +    smtpd_recipient_restrictions =
    +        ...
    +        reject_sender_login_mismatch
    +        permit_sasl_authenticated
    +        permit_mynetworks
    +        reject_unauth_destination
    +        ...
    +
    +
    + +

    The controlled_envelope_senders table specifies +the binding between the sender envelope addresses and its their +SASL login names:

    + +
    +
    +/etc/postfix/controlled_envelope_senders
    +    # envelope sender           owners (SASL login names)
    +    john@example.com            john@example.com
    +    helpdesk@example.com        john@example.com, mary@example.com
    +    postmaster                  admin@example.com
    +    @example.net                barney, fred, john@example.com, mary@example.com
    +
    +
    + +

    With this, the reject_sender_login_mismatch +restriction above will reject the sender address in the MAIL FROM +command if smtpd_sender_login_maps does not specify +the SMTP client's login name as an owner of that address.

    + +

    See also reject_authenticated_sender_login_mismatch and +reject_unauthenticated_sender_login_mismatch for additional +control over the SASL login name and the envelope sender.

    + +

    Additional SMTP Server SASL options

    + +

    Postfix provides a wide range of SASL authentication configuration +options. The next section lists a few that are discussed frequently. +See postconf(5) for a complete list.

    + +

    Default authentication domain

    + +

    Postfix can append a domain name (or any other string) to a +SASL login name that does not have a domain part, e.g. "john" +instead of "john@example.com":

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_local_domain = example.com
    +
    +
    + +

    This is useful as a default setting and safety net for misconfigured +clients, or during a migration to an authentication method/backend +that requires an authentication REALM or domain name, before all +SMTP clients are configured to send such information.

    + +

    Hiding SASL authentication from clients or +networks

    + +

    Some clients insist on using SASL authentication if it is offered, even +when they are not configured to send credentials - and therefore +they will always fail and disconnect.

    + +

    Postfix can hide the AUTH capability from these clients/networks:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_exceptions_networks = !192.0.2.171/32, 192.0.2.0/24
    +
    +
    + +

    Adding the SASL login name to mail headers

    + +

    To report SASL login names in Received: message headers (Postfix +version 2.3 and later):

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_authenticated_header = yes
    +
    +
    + +
    + +Note + +

    The SASL login names will be shared with the entire world.

    + +
    + +

    Testing SASL authentication in the Postfix SMTP Server

    + +

    To test the server side, connect (for example, with +telnet) to the Postfix SMTP server port and you should +be able to have a conversation as shown below. Information sent by +the client (that is, you) is shown in bold font.

    + +
    +
    +% telnet server.example.com 25
    +...
    +220 server.example.com ESMTP Postfix
    +EHLO client.example.com
    +250-server.example.com
    +250-PIPELINING
    +250-SIZE 10240000
    +250-ETRN
    +250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
    +250 8BITMIME
    +AUTH PLAIN AHRlc3QAdGVzdHBhc3M=
    +235 Authentication successful
    +
    +
    + +

    Instead of AHRlc3QAdGVzdHBhc3M=, specify the +base64-encoded form of \0username\0password (the \0 +is a null byte). The example above is for a user named `test' +with password `testpass'.

    +
    + +Caution + +

    When posting logs of the SASL negotiations to public lists, +please keep in mind that username/password information is trivial +to recover from the base64-encoded form.

    + +
    + +

    You can use one of the following commands to generate base64 +encoded authentication information:

    + +
    +
    +% gen-auth plain
    +username: username
    +password:
    +
    +
    + +

    The gen-auth Perl script was written by John +Jetmore and can be found at http://jetmore.org/john/code/gen-auth.

    + +
    +
    +% printf '\0username\0password' | mmencode
    +
    +
    + +

    The mmencode command is part of the metamail +software.

    + +
    +
    +% perl -MMIME::Base64 -e \
    +    'print encode_base64("\0username\0password");'
    +
    +
    + +

    MIME::Base64 is available from http://www.cpan.org/.

    + +

    Configuring SASL authentication in the Postfix SMTP/LMTP client

    + +

    The Postfix SMTP and the LMTP client can authenticate with a +remote SMTP server via the Cyrus SASL framework. At this time, the +Dovecot SASL implementation does not provide client functionality. +

    + +
    + +Note + +

    The examples in this section discuss only the SMTP client. +Replace smtp_ with lmtp_ to get the +corresponding LMTP client configuration.

    + +
    + +

    You can read more about the following topics:

    + + + +

    Enabling SASL authentication in the +Postfix SMTP/LMTP client

    + +

    This section shows a typical scenario where the Postfix SMTP +client sends all messages via a mail gateway server that requires +SASL authentication. To make the example more readable we introduce +it in two parts.

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_auth_enable = yes
    +    relayhost = [mail.isp.example]
    +    # Alternative form:
    +    # relayhost = [mail.isp.example]:submission
    +    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    +
    +
    + +
      + +
    • The smtp_sasl_auth_enable setting enables +client-side authentication. We will configure the client's username +and password information in the second part of the example.

      +
    • + +
    • The relayhost setting forces the Postfix SMTP +to send all remote messages to the specified mail server instead +of trying to deliver them directly to their destination.

    • + +
    • In the relayhost setting, the "[" +and "]" prevent the Postfix SMTP client from looking +up MX (mail exchanger) records for the enclosed name.

    • + +
    • The relayhost destination may also specify a +non-default TCP port. For example, the alternative form +[mail.isp.example]:submission tells Postfix to connect +to TCP network port 587, which is reserved for email client +applications.

    • + +
    • The Postfix SMTP client is compatible with SMTP servers +that use the non-standard "AUTH=method...." +syntax in response to the EHLO command; this requires no additional +Postfix client configuration.

    • + +
    • The Postfix SMTP client does not support the obsolete +"wrappermode" protocol, which uses TCP port 465 on the +SMTP server. See TLS_README for a solution that uses the +stunnel command.

    • + +
    • With the smtp_sasl_password_maps parameter, +we configure the Postfix SMTP client to send username and password +information to the mail gateway server. As discussed in the next +section, the Postfix SMTP client supports multiple ISP accounts. +For this reason the username and password are stored in a table +that contains one username/password combination for each mail gateway +server.

      + +
    + +
    +
    +/etc/postfix/sasl_passwd:
    +    # destination                   credentials
    +    [mail.isp.example]              username:password
    +    # Alternative form:
    +    # [mail.isp.example]:submission username:password
    +
    +
    + +
    + +Important + +

    Keep the SASL client password file in /etc/postfix, +and make the file read+write only for root to protect +the username/password combinations against other users. The Postfix +SMTP client will still be able to read the SASL client passwords. +It opens the file as user root before it drops privileges, +and before entering an optional chroot jail.

    + +
    + +
      + +
    • Use the postmap command whenever you +change the /etc/postfix/sasl_passwd file.

    • + +
    • If you specify the "[" and "]" +in the relayhost destination, then you must use the +same form in the smtp_sasl_password_maps file.

      +
    • + +
    • If you specify a non-default TCP Port (such as +":submission" or ":587") in the +relayhost destination, then you must use the same form +in the smtp_sasl_password_maps file.

    • + +
    + +

    Configuring Sender-Dependent SASL +authentication

    + +

    Postfix supports different ISP accounts for different sender +addresses (version 2.3 and later). This can be useful when one +person uses the same machine for work and for personal use, or when +people with different ISP accounts share the same Postfix server. +

    + +

    To make this possible, Postfix supports per-sender SASL passwords +and per-sender relay hosts. In the example below, the Postfix SMTP +client will search the SASL password file by sender address before +it searches that same file by destination. Likewise, the Postfix +trivial-rewrite(8) daemon will search the per-sender relayhost file, +and use the default relayhost setting only as a final +resort.

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sender_dependent_authentication = yes
    +    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
    +    smtp_sasl_auth_enable = yes
    +    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    +    relayhost = [mail.isp.example]
    +    # Alternative form:
    +    # relayhost = [mail.isp.example]:submission
    +
    +
    + +
    +
    +/etc/postfix/sasl_passwd:
    +    # Per-sender authentication; see also /etc/postfix/sender_relay.
    +    user1@example.com               username2:password2
    +    user2@example.net               username2:password2
    +    # Login information for the default relayhost.
    +    [mail.isp.example]              username:password
    +    # Alternative form:
    +    # [mail.isp.example]:submission username:password
    +
    +
    + +
    +
    +/etc/postfix/sender_relay:
    +    # Per-sender provider; see also /etc/postfix/sasl_passwd.
    +    user1@example.com               [mail.example.com]:submission
    +    user2@example.net               [mail.example.net]
    +
    +
    + +
      + +
    • If you are creative, then you can try to combine the two +tables into one single MySQL database, and configure different +Postfix queries to extract the appropriate information.

      + +
    • Specify dbm instead of hash if your system uses dbm files +instead of db files. To find out what lookup tables Postfix supports, +use the command "postconf -m".

      + +
    • Execute the command "postmap /etc/postfix/sasl_passwd" +whenever you change the sasl_passwd table.

      + +
    • Execute the command "postmap /etc/postfix/sender_relay" +whenever you change the sender_relay table.

      + +
    + +

    Postfix SMTP/LMTP client authentication +policy

    + +

    Just like the Postfix SMTP server, the SMTP client has a policy +that determines which SASL mechanisms are acceptable and which are +not.

    + +

    Unencrypted SMTP session

    + +

    The default policy is stricter than that of the Postfix SMTP +server - plaintext mechanisms are not allowed (nor is any anonymous +mechanism):

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_security_options = noplaintext, noanonymous
    +
    +
    + +

    Postfix can enforce the following policies on SASL authentication +mechanisms:

    + +
    + +
    + +
    noanonymous
    + +

    Don't use mechanisms that permit anonymous authentication. +

    + +
    noplaintext
    + +

    Don't use mechanisms that transmit unencrypted username +and password information.

    + +
    nodictionary
    + +

    Don't use mechanisms that are vulnerable to dictionary +attacks.

    + +
    + +
    +
    mutual_auth
    + +

    Use only mechanisms that authenticate both the client and +the server to each other.

    + +
    + +
    + +

    With the default policy shown above, the Postfix SMTP client +will not send its password over an unencrypted connection. This +sometimes leads to authentication failures if the remote server +only offers plaintext authentication mechanisms. In such cases the +SMTP client will log the following error message:

    + +
    +
    +SASL authentication failure: No worthy mechs found
    +
    +
    + +

    The less secure approach to deal with this is to lower the +security standards and permit plaintext authentication mechanisms: +

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_security_options = noanonymous
    +
    +
    + +

    Needless to say, sending a username and password over an insecure +channel is undesirable.

    + +

    If the remote server supports TLS, you can protect the plaintext +username and password by turning on TLS in the Postfix SMTP client +(see: TLS_README), and configuring the client as discussed next. + +

    Encrypted SMTP session (TLS)

    + +

    A separate parameter controls Postfix SASL mechanism policy +during a TLS-encrypted SMTP session. The default is to copy the +settings from the unencrypted session:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_tls_security_options = $smtp_sasl_security_options
    +
    +
    + +

    A more sophisticated policy allows plaintext mechanisms, but +only over a TLS-encrypted connection:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtpd_sasl_security_options = noanonymous, noplaintext
    +    smtpd_sasl_tls_security_options = noanonymous
    +
    +
    + +

    Filtering server mechanism names in +the Postfix SMTP/LMTP client

    + +

    Cyrus SASL always attempts to use the most secure authentication +mechanism that the remote SMTP server offers - even if the client +side was not configured to handle it! In such cases authentication +will definitely fail.

    + +

    To prevent this, the Postfix SMTP client can filter the list +of authentication mechanism names from the remote SMTP server. Used +correctly, the filter hides unwanted mechanisms from the Cyrus SASL +library, forcing the library to choose from the mechanisms the +Postfix filter passes through.

    + +

    The following example filters out everything but the mechanisms +PLAIN and LOGIN:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_mechanism_filter = plain, login
    +
    +
    + +
    + +Note + +

    If the remote server does not offer any of the mechanisms on +the filter list, authentication will fail.

    + +
    + +

    We close this section with an example that passes every mechanism +except for GSSAPI and LOGIN:

    + +
    +
    +/etc/postfix/main.cf:
    +    smtp_sasl_mechanism_filter = !gssapi, !login, static:all
    +
    +
    + +

    Building Postfix with SASL support

    + +

    As mentioned elsewhere, Postfix supports two SASL implementations: +Cyrus SASL (SMTP client and server) and Dovecot SASL (SMTP server +only). Both implementations can be built into Postfix simultaneously. +

    + + + +

    Building Dovecot SASL support

    + +

    These instructions assume that you build Postfix from source +code as described in the INSTALL document. Some modification may +be required if you build Postfix from a vendor-specific source +package.

    + +

    Support for the Dovecot version 1 SASL protocol is available +in Postfix 2.3 and later. At the time of writing, only server-side +SASL support is available, so you can't use it to authenticate the +Postfix SMTP client to your network provider's server.

    + +

    Dovecot uses its own daemon process for authentication. This +keeps the Postfix build process simple, because there is no need +to link extra libraries into Postfix.

    + +

    To generate the necessary Makefiles, execute the following in +the Postfix top-level directory:

    + +
    +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS='-DUSE_SASL_AUTH \
    +    -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
    +
    +
    + +

    After this, proceed with "make" as described in +the INSTALL document.

    + +Note + +
      + +
    • + +

      The -DDEF_SERVER_SASL_TYPE=\"dovecot\" is not +necessary; it just makes Postfix configuration a little more +convenient because you don't have to specify the SASL plug-in type +in the Postfix main.cf file (but this may cause surprises when you +switch to a later Postfix version that is built with the default +SASL type of sasl).

      + +
    • + +
    • + +

      If you also want support for LDAP or TLS (or for Cyrus SASL), +you need to merge their CCARGS and AUXLIBS +options into the above command line; see the LDAP_README and +TLS_README for details.

      + +
      +
      +% make tidy # if you have left-over files from a previous build
      +% make makefiles CCARGS='-DUSE_SASL_AUTH \
      +    -DDEF_SERVER_SASL_TYPE=\"dovecot\" \
      +    ...CCARGS options for LDAP or TLS etc....' \
      +   AUXLIBS='...AUXLIBS options for LDAP or TLS etc....'
      +
      +
      + +
    • + +
    + +

    Building Cyrus SASL support

    + +

    Building the Cyrus SASL library

    + +

    Postfix works with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, which are +available from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.

    + +
    + +Important + +

    If you install the Cyrus SASL libraries as per the default, you will have +to create a symlink /usr/lib/sasl -> +/usr/local/lib/sasl for version 1.5.x or +/usr/lib/sasl2 -> /usr/local/lib/sasl2 +for version 2.1.x.

    + +
    + +

    Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN +and/or NTLM authentication mechanism. To enable these authentication +mechanisms, build the Cyrus SASL libraries with:

    + +
    +
    +% ./configure --enable-login --enable-ntlm
    +
    +
    + +

    Building Postfix with Cyrus SASL support

    + +

    These instructions assume that you build Postfix from source +code as described in the INSTALL document. Some modification may +be required if you build Postfix from a vendor-specific source +package.

    + +

    The following assumes that the Cyrus SASL include files are in +/usr/local/include, and that the Cyrus SASL libraries are in +/usr/local/lib.

    + +

    On some systems this generates the necessary Makefile +definitions:

    + +
    + +
    Cyrus SASL version 2.1.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"
    +
    + +
    + +
    Cyrus SASL version 1.5.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"
    +
    + +
    + +
    + +

    On Solaris 2.x you need to specify run-time link information, +otherwise the ld.so run-time linker will not find the SASL shared +library:

    + +
    + +
    Cyrus SASL version 2.1.x
    + +
    + +
    +% make tidy # remove left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \
    +    -R/usr/local/lib -lsasl2"
    +
    + +
    + +
    Cyrus SASL version 1.5.x
    + +
    + +
    +% make tidy # if you have left-over files from a previous build
    +% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
    +    -I/usr/local/include" AUXLIBS="-L/usr/local/lib \
    +    -R/usr/local/lib -lsasl"
    +
    + +
    + +
    + +

    Using Cyrus SASL version 1.5.x

    + +

    Postfix supports Cyrus SASL version 1.x, but you shouldn't use +it unless you are forced to. The makers of Cyrus SASL write:

    + +
    This library is being deprecated and applications +should transition to using the SASLv2 library (source: Project Cyrus: +Downloads).
    + +

    If you still need to set it up, here's a quick rundown:

    + +

    Read the regular section on SMTP server configurations for the +Cyrus SASL framework. The differences are:

    + +
      + +
    • Cyrus SASL version 1.5.x searches for configuration +(smtpd.conf) in /usr/lib/sasl/ only. You +must place the configuration in that directory. Some systems may +have modified Cyrus SASL and put the files into e.g. +/var/lib/sasl/.

    • + +
    • Use the saslpasswd command instead of +saslpasswd2 to create users in sasldb. +

    • + +
    • Use the sasldblistusers command instead of +sasldblistusers2 to find users in sasldb. +

    • + +
    • In the smtpd.conf file you can't use +mech_list to limit the range of mechanisms offered. +Instead, remove their libraries from /usr/lib/sasl/ +(and remember remove those files again when a system update +re-installs new versions).

    • + +
    + +

    Credits

    + +
      + +
    • Postfix SASL support was originally implemented by Till Franke +of SuSE Rhein/Main AG.
    • + +
    • Wietse trimmed down the code to only the bare necessities. +
    • + +
    • Support for Cyrus SASL version 2 was contributed by Jason Hoos. +
    • + +
    • Liviu Daia added smtpd_sasl_application_name, separated +reject_sender_login_mismatch into +reject_authenticated_sender_login_mismatch and +reject_unauthenticated_sender_login_mismatch, and revised the docs. +
    • + +
    • Wietse made another iteration through the code to add plug-in +support for multiple SASL implementations, and for reasons that +have been lost, also changed smtpd_sasl_application_name into +smtpd_sasl_path.
    • + +
    • The Dovecot SMTP server-only plug-in was originally implemented +by Timo Sirainen of Procontrol, Finland.
    • + +
    • Patrick Ben Koetter revised this document for Postfix 2.4 and +made much needed updates.
    • + +
    • Patrick Ben Koetter revised this document again for Postfix +2.7 and made much needed updates.
    • + +
    + diff --git a/postfix/proto/TLS_README.html b/postfix/proto/TLS_README.html index f42bee9c6..b75bf9ed0 100644 --- a/postfix/proto/TLS_README.html +++ b/postfix/proto/TLS_README.html @@ -2237,7 +2237,7 @@ as specified by the smtp_tls_mandatory_ciphers configuration parameter. This setting controls the minimum acceptable SMTP client TLS cipher grade for use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may -want to enforce TLS, and is beyond the reach of today's crypt-analytic +want to enforce TLS, and is beyond the reach of today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis.

    diff --git a/postfix/proto/pcre_table b/postfix/proto/pcre_table index 5ae105ba4..5b7e2b206 100644 --- a/postfix/proto/pcre_table +++ b/postfix/proto/pcre_table @@ -66,7 +66,8 @@ # starts with whitespace continues a logical line. # .PP # Each pattern is a perl-like regular expression. The expression -# delimiter can be any character, except whitespace or characters +# delimiter can be any non-alphanumerical character, except +# whitespace or characters # that have special meaning (traditionally the forward slash is used). # The regular expression can contain whitespace. # diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index f827592fb..f3f7b3642 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -1269,8 +1269,8 @@ domain.

    Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

    @@ -2297,8 +2297,8 @@ which is just the name of a service that is defined the master.cf file.

    Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

    @@ -3569,10 +3569,10 @@ relocated_maps = hash:/etc/postfix/relocated %PARAM require_home_directory no

    -Whether or not a local(8) recipient's home directory must exist +Require that a local(8) recipient's home directory exists before mail delivery is attempted. By default this test is disabled. It can be useful for environments that import home directories to -the mail server (NOT RECOMMENDED). +the mail server (IMPORTING HOME DIRECTORIES IS NOT RECOMMENDED).

    %PARAM resolve_dequoted_address yes @@ -5404,7 +5404,7 @@ more of the following, separated by comma or whitespace.

    speed_adjust
    -
    Do not connect to a before-queue content filter until an entire +

    Do not connect to a before-queue content filter until an entire message has been received. This reduces the number of simultaneous before-queue content filter processes.

    @@ -7609,8 +7609,8 @@ the transport(5) table.

    Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

    @@ -8258,8 +8258,8 @@ This information can be overruled with the transport(5) table.

    Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. -The :nexthop part is optional. For more details see the -transport(5) manual page. +The :nexthop destination is optional; its syntax is documented +in the manual page of the corresponding delivery agent.

    @@ -10522,7 +10522,7 @@ smtp_tls_security_level = none # Opportunistic TLS. smtp_tls_security_level = may # Postfix ≥ 2.6: -# Do not tweak opportunistic ciphers unless it is essential +# Do not tweak opportunistic ciphers or protocol unless it is essential # to do so (if a security vulnerability is found in the SSL library that # can be mitigated by disabling a particular protocol or raising the # cipher grade from "export" to "low" or "medium"). @@ -10769,65 +10769,46 @@ meanings.

    %PARAM smtpd_tls_mandatory_ciphers medium -

    The minimum TLS cipher grade that the Postfix SMTP server -will use with mandatory TLS encryption. Cipher types listed in -smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are -excluded from the base definition of the selected cipher grade. See -smtpd_tls_ciphers for cipher controls that apply to opportunistic -TLS.

    +

    The minimum TLS cipher grade that the Postfix SMTP server will +use with mandatory TLS encryption. The default grade ("medium") is +sufficiently strong that any benefit from globally restricting TLS +sessions to a more stringent grade is likely negligible, especially +given the fact that many implementations still do not offer any stronger +("high" grade) ciphers, while those that do, will always use "high" +grade ciphers. So insisting on "high" grade ciphers is generally +counter-productive. Allowing "export" or "low" ciphers is typically +not a good idea, as systems limited to just these are limited to +obsolete browsers. No known SMTP clients fail to support at least +one "medium" or "high" grade cipher.

    The following cipher grades are supported:

    export
    -
    Enable the mainstream "EXPORT" grade or better OpenSSL ciphers. +
    Enable "EXPORT" grade or stronger OpenSSL ciphers. This is the most appropriate setting for public MX hosts, and is always used with opportunistic TLS encryption. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, -which you are strongly encouraged to not change. The default value -of tls_export_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the server is configured to ask for -client certificates. If you must always exclude anonymous ciphers, -set "smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers -only when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = -aNULL".
    +which you are strongly encouraged to not change.
    low
    -
    Enable the mainstream "LOW" grade or better OpenSSL ciphers. The +
    Enable "LOW" grade or stronger OpenSSL ciphers. The underlying cipherlist is specified via the tls_low_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_low_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
    +not change.
    medium
    -
    Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. These -are essentially the 128-bit or stronger ciphers. This is the default -minimum strength for mandatory TLS encryption. MSAs that enforce -TLS and have clients that do not support any "MEDIUM" or "HIGH" -grade ciphers, may need to configure a weaker ("low" or "export") -minimum cipher grade. The underlying cipherlist is specified via the -tls_medium_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_medium_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
    +
    Enable "MEDIUM" grade or stronger OpenSSL ciphers. These use 128-bit +or longer symmetric bulk-encryption keys. This is the default minimum +strength for mandatory TLS encryption. The underlying cipherlist is +specified via the tls_medium_cipherlist configuration parameter, which +you are strongly encouraged to not change.
    high
    -
    Enable only the mainstream "HIGH" grade OpenSSL ciphers. The +
    Enable only "HIGH" grade OpenSSL ciphers. The underlying cipherlist is specified via the tls_high_cipherlist configuration parameter, which you are strongly encouraged to -not change. The default value of tls_high_cipherlist includes -anonymous ciphers, but these are automatically filtered out if the -server is configured to ask for client certificates. If you must -always exclude anonymous ciphers, set "smtpd_tls_exclude_ciphers = -aNULL". To exclude anonymous ciphers only when TLS is enforced, set -"smtpd_tls_mandatory_exclude_ciphers = aNULL".
    +not change.
    null
    Enable only the "NULL" OpenSSL ciphers, these provide authentication @@ -10835,12 +10816,25 @@ without encryption. This setting is only appropriate in the rare case that all clients are prepared to use NULL ciphers (not normally enabled in TLS clients). The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_null_cipherlist -excludes anonymous ciphers (OpenSSL 0.9.8 has NULL ciphers that offer -data integrity without encryption or authentication).
    +encouraged to not change. +

    Cipher types listed in +smtpd_tls_mandatory_exclude_ciphers or smtpd_tls_exclude_ciphers are +excluded from the base definition of the selected cipher grade. See +smtpd_tls_ciphers for cipher controls that apply to opportunistic +TLS.

    + +

    The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +server is configured to ask for client certificates. You are very +unlikely to need to take any steps to exclude anonymous ciphers, they +are excluded automatically as required. If you must exclude anonymous +ciphers even when Postfix does not need or use peer certificates, set +"smtpd_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only +when TLS is enforced, set "smtpd_tls_mandatory_exclude_ciphers = aNULL".

    +

    This feature is available in Postfix 2.3 and later.

    %PARAM smtpd_tls_exclude_ciphers @@ -10889,7 +10883,7 @@ works in addition to the exclusions listed with smtpd_tls_exclude_ciphers use with mandatory TLS encryption. The default value "medium" is suitable for most destinations with which you may want to enforce TLS, and -is beyond the reach of today's crypt-analytic methods. See +is beyond the reach of today's cryptanalytic methods. See smtp_tls_policy_maps for information on how to configure ciphers on a per-destination basis.

    @@ -10897,47 +10891,32 @@ on a per-destination basis.

    export
    -
    Enable the mainstream "EXPORT" grade or better OpenSSL -ciphers. This is always used for opportunistic encryption. It is +
    Enable "EXPORT" grade or better OpenSSL +ciphers. This is the default for opportunistic encryption. It is not recommended for mandatory encryption unless you must enforce TLS with "crippled" peers. The underlying cipherlist is specified via the tls_export_cipherlist configuration parameter, which you are strongly -encouraged to not change. The default value of tls_export_cipherlist -includes anonymous ciphers, but these are automatically filtered out if -the client is configured to verify server certificates. If you must -exclude anonymous ciphers also at the "encrypt" security level, set -"smtp_tls_mandatory_exclude_ciphers = aNULL".
    +encouraged to not change.
    low
    -
    Enable the mainstream "LOW" grade or better OpenSSL ciphers. This +
    Enable "LOW" grade or better OpenSSL ciphers. This setting is only appropriate for internal mail servers. The underlying cipherlist is specified via the tls_low_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_low_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL".
    +parameter, which you are strongly encouraged to not change.
    medium
    -
    Enable the mainstream "MEDIUM" grade or better OpenSSL ciphers. +
    Enable "MEDIUM" grade or better OpenSSL ciphers. The underlying cipherlist is specified via the tls_medium_cipherlist configuration parameter, which you are strongly encouraged to not change. -The default value of tls_medium_cipherlist includes anonymous ciphers, -but these are automatically filtered out if the client is configured to -verify server certificates. If you must exclude anonymous ciphers also -at the "encrypt" security level, set "smtp_tls_mandatory_exclude_ciphers -= aNULL".
    +
    high
    -
    Enable only the mainstream "HIGH" grade OpenSSL ciphers. This -setting is appropriate when all mandatory TLS destinations support -some of "HIGH" grade ciphers, this is not uncommon. The underlying -cipherlist is specified via the tls_high_cipherlist configuration -parameter, which you are strongly encouraged to not change. The default -value of tls_high_cipherlist includes anonymous ciphers, but these are -automatically filtered out if the client is configured to verify server -certificates. If you must exclude anonymous ciphers also at the "encrypt" -security level, set "smtp_tls_mandatory_exclude_ciphers = aNULL".
    +
    Enable only "HIGH" grade OpenSSL ciphers. This setting may +be appropriate when all mandatory TLS destinations (e.g. when all +mail is routed to a suitably capable relayhost) support at least one +"HIGH" grade cipher. The underlying cipherlist is specified via the +tls_high_cipherlist configuration parameter, which you are strongly +encouraged to not change.
    null
    Enable only the "NULL" OpenSSL ciphers, these provide authentication @@ -10947,12 +10926,20 @@ in TLS servers). A plausible use-case is an LMTP server listening on a UNIX-domain socket that is configured to support "NULL" ciphers. The underlying cipherlist is specified via the tls_null_cipherlist configuration parameter, which you are strongly encouraged to not -change. The default value of tls_null_cipherlist excludes anonymous -ciphers (OpenSSL 0.9.8 has NULL ciphers that offer data integrity without -encryption or authentication).
    +change.
    +

    The underlying cipherlists for grades other than "null" include +anonymous ciphers, but these are automatically filtered out if the +Postfix SMTP client is configured to verify server certificates. +You are very unlikely to need to take any steps to exclude anonymous +ciphers, they are excluded automatically as necessary. If you must +exclude anonymous ciphers at the "may" or "encrypt" security levels, +when the Postfix SMTP client does not need or use peer certificates, set +"smtp_tls_exclude_ciphers = aNULL". To exclude anonymous ciphers only when +TLS is enforced, set "smtp_tls_mandatory_exclude_ciphers = aNULL".

    +

    This feature is available in Postfix 2.3 and later.

    %PARAM smtp_tls_exclude_ciphers @@ -12445,232 +12432,6 @@ inspection for DKIM-signed mail from known friendly domains.

    This feature is available in Postfix 2.7, and as an optional patch for Postfix 2.6.

    -%PARAM postscreen_cache_map btree:$data_directory/ps_whitelist - -

    Persistent storage for the postscreen(8) server decisions.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM smtpd_service smtpd - -

    The internal service that postscreen(8) forwards allowed -connections to. In a future version there may be different -classes of SMTP service.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_post_queue_limit $default_process_limit - -

    The number of clients that can be waiting for service from a -real SMTP server process. When this queue is full, all clients will -receive a 421 reponse.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_pre_queue_limit $default_process_limit - -

    The number of non-whitelisted clients that can be waiting for -a decision whether they will receive service from a real SMTP server -process. When this queue is full, all non-whitelisted clients will -receive a 421 reponse.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_cache_ttl 1d - -

    The amount of time that postscreen(8) will cache a decision for -a specific SMTP client IP address. During this time, the client IP -address is excluded from tests. If possible, expired decisions are -renewed automatically. 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.7.

    - -%PARAM postscreen_cache_retention_time 1d - -

    The amount of time that postscreen(8) will cache an expired -temporary whitelist entry before it is removed. This prevents clients -from being logged as "NEW" just because their cache entry expired -an hour ago.

    - -

    Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks).

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_cache_cleanup_interval 12h - -

    The amount of time between postscreen(8) cache cleanup runs. -Cache cleanup increases the load on the cache database and should -therefore not be run frequently. This feature requires that the -cache database supports the "delete" and "sequence" operators. -Specify a zero interval to disable cache cleanup.

    - -

    After each cache cleanup run, the postscreen(8) daemon logs the -number of entries that were retained and dropped. A cleanup run is -logged as "partial" when the daemon terminates early after "postfix -reload", "postfix stop", or no requests for $max_idle -seconds.

    - -

    Time units: s (seconds), m (minutes), h (hours), d (days), w -(weeks).

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_greet_wait 4s - -

    The amount of time that postscreen(8) will wait for an SMTP -client to send a command before its turn, and for DNS blocklist -lookup results to arrive. This is done only when the SMTP client -IP address is not permanently whitelisted, and when it has no cached -decision. 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.7.

    - -%PARAM postscreen_dnsbl_sites - -

    Optional list of DNS blocklist domains. When the list is non-enpty, -the dnsblog(8) daemon will query these domains with the IP addresses -of non-whitelisted postscreen(8) clients. Specify a list of domain -names, separated by comma or whitespace.

    - -%PARAM postscreen_dnsbl_action continue - -

    The action that postscreen(8) takes when an SMTP client is listed -at the DNS blocklist domains specified with the postscreen_dnsbl_sites -parameter. Specify one of the following:

    - -
    - -
    continue
    - -
    Forward the connection to a real SMTP server process.

    - -
    drop
    - -
    Drop the connection with a 521 SMTP reply.
    - -
    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_greet_action continue - -

    The action that postscreen(8) takes when an SMTP client speaks -before its turn within the time specified with the postscreen_greet_wait -parameter. Specify one of the following:

    - -
    - -
    continue
    - -
    Continue waiting until the postscreen_greet_wait time has -elapsed. If the client is listed at the DNS blocklist domains -specified with the postscreen_dnsbl_sites parameter, execute the -action specified with the postscreen_dnsbl_action parameter, otherwise -forward the connection to a real SMTP server process.

    - -
    drop
    - -
    Drop the connection immediately with a 521 SMTP reply, without -examining DNSBL lookup results.
    - -
    - -

    In either case, postscreen(8) will not whitelist the SMTP client -IP address.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_hangup_action continue - -

    The action that postscreen(8) takes when an SMTP client disconnects -without sending data, within the time specified with the -postscreen_greet_wait parameter. Specify one of the following: -

    - -
    - -
    continue
    - -
    Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client is listed at the DNSBL sites -specified with the postscreen_dnsbl_sites parameter. Do not -forward the broken connection to a real SMTP server process.

    - -
    drop
    - -
    Drop the connection immediately, without reporting DNSBL lookup -results.
    - -
    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_whitelist_networks $mynetworks - -

    Network addresses that are permanently whitelisted, and that -will not be subjected to postscreen(8) checks. This parameter uses -the same address syntax as the mynetworks parameter. This feature -never uses the remote SMTP client hostname.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_blacklist_networks - -

    Network addresses that are permanently blacklisted; see the -postscreen_blacklist_action parameter for possible actions. This -parameter uses the same address syntax as the mynetworks parameter. -The blacklist has higher precedence than whitelists. This feature -never uses the remote SMTP client hostname.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_greet_banner $smtpd_banner - -

    The text in the optional "220-text..." server -response that -postscreen(8) sends ahead of the real Postfix SMTP server's "220 -text..." response, in an attempt to confuse bad SMTP clients so -that they speak before their turn (pre-greet). Specify an empty -value to disable this feature.

    - -

    This feature is available in Postfix 2.7.

    - -%PARAM postscreen_blacklist_action continue - -

    The action that postscreen(8) takes when an SMTP client is -permanently blacklisted with the postscreen_blacklist_networks -parameter. Specify one of the following:

    - -
    - -
    continue
    - -
    Continue waiting until the postscreen_greet_wait time has -elapsed, and report whether the client triggers a PREGREET or HANGUP -error, or whether the client is listed at the DNSBL sites specified -with the postscreen_dnsbl_sites parameter. Take the corresponding -action, or forward the connection to a real SMTP server process. -

    - -
    drop
    - -
    Drop the connection immediately with a 521 SMTP reply, without -reporting PREGREET, HANGUP or DNSBL results.
    - -
    - -

    This feature is available in Postfix 2.7.

    - %PARAM smtpd_command_filter

    A mechanism to transform commands from remote SMTP clients. @@ -12800,7 +12561,7 @@ configuration parameter. See there for details.

    This feature is available in Postfix 2.7 and later.

    -%PARAM empty_address_default_transport_maps_lookup_key <> +%PARAM empty_address_default_transport_maps_lookup_key <>

    The sender_dependent_default_transport_maps search string that will be used instead of the null sender address.

    diff --git a/postfix/proto/regexp_table b/postfix/proto/regexp_table index 5375ad787..ae062f675 100644 --- a/postfix/proto/regexp_table +++ b/postfix/proto/regexp_table @@ -70,7 +70,8 @@ # \fBre_format\fR(7) with 4.4BSD, in \fBregex\fR(5) with Solaris, and in # \fBregex\fR(7) with Linux. Other systems may use other document names. # -# The expression delimiter can be any character, except whitespace +# The expression delimiter can be any non-alphanumerical +# character, except whitespace # or characters that have special meaning (traditionally the forward # slash is used). The regular expression can contain whitespace. # diff --git a/postfix/src/dnsblog/.indent.pro b/postfix/src/dnsblog/.indent.pro deleted file mode 120000 index 5c837eca6..000000000 --- a/postfix/src/dnsblog/.indent.pro +++ /dev/null @@ -1 +0,0 @@ -../../.indent.pro \ No newline at end of file diff --git a/postfix/src/dnsblog/Makefile.in b/postfix/src/dnsblog/Makefile.in deleted file mode 100644 index ec5391912..000000000 --- a/postfix/src/dnsblog/Makefile.in +++ /dev/null @@ -1,78 +0,0 @@ -SHELL = /bin/sh -SRCS = dnsblog.c -OBJS = dnsblog.o -HDRS = -TESTSRC = -DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) -CFLAGS = $(DEBUG) $(OPT) $(DEFS) -TESTPROG= -PROG = dnsblog -INC_DIR = ../../include -LIBS = ../../lib/libdns.a ../../lib/libmaster.a ../../lib/libglobal.a \ - ../../lib/libutil.a - -.c.o:; $(CC) $(CFLAGS) -c $*.c - -$(PROG): $(OBJS) $(LIBS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) - -$(OBJS): ../../conf/makedefs.out - -Makefile: Makefile.in - cat ../../conf/makedefs.out $? >$@ - -test: $(TESTPROG) - -tests: test - -root_tests: - -update: ../../libexec/$(PROG) - -../../libexec/$(PROG): $(PROG) - cp $(PROG) ../../libexec - -printfck: $(OBJS) $(PROG) - rm -rf printfck - mkdir printfck - sed '1,/^# do not edit/!d' Makefile >printfck/Makefile - set -e; for i in *.c; do printfck -f .printfck $$i >printfck/$$i; done - cd printfck; make "INC_DIR=../../../include" `cd ..; ls *.o` - -lint: - lint $(DEFS) $(SRCS) $(LINTFIX) - -clean: - rm -f *.o *core $(PROG) $(TESTPROG) junk - rm -rf printfck - -tidy: clean - -depend: $(MAKES) - (sed '1,/^# do not edit/!d' Makefile.in; \ - set -e; for i in [a-z][a-z0-9]*.c; do \ - $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \ - -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \ - -e 's/o: \.\//o: /' -e p -e '}' ; \ - done | sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in - @$(EXPORT) make -f Makefile.in Makefile 1>&2 - -# do not edit below this line - it is generated by 'make depend' -dnsblog.o: ../../include/argv.h -dnsblog.o: ../../include/attr.h -dnsblog.o: ../../include/dns.h -dnsblog.o: ../../include/iostuff.h -dnsblog.o: ../../include/mail_conf.h -dnsblog.o: ../../include/mail_params.h -dnsblog.o: ../../include/mail_proto.h -dnsblog.o: ../../include/mail_server.h -dnsblog.o: ../../include/mail_version.h -dnsblog.o: ../../include/msg.h -dnsblog.o: ../../include/myaddrinfo.h -dnsblog.o: ../../include/sock_addr.h -dnsblog.o: ../../include/sys_defs.h -dnsblog.o: ../../include/valid_hostname.h -dnsblog.o: ../../include/vbuf.h -dnsblog.o: ../../include/vstream.h -dnsblog.o: ../../include/vstring.h -dnsblog.o: dnsblog.c diff --git a/postfix/src/dnsblog/dnsblog.c b/postfix/src/dnsblog/dnsblog.c deleted file mode 100644 index 60a943e02..000000000 --- a/postfix/src/dnsblog/dnsblog.c +++ /dev/null @@ -1,258 +0,0 @@ -/*++ -/* NAME -/* dnsblog 8 -/* SUMMARY -/* Postfix DNS blocklist logger -/* SYNOPSIS -/* \fBdnsblog\fR [generic Postfix daemon options] -/* DESCRIPTION -/* The \fBdnsblog\fR(8) server implements an ad-hoc DNS blocklist -/* lookup service that will eventually be replaced by an UDP -/* client that is built directly into the \fBpostscreen\fR(8) -/* server. -/* -/* With each connection, the \fBdnsblog\fR(8) server receives -/* a DNS blocklist domain name and an IP address. If the address -/* is listed under the DNS blocklist, the \fBdnsblog\fR(8) -/* server logs the match and replies with the query arguments -/* plus a non-zero status. Otherwise it replies with the query -/* arguments plus a zero status. Finally, The \fBdnsblog\fR(8) -/* server closes the connection. -/* DIAGNOSTICS -/* Problems and transactions are logged to \fBsyslogd\fR(8). -/* CONFIGURATION PARAMETERS -/* .ad -/* .fi -/* Changes to \fBmain.cf\fR are picked up automatically, as -/* \fBdnsblog\fR(8) processes run for only a limited amount -/* of time. 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. -/* .IP "\fBconfig_directory (see 'postconf -d' output)\fR" -/* The default location of the Postfix main.cf and master.cf -/* configuration files. -/* .IP "\fBdaemon_timeout (18000s)\fR" -/* How much time a Postfix daemon process may take to handle a -/* request before it is terminated by a built-in watchdog timer. -/* .IP "\fBpostscreen_dnsbl_sites (empty)\fR" -/* Optional list of DNS blocklist domains. -/* .IP "\fBipc_timeout (3600s)\fR" -/* The time limit for sending or receiving information over an internal -/* communication channel. -/* .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 "\fBqueue_directory (see 'postconf -d' output)\fR" -/* The location of the Postfix top-level queue directory. -/* .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". -/* SEE ALSO -/* smtpd(8), Postfix SMTP server -/* postconf(5), configuration parameters -/* syslogd(5), system logging -/* LICENSE -/* .ad -/* .fi -/* The Secure Mailer license must be distributed with this software. -/* HISTORY -/* .ad -/* .fi -/* This service is temporary with Postfix version 2.7. -/* AUTHOR(S) -/* Wietse Venema -/* IBM T.J. Watson Research -/* P.O. Box 704 -/* Yorktown Heights, NY 10598, USA -/*--*/ - -/* System library. */ - -#include - -/* Utility library. */ - -#include -#include -#include -#include -#include -#include -#include - -/* Global library. */ - -#include -#include -#include - -/* DNS library. */ - -#include - -/* Server skeleton. */ - -#include - -/* Application-specific. */ - - /* - * Static so we don't allocate and free on every request. - */ -static VSTRING *rbl_domain; -static VSTRING *addr; -static VSTRING *query; -static VSTRING *why; - - /* - * Silly little macros. - */ -#define STR(x) vstring_str(x) - -/* static void dnsblog_query - query DNSBL for client address */ - -static int dnsblog_query(const char *dnsbl_domain, const char *addr) -{ - const char *myname = "dnsblog_query"; - ARGV *octets; - int i; - struct addrinfo *res; - unsigned char *ipv6_addr; - int dns_status; - DNS_RR *addr_list; - DNS_RR *rr; - MAI_HOSTADDR_STR hostaddr; - int found = 0; - - if (msg_verbose) - msg_info("%s: addr %s dnsbl_domain %s", - myname, addr, dnsbl_domain); - - VSTRING_RESET(query); - - /* - * Reverse the client IPV6 address, represented as 32 hexadecimal - * nibbles. We use the binary address to avoid tricky code. Asking for an - * AAAA record makes no sense here. Just like with IPv4 we use the lookup - * result as a bit mask, not as an IP address. - */ -#ifdef HAS_IPV6 - if (valid_ipv6_hostaddr(addr, DONT_GRIPE)) { - if (hostaddr_to_sockaddr(addr, (char *) 0, 0, &res) != 0 - || res->ai_family != PF_INET6) - msg_fatal("%s: unable to convert address %s", myname, addr); - ipv6_addr = (unsigned char *) &SOCK_ADDR_IN6_ADDR(res->ai_addr); - for (i = sizeof(SOCK_ADDR_IN6_ADDR(res->ai_addr)) - 1; i >= 0; i--) - vstring_sprintf_append(query, "%x.%x.", - ipv6_addr[i] & 0xf, ipv6_addr[i] >> 4); - freeaddrinfo(res); - } else -#endif - - /* - * Reverse the client IPV4 address, represented as four decimal octet - * values. We use the textual address for convenience. - */ - { - octets = argv_split(addr, "."); - for (i = octets->argc - 1; i >= 0; i--) { - vstring_strcat(query, octets->argv[i]); - vstring_strcat(query, "."); - } - argv_free(octets); - } - - /* - * Tack on the RBL domain name and query the DNS for an A record. Don't - * do this for AAAA records. Yet. - */ - vstring_strcat(query, dnsbl_domain); - dns_status = dns_lookup(STR(query), T_A, 0, &addr_list, (VSTRING *) 0, why); - if (dns_status == DNS_OK) { - for (rr = addr_list; rr != 0; rr = rr->next) { - if (dns_rr_to_pa(rr, &hostaddr) == 0) { - msg_warn("%s: skipping reply record type %s for query %s: %m", - myname, dns_strtype(rr->type), STR(query)); - } else { - msg_info("addr %s blocked by domain %s as %s", - addr, dnsbl_domain, hostaddr.buf); - found = 1; - } - } - dns_rr_free(addr_list); - } else if (dns_status == DNS_NOTFOUND) { - if (msg_verbose) - msg_info("%s: addr %s not listed under domain %s", - myname, addr, dnsbl_domain); - } else { - msg_warn("%s: lookup error for DNS query %s: %s", - myname, STR(query), STR(why)); - } - return (found); -} - -/* dnsblog_service - perform service for client */ - -static void dnsblog_service(VSTREAM *client_stream, char *unused_service, - char **argv) -{ - int found; - - /* - * Sanity check. This service takes no command-line arguments. - */ - if (argv[0]) - msg_fatal("unexpected command-line argument: %s", argv[0]); - - /* - * This routine runs whenever a client connects to the socket dedicated - * to the dnsblog service. All connection-management stuff is handled by - * the common code in single_server.c. - */ - if (attr_scan(client_stream, - ATTR_FLAG_MORE | ATTR_FLAG_STRICT, - ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, rbl_domain, - ATTR_TYPE_STR, MAIL_ATTR_ADDR, addr, - ATTR_TYPE_END) == 2) { - found = dnsblog_query(STR(rbl_domain), STR(addr)); - attr_print(client_stream, ATTR_FLAG_NONE, - ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, STR(rbl_domain), - ATTR_TYPE_STR, MAIL_ATTR_ADDR, STR(addr), - ATTR_TYPE_INT, MAIL_ATTR_STATUS, found, - ATTR_TYPE_END); - vstream_fflush(client_stream); - } -} - -/* post_jail_init - post-jail initialization */ - -static void post_jail_init(char *unused_name, char **unused_argv) -{ - rbl_domain = vstring_alloc(100); - addr = vstring_alloc(100); - query = vstring_alloc(100); - why = vstring_alloc(100); -} - -MAIL_VERSION_STAMP_DECLARE; - -/* main - pass control to the multi-threaded skeleton */ - -int main(int argc, char **argv) -{ - - /* - * Fingerprint executables and core dumps. - */ - MAIL_VERSION_STAMP_ALLOCATE; - - multi_server_main(argc, argv, dnsblog_service, - MAIL_SERVER_POST_INIT, post_jail_init, - MAIL_SERVER_UNLIMITED, - 0); -} diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index ba98408e0..0c1c353d5 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20100117" -#define MAIL_VERSION_NUMBER "2.7" +#define MAIL_RELEASE_DATE "20100203" +#define MAIL_VERSION_NUMBER "2.7.0-RC1" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index c49a9479c..2cdccebe3 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -259,7 +259,6 @@ /* 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 /* proxymap(8), Postfix lookup table proxy server /* qmgr(8), Postfix queue manager /* qmqpd(8), Postfix QMQP server diff --git a/postfix/src/postqueue/postqueue.c b/postfix/src/postqueue/postqueue.c index 24f08d9d0..4dfedabb7 100644 --- a/postfix/src/postqueue/postqueue.c +++ b/postfix/src/postqueue/postqueue.c @@ -48,8 +48,7 @@ /* Each queue entry shows the queue file ID, message /* size, arrival time, sender, and the recipients that still need to /* be delivered. If mail could not be delivered upon the last attempt, -/* the reason for failure is shown. This mode of operation is implemented -/* by executing the \fBpostqueue\fR(1) command. The queue ID string +/* the reason for failure is shown. The queue ID string /* is followed by an optional status character: /* .RS /* .IP \fB*\fR diff --git a/postfix/src/postscreen/.indent.pro b/postfix/src/postscreen/.indent.pro deleted file mode 120000 index 5c837eca6..000000000 --- a/postfix/src/postscreen/.indent.pro +++ /dev/null @@ -1 +0,0 @@ -../../.indent.pro \ No newline at end of file diff --git a/postfix/src/postscreen/Makefile.in b/postfix/src/postscreen/Makefile.in deleted file mode 100644 index dc3403e6c..000000000 --- a/postfix/src/postscreen/Makefile.in +++ /dev/null @@ -1,89 +0,0 @@ -SHELL = /bin/sh -SRCS = postscreen.c -OBJS = postscreen.o -HDRS = -TESTSRC = -DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) -CFLAGS = $(DEBUG) $(OPT) $(DEFS) -TESTPROG= -PROG = postscreen -INC_DIR = ../../include -LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a - -.c.o:; $(CC) $(CFLAGS) -c $*.c - -$(PROG): $(OBJS) $(LIBS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) - -$(OBJS): ../../conf/makedefs.out - -Makefile: Makefile.in - cat ../../conf/makedefs.out $? >$@ - -test: $(TESTPROG) - -tests: test - -root_tests: - -update: ../../libexec/$(PROG) - -../../libexec/$(PROG): $(PROG) - cp $(PROG) ../../libexec - -printfck: $(OBJS) $(PROG) - rm -rf printfck - mkdir printfck - sed '1,/^# do not edit/!d' Makefile >printfck/Makefile - set -e; for i in *.c; do printfck -f .printfck $$i >printfck/$$i; done - cd printfck; make "INC_DIR=../../../include" `cd ..; ls *.o` - -lint: - lint $(DEFS) $(SRCS) $(LINTFIX) - -clean: - rm -f *.o *core $(PROG) $(TESTPROG) junk - rm -rf printfck - -tidy: clean - -depend: $(MAKES) - (sed '1,/^# do not edit/!d' Makefile.in; \ - set -e; for i in [a-z][a-z0-9]*.c; do \ - $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \ - -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \ - -e 's/o: \.\//o: /' -e p -e '}' ; \ - done | sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in - @$(EXPORT) make -f Makefile.in Makefile 1>&2 - -# do not edit below this line - it is generated by 'make depend' -postscreen.o: ../../include/addr_match_list.h -postscreen.o: ../../include/argv.h -postscreen.o: ../../include/attr.h -postscreen.o: ../../include/connect.h -postscreen.o: ../../include/data_redirect.h -postscreen.o: ../../include/dict.h -postscreen.o: ../../include/dict_cache.h -postscreen.o: ../../include/events.h -postscreen.o: ../../include/format_tv.h -postscreen.o: ../../include/htable.h -postscreen.o: ../../include/iostuff.h -postscreen.o: ../../include/mail_conf.h -postscreen.o: ../../include/mail_params.h -postscreen.o: ../../include/mail_proto.h -postscreen.o: ../../include/mail_server.h -postscreen.o: ../../include/mail_version.h -postscreen.o: ../../include/match_list.h -postscreen.o: ../../include/match_ops.h -postscreen.o: ../../include/msg.h -postscreen.o: ../../include/myaddrinfo.h -postscreen.o: ../../include/mymalloc.h -postscreen.o: ../../include/name_code.h -postscreen.o: ../../include/sane_accept.h -postscreen.o: ../../include/set_eugid.h -postscreen.o: ../../include/stringops.h -postscreen.o: ../../include/sys_defs.h -postscreen.o: ../../include/vbuf.h -postscreen.o: ../../include/vstream.h -postscreen.o: ../../include/vstring.h -postscreen.o: postscreen.c diff --git a/postfix/src/postscreen/postscreen.c b/postfix/src/postscreen/postscreen.c deleted file mode 100644 index ec8e11a28..000000000 --- a/postfix/src/postscreen/postscreen.c +++ /dev/null @@ -1,1407 +0,0 @@ -/*++ -/* NAME -/* postscreen 8 -/* SUMMARY -/* Postfix SMTP triage server -/* SYNOPSIS -/* \fBpostscreen\fR [generic Postfix daemon options] -/* DESCRIPTION -/* The Postfix \fBpostscreen\fR(8) server performs triage on -/* multiple inbound SMTP connections in parallel. While -/* \fBpostscreen\fR(8) keeps zombies and other bogus clients -/* away from Postfix SMTP server processes, more Postfix SMTP -/* server processes remain available for legitimate clients. -/* GENERAL OPERATION -/* .ad -/* .fi -/* The triage process involves a number of tests, in the order -/* as described below. Some tests introduce a delay of a few -/* seconds. Once a client passes all tests, its IP address -/* is temporarily excluded from the tests, typically for 24 -/* hours. This minimizes the impact of the tests on legitimate -/* mail clients. -/* -/* After logging the result of its tests, \fBpostscreen\fR(8) -/* by default forwards all connections to a real SMTP server -/* process. This mode is useful for non-destructive testing. -/* -/* In a typical production setting, \fBpostscreen\fR(8) is -/* configured to disconnect clients that fail some tests. A -/* future implementation may pass the connection to a dummy -/* SMTP protocol engine that logs sender and recipient information -/* before hanging up. -/* -/* Note: \fBpostscreen\fR(8) is not an SMTP proxy; this is -/* intentional. The purpose is to prioritize legitimate clients -/* with as little overhead as possible. -/* .SH 1. PERMANENT WHITELIST TEST -/* .ad -/* .fi -/* The postscreen_whitelist_networks parameter (default: -/* $mynetworks) specifies a permanent whitelist for SMTP client -/* IP addresses. -/* -/* When the SMTP client address matches the permanent whitelist, -/* this is logged as: -/* .sp -/* .nf -/* \fBWHITELISTED \fIaddress\fR -/* .fi -/* .sp -/* The action is not configurable: immediately forward the -/* connection to a real SMTP server process. -/* .SH 2. PERMANENT BLACKLIST TEST -/* .ad -/* .fi -/* The postscreen_blacklist_networks parameter (default: empty) -/* specifies a permanent blacklist for SMTP client IP addresses. -/* The address syntax is as with mynetworks. -/* -/* When the SMTP client address matches the permanent blacklist, -/* this is logged as: -/* .sp -/* .nf -/* \fBBLACKLISTED \fIaddress\fR -/* .fi -/* .sp -/* The postscreen_blacklist_action parameter specifies the -/* action that is taken next: -/* .IP "\fBcontinue\fR (default)" -/* Continue with the SMTP GREETING PHASE TESTS below. -/* .IP \fBdrop\fR -/* Drop the connection immediately with a 521 SMTP reply. In -/* a future implementation, the connection may instead be -/* passed to a dummy SMTP protocol engine that logs sender and -/* recipient information. -/* .SH 3. TEMPORARY WHITELIST TEST -/* .ad -/* .fi -/* The \fBpostscreen\fR(8) daemon maintains a \fItemporary\fR -/* whitelist for SMTP client IP addresses that have passed all -/* the tests described below. The postscreen_cache_map parameter -/* specifies the location of the temporary whitelist. The -/* temporary whitelist is not used for SMTP client addresses -/* that appear on the \fIpermanent\fR blacklist or whitelist. -/* -/* When the SMTP client address appears on the temporary -/* whitelist, this is logged as: -/* .sp -/* .nf -/* \fBPASS OLD \fIaddress\fR -/* .fi -/* .sp -/* The action is not configurable: immediately forward the -/* connection to a real SMTP server process. The client is -/* excluded from further tests until its temporary whitelist -/* entry expires, as controlled with the postscreen_cache_ttl -/* parameter. Expired entries are silently renewed if possible. -/* .SH 4. SMTP GREETING PHASE TESTS -/* .ad -/* .fi -/* The postscreen_greet_wait parameter specifies a time interval -/* during which \fBpostscreen\fR(8) runs a number of tests in -/* parallel. These tests are described below, and are run -/* before the client may see the real SMTP server's "220 -/* text..." server greeting. -/* -/* When the SMTP client passes all greeting-phase tests, this -/* is logged as: -/* .sp -/* .nf -/* \fBPASS NEW \fIaddress\fR -/* .fi -/* .sp -/* The action is to forward the connection to a real SMTP -/* server process and to create a temporary whitelist entry -/* that excludes the client IP address from further tests until -/* the temporary whitelist entry expires, as controlled with -/* the postscreen_cache_ttl parameter. -/* -/* In a future implementation, the connection may first be passed to -/* a dummy SMTP protocol engine that implements more protocol -/* tests including greylisting, before the client is allowed -/* to talk to a real SMTP server process. -/* .SH 4A. PREGREET TEST -/* .ad -/* .fi -/* The postscreen_greet_banner parameter specifies the \fItext\fR -/* portion of a "220-\fItext\fR..." teaser banner (default: -/* $smtpd_banner). -/* The \fBpostscreen\fR(8) daemon sends this before the -/* postscreen_greet_wait timer is started. The purpose of the -/* teaser banner is to confuse SPAM clients so that they speak -/* before their turn. It has no effect on SMTP clients that -/* correctly implement the protocol. -/* -/* To avoid problems with broken SMTP engines in network -/* appliances, either exclude them from all tests with the -/* postscreen_whitelist_networks feature or else specify an -/* empty postscreen_greet_banner value to disable the "220-text..." -/* teaser banner. -/* -/* When an SMTP client sends a command before the -/* postscreen_greet_wait time has elapsed, this is logged as: -/* .sp -/* .nf -/* \fBPREGREET \fIcount \fBafter \fItime \fBfrom \fIaddress text...\fR -/* .fi -/* .sp -/* Translation: the client at \fIaddress\fR sent \fIcount\fR -/* bytes before its turn to speak, and this happened \fItime\fR -/* seconds after the postscreen_greet_wait timer was started. -/* The \fItext\fR is what the client sent (truncated to 100 -/* bytes, and with non-printable characters replaced with "?"). -/* -/* The postscreen_greet_action parameter specifies the action -/* that is taken next: -/* .IP "\fBcontinue\fR (default)" -/* Wait until the postscreen_greet_wait time has elapsed, then -/* report DNSBL lookup results if applicable. Either perform -/* DNSBL-related actions or forward the connection to a real -/* SMTP server process. -/* .IP \fBdrop\fR -/* Drop the connection immediately with a 521 SMTP reply. -/* In a future implementation, the connection may instead be passed -/* to a dummy SMTP protocol engine that logs sender and recipient -/* information. -/* .SH 4B. HANGUP TEST -/* .ad -/* .fi -/* When the SMTP client hangs up without sending any data -/* before the postscreen_greet_wait time has elapsed, this is -/* logged as: -/* .sp -/* .nf -/* \fBHANGUP after \fItime \fBfrom \fIaddress\fR -/* .fi -/* .sp -/* The postscreen_hangup_action specifies the action -/* that is taken next: -/* .IP "\fBcontinue\fR (default)" -/* Wait until the postscreen_greet_wait time has elapsed, then -/* report DNSBL lookup results if applicable. Do not forward -/* the broken connection to a real SMTP server process. -/* .IP \fBdrop\fR -/* Drop the connection immediately. -/* .SH 4C. DNS BLOCKLIST TEST -/* .ad -/* .fi -/* The postscreen_dnsbl_sites parameter (default: empty) -/* specifies a list of DNS blocklist servers. These lookups -/* are made in parallel. -/* -/* When the postscreen_greet_wait time has elapsed, and the -/* SMTP client address is listed with at least one of these -/* blocklists, this is logged as: -/* .sp -/* .nf -/* \fBDNSBL rank \fIcount \fBfor \fIaddress\fR -/* .fi -/* .sp -/* Translation: the client at \fIaddress\fR is listed with -/* \fIcount\fR DNSBL servers. The \fIcount\fR does not -/* depend on the number of DNS records that an individual DNSBL -/* server returns. -/* -/* The postscreen_dnsbl_action parameter specifies the action -/* that is taken next: -/* .IP "\fBcontinue\fR (default)" -/* Forward the connection to a real SMTP server process. -/* .IP \fBdrop\fR -/* Drop the connection immediately with a 521 SMTP reply. -/* In a future implementation, the connection may instead be passed -/* to a dummy SMTP protocol engine that logs sender and recipient -/* information. -/* SECURITY -/* .ad -/* .fi -/* The \fBpostscreen\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. -/* STANDARDS -/* RFC 5321 (SMTP, including multi-line 220 greetings) -/* RFC 2920 (SMTP Pipelining) -/* DIAGNOSTICS -/* Problems and transactions are logged to \fBsyslogd\fR(8). -/* CONFIGURATION PARAMETERS -/* .ad -/* .fi -/* Changes to main.cf are not picked up automatically, as -/* \fBpostscreen\fR(8) processes may run for several hours. -/* Use the command "postfix reload" after a configuration -/* change. -/* -/* The text below provides only a parameter summary. See -/* \fBpostconf\fR(5) for more details including examples. -/* TRIAGE PARAMETERS -/* .ad -/* .fi -/* .IP "\fBpostscreen_blacklist_action (continue)\fR" -/* The action that \fBpostscreen\fR(8) takes when an SMTP client is -/* permanently blacklisted with the postscreen_blacklist_networks -/* parameter. -/* .IP "\fBpostscreen_blacklist_networks (empty)\fR" -/* Network addresses that are permanently blacklisted; see the -/* postscreen_blacklist_action parameter for possible actions. -/* .IP "\fBpostscreen_dnsbl_action (continue)\fR" -/* The action that \fBpostscreen\fR(8) takes when an SMTP client is listed -/* at the DNS blocklist domains specified with the postscreen_dnsbl_sites -/* parameter. -/* .IP "\fBpostscreen_dnsbl_sites (empty)\fR" -/* Optional list of DNS blocklist domains. -/* .IP "\fBpostscreen_greet_action (continue)\fR" -/* The action that \fBpostscreen\fR(8) takes when an SMTP client speaks -/* before its turn within the time specified with the postscreen_greet_wait -/* parameter. -/* .IP "\fBpostscreen_greet_banner ($smtpd_banner)\fR" -/* The \fItext\fR in the optional "220-\fItext\fR..." server -/* response that -/* \fBpostscreen\fR(8) sends ahead of the real Postfix SMTP server's "220 -/* text..." response, in an attempt to confuse bad SMTP clients so -/* that they speak before their turn (pre-greet). -/* .IP "\fBpostscreen_greet_wait (4s)\fR" -/* The amount of time that \fBpostscreen\fR(8) will wait for an SMTP -/* client to send a command before its turn, and for DNS blocklist -/* lookup results to arrive. -/* .IP "\fBpostscreen_hangup_action (continue)\fR" -/* The action that \fBpostscreen\fR(8) takes when an SMTP client disconnects -/* without sending data, within the time specified with the -/* postscreen_greet_wait parameter. -/* .IP "\fBpostscreen_post_queue_limit ($default_process_limit)\fR" -/* The number of clients that can be waiting for service from a -/* real SMTP server process. -/* .IP "\fBpostscreen_pre_queue_limit ($default_process_limit)\fR" -/* The number of non-whitelisted clients that can be waiting for -/* a decision whether they will receive service from a real SMTP server -/* process. -/* .IP "\fBpostscreen_whitelist_networks ($mynetworks)\fR" -/* Network addresses that are permanently whitelisted, and that -/* will not be subjected to \fBpostscreen\fR(8) checks. -/* .IP "\fBsmtpd_service (smtpd)\fR" -/* The internal service that \fBpostscreen\fR(8) forwards allowed -/* connections to. -/* CACHE CONTROLS -/* .ad -/* .fi -/* .IP "\fBpostscreen_cache_cleanup_interval (12h)\fR" -/* The amount of time between \fBpostscreen\fR(8) cache cleanup runs. -/* .IP "\fBpostscreen_cache_map (btree:$data_directory/ps_whitelist)\fR" -/* Persistent storage for the \fBpostscreen\fR(8) server decisions. -/* .IP "\fBpostscreen_cache_retention_time (1d)\fR" -/* The amount of time that \fBpostscreen\fR(8) will cache an expired -/* temporary whitelist entry before it is removed. -/* .IP "\fBpostscreen_cache_ttl (1d)\fR" -/* The amount of time that \fBpostscreen\fR(8) will cache a decision for -/* a specific SMTP client IP address. -/* MISCELLANEOUS CONTROLS -/* .ad -/* .fi -/* .IP "\fBconfig_directory (see 'postconf -d' output)\fR" -/* The default location of the Postfix main.cf and master.cf -/* configuration files. -/* .IP "\fBdaemon_timeout (18000s)\fR" -/* How much time a Postfix daemon process may take to handle a -/* request before it is terminated by a built-in watchdog timer. -/* .IP "\fBdelay_logging_resolution_limit (2)\fR" -/* The maximal number of digits after the decimal point when logging -/* sub-second delay values. -/* .IP "\fBcommand_directory (see 'postconf -d' output)\fR" -/* The location of all postfix administrative commands. -/* .IP "\fBipc_timeout (3600s)\fR" -/* The time limit for sending or receiving information over an internal -/* communication channel. -/* .IP "\fBmax_idle (100s)\fR" -/* The maximum amount of time that an idle Postfix daemon process waits -/* for an incoming connection before terminating voluntarily. -/* .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". -/* SEE ALSO -/* smtpd(8), Postfix SMTP server -/* dnsblog(8), temporary DNS helper -/* syslogd(8), system logging -/* LICENSE -/* .ad -/* .fi -/* The Secure Mailer license must be distributed with this software. -/* AUTHOR(S) -/* Wietse Venema -/* IBM T.J. Watson Research -/* P.O. Box 704 -/* Yorktown Heights, NY 10598, USA -/*--*/ - -/* System library. */ - -#include -#include -#include - -#ifdef STRCASECMP_IN_STRINGS_H -#include -#endif - -#ifdef MISSING_STRTOUL -#define strtoul strtol -#endif - -/* Utility library. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Global library. */ - -#include -#include -#include -#include -#include -#include - -/* Master server protocols. */ - -#include - - /* - * Configuration parameters. - */ -char *var_smtpd_service; -char *var_smtpd_banner; -char *var_ps_cache_map; -int var_ps_post_queue_limit; -int var_ps_pre_queue_limit; -int var_proc_limit; -int var_ps_cache_ttl; -int var_ps_cache_ret; -int var_ps_cache_scan; -int var_ps_greet_wait; -char *var_ps_dnsbl_sites; -char *var_ps_dnsbl_action; -char *var_ps_greet_action; -char *var_ps_hangup_action; -char *var_ps_wlist_nets; -char *var_ps_blist_nets; -char *var_ps_greet_banner; -char *var_ps_blist_action; - - /* - * Per-session state. See also: new_session_state() and free_event_state() - * below. - */ -typedef struct { - int flags; /* see below */ - VSTREAM *smtp_client_stream; /* remote SMTP client */ - int smtp_server_fd; /* real SMTP server */ - char *smtp_client_addr; /* client address */ - char *smtp_client_port; /* client port */ - struct timeval creation_time; /* as the name says */ -} PS_STATE; - -#define PS_FLAG_NOCACHE (1<<0) /* don't store this client */ -#define PS_FLAG_NOFORWARD (1<<1) /* don't forward this session */ -#define PS_FLAG_EXPIRED (1<<2) /* whitelist expired */ -#define PS_FLAG_WHITELISTED (1<<3) /* whitelisted (temp or perm) */ - - /* - * This program screens all inbound SMTP connections, so it better not waste - * time. - */ -#define PS_GREET_TIMEOUT 5 -#define PS_SMTP_WRITE_TIMEOUT 1 -#define PS_SEND_SOCK_CONNECT_TIMEOUT 1 -#define PS_SEND_SOCK_NOTIFY_TIMEOUT 100 - -#define PS_READ_BUF_SIZE 1024 - -#define DNSBL_SERVICE "dnsblog" -#define DNSBLOG_TIMEOUT 10 - -#define PS_ACT_DROP 1 -#define PS_ACT_CONT 2 - -static int check_queue_length; /* connections being checked */ -static int post_queue_length; /* being sent to real SMTPD */ -static DICT_CACHE *cache_map; /* cache table handle */ -static VSTRING *temp; /* scratchpad */ -static char *smtp_service_name; /* path to real SMTPD */ -static char *teaser_greeting; /* spamware teaser banner */ -static ARGV *dnsbl_sites; /* dns blocklist domains */ -static VSTRING *reply_addr; /* address in DNSBL reply */ -static VSTRING *reply_domain; /* domain in DNSBL reply */ -static HTABLE *dnsbl_cache; /* entries being queried */ -static int dnsbl_action; /* PS_ACT_DROP or PS_ACT_CONT */ -static int greet_action; /* PS_ACT_DROP or PS_ACT_CONT */ -static int hangup_action; /* PS_ACT_DROP or PS_ACT_CONT */ -static ADDR_MATCH_LIST *wlist_nets; /* permanently whitelisted networks */ -static ADDR_MATCH_LIST *blist_nets; /* permanently blacklisted networks */ -static int blist_action; /* PS_ACT_DROP or PS_ACT_CONT */ - - /* - * See log_adhoc.c for discussion. - */ -typedef struct { - int dt_sec; /* make sure it's signed */ - int dt_usec; /* make sure it's signed */ -} DELTA_TIME; - -#define PS_CALC_DELTA(x, y, z) \ - do { \ - (x).dt_sec = (y).tv_sec - (z).tv_sec; \ - (x).dt_usec = (y).tv_usec - (z).tv_usec; \ - while ((x).dt_usec < 0) { \ - (x).dt_usec += 1000000; \ - (x).dt_sec -= 1; \ - } \ - while ((x).dt_usec >= 1000000) { \ - (x).dt_usec -= 1000000; \ - (x).dt_sec += 1; \ - } \ - if ((x).dt_sec < 0) \ - (x).dt_sec = (x).dt_usec = 0; \ - } while (0) - -#define SIG_DIGS 2 - -/* READ_EVENT_REQUEST - prepare for transition to next state */ - -#define READ_EVENT_REQUEST(fd, action, context, timeout) do { \ - if (msg_verbose) msg_info("%s: read-request fd=%d", myname, (fd)); \ - event_enable_read((fd), (action), (context)); \ - event_request_timer((action), (context), (timeout)); \ -} while (0) - -/* CLEAR_EVENT_REQUEST - complete state transition */ - -#define CLEAR_EVENT_REQUEST(fd, action, context) do { \ - if (msg_verbose) msg_info("%s: clear-request fd=%d", myname, (fd)); \ - event_disable_readwrite(fd); \ - event_cancel_timer((action), (context)); \ -} while (0) - -/* SLMs. */ - -#define STR(x) vstring_str(x) -#define LEN(x) VSTRING_LEN(x) - - /* - * Monitor time-critical operations. - */ -#define PS_GET_TIME_BEFORE_LOOKUP \ - struct timeval _before, _after; \ - DELTA_TIME _delta; \ - GETTIMEOFDAY(&_before); - -#define PS_DELTA_MS(d) ((d).dt_sec * 1000 + (d).dt_usec / 1000) - -#define PS_CHECK_TIME_AFTER_LOOKUP(table, action) \ - GETTIMEOFDAY(&_after); \ - PS_CALC_DELTA(_delta, _after, _before); \ - if (_delta.dt_sec > 1 || _delta.dt_usec > 100000) \ - msg_warn("%s: %s %s took %d ms", \ - myname, (table), (action), PS_DELTA_MS(_delta)); - -/* ps_addr_match_list_match - time-critical address list lookup */ - -static int ps_addr_match_list_match(ADDR_MATCH_LIST *addr_list, - const char *addr_str) -{ - const char *myname = "ps_addr_match_list_match"; - int result; - - PS_GET_TIME_BEFORE_LOOKUP; - result = addr_match_list_match(addr_list, addr_str); - PS_CHECK_TIME_AFTER_LOOKUP("address list", "lookup"); - return (result); -} - -/* ps_dict_get - time-critical table lookup */ - -static const char *ps_dict_get(DICT_CACHE *cache, const char *key) -{ - const char *myname = "ps_dict_get"; - const char *result; - - PS_GET_TIME_BEFORE_LOOKUP; - result = dict_cache_lookup(cache, key); - PS_CHECK_TIME_AFTER_LOOKUP(dict_cache_name(cache), "lookup"); - return (result); -} - -/* ps_dict_put - table dictionary update */ - -static void ps_dict_put(DICT_CACHE *cache, const char *key, const char *value) -{ - const char *myname = "ps_dict_put"; - - PS_GET_TIME_BEFORE_LOOKUP; - dict_cache_update(cache, key, value); - PS_CHECK_TIME_AFTER_LOOKUP(dict_cache_name(cache), "update"); -} - - /* - * DNSBL lookup status per client IP address. - */ -typedef struct { - int dnsbl_count; /* is this address listed */ - int refcount; /* query reference count */ -} PS_DNSBL_ENTRY; - -/* postscreen_dnsbl_entry_create - create blocklist cache entry */ - -static PS_DNSBL_ENTRY *postscreen_dnsbl_entry_create(void) -{ - PS_DNSBL_ENTRY *entry; - - entry = (PS_DNSBL_ENTRY *) mymalloc(sizeof(*entry)); - entry->dnsbl_count = 0; - entry->refcount = 0; - return (entry); -} - -/* postscreen_dnsbl_done - get blocklist cache entry, decrement refcount */ - -static int postscreen_dnsbl_done(const char *addr) -{ - const char *myname = "postscreen_dnsbl_done"; - PS_DNSBL_ENTRY *entry; - int dnsbl_count; - - /* - * Sanity check. - */ - if ((entry = (PS_DNSBL_ENTRY *) htable_find(dnsbl_cache, addr)) == 0) - msg_panic("%s: no blocklist cache entry for %s", myname, addr); - - /* - * Yes, cache reads are destructive. - */ - dnsbl_count = entry->dnsbl_count; - entry->refcount -= 1; - if (entry->refcount < 1) { - if (msg_verbose) - msg_info("%s: delete cache entry for %s", myname, addr); - htable_delete(dnsbl_cache, addr, myfree); - } - return (dnsbl_count); -} - -/* postscreen_dnsbl_reply - receive dnsbl reply, update blocklist cache entry */ - -static void postscreen_dnsbl_reply(int event, char *context) -{ - const char *myname = "postscreen_dnsbl_reply"; - VSTREAM *stream = (VSTREAM *) context; - PS_DNSBL_ENTRY *entry; - int dnsbl_count; - - CLEAR_EVENT_REQUEST(vstream_fileno(stream), postscreen_dnsbl_reply, context); - - /* - * Later, this will become an UDP-based DNS client that is built directly - * into the postscreen daemon. - * - * Don't panic when no blocklist cache entry exists. It may be gone when the - * client triggered a "drop" action after pregreet, DNSBL lookup, or - * hangup. - */ - if (event == EVENT_READ - && attr_scan(stream, - ATTR_FLAG_MORE | ATTR_FLAG_STRICT, - ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, reply_domain, - ATTR_TYPE_STR, MAIL_ATTR_ADDR, reply_addr, - ATTR_TYPE_INT, MAIL_ATTR_STATUS, &dnsbl_count, - ATTR_TYPE_END) == 3) { - if ((entry = (PS_DNSBL_ENTRY *) - htable_find(dnsbl_cache, STR(reply_addr))) != 0) - entry->dnsbl_count += dnsbl_count; - } - vstream_fclose(stream); -} - -/* postscreen_dnsbl_query - send dnsbl query */ - -static void postscreen_dnsbl_query(const char *addr) -{ - const char *myname = "postscreen_dnsbl_query"; - int fd; - VSTREAM *stream; - char **cpp; - PS_DNSBL_ENTRY *entry; - - /* - * Avoid duplicate effort when this lookup is already in progress. Now, - * we destroy the entry when the client replies. Later, we increment - * refcounts with queries sent, and decrement refcounts with replies - * received, so we can maintain state even after a client talks early, - * and update the external cache asynchronously. - */ - if ((entry = (PS_DNSBL_ENTRY *) htable_find(dnsbl_cache, addr)) != 0) { - entry->refcount += 1; - return; - } - if (msg_verbose) - msg_info("%s: create cache entry for %s", myname, addr); - entry = postscreen_dnsbl_entry_create(); - (void) htable_enter(dnsbl_cache, addr, (char *) entry); - entry->refcount = 1; - - /* - * Later, this will become an UDP-based DNS client that is built directly - * into the postscreen daemon. - */ - for (cpp = dnsbl_sites->argv; *cpp; cpp++) { - if ((fd = LOCAL_CONNECT("private/" DNSBL_SERVICE, NON_BLOCKING, 1)) < 0) { - msg_warn("%s: connect to " DNSBL_SERVICE " service: %m", myname); - return; - } - stream = vstream_fdopen(fd, O_RDWR); - attr_print(stream, ATTR_FLAG_NONE, - ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, *cpp, - ATTR_TYPE_STR, MAIL_ATTR_ADDR, addr, - ATTR_TYPE_END); - if (vstream_fflush(stream) != 0) { - msg_warn("%s: error sending to " DNSBL_SERVICE " service: %m", myname); - vstream_fclose(stream); - return; - } - READ_EVENT_REQUEST(vstream_fileno(stream), postscreen_dnsbl_reply, - (char *) stream, DNSBLOG_TIMEOUT); - } -} - -/* new_session_state - fill in connection state for event processing */ - -static PS_STATE *new_session_state(VSTREAM *stream, const char *addr, - const char *port) -{ - PS_STATE *state; - - state = (PS_STATE *) mymalloc(sizeof(*state)); - state->flags = 0; - if ((state->smtp_client_stream = stream) != 0) - check_queue_length++; - state->smtp_server_fd = (-1); - state->smtp_client_addr = mystrdup(addr); - state->smtp_client_port = mystrdup(port); - GETTIMEOFDAY(&state->creation_time); - return (state); -} - -/* free_session_state - destroy connection state including connections */ - -static void free_session_state(PS_STATE *state) -{ - if (state->smtp_client_stream != 0) { - event_server_disconnect(state->smtp_client_stream); - check_queue_length--; - } - if (state->smtp_server_fd >= 0) { - close(state->smtp_server_fd); - post_queue_length--; - } - myfree(state->smtp_client_addr); - myfree(state->smtp_client_port); - myfree((char *) state); - - if (check_queue_length < 0 || post_queue_length < 0) - msg_panic("bad queue length: check_queue=%d, post_queue=%d", - check_queue_length, post_queue_length); -} - -/* mydelta_time - pretty-formatted delta time */ - -static char *mydelta_time(VSTRING *buf, struct timeval tv, int *delta) -{ - DELTA_TIME pdelay; - struct timeval now; - - GETTIMEOFDAY(&now); - PS_CALC_DELTA(pdelay, now, tv); - VSTRING_RESET(buf); - format_tv(buf, pdelay.dt_sec, pdelay.dt_usec, SIG_DIGS, var_delay_max_res); - *delta = pdelay.dt_sec; - return (STR(buf)); -} - -/* smtp_reply - reply to the client */ - -static int smtp_reply(int smtp_client_fd, const char *smtp_client_addr, - const char *smtp_client_port, const char *text) -{ - int ret; - - /* - * XXX Need to make sure that the TCP send buffer is large enough for any - * response, so that a nasty client can't cause this process to block. - */ - ret = (write_buf(smtp_client_fd, text, strlen(text), 1) < 0); - if (ret != 0 && errno != EPIPE) - msg_warn("write %s:%s: %m", smtp_client_addr, smtp_client_port); - return (ret); -} - -/* send_socket_close_event - file descriptor has arrived or timeout */ - -static void send_socket_close_event(int event, char *context) -{ - const char *myname = "send_socket_close_event"; - PS_STATE *state = (PS_STATE *) context; - - if (msg_verbose) - msg_info("%s: sq=%d cq=%d event %d on send socket %d from %s:%s", - myname, post_queue_length, check_queue_length, - event, state->smtp_server_fd, state->smtp_client_addr, - state->smtp_client_port); - - /* - * The real SMTP server has closed the local IPC channel, or we have - * reached the limit of our patience. In the latter case it is still - * possible that the real SMTP server will receive the socket so we - * should not interfere. - */ - CLEAR_EVENT_REQUEST(state->smtp_server_fd, send_socket_close_event, context); - - switch (event) { - case EVENT_TIME: - msg_warn("timeout sending connection to service %s", smtp_service_name); - break; - default: - break; - } - free_session_state(state); -} - -/* send_socket - send socket to real smtpd */ - -static void send_socket(PS_STATE *state) -{ - const char *myname = "send_socket"; - int window_size; - - if (msg_verbose) - msg_info("%s: sq=%d cq=%d send socket %d from %s:%s", - myname, post_queue_length, check_queue_length, - vstream_fileno(state->smtp_client_stream), state->smtp_client_addr, - state->smtp_client_port); - - /* - * This is where we would adjust the window size to a value that is - * appropriate for this client class. - */ -#if 0 - window_size = 65535; - if (setsockopt(vstream_fileno(state->smtp_client_stream), SOL_SOCKET, SO_RCVBUF, - (char *) &window_size, sizeof(window_size)) < 0) - msg_warn("setsockopt SO_RCVBUF %d: %m", window_size); -#endif - - /* - * Connect to the real SMTP service over a local IPC channel, send the - * file descriptor, and close the file descriptor to save resources. - * Experience has shown that some systems will discard information when - * we close a channel immediately after writing. Thus, we waste resources - * waiting for the remote side to close the local IPC channel first. The - * good side of waiting is that we learn when the real SMTP server is - * falling behind. - * - * This is where we would forward the connection to an SMTP server that - * provides an appropriate level of service for this client class. For - * example, a server that is more forgiving, or one that is more - * suspicious. Alternatively, we could send attributes along with the - * socket with client reputation information, making everything even more - * Postfix-specific. - */ - if ((state->smtp_server_fd = LOCAL_CONNECT(smtp_service_name, NON_BLOCKING, - PS_SEND_SOCK_CONNECT_TIMEOUT)) < 0) { - msg_warn("cannot connect to service %s: %m", smtp_service_name); - smtp_reply(vstream_fileno(state->smtp_client_stream), - state->smtp_client_addr, state->smtp_client_port, - "421 4.3.2 All server ports are busy\r\n"); - free_session_state(state); - return; - } - post_queue_length++; - if (LOCAL_SEND_FD(state->smtp_server_fd, - vstream_fileno(state->smtp_client_stream)) < 0) { - msg_warn("cannot pass connection to service %s: %m", smtp_service_name); - smtp_reply(vstream_fileno(state->smtp_client_stream), state->smtp_client_addr, - state->smtp_client_port, "421 4.3.2 No system resources\r\n"); - free_session_state(state); - return; - } else { - - /* - * Closing the smtp_client_fd here triggers a FreeBSD 7.1 kernel bug - * where smtp-source sometimes sees the connection being closed after - * it has already received the real SMTP server's 220 greeting! - */ -#if 0 - event_server_disconnect(state->smtp_client_stream); - state->smtp_client_stream = 0; - check_queue_length--; -#endif - READ_EVENT_REQUEST(state->smtp_server_fd, send_socket_close_event, - (char *) state, PS_SEND_SOCK_NOTIFY_TIMEOUT); - return; - } -} - -/* smtp_read_event - handle pre-greet, EOF or timeout. */ - -static void smtp_read_event(int event, char *context) -{ - const char *myname = "smtp_read_event"; - PS_STATE *state = (PS_STATE *) context; - char read_buf[PS_READ_BUF_SIZE]; - int read_count; - int dnsbl_count; - int elapsed; - int action; - - if (msg_verbose) - msg_info("%s: sq=%d cq=%d event %d on smtp socket %d from %s:%s", - myname, post_queue_length, check_queue_length, - event, vstream_fileno(state->smtp_client_stream), - state->smtp_client_addr, state->smtp_client_port); - - /* - * Either the remote SMTP client spoke before its turn, the connection - * was closed, or we reached the limit of our patience. - */ - CLEAR_EVENT_REQUEST(vstream_fileno(state->smtp_client_stream), - smtp_read_event, context); - - /* - * If this session ends here, we MUST read the blocklist cache otherwise - * we have a memory leak. - */ - switch (event) { - - /* - * The SMTP client did not speak before its turn. If it is DNS - * blocklisted, drop the connection, or continue and forward the - * connection to the real SMTP server. - * - * This is where we would use a dummy SMTP protocol engine to further - * investigate whether the client cuts corners in the protocol, - * before allowing it to talk to a real SMTP server process. - */ - case EVENT_TIME: - if (*var_ps_dnsbl_sites) - dnsbl_count = postscreen_dnsbl_done(state->smtp_client_addr); - else - dnsbl_count = 0; - if (dnsbl_count > 0) { - msg_info("DNSBL rank %d for %s", - dnsbl_count, state->smtp_client_addr); - if (dnsbl_action == PS_ACT_DROP) { - smtp_reply(vstream_fileno(state->smtp_client_stream), - state->smtp_client_addr, state->smtp_client_port, - "521 5.7.1 Blocked by DNSBL\r\n"); - state->flags |= PS_FLAG_NOFORWARD; - } - state->flags |= PS_FLAG_NOCACHE; - } - if (state->flags & PS_FLAG_NOFORWARD) { - free_session_state(state); - } else { - if ((state->flags & PS_FLAG_NOCACHE) == 0) { - msg_info("PASS %s %s", (state->flags & PS_FLAG_EXPIRED) ? - "OLD" : "NEW", state->smtp_client_addr); - if (cache_map != 0) { - vstring_sprintf(temp, "%ld", (long) event_time()); - ps_dict_put(cache_map, state->smtp_client_addr, STR(temp)); - } - } - send_socket(state); - } - break; - - /* - * EOF or the client spoke before its turn. We simply drop the - * connection, or we continue waiting and allow DNS replies to - * trickle in. - * - * This is where we would use a dummy SMTP protocol engine to obtain the - * sender and recipient information before dropping a pregreeter's - * connection. - */ - default: - if ((read_count = recv(vstream_fileno(state->smtp_client_stream), - read_buf, sizeof(read_buf) - 1, MSG_PEEK)) > 0) { - read_buf[read_count] = 0; - msg_info("PREGREET %d after %s from %s: %.100s", read_count, - mydelta_time(temp, state->creation_time, &elapsed), - state->smtp_client_addr, printable(read_buf, '?')); - action = greet_action; - if (action == PS_ACT_DROP) - smtp_reply(vstream_fileno(state->smtp_client_stream), - state->smtp_client_addr, state->smtp_client_port, - "521 5.5.1 Protocol error\r\n"); - } else { - msg_info("HANGUP after %s from %s", - mydelta_time(temp, state->creation_time, &elapsed), - state->smtp_client_addr); - action = hangup_action; - state->flags |= PS_FLAG_NOFORWARD; - } - if (action == PS_ACT_DROP) { - if (*var_ps_dnsbl_sites) - (void) postscreen_dnsbl_done(state->smtp_client_addr); - free_session_state(state); - } else { - state->flags |= PS_FLAG_NOCACHE; - /* not: postscreen_dnsbl_done */ - if (elapsed > var_ps_greet_wait) - elapsed = var_ps_greet_wait; - event_request_timer(smtp_read_event, context, - var_ps_greet_wait - elapsed); - } - break; - } -} - -/* postscreen_dump - dump some statistics before exit */ - -static void postscreen_dump(void) -{ - - /* - * Dump preliminary cache cleanup statistics when the process commits - * suicide while a cache cleanup run is in progress. We can't currently - * distinguish between "postfix reload" (we should restart) or "maximal - * idle time reached" (we could finish the cache cleanup first). - */ - if (cache_map) { - dict_cache_close(cache_map); - cache_map = 0; - } -} - -/* postscreen_drain - delayed exit after "postfix reload" */ - -static void postscreen_drain(char *unused_service, char **unused_argv) -{ - int count; - - /* - * After "postfix reload", complete work-in-progress in the background, - * instead of dropping already-accepted connections on the floor. - * - * Unfortunately we must close all writable tables, so we can't store or - * look up reputation information. The reason is that we don't have any - * multi-writer safety guarantees. We also can't use the single-writer - * proxywrite service, because its latency guarantees are too weak. - * - * All error retry counts shall be limited. Instead of blocking here, we - * could retry failed fork() operations in the event call-back routines, - * but we don't need perfection. The host system is severely overloaded - * and service levels are already way down. - * - * XXX Some Berkeley DB versions break with close-after-fork. Every new - * version is an improvement over its predecessor. - */ - if (cache_map != 0) { - dict_cache_close(cache_map); - cache_map = 0; - } - for (count = 0; /* see below */ ; count++) { - if (count >= 5) { - msg_fatal("fork: %m"); - } else if (event_server_drain() != 0) { - msg_warn("fork: %m"); - sleep(1); - continue; - } else { - return; - } - } -} - -/* postscreen_service - handle new client connection */ - -static void postscreen_service(VSTREAM *smtp_client_stream, - char *unused_service, - char **unused_argv) -{ - const char *myname = "postscreen_service"; - PS_STATE *state; - struct sockaddr_storage addr_storage; - SOCKADDR_SIZE addr_storage_len = sizeof(addr_storage); - MAI_HOSTADDR_STR smtp_client_addr; - MAI_SERVPORT_STR smtp_client_port; - int aierr; - const char *stamp_str; - time_t stamp_time; - int window_size; - int state_flags = 0; - - /* - * This program handles all incoming connections, so it must not block. - * We use event-driven code for all operations that introduce latency. - * - * We use the event_server framework. This means we get already-accepted - * connections wrapped into a VSTREAM so we have to invoke getpeername() - * to find out the remote address and port. - */ - -#define PS_SERVICE_GIVEUP_AND_RETURN(stream) do { \ - event_server_disconnect(stream); \ - return; \ - } while (0); - - /* - * Look up the remote SMTP client address and port. - */ - if (getpeername(vstream_fileno(smtp_client_stream), (struct sockaddr *) - & addr_storage, &addr_storage_len) < 0) { - msg_warn("getpeername: %m"); - smtp_reply(vstream_fileno(smtp_client_stream), - "unknown_address", "unknown_port", - "421 4.3.2 No system resources\r\n"); - PS_SERVICE_GIVEUP_AND_RETURN(smtp_client_stream); - } - - /* - * Convert the remote SMTP client address and port to printable form for - * logging and access control. - */ - if ((aierr = sockaddr_to_hostaddr((struct sockaddr *) & addr_storage, - addr_storage_len, &smtp_client_addr, - &smtp_client_port, 0)) != 0) { - msg_warn("cannot convert client address/port to string: %s", - MAI_STRERROR(aierr)); - smtp_reply(vstream_fileno(smtp_client_stream), - "unknown_address", "unknown_port", - "421 4.3.2 No system resources\r\n"); - PS_SERVICE_GIVEUP_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) - msg_info("%s: sq=%d cq=%d connect from %s:%s", - myname, post_queue_length, check_queue_length, - smtp_client_addr.buf, smtp_client_port.buf); - - /* - * Reply with 421 when we can't forward more connections. - */ - if (var_ps_post_queue_limit > 0 - && post_queue_length >= var_ps_post_queue_limit) { - msg_info("reject: connect from %s:%s: all server ports busy", - smtp_client_addr.buf, smtp_client_port.buf); - smtp_reply(vstream_fileno(smtp_client_stream), - smtp_client_addr.buf, smtp_client_port.buf, - "421 4.3.2 All server ports are busy\r\n"); - PS_SERVICE_GIVEUP_AND_RETURN(smtp_client_stream); - } - - /* - * The permanent whitelist has highest precedence (never block mail from - * whitelisted sites). - */ - if (wlist_nets != 0 - && ps_addr_match_list_match(wlist_nets, smtp_client_addr.buf) != 0) { - msg_info("WHITELISTED %s", smtp_client_addr.buf); - state_flags |= PS_FLAG_WHITELISTED; - } - - /* - * The permanent blacklist has second precedence. If the client is - * permanently blacklisted, send some generic reply and hang up - * immediately, or torture them a little longer. - */ - else if (blist_nets != 0 - && ps_addr_match_list_match(blist_nets, smtp_client_addr.buf) != 0) { - msg_info("BLACKLISTED %s", smtp_client_addr.buf); - if (blist_action == PS_ACT_DROP) { - smtp_reply(vstream_fileno(smtp_client_stream), - smtp_client_addr.buf, smtp_client_port.buf, - "521 5.3.2 Service currently not available\r\n"); - PS_SERVICE_GIVEUP_AND_RETURN(smtp_client_stream); - } - } - - /* - * Finally, the temporary whitelist (i.e. the postscreen cache) has the - * lowest precedence. - */ - else if (cache_map != 0 - && (stamp_str = ps_dict_get(cache_map, smtp_client_addr.buf)) != 0) { - stamp_time = strtoul(stamp_str, 0, 10); - if (stamp_time > event_time() - var_ps_cache_ttl) { - msg_info("PASS OLD %s", smtp_client_addr.buf); - state_flags |= PS_FLAG_WHITELISTED; - } else - state_flags |= PS_FLAG_EXPIRED; - } - - /* - * If the client is permanently or temporarily whitelisted, send the - * socket to the real SMTP service and get out of the way. - */ - if (state_flags & PS_FLAG_WHITELISTED) { - state = new_session_state(smtp_client_stream, smtp_client_addr.buf, - smtp_client_port.buf); - send_socket(state); - return; - } - - /* - * Reply with 421 when we can't analyze more connections. - */ - if (var_ps_pre_queue_limit > 0 - && check_queue_length - post_queue_length >= var_ps_pre_queue_limit) { - msg_info("reject: connect from %s:%s: all screening ports busy", - smtp_client_addr.buf, smtp_client_port.buf); - smtp_reply(vstream_fileno(smtp_client_stream), - smtp_client_addr.buf, smtp_client_port.buf, - "421 4.3.2 All screening ports are busy\r\n"); - PS_SERVICE_GIVEUP_AND_RETURN(smtp_client_stream); - } - - /* - * If the client has no cached decision, send half the greeting banner, - * by way of teaser, then wait briefly to see if the client speaks before - * its turn. - * - * Before sending the banner we could set the TCP window to the smallest - * possible value to save some network bandwidth, at least with spamware - * that waits until the server starts speaking. - */ -#if 0 - window_size = 1; - if (setsockopt(vstream_fileno(smtp_client_stream), SOL_SOCKET, SO_RCVBUF, - (char *) &window_size, sizeof(window_size)) < 0) - msg_warn("setsockopt SO_RCVBUF %d: %m", window_size); -#endif - if (teaser_greeting != 0 - && smtp_reply(vstream_fileno(smtp_client_stream), smtp_client_addr.buf, - smtp_client_port.buf, teaser_greeting) != 0) - PS_SERVICE_GIVEUP_AND_RETURN(smtp_client_stream); - - state = new_session_state(smtp_client_stream, smtp_client_addr.buf, - smtp_client_port.buf); - state->flags |= state_flags; - READ_EVENT_REQUEST(vstream_fileno(state->smtp_client_stream), - smtp_read_event, (char *) state, var_ps_greet_wait); - - /* - * Run a DNS blocklist query while we wait for the client to respond. - */ - if (*var_ps_dnsbl_sites) - postscreen_dnsbl_query(smtp_client_addr.buf); -} - -/* postscreen_cache_validator - validate one cache entry */ - -static int postscreen_cache_validator(const char *client_addr, - const char *stamp_str, - char *unused_context) -{ - time_t stamp_time; - - /* - * This function is called by the cache cleanup pseudo thread. - * - * XX Eliminate code duplication and abstract the parser into a separate - * routine. - * - * Don't report a client as "NEW" just because their cache entry expired. - */ - stamp_time = strtoul(stamp_str, 0, 10); - return (event_time() < stamp_time + var_ps_cache_ttl + var_ps_cache_ret); -} - -/* pre_jail_init - pre-jail initialization */ - -static void pre_jail_init(char *unused_name, char **unused_argv) -{ - VSTRING *redirect; - - /* - * Open read-only maps as before dropping privilege, for consistency with - * other Postfix daemons. - */ - if (*var_ps_wlist_nets) - wlist_nets = - addr_match_list_init(MATCH_FLAG_NONE, var_ps_wlist_nets); - - if (*var_ps_blist_nets) - blist_nets = - addr_match_list_init(MATCH_FLAG_NONE, var_ps_blist_nets); - - /* - * Never, ever, get killed by a master signal, as that would corrupt the - * database when we're in the middle of an update. - */ - if (setsid() < 0) - msg_warn("setsid: %m"); - - /* - * Security: don't create root-owned files that contain untrusted data. - * And don't create Postfix-owned files in root-owned directories, - * either. We want a correct relationship between (file or directory) - * ownership and (file or directory) content. To open files before going - * to jail, temporarily drop root privileges. - */ - SAVE_AND_SET_EUGID(var_owner_uid, var_owner_gid); - redirect = vstring_alloc(100); - - /* - * Keep state in persistent external map. As a safety measure we sync the - * database on each update. This hurts on LINUX systems that sync all - * their dirty disk blocks whenever any application invokes fsync(). - * - * Start the cache maintenance pseudo thread after dropping privileges. - */ -#define PS_DICT_OPEN_FLAGS (DICT_FLAG_DUP_REPLACE | DICT_FLAG_SYNC_UPDATE) - - if (*var_ps_cache_map) - cache_map = - dict_cache_open(data_redirect_map(redirect, var_ps_cache_map), - O_CREAT | O_RDWR, PS_DICT_OPEN_FLAGS); - - /* - * Clean up and restore privilege. - */ - vstring_free(redirect); - RESTORE_SAVED_EUGID(); -} - -/* post_jail_init - post-jail initialization */ - -static void post_jail_init(char *unused_name, char **unused_argv) -{ - const NAME_CODE actions[] = { - "drop", PS_ACT_DROP, - "continue", PS_ACT_CONT, - 0, -1, - }; - int cache_flags; - - /* - * This routine runs after the skeleton code has entered the chroot jail. - * Prevent automatic process suicide after a limited number of client - * requests. It is OK to terminate after a limited amount of idle time. - */ - var_use_limit = 0; - - /* - * Other one-time initialization. - */ - temp = vstring_alloc(10); - vstring_sprintf(temp, "%s/%s", MAIL_CLASS_PRIVATE, var_smtpd_service); - smtp_service_name = mystrdup(STR(temp)); - if (*var_ps_greet_banner) { - vstring_sprintf(temp, "220-%s\r\n", var_ps_greet_banner); - teaser_greeting = mystrdup(STR(temp)); - } - dnsbl_sites = argv_split(var_ps_dnsbl_sites, ", \t\r\n"); - dnsbl_cache = htable_create(13); - reply_addr = vstring_alloc(100); - reply_domain = vstring_alloc(100); - if ((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 ((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 ((greet_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_greet_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_GREET_ACTION, var_ps_greet_action); - if ((hangup_action = name_code(actions, NAME_CODE_FLAG_NONE, - var_ps_hangup_action)) < 0) - msg_fatal("bad %s value: %s", VAR_PS_HUP_ACTION, var_ps_hangup_action); - - /* - * Start the cache maintenance pseudo thread last. Early cleanup makes - * verbose logging more informative (we get positive confirmation that - * the cleanup thread runs). - */ - cache_flags = DICT_CACHE_FLAG_STATISTICS; - if (msg_verbose) - cache_flags |= DICT_CACHE_FLAG_VERBOSE; - if (cache_map != 0 && var_ps_cache_scan > 0) - dict_cache_control(cache_map, - DICT_CACHE_CTL_FLAGS, cache_flags, - DICT_CACHE_CTL_INTERVAL, var_ps_cache_scan, - DICT_CACHE_CTL_VALIDATOR, postscreen_cache_validator, - DICT_CACHE_CTL_CONTEXT, (char *) 0, - DICT_CACHE_CTL_END); -} - -MAIL_VERSION_STAMP_DECLARE; - -/* main - pass control to the multi-threaded skeleton */ - -int main(int argc, char **argv) -{ - static const CONFIG_STR_TABLE str_table[] = { - VAR_SMTPD_SERVICE, DEF_SMTPD_SERVICE, &var_smtpd_service, 1, 0, - VAR_PS_CACHE_MAP, DEF_PS_CACHE_MAP, &var_ps_cache_map, 0, 0, - VAR_SMTPD_BANNER, DEF_SMTPD_BANNER, &var_smtpd_banner, 1, 0, - VAR_PS_DNSBL_SITES, DEF_PS_DNSBL_SITES, &var_ps_dnsbl_sites, 0, 0, - VAR_PS_GREET_ACTION, DEF_PS_GREET_ACTION, &var_ps_greet_action, 1, 0, - VAR_PS_DNSBL_ACTION, DEF_PS_DNSBL_ACTION, &var_ps_dnsbl_action, 1, 0, - VAR_PS_HUP_ACTION, DEF_PS_HUP_ACTION, &var_ps_hangup_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_GREET_BANNER, DEF_PS_GREET_BANNER, &var_ps_greet_banner, 0, 0, - VAR_PS_BLIST_ACTION, DEF_PS_BLIST_ACTION, &var_ps_blist_action, 1, 0, - 0, - }; - static const CONFIG_INT_TABLE int_table[] = { - VAR_PROC_LIMIT, DEF_PROC_LIMIT, &var_proc_limit, 1, 0, - 0, - }; - static const CONFIG_NINT_TABLE nint_table[] = { - VAR_PS_POST_QLIMIT, DEF_PS_POST_QLIMIT, &var_ps_post_queue_limit, 1, 0, - VAR_PS_PRE_QLIMIT, DEF_PS_PRE_QLIMIT, &var_ps_pre_queue_limit, 1, 0, - 0, - }; - static const CONFIG_TIME_TABLE time_table[] = { - VAR_PS_CACHE_TTL, DEF_PS_CACHE_TTL, &var_ps_cache_ttl, 1, 0, - VAR_PS_GREET_WAIT, DEF_PS_GREET_WAIT, &var_ps_greet_wait, 1, 0, - VAR_PS_CACHE_RET, DEF_PS_CACHE_RET, &var_ps_cache_ret, 0, 0, - VAR_PS_CACHE_SCAN, DEF_PS_CACHE_SCAN, &var_ps_cache_scan, 0, 0, - 0, - }; - - /* - * Fingerprint executables and core dumps. - */ - MAIL_VERSION_STAMP_ALLOCATE; - - event_server_main(argc, argv, postscreen_service, - MAIL_SERVER_STR_TABLE, str_table, - MAIL_SERVER_INT_TABLE, int_table, - MAIL_SERVER_NINT_TABLE, nint_table, - MAIL_SERVER_TIME_TABLE, time_table, - MAIL_SERVER_PRE_INIT, pre_jail_init, - MAIL_SERVER_POST_INIT, post_jail_init, - MAIL_SERVER_SOLITARY, - MAIL_SERVER_SLOW_EXIT, postscreen_drain, - MAIL_SERVER_EXIT, postscreen_dump, - 0); -} diff --git a/postfix/src/proxymap/proxymap.c b/postfix/src/proxymap/proxymap.c index 593986978..24016ab72 100644 --- a/postfix/src/proxymap/proxymap.c +++ b/postfix/src/proxymap/proxymap.c @@ -593,12 +593,6 @@ static void post_jail_init(char *service_name, char **unused_argv) } myfree(saved_filter); - /* - * This process is called by clients that already enforce the max_idle - * time, so we don't have to do it another time. - */ - var_idle_limit = 1; - /* * Never, ever, get killed by a master signal, as that could corrupt a * persistent database when we're in the middle of an update. diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 6ea2abcde..abec2da99 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -92,8 +92,6 @@ /* Resolve an address that ends in the "@" null domain as if the /* local hostname were specified, instead of rejecting the address as /* invalid. -/* .IP "\fBsmtpd_command_filter (empty)\fR" -/* A mechanism to transform commands from remote SMTP clients. /* .IP "\fBsmtpd_reject_unlisted_sender (no)\fR" /* Request that the Postfix SMTP server rejects mail from unknown /* sender addresses, even when no explicit reject_unlisted_sender @@ -125,6 +123,10 @@ /* Available in Postfix version 2.6 and later: /* .IP "\fBtcp_windowsize (0)\fR" /* An optional workaround for routers that break TCP window scaling. +/* .PP +/* Available in Postfix version 2.7 and later: +/* .IP "\fBsmtpd_command_filter (empty)\fR" +/* A mechanism to transform commands from remote SMTP clients. /* ADDRESS REWRITING CONTROLS /* .ad /* .fi @@ -4150,8 +4152,8 @@ typedef struct SMTPD_CMD { #define SMTPD_CMD_FLAG_LAST (1<<2) /* last in PIPELINING command group */ static SMTPD_CMD smtpd_cmd_table[] = { - SMTPD_CMD_HELO, helo_cmd, SMTPD_CMD_FLAG_LIMIT | SMTPD_CMD_FLAG_PRE_TLS, - SMTPD_CMD_EHLO, ehlo_cmd, SMTPD_CMD_FLAG_LIMIT | SMTPD_CMD_FLAG_PRE_TLS, + SMTPD_CMD_HELO, helo_cmd, SMTPD_CMD_FLAG_LIMIT | SMTPD_CMD_FLAG_PRE_TLS | SMTPD_CMD_FLAG_LAST, + SMTPD_CMD_EHLO, ehlo_cmd, SMTPD_CMD_FLAG_LIMIT | SMTPD_CMD_FLAG_PRE_TLS | SMTPD_CMD_FLAG_LAST, #ifdef USE_TLS SMTPD_CMD_STARTTLS, starttls_cmd, SMTPD_CMD_FLAG_PRE_TLS, #endif diff --git a/postfix/src/smtpd/smtpd_proxy.c b/postfix/src/smtpd/smtpd_proxy.c index 7535eaeba..0968f5b5b 100644 --- a/postfix/src/smtpd/smtpd_proxy.c +++ b/postfix/src/smtpd/smtpd_proxy.c @@ -74,9 +74,10 @@ /* 2xx or 3xx proxy server response is replaced by a generic /* error response to avoid support problems. /* In case of error, smtpd_proxy_create() updates the -/* state->error_mask and state->err fields, and leaves the the -/* proxy handle in an unconnected state. Destroy the handle -/* after reporting the error reply in the proxy->buffer field. +/* state->error_mask and state->err fields, and leaves the +/* SMTPD_PROXY handle in an unconnected state. Destroy the +/* handle after reporting the error reply in the proxy->buffer +/* field. /* /* proxy->cmd() formats and either buffers up the command and /* expected response until the entire message is received, or @@ -374,8 +375,8 @@ static int smtpd_proxy_connect(SMTPD_STATE *state) * Send our own EHLO command. If this fails then we have a problem * because the proxy should always accept our EHLO command. Make up our * own response instead of passing back a negative EHLO reply: the proxy - * open is delayed to the point that the client expects a MAIL FROM or - * RCPT TO reply. + * open is delayed to the point that the remote SMTP client expects a + * MAIL FROM or RCPT TO reply. */ if (smtpd_proxy_cmd(state, SMTPD_PROX_WANT_OK, "EHLO %s", proxy->ehlo_name)) { @@ -403,8 +404,8 @@ static int smtpd_proxy_connect(SMTPD_STATE *state) * Send XFORWARD attributes. For robustness, explicitly specify what SMTP * session attributes are known and unknown. Make up our own response * instead of passing back a negative XFORWARD reply: the proxy open is - * delayed to the point that the client expects a MAIL FROM or RCPT TO - * reply. + * delayed to the point that the remote SMTP client expects a MAIL FROM + * or RCPT TO reply. */ if (server_xforward_features) { buf = vstring_alloc(100); @@ -443,9 +444,9 @@ static int smtpd_proxy_connect(SMTPD_STATE *state) } /* - * Pass-through the client's MAIL FROM command. If this fails, then we - * have a problem because the proxy should always accept any MAIL FROM - * command that was accepted by us. + * Pass-through the remote SMTP client's MAIL FROM command. If this + * fails, then we have a problem because the proxy should always accept + * any MAIL FROM command that was accepted by us. */ if (smtpd_proxy_cmd(state, SMTPD_PROX_WANT_OK, "%s", proxy->mail_from) != 0) { diff --git a/postfix/src/trivial-rewrite/trivial-rewrite.c b/postfix/src/trivial-rewrite/trivial-rewrite.c index 22f1b79a2..b8cc438c2 100644 --- a/postfix/src/trivial-rewrite/trivial-rewrite.c +++ b/postfix/src/trivial-rewrite/trivial-rewrite.c @@ -565,12 +565,6 @@ static void post_jail_init(char *unused_name, char **unused_argv) if (resolve_verify.transport_info) transport_post_init(resolve_verify.transport_info); check_table_stats(0, (char *) 0); - - /* - * This process is called by clients that already enforce the max_idle - * time, so we don't have to do it another time. - */ - var_idle_limit = 1; } MAIL_VERSION_STAMP_DECLARE; diff --git a/postfix/src/verify/verify.c b/postfix/src/verify/verify.c index 116dd53a6..a1a1535f7 100644 --- a/postfix/src/verify/verify.c +++ b/postfix/src/verify/verify.c @@ -30,7 +30,8 @@ /* .IP "\fBupdate\fI address status text\fR" /* Update the status and text of the specified address. /* .IP "\fBquery\fI address\fR" -/* Look up the \fIstatus\fR and \fItext\fR for the specified address. +/* Look up the \fIstatus\fR and \fItext\fR for the specified +/* \fIaddress\fR. /* If the status is unknown, a probe is sent and an "in progress" /* status is returned. /* SECURITY @@ -41,7 +42,8 @@ /* The verify server can run chrooted at fixed low privilege. /* /* The address verification server can be coerced to store -/* unlimited amounts of garbage. Limiting the cache size +/* unlimited amounts of garbage. Limiting the cache expiry +/* time /* trades one problem (disk space exhaustion) for another /* one (poor response time to client requests). /* @@ -55,11 +57,13 @@ /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* BUGS -/* The address verification service is suitable only for sites that -/* handle a low mail volume. Verification probes add additional -/* traffic to the mail queue and perform poorly under high load. -/* Servers may blacklist sites that probe excessively, or that -/* probe excessively for non-existent recipient addresses. +/* Address verification probe messages add additional traffic +/* to the mail queue. +/* Recipient verification may cause an increased load on +/* down-stream servers in the case of a dictionary attack or +/* a flood of backscatter bounces. +/* Sender address verification may cause your site to be +/* blacklisted by some providers. /* /* If the persistent database ever gets corrupted then the world /* comes to an end and human intervention is needed. This violates @@ -69,7 +73,7 @@ /* .fi /* Changes to \fBmain.cf\fR are not picked up automatically, /* as \fBverify\fR(8) -/* processes are persistent. Use the command "\fBpostfix reload\fR" after +/* processes are long-lived. Use the command "\fBpostfix reload\fR" after /* a configuration change. /* /* The text below provides only a parameter summary. See