<solved>Verschiedene Login DB parallel Hat das wirklich schon jemand geschafft ?

Hilfe zu OTRS Problemen aller Art
Post Reply
RIAIngo
Znuny newbie
Posts: 77
Joined: 26 Nov 2012, 18:18
Znuny Version: 6.0.9
Real Name: Ingo

<solved>Verschiedene Login DB parallel Hat das wirklich schon jemand geschafft ?

Post by RIAIngo »

Hallo zusammen,

wir betreiben hier seit einigen Jahren erfolgreich ein OTRS System. Als Datenquelle für die Benutzer haben wir LDAP an die ActiveDirectory. Benurtzerportal wurde nicht genutzt.
Das Produktivsystem ist OTRS 3.3.6, das neue System ist 4.0.10 beide auf Ubuntu 14.04.3 LTS

Als neue Anforderung muss ich nun das Benutzerportal bereitstellen mit Selbstregistrierung (!) zusätzlich zur bestehenden LDAP Anmeldung.
Ich benötige also eine gleichzeitige Authentifizierung gegen LDAP und lokaler DB
Laut http://otrs.github.io/doc/manual/admin/ ... h-backends soll das funktionieren, die Realität scheint aber anders auszuschauen wie meine Recherche hier im Forum und Netz ergeben hat.
Daher meine Frage:

Gibt es tatsächlich jemanden, der beide Authentifizerungsmethoden parallel in Betrieb hat ?
Mein OTRS (egal welche der zwei Versionen) hört nämlich nach dem ersten Eintrag auf. Steht LDAP oben sagt er beim DB User :
CustomerUser: test authentication failed, no LDAP entry found!BaseDN='DC=firma,DC=local', Filter='(sAMAccountName=test)', (REMOTE_ADDR: xx.xx.xx.xx).

Steht DB oben sagt OTRS bei LDAP Usern :
CustomerUser: No auth record in 'customer_user' for 'testldap' (REMOTE_ADDR: xx.xx.xx.xx)

Ich habe mich streng an die Vorlage gehalten aber parallel klappt einfach nicht. Müssen vielleicht noch zusätzliche Parameter (SysConfig) gesetzt werden ?
Es wäre ein Traum, wenn ich mal eine Config.pm eines Forenmitglieds sehen könnte, bei dem es klappt.
Anbei Meine

Leider gab es bei vielen ähnlichen Fragen 0 Antworten, aber vielleicht habe ich ja Glück ;-)

Lg Ingo

Code: Select all


package Kernel::Config;

use utf8;

