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

LDAP Error Version 4.0 - 4.0.15

Open pvhkai opened this issue 9 years ago • 24 comments

Hi Snipe,

yesterday I installed the new version on my live-environment. Everything seems to work well instead of the LDAP. I typed in the "Base Bind DN" (OU=User Accounts,OU=DUS01,OU=Europe,DC=CORP,DC=COM) and for each location the "LDAP Search OU"s:

  • Duesseldorf (LocationID:1): OU=User Accounts,OU=DUS01,OU=Europe,DC=CORP,DC=COM
  • Hamburg (LocationID:2): OU=User Accounts,OU=HAM01,OU=Europe,DC=CORP,DC=COM
  • Munich (LocationID:3):OU=User Accounts,OU=MUN01,OU=Europe,DC=CORP,DC=COM

If I now wanted to synchronize one location with LDAP I get the following errormessage:

Whoops, looks like something went wrong.

So I tried to synchronize by using cmd with the following scriptline:

php artisan snipeit:ldap-sync --location_id=3 --ou"OU=User Accounts,OU=MUN01,OU=Europe,DC=CORP,DC=COM"

I get the following errormessage:

D:\snipe>php artisan snipeit:ldap-sync --location_id=3 --ou=="OU=User Accounts,O U=MUN01,OU=Europe,DC=CORP,DC=COM"

PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "D:\snipe\storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:107 Stack trace: #0 D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 D:\snipe\vendor\monolog\monolog\src\Monolog\Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 D:\snipe\vendor\monolog\monolog\src\Monolog\Logger.php(616):Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array) #3 D:\snipe\vendor\laravel\framework\src\Illuminate\Log\Writer.php(203): Monolog\Logger->error(Object(UnexpectedValueException), Array) #4 D:\snipe\vendor\laravel\framework\src\Illuminate\Log\Writer.php(114): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array) #5 D:\snipe\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(71): Illuminat in D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php on line 107 PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "D:\snipe\storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:107 Stack trace: #0 D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 D:\snipe\vendor\monolog\monolog\src\Monolog\Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 D:\snipe\vendor\monolog\monolog\src\Monolog\Logger.php(616):Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array) #3 D:\snipe\vendor\laravel\framework\src\Illuminate\Log\Writer.php(203):Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array) #4 D:\snipe\vendor\laravel\framework\src\Illuminate\Log\Writer.php(114): Illuminate\Log\Writer->writeLog('error', Object(Symfony\Component\Debug\Exception\FatalErrorException), Array) #5 D:\snipe\v in D:\snipe\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php on line 107

Do you have any idea?

Best regards..

pvhkai avatar Sep 28 '17 09:09 pvhkai

Hello, I have a similar problem... after upgrading from version 3.6.6 to v.4.0.4 the LDAP Syncronization has failed with the error: Whoops, looks like something went wrong. ErrorExceptionldap_search(): Search: No such object

in Ldap.php (line 265) at HandleExceptions->handleError(2, 'ldap_search(): Search: No such object', '/var/www/html/snipeit/app/Models/Ldap.php', 265, array('base_dn' => '', 'ldapconn' => resource, 'ldap_bind' => null, 'filter' => '&(objectcategory=person)(objectclass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))', 'page_size' => 500, 'cookie' => '', 'result_set' => array(), 'global_count' => 0, 'ldap_paging' => true)) at ldap_search(resource, '', '(&(objectcategory=person)(objectclass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))')in Ldap.php (line 265)

php artisan snipeit:ldap-sync --location_id=1 --summary [ErrorException] ldap_search(): Search: No such object

Please, could you help us?

ghost avatar Sep 28 '17 13:09 ghost

These are my LDAP Settings:

LDAP Integration: [x] LDAP enabled Active Directory: [x] This is an Active Directory server LDAP Password Sync: [x] Yes Active Directory domain: company.local LDAP Server : ldap://company.local Use TLS: [ ] LDAP SSL certificate validation: [x] Allow invalid SSL Certificate LDAP Bind Username : [email protected] LDAP Bind Password: ******* Base Bind DN: OU=ABC,DC=company,DC=local LDAP Filter: &(objectcategory=person)(objectclass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)) Username Field: sAMAccountName Last Name: sn LDAP First Name: givenname LDAP Authentication query: sAMAccountName= LDAP Version: 3 LDAP Active Flag: LDAP Employee Number: LDAP Email: mail

ghost avatar Sep 28 '17 14:09 ghost

Hi Snipe,

