[horde] CVS Head working, now LDAP and virtual domains

Edwin Culp eculp at viviendaatualcance.com.mx
Tue Mar 30 14:53:17 PST 2004


Quoting "John R. Hillman" <john at ridewide.com>:

> Cheese and rice, Ed, I didn't expect you to code it up *for* me! But, thanks
> just the same. ;)  I'll get a chance to try it out later tonight and I'll
> let you know how it goes.
John,

Don't believe that it's coded, it is just typed.  (I found a
missing , before the 'o=internet'.  It should be
',o=internet' same with 'ou=people' ',ou=people'.  At least
my errors are consistent (type once - cut and paste many
:-) There are probably many more because your configuration
could be different, I didn't check anything closely so be
sure to run "php -l filename.php" over it for puntuation
errors, etc. and look at the configuration and that I
haven't forgotten something like a dc= or what ever.  It is
really just an idea of what you should be able to do and
then polish it.

Good luck and let me know if it doesn't work,

ed
>
> Thanks again!
>
> J
>
>> -----Original Message-----
>> From: Edwin Culp [mailto:eculp at viviendaatualcance.com.mx]
>> Sent: Tuesday, March 30, 2004 3:15 PM
>> To: John R. Hillman
>> Cc: horde at lists.horde.org
>> Subject: RE: [horde] CVS Head working, now LDAP and virtual domains
>>
>> Quoting "John R. Hillman" <john at ridewide.com>:
>>
>> >> Personally I would use nameVirtualHost for each domain and
>> >> then parse the $_SERVER['HTTP_HOST'] variable, asigning
>> >> each element from the hostname.    You can do it
>> >> anywhere/everywhere ;-)  Off hand I'm not sure where you
>> >> might need it but at least in horde/config and turba/config
>> >
>> > Ed-
>> >
>> > Thanks.  In our old Horde (2.2.5, I think, stable release, non-CVS
>> anyway)
>> > implementation, we use the vinfo hook in Imp to pull the @domain.tld
>> part
>> > out of HTTP_HOST and append it to the login stuff automagically.
>> >
>> > I'm thinking that perhaps we'll drop the automagic addition of the
>> domain
>> > during login (forcing users to put in their whole email address), but
>> then I
>> > will still need to modify the BaseDN for Prefs and Turba.
>> >
>> > In looking through the files, it seems to me I'll need to modify the
>> > _prefs_hook_from_addr to separate the <username> from the <domain>.<tld>
>> > into individual variables.  Then I can concat them backtogether for the
>> > username, and also use them for building up a BaseDN.  Something like
>> this
>> > (pseudo code):
>> >
>> > $name = Auth::GetAuth() {
>> > 	$username = /regex to get everything before the @/;
>> > 	$domain = /regex to get everything after the @, but before the ./;
>> > 	$tld = /regex to get the stuff after the ./;
>> > 	$baseDN = 'ou=People,'.'dc='.$domain.',dc='.$tld.'o=internet";
>> >
>> > 	/...no clue where to go from here.../
>> > };
>> >
>> John,
>>
>> I'm going to put this back on the list so folks can correct
>> any errors that I have here.  With the below, if it works,
>> I haven't tested it.  You could just put it at the top of
>> the conf.php file or if you want put it in a seperate file
>> and just include it where needed.
>>
>> $vdomain =
>> strtolower(preg_replace('/^mail\.|^www\.|^www\.mail\./i',
>>   '', $_SERVER['HTTP_HOST']));
>> list($domain, $tld) = explode(".", $vdomain);
>> $uid = Auth::getBareAuth();
>> $mail = Auth::getAuth();
>> $pass=Auth::getCredential('password');
>>
>> In horde conf.php you will just put them in the areas needed
>> such as:
>>
>> $conf['auth']['driver'] = 'ldap';
>> $conf['auth']['params'] = array(
>>          'hostspec' => 'localhost',
>>          'port' => 389,
>>          'basedn' => 'ou=people,dc=' . $domain . ',dc=' .
>> $tld . 'o=internet',
>> //        'binddn' =>
>> 'cn=manager,ou=administrators,o=internet',
>> //        'password' => 'secret',
>>          'bind_dn' => 'mail=' . $mail . 'ou=people,dc=' .
>> $domain . ',dc=' . $tld . 'o=internet',
>>          'password' => $pass,
>>          'uid' => 'mail',
>>          'objectclass' => array(
>>             'person'
>>           ),
>> );
>>
>> Choose the binddn that fits your configuration as with the
>> other variables.
>>
>> Prefs would be something like:
>>
>> $conf['prefs']['driver'] = 'ldap';
>> $conf['prefs']['params'] = array();
>> $conf['prefs']['params']['hostspec'] = 'localhost';
>> $conf['prefs']['params']['port'] = '389';
>> // $conf['prefs']['params']['rootdn'] =
>> 'cn=manager,ou=administrators,o=internet';
>> // $conf['prefs']['params']['password'] = 'secret';
>>   $conf['prefs']['params']['rootdn'] = 'mail=' . $mail .
>> 'ou=people,dc=' . $domain . ',dc=' . $tld . 'o=internet';
>>   $conf['prefs']['params']['password'] = $pass;
>> $conf['prefs']['params']['basedn'] = 'ou=people,dc=' .
>> $domain . ',dc=' . $tld . 'o=internet';
>> $conf['prefs']['params']['uid'] = 'mail';
>>
>> And so on and so on.
>>
>> Good luck,
>>
>> ed
>>
>> > I'm just picking up PHP, so I'm sure I'm behind the learning curve.
>> Perhaps
>> > using a custom _prefs_hook_from_addr isn't the way to go, though.  I
>> guess
>> > the 'no clue where to go from here' section would be easier to pseudo
>> code
>> > in my head if I knew what variable horde was expecting me to set (and
>> > return) for the Prefs stuff.  After that, I'll worry about Turba. :)
>> >
>> > Thanks again,
>> >
>> > J
>>





More information about the horde mailing list