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