Zimbra Alfresco LDAP

Из названия должно быть понятно, что я читал то, что писали:

И НИХРЕНАШЕЧКИ НЕ НАШЕЛ!!!

Более того. Я наткнулся на одной из страниц на коментарии некоего человека, который задавал вопросы и ему отвечали. Только вот этот козел не рассказал как в итоге победил свои проблемы. Было очень горько осознать посмотрев на ник этого человека, что он - это я 5 лет назад. Т.е. я давным давно попробовал описываемую связку. Как-то разобрался, завел и не описал нигде как.

Исправляюсь теперь тут.

1. Ставим Zimbra и Alfresco как описано 1001 раз. Ребята разрабатывающие эти проекты упростили процесс на столько, что и полуграмотный ПТУшник справится минут за 20. Причем 18 минут будут скачиваться пакеты и ставиться все, что надо без его участия.

2. Оговорюсь, что у меня описываемые продукты стоят на одном физическом сервере и потому мне LDAPS как-то не очень то и нужен. Хватит обычного с 389 портом.

Есть такой файл в Zimbra "/opt/zimbra/bin/ldap"

В нем надо найти (в начале) такой фрагмент:

#zmsetvars

#if [ x$ldap_is_master = "xfalse" ]; then

# if [ "x$ldap_url" = "x$ldap_master_url" -a "x$1" != "xstop" ]; then

# echo "ldap_url and ldap_master_url cannot be the same on an ldap replica"

# exit 1

# fi

#fi

Как видите у меня он уже закоментирован. Далее пишем так:

zmsetvars

ldap_is_master

ldap_url

ldap_bind_url

ldap_master_url

ldap_replica_rid

ldap_replication_password

ldap_common_require_tls

ldaps_url

Помните, я говорил, что LDAPS пользовать не буду? Так вот пользовать я его не буду ПОКА. Потом вполне вероятно он понадобится. Но вернемся к файлу...

Это:

# sudo /opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h "${bind_url} ldapi:///" \

# -F /opt/zimbra/data/ldap/config -d 1 2>&1 | egrep "failed|error" &

меняем на это:

sudo /opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h "${bind_url} ${ldaps_url} ldapi:///" \

-F /opt/zimbra/data/ldap/config -d 1 2>&1 | egrep "failed|error" &

Это:

# sudo /opt/zimbra/libexec/zmslapd -l LOCAL0 \

# -u zimbra -h "${bind_url} ldapi:///" -F /opt/zimbra/data/ldap/config

меняем на это:

sudo /opt/zimbra/libexec/zmslapd -l LOCAL0 \

-u zimbra -h "${bind_url} ${ldaps_url} ldapi:///" -F /opt/zimbra/data/ldap/config

и выполним от пользователя zimbra (su - zimbra) такую команду:

zmlocalconfig -e ldaps_url="ldaps://mail.mydomain.com:636"

Таким образом мы подготовились к тому, что возможно когда нибудь сможем воспользоваться LDAPS вместо LDAP

А еще нам надо знать пароль пользователя zimbra, чтобы с ним подключаться к LDAP. При установке его у нас не спрашивали. А значит он сгенерирован автоматически. Чтобы его узнать делаем zmlocalconfig -s

Увидим много букв. Среди них будут такие:

zimbra_ldap_password = какой-то_набор_символов

zimbra_ldap_user = zimbra

zimbra_ldap_userdn = uid=zimbra,cn=admins,cn=zimbra

Очень советую сохранить себе эти строки в блокнот - понадобятся при настройке alfresco.

.

3. Открываем /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap/ldap-authentication.properties

Тут все приводим к такому виду (некоторые вещи будут прокоментированы по русски):

#Нехрен гостям тут делать!

ldap.authentication.allowGuestLogin=false

#Формат имен

ldap.authentication.userNameFormat=uid=%s,ou=people,dc=ваш_домен,dc=ru

# The LDAP context factory to use

ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory

# The URL to connect to the LDAP server

ldap.authentication.java.naming.provider.url=ldap://IP-адрес_или_доменное_имя_сервера:389

# The authentication mechanism to use for password validation

ldap.authentication.java.naming.security.authentication=simple

# Escape commas entered by the user at bind time

# Useful when using simple authentication and the CN is part of the DN and contains commas

ldap.authentication.escapeCommasInBind=false

