LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Hilfe zu Znuny Problemen aller Art
Locked
MrShinken
Znuny newbie
Posts: 78
Joined: 17 Apr 2013, 12:26
Znuny Version: 3.3.8

LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by MrShinken »

Guten Morgen,

- Frische OTRS 3.3.8 Installation mit ITSM auf Ubuntu Server
- Es wurden keine weiteren Änderungen an der Config vorgenommen.
- DC: Windows Server 2008 R2, in kürze jedoch 2012 R2

Mich beschäftigt jetzt eine Weile das Thema LDAP-Anbindung mit OTRS schon eine Weile. Liege ich damit richtig, dass die Config.pm im Verzeichnis /opt/otrs/Kernel/ entsprechend ergänzt werden muss? Die Default.pm soll man ja nicht ändern.

Muss der Ubuntu Server in die Domäne mit eingebunden werden?

Inzwischen sieht meine LDAP-Konfiguration folgendermaßen aus, die Anmeldung ist damit leider nicht möglich:

Code: Select all

	
	#################################################################################
	#																				#
	#	Hello @all, this LDAP-Config with works very fine with our Windows2008R2 	#
	#	Domain and OTRS v3.1.10. All authenticated agents are syncronized with 		#
	#	the OTRS database.                                                      	#
	#																				#
	#################################################################################
	

    # ---------------------------------------------------- #
    # ldap agent authentication                            #
    # ---------------------------------------------------- #

# Net::LDAP new parameters basic settings(if needed - for more info see perldoc Net::LDAP)
    $Self->{'AuthModule::LDAP::Params'} = {
        port    => 389,
        timeout => 120,
        async   => 0,
        version => 3,
	};

# This is an example configuration for an LDAP auth. backend.(take care that Net::LDAP is installed!)
    $Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
    $Self->{'AuthModule::LDAP::Host'} = '192.168.10.1';
    $Self->{'AuthModule::LDAP::BaseDN'} = 'ou=Firma,dc=domain,dc=local';
    $Self->{'AuthModule::LDAP::UID'} = 'sAMAccountname';

# Check if the user is allowed to auth in a posixGroup (e.g. user needs to be in a group xyz to use otrs)
    $Self->{'AuthModule::LDAP::GroupDN'} = 'CN=otrs,OU=domain,DC=domain,DC=local';
    $Self->{'AuthModule::LDAP::AccessAttr'} = 'member';

# for ldap posixGroups objectclass (just uid)
    #$Self->{'AuthModule::LDAP::UserAttr'} = 'sAMAccountname';
    # for non ldap posixGroups objectclass (with full user dn)
    $Self->{'AuthModule::LDAP::UserAttr'} = 'DN';

# The following is valid but would only be necessary if the anonymous user do NOT have permission to read from the LDAP tree
    $Self->{'AuthModule::LDAP::SearchUserDN'} = 'cn=ldap,cn=Users,dc=domain,dc=local';
    $Self->{'AuthModule::LDAP::SearchUserPw'} = 'geheimeskennwort';

    # ---------------------------------------------------- #
    # authentication sync settings                         #
    # (enable data sync. after succsessful authentication) #
	#        AGENT SYNCHRONIZATION LDAP --> OTRS DB        #
	# ---------------------------------------------------- #

# Net::LDAP new parameters basic settings(if needed - for more info see perldoc Net::LDAP)	
    $Self->{'AuthSyncModule::LDAP::Params'} = {
        port    => 389,
        timeout => 120,
        async   => 0,
        version => 3,
    };
	
# In case you need to use OTRS in iso-charset, you can define this by using this option (converts utf-8 data from LDAP to iso).
    $Self->{'AuthSyncModule::LDAP::Charset'} = 'utf-8';

# This is an example configuration for an LDAP auth sync. backend.(take care that Net::LDAP is installed!)
    $Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
    $Self->{'AuthSyncModule::LDAP::Host'} = '192.168.10.1';
    $Self->{'AuthSyncModule::LDAP::BaseDN'} = 'ou=Firma,dc=domain,dc=local';
    $Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountname';

# The following is valid but would only be necessary if the anonymous user do NOT have permission to read from the LDAP tree
    $Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'cn=ldap,cn=Users,dc=domain,dc=local';
    $Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'geheimeskennwort';

