Introduction

This OXpedia article describes, how to set up a spamhandler which optionally reports ham and spam via mail to any email address system with Open-Xchange.

In addition it moves the mail to the spam folder if marked as spam and into the Inbox if a message in the spam folder is again marked as ham. The exact behaviour can be configured.

To get the UI controls all users need to be provisioned accordingly. There is no global switch to enable/disable.


Prerequisites

Target mail

For setting up the spamhandler you require the address where to send ham and spam reports to.


Installation

We will need to install the following package on the Open-Xchange server. [Please note that even if the package carries the name cloudmark it is not bound to Cloudmark product. Though Cloudmark uses the same very generic reporting method.]


Installation on OX App Suite

Debian GNU/Linux 7.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/DebianWheezy/ /
# 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/DebianWheezy/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-cloudmark

Debian GNU/Linux 8.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/DebianJessie/ /
# 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/DebianJessie/ /

and run

$ apt-get update
$ apt-get install open-xchange-spamhandler-cloudmark

SUSE Linux Enterprise Server 11

Add the package repository using zypper if not already present:

$ zypper ar https://software.open-xchange.com/products/appsuite/stable/backend/SLES11 ox

If you have a valid maintenance subscription, please run the following command and add the ldb account data to the url so that the most recent packages get installed:

$ zypper ar https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/SLES11 ox-updates

and run

$ zypper ref
$ zypper in open-xchange-spamhandler-cloudmark

SUSE Linux Enterprise Server 12

Add the package repository using zypper if not already present:

$ zypper ar https://software.open-xchange.com/products/appsuite/stable/backend/SLE_12 ox

If you have a valid maintenance subscription, please run the following command and add the ldb account data to the url so that the most recent packages get installed:

$ zypper ar https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/SLES11 ox-updates

and run

$ zypper ref
$ zypper in open-xchange-spamhandler-cloudmark

RedHat Enterprise Linux 6

Start a console and create a software repository file if not already present:

$ vim /etc/yum.repos.d/ox.repo

[ox]
name=Open-Xchange
baseurl=https://software.open-xchange.com/products/appsuite/stable/backend/RHEL6/
gpgkey=https://software.open-xchange.com/oxbuildkey.pub
enabled=1
gpgcheck=1
metadata_expire=0m
# 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
# [ox-updates]
# name=Open-Xchange Updates
# baseurl=https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL6/
# gpgkey=https://software.open-xchange.com/oxbuildkey.pub
# enabled=1
# gpgcheck=1
# metadata_expire=0m

and run

$ yum update
$ yum install open-xchange-spamhandler-cloudmark

RedHat Enterprise Linux 7

Start a console and create a software repository file if not already present:

$ vim /etc/yum.repos.d/ox.repo

[ox]
name=Open-Xchange
baseurl=https://software.open-xchange.com/products/appsuite/stable/backend/RHEL7/
gpgkey=https://software.open-xchange.com/oxbuildkey.pub
enabled=1
gpgcheck=1
metadata_expire=0m
# 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
# [ox-updates]
# name=Open-Xchange Updates
# baseurl=https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL7/
# gpgkey=https://software.open-xchange.com/oxbuildkey.pub
# enabled=1
# gpgcheck=1
# metadata_expire=0m

and run

$ yum update
$ yum install open-xchange-spamhandler-cloudmark

CentOS 6

Start a console and create a software repository file if not already present:

$ vim /etc/yum.repos.d/ox.repo

[ox]
name=Open-Xchange
baseurl=https://software.open-xchange.com/products/appsuite/stable/backend/RHEL6/
gpgkey=https://software.open-xchange.com/oxbuildkey.pub
enabled=1
gpgcheck=1
metadata_expire=0m
# 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
# [ox-updates]
# name=Open-Xchange Updates
# baseurl=https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL6/
# gpgkey=https://software.open-xchange.com/oxbuildkey.pub
# enabled=1
# gpgcheck=1
# metadata_expire=0m

and run

$ yum update
$ yum install open-xchange-spamhandler-cloudmark

CentOS 7

Start a console and create a software repository file if not already present:

$ vim /etc/yum.repos.d/ox.repo

[ox]
name=Open-Xchange
baseurl=https://software.open-xchange.com/products/appsuite/stable/backend/RHEL7/
gpgkey=https://software.open-xchange.com/oxbuildkey.pub
enabled=1
gpgcheck=1
metadata_expire=0m
# 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
# [ox-updates]
# name=Open-Xchange Updates
# baseurl=https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL7/
# gpgkey=https://software.open-xchange.com/oxbuildkey.pub
# enabled=1
# gpgcheck=1
# metadata_expire=0m

and run

$ yum update
$ yum install open-xchange-spamhandler-cloudmark

Configuration

Open the following file in editor

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

Edit the following parameter to:

com.openexchange.imap.spamHandler=CloudmarkSpamHandler

Open the following file in editor

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

Edit the following parameters to configure the reporting service:

# Defines the eMail address to which the selected eMails will be bounced. If no
# address is specified the bounce will be skipped, but moving the selected mails
# to the target folder will still be processed (if configured)
com.openexchange.spamhandler.cloudmark.targetSpamEmailAddress=

# Defines the eMail address to which the selected eMails will be bounced, if they
# are marked as Ham. If no address is specified the bounce will be skipped,
# but moving the selected mails back to the Inbox will still be processed (if configured).
# Privacy note: This will send private mails of users to that address when marked as Ham
com.openexchange.spamhandler.cloudmark.targetHamEmailAddress=

# Defines to which folder the selected mails should be moved to after they have
# been bounced to the target eMail address. If no option is configured the
# selected mails will be moved to the users trash folder. Possible options are:
#
# 0 = Do not move the message at all (not recommended)
# 1 = User's trash folder (Default)
# 2 = User's SPAM folder
# 3 = Subscribed confirmed-spam folder (experimental)
com.openexchange.spamhandler.cloudmark.targetSpamFolder=2

# Defines if the spam/ham message is passed as a nested message to the target address
#
# ----------------------------------== /!\ ==----------------------------------------
# Note: This option needs to be clarified with your running Cloudmark service that
#       passing the spam/ham message as a nested message is accepted and properly
#       handled!
# -----------------------------------------------------------------------------------
#
# Default is "true"
com.openexchange.spamhandler.cloudmark.wrapMessage=true

Once done then reboot the OX Service

$ service open-xchange restart


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