Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong LDAP service account login behavior #15926

Open
2 tasks done
shkuviak opened this issue Dec 6, 2024 · 1 comment · May be fixed by #15927
Open
2 tasks done

Wrong LDAP service account login behavior #15926

shkuviak opened this issue Dec 6, 2024 · 1 comment · May be fixed by #15927

Comments

@shkuviak
Copy link

shkuviak commented Dec 6, 2024

Debug mode

Describe the bug

Ldap server: OpenLDAP
Snipe-it: Docker image v7.1.15

I cannot make my users login using their ldap uid field which is different from their DN.

According to login form:

private function loginViaLdap(Request $request): User
{
Log::debug("Binding user to LDAP.");
$ldap_user = Ldap::findAndBindUserLdap($request->input('username'), $request->input('password'));
if (!$ldap_user) {
Log::debug("LDAP user ".$request->input('username')." not found in LDAP or could not bind");
throw new \Exception("Could not find user in LDAP directory");
} else {
Log::debug("LDAP user ".$request->input('username')." successfully bound to LDAP");
}

The findAndBind function is used:

public static function findAndBindUserLdap($username, $password)

Currently credentials used to bind to LDAP server are the one entered in login form, (username = uid).
Bind fails because users cannot directly bind to openldap using their uid. They must use DN to bind.

Reproduction steps

  1. Configure ldap in snipe-it using bind user
  2. Try to connect with LDAP user
  3. Login failed

Expected behavior

Instead of trying to bind to ldap server with users credentials, a search should be made using bind_user service account and user_filter to find the user.
Then, we should save the user DN and try to bind to the LDAP using DN

Screenshots

Screenshot 2024-12-06
Screenshot 2024-12-06

Snipe-IT Version

v7.1.15 (docker image)

Operating System

Ubuntu 22.04

Web Server

apache2 - 2.4.52-1ubuntu4.12

PHP Version

8.1.2

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

  • fresh install
  • docker container
Copy link

welcome bot commented Dec 6, 2024

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@shkuviak shkuviak linked a pull request Dec 6, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant