OTRS

Материал из RSU WiKi
Перейти к: навигация, поиск
Tower of babel.png外國 language!
В статье используется несколько языков. Необходимо использовать один. Совсем неплохо, если это будет русский.
Pen.pngЭта статья находится в процессе написания.
Если вы считаете, что её стоило бы доработать как можно быстрее, пожалуйста, скажите об этом.


Содержание

Установка OTRS

OTRS LDAP

Основные атрибуты CommunigatePro:

cn=Иванов Иван Иванович
ou=Ректорат
sn=Иванович
telephonenumber=+12345678901 доб. 1234
uid=i.ivanov
mail=i.ivanov@rsu.edu.ru
dn=uid=i.ivanov,cn=example.com

Все настройки добавляются к файлу /<otrs>/Kernel/Config.pm. Конфигурация для аутентификации агентов:

# Configuration for getting the agents authenticated
$Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host'} = 'example.com';
$Self->{'AuthModule::LDAP::BaseDN'} = 'cn=example.com';
$Self->{'AuthModule::LDAP::UID'} = 'uid';
$Self->{'AuthModule::LDAP::UserAttr'} = 'uid';
$Self->{'AuthModule::LDAP::Params'} = {
    port => 389,
    timeout => 120,
    async => 0,
    version => 3,
};

Конфигурация для аутентификации клиентов:

# The customer authentication needs to be configured separately
# and also starts with basic LDAP information
$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';
$Self->{'Customer::AuthModule::LDAP::Host'} = 'example.com';
$Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'cn=example.com';
$Self->{'Customer::AuthModule::LDAP::UID'} = 'uid';
$Self->{'Customer::AuthModule::LDAP::UserAttr'} = 'uid';
$Self->{'Customer::AuthModule::LDAP::Params'} = {
    port => 389,
    timeout => 120,
    async => 0,
    version => 3,
};

Конфигурация для выборки клиентов из каталога во время создания заявки:

