LDAP Agent Sync auf Custom Fields

Hilfe zu OTRS Problemen aller Art
Post Reply
andreg
Znuny newbie
Posts: 4
Joined: 13 Aug 2012, 12:55
Znuny Version: 3.1.8
Real Name: André
Company: Pro Nautas B.V. GmbH

LDAP Agent Sync auf Custom Fields

Post by andreg »

Hallo,

ich habe bei meiner OTRS Installation bereits die Anbindung und Synchronisation mit dem LDAP / AD am Laufen.
Dabei werden auch beim Login die Agenten in der DB von OTRS angelegt.

Nun möchte ich gerne noch drei Custom Fields der Einstellungen mit synchronisieren (Telefon, Fax, Position).
Mache ich dies über die Map, werden die Werte ignoriert.

Irgendwelche Ideen, wie man das lösen könnte? ;-)

Hier einmal der zum Sync gehörende Teil meiner Config.pm:

Code: Select all

# ---------------------------------------------------- #
# LDAP Auth                                            #
# ---------------------------------------------------- #

# This is an example configuration for an LDAP auth. backend.
# (Make sure Net::LDAP is installed!)
$Self->{'AuthModule1'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host1'} = 'domain';
$Self->{'AuthModule::LDAP::BaseDN1'} = 'dc=domain,dc=local';
$Self->{'AuthModule::LDAP::UID1'} = '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::GroupDN1'} = '';
$Self->{'AuthModule::LDAP::AccessAttr1'} = 'member';
# for ldap posixGroups objectclass (just uid)
#  $Self->{'AuthModule::LDAP::UserAttr1'} = 'UID';
# for non ldap posixGroups objectclass (with full user dn)
$Self->{'AuthModule::LDAP::UserAttr1'} = '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::SearchUserDN1'} = 'user';
$Self->{'AuthModule::LDAP::SearchUserPw1'} = 'pwd';

# in case you want to add always one filter to each ldap query, use
# this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)'
#$Self->{'AuthModule::LDAP::AlwaysFilter1'} = '';

# in case you want to add a suffix to each login name, then
# you can use this option. e. g. user just want to use user but
# in your ldap directory exists user@domain.
#    $Self->{'AuthModule::LDAP::UserSuffix'} = '@domain.com';

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

$Self->{'AuthModule::LDAP::Die1'} = 1;


# UserSyncLDAPMap                                      #
# ---------------------------------------------------- #
# defines AuthSyncBackend (AuthSyncModule) for AuthModule
# if this key exists and is empty, there won't be a sync.
$Self->{'AuthModule::UseSyncBackend'} = 'AuthSyncBackend';
# agent data sync against ldap
$Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
$Self->{'AuthSyncModule::LDAP::Host'} = 'domain';
$Self->{'AuthSyncModule::LDAP::BaseDN'} = 'dc=domain, dc=local';
$Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountName';
$Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'user';
$Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'pwd';
$Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
    # DB -> LDAP
    UserFirstname => 'givenName',
    UserLastname  => 'sn',
    UserEmail     => 'mail',
    UserPhoneNumber => 'telephoneNumber',
};

# Maybe for later use
#    UserTelephoneNumber => 'telephoneNumber',
#    UserFaxNumber => 'facsimileTelephoneNumber',
#    UserWorkTitle => 'title',


# AuthSyncModule::LDAP::UserSyncInitialGroups
# (sync following group with rw permission after initial create of first agent
# login)
$Self->{'AuthSyncModule::LDAP::UserSyncInitialGroups'} = [
    'users',
];

# Fallback: internal OTRS DB
$Self->{'AuthModule2'} = 'Kernel::System::Auth::DB';
$Self->{'AuthModule::DB::CryptType2'} = 'crypt';
Produktiv:
OTRS 3.1.8
Ubuntu 10.04
Apache2/MySQL
boris
Znuny wizard
Posts: 554
Joined: 22 Feb 2010, 18:27
Znuny Version: 3.0.4

Re: LDAP Agent Sync auf Custom Fields

Post by boris »

Was sagt denn dein LOG?

Gibt es die Felder in der DB?
Produktiv:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL

Test:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL
andreg
Znuny newbie
Posts: 4
Joined: 13 Aug 2012, 12:55
Znuny Version: 3.1.8
Real Name: André
Company: Pro Nautas B.V. GmbH

Re: LDAP Agent Sync auf Custom Fields

Post by andreg »

boris wrote:Was sagt denn dein LOG?
Wenig spektakuläres:

Code: Select all

Thu Aug 16 13:42:04 2012	notice	OTRS-CGI-10	User: 'USER' changed password successfully!
Thu Aug 16 13:42:04 2012	notice	OTRS-CGI-10	User: 'USER' updated successfully (1)!
Thu Aug 16 13:42:04 2012	notice	OTRS-CGI-10	User: USER(CN=USER,OU=IT,OU=EXAMPLE,DC=DOMAIN,DC=local) authentication ok (REMOTE_ADDR: 172.0.0.1).
Thu Aug 16 13:42:03 2012	notice	OTRS-CGI-10	User: USER authentication with wrong Pw!!! (REMOTE_ADDR: 172.0.0.1)
boris wrote:Gibt es die Felder in der DB?
Jein.
Ich habe die Datenbank nicht angefasst, sondern die Felder über eine Konfigurationsdatei eingefügt.
Sprich: Unter $OTRS_HOME/Kernel/Config/Files/MyConfig.xml liegen dann Bezeichnungen nach diesem Schema:

