heiglandreas / authLdap

LDAP-Authentication for WordPress
http://andreas.heigl.org/cat/dev/wp/authldap/
MIT License
69 stars 38 forks source link

LDAP authentication reports Invalid credentials #208

Closed Samonitari closed 2 years ago

Samonitari commented 2 years ago

Hi @heiglandreas , thanks for your work!

As far as I know, I configured everything fine, however I cannot login with LDAP users: in WP_DEBUG_LOG there is no more than:

LDAP authentication failed with exception: bind was not successfull: Invalid credentials

LDAP is accessible, with the same service user/password, etc., I can configure Authorizer, but your plugin would be better for LDAP - if I could get it to work.

Now, I have ARGON2 hashed passwords in OpenLDAP, and ppolicy overlay to hash clearText passwords (as a workaround because Apache Directory Studio doesn't handle ARGON2, so I pass cleartext from there), if that is relevant.

heiglandreas commented 2 years ago

Hey.

Thanks for raising this.

I assume you have activated the debugging output in the configuration.

And I assume that the issue is not with the actual user but with the LDAP-URI. Can you provide me some more configuration details - sanitized for passwords - here or via email to authldap AT heigl DOT org?

Samonitari commented 2 years ago

Thanks for the quick reply!

I think your assumptions are correct: I made an intentionally wrong LDAP-URI - wrong user - which resulted in the same error. LDAP debugging is enabled.

~My LDAP-URI looks like this: ldap://cn=wordpress,ou=services,dc=example,dc=com:%env:LDAP_PASSWORD%@ldap.example.com:389/dc=example,dc=com~

WOW, what a blunder! I did try a lot of things. But a single space made it to the beginning of LDAP-URI :laughing: I guess you can close this, as it works now!

heiglandreas commented 2 years ago

Great that it works now!

And thanks for mentioning this!

I will add a trim before storing the LDAP-URI then to pervent such havoc in the future!

Samonitari commented 2 years ago

That fix almost unneccesary, as who would be that dumb to start (or end?) with a space :laughing:

Samonitari commented 2 years ago

On a side note: can I use env in other settings, like group base?