From 3414d539d23eaf9976edbe2c042c9b70e973a665 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Mon, 7 Feb 2005 00:00:00 -0500 Subject: [PATCH] postfix-2.2-20050207 --- postfix/HISTORY | 23 +- postfix/README_FILES/ADDRESS_REWRITING_README | 24 +- .../STANDARD_CONFIGURATION_README | 79 ++++-- postfix/conf/aliases | 4 +- postfix/conf/canonical | 26 +- postfix/conf/generics | 224 ++++++++++++++++ postfix/conf/postfix-files | 3 + postfix/conf/relocated | 5 +- postfix/conf/transport | 22 +- postfix/conf/virtual | 21 +- postfix/html/ADDRESS_REWRITING_README.html | 27 +- postfix/html/Makefile.in | 6 +- .../html/STANDARD_CONFIGURATION_README.html | 96 +++++-- postfix/html/aliases.5.html | 4 +- postfix/html/canonical.5.html | 26 +- postfix/html/cidr_table.5.html | 2 +- postfix/html/generics.5.html | 229 ++++++++++++++++ postfix/html/postconf.5.html | 31 +-- postfix/html/postfix-manuals.html | 12 +- postfix/html/postfix.1.html | 8 +- postfix/html/relocated.5.html | 5 +- postfix/html/transport.5.html | 22 +- postfix/html/virtual.5.html | 21 +- postfix/man/Makefile.in | 6 +- postfix/man/man1/postfix.1 | 8 +- postfix/man/man5/aliases.5 | 3 +- postfix/man/man5/canonical.5 | 19 +- postfix/man/man5/cidr_table.5 | 2 +- postfix/man/man5/generics.5 | 244 ++++++++++++++++++ postfix/man/man5/postconf.5 | 17 +- postfix/man/man5/relocated.5 | 8 +- postfix/man/man5/transport.5 | 10 +- postfix/man/man5/virtual.5 | 14 +- postfix/mantools/manlint.stop | 8 + postfix/mantools/postlink | 2 +- postfix/proto/ADDRESS_REWRITING_README.html | 27 +- postfix/proto/Makefile.in | 6 +- .../proto/STANDARD_CONFIGURATION_README.html | 96 +++++-- postfix/proto/aliases | 3 +- postfix/proto/canonical | 17 +- postfix/proto/cidr_table | 2 +- postfix/proto/generics | 213 +++++++++++++++ postfix/proto/postconf.proto | 31 +-- postfix/proto/relocated | 6 +- postfix/proto/transport | 10 +- postfix/proto/virtual | 12 +- postfix/src/cleanup/cleanup_message.c | 20 +- postfix/src/global/mail_version.h | 2 +- postfix/src/postfix/postfix.c | 8 +- 49 files changed, 1408 insertions(+), 306 deletions(-) create mode 100644 postfix/conf/generics create mode 100644 postfix/html/generics.5.html create mode 100644 postfix/man/man5/generics.5 create mode 100644 postfix/proto/generics diff --git a/postfix/HISTORY b/postfix/HISTORY index 9dc7db36c..f710bce07 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -10286,19 +10286,28 @@ Apologies for any names omitted. Cleanup: don't panic in mymalloc() when master can't find any IP addresses. LaMont Jones. File: master/master_ent.c. +20050207 + + Documentation: added a generics(5) manual page for consistency + with the already existing table driven mechanisms, added + references to or examples of the new generic mapping. + + Bugfix: the header_checks REPLACE action mis-handled + multi-line replacement text in message headers, for example: + /(.*)/ REPLACE X-$1. File: cleanup/cleanup_message.c. + + Bugfix: the header_checks REPLACE action should not drop + the input when the action is NOT executed. File: + cleanup/cleanup_message.c. + Open problems: - Med: document generics mapping in BASIC_CONFIGURATION_README. - - Med: local and remote source port and IP address for - smtpd policy hook. + Med: local and remote source port and IP address for smtpd + policy hook. Med: smtp_connect_timeout_budget (default: 2x smtp_connect_timeout) to limit the total time spent trying to connect. - Low: pointers to postfinger and saslfinger. postfinger - is now bundled. - Med: transform IPv4-in-IPv6 address literals to IPv4 form when comparing against local IP addresses? diff --git a/postfix/README_FILES/ADDRESS_REWRITING_README b/postfix/README_FILES/ADDRESS_REWRITING_README index 183eb8896..d3f3e0f45 100644 --- a/postfix/README_FILES/ADDRESS_REWRITING_README +++ b/postfix/README_FILES/ADDRESS_REWRITING_README @@ -607,11 +607,11 @@ localdomain.local. This can be a problem when you want to send mail over the Internet, because many mail servers reject mail addresses with invalid domain names. -With the smtp_generics_maps parameter you can specify lookup tables that -replace local mail addresses by valid Internet addresses when mail leaves the -machine via SMTP. This mapping replaces envelope and header addresses, and is -non-recursive. It does not happen when you send mail between addresses on the -local machine. +With the smtp_generics_maps parameter you can specify generics(5) lookup tables +that replace local mail addresses by valid Internet addresses when mail leaves +the machine via SMTP. The generics(5) mapping replaces envelope and header +addresses, and is non-recursive. It does not happen when you send mail between +addresses on the local machine. This feature is available in Postfix version 2.2 and later. @@ -621,15 +621,15 @@ Example: smtp_generics_maps = hash:/etc/postfix/generics /etc/postfix/generics: - you@localdomain.local youraccount@yourisp.example + his@localdomain.local hisaccount@hisisp.example her@localdomain.local heraccount@herisp.example - @localdomain.local youraccount+local@yourisp.example + @localdomain.local hisaccount+local@hisisp.example -When mail is sent to a remote host via SMTP, this replaces your local mail -address you@localdomain.local by your ISP mail address, replaces -her@localdomain.local by her ISP mail address, and replaces all other local -addresses by your ISP account, with an address extension of +local (this -example assumes that the ISP supports "+" style address extensions). +When mail is sent to a remote host via SMTP, this replaces +his@localdomain.local by his ISP mail address, replaces her@localdomain.local +by her ISP mail address, and replaces other local addresses by his ISP account, +with an address extension of +local (this example assumes that the ISP supports +"+" style address extensions). LLooccaall aalliiaass ddaattaabbaassee diff --git a/postfix/README_FILES/STANDARD_CONFIGURATION_README b/postfix/README_FILES/STANDARD_CONFIGURATION_README index 7c177af93..755b939ad 100644 --- a/postfix/README_FILES/STANDARD_CONFIGURATION_README +++ b/postfix/README_FILES/STANDARD_CONFIGURATION_README @@ -25,7 +25,7 @@ in specific environments. * Running Postfix behind a firewall * Configuring Postfix as MX host for a remote site * Postfix on a dialup machine - * Postfix on hosts without a real hostname + * Postfix on hosts without a real Internet hostname PPoossttffiixx oonn aa ssttaanndd--aalloonnee IInntteerrnneett hhoosstt @@ -49,8 +49,8 @@ document: mynetworks_style = host relay_domains = -See also the section "Postfix on hosts without a real hostname" if this is -applicable to your configuration. +See also the section "Postfix on hosts without a real Internet hostname" if +this is applicable to your configuration. PPoossttffiixx oonn aa nnuullll cclliieenntt @@ -443,8 +443,9 @@ dialup connections that are up 24x7, see the local area network section above. This section presents additional configuration. You need to combine this with basic configuration information as discussed the first half of this document. -If you do not have your own hostname (as with dynamic IP addressing) then you -should also study the section on "Postfix on hosts without a real hostname". +If you do not have your own hostname and IP address (usually with dialup, cable +TV or DSL connections) then you should also study the section on "Postfix on +hosts without a real Internet hostname". * Route all outgoing mail to your network provider. If your machine is disconnected most of the time, there isn't a lot of @@ -501,21 +502,56 @@ should also study the section on "Postfix on hosts without a real hostname". the "sseennddmmaaiill --qq" command every now and then while the dialup link is up, so that newly-posted mail is flushed from the queue. -PPoossttffiixx oonn hhoossttss wwiitthhoouutt aa rreeaall hhoossttnnaammee +PPoossttffiixx oonn hhoossttss wwiitthhoouutt aa rreeaall IInntteerrnneett hhoossttnnaammee -This section is for hosts that don't have an Internet hostname. Typically these -are systems that get a dynamic IP address via DHCP or via dialup. Postfix will -let you send and receive mail just fine between accounts on a machine with a -fantasy name. However, you cannot use a fantasy hostname in your email address -when sending mail into the Internet, because no-one would be able to reply to -your mail. In fact, more and more sites refuse mail from non-existent domain -names. +This section is for hosts that don't have their own Internet hostname. +Typically these are systems that get a dynamic IP address via DHCP or via +dialup. Postfix will let you send and receive mail just fine between accounts +on a machine with a fantasy name. However, you cannot use a fantasy hostname in +your email address when sending mail into the Internet, because no-one would be +able to reply to your mail. In fact, more and more sites refuse mail addresses +with non-existent domain names. -The perfect solution would be for Postfix to do a mapping from local fantasy -email addresses to valid Internet addresses when mail leaves the machine -(similar to Sendmail's generics table). This is planned for the near future. +Note: the following information is Postfix version dependent. To find out what +Postfix version you have, execute the command "ppoossttccoonnff mmaaiill__vveerrssiioonn". -In the mean time, the solution with Postfix is to use valid Internet addresses +PPoossttffiixx vveerrssiioonn 22..22 aanndd llaatteerr + +Postfix 2.2 uses the generics(5) address mapping to replace local fantasy email +addresses by valid Internet addresses. This mapping happens ONLY when mail +leaves the machine; not when you send mail between users on the same machine. + +The following example presents additional configuration. You need to combine +this with basic configuration information as discussed the first half of this +document. + + 1 /etc/postfix/main.cf: + 2 smtp_generics_maps = hash:/etc/postfix/generics + 3 + 4 /etc/postfix/generics: + 5 his@localdomain.local hisaccount@hisisp.example + 6 her@localdomain.local heraccount@herisp.example + 7 @localdomain.local hisaccount+local@hisisp.example + +When mail is sent to a remote host via SMTP: + + * Line 5 replaces his@localdomain.local by his ISP mail address, + + * Line 6 replaces her@localdomain.local by her ISP mail address, and + + * Line 7 replaces other local addresses by his ISP account, with an address + extension of +local (this example assumes that the ISP supports "+" style + address extensions). + +Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb files. +To find out what lookup tables Postfix supports, use the command "ppoossttccoonnff --mm". + +Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ggeenneerriiccss" whenever you change the +generics table. + +PPoossttffiixx vveerrssiioonn 22..11 aanndd eeaarrlliieerr + +The solution with older Postfix systems is to use valid Internet addresses where possible, and to let Postfix map valid Internet addresses to local fantasy addresses. With this, you can send mail to the Internet and to local fantasy addresses, including mail to local fantasy addresses that don't have a @@ -553,3 +589,12 @@ Translation: instead of sending it to the ISP. This part is not required but is convenient. +Specify ddbbmm instead of hhaasshh if your system uses ddbbmm files instead of ddbb files. +To find out what lookup tables Postfix supports, use the command "ppoossttccoonnff --mm". + +Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ccaannoonniiccaall" whenever you change the +canonical table. + +Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//vviirrttuuaall" whenever you change the +virtual table. + diff --git a/postfix/conf/aliases b/postfix/conf/aliases index 935638688..b13f4047c 100644 --- a/postfix/conf/aliases +++ b/postfix/conf/aliases @@ -180,8 +180,8 @@ decode: root # A list of address rewriting or forwarding mecha- # nisms that propagate an address extension from the # original address to the result. Specify zero or -# more of canonical, virtual, alias, forward, or -# include. +# more of canonical, virtual, alias, forward, +# include, or generics. # # owner_request_special # Give special treatment to owner-listname and list- diff --git a/postfix/conf/canonical b/postfix/conf/canonical index e2eacf381..d835107cc 100644 --- a/postfix/conf/canonical +++ b/postfix/conf/canonical @@ -13,8 +13,8 @@ # DESCRIPTION # The optional canonical(5) table specifies an address map- # ping for local and non-local addresses. The mapping is -# used by the cleanup(8) daemon. The address mapping is -# recursive. +# used by the cleanup(8) daemon, before mail is stored into +# the queue. The address mapping is recursive. # # Normally, the canonical(5) table is specified as a text # file that serves as input to the postmap(1) command. The @@ -53,8 +53,7 @@ # aliasing. Use the aliases(5) map for that purpose. # # TABLE FORMAT -# make# The input format for the postmap(1) command is as -# follows: +# The input format for the postmap(1) command is as follows: # # pattern result # When pattern matches a mail address, replace it by @@ -70,13 +69,14 @@ # line that starts with whitespace continues a logi- # cal line. # +# TABLE SEARCH ORDER # With lookups from indexed files such as DB or DBM, or from # networked tables such as NIS, LDAP or SQL, patterns are # tried in the order as listed below: # # user@domain address -# user@domain is replaced by address. This form has -# the highest precedence. +# Replace user@domain by address. This form has the +# highest precedence. # # This is useful to clean up addresses produced by # legacy mail systems. It can also be used to pro- @@ -84,17 +84,17 @@ # below for a simpler solution. # # user address -# user@site is replaced by address when site is equal -# to $myorigin, when site is listed in $mydestina- -# tion, or when it is listed in $inet_interfaces or +# Replace user@site by address when site is equal to +# $myorigin, when site is listed in $mydestination, +# or when it is listed in $inet_interfaces or # $proxy_interfaces. # # This form is useful for replacing login names by # Firstname.Lastname. # # @domain address -# Every address in domain is replaced by address. -# This form has the lowest precedence. +# Replace other addresses in domain by address. This +# form has the lowest precedence. # # In all the above forms, when address has the form @other- # domain, the result is the same user in otherdomain. @@ -170,8 +170,8 @@ # A list of address rewriting or forwarding mecha- # nisms that propagate an address extension from the # original address to the result. Specify zero or -# more of canonical, virtual, alias, forward, or -# include. +# more of canonical, virtual, alias, forward, +# include, or generics. # # Other parameters of interest: # diff --git a/postfix/conf/generics b/postfix/conf/generics new file mode 100644 index 000000000..164226a39 --- /dev/null +++ b/postfix/conf/generics @@ -0,0 +1,224 @@ +# GENERICS(5) GENERICS(5) +# +# NAME +# generics - Postfix generics table format +# +# SYNOPSIS +# postmap /etc/postfix/generics +# +# postmap -q "string" /etc/postfix/generics +# +# postmap -q - /etc/postfix/generics localdomain.local. This can be a problem when you want to send mail over the Internet, because many mail servers reject mail addresses with invalid domain names.