# UserSyncLDAPGroups(If "LDAP" was selected="selected" for AuthModule, you can specify initial user groups for first login.)
    $Self->{UserSyncLDAPGroups} = [
        'users',
    ];
	
# AuthSyncModule::LDAP::UserSyncMap (map if agent should create/synced from LDAP to DB after successful login)
    $Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
        # DB -> LDAP
        UserFirstname => 'givenName',
        UserLastname  => 'sn',
        UserEmail     => 'mail',
    };
Vielleicht findet jemand einen grundlegenden Fehler bei meiner Konfiguration oder kann mir einen Tipp geben, welche Maßnahmen ich für eine Fehleranalyse einleiten soll?

Vielen Dank für die Hilfe!
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,
MrShinken wrote: Mich beschäftigt jetzt eine Weile das Thema LDAP-Anbindung mit OTRS schon eine Weile. Liege ich damit richtig, dass die Config.pm im Verzeichnis /opt/otrs/Kernel/ entsprechend ergänzt werden muss? Die Default.pm soll man ja nicht ändern.
korrekt.
MrShinken wrote: Muss der Ubuntu Server in die Domäne mit eingebunden werden?
nein. Er muss nur erreichbar sein über die LDAP Ports.
MrShinken wrote: Inzwischen sieht meine LDAP-Konfiguration folgendermaßen aus, die Anmeldung ist damit leider nicht möglich:

# This is an example configuration for an LDAP auth. backend.(take care that Net::LDAP is installed!)
$Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host'} = '192.168.10.1';
$Self->{'AuthModule::LDAP::BaseDN'} = 'ou=Firma,dc=domain,dc=local';
$Self->{'AuthModule::LDAP::UID'} = 'sAMAccountname';

#lass den roten Teil erstmal weg
# Check if the user is allowed to auth in a posixGroup (e.g. user needs to be in a group xyz to use otrs)
$Self->{'AuthModule::LDAP::GroupDN'} = 'CN=otrs,OU=domain,DC=domain,DC=local';
$Self->{'AuthModule::LDAP::AccessAttr'} = 'member';

# for ldap posixGroups objectclass (just uid)
#$Self->{'AuthModule::LDAP::UserAttr'} = 'sAMAccountname';
# for non ldap posixGroups objectclass (with full user dn)
$Self->{'AuthModule::LDAP::UserAttr'} = 'DN';


$Self->{'AuthModule::LDAP::SearchUserDN'} = 'cn=ldap,cn=Users,dc=domain,dc=local';
$Self->{'AuthModule::LDAP::SearchUserPw'} = 'geheimeskennwort';

#lass den Teil auch erstmal weg
# ---------------------------------------------------- #
# authentication sync settings #
# (enable data sync. after succsessful authentication) #
# AGENT SYNCHRONIZATION LDAP --> OTRS DB #
# ---------------------------------------------------- #

# Net::LDAP new parameters basic settings(if needed - for more info see perldoc Net::LDAP)
$Self->{'AuthSyncModule::LDAP::Params'} = {
port => 389,
timeout => 120,
async => 0,
version => 3,
};

# In case you need to use OTRS in iso-charset, you can define this by using this option (converts utf-8 data from LDAP to iso).
$Self->{'AuthSyncModule::LDAP::Charset'} = 'utf-8';

# This is an example configuration for an LDAP auth sync. backend.(take care that Net::LDAP is installed!)
$Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
$Self->{'AuthSyncModule::LDAP::Host'} = '192.168.10.1';
$Self->{'AuthSyncModule::LDAP::BaseDN'} = 'ou=Firma,dc=domain,dc=local';
$Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountname';

# The following is valid but would only be necessary if the anonymous user do NOT have permission to read from the LDAP tree
$Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'cn=ldap,cn=Users,dc=domain,dc=local';
$Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'geheimeskennwort';

# UserSyncLDAPGroups(If "LDAP" was selected="selected" for AuthModule, you can specify initial user groups for first login.)
$Self->{UserSyncLDAPGroups} = [
'users',
];

# AuthSyncModule::LDAP::UserSyncMap (map if agent should create/synced from LDAP to DB after successful login)
$Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
# DB -> LDAP
UserFirstname => 'givenName',
UserLastname => 'sn',
UserEmail => 'mail',
};




