1#++ 2# NAME 3# virtual 5 4# SUMMARY 5# Postfix virtual alias table format 6# SYNOPSIS 7# \fBpostmap /etc/postfix/virtual\fR 8# 9# \fBpostmap -q "\fIstring\fB" /etc/postfix/virtual\fR 10# 11# \fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR 12# DESCRIPTION 13# The optional \fBvirtual\fR(5) alias table rewrites recipient 14# addresses for all local, all virtual, and all remote mail 15# destinations. 16# This is unlike the \fBaliases\fR(5) table which is used 17# only for \fBlocal\fR(8) delivery. This feature is implemented 18# in the Postfix \fBcleanup\fR(8) daemon before mail is queued. 19# 20# Virtual aliasing is recursive; to terminate recursion for 21# a specific address, alias that address to itself. 22# 23# The main applications of virtual aliasing are: 24# .IP \(bu 25# To redirect mail for one address to one or more addresses. 26# .IP \(bu 27# To implement virtual alias domains where all addresses are aliased 28# to addresses in other domains. 29# .sp 30# Virtual alias domains are not to be confused with the virtual mailbox 31# domains that are implemented with the Postfix \fBvirtual\fR(8) mail 32# delivery agent. With virtual mailbox domains, each recipient address 33# can have its own mailbox. 34# .PP 35# Virtual aliasing is applied only to recipient 36# envelope addresses, and does not affect message headers. 37# Use \fBcanonical\fR(5) 38# mapping to rewrite header and envelope addresses in general. 39# 40# Normally, the \fBvirtual\fR(5) alias table is specified as a text file 41# that serves as input to the \fBpostmap\fR(1) command. 42# The result, an indexed file in \fBdbm\fR or \fBdb\fR format, 43# is used for fast searching by the mail system. Execute the command 44# "\fBpostmap /etc/postfix/virtual\fR" to rebuild an indexed 45# file after changing the corresponding text file. 46# 47# When the table is provided via other means such as NIS, LDAP 48# or SQL, the same lookups are done as for ordinary indexed files. 49# 50# Alternatively, the table can be provided as a regular-expression 51# map where patterns are given as regular expressions, or lookups 52# can be directed to a TCP-based server. In those case, the lookups 53# are done in a slightly different way as described below under 54# "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES". 55# CASE FOLDING 56# .ad 57# .fi 58# The search string is folded to lowercase before database 59# lookup. As of Postfix 2.3, the search string is not case 60# folded with database types such as regexp: or pcre: whose 61# lookup fields can match both upper and lower case. 62# TABLE FORMAT 63# .ad 64# .fi 65# The input format for the \fBpostmap\fR(1) command is as follows: 66# .IP "\fIpattern address, address, ...\fR" 67# When \fIpattern\fR matches a mail address, replace it by the 68# corresponding \fIaddress\fR. 69# .IP "blank lines and comments" 70# Empty lines and whitespace-only lines are ignored, as 71# are lines whose first non-whitespace character is a `#'. 72# .IP "multi-line text" 73# A logical line starts with non-whitespace text. A line that 74# starts with whitespace continues a logical line. 75# TABLE SEARCH ORDER 76# .ad 77# .fi 78# With lookups from indexed files such as DB or DBM, or from networked 79# tables such as NIS, LDAP or SQL, each \fIuser\fR@\fIdomain\fR 80# query produces a sequence of query patterns as described below. 81# 82# Each query pattern is sent to each specified lookup table 83# before trying the next query pattern, until a match is 84# found. 85# .IP "\fIuser\fR@\fIdomain address, address, ...\fR" 86# Redirect mail for \fIuser\fR@\fIdomain\fR to \fIaddress\fR. 87# This form has the highest precedence. 88# .IP "\fIuser address, address, ...\fR" 89# Redirect mail for \fIuser\fR@\fIsite\fR to \fIaddress\fR when 90# \fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in 91# $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR 92# or $\fBproxy_interfaces\fR. 93# .sp 94# This functionality overlaps with the functionality of the local 95# \fIaliases\fR(5) database. The difference is that \fBvirtual\fR(5) 96# mapping can be applied to non-local addresses. 97# .IP "@\fIdomain address, address, ...\fR" 98# Redirect mail for other users in \fIdomain\fR to \fIaddress\fR. 99# This form has the lowest precedence. 100# .sp 101# Note: @\fIdomain\fR is a wild-card. With this form, the 102# Postfix SMTP server accepts 103# mail for any recipient in \fIdomain\fR, regardless of whether 104# that recipient exists. This may turn your mail system into 105# a backscatter source: Postfix first accepts mail for 106# non-existent recipients and then tries to return that mail 107# as "undeliverable" to the often forged sender address. 108# .sp 109# To avoid backscatter with mail for a wild-card domain, 110# replace the wild-card mapping with explicit 1:1 mappings, 111# or add a reject_unverified_recipient restriction for that 112# domain: 113# 114# .nf 115# smtpd_recipient_restrictions = 116# ... 117# reject_unauth_destination 118# check_recipient_access 119# inline:{example.com=reject_unverified_recipient} 120# unverified_recipient_reject_code = 550 121#.fi 122# 123# In the above example, Postfix may contact a remote server 124# if the recipient is aliased to a remote address. 125# RESULT ADDRESS REWRITING 126# .ad 127# .fi 128# The lookup result is subject to address rewriting: 129# .IP \(bu 130# When the result has the form @\fIotherdomain\fR, the 131# result becomes the same \fIuser\fR in \fIotherdomain\fR. 132# This works only for the first address in a multi-address 133# lookup result. 134# .IP \(bu 135# When "\fBappend_at_myorigin=yes\fR", append "\fB@$myorigin\fR" 136# to addresses without "@domain". 137# .IP \(bu 138# When "\fBappend_dot_mydomain=yes\fR", append 139# "\fB.$mydomain\fR" to addresses without ".domain". 140# ADDRESS EXTENSION 141# .fi 142# .ad 143# When a mail address localpart contains the optional recipient delimiter 144# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: 145# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, 146# \fIuser\fR, and @\fIdomain\fR. 147# 148# The \fBpropagate_unmatched_extensions\fR parameter controls whether 149# an unmatched address extension (\fI+foo\fR) is propagated to the 150# result of a table lookup. 151# VIRTUAL ALIAS DOMAINS 152# .ad 153# .fi 154# Besides virtual aliases, the virtual alias table can also be used 155# to implement virtual alias domains. With a virtual alias domain, all 156# recipient addresses are aliased to addresses in other domains. 157# 158# Virtual alias domains are not to be confused with the virtual mailbox 159# domains that are implemented with the Postfix \fBvirtual\fR(8) mail 160# delivery agent. With virtual mailbox domains, each recipient address 161# can have its own mailbox. 162# 163# With a virtual alias domain, the virtual domain has its 164# own user name space. Local (i.e. non-virtual) usernames are not 165# visible in a virtual alias domain. In particular, local 166# \fBaliases\fR(5) and local mailing lists are not visible as 167# \fIlocalname@virtual-alias.domain\fR. 168# 169# Support for a virtual alias domain looks like: 170# 171# .nf 172# /etc/postfix/main.cf: 173# virtual_alias_maps = hash:/etc/postfix/virtual 174# .fi 175# 176# Note: some systems use \fBdbm\fR databases instead of \fBhash\fR. 177# See the output from "\fBpostconf -m\fR" for available database types. 178# 179# .nf 180# /etc/postfix/virtual: 181# \fIvirtual-alias.domain anything\fR (right-hand content does not matter) 182# \fIpostmaster@virtual-alias.domain postmaster\fR 183# \fIuser1@virtual-alias.domain address1\fR 184# \fIuser2@virtual-alias.domain address2, address3\fR 185# .fi 186# .sp 187# The \fIvirtual-alias.domain anything\fR entry is required for a 188# virtual alias domain. \fBWithout this entry, mail is rejected 189# with "relay access denied", or bounces with 190# "mail loops back to myself".\fR 191# 192# Do not specify virtual alias domain names in the \fBmain.cf 193# mydestination\fR or \fBrelay_domains\fR configuration parameters. 194# 195# With a virtual alias domain, the Postfix SMTP server 196# accepts mail for \fIknown-user@virtual-alias.domain\fR, and rejects 197# mail for \fIunknown-user\fR@\fIvirtual-alias.domain\fR as undeliverable. 198# 199# Instead of specifying the virtual alias domain name via 200# the \fBvirtual_alias_maps\fR table, you may also specify it via 201# the \fBmain.cf virtual_alias_domains\fR configuration parameter. 202# This latter parameter uses the same syntax as the \fBmain.cf 203# mydestination\fR configuration parameter. 204# REGULAR EXPRESSION TABLES 205# .ad 206# .fi 207# This section describes how the table lookups change when the table 208# is given in the form of regular expressions. For a description of 209# regular expression lookup table syntax, see \fBregexp_table\fR(5) 210# or \fBpcre_table\fR(5). 211# 212# Each pattern is a regular expression that is applied to the entire 213# address being looked up. Thus, \fIuser@domain\fR mail addresses are not 214# broken up into their \fIuser\fR and \fI@domain\fR constituent parts, 215# nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. 216# 217# Patterns are applied in the order as specified in the table, until a 218# pattern is found that matches the search string. 219# 220# Results are the same as with indexed file lookups, with 221# the additional feature that parenthesized substrings from the 222# pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. 223# TCP-BASED TABLES 224# .ad 225# .fi 226# This section describes how the table lookups change when lookups 227# are directed to a TCP-based server. For a description of the TCP 228# client/server lookup protocol, see \fBtcp_table\fR(5). 229# This feature is available in Postfix 2.5 and later. 230# 231# Each lookup operation uses the entire address once. Thus, 232# \fIuser@domain\fR mail addresses are not broken up into their 233# \fIuser\fR and \fI@domain\fR constituent parts, nor is 234# \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. 235# 236# Results are the same as with indexed file lookups. 237# BUGS 238# The table format does not understand quoting conventions. 239# CONFIGURATION PARAMETERS 240# .ad 241# .fi 242# The following \fBmain.cf\fR parameters are especially relevant to 243# this topic. See the Postfix \fBmain.cf\fR file for syntax details 244# and for default values. Use the "\fBpostfix reload\fR" command after 245# a configuration change. 246# .IP "\fBvirtual_alias_maps ($virtual_maps)\fR" 247# Optional lookup tables that alias specific mail addresses or domains 248# to other local or remote addresses. 249# .IP "\fBvirtual_alias_domains ($virtual_alias_maps)\fR" 250# Postfix is the final destination for the specified list of virtual 251# alias domains, that is, domains for which all addresses are aliased 252# to addresses in other local or remote domains. 253# .IP "\fBpropagate_unmatched_extensions (canonical, virtual)\fR" 254# What address lookup tables copy an address extension from the lookup 255# key to the lookup result. 256# .PP 257# Other parameters of interest: 258# .IP "\fBinet_interfaces (all)\fR" 259# The network interface addresses that this mail system receives 260# mail on. 261# .IP "\fBmydestination ($myhostname, localhost.$mydomain, localhost)\fR" 262# The list of domains that are delivered via the $local_transport 263# mail delivery transport. 264# .IP "\fBmyorigin ($myhostname)\fR" 265# The domain name that locally-posted mail appears to come 266# from, and that locally posted mail is delivered to. 267# .IP "\fBowner_request_special (yes)\fR" 268# Enable special treatment for owner-\fIlistname\fR entries in the 269# \fBaliases\fR(5) file, and don't split owner-\fIlistname\fR and 270# \fIlistname\fR-request address localparts when the recipient_delimiter 271# is set to "-". 272# .IP "\fBproxy_interfaces (empty)\fR" 273# The network interface addresses that this mail system receives mail 274# on by way of a proxy or network address translation unit. 275# SEE ALSO 276# cleanup(8), canonicalize and enqueue mail 277# postmap(1), Postfix lookup table manager 278# postconf(5), configuration parameters 279# canonical(5), canonical address mapping 280# README FILES 281# .ad 282# .fi 283# Use "\fBpostconf readme_directory\fR" or 284# "\fBpostconf html_directory\fR" to locate this information. 285# .na 286# .nf 287# ADDRESS_REWRITING_README, address rewriting guide 288# DATABASE_README, Postfix lookup table overview 289# VIRTUAL_README, domain hosting guide 290# LICENSE 291# .ad 292# .fi 293# The Secure Mailer license must be distributed with this software. 294# AUTHOR(S) 295# Wietse Venema 296# IBM T.J. Watson Research 297# P.O. Box 704 298# Yorktown Heights, NY 10598, USA 299# 300# Wietse Venema 301# Google, Inc. 302# 111 8th Avenue 303# New York, NY 10011, USA 304#-- 305