Debian Exim with Virtual Domains Pseudo-HOW-TO
Do not use exim in version 3 no more, for which this document is intended.
Upgrade to a newer version of exim and use a different documentation, please.
This Pseudo-HOW-TO describes in short terms how to configure exim v3
with
virtual e-mail domains and with a very simple list support.
What you need:
- A running installation of exim v3 (=> 3.20)
What you get:
- Easy administration of virtual domain handling with exim in flat
text files:
- add one line in one file to open up a new virtual domain
- one file per virtual domain holds its alias table
- Full domain aliasing
- Support for very basic mailing lists
- Fallback to defaults
Configure:
- exim v3 (nano
/etc/exim/exim.conf):
- Add the path /etc/exim/virtual_domains with the lsearch directive
to the list of local domains (Option "local_domains"; the data is separated by
colons, e.g. local_domains = lsearch;/etc/exim/virtual_domains : another.host.alias.tld).
- Download vdom_conf.part
and open it in a text editor.
- Add the lines found in vdom_conf.part
to the
"Directors configuration" section. Insert them just before the
"system_aliases" director in the exim configuration file.
- Files and Folders:
- mkdir /etc/exim/aliases.d
- mkdir /etc/exim/lists.d
- download aliases.default into /etc/exim
- download lists.default into /etc/exim
- download virtual_domains into /etc/exim
Set up your domain:
- Add the name of your virtual domain together with the name of the
domain owner in
/etc/exim/virtual_domains
Each line in this file represents one virtual domain. A line
is composed of two parts separated by a colon:
<domainname> : <owner>
(e.g. example.com : someuser)
The domain owner must be a local mailbox or a simple list.
Advanced setup:
The following steps are all optional.
Altough, if you omit to configure aliases and
alike, you may only receive mails sent to the address <owner>@<virtualdomain> ;
all other mails would get rejected (except the system-wide default addresses like postmaster, abuse, etc., see below).
- Optionally, you may define aliases for your domain. Create a new file
named like your virtual domain in
/etc/exim/aliases.d
(e.g. /etc/exim/aliases.d/example.com)
In this file, mappings may be set up:
- Map a virtual
user to a real user:
To define to which local users mail will be delivered, use lines of
the form
sameuser : sameuser
(Note: Both words are identical!)
This line instructs the virtual_domain_to_local
director to replace the domain part with the local system.
E.g. On your system, there is a local user called "loc". She isn't the
domain owner, but she wants to receive mails in the virtual domain
"vdom.example". Set up an entry
loc : loc
This entry redirects mails addressed to "loc@vdom.example" to her
local mailbox loc.
(Note: You could achive the same by adding an entry of the form
<virtual_user> : <local_user>@
This way you wouldn't have to open an address in your virtual domain by
the name of the local mailbox name).
- Map virtual users to
other virtual users or remote addresses:
You may set up aliases in your virtual domain like the system aliases
in /etc/aliases.
<virtual_user> : <otheruser[@somedomain]>
(e.g. softpatents : trash or frog : crap@swamp.example)
- Implement a "catch
all":
Use an asterisks to implement a "catch all":
* : <user>
(e.g. * : frog)
In this example, each mails that isn't aliased otherwise will be
delivered to the user "frog".
- Optionally, set up system-wide defaults for virtual domains. RFC
822 requires the presence of a "postmaster" and "abuse" address, hence
they are mapped per default to the owner.
The file
/etc/exim/aliases.default
serves the defaults for all virtual domains and will be used
for look-ups if domain specific alias processing failed. Normal mapping
rules apply to this
file.
- Optionally, create a simple mail distribution list. Create a new
file named like the distribution list's address, including the local
part, the @ sign and the domain part, in
/etc/exim/lists.d
(e.g. /etc/exim/lists.d/mylist@mydomain.com)
Each line contains one address. If it's a local part only
(no @ sign in the word), it gets qualified with the list address'
domain part. For each address, a new mail is generated and delivered.
Note: You just have to create the file to set up the list. You don't
need an alias entry elsewhere!
Test your setup:
- Use exim -bt <address>
to test your setup. You may increase
the verbosity level by adding the "-d
<number>" switch. Refer to exim's
man page (man exim).
- Send some mails, watch the headers and the server's log files.
Caveats:
- The described exim configuration is well tested, but may still
contain bugs.
- Performance tests haven't been made at all. I assume it is
suitable for small servers.
Enjoy. Comments and corrections welcome.
Adrian Zaugg. (info at ente dot limmat dot ch)
(v0.3.2)
Other Exim3 Pseudo-How-Tos are available.