Installation instructions for SpamAssassin 3.1.3 Laird Bedore 7/19/06 ## Required Reading: ## http://svn.apache.org/repos/asf/spamassassin/branches/3.1/README ## http://svn.apache.org/repos/asf/spamassassin/branches/3.1/INSTALL ## This document depends on the qmail+spamcontrol 2.4 installation ## instructions written by Laird Bedore being completed beforehand. ## It assumes that your mail server is already running and tested. ## Get the prerequisite perl modules from CPAN. ## You'll need lynx at the minimum in order to use the "cpan" command ## to grab the modules. If you don't use "cpan", you're crazy. % swaret --install lynx % cpan ## Answer the myriad questions. Defaults are fine for just about everything. ## Now, in cpan: cpan> install Digest::SHA1 cpan> install Digest::HMAC cpan> install MIME::Base64 cpan> install HTML::Tagset cpan> install HTML::Parser cpan> install Net::IP cpan> install Net::DNS cpan> install Time::HiRes cpan> install URI::Escape cpan> install Net::CIDR::Lite cpan> install Sys::Hostname::Long cpan> install Mail::SPF::Query cpan> quit ## Unpack the tarball % cd /usr/src % tar zxf /vsn/pub/qmail/spamassassin/Mail-SpamAssassin-3.1.3.tar.gz % cd Mail-SpamAssassin-3.1.3 % perl Makefile.PL ## You will be asked some questions. Answer them! ## URL for more info: http://www.vectorstar.net/spamassassin.php % make % make install % cd spamc ## We don't actually need this, but lets build it in case we use it in the ## future. % make qmail-spamc % cp qmail-spamc /var/qmail/bin ## in /etc/mail/spamassassin, edit the config files and tune to your liking. ## Be careful to get these things right, after all. ## In v310.pre, make sure the AutoLearnThreshold is enabled and AWL (auto # whitelisting) is disabled. ## Settings in local.cf: rewrite_header Subject (SPAM Score: _SCORE(0)_) report_safe 0 lock_method nfssafe required_score 8.0 # Bayesian Filter settings use_bayes 1 bayes_auto_learn 1 bayes_auto_learn_threshold_nonspam 1.0 bayes_auto_learn_threshold_spam 12.0 bayes_min_ham_num 25 bayes_min_spam_num 50 # max tokens in db: default 150,000 - approx 8mb bayes_expiry_max_db_size 75000 bayes_auto_expire 1 bayes_ignore_header X-Bogosity bayes_ignore_header X-Spam-Flag bayes_ignore_header X-Spam-Status # Other settings report_hostname mail.vectorstar.net ## Configure spamd for daemonized operation. universal unpriv mode or ## as-each-user mode? Need to test more! ## Qmailrocks.org has an example script for launching spamd: ## http://www.qmailrocks.org/clamspam_slackware.htm % cp /vsn/pub/qmail/spamassassin/rc.spamd /etc/rc.d/ % chmod 755 /etc/rc.d/rc.spamd % echo "/etc/rc.d/rc.spamd start" >> /etc/rc.d/rc.local % /etc/rc.d/rc.spamd start ## Create special configuration for system-wide bayesian filter: % cd ~qmaild % mkdir .spamassassin % pico .spamassassin/user_prefs # Local spamassassin configuration file for qmaild (used on systemwide scans) use_bayes 1 bayes_min_ham_num 100 bayes_min_spam_num 200 # 1 million tokens - about a 50mb db bayes_expiry_max_db_size 1000000 bayes_auto_expire 1 % chown -R qmaild .spamassassin % chmod 700 .spamassassin % chmod 600 .spamassassin/user_prefs % chgrp nofiles .spamassassin/user_prefs ## SpamAssassin will automatically create and maintain the files ## "bayes_seen" and "bayes_toks" within ~qmaild/.spamassassin/ ## Edit your qmail-qfilter script and run "/usr/bin/spamc".. % pico /var/qmail/bin/prequeue-filter ## It should have an execution line like this: exec /usr/local/bin/qmail-qfilter /usr/bin/spamc ## That's it! Everything is set up and running. This provides a system-wide ## spamassassin filter with a reasonable 8.0 score requirement for spam. ## All email, regardless of score, is delivered. System-wide Bayesian ## filtering will be done once enough emails (100 good, 200 bad) have ## been received and learned by the bayesian filter. ## ## How to configure per-user bayesian filtering: ## To turn on per-user filtering, create the following .qmail file ## in the user's home directory with the correct ownership/permissions: |/usr/bin/spamc -e /vsn/bin/mailfilter ## SpamAssassin will automatically create and maintain the bayesian DB. ## To populate the DB based on the user's emails, run the following ## commands as the user: % sa-learn --ham --mbox ~/.mail/INBOX % sa-learn --spam --mbox ~/.mail/spam ##Check the following: ## send some test emails. ## Make sure the emails have arrived. If not, you probably need to ## revert the qfilter changes and read the qmail logs in /var/log/qmail ## and /var/log/qmail/smtpd . ## check that ~qmaild/.spamassassin/bayes_seen and bayes_toks have been ## created. ## Read the messages. Look at their headers and make sure that the ## X-Spam-whatever headers have been added by SpamAssassin.