]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.5-20071206
authorWietse Venema <wietse@porcupine.org>
Thu, 6 Dec 2007 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:33:35 +0000 (06:33 +0000)
32 files changed:
postfix/HISTORY
postfix/README_FILES/ADDRESS_VERIFICATION_README
postfix/README_FILES/TLS_LEGACY_README
postfix/README_FILES/TLS_README
postfix/RELEASE_NOTES
postfix/conf/master.cf
postfix/html/ADDRESS_VERIFICATION_README.html
postfix/html/TLS_LEGACY_README.html
postfix/html/TLS_README.html
postfix/html/postconf.5.html
postfix/html/proxymap.8.html
postfix/html/tlsmgr.8.html
postfix/html/verify.8.html
postfix/man/man5/postconf.5
postfix/man/man8/proxymap.8
postfix/man/man8/tlsmgr.8
postfix/man/man8/verify.8
postfix/proto/ADDRESS_VERIFICATION_README.html
postfix/proto/TLS_README.html
postfix/proto/postconf.proto
postfix/src/global/Makefile.in
postfix/src/global/data_redirect.c [new file with mode: 0644]
postfix/src/global/data_redirect.h [new file with mode: 0644]
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/proxymap/proxymap.c
postfix/src/tlsmgr/Makefile.in
postfix/src/tlsmgr/tlsmgr.c
postfix/src/util/set_eugid.c
postfix/src/util/set_eugid.h
postfix/src/verify/Makefile.in
postfix/src/verify/verify.c

index b419c7f81b67392465b12506ec40b76c8b657031..39b8a5117ae202ca4b0a04caa9172c8a490e1f5e 100644 (file)
@@ -13895,7 +13895,7 @@ Apologies for any names omitted.
        postalias/postalias.c.
 
        Bugfix: the proxymap client didn't properly propagate user
-       options options to the proxymap server.  File: util/dict.h.
+       options to the proxymap server.  File: util/dict.h.
 
        Workaround: force synchronous updates in the proxymap server
        so that maps will be in a consistent state between updates.
@@ -13923,3 +13923,17 @@ Apologies for any names omitted.
        Feature: data_directory configuration parameter for
        Postfix-writable data such as caches and random numbers.
        Files: postfix-install, conf/postfix-files.
+
+20071206
+
+       Security: tlsmgr(8) and verify(8) no longer use root
+       privileges when opening their cache files. This avoids a
+       potential security loophole where the ownership of a file
+       (or directory) does not match the trust level of the content
+       of that file (or directory). See RELEASE_NOTES for how to
+       use pre-existing data. Files: util/set_eugid.[hc],
+       tlsmgr/tlsmgr.c, verify/verify.c.
+
+       Compatibility: as a migration tool, redirect attempts by
+       tlsmgr(8) or verify(8) to open files in non-Postfix directories
+       to the Postfix-owned data_directory. File: global/data_redirect.c.
index 1269f4171c97702f944ac1be7a6d871cffa42e89..5a345085757d2cbb6897cb6d36dea093853dc642 100644 (file)
@@ -157,7 +157,7 @@ domains that often appear in forged email.
         unverified_sender_reject_code = 550
         # Note 1: Be sure to read the "Caching" section below!
         # Note 2: Avoid hash files here. Use btree instead.
-        address_verify_map = btree:/var/mta/verify
+        address_verify_map = btree:/var/lib/postfix/verify
 
     /etc/postfix/sender_access:
         aol.com     reject_unverified_sender
@@ -193,7 +193,7 @@ be blocked:
             ...
         # Note 1: Be sure to read the "Caching" section below!
         # Note 2: Avoid hash files here. Use btree instead.
-        address_verify_map = btree:/var/mta/verify
+        address_verify_map = btree:/var/lib/postfix/verify
 
 This is also a good way to populate your cache with address verification
 results before you start to actually reject mail.
@@ -239,16 +239,23 @@ If your /var file system has sufficient space, try:
 
     /etc/postfix/main.cf:
         # Note: avoid hash files here. Use btree instead.
-        address_verify_map = btree:/var/mta/verify
-
-NOTE: Do not put this file in a file system that may run out of space. When the
-address verification table gets corrupted the world comes to an end and YOU
+        address_verify_map = btree:/var/lib/postfix/verify
+
+NOTE 1: As of version 2.5, Postfix no longer uses root privileges when opening
+this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file under a non-
+Postfix directory is redirected to the Postfix-owned data_directory, and a
+warning is logged. If you wish to continue using an pre-existing database file,
+move it to the data_directory, and change ownership to the account specfied
+with the mail_owner parameter.
+
+NOTE 2: Do not put this file in a file system that may run out of space. When
+the address verification table gets corrupted the world comes to an end and YOU
 will have to MANUALLY fix things as described in the next section. Meanwhile,
 you will not receive mail via SMTP.
 
-The verify(8) daemon process will create a new database when none exists, and
-will open/create the file before it enters the chroot jail and before it drops
-root privileges.
+NOTE 3: The verify(8) daemon process will create a new database when none
+exists, and will open/create the file before it enters the chroot jail.
 
 M\bMa\ban\bna\bag\bgi\bin\bng\bg t\bth\bhe\be a\bad\bdd\bdr\bre\bes\bss\bs v\bve\ber\bri\bif\bfi\bic\bca\bat\bti\bio\bon\bn d\bda\bat\bta\bab\bba\bas\bse\be
 
index 78d1285218a376c33ff86f370fd58f98cb4845a0..f78af3ff6a8cd514c79dc23216a5bd466cbfa4bb 100644 (file)
@@ -375,7 +375,11 @@ is high.
 Example:
 
     /etc/postfix/main.cf:
-        smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache
+        smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
+
+As of version 2.5, Postfix will no longer maintain this file in a directory
+with non-Postfix ownership. As a migration aid, attempts to open such files are
+redirected to the Postfix-owned $data_directory, and a warning is logged.
 
 Cached Postfix SMTP server session information expires after a certain amount
 of time. Postfix/TLS does not use the OpenSSL default of 300s, but a longer
@@ -627,7 +631,11 @@ client is allowed to negotiate per unit time.
 Example:
 
     /etc/postfix/main.cf:
-        smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
+        smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
+
+As of version 2.5, Postfix will no longer maintain this file in a directory
+with non-Postfix ownership. As a migration aid, attempts to open such files are
+redirected to the Postfix-owned $data_directory, and a warning is logged.
 
 Cached Postfix SMTP client session information expires after a certain amount
 of time. Postfix/TLS does not use the OpenSSL default of 300s, but a longer
index 17a757873409456480ebd025424f8b8aaaa19747..db0ba5e2e6b6977840152c50a5b4291fbc39601f 100644 (file)
@@ -416,6 +416,12 @@ Example:
     /etc/postfix/main.cf:
         smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache
 
+Note: as of version 2.5, Postfix no longer uses root privileges when opening
+this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file under a non-
+Postfix directory is redirected to the Postfix-owned data_directory, and a
+warning is logged.
+
 Cached Postfix SMTP server session information expires after a certain amount
 of time. Postfix/TLS does not use the OpenSSL default of 300s, but a longer
 time of 3600sec (=1 hour). RFC 2246 recommends a maximum of 24 hours.
@@ -744,6 +750,12 @@ Example:
     /etc/postfix/main.cf:
         smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
 
+Note: as of version 2.5, Postfix no longer uses root privileges when opening
+this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file under a non-
+Postfix directory is redirected to the Postfix-owned data_directory, and a
+warning is logged.
+
 Cached Postfix SMTP client session information expires after a certain amount
 of time. Postfix/TLS does not use the OpenSSL default of 300s, but a longer
 time of 3600s (=1 hour). RFC 2246 recommends a maximum of 24 hours.
@@ -1598,17 +1610,25 @@ Example:
 The tlsmgr(8) process saves the PRNG state to a persistent exchange file at
 regular times and when the process terminates, so that it can recover the PRNG
 state the next time it starts up. This file is created when it does not exist.
-Its default location is under the Postfix configuration directory, which is not
-the proper place for information that is modified by Postfix. Instead, the file
-location should probably be on the /var partition (but n\bno\bot\bt inside the chroot
-jail).
 
 Examples:
 
     /etc/postfix/main.cf:
-        tls_random_exchange_name = /etc/postfix/prng_exch
+        tls_random_exchange_name = /var/lib/postfix/prng_exch
         tls_random_prng_update_period = 3600s
 
+As of version 2.5, Postfix no longer uses root privileges when opening this
+file. The file should now be stored under the Postfix-owned data_directory. As
+a migration aid, an attempt to open the file under a non-Postfix directory is
+redirected to the Postfix-owned data_directory, and a warning is logged. If you
+wish to continue using a pre-existing PRNG state file, move it to the
+data_directory and change the ownership to the account specified with the
+mail_owner parameter.
+
+With earlier Postfix versions the default file location is under the Postfix
+configuration directory, which is not the proper place for information that is
+modified by Postfix.
+
 G\bGe\bet\btt\bti\bin\bng\bg s\bst\bta\bar\brt\bte\bed\bd,\b, q\bqu\bui\bic\bck\bk a\ban\bnd\bd d\bdi\bir\brt\bty\by
 
 The following steps will get you started quickly. Because you sign your own
index da2fd5d40c559cb1c2726b65f1e7224d12cfd880..621020261facb2cf4ffb68549fefb5b043980da7 100644 (file)
@@ -17,13 +17,48 @@ Incompatibility with Postfix 2.3 and earlier
 If you upgrade from Postfix 2.3 or earlier, read RELEASE_NOTES-2.4
 before proceeding.
 