# Escape commas entered by the user when setting the authenticated user

# Useful when using simple authentication and the CN is part of the DN and contains commas, and the escaped \, is

# pulled in as part of an LDAP sync

# If this option is set to true it will break the default home folder provider as space names can not contain \

ldap.authentication.escapeCommasInUid=false

# Comma separated list of user names who should be considered administrators by default

ldap.authentication.defaultAdministratorUserNames=user1

# This flag enables use of this LDAP subsystem for user and group

# synchronization. It may be that this subsytem should only be used for

# authentication, in which case this flag should be set to false.

ldap.synchronization.active=true

# The authentication mechanism to use for synchronization

ldap.synchronization.java.naming.security.authentication=simple

# The default principal to use (only used for LDAP sync)

# ОБРАТИТЕ ВНИМАНИЕ НА ФОРМАТ

#ldap.synchronization.java.naming.security.principal=cn\=Manager,dc\=company,dc\=com

# В ТАКОМ ФОРМАТЕ Alfresco БУДЕТ ПОСЫЛАТЬ ВАС С СИНХРОНИЗАЦИЕЙ С ТАКОЙ ОШИБКОЙ:

# [LDAP: error code 49 - Invalid Credentials]

#Правильно так, как написано у вас в блокноте (читали как получить пароль от пользователя zimbra?)

ldap.synchronization.java.naming.security.principal=uid=zimbra,cn=admins,cn=zimbra

#Пароль из блокнота

ldap.synchronization.java.naming.security.credentials=Помните_же_про_команду_для_получения_пароля?

# If positive, this property indicates that RFC 2696 paged results should be

# used to split query results into batches of the specified size. This

# overcomes any size limits imposed by the LDAP server.

ldap.synchronization.queryBatchSize=0

# If positive, this property indicates that range retrieval should be used to fetch

# multi-valued attributes (such as member) in batches of the specified size.

# Overcomes any size limits imposed by Active Directory.

ldap.synchronization.attributeBatchSize=0

# The query to select all objects that represent the groups to import.

ldap.synchronization.groupQuery=(&(objectclass=zimbraDistributionList)(zimbraMailStatus=enabled))

# The query to select objects that represent the groups to import that have changed since a certain time.

ldap.synchronization.groupDifferentialQuery=(&(objectclass=zimbraDistributionList)(zimbraMailStatus=enabled)(!(modifyTimestamp<={0})))

# The query to select all objects that represent the users to import.

ldap.synchronization.personQuery=(&(objectClass=organizationalPerson)(zimbraMailStatus=enabled))

#The query to select objects that represent the users to import that have changed since a certain time.

ldap.synchronization.personDifferentialQuery=(&(objectClass=organizationalPerson)(zimbraMailStatus=enabled)(!(modifyTimestamp<={0})))

# The group search base restricts the LDAP group query to a sub section of tree on the LDAP server.

ldap.synchronization.groupSearchBase=dc=ваш_домент,dc=ru

# The user search base restricts the LDAP user query to a sub section of tree on the LDAP server.

ldap.synchronization.userSearchBase=dc=ваш_домен,dc=ru

# The name of the operational attribute recording the last update time for a group or user.

ldap.synchronization.modifyTimestampAttributeName=modifyTimestamp

# The timestamp format. Unfortunately, this varies between directory servers.

ldap.synchronization.timestampFormat=yyyyMMddHHmmss'Z'

# The attribute name on people objects found in LDAP to use as the uid in Alfresco

ldap.synchronization.userIdAttributeName=uid

# The attribute on person objects in LDAP to map to the first name property in Alfresco

ldap.synchronization.userFirstNameAttributeName=givenName

# The attribute on person objects in LDAP to map to the last name property in Alfresco

ldap.synchronization.userLastNameAttributeName=sn

# The attribute on person objects in LDAP to map to the email property in Alfresco

ldap.synchronization.userEmailAttributeName=mail

# The attribute on person objects in LDAP to map to the organizational id property in Alfresco

ldap.synchronization.userOrganizationalIdAttributeName=company

# The default home folder provider to use for people created via LDAP import

ldap.synchronization.defaultHomeFolderProvider=userHomesHomeFolderProvider

# The attribute on LDAP group objects to map to the authority name property in Alfresco

ldap.synchronization.groupIdAttributeName=cn

