User Tools

Site Tools


hwmig2007smapassassin

TuxSoftware

(The following subject to correction)

SpamAssassin

Overview

  • Can run in various modes
  • For us, runs as a filter that MTA postfix uses
  • Permanently running spamd (daemon), transiently running spamc (clients)
  • SpamAssassin scores the email - something else can decide what to do with it
    • SpamAssassin adds a header with the score to the email itself
  • Mailman uses the Spamassassin score
    • score > 10 → mailman discards automatically
    • score < 5 → mailman accepts
    • 5 > score > 10 → mailman submits to moderator for human decision

SpamAssassin docs

SpamAssassin - MTA - mailing list integration

  • We use postfix as our MTA
  • We use mailman as our mailing list manager

SpamAssassin - config

update:

SpamAssassin Quick & Dirty Config

I found this and tried it out on our site: http://www.xnote.com/howto/postfix-spamassassin.html. It seems to have everything necessary and appears to be working. It's been edited to match what we have set up locally.

  • Install postfix and get it working for your domain. See http://www.postfix.org for details.
  • Install SpamAssassin. The easiest way to do this is with the command “perl -MCPAN -e 'install Mail::!SpamAssassin'” OR you can compile it. Another way is to use an RPM (!RedHat or Fedora) or “apt-get install postfix spamassassin spamc” (if you have debian)
  • As root, create a file at /usr/local/bin/spamfilter.sh with the following content:
    #!/bin/bash
    /usr/local/bin/spamc | /usr/sbin/sendmail -i "$@"
    exit $?
  • Run:
    chmod 755 /usr/local/bin/spamfilter.sh
 and make sure you have it executable:
    ls -als /usr/local/bin/spamfilter.sh
  • Create a user called 'spamfilter'. Make it a complete user, with home directory and shell. (set the shell to false)
    example: useradd -m -d /home/spamfilter -s /bin/false spamfilter
  • Run
chown spamfilter:users /usr/local/bin/spamfilter.sh
  • In /etc/postfix/master.cf in the “Services” section, alter the 'smtp' line as follows (the “ -o con…” SHOULD be on the next line:
 //NOTE there are two lines that have smtp. Make sure it is the inet line (Usually the first occurrence)//
    # -----------------------------------------------------------------------------------
    smtp inet n - n - - smtpd
        -o content_filter=spamfilter:dummy
    # -----------------------------------------------------------------------------------
  • In /etc/postfix/master.cf in the “Interfaces to non-Postfix software” section add:
    # -----------------------------------------------------------------------------------
    spamfilter unix - n n - - pipe
        flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f ${sender} -- ${recipient}
    # -----------------------------------------------------------------------------------
  • Make sure that SpamAssassin is configured to run:
    • Edit /etc/default/spamassassin and change the enabled line to 1 from 0
    • Issue the command “/etc/init.d/spamassassin start” to get it started
    • Check /var/log/mail.log to see that the spamd process started
    • Make sure the symlinks are in the appropriate runlevel directories
  • Restart postfix and make sure you can still get email. Send a fake spam through the system (from an outside address) to verify that spam is marked as spam. For information on configuring SpamAssassin, go to http://www.spamassassin.org.
hwmig2007smapassassin.txt · Last modified: 2015/06/09 15:23 by 127.0.0.1