+Incompatibility with Postfix snapshot 20071206
+==============================================
+
+The "make install" and "make upgrade" procedures now create a
+Postfix-owned directory for Postfix-writable data files such as
+caches and random numbers. The location is specified with the
+"data_directory" parameter (default: "/var/lib/postfix"), and the
+ownership is specified with the "mail_owner" parameter.
+
+The tlsmgr(8) and verify(8) servers no longer use root privileges
+when opening the address_verify_map, *_tls_session_cache_database,
+and tls_random_exchange_name cache files.  This avoids a potential
+security loophole where the ownership of a file (or directory) does
+not match the trust level of the content of that file (or directory).
+
+The tlsmgr(8) and verify(8) cache files should now be stored under
+the Postfix-owned data_directory.  As a migration aid, attempts to
+open these files under a non-Postfix directory are redirected to
+the Postfix-owned data_directory, and a warning is logged.
+
+This is an example of the warning messages:
+
+    Dec  6 12:56:22 bristle postfix/tlsmgr[7899]: warning: request
+       to update file /etc/postfix/prng_exch in non-postfix directory
+       /etc/postfix
+
+    Dec  6 12:56:22 bristle postfix/tlsmgr[7899]: warning: redirecting
+       the request to postfix-owned data_directory /var/lib/postfix
+
+If you wish to continue using a pre-existing tls_random_exchange_name
+or address_verify_map file, move it to the Postfix-owned data_directory
+and change ownership to the account specified with the mail_owner
+configuration parameter.
+
 Major changes with Postfix snapshot 20071205
 ============================================
 
 The "make install" and "make upgrade" procedures now create a
-postfix-owned directory for Postfix-writable data files such as
+Postfix-owned directory for Postfix-writable data files such as
 caches and random numbers. The location is specified with the
-"data_directory" variable (default: "/var/lib/postfix").
+"data_directory" parameter (default: "/var/lib/postfix"), and the
+ownership is specified with the "mail_owner" parameter.
 
 Incompatibility with Postfix snapshot 20071203
 ==============================================
index c1677f8077f0e6e07189930a63de3374012ec870..18095ecb3a2e3ff5b23a930684631fbdcc8438fc 100644 (file)
@@ -32,6 +32,7 @@ trace     unix  -       -       n       -       0       bounce
 verify    unix  -       -       n       -       1       verify
 flush     unix  n       -       n       1000?   0       flush
 proxymap  unix  -       -       n       -       -       proxymap
+proxywrite unix -       -       n       -       -       proxymap
 smtp      unix  -       -       n       -       -       smtp
 # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
 relay     unix  -       -       n       -       -       smtp
index ce38c1534f4d43d0ddb7edd05e43dea4c78d4c3f..fa6083041f4edb1eeda75641ff442fb8338b7c8a 100644 (file)
@@ -272,7 +272,7 @@ specific domains that often appear in forged email. </p>
     <a href="postconf.5.html#unverified_sender_reject_code">unverified_sender_reject_code</a> = 550
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree instead.
-    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/mta/verify
+    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/lib/postfix/verify
  
 /etc/postfix/sender_access:
     aol.com     <a href="postconf.5.html#reject_unverified_sender">reject_unverified_sender</a>
@@ -314,7 +314,7 @@ you can see what mail would be blocked: </p>
         ...
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree instead.
-    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/mta/verify
+    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/lib/postfix/verify
 </pre>
 </blockquote>
 
@@ -373,19 +373,28 @@ stop". </p>
 <pre>
 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
     # Note: avoid hash files here. Use btree instead.
-    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/mta/verify
+    <a href="postconf.5.html#address_verify_map">address_verify_map</a> = btree:/var/lib/postfix/verify
 </pre>
 </blockquote>
 
-<p> NOTE: Do not put this file in a file system that may run out
+<p> NOTE 1: As of version 2.5, Postfix no longer uses root privileges
+when opening this file. The file should now be stored under the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. If you wish
+to continue using an pre-existing database file, move it to the
+<a href="postconf.5.html#data_directory">data_directory</a>, and change ownership to the account specfied with
+the <a href="postconf.5.html#mail_owner">mail_owner</a> parameter.  </p>
+
+<p> NOTE 2: Do not put this file in a file system that may run out
 of space.  When the address verification table gets corrupted the
 world comes to an end and YOU will have to MANUALLY fix things as
 described in the next section. Meanwhile, you will not receive mail
 via SMTP. </p>
 
-<p> The <a href="verify.8.html">verify(8)</a> daemon process will create a new database when
+<p> NOTE 3: The <a href="verify.8.html">verify(8)</a> daemon process will create a new database when
 none exists, and will open/create the file before it enters the
-chroot jail and before it drops root privileges. </p>
+chroot jail. </p>
 
 <h2><a name="dirty_secret">Managing the address verification
 database</a></h2>
index d9862b10484c36c0dfe27c87b2c2aa5504227db9..e5787a031e1edd78d03b4c74bbb848f0b7e122c0 100644 (file)
@@ -33,7 +33,7 @@ encrypted session protects the information that is transmitted with
 SMTP mail or with SASL authentication.
 
 <p> Postfix version 2.2 introduces support for TLS as described in
-<a href="http://www.faqs.org/rfcs/rfc3207.html">RFC 3207</a>.  TLS Support for older Postfix versions was available as
+<a href="http://tools.ietf.org/html/rfc3207">RFC 3207</a>.  TLS Support for older Postfix versions was available as
 an add-on patch.  The section "<a href="#compat">Compatibility with
 Postfix < 2.2 TLS support</a>" below discusses the differences
 between these implementations.  </p>
@@ -425,7 +425,7 @@ private key. This is intended behavior. </p>
 
 <p> You can ENFORCE the use of TLS, so that the Postfix SMTP server
 announces STARTTLS and accepts no mail without TLS encryption, by
-setting "<a href="postconf.5.html#smtpd_enforce_tls">smtpd_enforce_tls</a> = yes". According to <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> this MUST
+setting "<a href="postconf.5.html#smtpd_enforce_tls">smtpd_enforce_tls</a> = yes". According to <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> this MUST
 NOT be applied in case of a publicly-referenced Postfix SMTP server.
 This option is off by default and should only seldom be used. </p>
 
@@ -564,13 +564,18 @@ the cost of repeatedly negotiating TLS session keys is high.</p>
 <blockquote>
 <pre>
 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
-    <a href="postconf.5.html#smtpd_tls_session_cache_database">smtpd_tls_session_cache_database</a> = btree:/etc/postfix/smtpd_scache
+    <a href="postconf.5.html#smtpd_tls_session_cache_database">smtpd_tls_session_cache_database</a> = btree:/var/lib/postfix/smtpd_scache
 </pre>
 </blockquote>
 
+<p> As of version 2.5, Postfix will no longer maintain this file
+in a directory with non-Postfix ownership. As a migration aid,
+attempts to open such files are redirected to the Postfix-owned
+$<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP server session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
-default of 300s, but a longer time of 3600sec (=1 hour). <a href="http://www.faqs.org/rfcs/rfc2246.html">RFC 2246</a>
+default of 300s, but a longer time of 3600sec (=1 hour). <a href="http://tools.ietf.org/html/rfc2246">RFC 2246</a>
 recommends a maximum of 24 hours.  </p>
 
 <p> Example: </p>
@@ -933,13 +938,18 @@ is allowed to negotiate per unit time.</p>
 <blockquote>
 <pre>
 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
-    <a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a> = btree:/etc/postfix/smtp_scache
+    <a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a> = btree:/var/lib/postfix/smtp_scache
 </pre>
 </blockquote>
 
+<p> As of version 2.5, Postfix will no longer maintain this file
+in a directory with non-Postfix ownership. As a migration aid,
+attempts to open such files are redirected to the Postfix-owned
+$<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP client session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
-default of 300s, but a longer time of 3600s (=1 hour). <a href="http://www.faqs.org/rfcs/rfc2246.html">RFC 2246</a>
+default of 300s, but a longer time of 3600s (=1 hour). <a href="http://tools.ietf.org/html/rfc2246">RFC 2246</a>
 recommends a maximum of 24 hours.  </p>
 
 <p> Example: </p>
@@ -994,7 +1004,7 @@ CommonName is checked.  Verification may be turned off with the
 
 <p> Enforcing the use of TLS is useful if you know that you will
 only
-connect to servers that support <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> _and_ that present server
+connect to servers that support <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> _and_ that present server
 certificates that meet the above requirements.  An example would
 be a client only sends email to one specific mailhub that offers
 the necessary STARTTLS support.  </p>
@@ -1011,7 +1021,7 @@ the necessary STARTTLS support.  </p>
 <h3> <a name="client_tls_nopeer"> Disabling server certificate
 verification </a> </h3>
 
-<p> As of <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> the requirements for hostname checking for MTA
+<p> As of <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> the requirements for hostname checking for MTA
 clients are not set. When TLS is required (<a href="postconf.5.html#smtp_enforce_tls">smtp_enforce_tls</a> = yes),
 the option <a href="postconf.5.html#smtp_tls_enforce_peername">smtp_tls_enforce_peername</a> can be set to "no" to disable
 strict remote SMTP server hostname checking. In this case, the mail
index 1cbe97e32ee2aacd7463594bdb194c4da50a0fbb..d8ce9fc5c7e6b1422ebfaeb8c79c9a1e05477c6e 100644 (file)
@@ -463,7 +463,7 @@ so that the Postfix SMTP server announces STARTTLS and accepts no
 mail without TLS encryption, by setting
 "<a href="postconf.5.html#smtpd_tls_security_level">smtpd_tls_security_level</a> = encrypt" (Postfix 2.3 and
 later) or "<a href="postconf.5.html#smtpd_enforce_tls">smtpd_enforce_tls</a> = yes" (obsolete but still
-supported). According to <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> this MUST NOT be applied in case
+supported). According to <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> this MUST NOT be applied in case
 of a publicly-referenced Postfix SMTP server.  This option is off
 by default and should only seldom be used. </p>
 
@@ -616,9 +616,15 @@ the cost of repeatedly negotiating TLS session keys is high.</p>
 </pre>
 </blockquote>
 
+<p> Note: as of version 2.5, Postfix no longer uses root privileges     
+when opening this file. The file should now be stored under the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP server session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
-default of 300s, but a longer time of 3600sec (=1 hour). <a href="http://www.faqs.org/rfcs/rfc2246.html">RFC 2246</a>
+default of 300s, but a longer time of 3600sec (=1 hour). <a href="http://tools.ietf.org/html/rfc2246">RFC 2246</a>
 recommends a maximum of 24 hours.  </p>
 
 <p> Example: </p>
