dnknth / ldap-ui

Minimalistic web frontend for OpenLDAP
MIT License
370 stars 28 forks source link

Cannot login in the login page, but forcing the same user in BIND_DN and BIND_PASSWORD works #44

Closed gleitoncampos closed 1 year ago

gleitoncampos commented 1 year ago

Hello!

As the title says, if I try to connect in the front (docker) with the example user "admin" and password "123456", the page just reloaded and back to login. But if I force the envs 'BIND_DN=cd-admin,dc=example,dc-com' and 'BIND_PASSWORD=123456' in docker command line, it works.

Can you have any idea? Thank you!

dnknth commented 1 year ago

Could there be a typo? cd-admin,dc=example,dc-com is syntactically wrong for a DN, and I doubt that it works. Did you mean cn=admin,dc=example,dc=com?

gleitoncampos commented 1 year ago

Could there be a typo? cd-admin,dc=example,dc-com is syntactically wrong for a DN, and I doubt that it works. Did you mean cn=admin,dc=example,dc=com?

Yes, sorry... The correct was 'BIND_DN=cn=admin,dc=example,dc-com'

dnknth commented 1 year ago

The last part dc-com does not look right either. Should it read: dc=com?

gleitoncampos commented 1 year ago

The last part dc-com does not look right either. Should it read: dc=com?

Damn... Right again, the correct one 'BIND_DN=cn=admin,dc=example,dc=com' With this + bind_password forced in docker command, the front connect, but if I remove and try to login in the front, nothing happens.

dnknth commented 1 year ago

LOGIN_ATTR defaults to uid, but your admin user has a cn RDN. Therefore, you cannot log in as admin unless you also provide -e LOGIN_ATTR=cn on the Docker command line (or something equivalent in a compose file, or whatever you use).

Technically, when you log in with Basic Auth and no BIND_PATTERN is given, a search is performed against the directory for a user whose LOGIN_ATTR matches the provided user name, in your case uid=admin. Obviously, this does not produce a result and therefore, the login fails.

Hope that helps.

dnknth commented 1 year ago

Hello @gleitoncampos, did you solve it?

dnknth commented 1 year ago

Closing this for lack of a response, feel free to re-open if the problem is not resolved