I’ve been trying for months to get the latest Horde groupware client to integrate with our Kolab server. While this has been promised for Horde version 4 already (and first implementation attempts reach back to Horde version 1, if I recall correctly), it had always been more effort than I was able to make. But at least I tried 😉
Kolab once shipped with Horde as its web-based client, but that has changed, so maybe there where political games being played in the background without me noticing. And while I once was told that Kolab integration was to be expected for Horde 4 (H4), we now have Horde 5 out there and still Kolab integration doesn’t come right out of the box.
Horde 5 can be made to talk to Kolab
Nevertheless, with Horde 5 I’ve been able to get so far as to almost having a full working integration: It took me the better of a half working day to debug, (more or less) understand and change some code, but then it was “Heureka!” time: Horde 5 and Kolab 2.2 – yes, we can!
(And like with the original “main user” of that slogan, when it comes to re-election time and you look back at what has been achieved, not all is golden. There are some minor problems still waiting to be solved. But I keep up my vote for Horde 😉 )
Lets take a look at the half-full glass of wine, rather than whine: With the changes I’ve made (see further down this article), not only standard web-mail features work, but I can also use my Kolab/IMAP-stored calendar, address books, notes and task lists, together with the shared resources of other users. Great!
I’ve been discussing this privately and was told that “Kolab works with Horde, you just have to do the manual configuration” – looking at some other reports, there actually seem to be some non-developers out there interfacing Horde with Kolab servers, using groupware functions. Must be some kind of configuration artwork, because as soon as I turn on all kolab drivers in Horde’s configuration options, I start getting PHP errors in the logs and white browser screens.
For completeness, here are the things that don’t work for me (yet):
- Persisting the address book “name format” settings doesn’t work for me: Although I receive a positive response messages after saving, they’re always “no format”. (Update: This problem has shown to be related to my account’s preferences as stored in the according IMAP folder – after re-initializing the preferences, the above error could no longer be recreated.)
- Maybe completely unrelated to the Kolab changes, but who knows: When I sync my mobile phone with Horde, I can see changes made on the phone within Horde. But when I change that data (i.e. a calendar entry) inside Horde, that change doesn’t find its way back to the phone. (Update: This is no Horde bug,but PHP’s fault.)
While testing my setup, I came across two nasty problems:
There seems to be a bug in PHP, causing error messages (and corresponding failures of Horde) like:
PHP Fatal error: Base lambda function for closure not found
Once I ran into this, I had to restart my Apache web server to get things back to normal… but a few requests later, I got struck by the same error. There was an update to PHP on the server machine, but the problem still manifests much too often. (Just for reference: I’m talking about a SLES 11 SP2 machine, 64bit, currently using php53-5.3.8-0.39.1)
The other problem was more of the “user at keyboard detected – system halted!” type: The task application (“nag”) seemed to be unable to create new tasks. As I was testing my own changes, I attributed these errors to my changes, but actually it turned out that you need to have both mod_rewrite activated on your web server and to allow .htaccess overrides for them rewrite rules, too. Seems this is documented somewhere, but also it seems as many others missed that info, too.
I solved this by creating a new file /etc/apache2/conf.d/horde5.conf:
# ActiveSync support Alias /Microsoft-Server-ActiveSync /srv/www/htdocs/horde5/rpc.php Alias /autodiscover/autodiscover.xml /srv/www/htdocs/horde5/rpc.php # allow .htaccess with individual mod_rewrite settings <Directory /srv/www/htdocs/horde5 > Options FollowSymLinks AllowOverride All </Directory>
There may be many other problems I haven’t come across yet, those are just the few I noticed after spending a few hours with Horde 5. I’ll put the modified “Horde 5 / Kolab” system up as an alternative to our “old” H4-based web interface, we’ll see how things work out after some productive use.
This being version 2 of this article, the required changes have dropped drastically due to the good and continuous work of the Horde development team. It basically went down to two code changes and tuning the (not too up-to-date) “kolab-webmail” bundle. I’ve attached three patch files to this article, for those that would like to them against the git version or manually apply these to the files coming via PEAR.
Here’s what I had to do to bring up a functional Horde5 with working Kolab 2.2 integration, and why I deemed it necessary:
- Install the current Horde5 from its PEAR repositories
This ought to be straight-forward and is documented on the Horde site. Just make sure to install the webmail package and don’t actually access the site via browser before making the changes documented below.
# pear install horde/horde_role # pear run-scripts horde/Horde_Role Including external post-installation script "/usr/share/php5/PEAR/PEAR/Installer/Role/Horde/Role.php" - any errors are in this script Inclusion succeeded running post-install script "Horde_Role_postinstall->init()" init succeeded Filesystem location for the base Horde application : /srv/www/htdocs/horde5 Configuration successfully saved to PEAR config. Install scripts complete # pear install -a -B horde/webmail
- Integrate the kolab_webmail bundle files from git
The git repository of Horde has all the latest code, which in case of the kolab_webmail bundle doesn’t automatically mean “current” :(. Some of the stuff right-out caused errors, some of it seems to do no harm, some of it is really helpful. I’ve created and submitted a patch to the Horde team with my modifications, hopefully they’ll find some or all of it worthy of integrating with the rest of the code.
You’ll find the files under “bundles/kolab_webmail/” in the base directory of your git clone and can copy them to the according directories beneath the “Filesystem location for the base Horde application”
- Fix a few files, see the linked patch files for details:
Somehow, the file “/usr/share/php5/PEAR/Horde/Group/Kolab.php” isn’t included at run-time, thus the data types defined there are unavailable. I’m sure there must be a better way to do this, but I simply know of none – the straight-forward – but ugly – Include_once() at least fixed this situation. (Update: There are Horde5 updates on their way to fix this differently – but definitely they’re fixing it :))
It seems that along the way, some refactoring was done. The class named “Horde_Group_Kolab” is now called as “Horde_Core_Group_Kolab”, but no-one change its definition in this file. To make matters worse, the constructor didn’t establish the proper layout of the instance, I fixed the according places by borrowing from “Ldap.php” in the same directory. The patch file contains both changes A and B. (Update: There are Horde5 updates on their way to fix this differently – but definitely they’re fixing it :))
Maybe our installation contains too old entries, but “nag” seems to have a problem with some of them (those with empty start and/or completion dates). Again, a simple fix will help with that. (Update: Once I re-created the preferences of my account (dating back to Horde1 times), this error could no longer be preproduced.)
- Set the proper ownership to all files and directories
When you try to configure Horde via the web interface, the web server invokes all PHP routines to update the config files. To make those updates possible, you need to make sure that all config files (and probably the containing directories, too) are write-accessible to the user id running the web server.
Once the code is patched, you can start configuring the Horde installation by invoking the bundle configuration script (copied earlier) and then the web interface.
# $WEBROOT/bin/kolab-webmail-install Installing Horde Kolab Edition Configuring database settings What database backend should we use? (false) [None] (mysql) MySQL / PDO (mysqli) MySQL (mysqli) (pgsql) PostgreSQL (sqlite) SQLite Type your choice : mysql Request persistent connections? (1) Yes (0) No Type your choice : Username to connect to the database as*  horde5 Password to connect with How should we connect to the database? (unix) UNIX Sockets (tcp) TCP/IP Type your choice [unix]: tcp Database server/host*  mysql.company.com Port the DB is running on, if non-standard  Database name to use*  horde5 Internally used charset* [utf-8] Use SSL to connect to the server? (1) Yes (0) No Type your choice : 0 Certification Authority to use for SSL connections  /etc/ssl/certs/CA_company.cert.pem Split reads to a different server? (false) Disabled (true) Enabled Type your choice [false]: Writing main configuration file... done. Configuring administrator settings Provide the host name of your Kolab server: kolab.company.com Provide the host name of your SMTP server (may be your Kolab server name): kolab.copmany.com Provide the host name of your LDAP server (may be your Kolab server name): kolab.company.com Provide the primary mail domain of your Kolab server: company.com Provide the base DN of your Kolab server: dc=company,dc=com Provide the PHP DN of your Kolab LDAP nobody user, relative to base DN (may be "cn=nobody,cn=internal,"): cn=horde,ou=virtual,ou=people, Provide the PHP pw of your Kolab LDAP nobody user: ******* Writing main configuration file... done. Creating and updating database tables... done. Thank you for using Horde Kolab Edition!
I had made the following changes via the web administration interface (using Kolab’s “manager” account to log in to Horde):
- adjusting the path values according to our server situation
- set the localhost information
Of course there are plenty of other settings you may need or want to modify to adopt to your specific situation – I’ve only mentioned the changes that seemed to be necessary to get things up & running.
- Now you can save the configuration, create the database schemata etc as required… and are ready to rock!
Copyrights and disclaimer
You may use any information on this page without any license restrictions, for private, public and commercial projects. If you find any error or a better way to do things, you are kindly asked to leave a corresponding comment below and/or contact the Horde project about it.
Disclaimer: If you use anything from this page, it’s at your own risk. I specifically do not claim that the information provided here is free of errors nor that it is suitable for any type of use. Applying the changes described above may lead to data corruption, mail loss or worse. YMMV.