Discussion:
Performing lookups with LDAP
Julian Kippels
2018-07-19 16:23:33 UTC
Permalink
Hi,

I am trying to perform lookups of sa_username_maps using LDAP. My
config looks like this:

--
$enable_ldap = 1;

$default_ldap = {
hostname => 'ldaphost',
base => 'o=example',
scope => 'sub',
query_filter => '(|(mail=%m)(mailAlternateAddress=%m))',
};

@sa_username_maps = (
q_ldap_s('mailMessageStore'),
);
--

I have to match all available mailaliasses to get the real username
from the mailMessageStore-Attribute. The LDAP-Connection works in
principle. I can see the search performed in my LDAP-Logs. The search
filter is correct and works using ldapsearch on the command line,
however, there are two things that have me scratching my head. First of
all, in the lookup requests all attributes from the LDAP object, not
only mailMessageStore. Second, even with all attributes I still get no
match.
I see the following line in my amavis log:

amavis[25729]: (25729-01) lookup [sa_username] => undef,
"***@test.redacted.tld" does not match

What am I doing wrong here?

Thanks in advance,
Julian
Marco
2018-09-03 07:02:52 UTC
Permalink
Post by Julian Kippels
Hi,
I am trying to perform lookups of sa_username_maps using LDAP. My
--
$enable_ldap = 1;
$default_ldap = {
hostname => 'ldaphost',
base => 'o=example',
scope => 'sub',
query_filter => '(|(mail=%m)(mailAlternateAddress=%m))',
};
@sa_username_maps = (
q_ldap_s('mailMessageStore'),
);
--
I have to match all available mailaliasses to get the real username
from the mailMessageStore-Attribute. The LDAP-Connection works in
principle. I can see the search performed in my LDAP-Logs. The search
filter is correct and works using ldapsearch on the command line,
however, there are two things that have me scratching my head. First of
all, in the lookup requests all attributes from the LDAP object, not
only mailMessageStore. Second, even with all attributes I still get no
match.
amavis[25729]: (25729-01) lookup [sa_username] => undef,
What am I doing wrong here?
Thanks in advance,
Julian
Hello, I tried something similar time ago.
Examining the amavisd code it seems that only the LDAP Amavis official
schema attributes are retrieved. This is no good, in my opinion, it
limits the benefit of sa_username_maps option.

Bye
Marco

Loading...