# The attribute on LDAP group objects to map to the authority display name property in Alfresco

ldap.synchronization.groupDisplayNameAttributeName=description

# The group type in LDAP

ldap.synchronization.groupType=zimbraDistributionList

# The person type in LDAP

ldap.synchronization.personType=organizationalPerson

# The attribute in LDAP on group objects that defines the DN for its members

ldap.synchronization.groupMemberAttributeName=zimbraMailForwardingAddress

# If true progress estimation is enabled. When enabled, the user query has to be run twice in order to count entries.

ldap.synchronization.enableProgressEstimation=true

# Requests timeout, in miliseconds, use 0 for none (default)

ldap.authentication.java.naming.read.timeout=0

4. Открываем /opt/alfresco/tomcat/shared/classes/alfresco-global.properties

Приводим к такому виду:

#################################ТУТ ВСЕ ПО СИНХРОНИЗАЦИИ###############################

# Цепочка авторизации (где сначала искать пользователя). В моем случае будет использоваться ТОЛЬКО LDAP от zimbra

authentication.chain=ldap1:ldap

#Синхронизировать при старте. Как-бы нафиг не надо (ну мы же не пользуем LDAP альфрески). Но я сделал, чтобы если вдруг #чего не так - в логах мне бы сказали почему не можем зайти. Помните выше про формат данных? Так вот отловил проблему #именно через этот параметр в файле /opt/alfresco-4.2.f/tomcat/logs/catalina.out

synchronization.syncOnStartup=true

#Синхронизировать ТОЛЬКО изменившееся (тут как хотите)

synchronization.synchronizeChangesOnly=true

# Синхронизировать тех, кто логинится в первый раз и небыл найден в LDAP Alfresco

synchronization.syncWhenMissingPeopleLogIn=true

# Создавать людей при входе

synchronization.autoCreatePeopleOnLogin=true

###################################КОНЕЦ РАЗДЕЛА СИНХРОНИЗАЦИ###########################

###################################ВСЕ ОСТАЛЬНОЕ##########################################

dir.root=/opt/alfresco-4.2.f/alf_data

alfresco.context=alfresco

alfresco.host=127.0.0.1

alfresco.port=8080

alfresco.protocol=http

share.context=share

share.host=127.0.0.1

share.port=8080

share.protocol=http

### database connection properties ###

db.driver=org.postgresql.Driver

db.username=alfresco

db.password=Пароль_к_базе_указанный_при_установке

db.name=alfresco

db.url=jdbc:postgresql://localhost:5432/${db.name}

### FTP Server Configuration ###

ftp.enabled=true

ftp.port=21

### RMI service ports ###

alfresco.rmi.services.port=50500

avm.rmi.service.port=0

avmsync.rmi.service.port=0

attribute.rmi.service.port=0

authentication.rmi.service.port=0

repo.rmi.service.port=0

action.rmi.service.port=0

deployment.rmi.service.port=0

### External executable locations ###

ooo.exe=/opt/alfresco-4.2.f/libreoffice/program/soffice.bin

ooo.enabled=true

ooo.port=8100

img.root=/opt/alfresco-4.2.f/common

img.dyn=${img.root}/lib

img.exe=${img.root}/bin/convert

swf.exe=/opt/alfresco-4.2.f/common/bin/pdf2swf

swf.languagedir=/opt/alfresco-4.2.f/common/japanese

jodconverter.enabled=false

jodconverter.officeHome=/opt/alfresco-4.2.f/libreoffice

jodconverter.portNumbers=8100

### Initial admin password ###

alfresco_user_store.adminpassword=c5ba754c25efc77ab98f8fd6c2552e84

### E-mail site invitation setting ###

notification.email.siteinvite=false

### License location ###

dir.license.external=/opt/alfresco-4.2.f

### Solr indexing ###

index.subsystem.name=solr

dir.keystore=${dir.root}/keystore

solr.port.ssl=8443

### BPM Engine ###

system.workflow.engine.jbpm.enabled=false

_________________________________________________________________________

Ну вот и все. Остается добавить только, что без статей ссылки на которые есть в начале данного повествования ничего бы у меня не получилось вообще. Здесь я только исправил некоторые неточности Хотя может все дело в версиях продуктов описанных в тех статьях. Писались они очень давно...

Надеюсь кому нибудь будет полезно.