xref: /netbsd-src/external/ibm-public/postfix/dist/html/canonical.5.html (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3<html> <head>
4<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
5<title> Postfix manual - canonical(5) </title>
6</head> <body> <pre>
7CANONICAL(5)                                                      CANONICAL(5)
8
9<b>NAME</b>
10       canonical - Postfix canonical table format
11
12<b>SYNOPSIS</b>
13       <b>postmap /etc/postfix/canonical</b>
14
15       <b>postmap -q "</b><i>string</i><b>" /etc/postfix/canonical</b>
16
17       <b>postmap -q - /etc/postfix/canonical</b> &lt;<i>inputfile</i>
18
19<b>DESCRIPTION</b>
20       The  optional <a href="canonical.5.html"><b>canonical</b>(5)</a> table specifies an address mapping for local
21       and non-local addresses. The mapping is used by the <a href="cleanup.8.html"><b>cleanup</b>(8)</a>  daemon,
22       before  mail  is  stored into the queue.  The address mapping is recur-
23       sive.
24
25       Normally, the <a href="canonical.5.html"><b>canonical</b>(5)</a> table is  specified  as  a  text  file  that
26       serves as input to the <a href="postmap.1.html"><b>postmap</b>(1)</a> command.  The result, an indexed file
27       in <b>dbm</b> or <b>db</b> format, is used for fast searching  by  the  mail  system.
28       Execute  the  command  "<b>postmap  /etc/postfix/canonical</b>"  to rebuild an
29       indexed file after changing the corresponding text file.
30
31       When the table is provided via other means such as NIS,  LDAP  or  SQL,
32       the same lookups are done as for ordinary indexed files.
33
34       Alternatively,  the  table  can be provided as a regular-expression map
35       where patterns are given as regular  expressions,  or  lookups  can  be
36       directed to TCP-based server. In those cases, the lookups are done in a
37       slightly different way as described  below  under  "REGULAR  EXPRESSION
38       TABLES" or "TCP-BASED TABLES".
39
40       By  default  the  <a href="canonical.5.html"><b>canonical</b>(5)</a>  mapping  affects  both  message  header
41       addresses (i.e. addresses that  appear  inside  messages)  and  message
42       envelope  addresses  (for  example, the addresses that are used in SMTP
43       protocol commands).  This  is  controlled  with  the  <b><a href="postconf.5.html#canonical_classes">canonical_classes</a></b>
44       parameter.
45
46       NOTE:  Postfix  versions  2.2  and  later  rewrite message headers from
47       remote SMTP clients only if the  client  matches  the  <a href="postconf.5.html#local_header_rewrite_clients">local_header_re</a>-
48       <a href="postconf.5.html#local_header_rewrite_clients">write_clients</a> parameter, or if the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> config-
49       uration parameter specifies a non-empty  value.  To  get  the  behavior
50       before    Postfix    2.2,   specify   "<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a>   =
51       <a href="DATABASE_README.html#types">static</a>:all".
52
53       Typically, one would use the <a href="canonical.5.html"><b>canonical</b>(5)</a> table to replace login  names
54       by <i>Firstname.Lastname</i>, or to clean up addresses produced by legacy mail
55       systems.
56
57       The <a href="canonical.5.html"><b>canonical</b>(5)</a> mapping is not to be confused with <i>virtual alias</i>  sup-
58       port  or  with  local  aliasing.  To change the destination but not the
59       headers, use the <a href="virtual.5.html"><b>virtual</b>(5)</a> or <a href="aliases.5.html"><b>aliases</b>(5)</a> map instead.
60
61<b>CASE FOLDING</b>
62       The search string is folded to lowercase before database lookup. As  of
63       Postfix  2.3,  the search string is not case folded with database types
64       such as <a href="regexp_table.5.html">regexp</a>: or <a href="pcre_table.5.html">pcre</a>: whose lookup fields can match both  upper  and
65       lower case.
66
67<b>TABLE FORMAT</b>
68       The input format for the <a href="postmap.1.html"><b>postmap</b>(1)</a> command is as follows:
69
70       <i>pattern address</i>
71              When  <i>pattern</i>  matches  a mail address, replace it by the corre-
72              sponding <i>address</i>.
73
74       blank lines and comments
75              Empty lines and whitespace-only lines are ignored, as are  lines
76              whose first non-whitespace character is a `#'.
77
78       multi-line text
79              A  logical  line  starts  with  non-whitespace text. A line that
80              starts with whitespace continues a logical line.
81
82<b>TABLE SEARCH ORDER</b>
83       With lookups from indexed files such as DB or DBM,  or  from  networked
84       tables  such  as  NIS,  LDAP or SQL, patterns are tried in the order as
85       listed below:
86
87       <i>user</i>@<i>domain address</i>
88              Replace <i>user</i>@<i>domain</i> by <i>address</i>. This form has the highest prece-
89              dence.
90
91              This  is  useful  to  clean up addresses produced by legacy mail
92              systems.  It can also  be  used  to  produce  <i>Firstname.Lastname</i>
93              style addresses, but see below for a simpler solution.
94
95       <i>user address</i>
96              Replace  <i>user</i>@<i>site</i>  by  <i>address</i> when <i>site</i> is equal to $<b><a href="postconf.5.html#myorigin">myorigin</a></b>,
97              when <i>site</i> is listed in $<b><a href="postconf.5.html#mydestination">mydestination</a></b>, or when it is  listed  in
98              $<b><a href="postconf.5.html#inet_interfaces">inet_interfaces</a></b> or $<b><a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a></b>.
99
100              This form is useful for replacing login names by <i>Firstname.Last-</i>
101              <i>name</i>.
102
103       @<i>domain address</i>
104              Replace other addresses in <i>domain</i> by <i>address</i>.  This form has the
105              lowest precedence.
106
107              Note:  @<i>domain</i>  is  a  wild-card.  When  this form is applied to
108              recipient addresses, the Postfix SMTP server  accepts  mail  for
109              any  recipient  in  <i>domain</i>, regardless of whether that recipient
110              exists.  This may turn  your  mail  system  into  a  backscatter
111              source:  Postfix  first accepts mail for non-existent recipients
112              and then tries to return that mail  as  "undeliverable"  to  the
113              often forged sender address.
114
115<b>RESULT ADDRESS REWRITING</b>
116       The lookup result is subject to address rewriting:
117
118       <b>o</b>      When  the  result  has the form @<i>otherdomain</i>, the result becomes
119              the same <i>user</i> in <i>otherdomain</i>.
120
121       <b>o</b>      When "<b><a href="postconf.5.html#append_at_myorigin">append_at_myorigin</a>=yes</b>", append "<b>@$<a href="postconf.5.html#myorigin">myorigin</a></b>" to  addresses
122              without "@domain".
123
124       <b>o</b>      When "<b><a href="postconf.5.html#append_dot_mydomain">append_dot_mydomain</a>=yes</b>", append "<b>.$<a href="postconf.5.html#mydomain">mydomain</a></b>" to addresses
125              without ".domain".
126
127<b>ADDRESS EXTENSION</b>
128       When a mail address localpart contains the optional recipient delimiter
129       (e.g.,  <i>user+foo</i>@<i>domain</i>),  the  lookup  order becomes: <i>user+foo</i>@<i>domain</i>,
130       <i>user</i>@<i>domain</i>, <i>user+foo</i>, <i>user</i>, and @<i>domain</i>.
131
132       The  <b><a href="postconf.5.html#propagate_unmatched_extensions">propagate_unmatched_extensions</a></b>  parameter  controls   whether   an
133       unmatched address extension (<i>+foo</i>) is propagated to the result of table
134       lookup.
135
136<b>REGULAR EXPRESSION TABLES</b>
137       This section describes how the table lookups change when the  table  is
138       given  in the form of regular expressions. For a description of regular
139       expression lookup table syntax, see <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a> or <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>.
140
141       Each pattern is a regular expression that  is  applied  to  the  entire
142       address  being looked up. Thus, <i>user@domain</i> mail addresses are not bro-
143       ken up into their <i>user</i> and <i>@domain</i> constituent parts, nor  is  <i>user+foo</i>
144       broken up into <i>user</i> and <i>foo</i>.
145
146       Patterns  are  applied  in the order as specified in the table, until a
147       pattern is found that matches the search string.
148
149       Results are the same as with indexed file lookups, with the  additional
150       feature  that parenthesized substrings from the pattern can be interpo-
151       lated as <b>$1</b>, <b>$2</b> and so on.
152
153<b>TCP-BASED TABLES</b>
154       This section describes how the table lookups change  when  lookups  are
155       directed   to  a  TCP-based  server.  For  a  description  of  the  TCP
156       client/server lookup protocol, see <a href="tcp_table.5.html"><b>tcp_table</b>(5)</a>.  This feature  is  not
157       available up to and including Postfix version 2.4.
158
159       Each  lookup operation uses the entire address once.  Thus, <i>user@domain</i>
160       mail addresses are not broken up  into  their  <i>user</i>  and  <i>@domain</i>  con-
161       stituent parts, nor is <i>user+foo</i> broken up into <i>user</i> and <i>foo</i>.
162
163       Results are the same as with indexed file lookups.
164
165<b>BUGS</b>
166       The table format does not understand quoting conventions.
167
168<b>CONFIGURATION PARAMETERS</b>
169       The  following  <a href="postconf.5.html"><b>main.cf</b></a>  parameters  are especially relevant.  The text
170       below provides only a  parameter  summary.  See  <a href="postconf.5.html"><b>postconf</b>(5)</a>  for  more
171       details including examples.
172
173       <b><a href="postconf.5.html#canonical_classes">canonical_classes</a></b>
174              What addresses are subject to canonical address mapping.
175
176       <b><a href="postconf.5.html#canonical_maps">canonical_maps</a></b>
177              List of canonical mapping tables.
178
179       <b><a href="postconf.5.html#recipient_canonical_maps">recipient_canonical_maps</a></b>
180              Address  mapping  lookup table for envelope and header recipient
181              addresses.
182
183       <b><a href="postconf.5.html#sender_canonical_maps">sender_canonical_maps</a></b>
184              Address mapping lookup table  for  envelope  and  header  sender
185              addresses.
186
187       <b><a href="postconf.5.html#propagate_unmatched_extensions">propagate_unmatched_extensions</a></b>
188              A list of address rewriting or forwarding mechanisms that propa-
189              gate an address extension  from  the  original  address  to  the
190              result.  Specify zero or more of <b>canonical</b>, <b>virtual</b>, <b>alias</b>, <b>for-</b>
191              <b>ward</b>, <b>include</b>, or <b>generic</b>.
192
193       Other parameters of interest:
194
195       <b><a href="postconf.5.html#inet_interfaces">inet_interfaces</a></b>
196              The network interface addresses that this system  receives  mail
197              on.   You  need  to  stop  and start Postfix when this parameter
198              changes.
199
200       <b><a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a></b>
201              Rewrite message header addresses in mail from these clients  and
202              update incomplete addresses with the domain name in $<a href="postconf.5.html#myorigin">myorigin</a> or
203              $<a href="postconf.5.html#mydomain">mydomain</a>; either  don't  rewrite  message  headers  from  other
204              clients at all, or rewrite message headers and update incomplete
205              addresses with the domain  specified  in  the  <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_re</a>-
206              <a href="postconf.5.html#remote_header_rewrite_domain">write_domain</a> parameter.
207
208       <b><a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a></b>
209              Other  interfaces that this machine receives mail on by way of a
210              proxy agent or network address translator.
211
212       <b><a href="postconf.5.html#masquerade_classes">masquerade_classes</a></b>
213              List of address classes subject to masquerading: zero or more of
214              <b>envelope_sender</b>,        <b>envelope_recipient</b>,       <b>header_sender</b>,
215              <b>header_recipient</b>.
216
217       <b><a href="postconf.5.html#masquerade_domains">masquerade_domains</a></b>
218              List of domains that hide their subdomain structure.
219
220       <b><a href="postconf.5.html#masquerade_exceptions">masquerade_exceptions</a></b>
221              List of user names that are not subject to address masquerading.
222
223       <b><a href="postconf.5.html#mydestination">mydestination</a></b>
224              List of domains that this mail system considers local.
225
226       <b><a href="postconf.5.html#myorigin">myorigin</a></b>
227              The domain that is appended to locally-posted mail.
228
229       <b><a href="postconf.5.html#owner_request_special">owner_request_special</a></b>
230              Give special treatment to <b>owner-</b><i>xxx</i> and <i>xxx</i><b>-request</b> addresses.
231
232       <b><a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a></b>
233              Don't  rewrite  message  headers from remote clients at all when
234              this parameter is empty; otherwise, rewrite message headers  and
235              append the specified domain name to incomplete addresses.
236
237<b>SEE ALSO</b>
238       <a href="cleanup.8.html">cleanup(8)</a>, canonicalize and enqueue mail
239       <a href="postmap.1.html">postmap(1)</a>, Postfix lookup table manager
240       <a href="postconf.5.html">postconf(5)</a>, configuration parameters
241       <a href="virtual.5.html">virtual(5)</a>, virtual aliasing
242
243<b>README FILES</b>
244       <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
245       <a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a>, address rewriting guide
246
247<b>LICENSE</b>
248       The Secure Mailer license must be distributed with this software.
249
250<b>AUTHOR(S)</b>
251       Wietse Venema
252       IBM T.J. Watson Research
253       P.O. Box 704
254       Yorktown Heights, NY 10598, USA
255
256                                                                  CANONICAL(5)
257</pre> </body> </html>
258