141fbaed0Stron#++ 241fbaed0Stron# NAME 341fbaed0Stron# generic 5 441fbaed0Stron# SUMMARY 541fbaed0Stron# Postfix generic table format 641fbaed0Stron# SYNOPSIS 741fbaed0Stron# \fBpostmap /etc/postfix/generic\fR 841fbaed0Stron# 941fbaed0Stron# \fBpostmap -q "\fIstring\fB" /etc/postfix/generic\fR 1041fbaed0Stron# 1141fbaed0Stron# \fBpostmap -q - /etc/postfix/generic <\fIinputfile\fR 1241fbaed0Stron# DESCRIPTION 1341fbaed0Stron# The optional \fBgeneric\fR(5) table specifies an address 1441fbaed0Stron# mapping that applies when mail is delivered. This is the 1541fbaed0Stron# opposite of \fBcanonical\fR(5) mapping, which applies when 1641fbaed0Stron# mail is received. 1741fbaed0Stron# 1841fbaed0Stron# Typically, one would use the \fBgeneric\fR(5) table on a 1941fbaed0Stron# system that does not have a valid Internet domain name and 2041fbaed0Stron# that uses something like \fIlocaldomain.local\fR instead. 2141fbaed0Stron# The \fBgeneric\fR(5) table is then used by the \fBsmtp\fR(8) 2241fbaed0Stron# client to transform local mail addresses into valid Internet 2341fbaed0Stron# mail addresses when mail has to be sent across the Internet. 2441fbaed0Stron# See the EXAMPLE section at the end of this document. 2541fbaed0Stron# 2641fbaed0Stron# The \fBgeneric\fR(5) mapping affects both message header 2741fbaed0Stron# addresses (i.e. addresses that appear inside messages) and 2841fbaed0Stron# message envelope addresses (for example, the addresses that 2941fbaed0Stron# are used in SMTP protocol commands). 3041fbaed0Stron# 3141fbaed0Stron# Normally, the \fBgeneric\fR(5) table is specified as a 3241fbaed0Stron# text file that serves as input to the \fBpostmap\fR(1) 3341fbaed0Stron# command. The result, an indexed file in \fBdbm\fR or 3441fbaed0Stron# \fBdb\fR format, is used for fast searching by the mail 3541fbaed0Stron# system. Execute the command "\fBpostmap /etc/postfix/generic\fR" 3641fbaed0Stron# to rebuild an indexed file after changing the corresponding 3741fbaed0Stron# text file. 3841fbaed0Stron# 3941fbaed0Stron# When the table is provided via other means such as NIS, LDAP 4041fbaed0Stron# or SQL, the same lookups are done as for ordinary indexed files. 4141fbaed0Stron# 4241fbaed0Stron# Alternatively, the table can be provided as a regular-expression 4341fbaed0Stron# map where patterns are given as regular expressions, or lookups 44*4a672054Schristos# can be directed to a TCP-based server. In those cases, the lookups 4541fbaed0Stron# are done in a slightly different way as described below under 4641fbaed0Stron# "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES". 4741fbaed0Stron# CASE FOLDING 4841fbaed0Stron# .ad 4941fbaed0Stron# .fi 5041fbaed0Stron# The search string is folded to lowercase before database 5141fbaed0Stron# lookup. As of Postfix 2.3, the search string is not case 5241fbaed0Stron# folded with database types such as regexp: or pcre: whose 5341fbaed0Stron# lookup fields can match both upper and lower case. 5441fbaed0Stron# TABLE FORMAT 5541fbaed0Stron# .ad 5641fbaed0Stron# .fi 5741fbaed0Stron# The input format for the \fBpostmap\fR(1) command is as follows: 5841fbaed0Stron# .IP "\fIpattern result\fR" 5941fbaed0Stron# When \fIpattern\fR matches a mail address, replace it by the 6041fbaed0Stron# corresponding \fIresult\fR. 6141fbaed0Stron# .IP "blank lines and comments" 6241fbaed0Stron# Empty lines and whitespace-only lines are ignored, as 6341fbaed0Stron# are lines whose first non-whitespace character is a `#'. 6441fbaed0Stron# .IP "multi-line text" 6541fbaed0Stron# A logical line starts with non-whitespace text. A line that 6641fbaed0Stron# starts with whitespace continues a logical line. 6741fbaed0Stron# TABLE SEARCH ORDER 6841fbaed0Stron# .ad 6941fbaed0Stron# .fi 7041fbaed0Stron# With lookups from indexed files such as DB or DBM, or from networked 71f3bc92a4Schristos# tables such as NIS, LDAP or SQL, each \fIuser\fR@\fIdomain\fR 72f3bc92a4Schristos# query produces a sequence of query patterns as described below. 73f3bc92a4Schristos# 74f3bc92a4Schristos# Each query pattern is sent to each specified lookup table 75f3bc92a4Schristos# before trying the next query pattern, until a match is 76f3bc92a4Schristos# found. 7741fbaed0Stron# .IP "\fIuser\fR@\fIdomain address\fR" 7841fbaed0Stron# Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form 7941fbaed0Stron# has the highest precedence. 8041fbaed0Stron# .IP "\fIuser address\fR" 8141fbaed0Stron# Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is 8241fbaed0Stron# equal to $\fBmyorigin\fR, when \fIsite\fR is listed in 8341fbaed0Stron# $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR 8441fbaed0Stron# or $\fBproxy_interfaces\fR. 8541fbaed0Stron# .IP "@\fIdomain address\fR" 8641fbaed0Stron# Replace other addresses in \fIdomain\fR by \fIaddress\fR. 8741fbaed0Stron# This form has the lowest precedence. 8841fbaed0Stron# RESULT ADDRESS REWRITING 8941fbaed0Stron# .ad 9041fbaed0Stron# .fi 9141fbaed0Stron# The lookup result is subject to address rewriting: 9241fbaed0Stron# .IP \(bu 9341fbaed0Stron# When the result has the form @\fIotherdomain\fR, the 9441fbaed0Stron# result becomes the same \fIuser\fR in \fIotherdomain\fR. 9541fbaed0Stron# .IP \(bu 9641fbaed0Stron# When "\fBappend_at_myorigin=yes\fR", append "\fB@$myorigin\fR" 9741fbaed0Stron# to addresses without "@domain". 9841fbaed0Stron# .IP \(bu 9941fbaed0Stron# When "\fBappend_dot_mydomain=yes\fR", append 10041fbaed0Stron# "\fB.$mydomain\fR" to addresses without ".domain". 10141fbaed0Stron# ADDRESS EXTENSION 10241fbaed0Stron# .fi 10341fbaed0Stron# .ad 10441fbaed0Stron# When a mail address localpart contains the optional recipient delimiter 10541fbaed0Stron# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: 10641fbaed0Stron# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, 10741fbaed0Stron# \fIuser\fR, and @\fIdomain\fR. 10841fbaed0Stron# 10941fbaed0Stron# The \fBpropagate_unmatched_extensions\fR parameter controls whether 11041fbaed0Stron# an unmatched address extension (\fI+foo\fR) is propagated to the 11141fbaed0Stron# result of table lookup. 11241fbaed0Stron# REGULAR EXPRESSION TABLES 11341fbaed0Stron# .ad 11441fbaed0Stron# .fi 11541fbaed0Stron# This section describes how the table lookups change when the table 11641fbaed0Stron# is given in the form of regular expressions. For a description of 11741fbaed0Stron# regular expression lookup table syntax, see \fBregexp_table\fR(5) 11841fbaed0Stron# or \fBpcre_table\fR(5). 11941fbaed0Stron# 12041fbaed0Stron# Each pattern is a regular expression that is applied to the entire 12141fbaed0Stron# address being looked up. Thus, \fIuser@domain\fR mail addresses are not 12241fbaed0Stron# broken up into their \fIuser\fR and \fI@domain\fR constituent parts, 12341fbaed0Stron# nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. 12441fbaed0Stron# 12541fbaed0Stron# Patterns are applied in the order as specified in the table, until a 12641fbaed0Stron# pattern is found that matches the search string. 12741fbaed0Stron# 12841fbaed0Stron# Results are the same as with indexed file lookups, with 12941fbaed0Stron# the additional feature that parenthesized substrings from the 13041fbaed0Stron# pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. 13141fbaed0Stron# TCP-BASED TABLES 13241fbaed0Stron# .ad 13341fbaed0Stron# .fi 13441fbaed0Stron# This section describes how the table lookups change when lookups 13541fbaed0Stron# are directed to a TCP-based server. For a description of the TCP 13641fbaed0Stron# client/server lookup protocol, see \fBtcp_table\fR(5). 137*4a672054Schristos# This feature is available in Postfix 2.5 and later. 13841fbaed0Stron# 13941fbaed0Stron# Each lookup operation uses the entire address once. Thus, 14041fbaed0Stron# \fIuser@domain\fR mail addresses are not broken up into their 14141fbaed0Stron# \fIuser\fR and \fI@domain\fR constituent parts, nor is 14241fbaed0Stron# \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. 14341fbaed0Stron# 14441fbaed0Stron# Results are the same as with indexed file lookups. 14541fbaed0Stron# EXAMPLE 14641fbaed0Stron# .ad 14741fbaed0Stron# .fi 14841fbaed0Stron# The following shows a generic mapping with an indexed file. 14941fbaed0Stron# When mail is sent to a remote host via SMTP, this replaces 15041fbaed0Stron# \fIhis@localdomain.local\fR by his ISP mail address, replaces 15141fbaed0Stron# \fIher@localdomain.local\fR by her ISP mail address, and 15241fbaed0Stron# replaces other local addresses by his ISP account, with 15341fbaed0Stron# an address extension of \fI+local\fR (this example assumes 15441fbaed0Stron# that the ISP supports "+" style address extensions). 15541fbaed0Stron# 15641fbaed0Stron# .na 15741fbaed0Stron# .nf 15841fbaed0Stron# /etc/postfix/main.cf: 15941fbaed0Stron# smtp_generic_maps = hash:/etc/postfix/generic 16041fbaed0Stron# 16141fbaed0Stron# /etc/postfix/generic: 16241fbaed0Stron# his@localdomain.local hisaccount@hisisp.example 16341fbaed0Stron# her@localdomain.local heraccount@herisp.example 16441fbaed0Stron# @localdomain.local hisaccount+local@hisisp.example 16541fbaed0Stron# 16641fbaed0Stron# .ad 16741fbaed0Stron# .fi 16841fbaed0Stron# Execute the command "\fBpostmap /etc/postfix/generic\fR" 16941fbaed0Stron# whenever the table is changed. Instead of \fBhash\fR, some 17041fbaed0Stron# systems use \fBdbm\fR database files. To find out what 17141fbaed0Stron# tables your system supports use the command "\fBpostconf 17241fbaed0Stron# -m\fR". 17341fbaed0Stron# BUGS 17441fbaed0Stron# The table format does not understand quoting conventions. 17541fbaed0Stron# CONFIGURATION PARAMETERS 17641fbaed0Stron# .ad 17741fbaed0Stron# .fi 17841fbaed0Stron# The following \fBmain.cf\fR parameters are especially relevant. 17941fbaed0Stron# The text below provides only a parameter summary. See 18041fbaed0Stron# \fBpostconf\fR(5) for more details including examples. 181*4a672054Schristos# .IP "\fBsmtp_generic_maps (empty)\fR" 182*4a672054Schristos# Optional lookup tables that perform address rewriting in the 183*4a672054Schristos# Postfix SMTP client, typically to transform a locally valid address into 184*4a672054Schristos# a globally valid address when sending mail across the Internet. 185*4a672054Schristos# .IP "\fBpropagate_unmatched_extensions (canonical, virtual)\fR" 186*4a672054Schristos# What address lookup tables copy an address extension from the lookup 187*4a672054Schristos# key to the lookup result. 18841fbaed0Stron# .PP 18941fbaed0Stron# Other parameters of interest: 190*4a672054Schristos# .IP "\fBinet_interfaces (all)\fR" 191*4a672054Schristos# The network interface addresses that this mail system receives 192*4a672054Schristos# mail on. 193*4a672054Schristos# .IP "\fBproxy_interfaces (empty)\fR" 194*4a672054Schristos# The network interface addresses that this mail system receives mail 195*4a672054Schristos# on by way of a proxy or network address translation unit. 196*4a672054Schristos# .IP "\fBmydestination ($myhostname, localhost.$mydomain, localhost)\fR" 197*4a672054Schristos# The list of domains that are delivered via the $local_transport 198*4a672054Schristos# mail delivery transport. 199*4a672054Schristos# .IP "\fBmyorigin ($myhostname)\fR" 200*4a672054Schristos# The domain name that locally-posted mail appears to come 201*4a672054Schristos# from, and that locally posted mail is delivered to. 202*4a672054Schristos# .IP "\fBowner_request_special (yes)\fR" 203*4a672054Schristos# Enable special treatment for owner-\fIlistname\fR entries in the 204*4a672054Schristos# \fBaliases\fR(5) file, and don't split owner-\fIlistname\fR and 205*4a672054Schristos# \fIlistname\fR-request address localparts when the recipient_delimiter 206*4a672054Schristos# is set to "-". 20741fbaed0Stron# SEE ALSO 20841fbaed0Stron# postmap(1), Postfix lookup table manager 20941fbaed0Stron# postconf(5), configuration parameters 21041fbaed0Stron# smtp(8), Postfix SMTP client 21141fbaed0Stron# README FILES 21241fbaed0Stron# .ad 21341fbaed0Stron# .fi 21441fbaed0Stron# Use "\fBpostconf readme_directory\fR" or 21541fbaed0Stron# "\fBpostconf html_directory\fR" to locate this information. 21641fbaed0Stron# .na 21741fbaed0Stron# .nf 21841fbaed0Stron# ADDRESS_REWRITING_README, address rewriting guide 21941fbaed0Stron# DATABASE_README, Postfix lookup table overview 22041fbaed0Stron# STANDARD_CONFIGURATION_README, configuration examples 22141fbaed0Stron# LICENSE 22241fbaed0Stron# .ad 22341fbaed0Stron# .fi 22441fbaed0Stron# The Secure Mailer license must be distributed with this software. 22541fbaed0Stron# HISTORY 22641fbaed0Stron# A genericstable feature appears in the Sendmail MTA. 22741fbaed0Stron# 22841fbaed0Stron# This feature is available in Postfix 2.2 and later. 22941fbaed0Stron# AUTHOR(S) 23041fbaed0Stron# Wietse Venema 23141fbaed0Stron# IBM T.J. Watson Research 23241fbaed0Stron# P.O. Box 704 23341fbaed0Stron# Yorktown Heights, NY 10598, USA 234e262b48eSchristos# 235e262b48eSchristos# Wietse Venema 236e262b48eSchristos# Google, Inc. 237e262b48eSchristos# 111 8th Avenue 238e262b48eSchristos# New York, NY 10011, USA 23941fbaed0Stron#-- 240