domingo, 29 de septiembre de 2013

Integración de OTRS 3.2 con Directorio Activo

Para logueate en el sistema de tickets OTRS con tu usuario de Active Directory, debemos editar el archivo que se encuentra en la ruta /opt/otrs/Kernel/Config.pm. A continuación os dejo como ha quedado el archivo "Config.pm" que acabo de implementar en un empresa que hemos instalado OTRS 3.2.

####################INICIO LDAP#######################
  ###########INICIO USUARIOS AGENTES###########

$Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host'} = 'Dir.IP servidor';
$Self->{'AuthModule::LDAP::BaseDN'} = 'dc=ejemplo,dc=es';
$Self->{'AuthModule::LDAP::UID'} = 'sAMAccountName';
$Self->{'AuthModule::LDAP::SearchUserDN'} = 'CN=usuario_consulta_ldap,DC=ejemplo,DC=es';
$Self->{'AuthModule::LDAP::SearchUserPw'} = 'Pass_usuario_consulta_ldap';
$Self->{'AuthModule::LDAP::Params'} = {
    port => 389,
    timeout => 120,
    async => 0,
    version => 3,
};

$Self->{'AuthModule::LDAP::GroupDN'} = 'CN=AgentesOTRS,CN=Unidad Organizativa,DC=ejemplo,DC=es';
$Self->{'AuthModule::LDAP::AccessAttr'} = 'member';
$Self->{'AuthModule::LDAP::UserAttr'} = 'DN';

# agent data sync against ldap
$Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
$Self->{'AuthSyncModule::LDAP::Host'} = 'Dir.IP servidor';
$Self->{'AuthSyncModule::LDAP::BaseDN'} = 'dc=ejemplo,dc=es';
$Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountName';
$Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'CN=usuario_consulta_ldap,DC=ejemplo,DC=es';
$Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'Pass_usuario_consulta_ldap';
$Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
  # DB -> LDAP
  UserFirstname => 'givenName',
  UserLastname => 'name',
  UserEmail => 'mail',
 };
$Self->{'AuthSyncModule::LDAP::UserSyncInitialGroups'} = [
'users',
 ];
 ###########FIN USUARIOS AGENTES###########
 ###########INICIO USUARIOS CUSTOMER#######

# This is an example 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'} = 'Dir.IP servidor';
$Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'dc=ejemplo,dc=es';
$Self->{'Customer::AuthModule::LDAP::UID'} = 'sAMAccountName';
$Self->{'Customer::AuthModule::LDAP::SearchUserDN'} = 'cn=usuario_consulta_ldap,dc=ejemplo,dc=es';
$Self->{'Customer::AuthModule::LDAP::SearchUserPw'} = Pass_usuario_consulta_ldap';
# Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
$Self->{'Customer::AuthModule::LDAP::Params'} = {
 port => 389,
 timeout => 120,
 async => 0,
 version => 3,
 };


# CustomerUserLDAP
# (customer user ldap backend and settings)
$Self->{CustomerUser1} = {
  Name => 'LDAP Backend',
  Module => 'Kernel::System::CustomerUser::LDAP',
  Params => {
 # ldap host
   Host => 'Dir.IP servidor:389',
 # ldap base dn
 BaseDN => 'dc=ejemplo,dc=es',
# search scope (one|sub)
 SSCOPE => 'sub',
 UserDN => 'cn=usuario_consulta_ldap,dc=ejemplo,dc=es',
 UserPw => 'Pass_usuario_consulta_ldap',
 AlwaysFilter => '(mail=*)'
 },


# customer unique id
CustomerKey => 'sAMAccountName',
# customer 'sAMAccountName', 'cn',
CustomerID => 'employeeid',
CustomerUserListFields => ['sAMAccountName','sn','mail'],
CustomerUserSearchFields => ['mail'],
CustomerUserSearchPrefix => '',
CustomerUserSearchSuffix => '*',
CustomerUserSearchListLimit => 100000,
CustomerUserPostMasterSearchFields => ['mail'],
CustomerUserNameFields => ['givenname', 'sn'],
Map => [
# note: Login, Email and CustomerID needed!
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
[ 'UserTitle', 'Title', 'title', 1, 0, 'var', '', 0 ],
[ 'UserFirstname', 'Firstname', 'givenname', 1, 1, 'var', '', 0 ],
[ 'UserLastname', 'Lastname', 'sn', 1, 1, 'var', '', 0 ],
[ 'UserLogin', 'Username', 'sAMAccountName', 1, 1, 'var', '', 0 ],
[ 'UserPassword', 'Password', 'pw', 0, 0, 'var', '', 0 ],
[ 'UserEmail', 'Email', 'mail', 1, 1, 'var', '', 0 ],
[ 'UserCustomerID', 'CustomerID', 'employeeid', 0, 1, 'var', '', 0 ],
[ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var', '', 0 ],
[ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var', '', 0 ],
[ 'UserComment', 'Comment', 'description', 1, 0, 'var', '', 0 ],
# [ 'ValidID', 'Valid', '', 0, 1, 'int','', 0 ],
],

# default selections
Selections => {
UserTitle => {
'Mr.' => 'Mr.',
'Mrs.' => 'Mrs.',
},
},
};

 ###########FIN USUARIOS CUSTOMER##########
######################FIN LDAP########################