[Exim] using LDAP within Exim

Top Page
Delete this message
Reply to this message
Author: Paul Shields
Date:  
To: exim-users
Subject: [Exim] using LDAP within Exim
Hello

dont know if anyone can help, but I'm struggling to use LDAP for mailbox
authentication. Basically, we have Exim set up to work well with
SpamAssassin, as outlined in the configure snippet below.

We now need to perform an LDAP lookup before the Spam processing to ensure
that the receiving mailbox exists (the mail box is on another mail server
that we are relaying to). If the mailbox doesn't exist, then we bounce the
mail.

I've tried various scenarios, but just can't crack the correct syntax. Any
assistance gratefully received. (note that the settings below work fine
when the ldapcheck router is not there).

thanks

Paul






Routers definition:

begin routers

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more


ldapcheck:
driver = redirect
verify_recipient
no_verify
domains = +scan_domain1
data = ${lookup ldap
{ldap://ldapserver/ou=emailservice,ou=compname,ou=members,o=compname?mail?sub?mail=${quote_ldap:$local_part@$domain}
} }
self = pass
pass_router = spamcheck
no_more


spamcheck:
driver = accept
no_verify
domains = +scan_domain1
condition = "${if or { {def:h_X-Spam-Flag:} {eq
{$received_protocol}{relayed}} } {0}{1}}"
transport = forward
no_more

# This sends scanned mail to external server
forward:
driver = accept
no_verify
domains = +scan_domain1
condition = "${if or { {def:h_X-Spam-Flag:} {eq
{$received_protocol}{relayed}} } {1}{0}}"
transport = forward

userforward:
driver = redirect
check_local_user
file = $home/.forward
no_verify
no_expn
check_ancestor
# allow_filter
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply


# This router matches local user mailboxes.

localuser:
driver = accept
check_local_user
transport = local_delivery




begin transports

# This transport is used for delivering messages over SMTP connections.

remote_smtp:
driver = smtp

# Send all incoming mail through spamassassin.

spamcheck:
driver = pipe
command = /usr/exim/bin/exim -oMr relayed -bS
use_bsmtp = true
transport_filter = /usr/bin/spamc
home_directory = "/tmp"
current_directory = "/tmp"
log_output = true
return_fail_output = true
return_path_add = false
message_prefix =
message_suffix =

forward:
driver = smtp
# Remove all headers that Spam Assassin adds for testing
#headers_remove =
"X-Spam-Flag:X-Spam-Status:X-Spam-Level:X-Spam-Checker-Version:"
hosts = desthost
gethostbyname = true
interface = 192.168.7.5