Installing Exim - more on configuration


 

 

 

 

 

Aliasing

The first director is the aliasing director, and it looks up an alias file or database for aliases for users.

More accurately, the aliasing director looks up the alias file to search for the local part of an e-mail address.

So users can be given aliases of their actual user names, and these aliases can be used as the local part of their e-mail addresses.

This allows a corporate format for the local part of e-mail addresses, and also allows e-mail addresses which refer to job functions, as opposed to users.

The name and location of the alias file or database is specified in the run time configuration file, and a typical alias file could be

 
a.aa:       aaa@linux-2.e-nor.loc     
b.bb:       bbb@linux-2.e-nor.loc     
c.cc:       ccc@linux-2.e-nor.loc     
d.dd:       ddd@linux-2.e-nor.loc     

boss:       aaa@linux-2.e-nor.loc     
sales:      bbb@linux-2.e-nor.loc     
techie:     bbb@linux-2.e-nor.loc     
accounts:   bbb@linux-2.e-nor.loc     
dogsbody:   bbb@linux-2.e-nor.loc     
 

So if an e-mail is sent for example to "sales@linux-2.e-nor.loc", one of the first things Exim does is to convert the local part of the address into a user name.

 

Forwarding

The next director is the forwarding director, which by default uses the traditional .forward file in users` home directories.

In most cases this file contains a single line which is the e-mail address of the new recipient.

By default, after doing a forwarding lookup, Exim places the new address back at the start of the mail transfer process, so the new address can be an alias contained within the alias lookup file. Or of course it can be a real e-mail address, either in the same mail domain, or in another one.

If it is known that the addresses read from the alias file are actual addresses, and that there is no requirement to go back to the start of the mail transfer process, then Exim can be configured so that it does not.

A .forward file will typically contain a single line, which is an e-mail address -

 
bbb@linux-2.e-nor.loc         
 

It could also contain a list of e-mail addresses, and so function as a distribution list -


aaa@linux-2.e-nor.loc         
bbb@linux-2.e-nor.loc         
ccc@linux-2.e-nor.loc         
ddd@linux-2.e-nor.loc         
eee@linux-1.e-nor.loc         
fff@linux-1.e-nor.loc         
ggg@linux-1.e-nor.loc         
hhh@linux-1.e-nor.loc         
 

Exim also allows more complicated use of the forwarding director, eg, the .forward file can be set up as filter instead of a simple list, or the director can be set up to access filtering instructions in databases.

 

Corporate mail domains

Exim allows for the use of a corporate mail domain, for example " e-nor.loc "

How this is configured depends in part on how many mail servers there are in the domain. For the domain e-nor.loc there are currently two mail hosts, linux-1.e-nor.loc and linux-2.e-nor.loc

Linux-2 is running Exim, and in this case, the name of the corporate domain, ie, e-nor.loc, is defined under the parameter " local domains " in the run time configuration file.

So for users on linux-2, the local user director processes the e-mail, and appends it to the user`s mailbox file.

However linux-1 is more of a problem.

When an e-mail addressed to a user on linux-1, with the domain as e-nor.loc - ie, the address looks like

 
user@e-nor.loc         
 

then first of all the alias director can`t process it, then the forward director can`t process it, and then the localuser director recognises the domain as a local domain, and tries to deliver it into a local mailbox.

But of course there is not a local mailbox, so the delivery fails. And the localuser director does not seem to hand it on to the routers, to see if any of them can handle the address.

On the other hand, if the domain name of e-nor.loc is not stated as a local domain in the run time configuration file, then the localuser director does not pick up the message, and the address is picked up by the lookuphost router - this consults the DNS forward file, and gets the information from the MX records

 
e-nor.loc.    IN      MX    10 linux-1.e-nor.loc. 
e-nor.loc.    IN      MX    15 linux-2.e-nor.loc. 
 

that the mail server with the highest preference is linux-1. So it sends all messages with the domain of e-nor.loc to linux-1.

Currently, linux-1 is running sendmail as the MTA, and it is not configured to know about the domain called e-nor.loc

So although sendmail accepts the message from linux-2, it then finds it does not know what to do with it, so sends an error message back to linux-2.

