This is the first patch to Postfix 19991231. It fixes no bugs but rather adds a safety net for a common configuration problem. A common error is to list Postfix virtual domains in the mydestination parameter. This causes the new optional local_recipient_maps feature to reject mail for virtual users. Postfix now explicitly tests for this condition and logs a warning instead of refusing the mail. The patch is too large for email. It adds only a few lines of code. The bulk of the patch is spent on clarification in the documentation and in the sample configuration files, plus some feedback on the documentation that I received over the last couple days. The patch, postfix-19991231-patch01.gz, and a complete source kit, postfix-19991231-pl01.tar.gz, will be made available from the primary site: ftp://ftp.porcupine.org/mirrors/postfix-release/official/ http://ftp.porcupine.org/mirrors/postfix-release/index.html including a PGP signature (postfix-19991231-pl01.tar.gz.sig). Wietse Prereq: "Postfix-19991231" diff -cr /tmp/postfix-19991231/global/mail_version.h ./global/mail_version.h *** /tmp/postfix-19991231/global/mail_version.h Fri Dec 31 16:18:04 1999 --- ./global/mail_version.h Sun Jan 2 12:38:15 2000 *************** *** 15,21 **** * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" ! #define DEF_MAIL_VERSION "Postfix-19991231" extern char *var_mail_version; /* LICENSE --- 15,21 ---- * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" ! #define DEF_MAIL_VERSION "Postfix-19991231-pl01" extern char *var_mail_version; /* LICENSE diff -cr /tmp/postfix-19991231/HISTORY ./HISTORY *** /tmp/postfix-19991231/HISTORY Fri Dec 31 14:41:07 1999 --- ./HISTORY Sun Jan 2 17:11:48 2000 *************** *** 3515,3517 **** --- 3515,3529 ---- to enable LMTP delivery over UNIX-domain sockets. The goal is to simplify the experimental LMTP delivery agent by ripping out the privileged code that forks the LMTP server. + + 20000102 + + Clarified documentation after early feedback on the 19991231 + release by Drew Derbyshire, Ollivier Robert, Khetan Gajjar. + + Sanity check: a common error is to list Postfix virtual + domains in the mydestination parameter. This causes the + new optional local_recipient_maps feature to reject mail + for virtual users. The SMTP server now explicitly tests + for this common error and logs a warning instead of refusing + the mail. File: smtpd/smtpd_check.c. diff -cr /tmp/postfix-19991231/RELEASE_NOTES ./RELEASE_NOTES *** /tmp/postfix-19991231/RELEASE_NOTES Fri Dec 31 18:06:52 1999 --- ./RELEASE_NOTES Sun Jan 2 12:41:54 2000 *************** *** 76,85 **** - The SMTP server now rejects mail for unknown users in virtual domains that are defined by Postfix virtual maps. ! - The SMTP server optionally rejects mail for unknown local users. ! Use "local_recipient_maps = $alias_maps, unix:passwd.byname" if ! your local mail is delivered by a UNIX-style local delivery agent. ! See example in conf/main.cf. - Use "disable_vrfy_command = yes" to disable the SMTP VRFY command. This prevents some forms of address harvesting. --- 76,85 ---- - The SMTP server now rejects mail for unknown users in virtual domains that are defined by Postfix virtual maps. ! - The SMTP server can reject mail for unknown local users. Specify ! "local_recipient_maps = $relocated_maps, $alias_maps, unix:passwd.byname" ! if your local mail is delivered by a UNIX-style local delivery ! agent. See example in conf/main.cf. - Use "disable_vrfy_command = yes" to disable the SMTP VRFY command. This prevents some forms of address harvesting. diff -cr /tmp/postfix-19991231/conf/main.cf ./conf/main.cf *** /tmp/postfix-19991231/conf/main.cf Mon Dec 27 16:03:38 1999 --- ./conf/main.cf Sun Jan 2 14:19:11 2000 *************** *** 125,131 **** # Beware: if the Postfix SMTP server runs chrooted, you may have to # copy the passwd database into the jail. This is system dependent. # ! #local_recipient_maps = $alias_maps unix:passwd.byname # ADDRESS REWRITING # --- 125,134 ---- # Beware: if the Postfix SMTP server runs chrooted, you may have to # copy the passwd database into the jail. This is system dependent. # ! # FOR THIS TO WORK, DO NOT SPECIFY VIRTUAL DOMAINS IN MYDESTINATION. ! # MYDESTINATION MUST LIST NON-VIRTUAL DOMAINS ONLY. ! # ! #local_recipient_maps = $relocated_maps $alias_maps unix:passwd.byname # ADDRESS REWRITING # diff -cr /tmp/postfix-19991231/html/faq.html ./html/faq.html *** /tmp/postfix-19991231/html/faq.html Fri Dec 31 17:27:19 1999 --- ./html/faq.html Sun Jan 2 17:24:04 2000 *************** *** 97,104 ****
  • Relaying mail for mobile users !
  • Postfix refuses to receive mail for some ! virtual domains
  • Restricting what users can send mail to off-site destinations --- 97,104 ----
  • Relaying mail for mobile users !
  • Postfix refuses mail for virtual ! domains with "relay access denied"
  • Restricting what users can send mail to off-site destinations *************** *** 155,166 **** --- 155,178 ---- *************** *** 1123,1129 ****

    Postfix accepts mail for non-existing local users

    The information in this section applies to Postfix versions 19991216 ! and later. See elsewhere for
    unknown virtual users.

    --- 1135,1141 ----

    Postfix accepts mail for non-existing local users

    The information in this section applies to Postfix versions 19991216 ! and later. See elsewhere for unknown virtual users.

    *************** *** 1145,1151 ****

          /etc/postfix/main.cf:
    ! 	local_recipient_maps = $alias_maps, unix:passwd.byname
      

    --- 1157,1163 ----

          /etc/postfix/main.cf:
    ! 	local_recipient_maps = $relocated_maps $alias_maps, unix:passwd.byname
      

    *************** *** 1527,1532 **** --- 1539,1603 ----


    +

    How to configure a Postfix virtual domain

    + + Problem: + +

    + +

    + +

    + + Solution: + +

    + +

    + +

    + + For more information on how to set up virtual domains, see the virtual manual page. + +


    +

    Commands don't work in Postfix virtual maps

    Delivering mail to a command is a security-sensitive operation, *************** *** 1593,1659 ****
    !

    Rejecting mail for unknown virtual users

    ! Problem: mail for an unknown virtual user is misdelivered to a local ! user with the same name.

    ! Problem: mail for an unknown virtual user results in an ugly "mail ! loops back to myself" error from Postfix.

    ! Solution: add a magical entry to the Postfix virtual database:

    !

    !     /etc/postfix/virtual:
    !         virtual.domain whatever
    ! 

    ! This entry will also fix the problem that the Postfix SMTP server ! refuses to receive mail for the virtual ! domain. ! !

    ! ! For more information on how to set up virtual domains, see the virtual manual page. ! !


    ! !

    Postfix refuses to receive mail for some ! virtual domains

    ! In order to receive mail for virtual domains, the Postfix SMTP server ! needs to know that the domain is OK.

    -

    - - For more details, see the virtual - manual page. -


    Address masquerading with exceptions

    --- 1664,1732 ----
    !

    Receiving a virtual domain in a mailbox

    ! Question: how to receive all mail for a domain in a mailbox without ! losing the original recipient information? The Postfix Delivered-To: ! mail header shows only the mailbox owner, not the virtual address ! that the mail was sent to.

    ! Answer: I hope we all agree that delivering a domain to a mailbox ! is disgusting practice. Forwarding mail via SMTP or UUCP would be ! a much better choice. Unfortunately, neither SMTP nor UUCP are a ! usable alternative for legions of windows users.

    ! That said, it is possible to propagate the original virtual recipient ! information to the Delivered-To: header. The trick is to use a ! virtual map that uses regular expressions instead of the more ! traditional indexed files.

    ! The following delivers username@virtual.domain with a ! Delivered-To: message header that contains joe+username@your.domain. ! Postfix already puts the envelope sender address in the Return-Path: ! header. The information in the Delivered-To: and Return-Path: ! headers is sufficient to reliably implement a domain in a mailbox.

    !

    !     /etc/postfix/main.cf
    ! 	recipient_delimiter = +
    ! 	virtual_maps = 
    ! 	    ...non-regexp virtual maps...
    ! 	    regexp:/etc/postfix/virtual_regexp
      
    !     /etc/postfix/virtual_regexp
    ! 	/^virtual\.domain$/		whatever
    ! 	/^(.*\)@virtual\.domain$/	joe+$1
    ! 

    + Notes: +


    Address masquerading with exceptions

    *************** *** 1768,1774 **** This example specifies a command that delivers all local mail to mailbox. See the sample main.cf file for examples. In ! /etc/aliases, you must specify an alias for root that directs mail to a real person, otherwise mail sent to root will not work as expected. --- 1841,1847 ---- This example specifies a command that delivers all local mail to mailbox. See the sample main.cf file for examples. In ! /etc/aliases, you must specify an alias for root that directs mail to a real person, otherwise mail sent to root will not work as expected. *************** *** 1801,1807 ****
  • You need an rmail program that extracts the sender address from mail that arrives via UUCP, and that feeds the mail ! into the Postfix sendmail command. Most UNIX systems come with an rmail utility. If you're in a pinch, try the one bundled with the Postfix source code in the auxiliary directory. Some day Postfix may have its own rmail command. --- 1874,1880 ----
  • You need an rmail program that extracts the sender address from mail that arrives via UUCP, and that feeds the mail ! into the Postfix sendmail command. Most UNIX systems come with an rmail utility. If you're in a pinch, try the one bundled with the Postfix source code in the auxiliary directory. Some day Postfix may have its own rmail command. diff -cr /tmp/postfix-19991231/smtpd/smtpd_check.c ./smtpd/smtpd_check.c *** /tmp/postfix-19991231/smtpd/smtpd_check.c Wed Dec 29 21:30:30 1999 --- ./smtpd/smtpd_check.c Sun Jan 2 16:52:43 2000 *************** *** 1949,1954 **** --- 1949,1966 ---- #define NOP ((char **) 0) if (resolve_local(domain)) { + if (*var_virtual_maps + && maps_find(virtual_maps, domain, 0)) { + msg_warn("virtual domain \"%s\" is listed in $mydestination", + domain); + msg_warn("the $local_recipient_maps feature requires that no"); + msg_warn("virtual domains are listed in $mydestination"); + msg_warn("be sure to specify the required \"%s whatever\"", + domain); + msg_warn("entry in the virtual map, as explained in the man"); + msg_warn("page and in the FAQ entry for virtual domains"); + SMTPD_CHECK_RCPT_RETURN(0); + } if (*var_local_rcpt_maps && !mail_addr_find(rcpt_canon_maps, STR(reply.recipient), NOP) && !mail_addr_find(canonical_maps, STR(reply.recipient), NOP)