Two Scalix tips: Apache vhosts and keeping deleted mail

Scalix is a powerful, stable and soon to be almost completely open sourced email server. Unfortunately like many commercial products it is still a little rough round the edges when it comes to doing things outside of the supported method. Here is a couple of tips that may help you out when wanting to take Scalix "off-road" so to speak...

Keeping deleted mail indefinitely

I like to keep deleted mail mainly because I have a habit of deleting most non-business things soon after reading them. What normally happens is that a month later I remember something about an email I've read but deleted so I want to go back to it. Unfortunately by default Scalix wants to delete mail deleted mail after twenty four hours. Its not a bad default policy but changing it is not simple (though hopefully will get easier in later versions).

To change this policy open the general.cfg file in /var/opt/scalix/sys/ and add the following line to the buttom:

UAL_NO_WB_EMPTY=TRUE

Restart Scalix and it should no longer clear out deleted mail.

Integrating Scalix into an Apache Virtual Host

Another problem area with Scalix occurs in its assumption that the server it is installed on will be dedicated to email and will not have to work around or integrate into other existing services. I combine my email and Web services onto one server and within Apache there are numerous virtual hosts. I only want Scalix Web services to be exposed on a single domain (webmail.stress-free.co.nz) but by default it wants to create the Tomcat connector and CGI aliases across every single domain.

To fix this first disable the Scalix Apache include files. There are several installed in /etc/apache2/conf.d and another reference in /etc/sysconfig/apache2 that looks like this:

APACHE_CONF_INCLUDE_DIRS=/opt/scalix/global/httpd/scalix-web-client.conf

Now edit your virtual host that you want to serve email. Below is an example of my /etc/apache2/vhosts.d/webmail.stress-free.co.nz.conf illustrating the numerous Scalix specific entries required for the different services (this is used on Suse 10):

<VirtualHost 10.1.1.10:80>
ServerAdmin admin@stress-free.co.nz
ServerName webmail.stress-free.co.nz
# This is the fqdn for the Scalix server and is needed for SAC to work
ServerAlias scalix.stress-free.co.nz
DocumentRoot /srv/www/vhosts/webmail.stress-free.co.nz

ErrorLog /var/log/apache2/webmail.stress-free.co.nz-error_log
CustomLog /var/log/apache2/webmail.stress-free.co.nz-access_log combined
CustomLog /var/log/apache2/webmail.stress-free.co.nz-ssl_request_log ssl_combined

HostnameLookups Off
UseCanonicalName Off
ServerSignature On

<IfModule mod_jk.c>
# Send Scalix specific urls to a mod_jk worker named scalix (ajp13)
JkMount /webmail/* scalix
JkMount /sac/* scalix
JkMount /caa/* scalix
JkMount /webcal/* scalix
JkMount /res/* scalix
</IfModule>

<Directory "/srv/www/vhosts/webmail.stress-free.co.nz">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


<IfDefine SSL>
<IfDefine !NOSSL>
<VirtualHost 10.1.1.10:443>
ServerAdmin admin@stress-free.co.nz
ServerName webmail.stress-free.co.nz
# This is the fqdn for the Scalix server and is needed for SAC to work
ServerAlias scalix.stress-free.co.nz
DocumentRoot /srv/www/vhosts/webmail.stress-free.co.nz
ErrorLog /var/log/apache2/webmail.stress-free.co.nz-error_log
CustomLog /var/log/apache2/webmail.stress-free.co.nz-access_log combined
CustomLog /var/log/apache2/webmail.stress-free.co.nz-ssl_request_log ssl_combined

HostnameLookups Off
UseCanonicalName Off
ServerSignature On

# This by default redirects visitors to the login screen
Redirect /index.html https://webmail.stress-free.co.nz/webmail/

<Directory "/srv/www/vhosts/webmail.stress-free.co.nz">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# This sets up mod_jk for Scalix Tomcat -> Apache interaction
<IfModule mod_jk.c>
# Send everything for context /examples to worker named scalix (ajp13)
JkMount /webmail/* scalix
JkMount /sac/* scalix
JkMount /caa/* scalix
JkMount /webcal/* scalix
JkMount /res/* scalix
</IfModule>

# Scalix cgi-bin aliases
Alias /omhtml/ /var/opt/scalix/omhtml/
AliasMatch ^/omhtml\.([^/]*)/ /var/opt/om.$1/omhtml/

ScriptAlias /Scalix/rw /opt/scalix/bin/ice.cgi/prof=RW-C
ScriptAliasMatch ^/Scalix/rw-(.*) /opt/scalix/bin/ice.cgi/prof=RW-$1

# Add legacy PAW profile also ...
ScriptAlias /Scalix/paw /opt/scalix/bin/ice.cgi/prof=PAW-C
ScriptAliasMatch ^/Scalix/paw-(.*) /opt/scalix/bin/ice.cgi/prof=PAW-$1

ScriptAlias /Scalix/wap /opt/scalix/bin/ice.cgi/prof=WAP-C
ScriptAliasMatch ^/Scalix/wap-(.*) /opt/scalix/bin/ice.cgi/prof=WAP-$1

<Directory "/opt/scalix/bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
AddDefaultCharset off
</Directory>
<Directory "/var/opt/scalix/omhtml">
AllowOverride None
Order allow,deny
Allow from all
AddDefaultCharset off
</Directory>

SSLEngine on
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /etc/apache2/ssl.crt/www.stress-free.co.nz.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/www.stress-free.co.nz.key
SSLProtocol all -SSLv2
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

</VirtualHost>
</IfDefine>
</IfDefine>

I am using the Suse mod_jk library not the Scalix supplied version. This is configured in /etc/apache2/conf.d/mod_jk.conf and for my system looks like this:

<IfModule mod_jk.c>
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>

This configures mod_jk and references the /etc/apache2/workers.properties file which looks like this for my server:

worker.list=scalix

worker.scalix.type=lb
worker.scalix.balanced_workers=scalix1

# Set properties for worker1 (ajp13)
worker.scalix1.type=ajp13
worker.scalix1.host=127.0.0.1
worker.scalix1.port=8009
worker.scalix1.lbfactor=50
worker.scalix1.cachesize=10
worker.scalix1.cache_timeout=600
worker.scalix1.socket_keepalive=1
worker.scalix1.reclycle_timeout=300

Restart Apache and hopefully you should find Scalix works for your virtual host (and only your virtual host). If you have experience with configuring Apache2 and Tomcat you should find this relatively straightforward but if you don't it will be quite intimidating sorry.