Code: Select all

    <ConfigItem Name="PreferencesGroups###PersonalPhoneNumber" Required="0" Valid="0">
        <Description Translatable="1" lang="en">Ask for Agent phone number in settings page.</Description>
        <Description Translatable="1" lang="de">Agententelefonnummer in den Einstellungen abfragen.</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">Other Settings</Item>
                <Item Key="Label" Translatable="1">Agent phone number</Item>
                <Item Key="Key" Translatable="1">Agent phone number</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserPhoneNumber"}</Item>
                <Item Key="PrefKey">UserPhoneNumber</Item>
                <Item Key="Prio">7000</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
Manuell funktioniert das ganze wunderbar.
Ich kann auch bei AD Usern die Daten nachpflegen. Sinn ist aber ja gerade den Administrationsaufwand zu minimieren, indem ich die Daten nur an einer Stelle pflege (im AD) und dann passend repliziere / synchronisiere.

Danke schon einmal und VG
André
Produktiv:
OTRS 3.1.8
Ubuntu 10.04
Apache2/MySQL
boris
Znuny wizard
Posts: 554
Joined: 22 Feb 2010, 18:27
Znuny Version: 3.0.4

Re: LDAP Agent Sync auf Custom Fields

Post by boris »

Biegst du dir dann nicht besser das syncLDAP2DB.pl zurecht und lässt das per cron laufen?
Müsste eigentlich gehen. :?
Produktiv:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL

Test:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL
andreg
Znuny newbie
Posts: 4
Joined: 13 Aug 2012, 12:55
Znuny Version: 3.1.8
Real Name: André
Company: Pro Nautas B.V. GmbH

Re: LDAP Agent Sync auf Custom Fields

Post by andreg »

boris wrote:Biegst du dir dann nicht besser das syncLDAP2DB.pl zurecht und lässt das per cron laufen?
Müsste eigentlich gehen. :?
Gute Frage.
Ich konnte jetzt adhoc keine Doku zu dem Script finden und meine Kenntnisse in Perl sind, gelinde gesagt, bescheiden. :-)

Wenn man das Script so umbiegen/nutzen könnte, dass es nur die Userdaten "ergänzt" bzw. aktualisiert, wäre das Klasse - dann hätte ich ja schon genau das, was ich haben wollte.
Mhhm... Mhhm... wird vielleicht doch Zeit, dass ich mich mehr mit Perl auseinander setze.
Produktiv:
OTRS 3.1.8
Ubuntu 10.04
Apache2/MySQL
boris
Znuny wizard
Posts: 554
Joined: 22 Feb 2010, 18:27
Znuny Version: 3.0.4

Re: LDAP Agent Sync auf Custom Fields

Post by boris »

Das Problem hab ich auch. Ich glaub ne Doku gibts dazu auch nicht.
Produktiv:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL

Test:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL
boris
Znuny wizard
Posts: 554
Joined: 22 Feb 2010, 18:27
Znuny Version: 3.0.4

Re: LDAP Agent Sync auf Custom Fields

Post by boris »

Try and Error :)

Habs nicht getestet aber sollte gehen wenn ich den Code ansatzweise richtig verstehe.
Würde ich aber auf nem Testsystem versuchen;-)
You do not have the required permissions to view the files attached to this post.
Produktiv:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL

Test:
OTRS 3.1.7
CentOS 6.3
Apache2/MySQL
andreg
Znuny newbie
Posts: 4
Joined: 13 Aug 2012, 12:55
Znuny Version: 3.1.8
Real Name: André
Company: Pro Nautas B.V. GmbH

Re: LDAP Agent Sync auf Custom Fields

Post by andreg »

boris wrote:Try and Error :)

Habs nicht getestet aber sollte gehen wenn ich den Code ansatzweise richtig verstehe.
Würde ich aber auf nem Testsystem versuchen;-)
Danke.
Leider sind da doch noch einige Fallstricke:
- Daten sind in der Tabelle "user_preferences"
- Identifizierung der Datensätze ist dort über die OTRS userid
- Zuordnung von Spalte & Datensatz ist auch nicht so einfach.

Kurzum:
Das Script lässt sich mit Sicherheit anpassen, so lange bei uns aber noch nicht die Entscheidung gefallen ist mit OTRS in den Produktiveinsatz zu gehen, werde ich die Zeit lieber anders nutzen.
Das ganze wird wohl doch aufwändiger.
Machbar ist es mit dem Script aber definitiv!

Danke noch einmal.
VG

André
Produktiv:
OTRS 3.1.8
Ubuntu 10.04
Apache2/MySQL
Rotyn
Znuny newbie
Posts: 68
Joined: 21 Aug 2012, 17:11
Znuny Version: 3.3.5
Real Name: Rudy

Re: LDAP Agent Sync auf Custom Fields

Post by Rotyn »

Bin gerade auf das gleiche Problem gestossen.
Testing & Productive: OTRS::ITSM 3.3.5 on CentOS 6.5 and MySQL
Packages: All included
Post Reply