Adldap2/Adldap2-Laravel

Can't contact LDAP server

yllndritb opened this issue · 1 comments

  • Laravel Version: 7.24.0
  • Adldap2-Laravel Version: 6.1.1
  • PHP Version: 7.2.24
  • LDAP Type: ActiveDirectory

Trying to connect to the server and getting below error :
"message": "Can't contact LDAP server",
"exception": "Adldap\Auth\BindException",

While I tried pinging LDAP from the server where the WebApp is hosted and worked I can not login due to this error!! I even can login using tinker in command line. I think it has something to do with Apache configuration but I can not figure it out.

I am using CentOS 8 and Apache2 if this helps.

Below I will show my code i used to authenticate with tinker:
use Adldap\Laravel\Facades\Adldap;
$provider = Adldap::getProvider('default');
$provider->auth()->attempt('USER_NAME@DOMAIN.net','PASSWORD')

Output:

true

Stack trace:
{
"message": "Can't contact LDAP server",
"exception": "Adldap\Auth\BindException",
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/adldap2/adldap2/src/Auth/Guard.php",
"line": 107,
"trace": [
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/adldap2/adldap2/src/Auth/Guard.php",
"line": 119,
"function": "bind",
"class": "Adldap\Auth\Guard",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/adldap2/adldap2/src/Auth/Guard.php",
"line": 85,
"function": "bindAsAdministrator",
"class": "Adldap\Auth\Guard",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/app/Http/Controllers/UsersController.php",
"line": 217,
"function": "attempt",
"class": "Adldap\Auth\Guard",
"type": "->"
},
{
"function": "login",
"class": "App\Http\Controllers\UsersController",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "call_user_func_array"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\Routing\Controller",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 239,
"function": "dispatch",
"class": "Illuminate\Routing\ControllerDispatcher",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 196,
"function": "runController",
"class": "Illuminate\Routing\Route",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 685,
"function": "run",
"class": "Illuminate\Routing\Route",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 128,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 41,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Routing\Middleware\SubstituteBindings",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 59,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Routing\Middleware\ThrottleRequests",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 103,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 687,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 662,
"function": "runRouteWithinStack",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 628,
"function": "runRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 617,
"function": "dispatchToRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 165,
"function": "dispatch",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 128,
"function": "Illuminate\Foundation\Http\{closure}",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
"line": 63,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/fruitcake/laravel-cors/src/HandleCors.php",
"line": 58,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Fruitcake\Cors\HandleCors",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 57,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Fideloper\Proxy\TrustProxies",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 103,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 140,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 109,
"function": "sendRequestThroughRouter",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/html/projectTest.toolbox/projectTest-toolbox/public/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
}
]
}

Try this command:
setsebool -P httpd_can_network_connect 1