generic revision 1.1.1.4 1 1.1 tron # GENERIC(5) GENERIC(5)
2 1.1 tron #
3 1.1 tron # NAME
4 1.1 tron # generic - Postfix generic table format
5 1.1 tron #
6 1.1 tron # SYNOPSIS
7 1.1 tron # postmap /etc/postfix/generic
8 1.1 tron #
9 1.1 tron # postmap -q "string" /etc/postfix/generic
10 1.1 tron #
11 1.1 tron # postmap -q - /etc/postfix/generic <inputfile
12 1.1 tron #
13 1.1 tron # DESCRIPTION
14 1.1 tron # The optional generic(5) table specifies an address mapping
15 1.1 tron # that applies when mail is delivered. This is the opposite
16 1.1 tron # of canonical(5) mapping, which applies when mail is
17 1.1 tron # received.
18 1.1 tron #
19 1.1 tron # Typically, one would use the generic(5) table on a system
20 1.1 tron # that does not have a valid Internet domain name and that
21 1.1 tron # uses something like localdomain.local instead. The
22 1.1 tron # generic(5) table is then used by the smtp(8) client to
23 1.1 tron # transform local mail addresses into valid Internet mail
24 1.1 tron # addresses when mail has to be sent across the Internet.
25 1.1 tron # See the EXAMPLE section at the end of this document.
26 1.1 tron #
27 1.1 tron # The generic(5) mapping affects both message header
28 1.1 tron # addresses (i.e. addresses that appear inside messages) and
29 1.1 tron # message envelope addresses (for example, the addresses
30 1.1 tron # that are used in SMTP protocol commands).
31 1.1 tron #
32 1.1 tron # Normally, the generic(5) table is specified as a text file
33 1.1 tron # that serves as input to the postmap(1) command. The
34 1.1 tron # result, an indexed file in dbm or db format, is used for
35 1.1 tron # fast searching by the mail system. Execute the command
36 1.1 tron # "postmap /etc/postfix/generic" to rebuild an indexed file
37 1.1 tron # after changing the corresponding text file.
38 1.1 tron #
39 1.1 tron # When the table is provided via other means such as NIS,
40 1.1 tron # LDAP or SQL, the same lookups are done as for ordinary
41 1.1 tron # indexed files.
42 1.1 tron #
43 1.1.1.2 christos # Alternatively, the table can be provided as a regu-
44 1.1.1.2 christos # lar-expression map where patterns are given as regular
45 1.1.1.4 christos # expressions, or lookups can be directed to a TCP-based
46 1.1.1.4 christos # server. In those cases, the lookups are done in a slightly
47 1.1.1.2 christos # different way as described below under "REGULAR EXPRESSION
48 1.1.1.2 christos # TABLES" or "TCP-BASED TABLES".
49 1.1 tron #
50 1.1 tron # CASE FOLDING
51 1.1 tron # The search string is folded to lowercase before database
52 1.1 tron # lookup. As of Postfix 2.3, the search string is not case
53 1.1 tron # folded with database types such as regexp: or pcre: whose
54 1.1 tron # lookup fields can match both upper and lower case.
55 1.1 tron #
56 1.1 tron # TABLE FORMAT
57 1.1 tron # The input format for the postmap(1) command is as follows:
58 1.1 tron #
59 1.1 tron # pattern result
60 1.1 tron # When pattern matches a mail address, replace it by
61 1.1 tron # the corresponding result.
62 1.1 tron #
63 1.1 tron # blank lines and comments
64 1.1 tron # Empty lines and whitespace-only lines are ignored,
65 1.1 tron # as are lines whose first non-whitespace character
66 1.1 tron # is a `#'.
67 1.1 tron #
68 1.1 tron # multi-line text
69 1.1 tron # A logical line starts with non-whitespace text. A
70 1.1 tron # line that starts with whitespace continues a logi-
71 1.1 tron # cal line.
72 1.1 tron #
73 1.1 tron # TABLE SEARCH ORDER
74 1.1 tron # With lookups from indexed files such as DB or DBM, or from
75 1.1.1.3 christos # networked tables such as NIS, LDAP or SQL, each
76 1.1.1.3 christos # user@domain query produces a sequence of query patterns as
77 1.1.1.3 christos # described below.
78 1.1.1.3 christos #
79 1.1.1.3 christos # Each query pattern is sent to each specified lookup table
80 1.1.1.3 christos # before trying the next query pattern, until a match is
81 1.1.1.3 christos # found.
82 1.1 tron #
83 1.1 tron # user@domain address
84 1.1.1.3 christos # Replace user@domain by address. This form has the
85 1.1 tron # highest precedence.
86 1.1 tron #
87 1.1 tron # user address
88 1.1.1.3 christos # Replace user@site by address when site is equal to
89 1.1.1.3 christos # $myorigin, when site is listed in $mydestination,
90 1.1.1.3 christos # or when it is listed in $inet_interfaces or
91 1.1 tron # $proxy_interfaces.
92 1.1 tron #
93 1.1 tron # @domain address
94 1.1 tron # Replace other addresses in domain by address. This
95 1.1 tron # form has the lowest precedence.
96 1.1 tron #
97 1.1 tron # RESULT ADDRESS REWRITING
98 1.1 tron # The lookup result is subject to address rewriting:
99 1.1 tron #
100 1.1.1.3 christos # o When the result has the form @otherdomain, the
101 1.1 tron # result becomes the same user in otherdomain.
102 1.1 tron #
103 1.1.1.3 christos # o When "append_at_myorigin=yes", append "@$myorigin"
104 1.1 tron # to addresses without "@domain".
105 1.1 tron #
106 1.1 tron # o When "append_dot_mydomain=yes", append ".$mydomain"
107 1.1 tron # to addresses without ".domain".
108 1.1 tron #
109 1.1 tron # ADDRESS EXTENSION
110 1.1 tron # When a mail address localpart contains the optional recip-
111 1.1.1.3 christos # ient delimiter (e.g., user+foo@domain), the lookup order
112 1.1 tron # becomes: user+foo@domain, user@domain, user+foo, user, and
113 1.1 tron # @domain.
114 1.1 tron #
115 1.1.1.3 christos # The propagate_unmatched_extensions parameter controls
116 1.1.1.3 christos # whether an unmatched address extension (+foo) is propa-
117 1.1 tron # gated to the result of table lookup.
118 1.1 tron #
119 1.1 tron # REGULAR EXPRESSION TABLES
120 1.1.1.3 christos # This section describes how the table lookups change when
121 1.1 tron # the table is given in the form of regular expressions. For
122 1.1.1.3 christos # a description of regular expression lookup table syntax,
123 1.1 tron # see regexp_table(5) or pcre_table(5).
124 1.1 tron #
125 1.1.1.3 christos # Each pattern is a regular expression that is applied to
126 1.1 tron # the entire address being looked up. Thus, user@domain mail
127 1.1.1.3 christos # addresses are not broken up into their user and @domain
128 1.1 tron # constituent parts, nor is user+foo broken up into user and
129 1.1 tron # foo.
130 1.1 tron #
131 1.1.1.3 christos # Patterns are applied in the order as specified in the ta-
132 1.1.1.3 christos # ble, until a pattern is found that matches the search
133 1.1 tron # string.
134 1.1 tron #
135 1.1.1.3 christos # Results are the same as with indexed file lookups, with
136 1.1.1.3 christos # the additional feature that parenthesized substrings from
137 1.1 tron # the pattern can be interpolated as $1, $2 and so on.
138 1.1 tron #
139 1.1 tron # TCP-BASED TABLES
140 1.1.1.3 christos # This section describes how the table lookups change when
141 1.1 tron # lookups are directed to a TCP-based server. For a descrip-
142 1.1 tron # tion of the TCP client/server lookup protocol, see tcp_ta-
143 1.1.1.4 christos # ble(5). This feature is available in Postfix 2.5 and
144 1.1.1.4 christos # later.
145 1.1 tron #
146 1.1 tron # Each lookup operation uses the entire address once. Thus,
147 1.1.1.3 christos # user@domain mail addresses are not broken up into their
148 1.1 tron # user and @domain constituent parts, nor is user+foo broken
149 1.1 tron # up into user and foo.
150 1.1 tron #
151 1.1 tron # Results are the same as with indexed file lookups.
152 1.1 tron #
153 1.1 tron # EXAMPLE
154 1.1.1.3 christos # The following shows a generic mapping with an indexed
155 1.1.1.3 christos # file. When mail is sent to a remote host via SMTP, this
156 1.1.1.3 christos # replaces his (a] localdomain.local by his ISP mail address,
157 1.1.1.3 christos # replaces her (a] localdomain.local by her ISP mail address,
158 1.1.1.3 christos # and replaces other local addresses by his ISP account,
159 1.1.1.3 christos # with an address extension of +local (this example assumes
160 1.1 tron # that the ISP supports "+" style address extensions).
161 1.1 tron #
162 1.1 tron # /etc/postfix/main.cf:
163 1.1 tron # smtp_generic_maps = hash:/etc/postfix/generic
164 1.1 tron #
165 1.1 tron # /etc/postfix/generic:
166 1.1 tron # his (a] localdomain.local hisaccount (a] hisisp.example
167 1.1 tron # her (a] localdomain.local heraccount (a] herisp.example
168 1.1 tron # @localdomain.local hisaccount+local (a] hisisp.example
169 1.1 tron #
170 1.1.1.3 christos # Execute the command "postmap /etc/postfix/generic" when-
171 1.1.1.3 christos # ever the table is changed. Instead of hash, some systems
172 1.1.1.3 christos # use dbm database files. To find out what tables your sys-
173 1.1 tron # tem supports use the command "postconf -m".
174 1.1 tron #
175 1.1 tron # BUGS
176 1.1.1.3 christos # The table format does not understand quoting conventions.
177 1.1 tron #
178 1.1 tron # CONFIGURATION PARAMETERS
179 1.1.1.3 christos # The following main.cf parameters are especially relevant.
180 1.1.1.3 christos # The text below provides only a parameter summary. See
181 1.1 tron # postconf(5) for more details including examples.
182 1.1 tron #
183 1.1.1.4 christos # smtp_generic_maps (empty)
184 1.1.1.4 christos # Optional lookup tables that perform address rewrit-
185 1.1.1.4 christos # ing in the Postfix SMTP client, typically to trans-
186 1.1.1.4 christos # form a locally valid address into a globally valid
187 1.1.1.4 christos # address when sending mail across the Internet.
188 1.1.1.4 christos #
189 1.1.1.4 christos # propagate_unmatched_extensions (canonical, virtual)
190 1.1.1.4 christos # What address lookup tables copy an address exten-
191 1.1.1.4 christos # sion from the lookup key to the lookup result.
192 1.1 tron #
193 1.1 tron # Other parameters of interest:
194 1.1 tron #
195 1.1.1.4 christos # inet_interfaces (all)
196 1.1.1.4 christos # The network interface addresses that this mail sys-
197 1.1.1.4 christos # tem receives mail on.
198 1.1.1.4 christos #
199 1.1.1.4 christos # proxy_interfaces (empty)
200 1.1.1.4 christos # The network interface addresses that this mail sys-
201 1.1.1.4 christos # tem receives mail on by way of a proxy or network
202 1.1.1.4 christos # address translation unit.
203 1.1.1.4 christos #
204 1.1.1.4 christos # mydestination ($myhostname, localhost.$mydomain, local-
205 1.1.1.4 christos # host)
206 1.1.1.4 christos # The list of domains that are delivered via the
207 1.1.1.4 christos # $local_transport mail delivery transport.
208 1.1.1.4 christos #
209 1.1.1.4 christos # myorigin ($myhostname)
210 1.1.1.4 christos # The domain name that locally-posted mail appears to
211 1.1.1.4 christos # come from, and that locally posted mail is deliv-
212 1.1.1.4 christos # ered to.
213 1.1.1.4 christos #
214 1.1.1.4 christos # owner_request_special (yes)
215 1.1.1.4 christos # Enable special treatment for owner-listname entries
216 1.1.1.4 christos # in the aliases(5) file, and don't split owner-list-
217 1.1.1.4 christos # name and listname-request address localparts when
218 1.1.1.4 christos # the recipient_delimiter is set to "-".
219 1.1 tron #
220 1.1 tron # SEE ALSO
221 1.1 tron # postmap(1), Postfix lookup table manager
222 1.1 tron # postconf(5), configuration parameters
223 1.1 tron # smtp(8), Postfix SMTP client
224 1.1 tron #
225 1.1 tron # README FILES
226 1.1.1.3 christos # Use "postconf readme_directory" or "postconf html_direc-
227 1.1 tron # tory" to locate this information.
228 1.1 tron # ADDRESS_REWRITING_README, address rewriting guide
229 1.1 tron # DATABASE_README, Postfix lookup table overview
230 1.1 tron # STANDARD_CONFIGURATION_README, configuration examples
231 1.1 tron #
232 1.1 tron # LICENSE
233 1.1.1.3 christos # The Secure Mailer license must be distributed with this
234 1.1 tron # software.
235 1.1 tron #
236 1.1 tron # HISTORY
237 1.1 tron # A genericstable feature appears in the Sendmail MTA.
238 1.1 tron #
239 1.1 tron # This feature is available in Postfix 2.2 and later.
240 1.1 tron #
241 1.1 tron # AUTHOR(S)
242 1.1 tron # Wietse Venema
243 1.1 tron # IBM T.J. Watson Research
244 1.1 tron # P.O. Box 704
245 1.1 tron # Yorktown Heights, NY 10598, USA
246 1.1 tron #
247 1.1.1.2 christos # Wietse Venema
248 1.1.1.2 christos # Google, Inc.
249 1.1.1.2 christos # 111 8th Avenue
250 1.1.1.2 christos # New York, NY 10011, USA
251 1.1.1.2 christos #
252 1.1 tron # GENERIC(5)
253