Re: [exim] LDAP lookup and cocanation

Top Page
Delete this message
Reply to this message
Author: Nigel Wade
Date:  
To: exim-users
Subject: Re: [exim] LDAP lookup and cocanation
Ben Wheare wrote:
> Hi,
>
> I'm trying to figure out a way how I can do the following:
>
> Email is delivered to joe.bloggs@domain (the form firstname.surname@domain)
>
> I want Exim to receive this mail, do an LDAP lookup for the record that
> matches firstname=joe AND surname=bloggs and return the field
> userid=jbloggs, so that I can deliver mail to the maildir
> /maildirs/{userid}/.
>
> I've got it delivering mail to maildirs, and creating the maildirs on
> the fly, using a a file and lsearch. What I want to do now is extend
> that to LDAP and firstname.surname expansion.
>
> Anyone have any pointers?
>
> Thanks,
>
> Ben
>


Yes, you can do it, using the local_part_prefix operator.
Whether it's wise to do so or not is entirely up to you...

ldapfirstlast:
   driver = redirect
   local_part_suffix = .*
   data = ${lookup ldap { \
      user=LDAPU \
      pass=LDAPP \
      LDAPS/LDAP_BASE?\ 
uid?sub?(&(givenName=${quote_ldap:$local_part})(sn=${quote_ldap:${substr_1:$local_part_suffix}}))}\
        {$value} fail}



Here, LDAPU, LDAPP, specify the binding user and password,
LDAPS is the URI ldaps://ldap_server and LDAP_BASE is the base of the search, so
would be of the form ou=accounts,dc=whatever.

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
             University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@???
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555