Message Content Protection
Introduction
The point of Message Content Protection (MCP) is to allow you to write
rules for scanning the text content of email messages so you can trap
messages that contain certain numbers of keywords and/or phrases that
you don't want leaving your company. It could also be used to ban mail
containing pornographic phrases and so on, without having to mess with
Spam Actions or have custom spam rules to do it.
Basically what happens is that it is another call to SpamAssassin,
but this time using a completely customised set of rules and a separate set
of actions. Without any of the RBL checks, Bayes, etc of course. This
means that you can create your own rules and give them whatever score
you choose. Various different actions are then taken depending on the score.
To enable MCP, you need to set some configuration options in
MailScanner.conf file. You may also want to apply patches to
SpamAssassin to that MCP can scan the contents of attachments such as
Microsoft Word documents.
New MailScanner.conf Settings
All the MCP configurations contain "MCP" or "mcp" in their name, so they
can easily be found near the end of MailScanner.conf. For documentation
describing each of the settings, see the corresponding SpamAssassin
setting in MailScanner.conf, and/or read the book.
The "MCP Error Score" setting is there so that you can choose what happens
if the MCP system fails for some unknown reason. Set it to 0 and failure
will cause mail to be delivered as normal, but a high score would make
it get stopped (assuming you set "High Scoring MCP Actions" appropriately.
languages.conf Settings
You need to ensure you have the MCP output strings set in the
languages.conf for your language(s). This file can be found in
/etc/MailScanner/reports/en/languages.conf (for the language "en").
Ensure the file contains the following:
# Used in MCP checks
MCP = MCP
MCPSpamAssassin = MCP-Checker
MCPnotspam = MCP-Clean
MCPspam = MCP-Trapped
MCPblacklisted = MCP-Blacklisted
MCPwhitelisted = MCP-Whitelisted
MCPsadisabled = MCP disabled
MCPsanoheaders = MCP Message had no headers
MCPsatimedout = MCP timed out
Patching SpamAssassin
There are patches you need to apply to your copy of SpamAssassin for
MCP to be able to examine non-text attachments such as Microsoft Word
documents. Without these patches, it is only be able to examine text and HTML
sections of email messages.
You need to find your copy of SpamAssassin. You can usually find it with
one of these commands:
find /usr/lib -name SpamAssassin -print
find /usr/perl5 -name SpamAssassin -print
In that directory, you should find some files, including Conf.pm,
Message.pm, PerMsgStatus.pm and Util.pm.
If you are not sure which version of SpamAssassin you have installed,
then run this command:
perl -MMail::SpamAssassin -e 'print "You have version $Mail::SpamAssassin::VERSION\n";'
Once you know the version you have, it should be 2.63-2.64, 3.0.4,
3.1.0, 3.1.1, 3.1.7, 3.2.0 to 3.2.3. If it is less than 3.2.3 then I strongly advise that you upgrade to 3.2 (or whatever the latest version now is) if
you want to use this feature. If it is more than 3.2.3 then please contact me and request an
update for these patches.
patch < Conf.pm.patch.2.63
patch < PerMsgStatus.pm.patch.2.63
If you are running version 3.0.0, then use these 3 commands:
patch < Conf.pm.patch.3.0.0
patch < Message.pm.patch.3.0.0
patch < PerMsgStatus.pm.patch.3.0.0
If you are running version 3.0.4, then use these 3 commands:
patch < Conf.pm.patch.3.0.4
patch < Message.pm.patch.3.0.4
patch < PerMsgStatus.pm.patch.3.0.4
If you are running version 3.1.0, then use these 3 commands:
patch < Conf.pm.patch.3.1.0
patch < Message.pm.patch.3.1.0
patch < PerMsgStatus.pm.patch.3.1.0
If you are running version 3.1.1, then use these 3 commands:
patch < Conf.pm.patch.3.1.1
patch < Message.pm.patch.3.1.1
patch < PerMsgStatus.pm.patch.3.1.1
If you are running version 3.1.7, then use these 3 commands:
patch < Conf.pm.patch.3.1.7
patch < Message.pm.patch.3.1.7
patch < PerMsgStatus.pm.patch.3.1.7
If you are running version 3.2.0, then use these 3 commands:
patch < Conf.pm.patch.3.2.0
patch < Message.pm.patch.3.2.0
patch < PerMsgStatus.pm.patch.3.2.0
If you are running version 3.2.1 or 3.2.2, then use this single command:
patch < Util.pm.patch.3.2.1
If you are running version 3.2.3, then use this single command:
patch < Util.pm.patch.3.2.3
If you are running version 3.2.4, then use this single command:
patch < Util.pm.patch.3.2.4
Once that is done, and you have stopped and restarted MailScanner, the
MCP features will be able to check inside non-text attachments to messages.
Example
There is a very simple sample rule file in
/etc/MailScanner/mcp/*.cf which shows you the basic syntax so
you can test the system is working properly. Read the output of "man
Mail::SpamAssassin::Conf" for full details of the syntax of the rules
you can add. You can place rules in the /etc/MailScanner/mcp
directory with any filename that ends in ".cf".
|