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