-

With the smtp_generics_maps parameter you can specify lookup -tables that replace local mail addresses by valid Internet addresses -when mail leaves the machine via SMTP. This mapping replaces envelope -and header addresses, and is non-recursive. It does not happen when -you send mail between addresses on the local machine.

+

With the smtp_generics_maps parameter you can specify generics(5) +lookup tables that replace local mail addresses by valid Internet +addresses when mail leaves the machine via SMTP. The generics(5) +mapping replaces envelope and header addresses, and is non-recursive. +It does not happen when you send mail between addresses on the +local machine.

This feature is available in Postfix version 2.2 and later.

@@ -962,18 +963,18 @@ you send mail between addresses on the local machine.

smtp_generics_maps = hash:/etc/postfix/generics /etc/postfix/generics: - you@localdomain.local youraccount@yourisp.example + his@localdomain.local hisaccount@hisisp.example her@localdomain.local heraccount@herisp.example - @localdomain.local youraccount+local@yourisp.example + @localdomain.local hisaccount+local@hisisp.example -

When mail is sent to a remote host via SMTP, this replaces your -local mail address you@localdomain.local by your ISP mail -address, replaces her@localdomain.local by her ISP mail -address, and replaces all other local addresses by your ISP account, -with an address extension of +local (this example assumes -that the ISP supports "+" style address extensions).

+

When mail is sent to a remote host via SMTP, this replaces +his@localdomain.local by his ISP mail address, replaces +her@localdomain.local by her ISP mail address, and replaces +other local addresses by his ISP account, with an address extension +of +local (this example assumes that the ISP supports "+" +style address extensions).

Local alias database

diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in index e573cb5a4..39dd1a732 100644 --- a/postfix/html/Makefile.in +++ b/postfix/html/Makefile.in @@ -18,7 +18,7 @@ CONFIG = access.5.html aliases.5.html canonical.5.html relocated.5.html \ transport.5.html virtual.5.html pcre_table.5.html regexp_table.5.html \ cidr_table.5.html tcp_table.5.html header_checks.5.html \ ldap_table.5.html mysql_table.5.html pgsql_table.5.html \ - master.5.html nisplus_table.5.html + master.5.html nisplus_table.5.html generics.5.html OTHER = postfix-manuals.html AWK = awk '{ print; if (NR == 2) print ".pl 9999\n.ll 65" }' MAN2HTML = man2html -t "Postfix manual - `IFS=.; set \`echo $@\`; echo \"$$1($$2)\"`" @@ -241,6 +241,10 @@ header_checks.5.html: ../proto/header_checks PATH=../mantools:$$PATH; \ srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ +generics.5.html: ../proto/generics + PATH=../mantools:$$PATH; \ + srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ + ldap_table.5.html: ../proto/ldap_table PATH=../mantools:$$PATH; \ srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@ diff --git a/postfix/html/STANDARD_CONFIGURATION_README.html b/postfix/html/STANDARD_CONFIGURATION_README.html index 855747fca..5febf7130 100644 --- a/postfix/html/STANDARD_CONFIGURATION_README.html +++ b/postfix/html/STANDARD_CONFIGURATION_README.html @@ -56,7 +56,7 @@ site
  • Postfix on a dialup machine
  • Postfix on hosts without a real -hostname +Internet hostname @@ -88,7 +88,7 @@ what is covered in the BASIC_CONFIGURA

    See also the section "Postfix on hosts without -a real hostname" if this is applicable to your configuration. +a real Internet hostname" if this is applicable to your configuration.

    Postfix on a null client

    @@ -610,10 +610,10 @@ href="#local_network">local area network section above.

    combine this with basic configuration information as discussed the first half of this document.

    -

    If you do not have your own hostname (as with dynamic IP -addressing) then you should also study the section on "Postfix on hosts without a real hostname". -

    +

    If you do not have your own hostname and IP address (usually +with dialup, cable TV or DSL connections) then you should also +study the section on "Postfix on hosts without +a real Internet hostname".

      @@ -689,23 +689,71 @@ newly-posted mail is flushed from the queue.

    -

    Postfix on hosts without a real hostname

    +

    Postfix on hosts without a real Internet +hostname

    -

    This section is for hosts that don't have an Internet hostname. -Typically these are systems that get a dynamic IP address via DHCP -or via dialup. Postfix will let you send and receive mail just fine -between accounts on a machine with a fantasy name. However, you -cannot use a fantasy hostname in your email address when sending +

    This section is for hosts that don't have their own Internet +hostname. Typically these are systems that get a dynamic IP address +via DHCP or via dialup. Postfix will let you send and receive mail +just fine between accounts on a machine with a fantasy name. However, +you cannot use a fantasy hostname in your email address when sending mail into the Internet, because no-one would be able to reply to -your mail. In fact, more and more sites refuse mail from non-existent -domain names.

    +your mail. In fact, more and more sites refuse mail addresses with +non-existent domain names.

    -

    The perfect solution would be for Postfix to do a mapping from -local fantasy email addresses to valid Internet addresses when mail -leaves the machine (similar to Sendmail's generics table). This is -planned for the near future.

    +

    Note: the following information is Postfix version dependent. +To find out what Postfix version you have, execute the command +"postconf mail_version".

    -

    In the mean time, the solution with Postfix is to use valid +

    Postfix version 2.2 and later

    + +

    Postfix 2.2 uses the generics(5) address mapping to replace +local fantasy email addresses by valid Internet addresses. This +mapping happens ONLY when mail leaves the machine; not when you +send mail between users on the same machine.

    + +

    The following example presents additional configuration. You +need to combine this with basic configuration information as +discussed the first half of this document.

    + +
    +
    +1 /etc/postfix/main.cf:
    +2     smtp_generics_maps = hash:/etc/postfix/generics
    +3 
    +4 /etc/postfix/generics:
    +5     his@localdomain.local             hisaccount@hisisp.example
    +6     her@localdomain.local             heraccount@herisp.example
    +7     @localdomain.local                hisaccount+local@hisisp.example
    +
    +
    + +

    When mail is sent to a remote host via SMTP:

    + +
      + +
    • Line 5 replaces his@localdomain.local by his ISP +mail address,

      + +
    • Line 6 replaces her@localdomain.local by her ISP +mail address, and

      + +
    • Line 7 replaces other local addresses by his ISP account, +with an address extension of +local (this example assumes +that the ISP supports "+" style address extensions).

      + +
    + +

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

    + +

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

    + +

    Postfix version 2.1 and earlier

    + +

    The solution with older Postfix systems is to use valid Internet addresses where possible, and to let Postfix map valid Internet addresses to local fantasy addresses. With this, you can send mail to the Internet and to local fantasy addresses, including @@ -753,6 +801,16 @@ but is convenient. +

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

    + +

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

    + +

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

    + diff --git a/postfix/html/aliases.5.html b/postfix/html/aliases.5.html index 3a13f7cb1..38f242c58 100644 --- a/postfix/html/aliases.5.html +++ b/postfix/html/aliases.5.html @@ -148,8 +148,8 @@ ALIASES(5) ALIASES(5) A list of address rewriting or forwarding mecha- nisms that propagate an address extension from the original address to the result. Specify zero or - more of canonical, virtual, alias, forward, or - include. + more of canonical, virtual, alias, forward, + include, or generics. owner_request_special Give special treatment to owner-listname and list- diff --git a/postfix/html/canonical.5.html b/postfix/html/canonical.5.html index 62c373586..6cb0a1b4f 100644 --- a/postfix/html/canonical.5.html +++ b/postfix/html/canonical.5.html @@ -19,8 +19,8 @@ CANONICAL(5) CANONICAL(5) DESCRIPTION The optional canonical(5) table specifies an address map- ping for local and non-local addresses. The mapping is - used by the cleanup(8) daemon. The address mapping is - recursive. + used by the cleanup(8) daemon, before mail is stored into + the queue. The address mapping is recursive. Normally, the canonical(5) table is specified as a text file that serves as input to the postmap(1) command. The @@ -59,8 +59,7 @@ CANONICAL(5) CANONICAL(5) aliasing. Use the aliases(5) map for that purpose. TABLE FORMAT - make# The input format for the postmap(1) command is as - follows: + The input format for the postmap(1) command is as follows: pattern result When pattern matches a mail address, replace it by @@ -76,13 +75,14 @@ CANONICAL(5) CANONICAL(5) line that starts with whitespace continues a logi- cal line. +TABLE SEARCH ORDER With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: user@domain address - user@domain is replaced by address. This form has - the highest precedence. + Replace user@domain by address. This form has the + highest precedence. This is useful to clean up addresses produced by legacy mail systems. It can also be used to pro- @@ -90,17 +90,17 @@ CANONICAL(5) CANONICAL(5) below for a simpler solution. user address - user@site is replaced by address when site is equal - to $myorigin, when site is listed in $mydestina- - tion, or when it is listed in $inet_interfaces or + Replace user@site by address when site is equal to + $myorigin, when site is listed in $mydestination, + or when it is listed in $inet_interfaces or $proxy_interfaces. This form is useful for replacing login names by Firstname.Lastname. @domain address - Every address in domain is replaced by address. - This form has the lowest precedence. + Replace other addresses in domain by address. This + form has the lowest precedence. In all the above forms, when address has the form @other- domain, the result is the same user in otherdomain. @@ -176,8 +176,8 @@ CANONICAL(5) CANONICAL(5) A list of address rewriting or forwarding mecha- nisms that propagate an address extension from the original address to the result. Specify zero or - more of canonical, virtual, alias, forward, or - include. + more of canonical, virtual, alias, forward, + include, or generics. Other parameters of interest: diff --git a/postfix/html/cidr_table.5.html b/postfix/html/cidr_table.5.html index b2a630941..9d54bbe68 100644 --- a/postfix/html/cidr_table.5.html +++ b/postfix/html/cidr_table.5.html @@ -64,7 +64,7 @@ CIDR_TABLE(5) CIDR_TABLE(5) line that starts with whitespace continues a logi- cal line. -SEARCH ORDER +TABLE SEARCH ORDER Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. diff --git a/postfix/html/generics.5.html b/postfix/html/generics.5.html new file mode 100644 index 000000000..115417b21 --- /dev/null +++ b/postfix/html/generics.5.html @@ -0,0 +1,229 @@ + + + + Postfix manual - generics(5) +
    +GENERICS(5)                                           GENERICS(5)
    +
    +NAME
    +       generics - Postfix generics table format
    +
    +SYNOPSIS
    +       postmap /etc/postfix/generics
    +
    +       postmap -q "string" /etc/postfix/generics
    +
    +       postmap -q - /etc/postfix/generics <inputfile
    +
    +DESCRIPTION
    +       The  optional  generics(5) table specifies an address map-
    +       ping that applies when mail  is  delivered.  This  is  the
    +       opposite  of canonical(5) mapping, which applies when mail
    +       is received.
    +
    +       Typically, one would use the generics(5) table on a system
    +       that  does  not have a valid Internet domain name and that
    +       uses something like localdomain.local instead.  The gener-
    +       ics(5)  table is then used by the smtp(8) client to trans-
    +       form  local  mail  addresses  into  valid  Internet   mail
    +       addresses  when  mail  has to be sent across the Internet.
    +       See the EXAMPLE section at the end of this document.
    +
    +       The  generics(5)  mapping  affects  both  message   header
    +       addresses (i.e. addresses that appear inside messages) and
    +       message envelope addresses  (for  example,  the  addresses
    +       that are used in SMTP protocol commands).
    +
    +       Normally,  the  generics(5)  table  is specified as a text
    +       file that serves as input to the postmap(1) command.   The
    +       result,  an  indexed file in dbm or db format, is used for
    +       fast searching by the mail  system.  Execute  the  command
    +       "postmap  /etc/postfix/generics"  in  order to rebuild the
    +       indexed file after changing the text file.
    +
    +       When the table is provided via other means  such  as  NIS,
    +       LDAP  or  SQL,  the  same lookups are done as for ordinary
    +       indexed files.
    +
    +       Alternatively, the table can be  provided  as  a  regular-
    +       expression map where patterns are given as regular expres-
    +       sions, or lookups can be directed to TCP-based server.  In
    +       that  case,  the  lookups are done in a slightly different
    +       way as described below under "REGULAR  EXPRESSION  TABLES"
    +       and "TCP-BASED TABLES".
    +
    +TABLE FORMAT
    +       The input format for the postmap(1) command is as follows:
    +
    +       pattern result
    +              When pattern matches a mail address, replace it  by
    +              the corresponding result.
    +
    +       blank lines and comments
    +              Empty  lines and whitespace-only lines are ignored,
    +              as are lines whose first  non-whitespace  character
    +              is a `#'.
    +
    +       multi-line text
    +              A  logical  line starts with non-whitespace text. A
    +              line that starts with whitespace continues a  logi-
    +              cal line.
    +
    +TABLE SEARCH ORDER
    +       With lookups from indexed files such as DB or DBM, or from
    +       networked tables such as NIS, LDAP or  SQL,  patterns  are
    +       tried in the order as listed below:
    +
    +       user@domain address
    +              Replace  user@domain  by address. This form has the
    +              highest precedence.
    +
    +       user address
    +              Replace user@site by address when site is equal  to
    +              $myorigin,  when  site is listed in $mydestination,
    +              or  when  it  is  listed  in  $inet_interfaces   or
    +              $proxy_interfaces.
    +
    +       @domain address
    +              Replace other addresses in domain by address.  This
    +              form has the lowest precedence.
    +
    +       In all the above forms, the result address must  have  the
    +       form username@domainname.
    +
    +ADDRESS EXTENSION
    +       When a mail address localpart contains the optional recip-
    +       ient delimiter (e.g., user+foo@domain), the  lookup  order
    +       becomes: user+foo@domain, user@domain, user+foo, user, and
    +       @domain.
    +
    +       The  propagate_unmatched_extensions   parameter   controls
    +       whether  an  unmatched  address extension (+foo) is propa-
    +       gated to the result of table lookup.
    +
    +REGULAR EXPRESSION TABLES
    +       This section describes how the table lookups  change  when
    +       the table is given in the form of regular expressions. For
    +       a description of regular expression lookup  table  syntax,
    +       see regexp_table(5) or pcre_table(5).
    +
    +       Each  pattern  is  a regular expression that is applied to
    +       the entire address being looked up. Thus, user@domain mail
    +       addresses  are  not  broken up into their user and @domain
    +       constituent parts, nor is user+foo broken up into user and
    +       foo.
    +
    +       Patterns  are  applied  in  the  order as specified in the
    +       table, until a pattern is found that  matches  the  search
    +       string.
    +
    +       Results  are  the  same as with indexed file lookups, with
    +       the additional feature that parenthesized substrings  from
    +       the pattern can be interpolated as $1, $2 and so on.
    +
    +TCP-BASED TABLES
    +       This  section  describes how the table lookups change when
    +       lookups are directed to a TCP-based server. For a descrip-
    +       tion   of  the  TCP  client/server  lookup  protocol,  see
    +       tcp_table(5).  This feature is not  available  up  to  and
    +       including Postfix version 2.2.
    +
    +       Each lookup operation uses the entire address once.  Thus,
    +       user@domain mail addresses are not broken  up  into  their
    +       user and @domain constituent parts, nor is user+foo broken
    +       up into user and foo.
    +
    +       Results are the same as with indexed file lookups.
    +
    +EXAMPLE
    +       The following shows a  generic  mapping  with  an  indexed
    +       file.   When  mail is sent to a remote host via SMTP, this
    +       replaces his@localdomain.local by his  ISP  mail  address,
    +       replaces  her@localdomain.local  by  her ISP mail address,
    +       and replaces other local addresses  by  his  ISP  account,
    +       with  an address extension of +local (this example assumes
    +       that the ISP supports "+" style address extensions).
    +
    +       /etc/postfix/main.cf:
    +               smtp_generics_maps = hash:/etc/postfix/generics
    +
    +       /etc/postfix/generics:
    +           his@localdomain.local   hisaccount@hisisp.example
    +           her@localdomain.local   heraccount@herisp.example
    +           @localdomain.local      hisaccount+local@hisisp.example
    +
    +       Execute the command "postmap /etc/postfix/generics"  when-
    +       ever  the table is changed.  Instead of hash, some systems
    +       use dbm database files. To find out what tables your  sys-
    +       tem supports use the command "postconf -m".
    +
    +BUGS
    +       The  table format does not understand quoting conventions.
    +
    +CONFIGURATION PARAMETERS
    +       The following main.cf parameters are especially  relevant.
    +       The  text  below  provides  only  a parameter summary. See
    +       postconf(5) for more details including examples.
    +
    +       smtp_generics_maps
    +              Address  mapping  lookup  table  for  envelope  and
    +              header  sender and recipient addresses while deliv-
    +              ering mail via SMTP.
    +
    +       propagate_unmatched_extensions
    +              A list of address rewriting  or  forwarding  mecha-
    +              nisms  that propagate an address extension from the
    +              original address to the result.   Specify  zero  or
    +              more   of   canonical,   virtual,  alias,  forward,
    +              include, or generics.
    +
    +       Other parameters of interest:
    +
    +       inet_interfaces
    +              The network interface addresses  that  this  system
    +              receives mail on.  You need to stop and start Post-
    +              fix when this parameter changes.
    +
    +       proxy_interfaces
    +              Other interfaces that this machine receives mail on
    +              by way of a proxy agent or network address transla-
    +              tor.
    +
    +       mydestination
    +              List of domains that  this  mail  system  considers
    +              local.
    +
    +       myorigin
    +              The domain that is appended to locally-posted mail.
    +
    +       owner_request_special
    +              Give special treatment to owner-xxx and xxx-request
    +              addresses.
    +
    +SEE ALSO
    +       postmap(1), Postfix lookup table manager
    +       postconf(5), configuration parameters
    +       smtp(8), Postfix SMTP client
    +
    +README FILES
    +       DATABASE_README, Postfix lookup table overview
    +       ADDRESS_REWRITING_README, address rewriting guide
    +
    +LICENSE
    +       The Secure Mailer license must be  distributed  with  this
    +       software.
    +
    +HISTORY
    +       A genericstable feature appears in the Sendmail MTA.
    +
    +       This feature is available in Postfix 2.2 and later.
    +
    +AUTHOR(S)
    +       Wietse Venema
    +       IBM T.J. Watson Research
    +       P.O. Box 704
    +       Yorktown Heights, NY 10598, USA
    +
    +                                                      GENERICS(5)
    +
    diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index af926710f..601e20791 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -5917,34 +5917,11 @@ This is needed when the local machine does not have its own Internet domain name, but uses something like localdomain.local instead.

    -

    The table search order is described below. The search terminates -when a match is found. In other words, the search is non-recursive. -

    +

    The table format and lookups are documented in generics(5); +examples are shown in the ADDRESS_REWRITING_README and +STANDARD_CONFIGURATION_README documents.

    -
    - -
    user@domain.tld address
    - -

    Replace user@domain.tld by address. This -form has the highest precedence.

    - -
    user address
    - -

    Replace user@site by address when site is -equal to $myorigin, when site is listed in $mydestination, -or when it matches $inet_interfaces or $proxy_interfaces.

    -
    - -
    @domain.tld address
    - -

    Replace all other addresses in domain.tld by -address. This form has the lowest preference.

    - -
    - -

    In all cases address must specify a username and a -domain.

    This feature is available in Postfix 2.2 and later. -

    +

    This feature is available in Postfix 2.2 and later.

    diff --git a/postfix/html/postfix-manuals.html b/postfix/html/postfix-manuals.html index 24868b943..333f02f9d 100644 --- a/postfix/html/postfix-manuals.html +++ b/postfix/html/postfix-manuals.html @@ -84,6 +84,8 @@ the following convention:

  • postconf(1), Postfix configuration utility +
  • postfix(1), Postfix control program +
  • postkick(1), trigger Postfix daemon
  • postlock(1), Postfix-compatible locking @@ -96,6 +98,10 @@ the following convention:

  • postsuper(1), Postfix housekeeping +
  • mailq(1), Sendmail compatibility interface + +
  • newaliases(1), Sendmail compatibility interface +
  • sendmail(1), Sendmail compatibility interface @@ -120,9 +126,11 @@ the following convention:

  • aliases(5), Postfix alias database -
  • header_checks(5), body_checks(5), content inspection +
  • canonical(5), Postfix input address rewriting -
  • canonical(5), Postfix address rewriting +
  • generics(5), Postfix output address rewriting + +
  • header_checks(5), body_checks(5), Postfix content inspection
  • relocated(5), Users that have moved diff --git a/postfix/html/postfix.1.html b/postfix/html/postfix.1.html index 1dee2171d..08566ab8a 100644 --- a/postfix/html/postfix.1.html +++ b/postfix/html/postfix.1.html @@ -198,12 +198,15 @@ POSTFIX(1) POSTFIX(1) postalias(1), create/update/query alias database postcat(1), examine Postfix queue file postconf(1), Postfix configuration utility + postfix(1), Postfix control program postkick(1), trigger Postfix daemon postlock(1), Postfix-compatible locking postlog(1), Postfix-compatible logging postmap(1), Postfix lookup table manager postqueue(1), Postfix mail queue control postsuper(1), Postfix housekeeping + mailq(1), Sendmail compatibility interface + newaliases(1), Sendmail compatibility interface sendmail(1), Sendmail compatibility interface Postfix configuration: @@ -213,8 +216,9 @@ POSTFIX(1) POSTFIX(1) Table-driven mechanisms: access(5), Postfix SMTP access control table aliases(5), Postfix alias database - header_checks(5), body_checks(5), content inspection - canonical(5), Postfix address rewriting + canonical(5), Postfix input address rewriting + generics(5), Postfix output address rewriting + header_checks(5), body_checks(5), Postfix content inspection relocated(5), Users that have moved transport(5), Postfix routing table virtual(5), Postfix virtual aliasing diff --git a/postfix/html/relocated.5.html b/postfix/html/relocated.5.html index 5072c5ead..9a31a3bfb 100644 --- a/postfix/html/relocated.5.html +++ b/postfix/html/relocated.5.html @@ -54,6 +54,7 @@ RELOCATED(5) RELOCATED(5) line that starts with whitespace continues a logi- cal line. +TABLE SEARCH ORDER With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: @@ -67,8 +68,8 @@ RELOCATED(5) RELOCATED(5) in $inet_interfaces or $proxy_interfaces. @domain - Matches every address in domain. This form has the - lowest precedence. + Matches every other address in domain. This form + has the lowest precedence. ADDRESS EXTENSION When a mail address localpart contains the optional recip- diff --git a/postfix/html/transport.5.html b/postfix/html/transport.5.html index 05800b5bb..f93151e70 100644 --- a/postfix/html/transport.5.html +++ b/postfix/html/transport.5.html @@ -85,28 +85,28 @@ TRANSPORT(5) TRANSPORT(5) how or where to deliver mail. This is described in section "RESULT FORMAT". -TABLE LOOKUP +TABLE SEARCH ORDER With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: user+extension@domain transport:nexthop - Mail for user+extension@domain is delivered through + Deliver mail for user+extension@domain through transport to nexthop. user@domain transport:nexthop - Mail for user@domain is delivered through transport - to nexthop. - - domain transport:nexthop - Mail for domain is delivered through transport to + Deliver mail for user@domain through transport to nexthop. + domain transport:nexthop + Deliver mail for domain through transport to nex- + thop. + .domain transport:nexthop - Mail for any subdomain of domain is delivered - through transport to nexthop. This applies only - when the string transport_maps is not listed in the - parent_domain_matches_subdomains configuration set- + Deliver mail for any subdomain of domain through + transport to nexthop. This applies only when the + string transport_maps is not listed in the par- + ent_domain_matches_subdomains configuration set- ting. Otherwise, a domain name matches itself and its subdomains. diff --git a/postfix/html/virtual.5.html b/postfix/html/virtual.5.html index ec135d3e7..f52f11623 100644 --- a/postfix/html/virtual.5.html +++ b/postfix/html/virtual.5.html @@ -77,19 +77,20 @@ VIRTUAL(5) VIRTUAL(5) line that starts with whitespace continues a logi- cal line. +TABLE SEARCH ORDER With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: user@domain address, address, ... - Mail for user@domain is redirected to address. - This form has the highest precedence. + Redirect mail for user@domain to address. This + form has the highest precedence. user address, address, ... - Mail for user@site is redirected to address when - site is equal to $myorigin, when site is listed in - $mydestination, or when it is listed in - $inet_interfaces or $proxy_interfaces. + Redirect mail for user@site to address when site is + equal to $myorigin, when site is listed in $mydes- + tination, or when it is listed in $inet_interfaces + or $proxy_interfaces. This functionality overlaps with functionality of the local aliases(5) database. The difference is @@ -97,8 +98,8 @@ VIRTUAL(5) VIRTUAL(5) addresses. @domain address, address, ... - Mail for any user in domain is redirected to - address. This form has the lowest precedence. + Redirect mail for other users in domain to address. + This form has the lowest precedence. In all the above forms, when address has the form @other- domain, the result is the same user in otherdomain. This @@ -219,8 +220,8 @@ VIRTUAL(5) VIRTUAL(5) A list of address rewriting or forwarding mecha- nisms that propagate an address extension from the original address to the result. Specify zero or - more of canonical, virtual, alias, forward, or - include. + more of canonical, virtual, alias, forward, + include, or generics. Other parameters of interest: diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index 73711c8f5..7987737e2 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -16,7 +16,8 @@ CONFIG = man5/access.5 man5/aliases.5 man5/canonical.5 man5/relocated.5 \ man5/transport.5 man5/virtual.5 man5/pcre_table.5 man5/regexp_table.5 \ man5/cidr_table.5 man5/tcp_table.5 man5/header_checks.5 \ man5/body_checks.5 man5/ldap_table.5 man5/mysql_table.5 \ - man5/pgsql_table.5 man5/master.5 man5/nisplus_table.5 + man5/pgsql_table.5 man5/master.5 man5/nisplus_table.5 \ + man5/generics.5 TOOLS = man1/smtp-sink.1 man1/smtp-source.1 man1/qmqp-sink.1 \ man1/qmqp-source.1 man1/qshape.1 @@ -240,6 +241,9 @@ man5/canonical.5: ../proto/canonical man5/cidr_table.5: ../proto/cidr_table ../mantools/srctoman - $? >$@ +man5/generics.5: ../proto/generics + ../mantools/srctoman - $? >$@ + man5/header_checks.5: ../proto/header_checks ../mantools/srctoman - $? >$@ diff --git a/postfix/man/man1/postfix.1 b/postfix/man/man1/postfix.1 index a08e0a5d0..82c0a256c 100644 --- a/postfix/man/man1/postfix.1 +++ b/postfix/man/man1/postfix.1 @@ -163,12 +163,15 @@ Commands: postalias(1), create/update/query alias database postcat(1), examine Postfix queue file postconf(1), Postfix configuration utility +postfix(1), Postfix control program postkick(1), trigger Postfix daemon postlock(1), Postfix-compatible locking postlog(1), Postfix-compatible logging postmap(1), Postfix lookup table manager postqueue(1), Postfix mail queue control postsuper(1), Postfix housekeeping +mailq(1), Sendmail compatibility interface +newaliases(1), Sendmail compatibility interface sendmail(1), Sendmail compatibility interface Postfix configuration: @@ -178,8 +181,9 @@ postconf(5), Postfix main.cf file syntax Table-driven mechanisms: access(5), Postfix SMTP access control table aliases(5), Postfix alias database -header_checks(5), body_checks(5), content inspection -canonical(5), Postfix address rewriting +canonical(5), Postfix input address rewriting +generics(5), Postfix output address rewriting +header_checks(5), body_checks(5), Postfix content inspection relocated(5), Users that have moved transport(5), Postfix routing table virtual(5), Postfix virtual aliasing diff --git a/postfix/man/man5/aliases.5 b/postfix/man/man5/aliases.5 index bfd5c22b5..30297e87f 100644 --- a/postfix/man/man5/aliases.5 +++ b/postfix/man/man5/aliases.5 @@ -137,7 +137,8 @@ owner alias, instead using of the left-hand side address. A list of address rewriting or forwarding mechanisms that propagate an address extension from the original address to the result. Specify zero or more of \fBcanonical\fR, -\fBvirtual\fR, \fBalias\fR, \fBforward\fR, or \fBinclude\fR. +\fBvirtual\fR, \fBalias\fR, \fBforward\fR, \fBinclude\fR, +or \fBgenerics\fR. .IP \fBowner_request_special\fR Give special treatment to \fBowner-\fIlistname\fR and \fIlistname\fB-request\fR diff --git a/postfix/man/man5/canonical.5 b/postfix/man/man5/canonical.5 index 7032b003b..19ec6c26b 100644 --- a/postfix/man/man5/canonical.5 +++ b/postfix/man/man5/canonical.5 @@ -18,7 +18,8 @@ Postfix canonical table format .fi The optional \fBcanonical\fR(5) table specifies an address mapping for local and non-local addresses. The mapping is used by the -\fBcleanup\fR(8) daemon. The address mapping is recursive. +\fBcleanup\fR(8) daemon, before mail is stored into the +queue. The address mapping is recursive. Normally, the \fBcanonical\fR(5) table is specified as a text file that serves as input to the \fBpostmap\fR(1) command. @@ -57,7 +58,7 @@ Use the \fBaliases\fR(5) map for that purpose. .nf .ad .fi -make# The input format for the \fBpostmap\fR(1) command is as follows: +The input format for the \fBpostmap\fR(1) command is as follows: .IP "\fIpattern result\fR" When \fIpattern\fR matches a mail address, replace it by the corresponding \fIresult\fR. @@ -67,19 +68,23 @@ are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.PP +.SH "TABLE SEARCH ORDER" +.na +.nf +.ad +.fi With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: .IP "\fIuser\fR@\fIdomain address\fR" -\fIuser\fR@\fIdomain\fR is replaced by \fIaddress\fR. This form +Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form has the highest precedence. .sp This is useful to clean up addresses produced by legacy mail systems. It can also be used to produce \fIFirstname.Lastname\fR style addresses, but see below for a simpler solution. .IP "\fIuser address\fR" -\fIuser\fR@\fIsite\fR is replaced by \fIaddress\fR when \fIsite\fR is +Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR or $\fBproxy_interfaces\fR. @@ -87,7 +92,7 @@ or $\fBproxy_interfaces\fR. This form is useful for replacing login names by \fIFirstname.Lastname\fR. .IP "@\fIdomain address\fR" -Every address in \fIdomain\fR is replaced by \fIaddress\fR. +Replace other addresses in \fIdomain\fR by \fIaddress\fR. This form has the lowest precedence. .PP In all the above forms, when \fIaddress\fR has the form @@ -168,7 +173,7 @@ addresses. A list of address rewriting or forwarding mechanisms that propagate an address extension from the original address to the result. Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, -\fBforward\fR, or \fBinclude\fR. +\fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. .PP Other parameters of interest: .IP \fBinet_interfaces\fR diff --git a/postfix/man/man5/cidr_table.5 b/postfix/man/man5/cidr_table.5 index b4aa31ec6..30504a406 100644 --- a/postfix/man/man5/cidr_table.5 +++ b/postfix/man/man5/cidr_table.5 @@ -57,7 +57,7 @@ are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.SH "SEARCH ORDER" +.SH "TABLE SEARCH ORDER" .na .nf .ad diff --git a/postfix/man/man5/generics.5 b/postfix/man/man5/generics.5 new file mode 100644 index 000000000..486d8ed1c --- /dev/null +++ b/postfix/man/man5/generics.5 @@ -0,0 +1,244 @@ +.TH GENERICS 5 +.ad +.fi +.SH NAME +generics +\- +Postfix generics table format +.SH "SYNOPSIS" +.na +.nf +\fBpostmap /etc/postfix/generics\fR + +\fBpostmap -q "\fIstring\fB" /etc/postfix/generics\fR + +\fBpostmap -q - /etc/postfix/generics <\fIinputfile\fR +.SH DESCRIPTION +.ad +.fi +The optional \fBgenerics\fR(5) table specifies an address +mapping that applies when mail is delivered. This is the +opposite of \fBcanonical\fR(5) mapping, which applies when +mail is received. + +Typically, one would use the \fBgenerics\fR(5) table on a +system that does not have a valid Internet domain name and +that uses something like \fIlocaldomain.local\fR instead. +The \fBgenerics\fR(5) table is then used by the \fBsmtp\fR(8) +client to transform local mail addresses into valid Internet +mail addresses when mail has to be sent across the Internet. +See the EXAMPLE section at the end of this document. + +The \fBgenerics\fR(5) mapping affects both message header +addresses (i.e. addresses that appear inside messages) and +message envelope addresses (for example, the addresses that +are used in SMTP protocol commands). + +Normally, the \fBgenerics\fR(5) table is specified as a +text file that serves as input to the \fBpostmap\fR(1) +command. The result, an indexed file in \fBdbm\fR or +\fBdb\fR format, is used for fast searching by the mail +system. Execute the command "\fBpostmap /etc/postfix/generics\fR" +in order to rebuild the indexed file after changing the +text file. + +When the table is provided via other means such as NIS, LDAP +or SQL, the same lookups are done as for ordinary indexed files. + +Alternatively, the table can be provided as a regular-expression +map where patterns are given as regular expressions, or lookups +can be directed to TCP-based server. In that case, the lookups are +done in a slightly different way as described below under +"REGULAR EXPRESSION TABLES" and "TCP-BASED TABLES". +.SH "TABLE FORMAT" +.na +.nf +.ad +.fi +The input format for the \fBpostmap\fR(1) command is as follows: +.IP "\fIpattern result\fR" +When \fIpattern\fR matches a mail address, replace it by the +corresponding \fIresult\fR. +.IP "blank lines and comments" +Empty lines and whitespace-only lines are ignored, as +are lines whose first non-whitespace character is a `#'. +.IP "multi-line text" +A logical line starts with non-whitespace text. A line that +starts with whitespace continues a logical line. +.SH "TABLE SEARCH ORDER" +.na +.nf +.ad +.fi +With lookups from indexed files such as DB or DBM, or from networked +tables such as NIS, LDAP or SQL, patterns are tried in the order as +listed below: +.IP "\fIuser\fR@\fIdomain address\fR" +Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form +has the highest precedence. +.IP "\fIuser address\fR" +Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is +equal to $\fBmyorigin\fR, when \fIsite\fR is listed in +$\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR +or $\fBproxy_interfaces\fR. +.IP "@\fIdomain address\fR" +Replace other addresses in \fIdomain\fR by \fIaddress\fR. +This form has the lowest precedence. +.PP +In all the above forms, the result \fIaddress\fR must have +the form \fIusername@domainname\fR. +.SH "ADDRESS EXTENSION" +.na +.nf +.fi +.ad +When a mail address localpart contains the optional recipient delimiter +(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +\fIuser\fR, and @\fIdomain\fR. + +The \fBpropagate_unmatched_extensions\fR parameter controls whether +an unmatched address extension (\fI+foo\fR) is propagated to the +result of table lookup. +.SH "REGULAR EXPRESSION TABLES" +.na +.nf +.ad +.fi +This section describes how the table lookups change when the table +is given in the form of regular expressions. For a description of +regular expression lookup table syntax, see \fBregexp_table\fR(5) +or \fBpcre_table\fR(5). + +Each pattern is a regular expression that is applied to the entire +address being looked up. Thus, \fIuser@domain\fR mail addresses are not +broken up into their \fIuser\fR and \fI@domain\fR constituent parts, +nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. + +Patterns are applied in the order as specified in the table, until a +pattern is found that matches the search string. + +Results are the same as with indexed file lookups, with +the additional feature that parenthesized substrings from the +pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. +.SH "TCP-BASED TABLES" +.na +.nf +.ad +.fi +This section describes how the table lookups change when lookups +are directed to a TCP-based server. For a description of the TCP +client/server lookup protocol, see \fBtcp_table\fR(5). +This feature is not available up to and including Postfix version 2.2. + +Each lookup operation uses the entire address once. Thus, +\fIuser@domain\fR mail addresses are not broken up into their +\fIuser\fR and \fI@domain\fR constituent parts, nor is +\fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. + +Results are the same as with indexed file lookups. +.SH "EXAMPLE" +.na +.nf +.ad +.fi +The following shows a generic mapping with an indexed file. +When mail is sent to a remote host via SMTP, this replaces +\fIhis@localdomain.local\fR by his ISP mail address, replaces +\fIher@localdomain.local\fR by her ISP mail address, and +replaces other local addresses by his ISP account, with +an address extension of \fI+local\fR (this example assumes +that the ISP supports "+" style address extensions). + +.na +.nf +/etc/postfix/main.cf: +.in +4 + smtp_generics_maps = hash:/etc/postfix/generics +.in -4 + +/etc/postfix/generics: +.in +4 +his@localdomain.local hisaccount@hisisp.example +her@localdomain.local heraccount@herisp.example +@localdomain.local hisaccount+local@hisisp.example +.in -4 + +.ad +.fi +Execute the command "\fBpostmap /etc/postfix/generics\fR" +whenever the table is changed. Instead of \fBhash\fR, some +systems use \fBdbm\fR database files. To find out what +tables your system supports use the command "\fBpostconf +-m\fR". +.SH BUGS +.ad +.fi +The table format does not understand quoting conventions. +.SH "CONFIGURATION PARAMETERS" +.na +.nf +.ad +.fi +The following \fBmain.cf\fR parameters are especially relevant. +The text below provides only a parameter summary. See +\fBpostconf\fR(5) for more details including examples. +.IP \fBsmtp_generics_maps\fR +Address mapping lookup table for envelope and header sender +and recipient addresses while delivering mail via SMTP. +.IP \fBpropagate_unmatched_extensions\fR +A list of address rewriting or forwarding mechanisms that propagate +an address extension from the original address to the result. +Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, +\fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. +.PP +Other parameters of interest: +.IP \fBinet_interfaces\fR +The network interface addresses that this system receives mail on. +You need to stop and start Postfix when this parameter changes. +.IP \fBproxy_interfaces\fR +Other interfaces that this machine receives mail on by way of a +proxy agent or network address translator. +.IP \fBmydestination\fR +List of domains that this mail system considers local. +.IP \fBmyorigin\fR +The domain that is appended to locally-posted mail. +.IP \fBowner_request_special\fR +Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR +addresses. +.SH "SEE ALSO" +.na +.nf +postmap(1), Postfix lookup table manager +postconf(5), configuration parameters +smtp(8), Postfix SMTP client +.SH "README FILES" +.na +.nf +.ad +.fi +Use "\fBpostconf readme_directory\fR" or +"\fBpostconf html_directory\fR" to locate this information. +.na +.nf +DATABASE_README, Postfix lookup table overview +ADDRESS_REWRITING_README, address rewriting guide +.SH "LICENSE" +.na +.nf +.ad +.fi +The Secure Mailer license must be distributed with this software. +.SH "HISTORY" +.na +.nf +A genericstable feature appears in the Sendmail MTA. + +This feature is available in Postfix 2.2 and later. +.SH "AUTHOR(S)" +.na +.nf +Wietse Venema +IBM T.J. Watson Research +P.O. Box 704 +Yorktown Heights, NY 10598, USA diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 72f6b5582..f74971bcb 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -3246,21 +3246,10 @@ This is needed when the local machine does not have its own Internet domain name, but uses something like \fIlocaldomain.local\fR instead. .PP -The table search order is described below. The search terminates -when a match is found. In other words, the search is non-recursive. -.IP "\fIuser@domain.tld address\fR" -Replace \fIuser@domain.tld\fR by \fIaddress\fR. This -form has the highest precedence. -.IP "\fIuser address\fR" -Replace \fIuser@site\fR by \fIaddress\fR when \fIsite\fR is -equal to $myorigin, when \fIsite\fR is listed in $mydestination, -or when it matches $inet_interfaces or $proxy_interfaces. -.IP "\fI@domain.tld address\fR" -Replace all other addresses in \fIdomain.tld\fR by -\fIaddress\fR. This form has the lowest preference. +The table format and lookups are documented in \fBgenerics\fR(5); +examples are shown in the ADDRESS_REWRITING_README and +STANDARD_CONFIGURATION_README documents. .PP -In all cases \fIaddress\fR must specify a username and a -domain. This feature is available in Postfix 2.2 and later. .SH smtp_helo_name (default: $myhostname) The hostname to send in the SMTP EHLO or HELO command. diff --git a/postfix/man/man5/relocated.5 b/postfix/man/man5/relocated.5 index c48cc952a..5e8c9c182 100644 --- a/postfix/man/man5/relocated.5 +++ b/postfix/man/man5/relocated.5 @@ -51,7 +51,11 @@ are lines whose first non-whitespace character is a `#'. .IP \(bu A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.PP +.SH "TABLE SEARCH ORDER" +.na +.nf +.ad +.fi With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: @@ -63,7 +67,7 @@ Matches \fIuser\fR@\fIsite\fR when \fIsite\fR is $\fBmyorigin\fR, when \fIsite\fR is listed in $\fBmydestination\fR, or when \fIsite\fR is listed in $\fBinet_interfaces\fR or $\fBproxy_interfaces\fR. .IP @\fIdomain\fR -Matches every address in \fIdomain\fR. This form has the lowest +Matches every other address in \fIdomain\fR. This form has the lowest precedence. .SH "ADDRESS EXTENSION" .na diff --git a/postfix/man/man5/transport.5 b/postfix/man/man5/transport.5 index 8155003cb..81210fb1b 100644 --- a/postfix/man/man5/transport.5 +++ b/postfix/man/man5/transport.5 @@ -73,7 +73,7 @@ a domain name hierarchy, as described in section "TABLE LOOKUP". The \fIresult\fR is of the form \fItransport:nexthop\fR and specifies how or where to deliver mail. This is described in section "RESULT FORMAT". -.SH "TABLE LOOKUP" +.SH "TABLE SEARCH ORDER" .na .nf .ad @@ -82,17 +82,17 @@ With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: .IP "\fIuser+extension@domain transport\fR:\fInexthop\fR" -Mail for \fIuser+extension@domain\fR is delivered through +Deliver mail for \fIuser+extension@domain\fR through \fItransport\fR to \fInexthop\fR. .IP "\fIuser@domain transport\fR:\fInexthop\fR" -Mail for \fIuser@domain\fR is delivered through \fItransport\fR to +Deliver mail for \fIuser@domain\fR through \fItransport\fR to \fInexthop\fR. .IP "\fIdomain transport\fR:\fInexthop\fR" -Mail for \fIdomain\fR is delivered through \fItransport\fR to +Deliver mail for \fIdomain\fR through \fItransport\fR to \fInexthop\fR. .IP "\fI.domain transport\fR:\fInexthop\fR" -Mail for any subdomain of \fIdomain\fR is delivered through +Deliver mail for any subdomain of \fIdomain\fR through \fItransport\fR to \fInexthop\fR. This applies only when the string \fBtransport_maps\fR is not listed in the \fBparent_domain_matches_subdomains\fR configuration setting. diff --git a/postfix/man/man5/virtual.5 b/postfix/man/man5/virtual.5 index f53af1b5e..92786a6dc 100644 --- a/postfix/man/man5/virtual.5 +++ b/postfix/man/man5/virtual.5 @@ -67,15 +67,19 @@ are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.PP +.SH "TABLE SEARCH ORDER" +.na +.nf +.ad +.fi With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: .IP "\fIuser\fR@\fIdomain address, address, ...\fR" -Mail for \fIuser\fR@\fIdomain\fR is redirected to \fIaddress\fR. +Redirect mail for \fIuser\fR@\fIdomain\fR to \fIaddress\fR. This form has the highest precedence. .IP "\fIuser address, address, ...\fR" -Mail for \fIuser\fR@\fIsite\fR is redirected to \fIaddress\fR when +Redirect mail for \fIuser\fR@\fIsite\fR to \fIaddress\fR when \fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR or $\fBproxy_interfaces\fR. @@ -84,7 +88,7 @@ This functionality overlaps with functionality of the local \fIaliases\fR(5) database. The difference is that \fBvirtual\fR(5) mapping can be applied to non-local addresses. .IP "@\fIdomain address, address, ...\fR" -Mail for any user in \fIdomain\fR is redirected to \fIaddress\fR. +Redirect mail for other users in \fIdomain\fR to \fIaddress\fR. This form has the lowest precedence. .PP In all the above forms, when \fIaddress\fR has the form @@ -221,7 +225,7 @@ as the \fBmydestination\fR parameter. A list of address rewriting or forwarding mechanisms that propagate an address extension from the original address to the result. Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, -\fBforward\fR, or \fBinclude\fR. +\fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. .PP Other parameters of interest: .IP \fBinet_interfaces\fR diff --git a/postfix/mantools/manlint.stop b/postfix/mantools/manlint.stop index 793167d8c..c12d146ce 100644 --- a/postfix/mantools/manlint.stop +++ b/postfix/mantools/manlint.stop @@ -103,3 +103,11 @@ man/man1/postfix.1:44:.IP \fBflush\fR man/man8/oqmgr.8:55:.IP \fBbounce\fR man/man8/qmgr.8:55:.IP \fBbounce\fR man/man8/trivial-rewrite.8:21:.IP \fBlocal\fR +man/man5/aliases.5:140:\fBvirtual\fR, \fBalias\fR, \fBforward\fR, \fBinclude\fR, +man/man5/canonical.5:171:Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, +man/man5/generics.5:11:\fBpostmap /etc/postfix/generics\fR +man/man5/generics.5:13:\fBpostmap -q "\fIstring\fB" /etc/postfix/generics\fR +man/man5/generics.5:15:\fBpostmap -q - /etc/postfix/generics <\fIinputfile\fR +man/man5/generics.5:189:Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, +man/man5/postconf.5:2446:and \fBvirtual\fR is likely to cause problems when mail is forwarded +man/man5/postconf.5:4575:is \fBsmtpd\fR, corresponding to a SASL configuration file named diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index 2a7798eaf..af081aa4b 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -552,7 +552,7 @@ while (<>) { s/[]*access[<\/bB>]*\(5\)/$&<\/a>/g; s/[]*aliases[<\/bB>]*\(5\)/$&<\/a>/g; s/[]*canonical[<\/bB>]*\(5\)/$&<\/a>/g; - s/[]*etrn[<\/bB>]*\(5\)/$&<\/a>/g; + s/[]*gener[-<\/bB>]*\n* *[]*ics[<\/bB>]*\(5\)/$&<\/a>/g; s/[]*ldap[<\/bBiI>]*_[<\/iIbB>]*table[<\/bB>]*\(5\)/$&<\/a>/g; s/[]*mas[-<\/bB>]*\n* *[]*ter[<\/bB>]*\(5\)/$&<\/a>/g; s/[]*mysql[<\/bBiI>]*_[<\/iIbB>]*table[<\/bB>]*\(5\)/$&<\/a>/g; diff --git a/postfix/proto/ADDRESS_REWRITING_README.html b/postfix/proto/ADDRESS_REWRITING_README.html index 7e8e4b6ae..83b4ad834 100644 --- a/postfix/proto/ADDRESS_REWRITING_README.html +++ b/postfix/proto/ADDRESS_REWRITING_README.html @@ -946,11 +946,12 @@ a name such as localdomain.local. This can be a problem when you want to send mail over the Internet, because many mail servers reject mail addresses with invalid domain names.

    -

    With the smtp_generics_maps parameter you can specify lookup -tables that replace local mail addresses by valid Internet addresses -when mail leaves the machine via SMTP. This mapping replaces envelope -and header addresses, and is non-recursive. It does not happen when -you send mail between addresses on the local machine.

    +

    With the smtp_generics_maps parameter you can specify generics(5) +lookup tables that replace local mail addresses by valid Internet +addresses when mail leaves the machine via SMTP. The generics(5) +mapping replaces envelope and header addresses, and is non-recursive. +It does not happen when you send mail between addresses on the +local machine.

    This feature is available in Postfix version 2.2 and later.

    @@ -962,18 +963,18 @@ you send mail between addresses on the local machine.

    smtp_generics_maps = hash:/etc/postfix/generics /etc/postfix/generics: - you@localdomain.local youraccount@yourisp.example + his@localdomain.local hisaccount@hisisp.example her@localdomain.local heraccount@herisp.example - @localdomain.local youraccount+local@yourisp.example + @localdomain.local hisaccount+local@hisisp.example -

    When mail is sent to a remote host via SMTP, this replaces your -local mail address you@localdomain.local by your ISP mail -address, replaces her@localdomain.local by her ISP mail -address, and replaces all other local addresses by your ISP account, -with an address extension of +local (this example assumes -that the ISP supports "+" style address extensions).

    +

    When mail is sent to a remote host via SMTP, this replaces +his@localdomain.local by his ISP mail address, replaces +her@localdomain.local by her ISP mail address, and replaces +other local addresses by his ISP account, with an address extension +of +local (this example assumes that the ISP supports "+" +style address extensions).

    Local alias database

    diff --git a/postfix/proto/Makefile.in b/postfix/proto/Makefile.in index cda9815e7..7656e0114 100644 --- a/postfix/proto/Makefile.in +++ b/postfix/proto/Makefile.in @@ -3,7 +3,8 @@ SHELL = /bin/sh # For now, just hard-coded rules. CONFIG = ../conf/access ../conf/aliases ../conf/canonical ../conf/relocated \ - ../conf/transport ../conf/virtual ../conf/header_checks + ../conf/transport ../conf/virtual ../conf/header_checks \ + ../conf/generics HTML = ../html/ADDRESS_CLASS_README.html \ ../html/ADDRESS_REWRITING_README.html \ @@ -104,6 +105,9 @@ clobber: ../conf/canonical: canonical $(SRCTOMAN) - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ +../conf/generics: generics + $(SRCTOMAN) - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../conf/header_checks: header_checks $(SRCTOMAN) - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ diff --git a/postfix/proto/STANDARD_CONFIGURATION_README.html b/postfix/proto/STANDARD_CONFIGURATION_README.html index c06e37764..efb35e6c3 100644 --- a/postfix/proto/STANDARD_CONFIGURATION_README.html +++ b/postfix/proto/STANDARD_CONFIGURATION_README.html @@ -56,7 +56,7 @@ site
  • Postfix on a dialup machine
  • Postfix on hosts without a real -hostname +Internet hostname @@ -88,7 +88,7 @@ what is covered in the BASIC_CONFIGURATION_README document:

    See also the section "Postfix on hosts without -a real hostname" if this is applicable to your configuration. +a real Internet hostname" if this is applicable to your configuration.

    Postfix on a null client

    @@ -610,10 +610,10 @@ href="#local_network">local area network section above.

    combine this with basic configuration information as discussed the first half of this document.

    -

    If you do not have your own hostname (as with dynamic IP -addressing) then you should also study the section on "Postfix on hosts without a real hostname". -

    +

    If you do not have your own hostname and IP address (usually +with dialup, cable TV or DSL connections) then you should also +study the section on "Postfix on hosts without +a real Internet hostname".

      @@ -689,23 +689,71 @@ newly-posted mail is flushed from the queue.

    -

    Postfix on hosts without a real hostname

    +

    Postfix on hosts without a real Internet +hostname

    -

    This section is for hosts that don't have an Internet hostname. -Typically these are systems that get a dynamic IP address via DHCP -or via dialup. Postfix will let you send and receive mail just fine -between accounts on a machine with a fantasy name. However, you -cannot use a fantasy hostname in your email address when sending +

    This section is for hosts that don't have their own Internet +hostname. Typically these are systems that get a dynamic IP address +via DHCP or via dialup. Postfix will let you send and receive mail +just fine between accounts on a machine with a fantasy name. However, +you cannot use a fantasy hostname in your email address when sending mail into the Internet, because no-one would be able to reply to -your mail. In fact, more and more sites refuse mail from non-existent -domain names.

    +your mail. In fact, more and more sites refuse mail addresses with +non-existent domain names.

    -

    The perfect solution would be for Postfix to do a mapping from -local fantasy email addresses to valid Internet addresses when mail -leaves the machine (similar to Sendmail's generics table). This is -planned for the near future.

    +

    Note: the following information is Postfix version dependent. +To find out what Postfix version you have, execute the command +"postconf mail_version".

    -

    In the mean time, the solution with Postfix is to use valid +

    Postfix version 2.2 and later

    + +

    Postfix 2.2 uses the generics(5) address mapping to replace +local fantasy email addresses by valid Internet addresses. This +mapping happens ONLY when mail leaves the machine; not when you +send mail between users on the same machine.

    + +

    The following example presents additional configuration. You +need to combine this with basic configuration information as +discussed the first half of this document.

    + +
    +
    +1 /etc/postfix/main.cf:
    +2     smtp_generics_maps = hash:/etc/postfix/generics
    +3 
    +4 /etc/postfix/generics:
    +5     his@localdomain.local             hisaccount@hisisp.example
    +6     her@localdomain.local             heraccount@herisp.example
    +7     @localdomain.local                hisaccount+local@hisisp.example
    +
    +
    + +

    When mail is sent to a remote host via SMTP:

    + +
      + +
    • Line 5 replaces his@localdomain.local by his ISP +mail address,

      + +
    • Line 6 replaces her@localdomain.local by her ISP +mail address, and

      + +
    • Line 7 replaces other local addresses by his ISP account, +with an address extension of +local (this example assumes +that the ISP supports "+" style address extensions).

      + +
    + +

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

    + +

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

    + +

    Postfix version 2.1 and earlier

    + +

    The solution with older Postfix systems is to use valid Internet addresses where possible, and to let Postfix map valid Internet addresses to local fantasy addresses. With this, you can send mail to the Internet and to local fantasy addresses, including @@ -753,6 +801,16 @@ but is convenient. +

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

    + +

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

    + +

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

    + diff --git a/postfix/proto/aliases b/postfix/proto/aliases index d7d18c035..b2a690785 100644 --- a/postfix/proto/aliases +++ b/postfix/proto/aliases @@ -125,7 +125,8 @@ # A list of address rewriting or forwarding mechanisms that # propagate an address extension from the original address # to the result. Specify zero or more of \fBcanonical\fR, -# \fBvirtual\fR, \fBalias\fR, \fBforward\fR, or \fBinclude\fR. +# \fBvirtual\fR, \fBalias\fR, \fBforward\fR, \fBinclude\fR, +# or \fBgenerics\fR. # .IP \fBowner_request_special\fR # Give special treatment to \fBowner-\fIlistname\fR and # \fIlistname\fB-request\fR diff --git a/postfix/proto/canonical b/postfix/proto/canonical index 93916ee60..0a8051161 100644 --- a/postfix/proto/canonical +++ b/postfix/proto/canonical @@ -12,7 +12,8 @@ # DESCRIPTION # The optional \fBcanonical\fR(5) table specifies an address mapping for # local and non-local addresses. The mapping is used by the -# \fBcleanup\fR(8) daemon. The address mapping is recursive. +# \fBcleanup\fR(8) daemon, before mail is stored into the +# queue. The address mapping is recursive. # # Normally, the \fBcanonical\fR(5) table is specified as a text file # that serves as input to the \fBpostmap\fR(1) command. @@ -49,7 +50,7 @@ # TABLE FORMAT # .ad # .fi -make# The input format for the \fBpostmap\fR(1) command is as follows: +# The input format for the \fBpostmap\fR(1) command is as follows: # .IP "\fIpattern result\fR" # When \fIpattern\fR matches a mail address, replace it by the # corresponding \fIresult\fR. @@ -59,19 +60,21 @@ make# The input format for the \fBpostmap\fR(1) command is as follows: # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# .PP +# TABLE SEARCH ORDER +# .ad +# .fi # With lookups from indexed files such as DB or DBM, or from networked # tables such as NIS, LDAP or SQL, patterns are tried in the order as # listed below: # .IP "\fIuser\fR@\fIdomain address\fR" -# \fIuser\fR@\fIdomain\fR is replaced by \fIaddress\fR. This form +# Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form # has the highest precedence. # .sp # This is useful to clean up addresses produced by legacy mail systems. # It can also be used to produce \fIFirstname.Lastname\fR style # addresses, but see below for a simpler solution. # .IP "\fIuser address\fR" -# \fIuser\fR@\fIsite\fR is replaced by \fIaddress\fR when \fIsite\fR is +# Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is # equal to $\fBmyorigin\fR, when \fIsite\fR is listed in # $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR # or $\fBproxy_interfaces\fR. @@ -79,7 +82,7 @@ make# The input format for the \fBpostmap\fR(1) command is as follows: # This form is useful for replacing login names by # \fIFirstname.Lastname\fR. # .IP "@\fIdomain address\fR" -# Every address in \fIdomain\fR is replaced by \fIaddress\fR. +# Replace other addresses in \fIdomain\fR by \fIaddress\fR. # This form has the lowest precedence. # .PP # In all the above forms, when \fIaddress\fR has the form @@ -150,7 +153,7 @@ make# The input format for the \fBpostmap\fR(1) command is as follows: # A list of address rewriting or forwarding mechanisms that propagate # an address extension from the original address to the result. # Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, -# \fBforward\fR, or \fBinclude\fR. +# \fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. # .PP # Other parameters of interest: # .IP \fBinet_interfaces\fR diff --git a/postfix/proto/cidr_table b/postfix/proto/cidr_table index 341f516a9..478326222 100644 --- a/postfix/proto/cidr_table +++ b/postfix/proto/cidr_table @@ -49,7 +49,7 @@ # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# SEARCH ORDER +# TABLE SEARCH ORDER # .ad # .fi # Patterns are applied in the order as specified in the table, until a diff --git a/postfix/proto/generics b/postfix/proto/generics new file mode 100644 index 000000000..cc5684ad7 --- /dev/null +++ b/postfix/proto/generics @@ -0,0 +1,213 @@ +#++ +# NAME +# generics 5 +# SUMMARY +# Postfix generics table format +# SYNOPSIS +# \fBpostmap /etc/postfix/generics\fR +# +# \fBpostmap -q "\fIstring\fB" /etc/postfix/generics\fR +# +# \fBpostmap -q - /etc/postfix/generics <\fIinputfile\fR +# DESCRIPTION +# The optional \fBgenerics\fR(5) table specifies an address +# mapping that applies when mail is delivered. This is the +# opposite of \fBcanonical\fR(5) mapping, which applies when +# mail is received. +# +# Typically, one would use the \fBgenerics\fR(5) table on a +# system that does not have a valid Internet domain name and +# that uses something like \fIlocaldomain.local\fR instead. +# The \fBgenerics\fR(5) table is then used by the \fBsmtp\fR(8) +# client to transform local mail addresses into valid Internet +# mail addresses when mail has to be sent across the Internet. +# See the EXAMPLE section at the end of this document. +# +# The \fBgenerics\fR(5) mapping affects both message header +# addresses (i.e. addresses that appear inside messages) and +# message envelope addresses (for example, the addresses that +# are used in SMTP protocol commands). +# +# Normally, the \fBgenerics\fR(5) table is specified as a +# text file that serves as input to the \fBpostmap\fR(1) +# command. The result, an indexed file in \fBdbm\fR or +# \fBdb\fR format, is used for fast searching by the mail +# system. Execute the command "\fBpostmap /etc/postfix/generics\fR" +# in order to rebuild the indexed file after changing the +# text file. +# +# When the table is provided via other means such as NIS, LDAP +# or SQL, the same lookups are done as for ordinary indexed files. +# +# Alternatively, the table can be provided as a regular-expression +# map where patterns are given as regular expressions, or lookups +# can be directed to TCP-based server. In that case, the lookups are +# done in a slightly different way as described below under +# "REGULAR EXPRESSION TABLES" and "TCP-BASED TABLES". +# TABLE FORMAT +# .ad +# .fi +# The input format for the \fBpostmap\fR(1) command is as follows: +# .IP "\fIpattern result\fR" +# When \fIpattern\fR matches a mail address, replace it by the +# corresponding \fIresult\fR. +# .IP "blank lines and comments" +# Empty lines and whitespace-only lines are ignored, as +# are lines whose first non-whitespace character is a `#'. +# .IP "multi-line text" +# A logical line starts with non-whitespace text. A line that +# starts with whitespace continues a logical line. +# TABLE SEARCH ORDER +# .ad +# .fi +# With lookups from indexed files such as DB or DBM, or from networked +# tables such as NIS, LDAP or SQL, patterns are tried in the order as +# listed below: +# .IP "\fIuser\fR@\fIdomain address\fR" +# Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form +# has the highest precedence. +# .IP "\fIuser address\fR" +# Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is +# equal to $\fBmyorigin\fR, when \fIsite\fR is listed in +# $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR +# or $\fBproxy_interfaces\fR. +# .IP "@\fIdomain address\fR" +# Replace other addresses in \fIdomain\fR by \fIaddress\fR. +# This form has the lowest precedence. +# .PP +# In all the above forms, the result \fIaddress\fR must have +# the form \fIusername@domainname\fR. +# ADDRESS EXTENSION +# .fi +# .ad +# When a mail address localpart contains the optional recipient delimiter +# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +# \fIuser\fR, and @\fIdomain\fR. +# +# The \fBpropagate_unmatched_extensions\fR parameter controls whether +# an unmatched address extension (\fI+foo\fR) is propagated to the +# result of table lookup. +# REGULAR EXPRESSION TABLES +# .ad +# .fi +# This section describes how the table lookups change when the table +# is given in the form of regular expressions. For a description of +# regular expression lookup table syntax, see \fBregexp_table\fR(5) +# or \fBpcre_table\fR(5). +# +# Each pattern is a regular expression that is applied to the entire +# address being looked up. Thus, \fIuser@domain\fR mail addresses are not +# broken up into their \fIuser\fR and \fI@domain\fR constituent parts, +# nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. +# +# Patterns are applied in the order as specified in the table, until a +# pattern is found that matches the search string. +# +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from the +# pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. +# TCP-BASED TABLES +# .ad +# .fi +# This section describes how the table lookups change when lookups +# are directed to a TCP-based server. For a description of the TCP +# client/server lookup protocol, see \fBtcp_table\fR(5). +# This feature is not available up to and including Postfix version 2.2. +# +# Each lookup operation uses the entire address once. Thus, +# \fIuser@domain\fR mail addresses are not broken up into their +# \fIuser\fR and \fI@domain\fR constituent parts, nor is +# \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. +# +# Results are the same as with indexed file lookups. +# EXAMPLE +# .ad +# .fi +# The following shows a generic mapping with an indexed file. +# When mail is sent to a remote host via SMTP, this replaces +# \fIhis@localdomain.local\fR by his ISP mail address, replaces +# \fIher@localdomain.local\fR by her ISP mail address, and +# replaces other local addresses by his ISP account, with +# an address extension of \fI+local\fR (this example assumes +# that the ISP supports "+" style address extensions). +# +# .na +# .nf +# /etc/postfix/main.cf: +# .in +4 +# smtp_generics_maps = hash:/etc/postfix/generics +# .in -4 +# +# /etc/postfix/generics: +# .in +4 +# his@localdomain.local hisaccount@hisisp.example +# her@localdomain.local heraccount@herisp.example +# @localdomain.local hisaccount+local@hisisp.example +# .in -4 +# +# .ad +# .fi +# Execute the command "\fBpostmap /etc/postfix/generics\fR" +# whenever the table is changed. Instead of \fBhash\fR, some +# systems use \fBdbm\fR database files. To find out what +# tables your system supports use the command "\fBpostconf +# -m\fR". +# BUGS +# The table format does not understand quoting conventions. +# CONFIGURATION PARAMETERS +# .ad +# .fi +# The following \fBmain.cf\fR parameters are especially relevant. +# The text below provides only a parameter summary. See +# \fBpostconf\fR(5) for more details including examples. +# .IP \fBsmtp_generics_maps\fR +# Address mapping lookup table for envelope and header sender +# and recipient addresses while delivering mail via SMTP. +# .IP \fBpropagate_unmatched_extensions\fR +# A list of address rewriting or forwarding mechanisms that propagate +# an address extension from the original address to the result. +# Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, +# \fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. +# .PP +# Other parameters of interest: +# .IP \fBinet_interfaces\fR +# The network interface addresses that this system receives mail on. +# You need to stop and start Postfix when this parameter changes. +# .IP \fBproxy_interfaces\fR +# Other interfaces that this machine receives mail on by way of a +# proxy agent or network address translator. +# .IP \fBmydestination\fR +# List of domains that this mail system considers local. +# .IP \fBmyorigin\fR +# The domain that is appended to locally-posted mail. +# .IP \fBowner_request_special\fR +# Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR +# addresses. +# SEE ALSO +# postmap(1), Postfix lookup table manager +# postconf(5), configuration parameters +# smtp(8), Postfix SMTP client +# README FILES +# .ad +# .fi +# Use "\fBpostconf readme_directory\fR" or +# "\fBpostconf html_directory\fR" to locate this information. +# .na +# .nf +# DATABASE_README, Postfix lookup table overview +# ADDRESS_REWRITING_README, address rewriting guide +# LICENSE +# .ad +# .fi +# The Secure Mailer license must be distributed with this software. +# HISTORY +# A genericstable feature appears in the Sendmail MTA. +# +# This feature is available in Postfix 2.2 and later. +# AUTHOR(S) +# Wietse Venema +# IBM T.J. Watson Research +# P.O. Box 704 +# Yorktown Heights, NY 10598, USA +#-- diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 51a8be675..3cd47a66e 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -8248,31 +8248,8 @@ This is needed when the local machine does not have its own Internet domain name, but uses something like localdomain.local instead.

    -

    The table search order is described below. The search terminates -when a match is found. In other words, the search is non-recursive. -

    +

    The table format and lookups are documented in generics(5); +examples are shown in the ADDRESS_REWRITING_README and +STANDARD_CONFIGURATION_README documents.

    -
    - -
    user@domain.tld address
    - -

    Replace user@domain.tld by address. This -form has the highest precedence.

    - -
    user address
    - -

    Replace user@site by address when site is -equal to $myorigin, when site is listed in $mydestination, -or when it matches $inet_interfaces or $proxy_interfaces.

    -
    - -
    @domain.tld address
    - -

    Replace all other addresses in domain.tld by -address. This form has the lowest preference.

    - -
    - -

    In all cases address must specify a username and a -domain.

    This feature is available in Postfix 2.2 and later. -

    +

    This feature is available in Postfix 2.2 and later.

    diff --git a/postfix/proto/relocated b/postfix/proto/relocated index b8f2d148b..6d00ca76c 100644 --- a/postfix/proto/relocated +++ b/postfix/proto/relocated @@ -43,7 +43,9 @@ # .IP \(bu # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# .PP +# TABLE SEARCH ORDER +# .ad +# .fi # With lookups from indexed files such as DB or DBM, or from networked # tables such as NIS, LDAP or SQL, patterns are tried in the order as # listed below: @@ -55,7 +57,7 @@ # when \fIsite\fR is listed in $\fBmydestination\fR, or when \fIsite\fR # is listed in $\fBinet_interfaces\fR or $\fBproxy_interfaces\fR. # .IP @\fIdomain\fR -# Matches every address in \fIdomain\fR. This form has the lowest +# Matches other addresses in \fIdomain\fR. This form has the lowest # precedence. # ADDRESS EXTENSION # .fi diff --git a/postfix/proto/transport b/postfix/proto/transport index 9bd3cf376..cd5179a05 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -65,24 +65,24 @@ # The \fIresult\fR is of the form \fItransport:nexthop\fR and # specifies how or where to deliver mail. This is described in # section "RESULT FORMAT". -# TABLE LOOKUP +# TABLE SEARCH ORDER # .ad # .fi # With lookups from indexed files such as DB or DBM, or from networked # tables such as NIS, LDAP or SQL, patterns are tried in the order as # listed below: # .IP "\fIuser+extension@domain transport\fR:\fInexthop\fR" -# Mail for \fIuser+extension@domain\fR is delivered through +# Deliver mail for \fIuser+extension@domain\fR through # \fItransport\fR to # \fInexthop\fR. # .IP "\fIuser@domain transport\fR:\fInexthop\fR" -# Mail for \fIuser@domain\fR is delivered through \fItransport\fR to +# Deliver mail for \fIuser@domain\fR through \fItransport\fR to # \fInexthop\fR. # .IP "\fIdomain transport\fR:\fInexthop\fR" -# Mail for \fIdomain\fR is delivered through \fItransport\fR to +# Deliver mail for \fIdomain\fR through \fItransport\fR to # \fInexthop\fR. # .IP "\fI.domain transport\fR:\fInexthop\fR" -# Mail for any subdomain of \fIdomain\fR is delivered through +# Deliver mail for any subdomain of \fIdomain\fR through # \fItransport\fR to \fInexthop\fR. This applies only when the # string \fBtransport_maps\fR is not listed in the # \fBparent_domain_matches_subdomains\fR configuration setting. diff --git a/postfix/proto/virtual b/postfix/proto/virtual index 01a3d381a..03759f435 100644 --- a/postfix/proto/virtual +++ b/postfix/proto/virtual @@ -59,15 +59,17 @@ # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# .PP +# TABLE SEARCH ORDER +# .ad +# .fi # With lookups from indexed files such as DB or DBM, or from networked # tables such as NIS, LDAP or SQL, patterns are tried in the order as # listed below: # .IP "\fIuser\fR@\fIdomain address, address, ...\fR" -# Mail for \fIuser\fR@\fIdomain\fR is redirected to \fIaddress\fR. +# Redirect mail for \fIuser\fR@\fIdomain\fR to \fIaddress\fR. # This form has the highest precedence. # .IP "\fIuser address, address, ...\fR" -# Mail for \fIuser\fR@\fIsite\fR is redirected to \fIaddress\fR when +# Redirect mail for \fIuser\fR@\fIsite\fR to \fIaddress\fR when # \fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in # $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR # or $\fBproxy_interfaces\fR. @@ -76,7 +78,7 @@ # \fIaliases\fR(5) database. The difference is that \fBvirtual\fR(5) # mapping can be applied to non-local addresses. # .IP "@\fIdomain address, address, ...\fR" -# Mail for any user in \fIdomain\fR is redirected to \fIaddress\fR. +# Redirect mail for other users in \fIdomain\fR to \fIaddress\fR. # This form has the lowest precedence. # .PP # In all the above forms, when \fIaddress\fR has the form @@ -201,7 +203,7 @@ # A list of address rewriting or forwarding mechanisms that propagate # an address extension from the original address to the result. # Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR, -# \fBforward\fR, or \fBinclude\fR. +# \fBforward\fR, \fBinclude\fR, or \fBgenerics\fR. # .PP # Other parameters of interest: # .IP \fBinet_interfaces\fR diff --git a/postfix/src/cleanup/cleanup_message.c b/postfix/src/cleanup/cleanup_message.c index 7a813eb5d..cdf6840a8 100644 --- a/postfix/src/cleanup/cleanup_message.c +++ b/postfix/src/cleanup/cleanup_message.c @@ -278,6 +278,7 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf, { const char *optional_text = value + strcspn(value, " \t"); int command_len = optional_text - value; + VSTRING *bp; while (*optional_text && ISSPACE(*optional_text)) optional_text++; @@ -341,15 +342,22 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf, if (STREQUAL(value, "REPLACE", command_len)) { if (*optional_text == 0) { msg_warn("REPLACE action without text in %s map", map_class); - } else if (strcmp(context, CLEANUP_ACT_CTXT_HEADER) == 0 - && !is_header(optional_text)) { - msg_warn("bad REPLACE header text \"%s\" in %s map, " - "need \"headername: headervalue\"", - optional_text, map_class); + return (CLEANUP_ACT_KEEP); + } else if (strcmp(context, CLEANUP_ACT_CTXT_HEADER) == 0) { + if (!is_header(optional_text)) { + msg_warn("bad REPLACE header text \"%s\" in %s map, " + "need \"headername: headervalue\"", + optional_text, map_class); + return (CLEANUP_ACT_KEEP); + } + /* XXX Impedance mismatch. */ + bp = vstring_strcpy(vstring_alloc(100), optional_text); + cleanup_out_header(state, bp); + vstring_free(bp); } else { - cleanup_act_log(state, "replace", context, buf, optional_text); cleanup_out_string(state, REC_TYPE_NORM, optional_text); } + cleanup_act_log(state, "replace", context, buf, optional_text); return (CLEANUP_ACT_DROP); } if (STREQUAL(value, "REDIRECT", command_len)) { diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 83f273542..06af3306e 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only. */ -#define MAIL_RELEASE_DATE "20050206" +#define MAIL_RELEASE_DATE "20050207" #define MAIL_VERSION_NUMBER "2.2" #define VAR_MAIL_VERSION "mail_version" diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index 03f320ab8..68efdc25b 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -149,12 +149,15 @@ /* postalias(1), create/update/query alias database /* postcat(1), examine Postfix queue file /* postconf(1), Postfix configuration utility +/* postfix(1), Postfix control program /* postkick(1), trigger Postfix daemon /* postlock(1), Postfix-compatible locking /* postlog(1), Postfix-compatible logging /* postmap(1), Postfix lookup table manager /* postqueue(1), Postfix mail queue control /* postsuper(1), Postfix housekeeping +/* mailq(1), Sendmail compatibility interface +/* newaliases(1), Sendmail compatibility interface /* sendmail(1), Sendmail compatibility interface /* /* Postfix configuration: @@ -164,8 +167,9 @@ /* Table-driven mechanisms: /* access(5), Postfix SMTP access control table /* aliases(5), Postfix alias database -/* header_checks(5), body_checks(5), content inspection -/* canonical(5), Postfix address rewriting +/* canonical(5), Postfix input address rewriting +/* generics(5), Postfix output address rewriting +/* header_checks(5), body_checks(5), Postfix content inspection /* relocated(5), Users that have moved /* transport(5), Postfix routing table /* virtual(5), Postfix virtual aliasing