Configuring exim for virtual domains
This will configure exim (version 3.35, as in Debian stable) to accept mail for virtual domains.
/etc/exim/exim.conf configuration
Specify local domains
Exim needs to know the local domains it handles. Edit the local_domains = line in /etc/exim/exim.conf so it looks like:
local_domains = yourdomain.com:localhost:lsearch;/etc/exim/virtual/domains
Where yourdomain.com is your main domain exim handles mail for (i.e. not a virtual domain).
Also local_domains_include_host should be set to true as well as local_domains_include_host_literals
Adding a transport
Edit /etc/exim/exim.conf and add a transport. The following must go at the top of the transports section but before anything like a mailman transport (if you have it configured).
virtual_localdelivery: {{{ driver = appendfile create_directory = true directory_mode = 700 file = /var/spool/virtual/${domain}/${local_part} group = mail mode = 0660
}}}
Adding directors
Once again in /etc/exim/exim.conf, add two directors under the directors section. The following must go under the real_local director:
virtual_alias: {{{ driver = aliasfile file_transport = address_file pipe_transport = address_pipe domains = lsearch;/etc/exim/virtual/domains file = /etc/exim/virtual/${domain}/aliases search_type = lsearch* user = mail qualify_preserve_domain
}}}
The following must go under the userforward director:
virtual_localuser: {{{ driver = aliasfile file_transport = address_file pipe_transport = address_pipe transport = virtual_localdelivery domains = lsearch;/etc/exim/virtual/domains file = /etc/exim/virtual/${domain}/passwd search_type = lsearch no_more
}}}
Updating the localuser director
You should edit the localuser director too. You need to add a domains = line to localuser that looks like:
domains = “! lsearch; /etc/exim/virtual/domains : * ”
Updating the userforward director
You should edit the userforward director too. You need to add a domains = line to userforward that looks like:
domains = “! lsearch; /etc/exim/virtual/domains : * ”
Putting the required data in to /etc/exim/virtual
By default /etc/exim/virtual will not exist so mkdir /etc/exim/virtual
In this directory start by creating a file called domains. This will contain the virtual domains exim handles, one per line. For example:
domain-one.org domain-two.com domain-three.co.uk
Each domain the domains file should have its own directory within /etc/exim/virtual. For example /etc/exim/virtual/domain-one.org/
Inside each virtual domains directory should be two files. A passwd file and an aliases file.
The passwd file should contain the information from /etc/passwd for whoever is the real user for this virtual domain. For example if user david was the real owner on the system for the domain domain-one.org you could execute the following:
# grep ^david: /etc/passwd > /etc/exim/virtual/domain-one.org/passwd
The aliases file should contain the aliases for this virtual domain that are accepted and who the real user is. Once again in the below example, we say the real user is david
root: david david: david spam: david postmaster: david foo: david
Finishing off
When everything is setup, restart exim and keep your fingers crossed. Tail the exm logfiles in /var/log/exim to look out for any errors.
Mail for virtual domains gets sent to /var/spool/virtual/${domain}/${local_part} – This could be tweaked in exim.conf.
In order for the popper to work properly, (for the example used before) perform the following;
1. cd /var/spool/mail 1. ln -s ../virtual/domain-one.org/david
Leave a Reply
You must be logged in to post a comment.