4-B: SPAMASSASSIN

#If this is not your first install, it is always a good idea to copy tokens to /home/spamassassin/.spamassassin

apt-get install spamassassin
groupadd spamd
useradd -g spamd -d /home/spamassassin -s /sbin/nologin -p'*' spamd
mkdir /home/spamassassin
chown -R spamd:spamd /home/spamassassin/

nano /etc/default/spamassassin

#Verify that ENABLED=0    CRON=0ARN

#NOW SAVE AND CLOSE

nano /etc/spamassassin/local.cf

#Delete everything inside and paste:

# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################

#   Add *****SPAM***** to the Subject header of spam e-mails
#
#rewrite_header Subject *****SPAM*****

#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#
# report_safe 1

#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
# trusted_networks 212.17.35.

#   Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock

#   Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 4.2

#   Use Bayesian classifier (default: 1)
#
use_bayes 1

#   Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1

#   Set headers which may provide inappropriate cues to the Bayesian
#   classifier

bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status

#   Some shortcircuiting, if the plugin is enabled
#
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
#
#   default: strongly-whitelisted mails are *really* whitelisted now, if the
#   shortcircuiting plugin is active, causing early exit to save CPU load.
#   Uncomment to turn this on
#
shortcircuit USER_IN_WHITELIST       on
shortcircuit USER_IN_DEF_WHITELIST   on
shortcircuit USER_IN_ALL_SPAM_TO     on
shortcircuit SUBJECT_IN_WHITELIST    on

#   the opposite; blacklisted mails can also save CPU
#
shortcircuit USER_IN_BLACKLIST       on
shortcircuit USER_IN_BLACKLIST_TO    on
shortcircuit SUBJECT_IN_BLACKLIST    on

#   if you have taken the time to correctly specify your "trusted_networks",
#   this is another good way to save CPU
#
shortcircuit ALL_TRUSTED             on

#   and a well-trained bayes DB can save running rules, too
#
shortcircuit BAYES_99                spam
shortcircuit BAYES_00                ham

endif # Mail::SpamAssassin::Plugin::Shortcircuit

bayes_auto_expire 0
bayes_ignore_header X-Qmail-Scanner
bayes_ignore_header X-Spam-Level
bayes_ignore_header X-Spam-Status
razor_config /etc/razor/razor-agent.conf

#dcc_home /var/dcc
#dcc_path /usr/local/bin/dccproc
#dcc_dccifd_path /var/dcc/libexec/dccifd
 

## END OF PASTE

mkdir -p -m 1755 /etc/service/spamd
mkdir -p -m 755 /etc/service/spamd/log

cd /etc/service/spamd
nano run

=============================================================

#!/bin/sh
LANG=C; export LANG
exec spamd -r /var/run/spamd.pid --syslog=stderr --nocreate-prefs --nouser-config --max-children=15 --min-children=3 --max-spare=5 --username=spamd 2>&1
=============================================================

## You can refer to http://spamassassin.apache.org/full/3.2.x/doc/spamd.html for options to customize.

# Some recommend --max-children 3 or 2 (depending on your reqs), and --max-conn-per-child=300 (default is 200)

chmod 755 run
cd log
nano run

=============================================================
#!/bin/sh
exec /usr/bin/multilog t s100000000 n5 /var/log/spamd
=============================================================

chmod 755 run
ln -s /etc/service/spamd /etc/service/