@@ -1077,9 +1083,15 @@ is allowed to negotiate per unit time.</p>
 </pre>
 </blockquote>
 
+<p> Note: as of version 2.5, Postfix no longer uses root privileges     
+when opening this file. The file should now be stored under the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP client session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
-default of 300s, but a longer time of 3600s (=1 hour). <a href="http://www.faqs.org/rfcs/rfc2246.html">RFC 2246</a>
+default of 300s, but a longer time of 3600s (=1 hour). <a href="http://tools.ietf.org/html/rfc2246">RFC 2246</a>
 recommends a maximum of 24 hours.  </p>
 
 <p> Example: </p>
@@ -1461,7 +1473,7 @@ verification as a default policy. </p>
 
 <p> Mandatory server certificate verification as a default security
 level may be appropriate if you know that you will only connect to
-servers that support <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> <i>and</i> that present verifiable
+servers that support <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> <i>and</i> that present verifiable
 server certificates. An example would be a client that sends all
 email to a central mailhub that offers the necessary STARTTLS
 support. In such cases, you can often use a <a
@@ -1545,7 +1557,7 @@ as a default policy. </p>
 
 <p> Mandatory secure server certificate verification as a default
 security level may be appropriate if you know that you will only
-connect to servers that support <a href="http://www.faqs.org/rfcs/rfc2487.html">RFC 2487</a> <i>and</i> that present
+connect to servers that support <a href="http://tools.ietf.org/html/rfc2487">RFC 2487</a> <i>and</i> that present
 verifiable server certificates. An example would be a client that
 sends all email to a central mailhub that offers the necessary
 STARTTLS support. </p>
@@ -2164,22 +2176,31 @@ The default maximal time interval is 1 hour. </p>
 <p> The <a href="tlsmgr.8.html">tlsmgr(8)</a> process saves the PRNG state to a persistent
 exchange file at regular times and when the process terminates, so
 that it can recover the PRNG state the next time it starts up.
-This file is created when it does not exist. Its default location
-is under the Postfix configuration directory, which is not the
-proper place for information that is modified by Postfix.  Instead,
-the file location should probably be on the /var partition (but
-<b>not</b> inside the chroot jail).  </p>
+This file is created when it does not exist. </p>
 
 <p> Examples: </p>
  
 <blockquote>
 <pre>
 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
-    <a href="postconf.5.html#tls_random_exchange_name">tls_random_exchange_name</a> = /etc/postfix/prng_exch
+    <a href="postconf.5.html#tls_random_exchange_name">tls_random_exchange_name</a> = /var/lib/postfix/prng_exch
     <a href="postconf.5.html#tls_random_prng_update_period">tls_random_prng_update_period</a> = 3600s
 </pre>
 </blockquote>
 
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. If you wish to continue
+using a pre-existing PRNG state file, move it to the <a href="postconf.5.html#data_directory">data_directory</a>
+and change the ownership to the account specified with the <a href="postconf.5.html#mail_owner">mail_owner</a>
+parameter.  </p>
+
+<p> With earlier Postfix versions the default file location
+is under the Postfix configuration directory, which is not the
+proper place for information that is modified by Postfix.  </p>
+
 <h2><a name="quick-start">Getting started, quick and dirty</a></h2>
 
 <p> The following steps will get you started quickly. Because you
index 7d364d855257d0b8c5cd7ec1cb957d4a408d2acc..cd525afc415703e1f5a92d08121bb0316ace7395 100644 (file)
@@ -163,6 +163,12 @@ database becomes corrupted, the world comes to an end. To recover
 delete the file and do "<b>postfix reload</b>".
 </p>
 
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p>
 Examples:
 </p>
@@ -6180,13 +6186,10 @@ This feature is available in Postfix 2.0 and later.
 <DT><b><a name="proxy_write_maps">proxy_write_maps</a>
 (default: see "postconf -d" output)</b></DT><DD>
 
-<p>
-The lookup tables that the <a href="proxymap.8.html">proxymap(8)</a> server is allowed to access
-for the read-write service. If implemented with local files, these
-tables are preferably stored under the location specified with the
-<a href="postconf.5.html#data_directory">data_directory</a> configuration parameter.
-Table references that don't begin with <a href="proxymap.8.html">proxy</a>: are ignored.
-</p>
+<p> The lookup tables that the <a href="proxymap.8.html">proxymap(8)</a> server is allowed to
+access for the read-write service. Postfix-owned local database
+files should be stored under the Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>.
+Table references that don't begin with <a href="proxymap.8.html">proxy</a>: are ignored.  </p>
 
 <p>
 This feature is available in Postfix 2.5 and later.
@@ -9116,13 +9119,19 @@ implemented indirectly in the <a href="tlsmgr.8.html">tlsmgr(8)</a> daemon. This
 per-smtp-instance <a href="master.5.html">master.cf</a> overrides of this parameter are not effective.
 Note, that each of the cache databases supported by <a href="tlsmgr.8.html">tlsmgr(8)</a> daemon:
 $<a href="postconf.5.html#smtpd_tls_session_cache_database">smtpd_tls_session_cache_database</a>, $<a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a>
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to
-be stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $<a href="postconf.5.html#lmtp_tls_session_cache_database">lmtp_tls_session_cache_database</a>), needs to
+be stored separately. It is not at this time possible to store multiple
 caches in a single database. </p>
 
 <p> Note: <b>dbm</b> databases are not suitable. TLS
 session objects are too large. </p>
 
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Example: </p>
 
 <pre>
@@ -11850,13 +11859,19 @@ implemented indirectly in the <a href="tlsmgr.8.html">tlsmgr(8)</a> daemon. This
 per-smtpd-instance <a href="master.5.html">master.cf</a> overrides of this parameter are not
 effective. Note, that each of the cache databases supported by <a href="tlsmgr.8.html">tlsmgr(8)</a>
 daemon: $<a href="postconf.5.html#smtpd_tls_session_cache_database">smtpd_tls_session_cache_database</a>, $<a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a>
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to be
-stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $<a href="postconf.5.html#lmtp_tls_session_cache_database">lmtp_tls_session_cache_database</a>), needs to be
+stored separately. It is not at this time possible to store multiple
 caches in a single database. </p>
 
 <p> Note: <b>dbm</b> databases are not suitable. TLS
 session objects are too large. </p>
 
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+<a href="postconf.5.html#data_directory">data_directory</a>, and a warning is logged. </p>
+
 <p> Example: </p>
 
 <pre>
@@ -12245,15 +12260,18 @@ bytes is read. </p>
 </DD>
 
 <DT><b><a name="tls_random_exchange_name">tls_random_exchange_name</a>
-(default: ${<a href="postconf.5.html#config_directory">config_directory</a>}/prng_exch)</b></DT><DD>
+(default: see "postconf -d" output)</b></DT><DD>
 
 <p> Name of the pseudo random number generator (PRNG) state file
 that is maintained by <a href="tlsmgr.8.html">tlsmgr(8)</a>. The file is created when it does
 not exist, and its length is fixed at 1024 bytes.  </p>
 
-<p> Since this file is modified by Postfix, it should probably be
-kept in the /var file system, instead of under $<a href="postconf.5.html#config_directory">config_directory</a>.
-The location should not be inside the chroot jail. </p>
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file, and the default file location was changed from
+${<a href="postconf.5.html#config_directory">config_directory</a>}/prng_exch to ${<a href="postconf.5.html#data_directory">data_directory</a>}/prng_exch.  As
+a migration aid, an attempt to open the file under a non-Postfix
+directory is redirected to the Postfix-owned <a href="postconf.5.html#data_directory">data_directory</a>, and a
+warning is logged. </p>
 
 <p> This feature is available in Postfix 2.2 and later.  </p>
 
index 48100fe83804affc07a2dd29b12c03ba29380fac..a11b312aaa0561bba36bb01d63e96d0f975eec18 100644 (file)
@@ -117,13 +117,13 @@ PROXYMAP(8)                                                        PROXYMAP(8)
        sitive processes.
 
        Postfix-writable data files should be stored under a dedi-
-       cated  directory  that is writable only by the $<b><a href="postconf.5.html#mail_owner">mail_owner</a></b>
-       account, such as the $<b><a href="postconf.5.html#data_directory">data_directory</a></b> directory.
+       cated  directory that is writable only by the Postfix mail
+       system, such as the Postfix-owned <b><a href="postconf.5.html#data_directory">data_directory</a></b>.
 
        In particular, Postfix-writable files should  never  exist
        in root-owned directories. That would open up a particular
-       type of security hole  where  ownership  (root)  does  not
-       match content provenance (Postfix).
+       type of security hole where ownership of a file or  direc-
+       tory does not match the provider of its content.
 
 <b>DIAGNOSTICS</b>
        Problems and transactions are logged to <b>syslogd</b>(8).
index a60980d8a3f6bedaef31b2b1dccdabf0e7a11eca..509ee8b068aad1732aa466b58d15f3627b1d05ab 100644 (file)
@@ -47,6 +47,13 @@ TLSMGR(8)                                                            TLSMGR(8)
        source  and  exchange  file,  and creates or truncates the
        optional TLS session cache files.
 
+       With Postfix version  2.5  and  later,  the  <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a>  no
+       longer  uses  root  privileges  when  opening cache files.
+       These files should now be stored under  the  Postfix-owned
+       <b><a href="postconf.5.html#data_directory">data_directory</a></b>.   As a migration aid, an attempt to open a
+       cache file under a non-Postfix directory is redirected  to
+       the Postfix-owned <b><a href="postconf.5.html#data_directory">data_directory</a></b>, and a warning is logged.
+
 <b>DIAGNOSTICS</b>
        Problems and transactions are logged to the syslog daemon.
 
@@ -111,7 +118,7 @@ TLSMGR(8)                                                            TLSMGR(8)
               $<a href="postconf.5.html#tls_random_source">tls_random_source</a> when (re)seeding  the  in-memory
               pseudo random number generator (PRNG) pool.
 