Vielleicht findet jemand einen grundlegenden Fehler bei meiner Konfiguration oder kann mir einen Tipp geben, welche Maßnahmen ich für eine Fehleranalyse einleiten soll?

Vielen Dank für die Hilfe!
Ein guter Start ist das Logfile.

Probier mal falls möglich erstmal 'ne Kundendatenbank anzubinden. Also nicht gleich AgentAuth sondern CustomerUser.
Klappt das?

Falls ja, probier mal die Konfiguration (wie oben, nur ohne den roten Teil) und schau' ins Log.
Dann findste schnell raus wo's hapert.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MrShinken
Znuny newbie
Posts: 78
Joined: 17 Apr 2013, 12:26
Znuny Version: 3.3.8

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by MrShinken »

Vielen Dank für die Antwort!

Blöderweise erhalte ich jetzt einen Internal Server Error im Browser. Meine aktuelle Config.pm ist zugegeben noch ziemlich leer und inkludiert scheinbar auch standardmäßig die Default.pm aus dem /Kernel/Config-Verzeichnis. Einfach auskommentieren und nur die (schwarz-gelassenen) Zeilen in die Config.pm einfügen bringt leider ebenfalls den ISE.
Vielleicht habe ich einen Schritt übersprungen und vergessen, in der Default.pm gewisse Zeilen betreffend der Authentifizierung auszukommentieren. Wie sollte man bei einer jungfräulichen OTRS-Umgebung im Vorfeld machen?
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by reneeb »

Bei einem Internal Server Error sollte man mal einen Blick in die error.log des Webservers werfen. Dort tauchen in der Regel mehr Informationen auf.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,

ein internal server Error, da fehlt vermutlich ein ',' oder ein ';'
In meine Vorschlag habe ich ein '};' zuviel rot gemacht glaube ich.

ich würde vorschlagen, dass Du nochmal von "neu" anfängst, also die original Config.pm
wieder herstellst (Du hast ja ein Backup) und dann erstmal folgende Sachen konfigurierst
und testest.

Code: Select all

    $Self->{AuthModule} = 'Kernel::System::Auth::LDAP';
    $Self->{'AuthModule::LDAP::Host'} = 'ldap.example.com';
    $Self->{'AuthModule::LDAP::BaseDN'} = 'dc=example,dc=com';
    $Self->{'AuthModule::LDAP::UID'} = 'uid';

    $Self->{'AuthModule::LDAP::SearchUserDN'} = '';
    $Self->{'AuthModule::LDAP::SearchUserPw'} = '';

und die Defaults.pm wird gelesen. Klar.

Und Logfiles ist ein extrem guter Weg, Deine Fehler zu finden!!

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,
MrShinken wrote: Vielleicht habe ich einen Schritt übersprungen und vergessen, in der Default.pm gewisse Zeilen betreffend der Authentifizierung auszukommentieren. Wie sollte man bei einer jungfräulichen OTRS-Umgebung im Vorfeld machen?

NIEMALS die Defaults.pm ändern!!


:)

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MrShinken
Znuny newbie
Posts: 78
Joined: 17 Apr 2013, 12:26
Znuny Version: 3.3.8

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by MrShinken »

OK, habe es jetzt entsprechend eingefügt und angepasst. Der Server Fehler ist zwar weg, aber die Anmeldung ist dennoch nicht möglich.
Muss ich an der Zeile " $Self->{'AuthModule::LDAP::UID'} = 'uid';" noch etwas anpassen oder soll das so bleiben?

Bei der ersten Zeile ersten Zeile $Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';) fehlten noch die Apostrophs beim AuthModule.

Hat noch jemand Ideen? Beim SearchUserDN habe ich ein Konto für die LDAP-Verbindung (mit Domain-Admin-Rechten) hinterlegt und für SearchUserPw das dazugehörige Anmeldekennwort.

Bezgl. Logs:
Wo finde ich diese? In der Default.pm steht zwar " $Self->{'LogModule::LogFile'} = '/tmp/otrs.log'; ", jedoch gibt es unter /tmp/ keine otrs.log bzw. wird dort nicht reingeschrieben (habe eine erstellt und chmod 777 gesetzt). Eine Idee, wie ich das Logging aktivieren und auswerten kann?

Vielen Dank!
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,

