Spamassassin

From Open-Xchange

Introduction

This OXpedia article describes, how to connect the SpamAssassin system with Open-Xchange. It allows accessing your SpamAssassin settings from within Open-Xchange and use the spam- and ham Learning mechanisms of SpamAssassin directly from within the Open-Xchange UI.

Prerequisites

Sieve

You will need to install and configure the SIEVE Mail filter program on your mail server. Since we will not cover the installation part of Sieve in this article, therefore we will only tell the important configuration settings needed for Sieve to get integrated with Open-Xchange.

SpamAssassin

You will also need to install and configure the SpamAssassin. Since we will not cover the installation part of SpamAssassin in this article, therefore we will only tell the important configuration settings needed for SpamAssassin to get integrated with Open-Xchange.

Installation

We will need to install the following two packages on the Open-Xchange server.


Install on OX v6.22.x

Debian GNU/Linux 11.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/6.22/backend/DebianBullseye/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/6.22/backend/updates/DebianBullseye/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-spamassassin open-xchange-mailfilter

Debian GNU/Linux 12.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/6.22/backend/DebianBookworm/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/6.22/backend/updates/DebianBookworm/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-spamassassin open-xchange-mailfilter


Install on OX App Suite

Debian GNU/Linux 11.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/appsuite/stable/backend/DebianBullseye/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/DebianBullseye/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-spamassassin open-xchange-mailfilter

Debian GNU/Linux 12.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/appsuite/stable/backend/DebianBookworm/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/DebianBookworm/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-spamassassin open-xchange-mailfilter


Configuration

For Sieve

As we have now already installed the needed package open-xchange-mailfilter. Now we need to configure the setting the configuration file so that Open-Xchange can be integrated with Sieve.

Open the following file in your Linux editor.

$ /opt/open-xchange/etc/mailfilter.properties

Edit the following lines

SIEVE_SERVER=localhost //your sieve server name, localhost is default for single machine
 
SIEVE_PORT=4190 //this port should be same as the one you define during the installation of Sieve.

Save the changes and reboot Open-Xchange service.

$ /etc/init.d/open-xchange restart

Verify that the mailfilter bundle has started properly and should be ACTIVE.

$ listbundles | grep filter 

bundlename: com.openexchange.mail.filter status: ACTIVE

For SpamAssassin

Open the following file in Linux editor

$ /opt/open-xchange/etc/imap.properties

Edit the following parameter to:

com.openexchange.imap.spamHandler=SpamAssassin 

Once done then reboot the OX Service

$ /etc/init.d/open-xchange restart

Make sure that SpamAssassin port is also open Port 783 (by default). Also verify that spam bundles loaded successfully.

$ /opt/open-xchange/sbin/listbundles | grep spam 
bundlename: com.openexchange.spamhandler.spamassassin status: ACTIVE 


Finally, we will need to enable the capabilities for SPAM. To do this we have to run the following command for e.g.

$ changeuser -A oxadmin -P admin_password -c contextID -u username --gui_spam_filter_capabilities_enabled true 

or to set the property com.openexchange.spamhandler.enabled to true via ConfigCascade

Basic Troubleshooting

1. Make sure that you configure your Firewall to allow ports e.g. Port 4190 for Sieve and Port 783 for SpamAssassin in your Server environment.

2. Check /var/log/maillog for any issues as well. Also can turn the mail Debug logging for Dovecot e.g.

$ vi /etc/dovecot/conf.d/10-logging.conf 

and change the config parameter

$ mail_debug = yes

3. For SpamAssassin, you can also check the Open-Xchange Server logs to make sure that the settings are loaded correctly.