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

Re: Exim Aliases With Domains



On Sun, 23 Aug 1998, Asher Haig wrote:

> I would appreciate that.
> 
> And can i use @* for a domain in an alias? (Are wildcards allowed in 
> general?)
> 
> 

The method I use allows defaults in a very simple manner.

First, if Debian does not make a /etc/exim directory by default (I, can't
remember) make one now.

In that directory, you are going to build two files, domains.virtual and
aliases.virtual. These are flat text files and will make it VERY EASY to
administer all sorts of virtual domains. THese include domains where
all-users@domain go to a local or remote user, user@domain goes to a local
or remote user with a default catchall address, etc.

I am going to walk you through this from the "bottom-up" so that nothing
is enabled until the last step is in place.

First of all I am assuming that the ONLY thing in local_domains is your
local machine. That is how it should be. All of your virtual domains will
go into the /etc/exim/domains.virtual file.

Open /etc/exim/domains.virtual and make a list of all domains that you
are going to service. An example is:

some-domain.org
another-domain.net
yet-another.com

Once you have all of your domains listed, write and close the file, you
are finished with it.

Now open /etc/exim/aliases.virtual and make a file listing the aliases
like so:

some-domain.org:	billy@my-machine.dom
another-domain.org:	robin@some-other.net
yet-another.com:	jack@debian.org
postmaster@yet-another.com:	billy@my-machine.dom
billing@yet-another.com:	susie@her-isp.com
support@yet-another.com:	fred@flintstone.net

In other words, put the domain and its default alias first, then put any
specific aliases for that domain after. WHat will happen is that any alias
not specificly routed in this file will go to the default address listed
for the domain.

Now you have the domains and the aliases for the domains in their files.
You need to tell Exim what to do with them. This turns out to be two easy
entries in the directors section. I make them the first two directors:

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 the virtual_specific driver probably wraps, it
is ALL ONE LINE.

THis attempts to find user@domain first and if that fails, it attempts to
find domain.

Ok, now exim knows how to use the information in the files. The last step
is to tell exim that it is supposed to use these director entries when
processing domains. SIMPLE! All you need to do is include the following in
your "local_domains = " configuration item:

lsearch;/etc/exim/domains.virtual

For example, the line on my main mailhost looks like this:

local_domains = corsica.shorelink.com:lsearch;/etc/exim/domains.virtual

Now you are all done!

Restart exim to read the config and that is it.  If you want to add more
virtual domains and aliases, you simply edit those files (domains.virtual
and aliases.virtual) and your new domains/aliases are effective
immediately. No need to even restart exim. Adding a new virtual domain
takes seconds. This method can be improved by making the files dbm files
but this is fine for most mailhosts.

It is fast, easy to maintain and easy to debug. Just make sure that you
add the aliases BEFORE adding the domain because a mail delivery attempt
to the domain will fail if there is no alias yet.


George Bonser

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


Reply to: