Like many others, I’ve been receiving an ever greater amount of Spam in my E-Mail box. I decided to take action and deploy SpamAssassin on my Sun Messaging Server (6.3) in order to reduce amount of Spam E-Mail I receive.
First of all, I deployed SpamAssassin. Being as I’m on Solaris 10 x86, and use Blastwave for package management; I installed SpamAssassin thusly:
pkg-get -i spamassassin
It will install all the pre-requisite packages; as well as the SpamAssassin package. With SpamAssassin, there is a tad bit of post-installation configuration (to set it up to run as a service) located at /opt/csw/doc/spamassassin/README.CSW.
When SpamAssassin’s spamd process is successfully up and running the Sun Messaging Server configuration needs to be modified in order to call out to SpamAssassin. This is done first by creating a configuration file, generally in the config directory. I named mine spamassassin.cf with the following contents:
host=127.0.0.1
port=783
debug=1
mode=1
field=
host denotes where the spamd daemon lives; in my case on the local host.
port denotes what port the spamd daemon is listening to; in my case 783 (default).
debug denotes whether the Sun Messaging Server maintains debug information about its talking to SpamAssassin; 0 for off, 1 for on
mode denotes when a score will be handled. mode=0 specifies that no result string is returned. mode=1 specifies that the SpamAssassin result string is returned if the message is found to be spam. mode=2 for all messages
field specifies a string prefix for the SpamAssassin result string.
The config I have above works well for filtering messages based on score into a separate folder. A later post will make some changes in order to reduce messages that exceed a higher score.
Another change needs to happen to the option.dat file (located in config). Add the following lines to this file.
!
! SpamAssassin
spamfilter1_config_file=/opt/msg/msg-test/config/spamassassin.cf
spamfilter1_library=/opt/msg/msg-test/lib/libspamass.so
spamfilter1_optional=0
spamfilter1_string_action=data:,require “fileinto”; fileinto “Spam”;
The spamfilter1_config_file is the location of the config file above.
The spamfilter1_library is the full path to the .so file for libspamass.so that comes with Sun Messaging Server.
The spamfilter1_optional denotes whether SpamAssassin is bottlenecking inbound mail (0) or it will proceed and deliver as normal if SpamAssassin has an error (or is not up) (1).
The spamfilter1_string_action specifies what happens when a message is found to be Spam. In our case, it will file it into a folder named Spam.
The final step is to update the imta.cnf file to specify that messages should go to the Spam Filter. Update the ims-ms line to add the destinationspamfilter1optin spam option to the line.
After deploying SpamAssassin, mine looks like:
ims-ms defragment subdirs 20 notices 1 7 14 21 28 backoff “pt5m” “pt10m” “pt30m” “pt1h” “pt2h” “pt4h” maxjobs 2 pool IMS_POOL fileinto $U+$S@$D destinationspamfilter1optin spam
With a final ./imsimta cnbuild; ./imsimta chbuild; and an ./imsimta restart; Spam filtering should be in place.
Reference information from Sun about deploying SpamAssassin.