Re: [exim] Private Aliaes

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: Exim
CC: exim-users
Subject: Re: [exim] Private Aliaes
On Fri, Oct 22, 2010 at 12:38 PM, Exim <exim@???> wrote:
> I have a customer asking me to set up a separate alias file, but one that
> can only be used when the email comes from a local(trusted) machine.
>
> Is there a way in the router to say "only look at this router if the email
> came from these hosts?"
>
> Thanks in advance, and if this is in the FAQ or manuals, accept my apologies
> in advance.  I looked around for over an hour and didn't see anyting.


The thing about exim is it gives you the nuts and the bolts to build
whatever you need. You're used to looking for $setting that will do
it all for you, but instead also keep in mind that if there isn't a
router that does what you need, you can build one. Let's say you're
starting with something like this:

system_aliases:
debug_print = "Router: system_aliases for $local_part@$domain"
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
file_transport = address_file
pipe_transport = address_pipe

Some detail has been removed because my system has some restrictions
on what hostnames it will actually look in the aliases for.

Starting with that, add one condition that will fail except when the
ip is the correct one:

system_aliases_john:
debug_print = "Router: system_aliases for $local_part@$domain"
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
file_transport = address_file
pipe_transport = address_pipe
condition = ${if eq {$acl_c_john_is_sending}{1} {yes}{no} }

And somewhere in your acl's actually asign that macro:

warn    hosts = ip.of.john.machine
           set acl_c_john_is_sending = 1



You could also do it without the ACL's. For the condition in the router:

condition = ${if eq{$sender_host_address}{ip.of.john.machine} {yes}{no} }

I just like doing as much logic in ACL's as I can, it makes for a more
modular system to me.
I'm sure there are easier ways, but that is the way I would do it.

--
Regards...      Todd
I seek the truth...it is only persistence in self-delusion and
ignorance that does harm.  -- Marcus Aurealius