https://github.com/lldap/lldap logo
Feoras - Hello everyone, I'm trying to setup ll...
# troubleshooting
f
Hello everyone, I'm trying to setup lldap together with maddy mail server (https://maddy.email/reference/auth/ldap/) The problem I have is that maddy sends the email address as username and I have no idea if I can change the dn_template or filter to allow this behavior to match any results in lldap.
Copy code
imap/sasl: authentication failed        {"reason":"no auth. provider accepted creds, last err: auth.ldap: search: LDAP Result Code 50 \"Insufficient Access Rights\": No user currently bound","src_ip":"xxx:42058","username":"test@sub.example.com"}
or
Copy code
imap/sasl: authentication failed        {"reason":"no auth. provider accepted creds, last err: unknown credentials","src_ip":"xxx:51592","username":"test@sub.example.com"}
I'm not really experienced with ldap yet so I tried different filter's like any combinations of mail_attribute and username with
filter "(&(objectClass=posixAccount)({mail_attribute}={username}))"
without any luck. In maddy they say to change "auth_map (see documentation page for used storage backend)" which would be lldap but I didn't found any option like this
Well I got it working 🤦‍♂️
n
that was fast
f
yeah I was trying it for an hour already, but I actually looked at the error again which said 'Insufficient Access Rights' so I looked up the docs again and saw that when filter is used a "bind" has to be used with a valid accoutn to lookup the data. So I had to provide an account for it to lookup. my final maddy config is thus:
Copy code
auth.ldap local_authdb {
    urls ldap://lldap:3890

    bind plain "cn=admin,ou=people,dc=example,dc=com" "password_of_user_admin"
    base_dn "dc=example,dc=com"
    filter "(&(|(uid={username})(mail={username}))(objectClass=person))"

    starttls off
    debug off
    connect_timeout 1m
}
and well luckily I found such a mail filter somewhere on the github issues
n
nice! You might want to use a service account with fewer privileges (member of lldap_strict_readonly for instance), but otherwise admin is good as well
Are you going to send a PR to add the example config?
f
Thanks for the info! I'm just testing it out right now before bringing it to production so I will make sure to do that there. I can create a PR in the next days sure
There you go, better do it now while the memory is still fresh right 😉
n
Thanks a lot!
f
Thank you for such an awesome and lightweight tool!