any idea on this? :(

Best regards

BTW: have the same LDAP settings

pvhkai avatar Oct 04 '17 06:10 pvhkai

@pvhkai the error in your first post is suggesting that your permissions are incorrect on the storage folder

madd15 avatar Oct 04 '17 20:10 madd15

Hi, @madd15 thanks for the feedback. I gave (as a test) "Everyone" access to that folder and tried again. The funfact is, that the cmdline said:

php artisan snipeit:ldap-sync --location_id=3 --ou"OU=User Accounts,OU=MUN01,OU=Europe,DC=CORP,DC=COM"

And I get: UnexpectedValueException

  • The Stream or file "D:\Snipe-IT\storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

If I have a look in the "laravel.log" I see as the last lines: [2017-10-16 11:26:23] production.ERROR: There was an error authenticating the LDAP user: Could not find user in LDAP directory
[2017-10-16 14:17:13] production.ERROR: There was an error authenticating the LDAP user: Could not find user in LDAP directory
[2017-10-16 15:39:36] production.ERROR: There was an error authenticating the LDAP user: Could not find user in LDAP directory

So from my point of view it is the wrong user who tried to use the LDAP-sync. I tried again by adding the user again (in Snipe/admin/ldap). But also the test runs an error (and I am 100% sure that the password is correct).

Hope you know something I can do.. :(

pvhkai avatar Oct 16 '17 13:10 pvhkai

Here are my LDAP Settings:

LDAP Integration: [x] LDAP enabled Active Directory: [x] This is an Active Directory server LDAP Password Sync: [x] Yes Active Directory domain: company.com LDAP Server : ldap://company.com Use TLS: [ ] LDAP SSL certificate validation: [ ] Allow invalid SSL Certificate LDAP Bind Username : company.com\adminuser LDAP Bind Password: ******* Base Bind DN: OU=ABC,DC=company,DC=local LDAP Filter: &(cn=*) Username Field: sAMAccountName Last Name: sn LDAP First Name: givenname LDAP Authentication query: sAMAccountName LDAP Version: 3 LDAP Active Flag: LDAP Employee Number: LDAP Email: mail

If I now press on "Test LDAP" my browser brings up a logon-popup which does not react on anything entered.

// Afterwards I deleted my cache an cookies and clicked on the "LDAP Sync Button" in "Users" and than the following error comes up: Could Not bind to LDAP: Invalid credentials

The settings worked well before the update to Version 4.x (current build 120 - gf66e222)

pvhkai avatar Oct 17 '17 07:10 pvhkai

Made an Update to 4.0.10: Now the "LDAP Test" tells me "It Works!" - But the "Test LDAP Login" with the same login gave me the error "Login Failed. corp\administrator did not successfully bind to LDAP.

Afterwards I tried by script again: php artisan snipeit:ldap-sync --location_id=3 --summary

Answer: Error Exeption - ldap_search<>: Search: No such object

pvhkai avatar Oct 17 '17 12:10 pvhkai

Error in Laravel.log: [2017-10-17 14:50:11] production.ERROR: ErrorException: ldap_search(): Search: No such object in D:\Snipeit\app\Models\Ldap.php:267 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'ldap_search(): ...', 'D:\\snipeit\\app\\Mo...', 267, Array) #1 D:\snipeit\app\Models\Ldap.php(267): ldap_search(Resource id #560, '', '(&(cn=*))') #2 D:\Titan\app\Console\Commands\LdapSync.php(110): App\Models\Ldap::findLdapUsers('') #3 [internal function]: App\Console\Commands\LdapSync->handle()

pvhkai avatar Oct 17 '17 12:10 pvhkai

Anyone an idea!? Cannot do any LDAP import.. :(

pvhkai avatar Oct 18 '17 06:10 pvhkai

Upgrade to latest

snipe avatar Oct 18 '17 06:10 snipe

Hi @snipe ,

thanks for your info. I just made the update right a minute away. But the issue stays.

**LDAP Sync Test:**  Connection to LDAP server established!
**Test LDAP Login:** Login Failed. corp\adminuser did not successfully bind to LDAP.

And I use exactly the same username and password.. :(

pvhkai avatar Oct 18 '17 06:10 pvhkai

Hey @snipe, is there any posibillity to get more into it? The LDAP-status is now more than 20 days old and the colleagues who are using the system are coming over every day to ask when the LDAP will work again.. :(

Best regards

pvhkai avatar Oct 19 '17 07:10 pvhkai

Hey @snipe, I tried now (even if the Test LDAP Login comes out with an error) to synchonize.

Now (after the update to 4.0.11) - I did not get any error anymore by using the syncscript but the users the script comes back with are not in the OU which is in the location. The result comes up with 10-12 users randomly (thats how it lookes).

That happens also if i synchronize an location without defined "LDAP Search OU" in it...

pvhkai avatar Oct 19 '17 08:10 pvhkai

Hi @snipe ,

also the upgrade to 4.0.13 didnt fix the issue :(

pvhkai avatar Oct 19 '17 08:10 pvhkai

Hi @snipe,@korio77, because you closed the ticket (https://github.com/snipe/snipe-it/issues/4255), here again the solution and the persistand issue:

Putting the Admin Ou as Bind OU was the solution for the error that the "Test LDAP Login: Login Failed. corp\adminuser did not successfully bind to LDAP."

Logfile

[2017-10-20 08:17:54] production.DEBUG: Attempting to login using distinguished name:[email protected]  
[2017-10-20 08:17:54] production.DEBUG: It worked! adminuser1 successfully binded to LDAP.  
[2017-10-20 08:18:12] production.DEBUG: Some locations have special OUs set. Locations will be automatically set for users in those OUs.  
[2017-10-20 08:18:12] production.DEBUG: Location ID 1 passed  
[2017-10-20 08:18:12] production.DEBUG: Importing to Duesseldorf Headoffice (1)  
[2017-10-20 08:18:50] production.DEBUG: Some locations have special OUs set. Locations will be automatically set for users in those OUs.  
[2017-10-20 08:18:50] production.DEBUG: Location ID 3 passed  
[2017-10-20 08:18:50] production.DEBUG: Importing to München Showroom (3)  
[2017-10-20 08:19:24] production.DEBUG: Preparing to test LDAP connection  
[2017-10-20 08:19:24] production.DEBUG: attempting to bind to LDAP for LDAP test  
[2017-10-20 08:19:35] production.DEBUG: Preparing to test LDAP login  
[2017-10-20 08:19:35] production.DEBUG: Attempting to bind to LDAP for LDAP test  
[2017-10-20 08:19:35] production.DEBUG: Attempting to login using distinguished name:[email protected]  
[2017-10-20 08:19:35] production.DEBUG: It worked! adminuser1 successfully binded to LDAP.  
[2017-10-20 08:27:16] production.DEBUG: Some locations have special OUs set. Locations will be automatically set for users in those OUs.  
[2017-10-20 08:27:16] production.DEBUG: Location ID 1 passed  
[2017-10-20 08:27:16] production.DEBUG: Importing to Duesseldorf Showroom (1)

There is always a BUT

But the sync doesnt sync what it shoud do - I checked all OUs in the locations again and made a copy+past from the AD. But it throws out random wrong users. And always the same users not necessary which location I sync. I there a cache/ config/ thing I can reset or any other idea?

pvhkai avatar Oct 20 '17 08:10 pvhkai

Hi @snipe,

thats why I do not understand why the other ticket is closed! The issue is not solved yet - with so many users it is not possible to manage all without the functionallity to sync by ldap..

Does anyone have an idea?

pvhkai avatar Oct 23 '17 14:10 pvhkai

Even the Update to 4.0.15 didnt solve the issue.

-> Any other idea? I am open for everything...

pvhkai avatar Oct 24 '17 09:10 pvhkai

I don't have any explanation as to why you'd be seeing this, other that a misconfiguration on your end.

snipe avatar Oct 24 '17 09:10 snipe

@madd15 any additional thoughts? LDAP sync is working for everyone else, so I can't think of any reasons why this would be pulling a small set of random users.

snipe avatar Oct 24 '17 09:10 snipe

If not is there a payable support I can show my config to? I am really out of ideas...

My current LDAP Settings

LDAP Integration: [x] LDAP enabled Active Directory: [x] This is an Active Directory server LDAP Password Sync: [x] Yes Active Directory domain: company.com LDAP Server : ldap://company.com Use TLS: [ ] LDAP SSL certificate validation: [x] Allow invalid SSL Certificate LDAP Bind Username : adminuser LDAP Bind Password: ******* Base Bind DN: OU=ABC,DC=company,DC=local LDAP Filter: &(cn=*) Username Field: samaccountname Last Name: sn LDAP First Name: givenname LDAP Authentication query: sAMAccountName= LDAP Version: 3 LDAP Active Flag: LDAP Employee Number:telephoneNumber LDAP Email: mail

Funfact

@snipe - I made a new installation on my testenvironment. With the same settings but using version 3.4 of SnipeIT and it worked perfectly...

pvhkai avatar Oct 24 '17 09:10 pvhkai