Addition/OpenLDAP/Personal LDAP Address Book

From iRedMail

(Difference between revisions)
Jump to: navigation, search
(Configure OpenLDAP)
(Configure Roundcube Webmail)
Line 44: Line 44:
= Configure Roundcube Webmail =
= Configure Roundcube Webmail =
 +
 +
Open Roundcube webmail config file '''main.inc.php''', it could be one of below:
 +
* RHEL/CentOS: /var/www/roundcubemail/config/main.inc.php
 +
* Debian/Ubuntu: /usr/share/apache2/roundcubemail/config/main.inc.php
 +
* OpenSuSE: /srv/www/roundcubemail/config/main.inc.php
 +
* FreeBSD: /usr/local/www/roundcubemail/main.inc.php
 +
 +
Add below lines before the last line '''?>''' ('''NOTE''': You must replace '''dc=iredmail,dc=org''' by your own LDAP suffix below):
 +
{{cfg|main.inc.php|<pre>
 +
$rcmail_config['ldap_public']['ldap_personal'] = array(
 +
    'name'          => 'Personal LDAP Address Book',
 +
    'hosts'        => array('127.0.0.1'),
 +
    'port'          => 389,
 +
    'use_tls'      => false,
 +
    'user_specific' => true,
 +
    'base_dn'      => 'mail=%u@%d,ou=Users,domainName=%d,o=domains,dc=iredmail,dc=org',
 +
    'bind_dn'      => 'mail=%u@%d,ou=Users,domainName=%d,o=domains,dc=iredmail,dc=org',
 +
    'writable'      => true,
 +
    'LDAP_Object_Classes' => array('top', 'inetOrgPerson'),
 +
    'required_fields'    => array('cn', 'sn', 'givenName', 'mail'),
 +
    'LDAP_rdn'      => 'cn',
 +
    'ldap_version'  => '3',
 +
    'search_fields' => array('mail', 'cn', 'givenName', 'sn'),
 +
    'name_field'    => 'cn',
 +
    'email_field'  => 'mail',
 +
    'surname_field' => 'sn',
 +
    'firstname_field' => 'givenName',
 +
    'sort'          => 'cn',
 +
    'scope'        => 'list',
 +
    'filter'        => '(objectClass=inetOrgPerson)',
 +
    'fuzzy_search'  => true);
 +
</pre>}}
 +
 +
Change default personal address book from sql to ldap in same file '''main.inc.php''':
 +
{{cfg|main.inc.php|<pre>
 +
$rcmail_config['address_book_type'] = 'ldap';
 +
</pre>}}
 +
 +
Append '''ldap_personal''' in setting '''autocomplete_addressbooks''', and remove '''sql''':
 +
{{cfg|main.inc.php|<pre>
 +
$rcmail_config['autocomplete_addressbooks'] = array(..., 'ldap_personal');
 +
</pre>}}
 +
 +
Restarting apache to make it work.
= Test =
= Test =
= Note to iRedAdmin-Pro-LDAP customers =
= Note to iRedAdmin-Pro-LDAP customers =

Revision as of 18:24, 13 February 2011

Contents


Summary

Per-user personal LDAP address book allow user to store their personal contacts in LDAP instead of MySQL.

Configure OpenLDAP

Open OpenLDAP config file slapd.conf, it could be one of below:

  • RHEL/CentOS/OpenSuSE: /etc/openldap/slapd.conf
  • Debian/Ubuntu: /etc/ldap/slapd.conf
  • FreeBSD: /usr/local/etc/openldap/slapd.conf

Find this line:

File: slapd.conf
access to attrs="userPassword,mailForwardingAddress"

Then add below lines ABOVE it (NOTE: You must replace dc=iredmail,dc=org by your own LDAP suffix below):

File: slapd.conf
access to dn.regex="cn=[^,]+,mail=([^,]+)@([^,]+),ou=Users,domainName=([^,]+),o=domains,dc=iredmail,dc=org$"
    by anonymous        none
    by self             none
    by dn.exact="cn=vmail,dc=iredmail,dc=org"   read
    by dn.exact="cn=vmailadmin,dc=iredmail,dc=org"  write
    by dn.regex="mail=$1@$2,ou=Users,domainName=$3,o=domains,dc=iredmail,dc=org$" write
    by users                        none

The final result looks like below:

File: slapd.conf
access to dn.regex="cn=[^,]+,mail=([^,]+)@([^,]+),ou=Users,domainName=([^,]+),o=domains,dc=iredmail,dc=org$"
    by anonymous        none
    by self             none
    by dn.exact="cn=vmail,dc=iredmail,dc=org"   read
    by dn.exact="cn=vmailadmin,dc=iredmail,dc=org"  write
    by dn.regex="mail=$1@$2,ou=Users,domainName=$3,o=domains,dc=iredmail,dc=org$" write
    by users                        none

access to attrs="userPassword,mailForwardingAddress"
    [...SKIP OTHER LINES HERE...]

Restart OpenLDAP service to make it work.

Configure Roundcube Webmail

Open Roundcube webmail config file main.inc.php, it could be one of below:

  • RHEL/CentOS: /var/www/roundcubemail/config/main.inc.php
  • Debian/Ubuntu: /usr/share/apache2/roundcubemail/config/main.inc.php
  • OpenSuSE: /srv/www/roundcubemail/config/main.inc.php
  • FreeBSD: /usr/local/www/roundcubemail/main.inc.php

Add below lines before the last line ?> (NOTE: You must replace dc=iredmail,dc=org by your own LDAP suffix below):

File: main.inc.php
$rcmail_config['ldap_public']['ldap_personal'] = array(
    'name'          => 'Personal LDAP Address Book',
    'hosts'         => array('127.0.0.1'),
    'port'          => 389,
    'use_tls'       => false,
    'user_specific' => true,
    'base_dn'       => 'mail=%u@%d,ou=Users,domainName=%d,o=domains,dc=iredmail,dc=org',
    'bind_dn'       => 'mail=%u@%d,ou=Users,domainName=%d,o=domains,dc=iredmail,dc=org',
    'writable'      => true,
    'LDAP_Object_Classes' => array('top', 'inetOrgPerson'),
    'required_fields'     => array('cn', 'sn', 'givenName', 'mail'),
    'LDAP_rdn'      => 'cn',
    'ldap_version'  => '3',
    'search_fields' => array('mail', 'cn', 'givenName', 'sn'),
    'name_field'    => 'cn',
    'email_field'   => 'mail',
    'surname_field' => 'sn',
    'firstname_field' => 'givenName',
    'sort'          => 'cn',
    'scope'         => 'list',
    'filter'        => '(objectClass=inetOrgPerson)',
    'fuzzy_search'  => true);

Change default personal address book from sql to ldap in same file main.inc.php:

File: main.inc.php
$rcmail_config['address_book_type'] = 'ldap';

Append ldap_personal in setting autocomplete_addressbooks, and remove sql:

File: main.inc.php
$rcmail_config['autocomplete_addressbooks'] = array(..., 'ldap_personal');

Restarting apache to make it work.

Test

Note to iRedAdmin-Pro-LDAP customers

Personal tools