The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Postfix - virtual domains (part II) 21 May 2003
Need more help on this topic? Click here
This article has 6 comments
Show me similar articles

This is the second of two articles on Postfix. Please read Postfix - virtual domains first. Postfix is my mail server of preference and has been for over a year. But my first article about it was less than two weeks ago. It showed how I installed and configured Postfix and how I implemented virtual domains. At the time, I was setting up some secondary mail servers and was moving the mail service for some domains from one server to another. Shortly after writing that article, I became much more aware of the power and flexibility which is available with Postfix when it comes to virtual domains. That first article barely scratches the surface. Sure, it will get you up and running, but will you have the type of implementation which best suits your needs? In this article, I will talk about the three different types of virtual domains available with Postfix. After reading this, I'm sure you will know which one to use.

My thanks must go to Russell Mosemann for pointing out the missing pieces. You can find the original message via Google

Things have changed, be warned

This article was written back in November 2002, but sat here unfinished for some time. After someone asked me about virtual domains, I decided it was time to publish. Please note that around January 2003, the terminology used for Postfix virtual domains was changed to avoid confusion. The terms sendmail virtual domains and postfix virtual domains are no longer used in Postfix 2. The RELEASE_NOTES has details. Look for Name change of virtual domain tables. I have reproduced that section here:

Name change of virtual domain tables
====================================

This release introduces separation of lookup tables for addresses and for domain names of virtual domains.

[Incompat 20021209] the virtual_maps parameter is replaced by virtual_alias_maps (for address lookups) and virtual_alias_domains (for the names of what were formerly called "Postfix-style virtual domains").

  For backwards compatibility with Postfix version 1.1, the new
  virtual_alias_maps parameter defaults to $virtual_maps, and the
  new virtual_alias_domains parameter defaults to $virtual_alias_maps.
  This means that you can still keep all information about a domain
  in one file, just like before.

For details, see the virtual(5) and sample-virtual.cf files.

[Incompat 20021209] the virtual_mailbox_maps parameter now has a companion parameter called virtual_mailbox_domains (for the names of domains served by the virtual delivery agent). virtual_mailbox_maps is now used for address lookups only.

  For backwards compatibility with Postfix version 1.1,, the new
  virtual_mailbox_domains parameter defaults to $virtual_mailbox_maps.
  This means that you can still keep all information about a domain
  in one file, just like before.

For details, see the VIRTUAL_README file.

[Incompat 20021209] If you use the "advanced content filter" technique, you MUST NOT override the virtual aliases and virtual mailbox settings in the SMTP server that receives mail from the content filter, or else mail for virtual recipients will be rejected with "User unknown".

For details, see the FILTER_README file.

The choices

There are three types of virtual domains available with Postfix.

  • sendmail-style virtual domain
  • regular postfix-style virtual domain
  • virtual mailbox domain
I will now give a short overview of each type.
sendmail-style virtual domain

With a sendmail-style virtual domain, every local account exists in all of the domains handled by Postfix. For example, if your mail server accepts mail for example.net and example.com, and you have a local user tk19, then mail to tk19@example.net and tk19@example.com will both be delivered to the local user. This may not be what you want. If it isn't, then regular postfix-style virtual domain may be what you need.

This is an example of a sendmail-style virtual domain:

dan@example.net     dan
dan@example.com     dtm
With this scenario, mail sent to the unknown user dtm@example.com will be delivered to the local user dtm. Mail to xyz@example.org will be bounced to the sender if no local user xyz exists.
regular postfix-style virtual domain

The main difference between a sendmail-style virtual domain and a regular postfix-style virtual domain is what I call the domain header (this is a term I made up; don't expect to see it used elsewhere). This creates a domain use name space. Local user names are not visible in a regular postfix-style virtual domain.

example.net         DOMAIN
dan@example.net     dan

example.com         DOMAIN
dan@example.com     dtm
With this example, mail for an unknown user in example.net will be bounced back to the sender, unlike a sendmail-style virtual domain where delivery will be first attempted to a local user before bouncing. For what it's worth, this is the type of virtual domain I use on my mail servers.
virtual mailbox domain

I haven't investigated this at all yet.

See http://www.postfix.org/virtual.8.html and this long google link.


Need more help on this topic? Click here
This article has 6 comments
Show me similar articles