also ich hoffe doch Du hast viewtopic.php?f=36&t=7558 gelesen.

Normalerweise ist das Logfile im Syslog und das apache log ist je nach Konfiguration unterschiedlich.
Dort findest Du Hinweise.

Wenn Du es ins Filesystem umleitest dann solltest Du das nach /opt/otrs/var/log umleiten.


Das UID muss natürlich Deinem Attribut entsprechen. uid ist für LDAP korrekt, für ein Active Directory
ist es SamAccountName.

Und der Agent muss erstmal auch in der lokalen Datenbank (Admin - Agents) mit dem gleichen Username
angelegt sein.

Dann schaumermal weiter. Aber bitte liefere Ausgaben des Logfiles, sonst ist keine weitere Lösung
auf diesem Weg möglich.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MrShinken
Znuny newbie
Posts: 78
Joined: 17 Apr 2013, 12:26
Znuny Version: 3.3.8

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by MrShinken »

Hi Flo,

danke für die Unterstützung! Die Anmeldung funktioniert nun. Ich musste dazu die Verbindung über LDAPS erzwingen.

Jetzt fehlt nur noch das AutoSync, damit neue Mitarbeiter automatisch auch auf OTRS zugreifen können. Dazu muss der neue AD-User in der Gruppe "otrs" sein. Ich habe jetzt mehrere Minuten gewartet, jedoch tauchen keine neuen Agenten in OTRS auf. Meine AuthSync-Config sieht folgendermaßen aus:

Code: Select all

# In case you need to use OTRS in iso-charset, you can define this by using this option (converts utf-8 data from LDAP to iso).
$Self->{'AuthSyncModule::LDAP::Charset'} = 'utf-8';

# This is an example configuration for an LDAP auth sync. backend.(take care that Net::LDAP is installed!)
$Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
$Self->{'AuthSyncModule::LDAP::Host'} = 'ldaps://192.168.10.1';
$Self->{'AuthSyncModule::LDAP::BaseDN'} = 'dc=domain,dc=local';
$Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountname';

# The following is valid but would only be necessary if the anonymous user do NOT have permission to read from the LDAP tree
$Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'ldap@domain.local';
$Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'pass!';

# UserSyncLDAPGroups(If "LDAP" was selected="selected" for AuthModule, you can specify initial user groups for first login.)
$Self->{UserSyncLDAPGroups} = [
'otrs',
];

# AuthSyncModule::LDAP::UserSyncMap (map if agent should create/synced from LDAP to DB after successful login)
$Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
# DB -> LDAP
UserFirstname => 'givenName',
UserLastname => 'sn',
UserEmail => 'mail',
};

$Self->{'AuthSyncModule::LDAP::Params'} = {
    port    => 636,
    timeout => 120,
    async   => 0,
    version => 3,
};
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,
MrShinken wrote:Hi Flo,

danke für die Unterstützung! Die Anmeldung funktioniert nun. Ich musste dazu die Verbindung über LDAPS erzwingen.
sehr gut :)
MrShinken wrote: Jetzt fehlt nur noch das AutoSync, damit neue Mitarbeiter automatisch auch auf OTRS zugreifen können. Dazu muss der neue AD-User in der Gruppe "otrs" sein. Ich habe jetzt mehrere Minuten gewartet, jedoch tauchen keine neuen Agenten in OTRS auf. Meine AuthSync-Config sieht folgendermaßen aus:
Das Sync kommt erst, wenn Du Dich anmeldest. Einfach "warten" is' nich' ;)
Ansonsten sollte das gehen. Was sagt das Log?

Wenn Du nicht mit dem Log kommst, werd' ich Dir nicht mehr schreiben.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MrShinken
Znuny newbie
Posts: 78
Joined: 17 Apr 2013, 12:26
Znuny Version: 3.3.8

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by MrShinken »

Danke für die Info.
Klappt jetzt.
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: LDAP Anbindung mit Sync - Anmeldung funktioniert nicht

Post by wurzel »

Hi,

sehr gut. Jetzt kannst Du ja weiterbauen. Den Sync, die Login Berechtigung, Du kannst auch einen
Sync von AD Gruppen zu Rollen machen...

wenn Du magst, bau' weiter und stell' Deine Config zur Verfügung. Andere würden sich freuen ;)

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
Locked