-       <b><a href="postconf.5.html#tls_random_exchange_name">tls_random_exchange_name</a> (${<a href="postconf.5.html#config_directory">config_directory</a>}/prng_exch)</b>
+       <b><a href="postconf.5.html#tls_random_exchange_name">tls_random_exchange_name</a> (see 'postconf -d' output)</b>
               Name  of  the pseudo random number generator (PRNG)
               state file that is maintained by <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a>.
 
index 23dce716744fd8454a75207e22523cfba504a347..744a5bb7185012ff974ae758546a1cd421d38674 100644 (file)
@@ -54,6 +54,14 @@ VERIFY(8)                                                            VERIFY(8)
        trades one problem (disk space exhaustion) for another one
        (poor response time to client requests).
 
+       With  Postfix  version 2.5 and later, the <a href="verify.8.html"><b>verify</b>(8)</a> server
+       no  longer  uses  root   privileges   when   opening   the
+       <b><a href="postconf.5.html#address_verify_map">address_verify_map</a></b>  cache  file.  The  file  should now be
+       stored  under  the  Postfix-owned  <b><a href="postconf.5.html#data_directory">data_directory</a></b>.   As  a
+       migration  aid,  an  attempt  to open a cache file under a
+       non-Postfix directory is redirected to  the  Postfix-owned
+       <b><a href="postconf.5.html#data_directory">data_directory</a></b>, and a warning is logged.
+
 <b>DIAGNOSTICS</b>
        Problems and transactions are logged to <b>syslogd</b>(8).
 
@@ -82,12 +90,13 @@ VERIFY(8)                                                            VERIFY(8)
               Optional  lookup table for persistent address veri-
               fication status storage.
 
-       <b><a href="postconf.5.html#address_verify_sender">address_verify_sender</a> (postmaster)</b>
+       <b><a href="postconf.5.html#address_verify_sender">address_verify_sender</a> ($<a href="postconf.5.html#double_bounce_sender">double_bounce_sender</a>)</b>
               The sender address to use in  address  verification
-              probes.
+              probes; prior to Postfix 2.5 the default was "post-
+              master".
 
        <b><a href="postconf.5.html#address_verify_positive_expire_time">address_verify_positive_expire_time</a> (31d)</b>
-              The  time  after  which  a successful probe expires
+              The time after which  a  successful  probe  expires
               from the address verification cache.
 
        <b><a href="postconf.5.html#address_verify_positive_refresh_time">address_verify_positive_refresh_time</a> (7d)</b>
@@ -99,24 +108,24 @@ VERIFY(8)                                                            VERIFY(8)
               results.
 
        <b><a href="postconf.5.html#address_verify_negative_expire_time">address_verify_negative_expire_time</a> (3d)</b>
-              The time after which a failed  probe  expires  from
+              The  time  after  which a failed probe expires from
               the address verification cache.
 
        <b><a href="postconf.5.html#address_verify_negative_refresh_time">address_verify_negative_refresh_time</a> (3h)</b>
-              The  time after which a failed address verification
+              The time after which a failed address  verification
               probe needs to be refreshed.
 
 <b>PROBE MESSAGE ROUTING CONTROLS</b>
-       By default, probe messages  are  delivered  via  the  same
-       route  as  regular messages.  The following parameters can
+       By  default,  probe  messages  are  delivered via the same
+       route as regular messages.  The following  parameters  can
        be used to override specific message routing mechanisms.
 
        <b><a href="postconf.5.html#address_verify_relayhost">address_verify_relayhost</a> ($<a href="postconf.5.html#relayhost">relayhost</a>)</b>
-              Overrides  the  <a href="postconf.5.html#relayhost">relayhost</a>  parameter  setting   for
+              Overrides   the  <a href="postconf.5.html#relayhost">relayhost</a>  parameter  setting  for
               address verification probes.
 
        <b><a href="postconf.5.html#address_verify_transport_maps">address_verify_transport_maps</a> ($<a href="postconf.5.html#transport_maps">transport_maps</a>)</b>
-              Overrides  the <a href="postconf.5.html#transport_maps">transport_maps</a> parameter setting for
+              Overrides the <a href="postconf.5.html#transport_maps">transport_maps</a> parameter setting  for
               address verification probes.
 
        <b><a href="postconf.5.html#address_verify_local_transport">address_verify_local_transport</a> ($<a href="postconf.5.html#local_transport">local_transport</a>)</b>
@@ -124,7 +133,7 @@ VERIFY(8)                                                            VERIFY(8)
               address verification probes.
 
        <b><a href="postconf.5.html#address_verify_virtual_transport">address_verify_virtual_transport</a> ($<a href="postconf.5.html#virtual_transport">virtual_transport</a>)</b>
-              Overrides  the  <a href="postconf.5.html#virtual_transport">virtual_transport</a> parameter setting
+              Overrides the <a href="postconf.5.html#virtual_transport">virtual_transport</a>  parameter  setting
               for address verification probes.
 
        <b><a href="postconf.5.html#address_verify_relay_transport">address_verify_relay_transport</a> ($<a href="postconf.5.html#relay_transport">relay_transport</a>)</b>
@@ -132,17 +141,17 @@ VERIFY(8)                                                            VERIFY(8)
               address verification probes.
 
        <b><a href="postconf.5.html#address_verify_default_transport">address_verify_default_transport</a> ($<a href="postconf.5.html#default_transport">default_transport</a>)</b>
-              Overrides  the  <a href="postconf.5.html#default_transport">default_transport</a> parameter setting
+              Overrides the <a href="postconf.5.html#default_transport">default_transport</a>  parameter  setting
               for address verification probes.
 
 <b>MISCELLANEOUS CONTROLS</b>
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The default location of  the  Postfix  <a href="postconf.5.html">main.cf</a>  and
+              The  default  location  of  the Postfix <a href="postconf.5.html">main.cf</a> and
               <a href="master.5.html">master.cf</a> configuration files.
 
        <b><a href="postconf.5.html#daemon_timeout">daemon_timeout</a> (18000s)</b>
-              How  much time a Postfix daemon process may take to
-              handle a request  before  it  is  terminated  by  a
+              How much time a Postfix daemon process may take  to
+              handle  a  request  before  it  is  terminated by a
               built-in watchdog timer.
 
        <b><a href="postconf.5.html#ipc_timeout">ipc_timeout</a> (3600s)</b>
@@ -150,23 +159,23 @@ VERIFY(8)                                                            VERIFY(8)
               over an internal communication channel.
 
        <b><a href="postconf.5.html#process_id">process_id</a> (read-only)</b>
-              The process ID  of  a  Postfix  command  or  daemon
+              The  process  ID  of  a  Postfix  command or daemon
               process.
 
        <b><a href="postconf.5.html#process_name">process_name</a> (read-only)</b>
-              The  process  name  of  a Postfix command or daemon
+              The process name of a  Postfix  command  or  daemon
               process.
 
        <b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
-              The location of the Postfix top-level queue  direc-
+              The  location of the Postfix top-level queue direc-
               tory.
 
        <b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
               The syslog facility of Postfix logging.
 
        <b><a href="postconf.5.html#syslog_name">syslog_name</a> (postfix)</b>
-              The  mail  system  name  that  is  prepended to the
-              process name in syslog  records,  so  that  "smtpd"
+              The mail system  name  that  is  prepended  to  the
+              process  name  in  syslog  records, so that "smtpd"
               becomes, for example, "postfix/smtpd".
 
 <b>SEE ALSO</b>
@@ -179,7 +188,7 @@ VERIFY(8)                                                            VERIFY(8)
        <a href="ADDRESS_VERIFICATION_README.html">ADDRESS_VERIFICATION_README</a>, address verification howto
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>HISTORY</b>
index e204a342ad7675d3dcd060b5e54a481262ad92fe..5bef7fd800c9c273afcce7c8565857ec56298ea3 100644 (file)
@@ -99,6 +99,12 @@ Specify a location in a file system that will not fill up. If the
 database becomes corrupted, the world comes to an end. To recover
 delete the file and do "\fBpostfix reload\fR".
 .PP
+As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged.
+.PP
 Examples:
 .PP
 .nf
@@ -3436,10 +3442,9 @@ Table references that don't begin with proxy: are ignored.
 .PP
 This feature is available in Postfix 2.0 and later.
 .SH proxy_write_maps (default: see "postconf -d" output)
-The lookup tables that the \fBproxymap\fR(8) server is allowed to access
-for the read-write service. If implemented with local files, these
-tables are preferably stored under the location specified with the
-data_directory configuration parameter.
+The lookup tables that the \fBproxymap\fR(8) server is allowed to
+access for the read-write service. Postfix-owned local database
+files should be stored under the Postfix-owned data_directory.
 Table references that don't begin with proxy: are ignored.
 .PP
 This feature is available in Postfix 2.5 and later.
@@ -5359,13 +5364,19 @@ implemented indirectly in the \fBtlsmgr\fR(8) daemon. This means that
 per-smtp-instance master.cf overrides of this parameter are not effective.
 Note, that each of the cache databases supported by \fBtlsmgr\fR(8) daemon:
 $smtpd_tls_session_cache_database, $smtp_tls_session_cache_database
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to
-be stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $lmtp_tls_session_cache_database), needs to
+be stored separately. It is not at this time possible to store multiple
 caches in a single database.
 .PP
 Note: \fBdbm\fR databases are not suitable. TLS
 session objects are too large.
 .PP
+As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged.
+.PP
 Example:
 .PP
 .nf
@@ -7234,13 +7245,19 @@ implemented indirectly in the \fBtlsmgr\fR(8) daemon. This means that
 per-smtpd-instance master.cf overrides of this parameter are not
 effective. Note, that each of the cache databases supported by \fBtlsmgr\fR(8)
 daemon: $smtpd_tls_session_cache_database, $smtp_tls_session_cache_database
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to be
-stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $lmtp_tls_session_cache_database), needs to be
+stored separately. It is not at this time possible to store multiple
 caches in a single database.
 .PP
 Note: \fBdbm\fR databases are not suitable. TLS
 session objects are too large.
 .PP
+As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged.
+.PP
 Example:
 .PP
 .nf
