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