Menu

#2359 ldap_search(): Search: Operations error

None
open
nobody
None
1
2023-06-12
2021-05-27
Wayne U
No

Hi everyone
I have problem of LDAP authentication. The error is "ldap_search(): Search: Operations error". I have tried to use LDAP authentication in the lateset version of MRBS 1.9.3, and I also encounter the same error.

Here is my setting in config.ini:

$auth["type"] = "ldap";
$ldap_host = "*";
$ldap_port = 389;
$ldap_v3 = true;
$ldap_tls = false;

$ldap_base_dn = "dc=company,dc=com";
$ldap_user_attrib = "sAMAccountName";
$ldap_dn_search_attrib = "sAMAccountName";
$ldap_dn_search_dn = "cn=*,cn=users,dc=company,dc=com"; 
$ldap_filter="dc=*,dc=com";

$ldap_dn_search_password = "*"; 
$debug = true;

Error:

##### E_WARNING in C:\xampp\htdocs\mrbs\web\lib\MRBS\Auth\AuthLdap.php at line 587
##### ldap_search(): Search: Operations error
##### MRBS GET: Array
##### (
##### )
##### MRBS POST: Array
##### (
#####     [csrf_token] => b7b5a1a6721c46e0aeef8a2360c9bcbda6bfca98966b75fcb83e9bec75ea0fb2
#####     [returl] =>
######     [target_url] => index.php
######     [action] => SetName
######     [username] => ****
######     [password] => ****
###### )
###### MRBS SESSION: Array
###### (
#####     [csrf_token] => b7b5a1a6721c46e0aeef8a2360c9bcbda6bfca98966b75fcb83e9bec75ea0fb2
##### )
##### 
#####  MRBS\generate_backtrace() called at [C:\xampp\htdocs\mrbs\web\functions_error.inc:152]
#####  MRBS\output_error() called at [C:\xampp\htdocs\mrbs\web\functions_error.inc:182]
#####  MRBS\error_handler(2, ldap_search(): Search: Operations error, C:\xampp\htdocs\mrbs\web\lib\MRBS\Auth\AuthLdap.php, 587, array)
#####  ldap_search(resource, dc=*,dc=com, (sAMAccountName=Wayne.Yu)) called at [C:\xampp\htdocs\mrbs\web\lib\MRBS\Auth\AuthLdap.php:587]
#####  MRBS\Auth\AuthLdap->action(validateUserCallback, *, array) called at [C:\xampp\htdocs\mrbs\web\lib\MRBS\Auth\AuthLdap.php:209]
#####  MRBS\Auth\AuthLdap->validateUser(*, *) called at [C:\xampp\htdocs\mrbs\web\lib\MRBS\Session\SessionWithLogin.php:136]
#####  MRBS\Session\SessionWithLogin->getValidUser(*, *) called at [C:\xampp\htdocs\mrbs\web\lib\MRBS\Session\SessionWithLogin.php:114]
#####  MRBS\Session\SessionWithLogin->processForm() called at [C:\xampp\htdocs\mrbs\web\mrbs_auth.inc:26]
#####  require_once(C:\xampp\htdocs\mrbs\web\mrbs_auth.inc) called at [C:\xampp\htdocs\mrbs\web\defaultincludes.inc:32]
#####  require(C:\xampp\htdocs\mrbs\web\defaultincludes.inc) called at [C:\xampp\htdocs\mrbs\web\admin.php:16]

Here is my environment:

MRBS: 1.9.2 
Windows Server 2012 R2
MySQL: 8
PHP: 7.3.28

