[Gllug] Exim and virtual domains
Xander D Harkness
xander at harkness.co.uk
Mon May 20 11:50:13 UTC 2002
On Thu, 2002-05-16 at 09:55, Paul Brazier wrote:
> Can someone give me some pointers to setting up "virtual domains" in
> Exim?
> Is this what exim calls "directors"? The documentation looks very
> comprehensive but assumes you know all the jargon etc.
>
> The box has the domain "mydomain.com" say but I also have DNS A, MX, etc
> records set up for "foo.com" and "bar.com" to point to the same IP
> address. For starters it would be nice just to bounce mail for
> fred at bar.com to another email say fred at fredsisp.net. Then maybe also
> have local spools so people can pick up email by pop3.
> I have this kind of setup with postfix on another box and although it's
> slightly tricky to set up it does work.
>
> I've looked into /etc/aliases but I'm not sure if this is just for local
> users - I tried adding an outside email to this but I think it thought I
> was trying to use it as a relay and gave me an error.
>
> Can Exim even do this (I'm sure I've seen this topic before but couldn't
> see it in the archives) or do I need something more heavyweight like
> Courier?
>
> Are there any simple introductions to Exim either online or in print? Is
> the O'Reilly Exim book any good?
I thought you might also be interested in this example which I took of
the exim list some time ago:
From: Marc Perkel <marc at nospamperkel.com>
To: exim-users at exim.org
Subject: [Exim] Linuxconf vdeliver and exim - virtual domains
Date: 14 Nov 2001 10:56:33 -0800
I got Linuxconf and it's vdeliver program working with exim. I also have
exim scripts that do the same thing as vdeliver. I'm just going to cut
some of my code into this message so it can be used by anyone who's
interested in making this work.
I'm still trying to work on the guy who writes linuxconf to create an
exim interface. So far no luck. If there are any programmers here I
think it could be done easilly.
Here's the director:
virtual_localuser_vdeliver:
driver = smartuser
transport = vdeliver
require_files = /etc/vmail/passwd.$domain
domains = lsearch;/etc/exim/vdomains
condition=${lookup {$local_part} lsearch {/etc/vmail/passwd.$domain}
{$value}}
And the transport:
vdeliver:
driver = pipe
command = /usr/lib/linuxconf/lib/vdeliver $local_part $domain
current_directory = /
return_path_add
envelope_to_add
delivery_date_add
return_output
user = root
group = root
Additionally - here's exim code to do the same things:
# This transport handles virtual domains using local delivery.-
linuxconf format
virtual_local_delivery:
driver = appendfile
create_directory = true
directory_mode = 700
file = /var/spool/vmail/${domain}/${local_part}
delivery_date_add
envelope_to_add
return_path_add
allow_symlink
user = ${extract{2} {:} {${lookup {$local_part} lsearch
{/etc/vmail/passwd.$domain} {$value}}}}
group = mail
mode = 600
# This director matches virtual local user mailboxes.
virtual_localuser:
driver = smartuser
transport = virtual_local_delivery
# transport = vdeliver
require_files = /etc/vmail/passwd.$domain
domains = lsearch;/etc/exim/vdomains
condition=${lookup {$local_part} lsearch {/etc/vmail/passwd.$domain}
{$value}}
---------------------------------
Additionally - I handle aliases and .forward files:
# This director handles virtual user aliases the same was alias files
# are handled
virtual_alias:
driver = aliasfile
user = root
expand
file_transport = address_file
pipe_transport = address_pipe
domains = lsearch;/etc/exim/vdomains
require_files = /etc/vmail/aliases.$domain
file = /etc/vmail/aliases.$domain
search_type = lsearch*
qualify_preserve_domain
userforward:
driver = forwardfile
require_files = /etc/vmail/passwd.$domain
condition = ${lookup {$local_part} lsearch {/etc/vmail/passwd.$domain}
{$value}}
file =
${lookup{$local_part}lsearch{/etc/vmail/passwd.$domain}{${extract{5}{:}{$value}}/.forward}}
no_verify
no_expn
no_check_local_user
check_ancestor
filter
skip_syntax_errors
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
----------------------------
And: I have virtual domain forwarding and fallback domains:
######################################################################
# REWRITE CONFIGURATION #
######################################################################
# The /etc/exim/domainaliases file contains a list of domain aliases
# mydomain.net: mydomain.com
# mydomain.org: mydomain.com
*@*
${lookup{$2}lsearch{/etc/exim/domainaliases}{$local_part@$value}{$local_part@$domain}}
E
*@mail.* $1@$2
# VIRTUAL DOMAIN FALLBACK
# If there is no alias and local delivery fails, but there is an
alternative
# domain name to forward unsent mail to, then fallbackdomain picks up
the new
# name and resends the message. Thus if a message is sent to domain1.com
and
# there are not matching user mailboxes or aliases, then the message is
# forwarded to the same user at domain2.com. Domains can be chained.
# The file format is as follows:
# domain1.com: domain2.com
# domain2.com: domain3.com
fallbackdomain:
user=root
driver = smartuser
condition=${lookup{$domain}lsearch{/etc/exim/domainfallback}{$value}}
new_address =
${lookup{$domain}lsearch{/etc/exim/domainfallback}{$local_part@$value}{$local_part@$domain}}
end
------------------
Hope this is useful. Enjoy!
--
## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list