Author Topic: LDAP for Roundcube and Thunderbird  (Read 11650 times)

Offline frank

  • Newbie
  • *
  • Posts: 5
LDAP for Roundcube and Thunderbird
« on: April 28, 2009, 06:32:22 AM »
Hi folks,

I'm well running RC 0.2.1 on my apache webserver. The server has got Debian 4.0 running.
Now I want to serve my customers with a personal addressbook based on LDAP for r/w access via Roundcube and read (probably r/w) access by Thunderbird.

So I did install openldap. And that's the point where the confusion begins.
I'm very new in LDAP and I cannot figure out the configuration part. Google gave a few results but not in relation to Roundcube.

Has anybody Roundcube running with LDAP for access via Roundcube and Thunderbird who could tell me the configuration.

Frank

Offline davel

  • Newbie
  • *
  • Posts: 1
LDAP for Roundcube and Thunderbird
« Reply #1 on: May 01, 2009, 05:19:12 AM »
Hi,
I've got that combination working ok. First of all, have you populated any addressbook entries in your LDAP directory with attributes that Thunderbird expects? Once this is in place, you need to edit the main roundcube config ("main.inc.php") - you'll find the LDAP section about halfway down the file.

It's fairly straightforward - you need to spend some time getting to grips with LDAP. The good news is that there is plenty of info online and on paper.

Dave

Offline frank

  • Newbie
  • *
  • Posts: 5
LDAP for Roundcube and Thunderbird
« Reply #2 on: May 01, 2009, 02:40:16 PM »
Hi Dave,

while testing the base config for LDAP I placed a set of data. I was able to read them by Thunderbird but not to change this data.
Roundcube told me "nothing found".

The bad thing is that I didn't find out how this LDAP stuff works and how to get the right structure.
Do you propose to have phpldapadmin for administration of ldap?

Would you be so nice and post or pm your configs?

Frank

Offline frank

  • Newbie
  • *
  • Posts: 5
LDAP for Roundcube and Thunderbird
« Reply #3 on: May 04, 2009, 03:50:57 PM »
After a few days and a lot of coffee i was able to get openldap working with Roundcube 0.2.1 and Thunderbird.
IT'S WORKING!

I got in the know about the ldap structure after I did install phpLDAPadmin.
It's recommended for all ldap newbies to use phpLDAPadmin or some other client to get in touch!

btw: beware of fully commented (ldap-) sections in main.inc.php !!!  ;D

Frank
« Last Edit: May 04, 2009, 03:57:59 PM by frank »

Offline techdude

  • Jr. Member
  • **
  • Posts: 38
LDAP for Roundcube and Thunderbird
« Reply #4 on: May 11, 2009, 10:48:32 PM »
This is EXACTLY what I want to do!!!

Frank: Do your users have a private addressbook that only they can see?  How did you do that with LDAP?

Offline frank

  • Newbie
  • *
  • Posts: 5
LDAP for Roundcube and Thunderbird
« Reply #5 on: May 12, 2009, 04:36:45 AM »
Hi

this is quite easy, once you've done the "step behind".
Anyhow I'm still not a ldap professional!
There might be security holes which I didn't recognize, yet!
If you'll fild one, please tell me! :o

1.
Install a ldap-server such as openladp or similar.
Grab phpLDAPadmin from sourceforge and do it's install procedure as described there.

2.
With phpldapadmin I've created the ldap sutucture like this:
Code: [Select]
version: 1

# LDIF Export for: dc=yourserver,dc=com
# Generated by phpLDAPadmin ( http://phpldapadmin.sourceforge.net/ ) on May 12, 2009 9:41 am
# Server: My LDAP Server (localhost)
# Search Scope: sub
# Search Filter: (objectClass=*)

dn: dc=yourserver,dc=com
objectClass: top
objectClass: domain
dc: nameofyourservice

dn: cn=mailusers,dc=yourserver,dc=com
cn: mailusers
gidNumber: 1000
objectClass: posixGroup
objectClass: top


# example mailuser entry for address email@address.com
dn: cn=email@address.com,cn=mailusers,dc=yourserver,dc=com
sn: Test
cn:  User
uid: email@address.com
userPassword: {MD5}passwd
uidNumber: 1002
gidNumber: 1000
homeDirectory: /dev/null
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top

# example addressbook entry for user email@address.com
dn: mail=somebody@domain.com,cn=email@address.com,cn=mailusers,dc=yourserver,dc=com
objectClass: top
objectClass: inetOrgPerson
cn: Somebody
givenName: Body
sn: Some
mail: somebody@domain.com

3.
The ldap section in /config/main.inc.php file of roundcube 0.2.1 looks like this:
Code: [Select]
$rcmail_config['ldap_public']['addressbook'] = array(
  'name'          => 'Personal Addressbook',
  'hosts'         => array('yourldapserver.com'),
  'port'          => 389,
  'use_tls'       => false,
  'user_specific' => true,

  'base_dn'       => 'cn=%fu,cn=mailusers,dc=yourserver,dc=com',
  'bind_dn'       => 'cn=%fu,cn=mailusers,dc=yourserver,dc=com',
  'bind_pass'     => 'PASSWORD',

  'LDAP_Object_Classes' => array("top", "inetOrgPerson"),
  'required_fields'     => array("cn", "sn", "mail"),  
  'LDAP_rdn'      => 'mail',

  'ldap_version'  => 3,
  'search_fields' => array('givenName', 'cn', 'sn', 'mail'),
  'name_field'    => 'cn',
  'email_field'   => 'mail',
  'surname_field' => 'sn',
  'firstname_field' => 'givenName',
  'sort'          => 'cn',  
  'scope'         => 'sub',
  'filter'        => 'givenName=*',
  'fuzzy_search'  => true);

Every mail user has got the same password (entry userPassword = ... in ldap directory) for ldap, because the bind_pass is always the same. This might be a security hole because anybody could access others addressbooks simply by choosing another cn=, if he could guess one.

4.
In Thunderbird you've got to create a new directory-server entry.
The steps are as follows (in German language because this is how my Thunderbird is speaking to me ;D):
  • Extras -> Konten (or under Linux: Bearbeiten -> Konten)
  • Verfassen & Adressieren
  • Einen anderen LDAP-Verzeichnisserver verwenden: -> Bearbeiten...
  • Hinzufügen
  • Name: choose one
  • Server-Adresse: IP or domainname of your ldap server
  • Basis-DN: cn=email@address.com,cn=mailusers,dc=yourserver,dc=com
  • Port-Nummer: 389
  • Bind-DN: cn=email@address.com,cn=mailusers,dc=yourserver,dc=com
5.
Next steps (if I can find time to do so):
  • I'm looking forward to replace the bind_pass with some php code and sql query to lookup each users password and protect the adressbooks against spy.
  • Figuring out why Thunderbird (2.0.0.21 running on ubuntu 8.10) is only able to read but not able to add entries to addressbook. Seems that there is no function for adding contacts to a ldap directory.

Your comments will be welcome.
« Last Edit: May 14, 2009, 02:53:43 PM by frank »

Offline techdude

  • Jr. Member
  • **
  • Posts: 38
LDAP for Roundcube and Thunderbird
« Reply #6 on: May 17, 2009, 10:17:36 AM »
Frank:  Is there anyway to make each seperate private addressbook password protected?  Like using the username and password of their Linux account?