snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.85k stars 3.14k forks source link

LDAP Sync synchronises wrong users #14823

Open kuratlielia opened 3 months ago

kuratlielia commented 3 months ago

Debug mode

Describe the bug

We created about 40 locations inside SnipeIT, each with its own Active Directory OU path assigned. Now we have a script that runs the following command for all IDs between 1 and 40:

php artisan snipeit:ldap-sync --location_id=X --summary

The command, it doesn't matter which ID, returns around 2100 users each time. The same users every time and the strange part is the users don't even belong to the correct location.

The users are from 8 different locations, but I don't see a pattern and don't get from which OU path the users are picked.

Do you know this problem and maybe already found a solution?

Reproduction steps

  1. Create a location and enter the ou where the users are in
  2. Run the sync command for the location with id=1 -> php artisan snipeit:ldap-sync --location_id=1 --summary

Expected behavior

All the users from the given location should be imported into SnipeIT and be assigned the correct location.

Screenshots

No response

Snipe-IT Version

v7.0.0 / v6.3.2

Operating System

Windows Server 2022

Web Server

IIS

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

No response

snipe commented 3 months ago

My guess would be the filters are wrong, either on the base LDAP setting or on the locations themselves.

kuratlielia commented 3 months ago

My guess would be the filters are wrong, either on the base LDAP setting or on the locations themselves.

We set the LDAP Filter, so only users will be imported: grafik

And the search OU is this one:

OU=Departments,OU=User,OU=XXX,DC=XXX,DC=XXX

Under this path, there are OU's with all the users from the Departments.

In my understanding it should work, any ideas?

rshe-james commented 1 month ago

try &(objectClass=user)(objectCategory=person)