PersonalAddressBooks

From ISPMan

Jump to: navigation, search

varalch monelze

This page is currently under development by
PedroAlgarvio
This information maybe incomplete or wrong so please use this information at your own risk. Thank you.
Feel free to make suggestions or edit this page.


Contents

[edit] Initial Thoughts

Thinking on adding a centralized address book for your ISPMan installation(s) domain(s)/user(s)?

s0undt3ch has found you the solution ;)

First of all I'd like to thank Andreas John for providing me with the needed bootstrap to achieve this, and also, all of the folks on #ldap who helped a lot with my noobiness regarding ldap ACL's according to research papers.

This is by no means, of course, the only way to do this, and probably not the best one since there's not even a standard way to do it, not even a standard ldap schema besides inetOrgPerson probably, which lacks lot's of fields for what you're probably used to with Thunderbird, (M$) 0utlook, Evolution, etc, etc, etc.

[edit] The Hard Way

[edit] LDAP Tree Changes / Additions

You're probably very used to the ISPMan tree by now, and with the suggestion of trappist on our wonderful IRC channel, this implementation is the less intrusive possible on your current ldap tree.

The initial PAB's(Personal Address Books) ldif is:

dn: ou=pabs,o=ispman
objectClass: top
objectClass: organizationalUnit
ou: pabs

Of course, change o=ispman to whatever ldapBaseDN you adopted when you installed ISPMan, then import that into your tree.

Now, for every domain, you'll have to also add to ldap:

dn: ou=domain.tld,ou=pabs,o=ispman
objectClass: top
objectClass: organizationalUnit
ou: domain.tld


And for every new user:

dn: ou=user_domain_tld,ou=domain.tld,ou=pabs,o=ispman
objectClass: top
objectClass: organizationalUnit
ou: user_domain_tld

Now you might ask:
Since ISPMan CVS now supports the user@domain.tld login's why not use that for the user's PAB DN?
The quick and only answer is, because it eases a lot the needed ACL's to include in slapd.conf which I now tell you what they are, heh, what it is ;).
Add to your slapd.conf:

access to dn.regex="^(.+,)?ou=([^,]+),ou=([^,]+),ou=pabs,o=ispman$"
    by dn.exact,expand="uid=$2,ou=users,ispmanDomain=$3,o=ispman" write
    by * none

The above means that we expect 2 matching groups, plus an optional 3rd, which actually comes first. The last 2 groups are needed to build the dn which will have write access to the PAB. Everyone else, does not even get a change to read it. The optional first group is to match every entry we add to our PAB and to allow us to add, edit and delete those entries.
If you need to better understand this, man slapd.access ;).

One last thing regarding the above ACL which you must add to your slapd.conf, the order of the ACL's MATTERS.
If only I had thought about that it would have saved me a couple of hours arround the subject.


[edit] TO NOT FORGET

--- Driver.php.old      2007-03-31 22:35:50.000000000 +0100
+++ Driver.php  2007-03-31 22:26:21.000000000 +0100
@@ -142,6 +142,9 @@
                 $fields[$this->map[$key]] = $val;
             }
         }
+        if (empty($fields['cn'])) {
+            $fields['cn'] = $fields['givenName'] . ' ' . $fields['sn'];
+        }
         return $fields;
     }

[edit] The Easy Way

[edit] ISPman Patching

Patch to ISPMan(CVS HEAD) to naturally create/delete domain/user PAB(s).

  1. Index: install-data/examples/openldap/slapd.ldapv3.conf.tmpl
  2. ===================================================================
  3. RCS file: /cvsroot/ispman/ispman/install-data/examples/openldap/slapd.ldapv3.conf.tmpl,v
  4. retrieving revision 1.3
  5. diff -r1.3 slapd.ldapv3.conf.tmpl
  6. 72a73,76
  7. > # PAB ACL's
  8. > access to dn.regex="^(.+,)?ou=([^,]+),ou=([^,]+),ou=pabs,%%ldapBaseDN%%$"
  9. > by dn.exact,expand="uid=$2,ou=users,ispmanDomain=$3,%%ldapBaseDN%%" write
  10. > by * none
  11. Index: install-data/ldifs/base.ldif
  12. ===================================================================
  13. RCS file: /cvsroot/ispman/ispman/install-data/ldifs/base.ldif,v
  14. retrieving revision 1.7
  15. diff -r1.7 base.ldif
  16. 33a34,39
  17. > # PAB Stuff
  18. > dn: ou=pabs,%%ldapBaseDN%%
  19. > objectClass: top
  20. > objectClass: organizationalUnit
  21. > ou: pabs
  22. >
  23. Index: install-data/templates/domain.common.ldif.template
  24. ===================================================================
  25. RCS file: /cvsroot/ispman/ispman/install-data/templates/domain.common.ldif.template,v
  26. retrieving revision 1.9
  27. diff -r1.9 domain.common.ldif.template
  28. 41c41,45
  29. <
  30. ---
  31. > # PAB Stuff
  32. > dn: ou=<perl>$domain</perl>, ou=pabs, <perl>$ispman->getConf("ldapBaseDN")</perl>
  33. > objectClass: top
  34. > objectClass: organizationalUnit
  35. > ou: <perl>$domain</perl>
  36. Index: install-data/templates/users.ldif.template
  37. ===================================================================
  38. RCS file: /cvsroot/ispman/ispman/install-data/templates/users.ldif.template,v
  39. retrieving revision 1.16
  40. diff -r1.16 users.ldif.template
  41. 72c72,76
  42. <
  43. ---
  44. > # PAB Stuff
  45. > dn: ou=<perl>$r->param("uid")</perl>, ou=<perl>$r->param("ispmanDomain")</perl>, ou=pabs, <perl>$ispman->getConf("ldapBaseDN")</perl>
  46. > objectClass: top
  47. > objectClass: organizationalUnit
  48. > ou: <perl>$r->param("uid")</perl>
  49. Index: lib/ISPMan/DomainMan.pm
  50. ===================================================================
  51. RCS file: /cvsroot/ispman/ispman/lib/ISPMan/DomainMan.pm,v
  52. retrieving revision 1.88
  53. diff -r1.88 DomainMan.pm
  54. 468a469,473
  55. > # Delete Domain PAB's
  56. > $self->delTree(
  57. > 'ou=' . $domain . ',ou=pabs,' . $self->getConf("ldapBaseDN")
  58. > );
  59. >
  60. Index: lib/ISPMan/UserMan.pm
  61. ===================================================================
  62. RCS file: /cvsroot/ispman/ispman/lib/ISPMan/UserMan.pm,v
  63. retrieving revision 1.65
  64. diff -r1.65 UserMan.pm
  65. 305a306,308
  66. > # Delete User PAB
  67. > my $pab_dn = 'ou=' . $self->{'user'}{'uid'} . ',ou=' . $self->{'user'}{'ispmanDomain'} . ',ou=pabs,' . $self->getConf("ldapBaseDN");
  68. > $self->delTree( $pab_dn );
  69.  
Personal tools