LDAP connection problem

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
alexswamp
Posts: 3
Joined: 07 Feb 2022, 07:36

LDAP connection problem

Post by alexswamp »

Hi Everyone!

I would like to connect my mantis with LDAP. I try with my admin user to connect it. What could be the problem?

CONFIG:

Code: Select all

$g_login_method = LDAP;
$g_ldap_server = 'ldap://dc.officium.local:389';
$g_ldap_root_dn = 'OU=Internal_user, OU=Officium, OU=Employers, ,dc=officium,dc=local';
$g_ldap_organization = '';
$g_ldap_realname_field  = 'cn';
$g_ldap_uid_field = 'sAMAccountName';   
$g_ldap_bind_dn = 'CN=XYZ,OU=Administrators,OU=Internal_user,OU=Officium,OU=Employers,DC=officium,DC=local';
$g_ldap_bind_passwd = 'asdasdasda'; 
$g_ldap_protocol_version = 3;
$g_use_ldap_email		= OFF;
$g_use_ldap_realname	= ON;
My LOG:

Code: Select all

2024-03-21 16:19 CET LDAP ldap_api.php:342 ldap_authenticate_by_username() Binding to LDAP server
2024-03-21 16:19 CET LDAP ldap_api.php:67 ldap_connect_bind() Attempting connection to LDAP server/URI 'ldap://dc.officium.local:389'.
2024-03-21 16:19 CET LDAP ldap_api.php:76 ldap_connect_bind() Connection accepted by LDAP server
2024-03-21 16:19 CET LDAP ldap_api.php:89 ldap_connect_bind() Setting LDAP protocol version to 3
2024-03-21 16:19 CET LDAP ldap_api.php:111 ldap_connect_bind() Attempting bind to ldap server as 'CN=XYZ,OU=Administrators,OU=Internal_user,OU=Officium,OU=Employers,DC=officium,DC=local'
2024-03-21 16:19 CET LDAP ldap_api.php:50 ldap_log_error() ERROR #-1: Can't contact LDAP server
2024-03-21 16:19 CET LDAP ldap_api.php:121 ldap_connect_bind() Bind to ldap server failed
cas
Posts: 1622
Joined: 11 Mar 2006, 16:08
Contact:

Re: LDAP connection problem

Post by cas »

Did you search the forum on this, there are a lot of examples :mrgreen: here
Phroobar
Posts: 37
Joined: 13 Dec 2022, 16:14

Re: LDAP connection problem

Post by Phroobar »

I was able to connect to my server using ldaps on PHP using the following method.

$connect = ldap_connect('ldaps://'. $ldap_host. ':'. $ldap_port)
I also had to create these folders C:\openldap\sysconf and then put a text document named ldap.conf into it.
I then edited ldap.conf and put in TLS_REQCERT never
This worked for connecting through LDAPS.
The correct way to do it, is to download cacert.pem from here:
https://curl.haxx.se/docs/caextract.html Then add your server hash onto the bottom of this cert.
Lastly edit ldap.conf to say TLS_CACERT \path\to\cert\cacert.pem and comment out the TLS_REQCERT comment from above.
Then restart apache/nginx/etc and you should be able to connect using LDAPS.
Post Reply