# CustomerUser
# (customer user ldap backend and settings)
$Self->{CustomerUser} = {
    Name => 'rsu.edu.ru',
    Module => 'Kernel::System::CustomerUser::LDAP',
    Params => {
        # ldap host
        Host => 'example.com',
        # ldap base dn
        BaseDN => 'cn=example.com',
        # 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 => ,
#        UserPw => ,
        # 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 your frontend is e. g. iso-8859-1 and the charset of your
        # ldap server is utf-8, use these options.
#        SourceCharset => 'utf-8',
#        DestCharset => 'iso-8859-1',
#        DestCharset => 'utf-8',
        # if both your frontend and your LDAP are unicode, use this:
        SourceCharset => 'utf-8',
        DestCharset   => 'utf-8',
        # 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 => 'uid',
    # customer #
    CustomerID => 'uid',
    CustomerUserListFields => ['cn', 'mail'],
    CustomerUserSearchFields => ['uid', 'cn', 'mail'],
    CustomerUserSearchPrefix => ,
    CustomerUserSearchSuffix => '*',
#    CustomerUserSearchListLimit => 250,
    CustomerUserSearchListLimit => 10,
    CustomerUserPostMasterSearchFields => ['mail'],
#     CustomerUserNameFields => ['givenname', 'sn'],
    # show not own tickets in customer panel, CompanyTickets
    CustomerUserExcludePrimaryCustomerID => 0,
    # add an ldap filter for valid users (expert setting)
#     CustomerUserValidFilter => '(!(description=locked))',
    # administrator can't change customer preferences
    AdminSetPreferences => 0,
    # cache time to live in sec. - cache any database queries
#     CacheTTL => 0,
    Map => [
        # note: Login, Email and CustomerID are mandatory!
        # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
        #[ 'UserSalutation', 'Title',      'title',           1, 0, 'var', , 0 ],
        #[ 'UserFirstname',  'Firstname',  'givenname',       1, 1, 'var', , 0 ],
        [ 'UserFirstname',  'Firstname',  'cn',       1, 1, 'var', , 0 ],
        #[ 'UserFullName',  'Полное имя',  'cn',       1, 1, 'var', , 0 ],
        #[ 'UserLastname',   'Lastname',   'sn',              1, 1, 'var', , 0 ],
        [ 'UserLogin',      'Username',   'uid',             1, 1, 'var', , 0 ],
        [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', , 0 ],
        [ 'UserCustomerID', 'CustomerID', 'uid',            0, 1, 'var', , 0 ],
#         [ 'UserCustomerIDs', 'CustomerIDs', 'second_customer_ids', 1, 0, 'var', , 0 ],
        [ 'UserPhone',      'Phone',      'telephonenumber', 1, 0, 'var', , 0 ],
        #[ 'UserAddress',    'Address',    'postaladdress',   1, 0, 'var', , 0 ],
        #[ 'UserComment',    'Comment',    'description',     1, 0, 'var', , 0 ],
    ],
};

PHP-скрипт для просмотра атрибутов:

<?php
 header ('Content-type: text/html; charset=utf-8');
 // базовая последовательность работы с LDAP:
 // подключение, привязка, поиск, интерпретация результата, закрытие подключения
 echo "<h3>Проверочный запрос к LDAP</h3>";
 echo "Подключение ...";
 $ds=ldap_connect("example.com");  // Необходимо указать корректный LDAP сервер
 echo "Результат подключения: " . $ds . "<br />";
 if ($ds) { 
     echo "Привязка ..."; 
     $r=ldap_bind($ds);     // "анонимная" привязка,
                            // доступ только для чтения
     echo "Результат привязки: " . $r . "<br />";
     echo "Поиск ...";
     // Поиск по фамилиям записей
     $sr=ldap_search($ds, "cn=example.com", "(uid=i.ivanov)");  
     echo "Результат поиска: " . $sr . "<br />";
     echo "Получено количество записей " . ldap_count_entries($ds, $sr) . "<br />";
     echo "Получение элементов ...<p>";
     $info = ldap_get_entries($ds, $sr);
     echo "Элемент: " . $info["count"] . " Данные:<p>";
     for ($i=0; $i<$info["count"]; $i++) {
         echo "dn: " . $info[$i]["dn"] . "<br />";
        echo "первый cn: " . $info[$i]["cn"][0] . "<br />";
         echo "первый email: " . $info[$i]["mail"][0] . "<br /><hr />";
         echo "<pre>" . print_r($info[$i]) . "
";
}
echo "Закрытие соединения";
ldap_close($ds);
} else {
echo "

Невозможно подключиться к серверу LDAP

";
}
?></pre>

OTRS клиент для iPhone

Скачайте актуальную версию пакета iPhoneHandle из ftp://ftp.otrs.org/pub/otrs/packages/ Затем установите пакет как сказано в

Графики

Если вы не можете выбрать ни один из графиков при создании отчета, запустите

/opt/otrs/bin/otrs.checkModules.pl

Уточните по поводу состояния библиотеки gd

GD ... not installed! (for stats - not required)
GD::Text ... not installed! (for stats - not required)
GD::Graph ... not installed! (for stats - not required)
GD::Graph::lines ... not installed! (for stats - not required)
GD::Text::Align ... not installed! (for stats - not required)

Доустановите модули perl gd с зависимостями в систему чере yast, затем через cpan доустановите модули perl. cpan открывается командой

perl -MCPAN -e shell

Модули устанавливаются командами:

install GD
install GD::Text
install GD::Graph
install GD::Graph::lines
install GD::Text::Align

Снова запустите otrs.checkModules для проврки.

Setting Up Nginx for OTRS

Основная статья: Nginx

OTRS is natively support Apache. I have tested and it is working without any issue (obviously). But some setups I had no choice use Nginx as the web service for OTRS. Following configuration is done on Redhat v5 and I assume you know what is OTRS1 and Nginx2 and they are already installed and operational :) [1]

Nginx is not support CGI directly but FastCGI. The problem here that OTRS is troublesome with FastCGI. To get on with Nginx to host OTRS, we have to use FastCGI wrapper to launch FastCGI as CGI.

Here I use FastCGI wrapper script thanks to Denis S. Filimonov and another script I used to to start/stop the FastCGI process. I have taken these two scripts from nginxlibrary.com. Fallowing is the quick and dirty start.

wget http://nginxlibrary.com/downloads/perl-fcgi/fastcgi-wrapper -O /usr/local/bin/fastcgi-wrapper.pl
wget http://nginxlibrary.com/downloads/perl-fcgi/perl-fcgi -O /etc/init.d/perl-fcgi
chmod +x /usr/local/bin/fastcgi-wrapper.pl
chmod +x /etc/init.d/perl-fcgi

Ставим недостающий Perl-модуль FCGI.pm

cpan
install FCGI

Создаем файл UNIX-сокета:

mkdir /var/run/otrs
touch /var/run/otrs/perl_cgi-dispatch.sock

Put wrapper to /usr/local/bin/fastcgi-wrapper.pl and change it to open Unix socket at /var/run/otrs/perl_cgi-dispatch.sock [2]:

$socket = FCGI::OpenSocket( "/var/run/otrs/perl_cgi-dispatch.sock", 10 );

Lets make sure the star/stop script executed during the boot process:

chkconfig --add perl-fcgi
chkconfig perl-fcgi on

Now we should be able to start the FastFCG process.

service  perl-fastcgi start
Starting perl:                                             [  OK  ]

Configure nginx.conf to support OTRS and FastCGI

cat /etc/nginx/nginx.conf
.....
server {
    listen       80;
    server_name  localhost;

    access_log /var/log/nginx/access.log main;
    error_log /var/log/nginx/error.log debug;

        default_type application/json;

include /etc/nginx/conf.d/otrs.data;
.....

I store OTRS related configurations in otrs.data

cat /etc/nginx/conf.d/otrs.data
  location /otrs-web {
        gzip on;
        alias /opt/otrs/var/httpd/htdocs;
}

   location ~ ^/otrs/(.*\.pl)(/.*)?$ {
        fastcgi_pass unix:/var/run/otrs/perl_cgi-dispatch.sock;
        fastcgi_index index.pl;
        fastcgi_param SCRIPT_FILENAME /opt/otrs/bin/fcgi-bin/$1;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE nginx;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param REQUEST_URI $request_uri;
        fastcgi_param DOCUMENT_URI $document_uri;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
  }

Now go ahead start nginx and OTRS

/etc/init.d/nginx  start
Starting nginx:                                            [  OK  ]
service  otrs start
Starting OTRS..
 Checking httpd ... done.
 Checking database connection... Trying to connect to database
DSN: DBI:mysql:database=otrs;host=localhost;
DatabaseUser: otrs_user

It looks Ok! done.
 Checking OTRS Scheduler Service... 0
 done.
 Enable /opt/otrs/bin/otrs.PostMaster.pl ... done.
 Checking otrs spool dir...  done.
 Creating cronjobs (source /opt/otrs/var/cron/*) ...
 done.

  -->> http://abmx-test/otrs/index.pl <<--
Final start of OTRS.. done

This is it you should be able to run OTRS with nginx without any issue.

Примечания

  1. Setting Up Nginx for OTRS
  2. http://supportex.net/2011/11/migrating-otrs-apache-nginx/

См. также

Ссылки

Личные инструменты
Пространства имён

Варианты
Действия
Навигация
Инструменты