Webmail

From CSCWiki
Revision as of 23:12, 20 January 2010 by Jbroman (talk | contribs) (Webmail documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Webmail is offered at https://mail.csclub.uwaterloo.ca and hosted on caffeine. It currently runs RoundCube as www-webmail (UID 301) via suexec through mod_fcgid.

Configuration

The configuration is located in /etc/roundcube, and the database configuration is generated from /etc/dbconfig-common/roundcube.conf. At the moment, RoundCube stores its data (user preferences, etc.) in a MySQL database called csc-roundcube using a user of the same name. RoundCube is configured to auto-complete contacts from the CSC and UW LDAP directories for convenience.

Logging

A few different logs are involved in webmail (logrotate should take care of keeping them from expanding too much):

Path Written by Purpose
/var/log/roundcube/errors RoundCube RoundCube errors: Can mostly be ignored, but PHP errors get redirected here so it may be useful.
/var/log/roundcube/sendmail RoundCube Makes an entry whenever a user sends a message.
/var/log/apache2/csc-mail-access.log Apache Logs requests to the mail vhost.
/var/log/apache2/csc-mail-error.log Apache Logs errors generated by Apache for the mail vhost.
/var/log/apache2/suexec.log suexec Logs errors with suexec.

suexec

Webmail is currently run as www-webmail using suexec. Suexec is fairly picky about permissions, so here are the permissions on the FastCGI wrapper stuff and their contents. This setup is known to work.

dr-xr-xr-x 2 www-webmail www-webmail 4096 2010-01-20 21:57 /var/lib/roundcube/fcgi-wrapper

-r-xr-xr-x 1 www-webmail www-webmail   95 2010-01-20 21:57 php-cgi
#!/bin/sh
export PHP_FCGI_CHILDREN=3
export PHP_FCGI_MAX_REQUESTS=4000
exec /usr/bin/php5-cgi

-rwxr-xr-x 1 root        root          71 2010-01-20 21:34 php-cgi-suexec
#!/bin/sh
exec /usr/lib/apache2/suexec www-webmail www-webmail php-cgi

And here is the relevant line in the vhost configuration:

FCGIWrapper "/var/lib/roundcube/fcgi-wrapper/php-cgi-suexec" .php

Patches

Since the lenny-backports version of RoundCube is 0.2 (not 0.3), plugin support does not exist in RoundCube at this time. As a result, a few pieces of extra functionality have been patched into the source. Firstly, the following is needed to generate CSC email addresses from user IDs (as we do not have any "mail" field in our directory). Add it in the _ldap2result function in /usr/share/roundcube/program/include/rcube_ldap.php, immediately before the return statement.

// if found by uid, put that in first
if (!$out['email'])
   $out['email'] = $out['name'];

// add domain if there is none
if (strpos($out['email'],"@") === FALSE)
   $out['email'] .= "@csclub.uwaterloo.ca";

Additionally, RoundCube does not automatically read user display names from LDAP, so by default emails have an outgoing display name of "j3doe" instead of "John Doe". There is a patch which remedies this. If you do need to reapply it, do so by hand as minor changes in that area of rcube_user.php may make automatic patching misbehave.