[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Exim virtual domains howto (unofficial)



On Fri, 28 Aug 1998, Nathan E Norman wrote:

> I like exim, it seems to "make sense", though I have yet to find a
> web-page or document that says "Here's how you do the stuff you did in
> sendmail/smail/qmail"  (like the virtusertable feature of sendmail).  Oh
> well, you've helped open the door :)
> 
> Thanks,
> 
> --

Assume: local machine is foo.bar.com and services the local bar.com
domain.

exim is very close to smail in syntax, philosopy and structure. One major
difference is the integration of the conf file from smail's config,
routers, directors, and transports files into a single file with their own
sections and the addition of two new sections, a retry and header rewrite
section.

There are SEVERAL ways to effect virtual domains with exim, I will explain
one way that is extremely simple to maintain. You have one flat file to
edit to change virtual aliases and one other to ad new domains.

The first file I will call domains.virtual and is a listing of the virtual
domains that you want to service. It is important that you DO NOT list
your own domain or any real remote domains in this file. Here is an
example file:

# Virtual domains serviced here:

blah.com
blah-blah.com
blah-blah-blan.net

# End of domains.virtual

The other file I call aliases.virtual and contains the mappings for the
virtual domains. Note that the virtual mappings need NOT map to a local
address and the the address mapped to must contain a domain part even if
it is local.

Here is an example:

# Mapping of virutual domain users:

blah.com:	sammy@bar.com
sales@blah.com:	ralph@aol.com
bill@blah.com:	billyh@hokey.org

blah-blah.com:		cindy@bar.com
sam@blah-blah.com:	sam@uunet.uu.net
support@blah-blah.com:	bob@shorelink.com

blah-blah-blah.com:	gates@microsoft.com

# End of aliases.virtual

The first file will be read by exim when it sets it local_domains item so
that it knows that the virtual domains are handled locally and not to try
to route the mail for these domains to another host.

The second file will be used by the following directors to route the mail
to the proper places. In teh case where you have simply the domain name
mapped to an alias, the corresponding address will be used as the default
catch-all for all addresses for that domain not specificly directed below
it. They you have a listing of domain aliases and where mail for those
aliases is supposed to go. These can be local or remote addresses but you
should specify the full domain even for local addresses.

I put these files in /etc/exim/domains.virtual and
/etc/exim/aliases.virtual but you can put them anywhere you want as long
as exim has permission to read them.

Now all you need to do is modify the config file. In my ficticious host,
it would be as follows:

In the main config portion of the file:

local_domains = bar.com:lsearch;/etc/exim/domains.virtual
local_domains_include_host = true
local_domains_include_host_literals = true

Ok, thats it for this section. Now you simply need to add the directors
for the domain default and domain specific aliases. You put these at the
START of the directors section BEFORE any existing directors in EXACTLY
the order that I have them here:

virtual_specific:
driver=smartuser,
domains="partial-lsearch;/etc/exim/aliases.virtual";
new_address=${lookup{$local_part@$domain}lsearch{/etc/exim/aliases.virtual}{$value} fail};

virtual_default:
driver=smartuser,
domains="partial-lsearch;/etc/exim/aliases.virtual";
new_address=${lookup{$domain}lsearch{/etc/exim/aliases.virtual} {$value}fail};


Note that the last line of both directors may wrap on your mail reader but
it must be on one line in the conf file.

Now restart exim.

That is it!

TO add a new domain you sinply add it to domains.virtual and then add an
alias mapping in aliases.virtual. These take affect as soon as you make
the edit, no need to restart exim after changing/adding an alias or
domain.

George Bonser

The Linux "We're never going out of business" sale at an FTP site near you!


Reply to: