In a nutshell I need to set up a sendmail server (running on CentOS linux) that will look up recipient addresses via LDAP and I'm not having much luck. From what I've read we need to configure sendmail to use LDAP and it looks like I want to use the genericstable for LDAP queries but it doesn't look like its working for me.
Here are the gory details: We have an environment where we have a fairly large LDAP database of users and their primary e-mail addresses. We have a high-performance research cluster (and a second one being planned) that these users can log into and submit jobs for processing. Right now any e-mail generated as a result of those jobs is getting lost because sendmail was never configured properly. We need to set up sendmail to do a lookup in LDAP to determine a users primary e-mail address and use that as the delivery address.
To summarize our LDAP configuration, a typical entry contains the following fields (assuming myself) in ObjectClass=fooPerson:
cn: Bruce Pennypacker
uid: bpennypa (my login name on the servers)
mail: bruce.pennypacker@... (my primary e-mail address)
Assume the base DN for our LDAP setup is "dc=foo,dc=bar"
I know that LDAP lookups work properly from this particular server. I wrote a quick little perl script to verify that it can query the LDAP server and it's working properly.
The first thing I did was build a custom version of sendmail, enabling the LDAPMAP option. This is showing up in the sendmail output when I use -d so I'm sure it was built properly. I then added the following to my sendmail .mc file:
define(`confLDAP_DEFAULT_SPEC', `-p 389 -h ldap.foobar.com -b dc=foo,dc=bar')dnl
FEATURE(`genericstable', `ldap:-k (&(objectClass=fooPerson)(uid=%0)) -v mail')dnl
I rebuilt sendmail.cf after doing the above and see the following in that file:
# default LDAP map specification
# need to set this now before any LDAP maps are defined
O LDAPDefaultSpec=-p 389 -h ldap.foobar.com -b dc=foo,dc=bar
# LDAP routing maps
Kldapmh ldap -1 -T<TMPF> -v mailHost -k (&(objectClass=inetLocalMailRecipient)(mailLocalAddress=%0))
Kldapmra ldap -1 -T<TMPF> -v mailRoutingAddress -k (&(objectClass=inetLocalMailRecipient)(mailLocalAddress=%0))
# Generics table (mapping outgoing addresses)
Kgenerics ldap:-k (&(objectClass=fooPerson)(uid=%0)) -v mail
But if I run sendmail -d -bv bpennypa to see if it'll do a lookup and convert the name it doesn't work. I end up with a "user unknown" error. The debug output doesn't seem to indicate any LDAP query occurring. So what am I missing?