@@ -7454,14 +7471,17 @@ symmetric keys.  If using EGD or a device file, a maximum of 255
 bytes is read.
 .PP
 This feature is available in Postfix 2.2 and later.
-.SH tls_random_exchange_name (default: ${config_directory}/prng_exch)
+.SH tls_random_exchange_name (default: see "postconf -d" output)
 Name of the pseudo random number generator (PRNG) state file
 that is maintained by \fBtlsmgr\fR(8). The file is created when it does
 not exist, and its length is fixed at 1024 bytes.
 .PP
-Since this file is modified by Postfix, it should probably be
-kept in the /var file system, instead of under $config_directory.
-The location should not be inside the chroot jail.
+As of version 2.5, Postfix no longer uses root privileges when
+opening this file, and the default file location was changed from
+${config_directory}/prng_exch to ${data_directory}/prng_exch.  As
+a migration aid, an attempt to open the file under a non-Postfix
+directory is redirected to the Postfix-owned data_directory, and a
+warning is logged.
 .PP
 This feature is available in Postfix 2.2 and later.
 .SH tls_random_prng_update_period (default: 3600s)
index 6d6aa619d8ab68dc59f9a777ffdd9cd82036dc59..025b307266e4cd92b5f3c090dcc49e03ad76f829 100644 (file)
@@ -119,13 +119,13 @@ and opens the table directly. This allows the same main.cf
 setting to be used by sensitive and non-sensitive processes.
 
 Postfix-writable data files should be stored under a dedicated
-directory that is writable only by the $\fBmail_owner\fR
-account, such as the $\fBdata_directory\fR directory.
+directory that is writable only by the Postfix mail system,
+such as the Postfix-owned \fBdata_directory\fR.
 
 In particular, Postfix-writable files should never exist
 in root-owned directories. That would open up a particular
-type of security hole where ownership (root) does not match
-content provenance (Postfix).
+type of security hole where ownership of a file or directory
+does not match the provider of its content.
 .SH DIAGNOSTICS
 .ad
 .fi
@@ -185,8 +185,8 @@ Available in Postfix 2.5 and later:
 The directory with Postfix-writable data files (for example:
 caches, pseudo-random numbers).
 .IP "\fBproxy_write_maps (see 'postconf -d' output)\fR"
-The lookup tables that the \fBproxymap\fR(8) server is allowed to access
-for the read-write service.
+The lookup tables that the \fBproxymap\fR(8) server is allowed to
+access for the read-write service.
 .SH "SEE ALSO"
 .na
 .nf
index 6bba143a529af7d1fdea4104865f47278abd5824..5765ea3915eff92437ddaaa13914c1a268f72a1b 100644 (file)
@@ -48,6 +48,14 @@ The \fBtlsmgr\fR(8) can be run chrooted and with reduced privileges.
 At process startup it connects to the entropy source and
 exchange file, and creates or truncates the optional TLS
 session cache files.
+
+With Postfix version 2.5 and later, the \fBtlsmgr\fR(8) no
+longer uses root privileges when opening cache files. These
+files should now be stored under the Postfix-owned
+\fBdata_directory\fR.  As a migration aid, an attempt to
+open a cache file under a non-Postfix directory is redirected
+to the Postfix-owned \fBdata_directory\fR, and a warning
+is logged.
 .SH DIAGNOSTICS
 .ad
 .fi
@@ -110,7 +118,7 @@ random number generator (PRNG) pool.
 The number of bytes that \fBtlsmgr\fR(8) reads from $tls_random_source
 when (re)seeding the in-memory pseudo random number generator (PRNG)
 pool.
-.IP "\fBtls_random_exchange_name (${config_directory}/prng_exch)\fR"
+.IP "\fBtls_random_exchange_name (see 'postconf -d' output)\fR"
 Name of the pseudo random number generator (PRNG) state file
 that is maintained by \fBtlsmgr\fR(8).
 .IP "\fBtls_random_prng_update_period (3600s)\fR"
index 2a9eedbe070224e350b7438bfc86cbbea1efc45a..fa8c05ec9d0b384ca5ebdfa4c828f91fb5435c4a 100644 (file)
@@ -52,6 +52,14 @@ 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).
+
+With Postfix version 2.5 and later, the \fBverify\fR(8)
+server no longer uses root privileges when opening the
+\fBaddress_verify_map\fR cache file. The file should now
+be stored under the Postfix-owned \fBdata_directory\fR.  As
+a migration aid, an attempt to open a cache file under a
+non-Postfix directory is redirected to the Postfix-owned
+\fBdata_directory\fR, and a warning is logged.
 .SH DIAGNOSTICS
 .ad
 .fi
@@ -88,8 +96,9 @@ The text below provides only a parameter summary. See
 .IP "\fBaddress_verify_map (empty)\fR"
 Optional lookup table for persistent address verification status
 storage.
-.IP "\fBaddress_verify_sender (postmaster)\fR"
-The sender address to use in address verification probes.
+.IP "\fBaddress_verify_sender ($double_bounce_sender)\fR"
+The sender address to use in address verification probes; prior
+to Postfix 2.5 the default was "postmaster".
 .IP "\fBaddress_verify_positive_expire_time (31d)\fR"
 The time after which a successful probe expires from the address
 verification cache.
index 6addcb7b5d2e47c08d01293c534df22b1c4dc112..46be3f376a410ed9cc5f3218bd8c020486cb336f 100644 (file)
@@ -272,7 +272,7 @@ specific domains that often appear in forged email. </p>
     unverified_sender_reject_code = 550
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree instead.
-    address_verify_map = btree:/var/mta/verify
+    address_verify_map = btree:/var/lib/postfix/verify
  
 /etc/postfix/sender_access:
     aol.com     reject_unverified_sender
@@ -314,7 +314,7 @@ you can see what mail would be blocked: </p>
         ...
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree instead.
-    address_verify_map = btree:/var/mta/verify
+    address_verify_map = btree:/var/lib/postfix/verify
 </pre>
 </blockquote>
 
@@ -373,19 +373,28 @@ stop". </p>
 <pre>
 /etc/postfix/main.cf:
     # Note: avoid hash files here. Use btree instead.
-    address_verify_map = btree:/var/mta/verify
+    address_verify_map = btree:/var/lib/postfix/verify
 </pre>
 </blockquote>
 
-<p> NOTE: Do not put this file in a file system that may run out
+<p> NOTE 1: As of version 2.5, Postfix no longer uses root privileges
+when opening this file. The file should now be stored under the
+Postfix-owned data_directory. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned data_directory, and a warning is logged. If you wish
+to continue using an pre-existing database file, move it to the
+data_directory, and change ownership to the account specfied with
+the mail_owner parameter.  </p>
+
+<p> NOTE 2: Do not put this file in a file system that may run out
 of space.  When the address verification table gets corrupted the
 world comes to an end and YOU will have to MANUALLY fix things as
 described in the next section. Meanwhile, you will not receive mail
 via SMTP. </p>
 
-<p> The verify(8) daemon process will create a new database when
+<p> NOTE 3: The verify(8) daemon process will create a new database when
 none exists, and will open/create the file before it enters the
-chroot jail and before it drops root privileges. </p>
+chroot jail. </p>
 
 <h2><a name="dirty_secret">Managing the address verification
 database</a></h2>
index e63a7e6702727523ebe3b972579128dfc01a490b..b8c74141e9aa61e11fe23d50ce2b0b00bc3e4ce3 100644 (file)
@@ -616,6 +616,12 @@ the cost of repeatedly negotiating TLS session keys is high.</p>
 </pre>
 </blockquote>
 
+<p> Note: as of version 2.5, Postfix no longer uses root privileges     
+when opening this file. The file should now be stored under the
+Postfix-owned data_directory. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned data_directory, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP server session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
 default of 300s, but a longer time of 3600sec (=1 hour). RFC 2246
@@ -1077,6 +1083,12 @@ is allowed to negotiate per unit time.</p>
 </pre>
 </blockquote>
 
+<p> Note: as of version 2.5, Postfix no longer uses root privileges     
+when opening this file. The file should now be stored under the
+Postfix-owned data_directory. As a migration aid, an attempt to
+open the file under a non-Postfix directory is redirected to the
+Postfix-owned data_directory, and a warning is logged. </p>
+
 <p> Cached Postfix SMTP client session information expires after
 a certain amount of time.  Postfix/TLS does not use the OpenSSL
 default of 300s, but a longer time of 3600s (=1 hour). RFC 2246
@@ -2164,22 +2176,31 @@ The default maximal time interval is 1 hour. </p>
 <p> The tlsmgr(8) process saves the PRNG state to a persistent
 exchange file at regular times and when the process terminates, so
 that it can recover the PRNG state the next time it starts up.
-This file is created when it does not exist. Its default location
-is under the Postfix configuration directory, which is not the
-proper place for information that is modified by Postfix.  Instead,
-the file location should probably be on the /var partition (but
-<b>not</b> inside the chroot jail).  </p>
+This file is created when it does not exist. </p>
 
 <p> Examples: </p>
  
 <blockquote>
 <pre>
 /etc/postfix/main.cf:
-    tls_random_exchange_name = /etc/postfix/prng_exch
+    tls_random_exchange_name = /var/lib/postfix/prng_exch
     tls_random_prng_update_period = 3600s
 </pre>
 </blockquote>
 
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged. If you wish to continue
+using a pre-existing PRNG state file, move it to the data_directory
+and change the ownership to the account specified with the mail_owner
+parameter.  </p>
+
+<p> With earlier Postfix versions the default file location
+is under the Postfix configuration directory, which is not the
+proper place for information that is modified by Postfix.  </p>
+
 <h2><a name="quick-start">Getting started, quick and dirty</a></h2>
 
 <p> The following steps will get you started quickly. Because you
index 8a18896159f7155f6c9a0b5eb27f666995d71a15..8f8daa962c53c27559826c4d7dfc223393639e75 100644 (file)
@@ -183,6 +183,12 @@ Specify a location in a file system that will not fill up. If the
 database becomes corrupted, the world comes to an end. To recover
 delete the file and do "<b>postfix reload</b>".
 </p>
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged. </p>
 
 <p>
 Examples:
