You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by Apache Wiki <wi...@apache.org> on 2008/03/13 09:31:46 UTC

[Spamassassin Wiki] Update of "SiteWideBayesSetup" by MattKettler

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Spamassassin Wiki" for change notification.

The following page has been changed by MattKettler:
http://wiki.apache.org/spamassassin/SiteWideBayesSetup

The comment on the change is:
Fixing the *MANY* broken suggestions in this article -Matt Kettler

------------------------------------------------------------------------------
  In local.cf, tell SpamAssassin where to find the Bayesian database files:
  
  {{{
- bayes_path /etc/mail/spamassassin/bayes
+ bayes_path /var/spamassassin/bayes/bayes
+ bayes_file_mode 0777
  }}}
  
- This tells the system that the Bayesian filter database files will be /etc/mail/spamassassin/bayes_msgcount, _seen and _toks.  Feel free to move it wherever you want.
+ This tells the system that the Bayesian filter database files will be /var/spamassassin/bayes/bayes_msgcount, _seen and _toks. Feel free to move it wherever you want. Please note this directory needs to be RWX to all users that SpamAssassin will be executed as, and many use world RWX to simplify this. The directory also shouldn't contain any files other than your bayes database. If it contains any files that start with "bayes_" it can break the locking mechanisms SpamAssassin uses.
  
- Now start feeding the Bayesian filter spam and ham messages.  Tell sa-learn to use /etc/mail/spamassassin as the configuration directory (i.e. where to find the bayes_msgcount, _seen and _toks files): 
+ Now start feeding the Bayesian filter spam and ham messages.  
  
  {{{
- sa-learn --spam -C /etc/mail/spamassassin --showdots --dir /path/to/directory/full/of/spam/msgs
+ sa-learn --spam --showdots --dir /path/to/directory/full/of/spam/msgs
- sa-learn --ham -C /etc/mail/spamassassin --showdots --dir /path/to/directory/full/of/ham/msgs
+ sa-learn --ham --showdots --dir /path/to/directory/full/of/ham/msgs
  }}}
  
- See SiteWideBayesFeedback for more tips on getting an entire site to feed back spam and ham messages into the Bayesian filter.  Just use -C to make sure that the correct database files are used.
+ See SiteWideBayesFeedback for more tips on getting an entire site to feed back spam and ham messages into the Bayesian filter. 
  
- Also restart spamd if you're running it already so that it will re-read local.cf and enable the Bayes filter:
+ Also restart spamd if you're running it so that it will re-read local.cf and enable the Bayes filter:
  
  {{{
- ps axo %p%a | awk '/spamd/ { print $1 }'
- spamd -x -q -d -L -u nobody
+ /etc/init.d/spamassassin restart
+ -or-
+ service spamassassin restart
  }}}
  
- (your spamd options may be different than mine)
+ Your method of restarting spamd options may differ, but the above is typical. If you're using any MTA integrations that invoke SpamAssassin as a perl API (ie: MailScanner or mimedefang) that process will need to be restarted or told to reload its configuration as it is effectively it's own spamd.
  
- You may experience difficulties with permissions. Make sure you chmod your bayes files to readable/writable by your user group.
+ You may experience difficulties with file permissions. Make sure you chmod any existing bayes files to readable/writable by your user groups (or world if you're doing so). 
  
- If you are running spamd in setuid mode (setuid's to the user who ran spamc), you will probably need to set bayes_file_mode in local.cf. Otherwise, the bayes file permissions will default to 0700 when the first caller causes updates, and subsequent callers will lack the permissions to open these file.
+ If you are going to use group rights instead of a world RWX, there are some additional issues you will need consider. If you use spamd and mail gets scanned on behalf of "root" spamd will use "nobody" as its effective user for bayes database access. You should consider this user when planing your group memberships. Also, be aware that the files are deleted and recreated by whatever user happens to be running spamassassin when an expiration is due. If you are not using world RWX this means you need to beware the files will loose their group ownership you may have set unless you make the directory setgid.
  
- In local.cf (your setttings may vary):
- {{{
- bayes_file_mode 0770
- }}}
  
  See Mail::SpamAssassin::Conf(3) for details.
  ----