sub Load {
    my $Self = shift;
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    #         Start of your own config options!!!          #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #
    # DatabaseHost
    # (The database host.)
    $Self->{'DatabaseHost'} = 'localhost';
    # Database
    # (The database name.)
    $Self->{'Database'} = 'otrs';
    # DatabaseUser
    # (The database user.)
    $Self->{'DatabaseUser'} = 'otrs';
    # DatabasePw
    # (The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords.)
    $Self->{'DatabasePw'} = '<password>';
    # DatabaseDSN
    # (The database DSN for MySQL ==> more: "man DBD::mysql")
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # (The database DSN for PostgreSQL ==> more: "man DBD::Pg")
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a tcpip connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";
    # if you have PostgresSQL 8.1 or earlier, activate the legacy driver with this line:
#    $Self->{DatabasePostgresqlBefore82} = 1;

    # ---------------------------------------------------- #
    # fs root directory
    # ---------------------------------------------------- #
    $Self->{Home} = '/opt/otrs';

    # ---------------------------------------------------- #
    # insert your own config settings "here"               #
    # config settings taken from Kernel/Config/Defaults.pm #
    # ---------------------------------------------------- #
    # $Self->{SessionUseCookie} = 0;
     $Self->{CheckMXRecord} = 0;

    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # data inserted by installer                           #
    # ---------------------------------------------------- #
    # $DIBI$

    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    #           End of your own config options!!!          #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #

	
  # --------------------------------------------------------------------
  # Agenten Backend Module
  # --------------------------------------------------------------------
  # Agenten Backend nur über LDAP
  
$Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host'} = 'xx.xx.xx.xx';
$Self->{'AuthModule::LDAP::BaseDN'} = 'DC=firma,DC=local';
$Self->{'AuthModule::LDAP::UID'} = 'sAMAccountName';
$Self->{'AuthModule::LDAP::SearchUserDN'} = 'CN=ldap,IT,DC=firma,DC=local';
$Self->{'AuthModule::LDAP::SearchUserPw'} = 'somepass';

	
  # --------------------------------------------------------------------
  # Customer Backend Module
  # --------------------------------------------------------------------
  


  # This is an configuration for an LDAP auth. backend.
  # (take care that Net::LDAP is installed!)
$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';
$Self->{'Customer::AuthModule::LDAP::Host'} = 'xx.xx.xx.xx';
$Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'DC=firma,DC=local';
$Self->{'Customer::AuthModule::LDAP::UID'} = 'sAMAccountName';

# This is the auth. module agains the otrs db
$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::DB';
$Self->{'Customer::AuthModule::DB::Table'} = 'customer_user';
$Self->{'Customer::AuthModule::DB::CustomerKey'} = 'login';
$Self->{'Customer::AuthModule::DB::CustomerPassword'} = 'pw';
#$Self->{'Customer::AuthModule::DB::DSN'} = "DBI:mysql:database=otrs;host=localhost";
#$Self->{'Customer::AuthModule::DB::User'} = "";
#$Self->{'Customer::AuthModule::DB::Password'} = "";
	
  # --------------------------------------------------------------------
  # Customer Backend Authentifizierungsdatenbanken
  # --------------------------------------------------------------------
  
  
# 1. Customer user backend: DB
# (customer database backend and settings)
$Self->{CustomerUser1} = {
    Name => 'Customer Database',
    Module => 'Kernel::System::CustomerUser::DB',
    Params => {
        # if you want to use an external database, add the
        # required settings
#        DSN => 'DBI:odbc:yourdsn',
#        Type => 'mssql', # only for ODBC connections
#        DSN => 'DBI:mysql:database=customerdb;host=customerdbhost',
#        User => '',
#        Password => '',
        Table => 'customer_user',
    },
    # customer unique id
    CustomerKey => 'login',
    # customer #
    CustomerID => 'customer_id',
    CustomerValid => 'valid_id',
    CustomerUserListFields => ['first_name', 'last_name', 'email'],
    CustomerUserSearchFields => ['login', 'last_name', 'customer_id'],
    CustomerUserSearchPrefix => '',
    CustomerUserSearchSuffix => '*',
    CustomerUserSearchListLimit => 250,
    CustomerUserPostMasterSearchFields => ['email'],
    CustomerUserNameFields => ['title','first_name','last_name'],
    CustomerUserEmailUniqCheck => 1,
#    # show not own tickets in customer panel, CompanyTickets
#    CustomerUserExcludePrimaryCustomerID => 0,
#    # generate auto logins
#    AutoLoginCreation => 0,
#    AutoLoginCreationPrefix => 'auto',
#    # admin can change customer preferences
#    AdminSetPreferences => 1,
#    # cache time to live in sec. - cache any database queries
#    CacheTTL => 0,
#    # just a read only source
#    ReadOnly => 1,
    Map => [

        # note: Login, Email and CustomerID needed!
        # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
        [ 'UserTitle',      'Title',      'title',        1, 0, 'var', '', 0 ],
        [ 'UserFirstname',  'Firstname',  'first_name',   1, 1, 'var', '', 0 ],
        [ 'UserLastname',   'Lastname',   'last_name',    1, 1, 'var', '', 0 ],
        [ 'UserLogin',      'Username',   'login',        1, 1, 'var', '', 0 ],
        [ 'UserPassword',   'Password',   'pw',           0, 0, 'var', '', 0 ],
        [ 'UserEmail',      'Email',      'email',        1, 1, 'var', '', 0 ],
        [ 'UserCustomerID', 'CustomerID', 'customer_id',  0, 1, 'var', '', 0 ],
        [ 'UserPhone',      'Phone',      'phone',        1, 0, 'var', '', 0 ],
        [ 'UserFax',        'Fax',        'fax',          1, 0, 'var', '', 0 ],
        [ 'UserMobile',     'Mobile',     'mobile',       1, 0, 'var', '', 0 ],
        [ 'UserStreet',     'Street',     'street',       1, 0, 'var', '', 0 ],
        [ 'UserZip',        'Zip',        'zip',          1, 0, 'var', '', 0 ],
        [ 'UserCity',       'City',       'city',         1, 0, 'var', '', 0 ],
        [ 'UserCountry',    'Country',    'country',      1, 0, 'var', '', 0 ],
        [ 'UserComment',    'Comment',    'comments',     1, 0, 'var', '', 0 ],
        [ 'ValidID',        'Valid',      'valid_id',     0, 1, 'int', '', 0 ],
    ],
    # default selections
    Selections => {
        UserTitle => {
            'Mr.' => 'Mr.',
            'Mrs.' => 'Mrs.',
        },
    },
  }; 
# 2. Customer user backend: LDAP
# (customer ldap backend and settings)
$Self->{CustomerUser2} = {
    Name => 'LDAP Datasource',
    Module => 'Kernel::System::CustomerUser::LDAP',
    Params => {
        # ldap host
        Host => 'xx.xx.xx.xx',
        # ldap base dn
        BaseDN => 'DC=firma,DC=local',
        # search scope (one|sub)
        SSCOPE => 'sub',
        # The following is valid but would only be necessary if the
        # anonymous user does NOT have permission to read from the LDAP tree
        UserDN => 'CN=LDAP,DC=firma,DC=local',
        UserPw => 'somepassword',
        # in case you want to add always one filter to each ldap query, use
        # this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)'
        AlwaysFilter => '',
        # if the charset of your ldap server is iso-8859-1, use this:
        SourceCharset => 'iso-8859-1',

        # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
        Params => {
            port => 389,
            timeout => 120,
            async => 0,
            version => 3,
        },
    },
    # customer unique id
    CustomerKey => 'sAMAccountName',
    # customer #
    CustomerID => 'mail',
    CustomerUserListFields => ['sAMAccountName', 'cn', 'mail'],
    CustomerUserSearchFields => ['sAMAccountName', 'cn', 'mail'],
    CustomerUserSearchPrefix => '',
    CustomerUserSearchSuffix => '*',
    CustomerUserSearchListLimit => 250,
    CustomerUserPostMasterSearchFields => ['mail'],
    CustomerUserNameFields => ['givenname', 'sn'],
    # show not own tickets in customer panel, CompanyTickets
    CustomerUserExcludePrimaryCustomerID => 0,
    # add a ldap filter for valid users (expert setting)
#    CustomerUserValidFilter => '(!(description=locked))',
    # admin can't change customer preferences
    AdminSetPreferences => 0,
    Map => [
        # note: Login, Email and CustomerID needed!
        # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
    [ 'UserFirstname', 'Firstname', 'givenname', 1, 1, 'var' ],
    [ 'UserLastname', 'Lastname', 'sn', 1, 1, 'var' ],
    [ 'UserLogin', 'Login', 'sAMAccountName', 1, 1, 'var' ],
    [ 'UserEmail', 'Email', 'mail', 1, 1, 'var' ],
    [ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],
    [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var' ],
    [ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var' ],
    [ 'UserComment', 'Comment', 'description', 1, 0, 'var' ],
    [ 'UserPysical', 'Standort', 'physicalDeliveryOfficeName', 1, 0,'var'],
    [ 'UserLDAPName', 'LDAP', 'distinguishedName', 1, 0, 'var' ],
    [ 'UserScriptpath', 'Scriptpath', 'scriptPath', 1, 0, 'var' ],
    ],
 	

};

  # End  config
  #------------------------------------------------------------------------

}

# ---------------------------------------------------- #
# needed system stuff (don't edit this)                #
# ---------------------------------------------------- #
use strict;
use warnings;

use vars qw(@ISA $VERSION);
$VERSION = qw($Revision: 1.25 $)[1];

use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');

# -----------------------------------------------------#

1;

Last edited by RIAIngo on 25 Sep 2015, 15:38, edited 1 time in total.
RotherOSS
Znuny newbie
Posts: 4
Joined: 23 Sep 2015, 11:20
Znuny Version: 3,4,5
Real Name: Stefan
Company: Rother OSS GmbH
Contact:

Re: Verschiedene Login DB parallel Hat das wirklich schon jemand geschafft ?

Post by RotherOSS »

Hallo Ingo,

ich hoffe es geht Dir gut!
RIAIngo wrote:Gibt es tatsächlich jemanden, der beide Authentifizerungsmethoden parallel in Betrieb hat ?
Ja, das gibt es. Ich habe diese Funktionalität bei zig Kunden von mir aktiv (OTRS 3,4,5) und würde das schon als Standard bei den meisten OTRS Installationen sehen. Denn in der Regel kannst Du nicht immer alle OTRS Agenten auch einen AD-Account einrichten, oder es ist einfach nicht zu empfehlen.

Der erste Fehler der mir sofort aufgefallen ist betrifft folgenden Bereich:
RIAIngo wrote:  # This is an configuration for an LDAP auth. backend.
  # (take care that Net::LDAP is installed!)
$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';
$Self->{'Customer::AuthModule::LDAP::Host'} = 'xx.xx.xx.xx';
$Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'DC=firma,DC=local';
$Self->{'Customer::AuthModule::LDAP::UID'} = 'sAMAccountName';

# This is the auth. module agains the otrs db
$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::DB';
$Self->{'Customer::AuthModule::DB::Table'} = 'customer_user';
$Self->{'Customer::AuthModule::DB::CustomerKey'} = 'login';
$Self->{'Customer::AuthModule::DB::CustomerPassword'} = 'pw';
#$Self->{'Customer::AuthModule::DB::DSN'} = "DBI:mysql:database=otrs;host=localhost";
#$Self->{'Customer::AuthModule::DB::User'} = "";
#$Self->{'Customer::AuthModule::DB::Password'} = "";
Das kann so nicht funktionieren, Du überschreibst Dir die Optionen selber. Teste mal bitte (in etwa) wie folgt:

 # This is an configuration for an LDAP auth. backend.
 # (take care that Net::LDAP is installed!)
$Self->{'Customer::AuthModule1'} = 'Kernel::System::CustomerAuth::LDAP';
$Self->{'Customer::AuthModule::LDAP::Host1'} = 'xx.xx.xx.xx';
$Self->{'Customer::AuthModule::LDAP::BaseDN1'} = 'DC=firma,DC=local';
$Self->{'Customer::AuthModule::LDAP::UID1'} = 'sAMAccountName';

Denn, die Konfiguration bezüglich der Authentifizierung gegen die lokale OTRS DB sollte schon vorkonfiguriert sein. Somit muss lediglich noch die Authentifizierung gegen das AD hinzugefügt werden, siehe mein Beispiel. Bitte achte auf die 1, somit gibst Du an, dass es sich um eine weitere Quelle handelt. In Deinem Beispiel überschreibst Du nur die vorgehende Funktion.

Wenn das jetzt alles so konfiguriert ist, sollte die Authentifizierung gegen beide Source klappen.

Ich hoffe ich konnte helfen!

Schöne Grüße,

Stefan
Business services for ((OTRS)) Community Edition.

https://rother-oss.com/ | https://otobo.de/

Check out OTOBO – our free Open Source Helpdesk with strong functionality and a great look.
Based on ((OTRS)) Community Edition.
RIAIngo
Znuny newbie
Posts: 77
Joined: 26 Nov 2012, 18:18
Znuny Version: 6.0.9
Real Name: Ingo

Re: Verschiedene Login DB parallel Hat das wirklich schon jemand geschafft ?

Post by RIAIngo »

Guten Tag Stefan,

vielen Dank für die schnelle Hilfe.
Jetzt geht es mir richtig gut :D

Dein Einwand war genau richtig (blöd das die im Beispiel das nicht so gemacht haben)
Nachdem ich da eine 1 hinter gesetzt habe, habe ich zwar noch einen LDAP Bind Fehler bekommen, der ist aber schnell gefunden worden.
Es musste noch der Search User hinzugefügt werden.
Jetzt funktioniert also alle bei mir wie gewünscht.

Für die Nachwelt hier die Änderungen gegenüber oben damit ein Parallelbetrieb funktioniert :

Code: Select all

 # This is an configuration for an LDAP auth. backend.
  # (take care that Net::LDAP is installed!)
$Self->{'Customer::AuthModule1'} = 'Kernel::System::CustomerAuth::LDAP';
$Self->{'Customer::AuthModule::LDAP::Host1'} = 'xx.xx.xx.xx';
$Self->{'Customer::AuthModule::LDAP::BaseDN1'} = 'DC=firma,DC=local';
$Self->{'Customer::AuthModule::LDAP::UID1'} = 'sAMAccountName';
$Self->{'Customer::AuthModule::LDAP::SearchUserDN1'} = 'CN=ldap,DC=firma,DC=local';
$Self->{'Customer::AuthModule::LDAP::SearchUserPw1'} = 'somepass';
Danke nochmals
Lg Ingo
Post Reply