@@ -7215,13 +7221,10 @@ This feature is available in Postfix 2.0 and later.
 
 %PARAM proxy_write_maps see "postconf -d" output
 
-<p>
-The lookup tables that the proxymap(8) server is allowed to access
-for the read-write service. If implemented with local files, these
-tables are preferably stored under the location specified with the
-data_directory configuration parameter.
-Table references that don't begin with proxy: are ignored.
-</p>
+<p> The lookup tables that the proxymap(8) server is allowed to
+access for the read-write service. Postfix-owned local database
+files should be stored under the Postfix-owned data_directory.
+Table references that don't begin with proxy: are ignored.  </p>
 
 <p>
 This feature is available in Postfix 2.5 and later.
@@ -8480,12 +8483,18 @@ implemented indirectly in the tlsmgr(8) daemon. This means that
 per-smtpd-instance master.cf overrides of this parameter are not
 effective. Note, that each of the cache databases supported by tlsmgr(8)
 daemon: $smtpd_tls_session_cache_database, $smtp_tls_session_cache_database
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to be
-stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $lmtp_tls_session_cache_database), needs to be
+stored separately. It is not at this time possible to store multiple
 caches in a single database. </p>
 
 <p> Note: <b>dbm</b> databases are not suitable. TLS
 session objects are too large. </p>
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged. </p>
 
 <p> Example: </p>
 
@@ -8738,12 +8747,18 @@ implemented indirectly in the tlsmgr(8) daemon. This means that
 per-smtp-instance master.cf overrides of this parameter are not effective.
 Note, that each of the cache databases supported by tlsmgr(8) daemon:
 $smtpd_tls_session_cache_database, $smtp_tls_session_cache_database
-(and with Postfix 2.3 and later $lmtp_session_cache_database), needs to
-be stored separately, it is not at this time possible to store multiple
+(and with Postfix 2.3 and later $lmtp_tls_session_cache_database), needs to
+be stored separately. It is not at this time possible to store multiple
 caches in a single database. </p>
 
 <p> Note: <b>dbm</b> databases are not suitable. TLS
 session objects are too large. </p>
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file. The file should now be stored under the Postfix-owned
+data_directory. As a migration aid, an attempt to open the file
+under a non-Postfix directory is redirected to the Postfix-owned
+data_directory, and a warning is logged. </p>
 
 <p> Example: </p>
 
@@ -8966,15 +8981,18 @@ smtp_tls_dcert_file = /etc/postfix/client-dsa.pem
 
 <p> This feature is available in Postfix 2.2 and later.  </p>
 
-%PARAM tls_random_exchange_name ${config_directory}/prng_exch
+%PARAM tls_random_exchange_name see "postconf -d" output
 
 <p> Name of the pseudo random number generator (PRNG) state file
 that is maintained by tlsmgr(8). The file is created when it does
 not exist, and its length is fixed at 1024 bytes.  </p>
 
-<p> Since this file is modified by Postfix, it should probably be
-kept in the /var file system, instead of under $config_directory.
-The location should not be inside the chroot jail. </p>
+<p> As of version 2.5, Postfix no longer uses root privileges when
+opening this file, and the default file location was changed from
+${config_directory}/prng_exch to ${data_directory}/prng_exch.  As
+a migration aid, an attempt to open the file under a non-Postfix
+directory is redirected to the Postfix-owned data_directory, and a
+warning is logged. </p>
 
 <p> This feature is available in Postfix 2.2 and later.  </p>
 
index b87e7733562b9be997328c059ba16c0b2e348451..bb44e93d9296d81b0cd06d6718975fa10ca873e3 100644 (file)
@@ -28,7 +28,7 @@ SRCS  = abounce.c anvil_clnt.c been_here.c bounce.c bounce_log.c \
        tok822_resolve.c tok822_rewrite.c tok822_tree.c trace.c \
        user_acl.c valid_mailhost_addr.c verify.c verify_clnt.c \
        verp_sender.c wildcard_inet_addr.c xtext.c delivered_hdr.c \
-       fold_addr.c header_body_checks.c mkmap_proxy.c
+       fold_addr.c header_body_checks.c mkmap_proxy.c data_redirect.c
 OBJS   = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \
        canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
        clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
@@ -58,7 +58,7 @@ OBJS  = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \
        tok822_resolve.o tok822_rewrite.o tok822_tree.o trace.o \
        user_acl.o valid_mailhost_addr.o verify.o verify_clnt.o \
        verp_sender.o wildcard_inet_addr.o xtext.o delivered_hdr.o \
-       fold_addr.o header_body_checks.o mkmap_proxy.o
+       fold_addr.o header_body_checks.o mkmap_proxy.o data_redirect.o
 HDRS   = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \
        canon_addr.h cfg_parser.h cleanup_user.h clnt_stream.h config.h \
        conv_time.h db_common.h debug_peer.h debug_process.h defer.h \
@@ -82,7 +82,7 @@ HDRS  = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \
        string_list.h strip_addr.h sys_exits.h timed_ipc.h tok822.h \
        trace.h user_acl.h valid_mailhost_addr.h verify.h verify_clnt.h \
        verp_sender.h wildcard_inet_addr.h xtext.h delivered_hdr.h \
-       fold_addr.h header_body_checks.h
+       fold_addr.h header_body_checks.h data_redirect.h
 TESTSRC        = rec2stream.c stream2rec.c recdump.c
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
@@ -94,7 +94,8 @@ TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \
        resolve_local rewrite_clnt stream2rec string_list tok822_parse \
        quote_821_local mail_conf_time mime_state strip_addr \
        verify_clnt xtext anvil_clnt scache ehlo_mask \
-       valid_mailhost_addr own_inet_addr header_body_checks
+       valid_mailhost_addr own_inet_addr header_body_checks \
+       data_redirect
 
 LIBS   = ../../lib/libutil.a
 LIB_DIR        = ../../lib
@@ -274,6 +275,9 @@ own_inet_addr: own_inet_addr.c $(LIB) $(LIBS)
 header_body_checks: header_body_checks.c $(LIB) $(LIBS)
        $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS)
 
+data_redirect: data_redirect.c $(LIB) $(LIBS)
+       $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS)
+
 tests: tok822_test mime_tests strip_addr_test tok822_limit_test \
        xtext_test scache_multi_test ehlo_mask_test \
        namadr_list_test mail_conf_time_test header_body_checks_tests
@@ -636,6 +640,23 @@ conv_time.o: ../../include/msg.h
 conv_time.o: ../../include/sys_defs.h
 conv_time.o: conv_time.c
 conv_time.o: conv_time.h
+data_redirect.o: ../../include/argv.h
+data_redirect.o: ../../include/dict.h
+data_redirect.o: ../../include/dict_cdb.h
+data_redirect.o: ../../include/dict_db.h
+data_redirect.o: ../../include/dict_dbm.h
+data_redirect.o: ../../include/msg.h
+data_redirect.o: ../../include/name_code.h
+data_redirect.o: ../../include/split_at.h
+data_redirect.o: ../../include/stringops.h
+data_redirect.o: ../../include/sys_defs.h
+data_redirect.o: ../../include/vbuf.h
+data_redirect.o: ../../include/vstream.h
+data_redirect.o: ../../include/vstring.h
+data_redirect.o: data_redirect.c
+data_redirect.o: data_redirect.h
+data_redirect.o: dict_proxy.h
+data_redirect.o: mail_params.h
 db_common.o: ../../include/argv.h
 db_common.o: ../../include/dict.h
 db_common.o: ../../include/match_list.h