Discussion

  • Campbell Morrison

    Is this a brand new installation, or are you upgrading from 1.9.2? If upgrading, was it working in 1.9.2?

     
  • John Beranek

    John Beranek - 2021-05-27
    $ldap_dn_search_dn = "cn=*,cn=users,dc=company,dc=com";
    

    Was this just you obscuring personal details, as it doesn't look like a valid DN to me...

    That field is the LDAP Distinguished Name to login as, so for a Active Directory system perhaps:
    cn=queryuser,ou=users,dc=example,dc=com

     
  • Anonymous

    Anonymous - 2021-05-27

    On latest version 1.9.3. upgraded from 1.7.1 (which was working fine on new Ubuntu VM and cannot load index page after successful login (seen in Apache log : MRBS\Auth\AuthLdap::getUserCallback(440): ldap_read() succeeded, taking 0.00060915946960449 seconds, referer: https://bookings......) Upgrade seemed to go well seen by database versions displayed as complete, returning to login screen, but no login to see good old index page. Just goes back in a loop to login page, even after login success - why?

     
  • Campbell Morrison

    Is this the same problem? I thought you were getting "ldap_search(): Search: Operations error"?

     
  • Anonymous

    Anonymous - 2021-05-27

    no error in Apache log, it says "succeeded" but I am still on the same login page, not loading index page with usual layout. Ldap is correctly configured, however it appears not to make any progress from login page. Before upgrade it worked well. I can still install old version 1.7.1 migrating from old opensuse vm to new ubuntu vm and it will work, but why is the latest version stuck at login page, even after successful login? Looks like new ticket to me?

     
  • Campbell Morrison

    1. Are you still getting the "ldap_search(): Search: Operations error" message? If not, have you changed something?
    2. What have you got $auth['session'] set to?
     
  • Anonymous

    Anonymous - 2021-05-28
    1. I was never getting ldap error message, only "succeeded" message in Apache log
    2. Could not find the string $auth['session'] in config.inc.php file.
     
    • Campbell Morrison

      Ah, I assume you didn't raise the ticket originally? If not, then yes, a new ticket would be helpful.

       
  • Anonymous

    Anonymous - 2021-05-28

    correction:
    2. $auth["session"] = "cookie"

    single speech marks issue ( " instead of ')

     
    • Campbell Morrison

      Try setting

      $auth['session'] = 'php';
      
       
  • Anonymous

    Anonymous - 2021-05-28

    already did - still the same login screen with no progress. in Apache log: PHP Notice: parseLocale: could not parse subtag '' in /var/www/html/web/lib/MRBS/Locale.php on line 224, referer: https://bookings....
    PHP Notice: Server failed to set locale to [".UTF-8"] for language tag ''. in /var/www/html/web/language.inc on line 221, referer: https://bookings.....
    [php7:notice] [pid 5393] [client 192.168.x.x:53127] \nE_WARNING in /var/www/html/web/lib/MRBS/Session/SessionPhp.php at line 61\nsession_destroy(): Session object destruction failed\nMRBS GET: Array\n(\n)\nMRBS POST: Array\n(\n [csrf_token] => 255c308d78064167e4c3343d77ed49b5a0b149972b5dbad86604bae672c85c09\n [returl] => \n [target_url] =>

     
  • Anonymous

    Anonymous - 2021-05-28

    I always had :
    $auth["session"] = "cookie"
    $auth["type"] = "ldap";
    and it was working fine..

     
  • Anonymous

    Anonymous - 2021-05-28

    I can only get in if:
    $auth["session"] = "nt";
    $auth["type"] = "none";
    but that is not the point as users are not authenticated against AD (ldap was fine though) ?

     
  • Campbell Morrison

    What happens if you set

    $auth["session"] = "php";
    $auth["type"] = "db";
    

    I know it's not what you want, but it's a test that will help narrow the problem down.

     
  • Anonymous

    Anonymous - 2021-05-28

    yes thanks, that works ok, first create user, then log in as that user. what about cookie sessions plus lpdap auth?

     
  • Wayne U

    Wayne U - 2021-06-03

    Hi Campbell
    Currently I am using MRBS 1.9.2 version.

    Hi John
    I have checked with the AD. The follwoing dn is correct. * is the Window AD admin acoount.
    $ldap_dn_search_dn = "cn=*,cn=users,dc=company,dc=com";

    After I removed the following code, I can log in MRBS using LDAP authentication. Thanks a lot.
    $ldap_filter="dc=*,dc=com";