[exim-dev] X-Post: LDAP lookup inside system filter

Top Page
Delete this message
Reply to this message
Author: ashkan
Date:  
To: Exim-dev
CC: 
Subject: [exim-dev] X-Post: LDAP lookup inside system filter
Hi all

Sorry about the cross-post. I tried this on exim-users with no response so I thought I would try my luck here.

Really simply: does anyone know if its possible to do LDAP lookups directly in a system_filter or similar (such as a central_filter using the redirect transport)? Basically, I want to lookup the OU for a particular mail user and then perform selective filtering based on what 'organizational unit' that particular mail user is in, system wide. This can be done either within the filter script, or declared outside of the script in exim.conf and then 'used' by the script logic.

For example, I've setup a system-wide central filter as follows:

>central_filter:
> driver = redirect
> domains = +local_domains
> file = /etc/exim/filter1
> no_verify
> user = exim
> group = exim
> allow_filter
> allow_freeze


Then I want to have something like the following inside /etc/exim/filter1

>group = ${lookup ldapm {ldap://localhost:389/ou=people,dc=testdomain,dc=com?ou?(mail=${local_­part})}{$value}
>
>if $group is "marketing" then save /dev/null endif


Does anyone know how to do this or if its possible? I found this post: http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20030310/msg00292.html but no further information on the matter.

Perhaps I can lookup the group information outside of the central_filter, then pass that information to the filtering script?

Also, I understand theres some caveats between system_filters and central_filters with regards to multiple recipients which is why I chose to use the redirect/central_filter model. Are there any problems with this approach?

-a