diff --git a/postfix/src/global/data_redirect.c b/postfix/src/global/data_redirect.c
new file mode 100644 (file)
index 0000000..9569707
--- /dev/null
@@ -0,0 +1,244 @@
+/*++
+/* NAME
+/*     data_redirect 3
+/* SUMMARY
+/*     redirect legacy writes to Postfix-owned data directory
+/* SYNOPSIS
+/*     #include <data_redirect.h>
+/*
+/*     char    *data_redirect_file(result, path)
+/*     VSTRING *result;
+/*     const char *path;
+/*
+/*     char    *data_redirect_map(result, map)
+/*     VSTRING *result;
+/*     const char *map;
+/* DESCRIPTION
+/*     With Postfix version 2.5 and later, the tlsmgr(8) and
+/*     verify(8) servers no longer open cache files with root
+/*     privilege. This avoids a potential security loophole where
+/*     the ownership of a file (or directory) does not match the
+/*     trust level of the content of that file (or directory).
+/*
+/*     This module implements a migration aid that allows a
+/*     transition without disruption of service.
+/*
+/*     data_redirect_file() detects a request to open a file in a
+/*     non-Postfix directory, logs a warning, and redirects the
+/*     request to the Postfix-owned data_directory.
+/*
+/*     data_redirect_map() performs the same function for a limited
+/*     subset of file-based lookup tables.
+/*
+/*     Arguments:
+/* .IP result
+/*     A possibly redirected copy of the input.
+/* .IP path
+/*     The pathname that may be redirected.
+/* .IP map
+/*     The "mapname" or "maptype:mapname" that may be redirected.
+/*     The result is always in "maptype:mapname" form.
+/* BUGS
+/*     Only a few map types are redirected. This is acceptable for
+/*     a temporary migration tool.
+/* DIAGNOSTICS
+/*     Fatal errors: memory allocation failure.
+/* CONFIGURATION PARAMETERS
+/*     data_directory, location of Postfix-writable files
+/* 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 <sys_defs.h>
+#include <sys/stat.h>
+#include <string.h>
+
+/* Utility library. */
+
+#include <msg.h>
+#include <vstring.h>
+#include <stringops.h>
+#include <split_at.h>
+#include <name_code.h>
+#include <dict_db.h>
+#include <dict_dbm.h>
+#include <dict_cdb.h>
+
+/* Global directory. */
+
+#include <mail_params.h>
+#include <dict_proxy.h>
+#include <data_redirect.h>
+
+/* Application-specific. */
+
+#define STR(x) vstring_str(x)
+#define LEN(x) VSTRING_LEN(x)
+
+ /*
+  * Redirect only these map types, so that we don't try stupid things with
+  * NIS, *SQL or LDAP. This is a transition feature for legacy TLS and verify
+  * configurations, so it does not have to cover every possible map type.
+  * 
+  * XXX In this same spirit of imperfection we also use hard-coded map names,
+  * because maintainers may add map types that the official release doesn't
+  * even know about, because map types may be added dynamically on some
+  * platforms.
+  */
+static NAME_CODE data_redirect_map_types[] = {
+    DICT_TYPE_HASH, 1,
+    DICT_TYPE_BTREE, 1,
+    DICT_TYPE_DBM, 1,
+    DICT_TYPE_CDB, 1,                  /* not a read-write map type */
+    "sdbm", 1,                         /* legacy 3rd-party TLS */
+    "dbz", 1,                          /* just in case */
+    0, 0,
+};
+
+/* data_redirect_path - redirect path to Postfix-owned directory */
+
+static char *data_redirect_path(VSTRING *result, const char *path,
+                                const char *log_type, const char *log_name)
+{
+    struct stat st;
+
+#define PATH_DELIMITER "/"
+
+    (void) sane_dirname(result, path);
+    if (stat(STR(result), &st) != 0 || st.st_uid == var_owner_uid) {
+       vstring_strcpy(result, path);
+    } else {
+       msg_warn("request to update %s %s in non-%s directory %s",
+                log_type, log_name, var_mail_owner, STR(result));
+       msg_warn("redirecting the request to %s-owned %s %s",
+                var_mail_owner, VAR_DATA_DIR, var_data_dir);
+       (void) sane_basename(result, path);
+       vstring_prepend(result, PATH_DELIMITER, sizeof(PATH_DELIMITER) - 1);
+       vstring_prepend(result, var_data_dir, strlen(var_data_dir));
+    }
+    return (STR(result));
+}
+
+/* data_redirect_file - redirect file to Postfix-owned directory */
+
+char   *data_redirect_file(VSTRING *result, const char *path)
+{
+
+    /*
+     * Sanity check.
+     */
+    if (path == STR(result))
+       msg_panic("data_redirect_file: result clobbers input");
+
+    return (data_redirect_path(result, path, "file", path));
+}
+
+char   *data_redirect_map(VSTRING *result, const char *map)
+{
+    const char *path;
+    const char *map_type;
+    size_t  map_type_len;
+
+#define MAP_DELIMITER ":"
+
+    /*
+     * Sanity check.
+     */
+    if (map == STR(result))
+       msg_panic("data_redirect_map: result clobbers input");
+
+    /*
+     * Parse the input into map type and map name.
+     */
+    path = strchr(map, MAP_DELIMITER[0]);
+    if (path != 0) {
+       map_type = map;
+       map_type_len = path - map;
+       path += 1;
+    } else {
+       map_type = var_db_type;
+       map_type_len = strlen(map_type);
+       path = map;
+    }
+
+    /*
+     * Redirect the pathname.
+     */
+    vstring_strncpy(result, map_type, map_type_len);
+    if (name_code(data_redirect_map_types, NAME_CODE_FLAG_NONE, STR(result))) {
+       data_redirect_path(result, path, "table", map);
+    } else {
+       vstring_strcpy(result, path);
+    }
+
+    /*
+     * (Re)combine the map type with the map name.
+     */
+    vstring_prepend(result, MAP_DELIMITER, sizeof(MAP_DELIMITER) - 1);
+    vstring_prepend(result, map_type, map_type_len);
+    return (STR(result));
+}
+
+ /*
+  * Proof-of-concept test program. This can't be run as automated regression
+  * test, because the result depends on main.cf information (mail_owner UID
+  * and data_directory pathname) and on local file system details.
+  */
+#ifdef TEST
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <vstring_vstream.h>
+#include <mail_conf.h>
+
+int     main(int argc, char **argv)
+{
+    VSTRING *inbuf = vstring_alloc(100);
+    VSTRING *result = vstring_alloc(100);
+    char   *bufp;
+    char   *cmd;
+    char   *target;
+    char   *junk;
+
+    mail_conf_read();
+
+    while (vstring_get_nonl(inbuf, VSTREAM_IN) != VSTREAM_EOF) {
+       bufp = STR(inbuf);
+       if (!isatty(0)) {
+           vstream_printf("> %s\n", bufp);
+           vstream_fflush(VSTREAM_OUT);
+       }
+       if (*bufp == '#')
+           continue;
+       if ((cmd = mystrtok(&bufp, " \t")) == 0) {
+           vstream_printf("usage: file path|map maptype:mapname\n");
+           vstream_fflush(VSTREAM_OUT);
+           continue;
+       }
+       target = mystrtok(&bufp, " \t");
+       junk = mystrtok(&bufp, " \t");
+       if (strcmp(cmd, "file") == 0 && target && !junk) {
+           data_redirect_file(result, target);
+           vstream_printf("%s -> %s\n", target, STR(result));
+       } else if (strcmp(cmd, "map") == 0 && target && !junk) {
+           data_redirect_map(result, target);
+           vstream_printf("%s -> %s\n", target, STR(result));
+       } else {
+           vstream_printf("usage: file path|map maptype:mapname\n");
+       }
+       vstream_fflush(VSTREAM_OUT);
+    }
+    vstring_free(inbuf);
+    return (0);
+}
+
+#endif
diff --git a/postfix/src/global/data_redirect.h b/postfix/src/global/data_redirect.h
new file mode 100644 (file)
index 0000000..28b431e
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _DATA_REDIRECT_H_INCLUDED_
+#define _DATA_REDIRECT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     data_redirect 3h
+/* SUMMARY
+/*     redirect writes from legacy pathname to Postfix-owned data directory
+/* SYNOPSIS
+/*     #include "data_redirect.h"
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+char   *data_redirect_file(VSTRING *, const char *);
+char   *data_redirect_map(VSTRING *, const char *);
+
+/* 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
+/*--*/
+
+#endif
index aac05a6baf2183af6eca2fe9e3f989d9a4d7b0f6..5cfaa1307fa0ee5763eae9a38673811262f96823 100644 (file)
@@ -608,7 +608,7 @@ extern bool var_stat_home_dir;
 extern int var_dup_filter_limit;
 
 #define VAR_TLS_RAND_EXCH_NAME "tls_random_exchange_name"
-#define DEF_TLS_RAND_EXCH_NAME "${config_directory}/prng_exch"
+#define DEF_TLS_RAND_EXCH_NAME "${data_directory}/prng_exch"
 extern char *var_tls_rand_exch_name;
 
 #define VAR_TLS_RAND_SOURCE    "tls_random_source"
index 3e91849b71bc9c8f8d5a9cef32d9e7d7f4a00e21..1d85f75986331eacbe229ef64a7efe618a049262 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "2007111205"
+#define MAIL_RELEASE_DATE      "20071206"
 #define MAIL_VERSION_NUMBER    "2.5"
 
 #ifdef SNAPSHOT
index 2a3c392af76284ed5da38a0f6eac1ce6979c788f..481510a8da7179b46a63387e8995f1078efa72ec 100644 (file)
 /*     setting to be used by sensitive and non-sensitive processes.
 /*
 /*     Postfix-writable data files should be stored under a dedicated
-/*     directory that is writable only by the $\fBmail_owner\fR
-/*     account, such as the $\fBdata_directory\fR directory.
+/*     directory that is writable only by the Postfix mail system,
+/*     such as the Postfix-owned \fBdata_directory\fR.
 /*
 /*     In particular, Postfix-writable files should never exist
 /*     in root-owned directories. That would open up a particular
-/*     type of security hole where ownership (root) does not match
-/*     content provenance (Postfix).
+/*     type of security hole where ownership of a file or directory
+/*     does not match the provider of its content.
 /* DIAGNOSTICS
 /*     Problems and transactions are logged to \fBsyslogd\fR(8).
 /* BUGS
 /*     The directory with Postfix-writable data files (for example:
 /*     caches, pseudo-random numbers).
 /* .IP "\fBproxy_write_maps (see 'postconf -d' output)\fR"
-/*     The lookup tables that the \fBproxymap\fR(8) server is allowed to access
-/*     for the read-write service.
+/*     The lookup tables that the \fBproxymap\fR(8) server is allowed to
+/*     access for the read-write service.
 /* SEE ALSO
 /*     postconf(5), configuration parameters
 /*     master(5), generic daemon options
index a2520842757948877b7da825d03c497810126a73..597f6e650b10c3404b444e6e15005e9eb6e174b1 100644 (file)
@@ -61,6 +61,7 @@ depend: $(MAKES)
 # do not edit below this line - it is generated by 'make depend'
 tlsmgr.o: ../../include/argv.h
 tlsmgr.o: ../../include/attr.h
+tlsmgr.o: ../../include/data_redirect.h
 tlsmgr.o: ../../include/dict.h
 tlsmgr.o: ../../include/events.h
 tlsmgr.o: ../../include/iostuff.h
@@ -74,6 +75,7 @@ tlsmgr.o: ../../include/msg.h
 tlsmgr.o: ../../include/mymalloc.h
 tlsmgr.o: ../../include/name_code.h
 tlsmgr.o: ../../include/name_mask.h
+tlsmgr.o: ../../include/set_eugid.h
 tlsmgr.o: ../../include/stringops.h
 tlsmgr.o: ../../include/sys_defs.h
 tlsmgr.o: ../../include/tls.h
index 242c10d963811d2302149a082f9c39da87374f0e..2fe71b36a713e40a03b652a3111f2ecc790e5191 100644 (file)
 /*     At process startup it connects to the entropy source and
 /*     exchange file, and creates or truncates the optional TLS
 /*     session cache files.
+/*
+/*     With Postfix version 2.5 and later, the \fBtlsmgr\fR(8) no
+/*     longer uses root privileges when opening cache files. These
+/*     files should now be stored under the Postfix-owned
+/*     \fBdata_directory\fR.  As a migration aid, an attempt to
+/*     open a cache file under a non-Postfix directory is redirected
+/*     to the Postfix-owned \fBdata_directory\fR, and a warning
+/*     is logged.
 /* DIAGNOSTICS
 /*     Problems and transactions are logged to the syslog daemon.
 /* BUGS
 /*     The number of bytes that \fBtlsmgr\fR(8) reads from $tls_random_source
 /*     when (re)seeding the in-memory pseudo random number generator (PRNG)
 /*     pool.
-/* .IP "\fBtls_random_exchange_name (${config_directory}/prng_exch)\fR"
+/* .IP "\fBtls_random_exchange_name (see 'postconf -d' output)\fR"
 /*     Name of the pseudo random number generator (PRNG) state file
 /*     that is maintained by \fBtlsmgr\fR(8).
 /* .IP "\fBtls_random_prng_update_period (3600s)\fR"
 #include <vstring.h>
 #include <vstring_vstream.h>
 #include <attr.h>
+#include <set_eugid.h>
 
 /* Global library. */
 
 #include <mail_version.h>
 #include <tls_mgr.h>
 #include <mail_proto.h>
