Penguin
Blame: LDAPAddressBook
EditPageHistoryDiffInfoLikePages
Annotated edit history of LDAPAddressBook version 8, including all changes. View license author blame.
Rev Author # Line
4 AristotlePagaltzis 1 !! Installing LDAP
1 MattBrown 2
3 DanielLawson 3 My project for the day was to get a [LDAP] address book running, so I can get rid of pieces of paper with phone numbers. Eventually I'd like to be able to sync my cellphone against it (easy, cos the software for the phone can take a CSV and I'm sure I could write a connector if I wanted), and I want to be able to read it from MicrosoftOutlook/OutlookExpress and XimianEvolution, and write to it with at least Evolution (pref. everything, but you can't always get what you want.)
1 MattBrown 4
4 AristotlePagaltzis 5 These notes may be slightly [Debian] specific, [YMMV], etc.
1 MattBrown 6
4 AristotlePagaltzis 7 There is also an article about [Building an Address Book with OpenLDAP | http://www.onlamp.com/pub/a/onlamp/2003/03/27/ldap_ab.html] on [ONLamp | http://www.onlamp.com/].
8
9 ! 1. Install slapd
1 MattBrown 10
3 DanielLawson 11 [[root@jane]: ~# apt-get install slapd ldap-utils
12 The following extra packages will be installed:
13 libgtk1.2 libgtk1.2-common libiodbc2
1 MattBrown 14
3 DanielLawson 15 Why does my server need [GTK], you say? Well, on Debian [Woody], OpenLDAP requires [ODBC], ODBC requires ODBC-setup and ODBC-setup requires libgtk. Or something similar. (Fixed in testing - see [LDAPNotes].)
16
17 When you install the server, use your hostname for the LDAP root DN - my hostname is ellusions.tla so my DN becomes dc=ellusions,dc=tla.
6 JackWasey 18
7 IanMcDonald 19 Depending on how you install the packages, you may not be offered the choice of domain name. If you are not asked, the name could default to something useless like 'localhost', so use:
6 JackWasey 20
21 dpkg-reconfigure -plow slapd
22
3 DanielLawson 23
4 AristotlePagaltzis 24 ! 2. Get your existing contacts
3 DanielLawson 25
26 By far the easiest way I found to get contacts out of Outlook and into LDIF was using MozillaMail as an intermediate step. Export whatever fields you need to a [CSV], fire up Mozilla and it's address book, import the file, line up the fields (be careful here!) and then you have all your data in Mozilla's address book. From the Tools menu, click Export, to LDIF - done.
27
28 I also found a [Perl script that converts CSV to LDIF|http://ranger.dnsalias.com/mandrake/muo/connect/cldap4.html] but then you'll have to manually align the fields.
29
4 AristotlePagaltzis 30 ! 3. Create an OU ([OrganisationalUnit]) for your contacts
3 DanielLawson 31
32 Create a file called 'ou.ldif' that contains something like this (edit for your DN)
33
34 dn: ou=Contacts, dc=ellusions, dc=tla
35 objectClass: top
36 objectClass: organizationalUnit
37 ou: Contacts
38
39 Then import it with
40
41 # ldapadd -W -x -D "cn=admin,dc=ellusions,dc=tla" -f ou.ldif
42 Enter LDAP Password: xxxxxxxx
43 adding new entry "ou=Contacts, dc=ellusions, dc=tla"
44
45 Done!
46
4 AristotlePagaltzis 47 ! 4. Modify the output from the export to fit your DN
3 DanielLawson 48
49 You need to run a substitution or two over your file. Create a [Perl] script:
50
51 #!/usr/bin/perl -pi
52 s/mail=.*/ou=Contacts,dc=ellusions,dc=tla/;
53 s/modifytimestamp.*\n//;
54 s/objectclass: mozillaAbPersonObsolete.*\n//;
55
56 eg as __fix-ldif__ and run it (don't forget to __chmod a+x__):
57
58 # ./fix-ldif contacts.ldif
59
8 IanMcDonald 60 The first substitution takes mail=(emailaddr) ([Mozilla]'s DN) and replaces it with your own. The second removes the modify time, which a standard ldap add can't set.
3 DanielLawson 61
62 Then remove any givenName and sn blocks and use this:
63
64 # perl -pi -e '$_ .= "givenName: $1\n" . "sn: $2\n" if /^cn: \s+ (\w+) \s+ (.*)//x' contacts.ldif
65
66 ''If this works (it should), it should be added to the script above.'' --AristotlePagaltzis
5 SusanneWenz 67
8 IanMcDonald 68 ''No, it doesn't. Afterwards my contacts.ldif was empty :-('' --Susanne Wenz
5 SusanneWenz 69
70
3 DanielLawson 71
72 Now import them in much the same way:
73
4 AristotlePagaltzis 74 ! 5. Connect Evolution to your address book
3 DanielLawson 75
76 In the Tools menu, click Settings. Select Directory Server and Add a new connection. Follow the wizard, adding the name of your server, binding by DN (use cn=admin,dc=ellusions,dc=tla at this point).
77
78 When you save this, you will see an entry for your LDAP server under "Other Contacts". If you click it it should ask you for a password (once, use your root DN password) - upon success __you will see no contacts__. Click "Clear" on the search field on top of the box and they should populate. You can then add/edit/search the contacts.
1 MattBrown 79
80 Ximian Evolution assumes that you will not have write access to your LDAP address book unless you have authenticated with the LDAP server.
3 DanielLawson 81
4 AristotlePagaltzis 82 ! 6. Caveats
3 DanielLawson 83
84 * You will see a contact with "Department: Contacts". This is the OU; you can't do anything with this.
85 * If you try and create a user 'Foo', you will get a failure (Error adding card: Other error) which equates to "no sn: field in LDAP".
8 IanMcDonald 86 * You shouldn't use the root DN - the next update will concern creating an [LDAP] user and giving them access to the contacts, but I might tie that into migrating all my system users to [LDAP] as well.
87 * If you are trying to export address books from [Mozilla] to use via [LDAP] in [Mozilla] it might help to be aware of some bugs ..
88 http://bugzilla.mozilla.org/show_bug.cgi?id=116692 this [URL] contains links to an official [Mozilla] [LDAP] [Schema] and a [Perl] script to help convert the current ldif export to conform with this [Schema].
The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • JackWasey
  • SusanneWenz
The following authors of this page have agreed to the WlugWikiLicense.

lib/plugin/WlugLicense.php (In template 'html'):99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php (In template 'html'):111: Notice: Undefined variable: ignore_authors

lib/plugin/WlugLicense.php (In template 'html'):111: Notice: Undefined variable: ignore_authors

lib/plugin/WlugLicense.php (In template 'html'):111: Notice: Undefined variable: ignore_authors