ldap_write_support icon indicating copy to clipboard operation
ldap_write_support copied to clipboard

Registration via LDAP refuses to connecto to LDAP server

Open TheOneWithTheBraid opened this issue 3 years ago • 0 comments

In our Nextcloud instance, some days ago, the LDAP registration suddenly stopped working. LDAP login works, other applications can register new users too with the same provided credentials.

It seems like it cannot connect to the LDAP server, even though login and setting's connection test can.

The log tells us the following:

[
  {
    "reqId": "FLINFrQ14PayLpNr49MS",
    "level": 3,
    "time": "2022-02-22T10:18:37+00:00",
    "remoteAddr": "192.168.0.1",
    "user": "--",
    "app": "PHP",
    "method": "POST",
    "url": "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen",
    "message": "ldap_bind(): Unable to bind to server: Can't contact LDAP server at /var/www/html/custom_apps/ldap_write_support/lib/LDAPConnect.php#87",
    "userAgent": "Mozilla/5.0 (X11; Linux aarch64; rv:96.0) Gecko/20100101 Firefox/96.0",
    "version": "23.0.0.10",
    "exception": {
      "Exception": "Error",
      "Message": "ldap_bind(): Unable to bind to server: Can't contact LDAP server at /var/www/html/custom_apps/ldap_write_support/lib/LDAPConnect.php#87",
      "Code": 0,
      "Trace": [
        {
          "function": "onError",
          "class": "OC\\Log\\ErrorHandler",
          "type": "::",
          "args": [
            2,
            "ldap_bind(): Unable to bind to server: Can't contact LDAP server",
            "/var/www/html/custom_apps/ldap_write_support/lib/LDAPConnect.php",
            87
          ]
        },
        {
          "file": "/var/www/html/custom_apps/ldap_write_support/lib/LDAPConnect.php",
          "line": 87,
          "function": "ldap_bind",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/custom_apps/ldap_write_support/lib/LDAPConnect.php",
          "line": 106,
          "function": "bind",
          "class": "OCA\\LdapWriteSupport\\LDAPConnect",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/custom_apps/ldap_write_support/lib/LDAPUserManager.php",
          "line": 224,
          "function": "getLDAPConnection",
          "class": "OCA\\LdapWriteSupport\\LDAPConnect",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps/user_ldap/lib/UserPluginManager.php",
          "line": 96,
          "function": "createUser",
          "class": "OCA\\LdapWriteSupport\\LDAPUserManager",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/apps/user_ldap/lib/User_LDAP.php",
          "line": 621,
          "function": "createUser",
          "class": "OCA\\User_LDAP\\UserPluginManager",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar"
          ]
        },
        {
          "function": "createUser",
          "class": "OCA\\User_LDAP\\User_LDAP",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/apps/user_ldap/lib/User_Proxy.php",
          "line": 81,
          "function": "call_user_func_array",
          "args": [
            [
              {
                "__class__": "OCA\\User_LDAP\\User_LDAP"
              },
              "createUser"
            ],
            [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          ]
        },
        {
          "file": "/var/www/html/apps/user_ldap/lib/Proxy.php",
          "line": 171,
          "function": "walkBackends",
          "class": "OCA\\User_LDAP\\User_Proxy",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "createUser",
            [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          ]
        },
        {
          "file": "/var/www/html/apps/user_ldap/lib/User_Proxy.php",
          "line": 386,
          "function": "handleRequest",
          "class": "OCA\\User_LDAP\\Proxy",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "createUser",
            [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/User/Manager.php",
          "line": 463,
          "function": "createUser",
          "class": "OCA\\User_LDAP\\User_Proxy",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/lib/private/User/Manager.php",
          "line": 401,
          "function": "createUserFromBackend",
          "class": "OC\\User\\Manager",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar",
            {
              "__class__": "OCA\\User_LDAP\\User_Proxy"
            }
          ]
        },
        {
          "file": "/var/www/html/custom_apps/registration/lib/Service/RegistrationService.php",
          "line": 377,
          "function": "createUser",
          "class": "OC\\User\\Manager",
          "type": "->",
          "args": [
            "voirhboifrnbvoiewnoiwrenboiw",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/custom_apps/registration/lib/Controller/RegisterController.php",
          "line": 328,
          "function": "createAccount",
          "class": "OCA\\Registration\\Service\\RegistrationService",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Registration\\Db\\Registration",
              "id": 1629
            },
            "voirhboifrnbvoiewnoiwrenboiw",
            "",
            "",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 217,
          "function": "submitUserForm",
          "class": "OCA\\Registration\\Controller\\RegisterController",
          "type": "->",
          "args": [
            "NzjjGQekaXPdEgM4sK4j33NFPysjMPW5",
            "gXxHeQcaen",
            "voirhboifrnbvoiewnoiwrenboiw",
            "",
            "",
            "foobar"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 126,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Registration\\Controller\\RegisterController"
            },
            "submitUserForm"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 157,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Registration\\Controller\\RegisterController"
            },
            "submitUserForm"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Registration\\Controller\\RegisterController",
            "submitUserForm",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "secret": "NzjjGQekaXPdEgM4sK4j33NFPysjMPW5",
              "token": "gXxHeQcaen",
              "_route": "registration.register.submitUserForm"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1006,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen"
          ]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/lib/private/Log/ErrorHandler.php",
      "Line": 92,
      "CustomMessage": "--"
    }
  },
  {
    "reqId": "FLINFrQ14PayLpNr49MS",
    "level": 3,
    "time": "2022-02-22T10:18:37+00:00",
    "remoteAddr": "192.168.0.1",
    "user": "--",
    "app": "ldap_write_support",
    "method": "POST",
    "url": "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen",
    "message": "Unable to bind to LDAP server",
    "userAgent": "Mozilla/5.0 (X11; Linux aarch64; rv:96.0) Gecko/20100101 Firefox/96.0",
    "version": "23.0.0.10"
  },
  {
    "reqId": "FLINFrQ14PayLpNr49MS",
    "level": 3,
    "time": "2022-02-22T10:18:37+00:00",
    "remoteAddr": "192.168.0.1",
    "user": "--",
    "app": "index",
    "method": "POST",
    "url": "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen",
    "message": "ldap_add(): Argument #1 ($ldap) must be of type resource, bool given in file '/var/www/html/custom_apps/ldap_write_support/lib/LDAPUserManager.php' line 233",
    "userAgent": "Mozilla/5.0 (X11; Linux aarch64; rv:96.0) Gecko/20100101 Firefox/96.0",
    "version": "23.0.0.10",
    "exception": {
      "Exception": "Exception",
      "Message": "ldap_add(): Argument #1 ($ldap) must be of type resource, bool given in file '/var/www/html/custom_apps/ldap_write_support/lib/LDAPUserManager.php' line 233",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 157,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Registration\\Controller\\RegisterController"
            },
            "submitUserForm"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Registration\\Controller\\RegisterController",
            "submitUserForm",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "secret": "NzjjGQekaXPdEgM4sK4j33NFPysjMPW5",
              "token": "gXxHeQcaen",
              "_route": "registration.register.submitUserForm"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1006,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen"
          ]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
      "Line": 158,
      "Previous": {
        "Exception": "TypeError",
        "Message": "ldap_add(): Argument #1 ($ldap) must be of type resource, bool given",
        "Code": 0,
        "Trace": [
          {
            "file": "/var/www/html/custom_apps/ldap_write_support/lib/LDAPUserManager.php",
            "line": 233,
            "function": "ldap_add",
            "args": [
              false,
              "uid=voirhboifrnbvoiewnoiwrenboiw,ou=activists,cn=users,cn=accounts,dc=activism,dc=international",
              {
                "objectClass": "inetOrgPerson",
                "uid": "voirhboifrnbvoiewnoiwrenboiw",
                "displayName": "voirhboifrnbvoiewnoiwrenboiw",
                "cn": "voirhboifrnbvoiewnoiwrenboiw",
                "sn": "voirhboifrnbvoiewnoiwrenboiw",
                "userPassword": "foobar"
              }
            ]
          },
          {
            "file": "/var/www/html/apps/user_ldap/lib/UserPluginManager.php",
            "line": 96,
            "function": "createUser",
            "class": "OCA\\LdapWriteSupport\\LDAPUserManager",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/apps/user_ldap/lib/User_LDAP.php",
            "line": 621,
            "function": "createUser",
            "class": "OCA\\User_LDAP\\UserPluginManager",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          },
          {
            "function": "createUser",
            "class": "OCA\\User_LDAP\\User_LDAP",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/apps/user_ldap/lib/User_Proxy.php",
            "line": 81,
            "function": "call_user_func_array",
            "args": [
              [
                {
                  "__class__": "OCA\\User_LDAP\\User_LDAP"
                },
                "createUser"
              ],
              [
                "voirhboifrnbvoiewnoiwrenboiw",
                "foobar"
              ]
            ]
          },
          {
            "file": "/var/www/html/apps/user_ldap/lib/Proxy.php",
            "line": 171,
            "function": "walkBackends",
            "class": "OCA\\User_LDAP\\User_Proxy",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "createUser",
              [
                "voirhboifrnbvoiewnoiwrenboiw",
                "foobar"
              ]
            ]
          },
          {
            "file": "/var/www/html/apps/user_ldap/lib/User_Proxy.php",
            "line": 386,
            "function": "handleRequest",
            "class": "OCA\\User_LDAP\\Proxy",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "createUser",
              [
                "voirhboifrnbvoiewnoiwrenboiw",
                "foobar"
              ]
            ]
          },
          {
            "file": "/var/www/html/lib/private/User/Manager.php",
            "line": 463,
            "function": "createUser",
            "class": "OCA\\User_LDAP\\User_Proxy",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/lib/private/User/Manager.php",
            "line": 401,
            "function": "createUserFromBackend",
            "class": "OC\\User\\Manager",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar",
              {
                "__class__": "OCA\\User_LDAP\\User_Proxy"
              }
            ]
          },
          {
            "file": "/var/www/html/custom_apps/registration/lib/Service/RegistrationService.php",
            "line": 377,
            "function": "createUser",
            "class": "OC\\User\\Manager",
            "type": "->",
            "args": [
              "voirhboifrnbvoiewnoiwrenboiw",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/custom_apps/registration/lib/Controller/RegisterController.php",
            "line": 328,
            "function": "createAccount",
            "class": "OCA\\Registration\\Service\\RegistrationService",
            "type": "->",
            "args": [
              {
                "__class__": "OCA\\Registration\\Db\\Registration",
                "id": 1629
              },
              "voirhboifrnbvoiewnoiwrenboiw",
              "",
              "",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 217,
            "function": "submitUserForm",
            "class": "OCA\\Registration\\Controller\\RegisterController",
            "type": "->",
            "args": [
              "NzjjGQekaXPdEgM4sK4j33NFPysjMPW5",
              "gXxHeQcaen",
              "voirhboifrnbvoiewnoiwrenboiw",
              "",
              "",
              "foobar"
            ]
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 126,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->",
            "args": [
              {
                "__class__": "OCA\\Registration\\Controller\\RegisterController"
              },
              "submitUserForm"
            ]
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/App.php",
            "line": 157,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->",
            "args": [
              {
                "__class__": "OCA\\Registration\\Controller\\RegisterController"
              },
              "submitUserForm"
            ]
          },
          {
            "file": "/var/www/html/lib/private/Route/Router.php",
            "line": 302,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::",
            "args": [
              "OCA\\Registration\\Controller\\RegisterController",
              "submitUserForm",
              {
                "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
              },
              {
                "secret": "NzjjGQekaXPdEgM4sK4j33NFPysjMPW5",
                "token": "gXxHeQcaen",
                "_route": "registration.register.submitUserForm"
              }
            ]
          },
          {
            "file": "/var/www/html/lib/base.php",
            "line": 1006,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->",
            "args": [
              "/apps/registration/register/NzjjGQekaXPdEgM4sK4j33NFPysjMPW5/gXxHeQcaen"
            ]
          },
          {
            "file": "/var/www/html/index.php",
            "line": 36,
            "function": "handleRequest",
            "class": "OC",
            "type": "::",
            "args": []
          }
        ],
        "File": "/var/www/html/custom_apps/ldap_write_support/lib/LDAPUserManager.php",
        "Line": 233
      },
      "CustomMessage": "--"
    }
  }
]

Nextcloud version: 23.0.0 Using LDAPS...

TheOneWithTheBraid avatar Feb 22 '22 10:02 TheOneWithTheBraid