+#include <data_redirect.h>
 
 /* Master process interface. */
 
@@ -737,6 +747,7 @@ static void tlsmgr_pre_init(char *unused_name, char **unused_argv)
     char   *path;
     struct timeval tv;
     TLSMGR_SCACHE *ent;
+    VSTRING *redirect;
 
     /*
      * If nothing else works then at least this will get us a few bits of
@@ -796,28 +807,48 @@ static void tlsmgr_pre_init(char *unused_name, char **unused_argv)
     }
 
     /*
-     * Open the PRNG exchange file while privileged. Start the exchange file
-     * read/update pseudo thread after dropping privileges.
+     * 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/directory)
+     * ownership and (file/directory) content.
+     */
+    SAVE_AND_SET_EUGID(var_owner_uid, var_owner_gid);
+    redirect = vstring_alloc(100);
+
+    /*
+     * Open the PRNG exchange file before going to jail, but don't use root
+     * privileges. Start the exchange file read/update pseudo thread after
+     * dropping privileges.
      */
     if (*var_tls_rand_exch_name) {
-       rand_exch = tls_prng_exch_open(var_tls_rand_exch_name);
+       rand_exch =
+           tls_prng_exch_open(data_redirect_file(redirect,
+                                                 var_tls_rand_exch_name));
        if (rand_exch == 0)
            msg_fatal("cannot open PRNG exchange file %s: %m",
                      var_tls_rand_exch_name);
     }
 
     /*
-     * Open the session cache files and discard old information while
-     * privileged. Start the cache maintenance pseudo threads after dropping
-     * privileges.
+     * Open the session cache files and discard old information before going
+     * to jail, but don't use root privilege. Start the cache maintenance
+     * pseudo threads after dropping privileges.
      * 
      * XXX Need sanity check that the databases have different names.
      */
     for (ent = cache_table; ent->cache_label; ++ent)
        if (**ent->cache_db)
            ent->cache_info =
-               tls_scache_open(*ent->cache_db, ent->cache_label,
-                           *ent->cache_loglevel >= 2, *ent->cache_timeout);
+               tls_scache_open(data_redirect_map(redirect, *ent->cache_db),
+                               ent->cache_label,
+                               *ent->cache_loglevel >= 2,
+                               *ent->cache_timeout);
+
+    /*
+     * Clean up and restore privilege.
+     */
+    vstring_free(redirect);
+    RESTORE_SAVED_EUGID();
 }
 
 /* tlsmgr_post_init - post-jail initialization */
index f71b6b4e7431f7088f4f1eb99e0ecb5a6020a9f0..ef35380b503bf810703e8ffe51d4112d24a2603f 100644 (file)
@@ -9,10 +9,19 @@
 /*     void    set_eugid(euid, egid)
 /*     uid_t   euid;
 /*     gid_t   egid;
+/*
+/*     void    SAVE_AND_SET_EUGID(uid, gid)
+/*     uid_t   uid;
+/*     gid_t gid;
+/*
+/*     void    RESTORE_SAVED_EUGID()
 /* DESCRIPTION
 /*     set_eugid() sets the effective user and group process attributes
 /*     and updates the process group access list to be just the specified
 /*     effective group id.
+/*
+/*     SAVE_AND_SET_EUGID() opens a block that executes with the
+/*     specified privilege. RESTORE_SAVED_EUGID() closes the block. 
 /* DIAGNOSTICS
 /*     All system call errors are fatal.
 /* SEE ALSO
index e461cbfed5f934c7039a4af8b2f0329d4d6b6419..97a523e8c84c4fe2e2933bbbddbd8be81b0865c6 100644 (file)
 
 extern void set_eugid(uid_t, gid_t);
 
+ /*
+  * The following macros open and close a block that runs at a different
+  * privilege level. To make mistakes with stray curly braces less likely, we
+  * shape the macros below as the head and tail of a do-while loop.
+  */
+#define SAVE_AND_SET_EUGID(uid, gid) do { \
+       uid_t __set_eugid_uid = geteuid(); \
+       gid_t __set_eugid_gid = getegid(); \
+       set_eugid((uid), (gid));
+
+#define RESTORE_SAVED_EUGID() \
+       set_eugid(__set_eugid_uid, __set_eugid_gid); \
+    } while (0)
+
 /* LICENSE
 /* .ad
 /* .fi
index 0bb5c159d0a55828023e5c722c53a79ac592e7e2..e5fa293c78c1f583463311ffdf7ea64f54db5336 100644 (file)
@@ -60,6 +60,7 @@ depend: $(MAKES)
 verify.o: ../../include/argv.h
 verify.o: ../../include/attr.h
 verify.o: ../../include/cleanup_user.h
+verify.o: ../../include/data_redirect.h
 verify.o: ../../include/deliver_request.h
 verify.o: ../../include/dict.h
 verify.o: ../../include/dict_ht.h
@@ -77,6 +78,7 @@ verify.o: ../../include/msg_stats.h
 verify.o: ../../include/mymalloc.h
 verify.o: ../../include/post_mail.h
 verify.o: ../../include/recipient_list.h
+verify.o: ../../include/set_eugid.h
 verify.o: ../../include/split_at.h
 verify.o: ../../include/stringops.h
 verify.o: ../../include/sys_defs.h
index 13db73fd883c4a80e4645b06d79f2b012edadd8d..ac7acd00b091ff55ea51eb5d0ed4175d67723764 100644 (file)
 /*     unlimited amounts of garbage. Limiting the cache size
 /*     trades one problem (disk space exhaustion) for another
 /*     one (poor response time to client requests).
+/*
+/*     With Postfix version 2.5 and later, the \fBverify\fR(8)
+/*     server no longer uses root privileges when opening the
+/*     \fBaddress_verify_map\fR cache file. The file should now
+/*     be stored under the Postfix-owned \fBdata_directory\fR.  As
+/*     a migration aid, an attempt to open a cache file under a
+/*     non-Postfix directory is redirected to the Postfix-owned
+/*     \fBdata_directory\fR, and a warning is logged.
 /* DIAGNOSTICS
 /*     Problems and transactions are logged to \fBsyslogd\fR(8).
 /* BUGS
@@ -72,8 +80,9 @@
 /* .IP "\fBaddress_verify_map (empty)\fR"
 /*     Optional lookup table for persistent address verification status
 /*     storage.
-/* .IP "\fBaddress_verify_sender (postmaster)\fR"
-/*     The sender address to use in address verification probes.
+/* .IP "\fBaddress_verify_sender ($double_bounce_sender)\fR"
+/*     The sender address to use in address verification probes; prior
+/*     to Postfix 2.5 the default was "postmaster".
 /* .IP "\fBaddress_verify_positive_expire_time (31d)\fR"
 /*     The time after which a successful probe expires from the address
 /*     verification cache.
 #include <dict.h>
 #include <split_at.h>
 #include <stringops.h>
+#include <set_eugid.h>
 
 /* Global library. */
 
 #include <mail_version.h>
 #include <mail_proto.h>
 #include <post_mail.h>
+#include <data_redirect.h>
 #include <verify_clnt.h>
 
 /* Server skeleton. */
@@ -540,6 +551,37 @@ static void post_jail_init(char *unused_name, char **unused_argv)
 static void pre_jail_init(char *unused_name, char **unused_argv)
 {
     mode_t  saved_mask;
+    VSTRING *redirect;
+
+    /*
+     * Never, ever, get killed by a master signal, as that would corrupt the
+     * database when we're in the middle of an update.
+     */
+    setsid();
+
+    /*
+     * 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/directory)
+     * ownership and (file/directory) content.
+     * 
+     * XXX Non-root open can violate the principle of least surprise: Postfix
+     * can't open an *SQL config file for database read-write access, even
+     * though it can open that same control file for database read-only
+     * access.
+     * 
+     * The solution is to query a map type and obtain its properties before
+     * opening it. A clean solution is to add a dict_info() API that is
+     * simlar to dict_open() except it returns properties (dict flags) only.
+     * A pragmatic solution is to overload the existing API and have
+     * dict_open() return a dummy map when given a null map name.
+     * 
+     * However, the proxymap daemon has been opening *SQL maps as non-root for
+     * years now without anyone complaining, let's not solve a problem that
+     * doesn't exist.
+     */
+    SAVE_AND_SET_EUGID(var_owner_uid, var_owner_gid);
+    redirect = vstring_alloc(100);
 
     /*
      * Keep state in persistent (external) or volatile (internal) map.
@@ -548,7 +590,7 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
 
     if (*var_verify_map) {
        saved_mask = umask(022);
-       verify_map = dict_open(var_verify_map,
+       verify_map = dict_open(data_redirect_map(redirect, var_verify_map),
                               O_CREAT | O_RDWR,
                               VERIFY_DICT_OPEN_FLAGS);
        (void) umask(saved_mask);
@@ -557,10 +599,10 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
     }
 
     /*
-     * Never, ever, get killed by a master signal, as that would corrupt the
-     * database when we're in the middle of an update.
+     * Clean up and restore privilege.
      */
-    setsid();
+    vstring_free(redirect);
+    RESTORE_SAVED_EUGID();
 }
 
 MAIL_VERSION_STAMP_DECLARE;