Page 1 of 1

Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 07:20
by Darkmoon
Hi.
I wanted to enable the Ldap Authentication for an on-premise Mantis Server running Version 1.2.19 to authenticate to Active Directory.
Have configured config_inc.php:
$g_login_method = LDAP;
$g_ldap_server = 'ldap://xxxxx.xxxxx.com:389';
$g_ldap_root_dn = 'OU=XXXX,DC=xxxx,DC=com';
$g_ldap_protocol_version = 3;
$g_ldap_follow_referrals = OFF;
$g_ldap_bind_dn = 'CN=Username,OU=Service Accounts,OU=Location1,OU=Location2,OU=XXXXX,DC=XXXXXX,DC=com';
$g_ldap_bind_paswd = 'password';
$g_ldap_uid_field = 'sAMAccountName';
$g_use_ldap_email = ON;

When pressing the Login button at the Mantis Site it shows this error:
APPLICATION ERROR #1400
LDAP Authentication Failed.

Full path: /var/www/core/ldap_api.php
Line: 363

p_username administrator string
p_password ********** string
c_username administrator string
t_ldap_organization string
t_ldap_root_dn OU=MCHP-MAIN,DC=mchp-main,DC=com string
t_ldap_uid_field sAMAccountName string
t_search_filter (&(sAMAccountName=administrator)) string
t_ds Resource id #14 unknown type
t_sr boolean

/var/www/core/ldap_api.php 363 - - trigger_error ( <string>'1400', <integer>256 )
/var/www/core/ldap_api.php 321 - - ldap_authenticate_by_username ( <string>'administrator', <string>'root' )
/var/www/core/authentication_api.php 363 - - ldap_authenticate ( <string>'1', <string>'root' )
/var/www/login_page.php 199 - - auth_does_password_match ( <string>'1', <string>'root' )

What is the p_username and p_password field, this is not reflecting the bind user i have configured?
And what is the c_username field? Why is there "Administrator" filled in, i do not want to authenticate with Administrator User to Ldap.

If somebody have an idea how to configure the ldap login to AD successfully let me know :-)

Re: Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 07:53
by Darkmoon
in the meantime i have enabled ldap logging:
$g_log_level = LOG_LDAP;

then i found this:

[Tue May 24 09:46:00.466629 2016] [:error] [pid 9902] [client xxx.xxx.xxx.xx:1044] 24-05-2016 09:46 CEST ldap Bind to ldap server successful\n, referer: http://xxx.xxx.xxx.xx/main_page.php
[Tue May 24 09:46:00.466663 2016] [:error] [pid 9902] [client xxx.xxx.xxx.xx:1044] 24-05-2016 09:46 CEST ldap Searching for (&(sAMAccountName=administrator))\n, referer: http://xxx.xxx.xxx.xx/main_page.php
[Tue May 24 09:46:00.466945 2016] [:error] [pid 9902] [client xxx.xxx.xxx.xx:1044] 24-05-2016 09:46 CEST ldap ERROR #1: Operations error\n, referer: http://xxx.xxx.xxx.xx/main_page.php
[Tue May 24 09:46:00.467026 2016] [:error] [pid 9902] [client xxx.xxx.xxx.xx:1044] 24-05-2016 09:46 CEST ldap ldap search failed\n, referer: http://xxx.xxx.xxx.xx/main_page.php

So it seems, ldap bind is successful but it tries to search a user "administrator". Where can i define this?
It should not use Administrator, the Root DN has no Admins inside, just users.

Re: Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 09:20
by atrol
Darkmoon wrote:tries to search a user "administrator". Where can i define this?
Isn't this the user name you entered on Mantis logon page?

Re: Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 09:24
by Darkmoon
I cannot enter a username, when i click on login the error comes up. i have no chance to enter a username, except when i disable the ldap login completely.

please see my last reply, the ldap bind is working but it tries to use administrator for some reason.

Re: Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 09:36
by atrol
Mantis does not connect to LDAP before entering user name and password and clicking the login button.
At least it does not with standard settings.

You might have changed setting $g_display_errors in a wrong way so that certain kind of errors do no longer stop the system.

Re: Ldap Authentication Failed. Application Error #1400

Posted: 24 May 2016, 11:30
by Darkmoon
Thanks a lot atrol.

You were completely right. $g_display_errors were set wrong, now i got the logon screen.

Re: Ldap Authentication Failed. Application Error #1400

Posted: 19 Jun 2017, 18:28
by kieling
I have the same issue. However, $g_display_errors isn't set.
I cannot enter a username, when i click on login the error comes up. I have no chance to enter a username. Any idea?

Thanks!

Re: Ldap Authentication Failed. Application Error #1400

Posted: 13 Jan 2021, 16:40
by FedericoCoppola
I have the same error in the login page.
I can not enter any username or password, I can just see

Code: Select all

APPLICATION ERROR #1400
LDAP Authentication Failed.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

How can I set "$g_display_errors" inside config_inc.php?
I don't have this variabile inside my settings

Thanks
Federico