However even if sendmail was configured to know about the domain called e-nor.loc, this would not provide a solution, as all messages for the domain e-nor.loc would go to linux-1, even though the intended recipient exists on linux-2.

The solution that I know of to all of this is to use the alias file to list all users on both linux-1 and linux-2, and have the real address with a fully qualified host name.

 
aaa:       aaa@linux-2.e-nor.loc     
bbb:       bbb@linux-2.e-nor.loc     
ccc:       ccc@linux-2.e-nor.loc     
ddd:       ddd@linux-2.e-nor.loc     

eee:       eee@linux-1.e-nor.loc     
fff:       fff@linux-1.e-nor.loc     
ggg:       ggg@linux-1.e-nor.loc     
hhh:       hhh@linux-1.e-nor.loc     
 

This works because the aliasfile director looks only for the local part of an address, it makes no judgement on the domain name.

The aliasfile director changes the domain address of the message, and places the message back at the start of the mail processing.

Now, for the domain linux-2.e-nor.loc, the localuser director identifies the address as the local host, and passes the message on to the local_delivery transport, for delivery into the correct mailbox.

And for the domain linux-1.e-nor.loc, none of the directors are involved, the lookuphost router picks up the message, and passes it on to the remote_smtp transport for delivery to linux-1.

Of course, as described above, the alias e-mail addresses can enable the use of some kind of corporate name convention, and the alias file will then serve two purposes.

So after all that, it is now possible to have corporate e-mail formats of the form

 
sales@e-nor.loc         
 

or

 
user@e-nor.loc         
 

 

Combining all the above

Just as a demonstration of all the above, here is the results of a processing chain set up on linux-2.

The alias file had the following section in it -

 
a.aa:       aaa@linux-2.e-nor.loc     
b.bb:       bbb@linux-2.e-nor.loc     
c.cc:       ccc@linux-2.e-nor.loc     
d.dd:       ddd@linux-2.e-nor.loc     
 

The .forward file for aaa in linux-2 contained the address

 
b.bb@linux-2.e-nor.loc         
 

The .forward file for bbb in linux-2 contained the address

 
c.cc@linux-2.e-nor.loc         
 

The .forward file for ccc in linux-2 contained the address

 
d.dd@linux-2.e-nor.loc         
 

Finally, the line

 
headers_add = "X_Delivered_To: $local_part@$domain"
 

was added to the run time configuration file for each of the directors. This instruction adds a header line to the final e-mail message, which shows the change of address.

By sending an e-mail from root to a.aa@linux-2.e-nor.loc, the following was obtained -

 


From root@linux-2.e-nor.loc Wed May 22 17:45:34 2002
Return-path: [root@linux-2.e-nor.loc]
Envelope-to: a.aa@e-nor.loc
Delivery-date: Wed, 22 May 2002 17:45:34 +0000
Received: from root (helo=localhost)
	by linux-2.e-nor.loc with local-smtp (Exim 3.34 #1)
	id 17AaB4-0000fJ-00
	for a.aa@e-nor.loc; Wed, 22 May 2002 17:45:34 +0000
Date: Wed, 22 May 2002 17:45:34 +0000 (GMT)
From:  [root@linux-2.e-nor.loc]
To: a.aa@e-nor.loc
Subject: demo of aliases and forwarding
Message-ID: [Pine.LNX.4.02.10205221743170.2560-100000@linux-2.e-nor.loc]
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Delivered-To: a.aa@e-nor.loc
X-Delivered-To: aaa@linux-2.e-nor.loc
X-Delivered-To: b.bb@e-nor.loc
X-Delivered-To: bbb@linux-2.e-nor.loc
X-Delivered-To: c.cc@e-nor.loc
X-Delivered-To: ccc@linux-2.e-nor.loc
X-Delivered-To: d.dd@e-nor.loc
X-Delivered-To: ddd@linux-2.e-nor.loc

This is an e-mail sent by root@linux-2.e-nor.loc to a.aa@e-nor.loc,
in order to demonstrate the process of aliasing and forwarding. 

    

Which is probably not much use in real life, but rather fun.

 

PS

Just as before, Internet Explorer gets confused by pairs of chevrons inside text - it tries to use them as tags.

I have therefore replaced the chevrons in the above extract with [ and ]

 


© 2002 Ron Turner


Return to the Exim index page