| |
| Important Note For Users Upgrading From Earlier Versions |
| -------------------------------------------------------- |
| |
| SpamAssassin no longer includes code to handle local mail delivery, as it |
| was not reliable enough, compared to procmail. So now, if you relied on |
| spamassassin to write the mail into your mail folder, you'll have to |
| change your setup to use procmail as detailed below. |
| |
| If you used spamassassin to filter your mail and then something else wrote |
| it into a folder for you, then you should be fine. |
| |
| |
| Installing SpamAssassin |
| ----------------------- |
| |
| The easiest way to do this is using CPAN.pm, like so: |
| |
| perl -MCPAN -e shell [as root] |
| o conf prerequisites_policy ask |
| install Mail::SpamAssassin |
| quit |
| |
| On Debian, you can apt-get it from unstable, thanks to Duncan Findlay. |
| |
| Alternatively download the tarfile, zipfile or Red Hat RPM from |
| http://spamassassin.org/ , and install that, like so: |
| |
| [unzip/untar the archive] |
| cd Mail-SpamAssassin-* |
| perl Makefile.PL |
| make |
| make install [as root] |
| |
| To install as non-root, do something like this: |
| |
| [unzip/untar the archive] |
| cd Mail-SpamAssassin-* |
| perl Makefile.PL PREFIX=~/sausr SYSCONFDIR=~/saetc |
| make |
| make install |
| |
| This will install the SpamAssassin modules and rules into the ~/sausr |
| and ~/saetc directories off your home directory. |
| |
| (note: if you intend to package SpamAssassin as an RPM, deb, or other |
| package, please read the comments at the top of 'Makefile.PL'.) |
| |
| |
| SunOS Note |
| ---------- |
| |
| Under SunOS, snprintf is not defined. A library containing a SunOS |
| version of snprintf is included in contrib/snp.tar.gz, which is usable for |
| building SpamAssassin. Mike Nolan <nolan AT naic dot edu> has built this, |
| and here's his directions: |
| |
| I built SpamAssassin under SunOS 4.1.3. (...) |
| |
| % cd contrib |
| % gtar xzf snp.tar.gz |
| % cd snp |
| % gmake libsnp.a |
| |
| OK, now go to the spamassassin directory, and compile: |
| |
| % cd .. |
| % gcc -g -O2 spamd/spamc.c spamd/libspamc.c spamd/utils.c \ |
| -o spamd/spamc -ldl -lnsl contrib/snp/libsnp.a -lm |
| % gmake |
| |
| Now you have spamc and spamd. |
| |
| |
| Installing SpamAssassin for Personal Use (Not System-Wide) |
| ---------------------------------------------------------- |
| |
| These steps assume the following, so substitute as necessary: |
| - Your UNIX login is "user" |
| - Your home directory is /home/user |
| - The location of the procmail executable is /usr/bin/procmail |
| |
| 1. Uncompress and extract the SpamAssassin archive, using "unzip" or "tar |
| xvfz", in a temporary directory. |
| |
| 2. change directory into it: |
| |
| cd Mail-SpamAssassin-* |
| |
| 3. Make SpamAssassin as normal, but using your home directory as the |
| target: |
| |
| perl Makefile.PL PREFIX=~/sausr SYSCONFDIR=~/saetc |
| make |
| make install |
| |
| 4. If you already use procmail, skip to step 6. If not, ensure procmail |
| is installed using "which procmail" or install it from www.procmail.org. |
| |
| 5. Create a .forward file in your home directory containing the below |
| lines: |
| |
| "|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #user" |
| |
| 6. Edit or create a .procmailrc file in your home directory containing the |
| below lines. If you already have a .procmailrc file, add the lines to the |
| top of your .procmailrc file: |
| |
| :0fw |
| | /home/user/sausr/bin/spamassassin |
| |
| The above line filters all incoming mail through SpamAssassin and tags |
| probable spam with a unique header. If you would prefer to have spam |
| blocked and saved to a file called "caughtspam" in your home directory, |
| instead of passed through and tagged, append this directly below the above |
| lines: |
| |
| :0: |
| * ^X-Spam-Status: Yes |
| caughtspam |
| |
| 7. Now, you should be ready to send some test emails and ensure everything |
| works as expected. First, send yourself a test email that doesn't contain |
| anything suspicious. You should receive it normally, but there will be a |
| header containing "X-Spam-Status: No". If you are only tagging your spam, |
| send yourself an obvious spam mail and check to be sure it is marked as |
| spam. If your test emails don't get through to you, immediately rename |
| your .forward file until you figure out cause of the the problem, so you |
| don't lose incoming email. |
| |
| |
| Required Modules |
| ---------------- |
| |
| These modules are required for spamassassin to run. |
| |
| - File::Spec >= 0.8 (from CPAN, or included in Perl 5.6 and higher) |
| |
| The File::Spec module is required in version 0.8 (Mar 2000) or later. |
| This is included in Perl versions 5.6 and later. |
| |
| - Pod::Usage (from CPAN, or included in Perl 5.6 and higher) |
| |
| The Pod::Usage module is required. This is included in Perl versions |
| 5.6 and later. |
| |
| - HTML::Parser >= 3.0 (from CPAN) |
| |
| HTML is used for an ever-increasing amount of email so this dependency |
| is unavoidable. Run "perldoc -q html" for additional information. |
| |
| If you use Debian, you can get HTML::Parser from the libhtml-parser-perl |
| package. |
| |
| Optional Additional Modules |
| --------------------------- |
| |
| In addition, the following modules will be used for some checks, if |
| available. If they are not available, SpamAssassin will still work, just |
| not as effectively -- some of the spam-detection tests will have to be |
| skipped. |
| |
| |
| - Net::DNS (from CPAN) |
| |
| Used to check the RBL, RSS, DUL etc. and perform MX checks. |
| Recommended. |
| |
| perl -MCPAN -e shell |
| o conf prerequisites_policy ask |
| install Net::DNS |
| quit |
| |
| |
| - Razor http://razor.sourceforge.net/ |
| |
| Used to check message signatures against Vipul's Razor collaborative |
| filtering network. Razor is not available from CPAN -- you have to |
| download it from the URL above. |
| |
| Razor has a large number of dependencies on CPAN modules. Feel free |
| to skip installing it, if this makes you nervous; SpamAssassin will |
| still work well without it. |
| |
| |
| - DCC http://www.rhyolite.com/anti-spam/dcc/ |
| |
| DCC (Distributed Checksum Clearinghouse) is a system similar to Razor. |
| It supports fuzzy checksums and therefore detects some more spams than |
| Razor does at the moment. |
| |
| To install it, download |
| http://www.rhyolite.com/anti-spam/dcc/source/dcc-dccproc.tar.Z and |
| perform the following steps: |
| |
| # tar xfvz dcc-dccproc.tar.Z |
| # cd dcc-dccproc-X.X.X |
| # ./configure && make && make install |
| # cdcc 'info' |
| |
| The last command will give some output. One line of it should contain |
| something like: |
| |
| dcc.rhyolite.com,- RTT+0 ms anon |
| |
| |
| - Pyzor http://pyzor.sourceforge.net/ |
| |
| Used to check message signatures against the Pyzor collaborative |
| filtering network. Pyzor was initially "a Python implementation of |
| Razor", but now also uses its own (free) server architecture and is |
| "based upon a new, lighter, more language-independent protocol." |
| |
| Pyzor requires at least Python 2.2.1 which can be found at |
| http://www.python.org/ . |
| |
| To install Pyzor, download the latest revision from |
| https://sourceforge.net/project/showfiles.php?group_id=50000 and |
| perform the following steps: |
| |
| # bunzip2 pyzor-*.tar.bz2 |
| # cd pyzor-* |
| # python setup.py build |
| # python setup.py install |
| |
| Note that your system might install the modules and scripts with |
| non-world-readable permissions. Correct this with a command such as: |
| |
| # chmod -R a+rX /usr/share/doc/pyzor \ |
| /usr/lib/python2.2/site-packages/pyzor \ |
| /usr/bin/pyzor /usr/bin/pyzord |
| |
| Read the INSTALL document if you want to setup your own Pyzor server and |
| signature store. Otherwise, you can just use the public servers. |
| |
| |
| - Mail::Audit, Mail::Internet, Net::SMTP (from CPAN) |
| |
| If you want to use SpamAssassin with Mail::Audit, you will (obviously) |
| require the Mail::Audit module, and any modules it requires (there's |
| lots of them, unfortunately). |
| |
| Additionally, Mail::Internet is required if you wish to use the |
| "-r/-w" options of the spamassassin program (reporting and replying, |
| for spam-trap mail accounts). |
| |
| If you use procmail, KMail, 'spamassassin', or you plan to use |
| 'spamd', you will *not* need these. |
| |
| Here's how to install them using CPAN.pm: |
| |
| perl -MCPAN -e shell |
| o conf prerequisites_policy ask |
| install Mail::Audit |
| quit |
| |
| - Digest::SHA1 (from CPAN) |
| |
| The Digest::SHA1 module will speed up some cryptographic hash tests, |
| but is not required (although it may be required by another module). |
| |
| If you use Debian, you can get Digest::SHA1 from the libdigest-sha1-perl |
| package. |
| |
| Using SpamAssassin |
| ------------------ |
| |
| Steps to take for every installation: |
| |
| - Install Mail::SpamAssassin on your mail server, as above. |
| |
| - Test it: |
| |
| spamassassin -t < sample-nonspam.txt > nonspam.out |
| spamassassin -t < sample-spam.txt > spam.out |
| |
| Verify (using a text viewer, ie. "less" or "notepad") that nonspam.out |
| has not been tagged as spam, and that spam.out has. The files should |
| contain the full text and headers of the messages, the "spam.out" |
| message should be annotated with "****SPAM****" in the subject line |
| and a report from SpamAssassin, and there should be no errors when you |
| run the commands. |
| |
| Even though sample-nonspam.txt is not spam, nonspam.out will contain a |
| SpamAssassin report anyway. This is a side-effect of the "-t" (test) |
| switch. However, there should be less than 5 hits accumulated; when |
| the "-t" switch is not in use, the report text would not be added. |
| |
| If the commands do not work, DO NOT PROCEED TO THE NEXT STEP, as you |
| will lose mail! |
| |
| |
| |
| If you use Mail::Audit already: |
| |
| - run "perldoc Mail::SpamAssassin" and take a look at the synopsis, it |
| outlines what you need to add to your audit script. |
| |
| - Copy the configuration files (see CUSTOMISING, below) to a known |
| location, so your script can set the appropriate options for the |
| Mail::SpamAssassin constructor to load them. |
| |
| |
| |
| If you use KMail: |
| |
| - http://kmail.kde.org/tools.html mentions: |
| |
| The filter setup is the work of five minutes (if that!) if you have a |
| working spamassassin set up. |
| |
| The filter in question is "<any header><matches regexp> ." |
| |
| The action is "<pipe through> spamassassin" |
| |
| Then, in the advanced options, uncheck the "If this filter matches, |
| stop processing here" box. If you keep this filter at the top, it will |
| analyze any incoming mail, decide whether it's spam or not, and flag |
| it accordingly. |
| |
| [Then add] a second filter behind it, which searches for the added |
| spam-flags and diverts them into a specific spam folder. [...] |
| |
| |
| |
| If you use procmail, or haven't decided on any of the above examples: |
| |
| - Make a backup of your .procmailrc (if you already have one). |
| |
| cp ~/.procmailrc ~/.procmailrc.bak |
| |
| - add the line from procmailrc.example to ~/.procmailrc, at the top of |
| the file before any existing recipes. |
| |
| That'll process all mail through SA, and refile spam messages to |
| a folder called "caughtspam" in your home directory. |
| |
| - Send yourself a mail message, and ensure it gets to you. If it does |
| not, copy your old backed-up .procmailrc file back into place and ask |
| your sysadmin for help! Here's commands to do that: |
| |
| cp ~/.procmailrc.bak ~/.procmailrc |
| echo "Help!" | mail root |
| |
| |
| |
| If you want to use SpamAssassin site-wide: |
| |
| - take a look at the notes on the website, at |
| http://spamassassin.org/sitewide.html . You will probably want to use |
| 'spamd' (see below). |
| |
| - Note that procmail users adding spamc to /etc/procmailrc should |
| add the line 'DROPPRIVS=yes' at the top of the file. |
| |
| |
| |
| Other Installation Notes |
| ------------------------ |
| |
| |
| - SpamAssassin now uses a temporary file in /tmp (or $TMPDIR, if that's |
| set in the environment) for Pyzor and DCC checks. Make sure that this |
| directory is either (a) not writable by other users, or (b) not shared |
| over NFS, for security. |
| |
| |
| - You can create your own system-wide rules files in |
| /etc/mail/spamassassin; their filenames should end in ".cf". Multiple |
| files will be read, and SpamAssassin will not overwrite these files |
| when installing a new version. |
| |
| |
| - The auto-whitelist is enabled using the -a flag to spamassassin or |
| spamd. |
| |
| |
| - spamc can now be built as a shared library for use with milters or |
| to link into other existing programs; simply run "make libspamc.so" |
| to build this. |
| |
| |
| - If you get spammed, it is helpful to everyone else if you re-run |
| spamassassin with the "-r" option to report the message in question as |
| "verified spam". This will add it to Vipul's Razor |
| (http://razor.sourceforge.net/), a collaborative spam filtering |
| network, if you've installed the Razor modules. |
| |
| spamassassin -r < spam-message |
| |
| If you use mutt as your mail reader, this macro will bind the X key to |
| report a spam message. |
| |
| macro index X "| spamassassin -r" |
| |
| This is, of course, optional -- but you'll get lots of good-netizen |
| karma. ;) |
| |
| |
| - Quite often, if you've been on the internet for a while, you'll have |
| accumulated a few old email accounts that nowadays get nothing but |
| spam. You can set these up as spam traps using SpamAssassin; see the |
| ''SPAM TRAPPING'' section of the spamassassin manual page for details. |
| |
| If you don't want to go to the bother of setting up a system yourself |
| to do this, feel free to set up a simple alias to forward any mails to |
| <someaddress@spamtraps.taint.org> -- replace "someaddress" with |
| something to identify you, such as your email addr or website with |
| non-alphanumeric chars replaced by underscores, or similar. This |
| will feed it into my spam-trapping system running on taint.org, where |
| it will be fed into Razor. |
| |
| |
| - The distribution now includes 'spamd', a daemonized version of the |
| perl script, and 'spamc', a low-overhead C client for this, |
| contributed by Craig R. Hughes. This greatly reduces the overhead of |
| checking large volumes of mail with SpamAssassin. Take a look in the |
| 'spamd' directory for more details. |
| |
| |
| - Scores and other user preferences can now be loaded from an SQL |
| database; see the 'sql' subdirectory for more details. |
| |
| |
| - Edward Fang <edfang /at/ visi.net> has contributed the |
| 'communigate.sh' script for CommunigatePro (see the 'contrib' |
| directory). |
| |
| |
| - James Henstridge <james /at/ daa.com.au> has contributed an LMTP proxy |
| server (designed for Cyrus, but probably will work fine with others), |
| again it's in the contrib directory. |
| |
| |
| |
| (end of INSTALL) |
| |
| // vim:tw=74: |