Struggled an interesting problem. 3 month ago configured OTRS for my organization support portal. As for login we used only DB Auth and all worked pretty well. As for now i must make LDAP Auth. I made changes to Config.pm:
Code: Select all
#Agent auth
#----------
#Agent auth using LDAP
$Self->{AuthModule} = 'Kernel::System::Auth::LDAP';
#LDAP-server-Params
$Self->{'AuthModule::LDAP::Host'} = 'xxx.xxxxx.xx';
$Self->{'AuthModule::LDAP::BaseDN'} = 'cn=users,cn=accounts,dc=xxxxx,dc=xxxxxx,dc=xxxxx';
$Self->{'AuthModule::LDAP::UID'} = 'uid';
$Self->{'AuthModule::LDAP::GroupDN'} = 'cn=otrs-agents,cn=groups,cn=accounts,dc=xxxxxx,dc=xxxxx,dc=xxxxxx';
$Self->{'AuthModule::LDAP::AccessAttr'} = 'member';
$Self->{'AuthModule::LDAP::UserAttr'} = 'DN';
#Block for non-anonymos structure view
$Self->{'AuthModule::LDAP::SearchUserDN'} = 'uid=support_ldap,cn=users,cn=accounts,dc=xxxxxx,dc=xxxxxx,dc=xxxx';
$Self->{'AuthModule::LDAP::SearchUserPw'} = 'xxxxxxxxxxxxxxxx';
#$Self->{'AuthModule::LDAP::SearchUserDN'} = '';
#$Self->{'AuthModule::LDAP::SearchUserPw'} = '';
#LDAP-filtering-option (only mail exist)
$Self->{'AuthModule::LDAP::AlwaysFilter'} = '';
#Code utf-8 fix
$Self->{'AuthModule::LDAP::Charset'} = 'utf-8';
$Self->{'AuthModule::UseSyncBackend'} = 'AuthSyncBackend';
#Backwards DB compability
$Self->{AuthModule1} = 'Kernel::System::Auth::DB';
#Group-sync
$Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
$Self->{'AuthSyncModule::LDAP::Host'} = 'xxxxx.xxxxxxxxxx.xxxxx';
$Self->{'AuthSyncModule::LDAP::BaseDN'} = 'cn=users,cn=accounts,dc=xxxxx,dc=xxxxxxxx,dc=xxxxxxx';
$Self->{'AuthSyncModule::LDAP::UID'} = 'uid';
$Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'uid=support_ldap,cn=users,cn=accounts,dc=xxxxxx,dc=xxxxxx,dc=xxxxxxxxxxx';
$Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$Self->{'AuthSyncModule::LDAP::AlwaysFilter'} = '';
$Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
# DB -> LDAP
UserFirstname => 'givenName',
UserLastname => 'sn',
UserEmail => 'mail',
};
$Self->{'AuthSyncModule::LDAP::AccessAttr'} = 'member';
$Self->{'AuthSyncModule::LDAP::UserAttr'} = 'DN';
#
$Self->{'AuthSyncModule::LDAP::UserSyncGroupsDefinition'} = {
'cn=otrs-admins,cn=groups,cn=accounts,dc=xxxxxxxxx,dc=xxxxxxxxxx,dc=xxxxxxxxxxxx' => {
....... #Different rights sets
},
};
$Self->{DatabaseUserTable} = 'users';
$Self->{DatabaseUserTableUserID} = 'id';
$Self->{DatabaseUserTableUserPW} = 'pw';
$Self->{DatabaseUserTableUser} = 'login';
And nothing happened. I cannot log in using ldap credentials.
Debugging a little:
1) ldap-server is avaliable from otrs system. 389 port opened.
2) ldapsearch from openldap-clients can successfully search ldap using support_ldap credentials
3) journalctl entries:
Code: Select all
Nov 20 15:43:08 XXXX.XXXXX.XXXX OTRS-CGI-45[6689]: [Notice][Kernel::System::Auth::DB::Auth] User: k_komarov doesn't exist or is invalid!!! (REMOTE_ADDR: 10.150.150.121)
Nov 20 15:43:08 XXXXX.XXXXXX.XXXXX OTRS-CGI-45[6689]: [Error][Kernel::System::User::UserLookup][Line:975]: No UserID found for 'k_komarov'!
Code: Select all
ERROR: OTRS-CGI-45 Perl: 5.16.3 OS: linux Time: Wed Nov 20 12:32:33 2019
Message: No UserID found for 'k_komarov'!
RemoteAddress: 10.150.150.121
RequestURI: /otrs/index.pl
Traceback (1955):
Module: Kernel::System::User::UserLookup Line: 975
Module: Kernel::System::Auth::Auth Line: 245
Module: Kernel::System::Web::InterfaceAgent::Run Line: 248
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler Line: 38
Module: (eval) (v1.99) Line: 207
Module: ModPerl::RegistryCooker::run (v1.99) Line: 207
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
Module: ModPerl::Registry::handler (v1.99) Line: 32
So this errors took place cause nothing requested and nothing synced, so there are no such user in DB.
5) Found perl script to check Net::LDAP module work:
Code: Select all
#!/usr/bin/env perl
use strict;
use warnings;
use Net::LDAP;
my $HOST = "XXXXXXXXXx.XXXXXXXX.XXXXXx";
my $USER = "uid=support_ldap,cn=users,cn=accounts,dc=XXXXXXXXx,dc=XXXXXXXXXXX,dc=XXXXXXXXXXXXx";
my $PWD = "XXXXXXXXXXXXXXXXXXXXx";
my $ldap = Net::LDAP->new( $HOST ) or die $@;
my $mesg = $ldap->bind($USER,password=>$PWD);
if ( $mesg and $mesg->code() == 0 ) {
print "Success\n";
}
else{
print "Unsuccess\n";
}
$ldap->unbind;
Code: Select all
[root@support ~]# perl perl_ldap_check.pl
Success
[root@support ~]#
But i couldn't see any entries in journalctl that requested this module. Also i tried to comment $Self->{'AuthModule::LDAP::Host'} = 'xxx.xxxxx.xx'; to cause an error. No error occured.
So, in other words Statement about AuthModule::LDAP from Config.pm just ignored. To finally and 100% confirm I experiment with Default.pm.
And then what happened:
1) Committing $Self->{AuthModule} = 'Kernel::System::Auth::DB'; in Default.pm causes login fail using DB stored credentials, so same statement from Config.pm ignored;
2) Placed LDAP config inside Default.pm (yeah I know that it is BAD, but it was made for nooby_debugging purposes) -> Auth worked:
Code: Select all
[Notice][Kernel::System::Auth::LDAP::Auth] User: k_komarov (uid=k_komarov,cn=users,cn=accounts,dc=XXXX,dc=XXX,dc=XXX) authentication ok (REMOTE_ADDR: 10.150.150.121).
[Kernel::System::User::UserAdd] User: 'k_komarov' ID: '12' created successfully (1)!
[Kernel::System::User::SetPassword] User: 'k_komarov' changed password successfully!
[Kernel::System::Auth::Sync::LDAP::Sync] Initial data for 'k_komarov' (uid=k_komarov,cn=users,cn=accounts,dc=xxx,dc=xxxx,dc=xxx) created in RDBMS.
[Kernel::System::Auth::Sync::LDAP::Sync] User: k_komarov not in GroupDN='cn=otrs-bios,cn=groups,cn=accounts,dc=xxx,dc=xxxx,dc=xxxxxx', Filter='(member=uid=k_komarov,
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: k_komarov not in GroupDN='cn=otrs-edge,cn=groups,cn=accounts,dc=xxxxx,dc=xxxxxx,dc=xx', Filter='(member=uid=k_komarov,
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: k_komarov not in GroupDN='cn=otrs-pstp,cn=groups,cn=accounts,dc=xxx,dc=xxx,dc=xxx', Filter='(member=uid=k_komarov,
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: k_komarov not in GroupDN='cn=otrs-vserver,cn=groups,cn=accounts,dc=xxx,dc=xxxx,dc=xx', Filter='(member=uid=k_komar
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group users!
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group admin!
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group stats!
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group Numa ARCE/BIOS!
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group Numa EDGE!
[Notice][Kernel::System::Auth::Sync::LDAP::Sync] User: 'k_komarov' sync ldap group Numa vServer!
Tried with OTRS 6.0.21 and then with updated to 6.0.24. Host: Centos 7 with 3.10.0-957.21.3.el7.x86_64 kernel (not last patched)