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

LDAP fails with GUI, but syncs users via CLI

Open xWyatt opened this issue 9 years ago • 4 comments

Expected Behavior (or desired behavior if a feature request)

When hitting the "Test LDAP" button under Admin > Settings > Test LDAP Integration I expect the background of the box to turn green and have the ability to sync LDAP users in the 'People' sub menu.


Actual Behavior

LDAP sync from the 'People' sub menu produces an error (in debug mode), and the test box is red with an ! triangle.

However, running php artisan snipeit:ldap-sync syncs users from AD into Snipe-IT with no error. The LDAP function also works fine, with the same config, on my test Snipe-IT instance. I can not find any differences between the test machine and production.

ALSO, php-ldap is installed.


Please confirm you have done the following before posting your bug report:


Please provide answers to these questions before posting your bug report:

  • Version of Snipe-IT you're running v3.6.5 build 1

  • What OS and web server you're running Snipe-IT on CentOS 7, Apache

  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) Manual Install; cloning the Git repo into /opt

  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error FatalThrowableError in Ldap.php line 43: Call to undefined function App\Models\ldap_connect() in Ldap.php line 43

  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error That error is triggered in /admin/users/ldap

  • If a stacktrace is provided in the error, include that too.

**at Ldap::connectToLdap() in UsersController.php line 1161
at UsersController->getLDAP()
at call_user_func_array(array(object(UsersController), 'getLDAP'), array()) in compiled.php line 9424
at Controller->callAction('getLDAP', array()) in compiled.php line 9486
at ControllerDispatcher->call(object(UsersController), object(Route), 'getLDAP') in compiled.php line 9466
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9948
at Pipeline->then(object(Closure)) in compiled.php line 9467
at ControllerDispatcher->callWithinStack(object(UsersController), object(Route), object(Request), 'getLDAP') in compiled.php line 9454
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\UsersController', 'getLDAP') in compiled.php line 8524
at Route->runController(object(Request)) in compiled.php line 8511
at Route->run(object(Request)) in compiled.php line 8225
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckPermissions.php line 28
at CheckPermissions->handle(object(Request), object(Closure), 'users.edit')
at call_user_func_array(array(object(CheckPermissions), 'handle'), array(object(Request), object(Closure), 'users.edit')) in compiled.php line 9963
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckPermissions.php line 28
at CheckPermissions->handle(object(Request), object(Closure), 'users.view')
at call_user_func_array(array(object(CheckPermissions), 'handle'), array(object(Request), object(Closure), 'users.view')) in compiled.php line 9963**

    **The stack trace extends to 150 lines, if you need more than this, let me know :)**
  • Any errors that appear in your browser's error console. GET https://snipe/admin/users/ldap 500 (Internal Server Error)

  • Confirm whether the error is reproduceable on the demo. N/A

  • Include any additional information you can find in app/storage/logs and your webserver's logs. laravel.log just displays the same error/stacktrace above, and my Apache logs do not show any errors

  • Include what you've done so far in the installation, and if you got any error messages along the way. Everything works fine, no other errors

  • Indicate whether or not you've manually edited any data directly in the database Nope.

xWyatt avatar May 17 '17 20:05 xWyatt

I actually ran into a similar LDAP Sync error in Version v4.0-alpha2 build alpha2 (13). The UI LDAP Sync errors out but after seeing your post I tried the CLI sync which seems to have worked perfectly with a couple of memory allocation updates.

For reference, the memory allocation changes which worked in our Debian/Apache environment with 14K LDAP records were;

/etc/php5/cli/php.ini;
memory_limit = 1024M
/etc/php5/apache2/php.ini;
memory_limit = 1024M
app/Console/Commands/LdapSync.php;
ini_set('memory_limit', '999M');
app/Console/Commands/ObjectImportCommand.php;
ini_set('memory_limit', '999M');

matc avatar May 18 '17 07:05 matc

I bumped up the memory allocation to what you specified above with no improvement.

I wasn't too concerned about memory usage though; I am only pulling in a few hundred records which does work on an identical instance of Snipe-IT on a different VM. That, and the test function in the Admin > Settings menu also errors out

xWyatt avatar May 18 '17 13:05 xWyatt

Is there anything further up that stack? It looks like it's getting cut off somewhere.

snipe avatar May 31 '17 13:05 snipe

There is - unfortunately (fortunately?) the error seemed to have went away when I attempted to reproduce it again this morning. The issue persisted for a week or two before posting on here, and continually until a week ago when I gave up attempting to fix it. There has been no documented changes to our Snipe-IT server - so perhaps it is something on the AD side of things..

If you have any thoughts or suggestions on what the root cause could be, or perhaps how to get it to error out, let me know. Otherwise this thread is as good as closed :/

xWyatt avatar Jun 02 '17 13:06 xWyatt