snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

LDAP manager attribute not being synced correctly in AD (was: LDAP Sync fails after adding manager attribue on 6.0 stable (Error 500))

Open jed214 opened this issue 4 years ago • 38 comments

Debug mode

Describe the bug

Whenever I run ldap sync I get error 500. Login and everything else works just fine.

It works though in the ldap settings page but that is probably because it does not lookup the manager attribute. I am running Active Directory on the other side of the ldap. I tested ldap and ldaps. When running the ldap sync from cli I get this image

Reproduction steps

1.Upgrade to php 7.4 2.Upgrade to snipe 6.0 3.Configure LDAP sync with manager attribue set (manager for AD) 4. Go to people tab or run command for ldap sync 5. See the error 500 or the one in the screenshot. 6. Leave manager field in ldap settings blank and it all works again ...

Expected behavior

Users sync and existing ones update with their manager field (other user object) from active directory.

Screenshots

image

image

image

Snipe-IT Version

v6.0.0 build 6860 (g722e88a47)

Operating System

Debian

Web Server

Apache

PHP Version

7.4

Operating System

Windows

Browser

Tested on Chrome and Firefox

Version

newest

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

jed214 avatar May 14 '22 23:05 jed214

👋 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.

welcome[bot] avatar May 14 '22 23:05 welcome[bot]

@Godmartinz - I think you donked around with some bits here - any help you can give?

uberbrady avatar May 14 '22 23:05 uberbrady

Should I maybe rollback the update and run it with php 8.1 installed instead of 7.4? Which one is better tested?

jed214 avatar May 15 '22 14:05 jed214

I would stick with php 7.4

As for whether or not you roll back, that’s kinda your call. I’d love to track down the error in the sync script if we can and get it fixed before the end of the weekend, but I can’t guarantee that

uberbrady avatar May 15 '22 15:05 uberbrady

And another question - if you remove the Manager attribute from the settings, do the LDAP syncs work out ok?

uberbrady avatar May 15 '22 16:05 uberbrady

I would stick with php 7.4

As for whether or not you roll back, that’s kinda your call. I’d love to track down the error in the sync script if we can and get it fixed before the end of the weekend, but I can’t guarantee that

Well even if I upgrade php to 8.1 I dont think the error will be resolved, not really so you will still have your option to look into it.

And another question - if you remove the Manager attribute from the settings, do the LDAP syncs work out ok?

Yup, removing the manager attribute from settings makes the sync work again without an issue. I posted this in reproducing steps.

It might also help that I am running a lxc container from turnkeylinux.org but the update process I done manually since its pure debian under.

jed214 avatar May 15 '22 16:05 jed214

ok, I can replicate the bug and I'm working on a fix. I think it looks like it should be pretty easy?

uberbrady avatar May 15 '22 16:05 uberbrady

As soon as we can get this merged, I'd love for you to give it another whirl if you can.

uberbrady avatar May 15 '22 16:05 uberbrady

Sure, give me a ping in this thread to check on my end the problem is resolved.

jed214 avatar May 15 '22 16:05 jed214

Ok @jed214 - @snipe has merged my PR against master, can you pull down the latest and see if it fixes your problem?

uberbrady avatar May 15 '22 16:05 uberbrady

Well yes it now syncs, but the Manager field is empty though after the sync even if its populated in Active Directory with a user that is also being synced to Snipe

jed214 avatar May 15 '22 16:05 jed214

Hrm. What setting are you using for the "LDAP Manager" field? I'm using manager there and it is correctly syncing AD managers - only if they actually exist in Snipe-IT though.

uberbrady avatar May 15 '22 17:05 uberbrady

I am also using manager. It syncs but even on a user I created just now the field is empty when on AD its populated by my user that is in also synced to snipe image image image image

jed214 avatar May 15 '22 17:05 jed214

Hrm. What are you using for your Username field?

uberbrady avatar May 15 '22 17:05 uberbrady

image

jed214 avatar May 15 '22 17:05 jed214

Before you ask I tried case sensitive image But then it does not work for and sync fails

jed214 avatar May 15 '22 17:05 jed214

Strange enough in the query field it works in the case sensitive form

jed214 avatar May 15 '22 17:05 jed214

Yeah, it's weird like that - in the query field, it wants the case-sensitive version, but in the username field, it wants all lower-case.

uberbrady avatar May 15 '22 17:05 uberbrady

If the user actually exists in Snipe-IT, the manager should get set to that user. Are there any users that can get correctly set as manager? Like, maybe one in the Base DN level? Maybe one in a different OU? It's possible that that manager-setting logic needs to be improved.

uberbrady avatar May 15 '22 17:05 uberbrady

Does the manager exist within that LDAP Filter?

uberbrady avatar May 15 '22 17:05 uberbrady