Re: [Exim] LDAP lookup in router condition

Top Page
Delete this message
Reply to this message
Author: Tony Earnshaw
Date:  
To: Gregg Berkholtz
CC: exim-users
Subject: Re: [Exim] LDAP lookup in router condition
Gregg Berkholtz wrote:

> I'm trying to setup an exim router that routes mail to a particular
> server based on a successful LDAP lookup. Is this possible within
> Exim?


What Exim version?

> What the ldap server shows:
> Jun 28 13:24:18 host slapd[27504]: conn=6 op=0 BIND dn="" method=128
> Jun 28 13:24:18 host slapd[27504]: conn=6 op=0 RESULT tag=97 err=0 text=
> Jun 28 13:24:18 host slapd[27504]: conn=6 op=1 SRCH base="ou=People,dc=domain,dc=com" scope=0 filter="(uid=greggberkholtz)"
> Jun 28 13:24:18 host slapd[27504]: conn=6 op=1 SEARCH RESULT tag=101 err=0 text=
> Jun 28 13:24:18 host slapd[27504]: conn=6 op=2 UNBIND
> Jun 28 13:24:18 host slapd[27504]: conn=-1 fd=14 closed


Your LDAP looks like Openldap - but what version? On what Unix/Linux?

I can/do do what you want with Exim 4.20 and Openldap 2.1.22 on heavily
modified Red Hat 7.2, using the following router:

local_redirect:
   driver = redirect
   allow_fail
   allow_defer
   data   = ${lookup ldapm \
     {user="cn=exim,ou=services,ou=groups,dc=billy,dc=demon,dc=nl"
pass=sNortwHistle\
     ldaps://localhost/\
     dc=billy,dc=demon,dc=nl?mailRoutingAddress?sub?\
     (&(objectClass=inetlocalMailRecipient)(mail=$local_part@$domain))\
     }\
     {$value} fail }
   file_transport = address_file
   pipe_transport = address_pipe


And objectClass inetLocalMailRecipient / attribute mailRoutingAddress
from misc.schema.

User petter with mail address petter@??? gets his mail routed
to pettere@???. Like using a .forward file in his home directory,
in fact. User petter could be a "virtual user" though, without a home
directory.

Why user exim? Cos he's a powerful proxy user, with permission to read
anything in my LDAP DIT - even if others may not. You mightn't need such
a user, but I do.

I can do it for groups, aliases, anything Openldap-based, with different
router combinations - all with the above as model. So yes - it's possible.

HTH,

Tony

-
Tony Earnshaw

Humor him and he'll go away

http://j-walk.com/blog/docs/conference.htm
http://www.billy.demon.nl
Mail: tonni@???