spamassassin:stopping_spam
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spamassassin:stopping_spam [2016/11/02 00:12] – peter | spamassassin:stopping_spam [2019/12/04 21:15] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== SpamAssassin - Stopping Spam ====== | ||
- | ===== Install Mail::Audit ===== | ||
- | |||
- | SpamAssassin needs the **Mail:: | ||
- | |||
- | <code bash> | ||
- | perl -MCPAN -e shell | ||
- | cpan> install Mail::Audit | ||
- | cpan> quit | ||
- | </ | ||
- | |||
- | |||
- | ===== Install Spam Assassin Modules ===== | ||
- | |||
- | Install SpamAssassin from CPAN, which will also install all other required modules too. | ||
- | |||
- | <code bash> | ||
- | perl -MCPAN -e shell | ||
- | cpan> install Mail:: | ||
- | </ | ||
- | |||
- | It maybe will ask you for some needed modules that aren't installed yet - Answer yes and Perl will fetch and install them, too. | ||
- | |||
- | <code perl> | ||
- | cpan> quit | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ===== Run the recommended tests ===== | ||
- | |||
- | First look if the install succeded by running: | ||
- | |||
- | <code bash> | ||
- | which spamassassin | ||
- | / | ||
- | </ | ||
- | |||
- | If you don't get a right answer something failed... or your PATH-variable isn't set right... | ||
- | |||
- | Now lets scan a no spam mail with | ||
- | |||
- | <code bash> | ||
- | spamassassin -t < | ||
- | </ | ||
- | |||
- | Look for a line like this in the output: | ||
- | |||
- | < | ||
- | X-Spam-Status: | ||
- | </ | ||
- | |||
- | Okay fine - now try a bad spam message: | ||
- | |||
- | <code bash> | ||
- | spamassassin -t < | ||
- | </ | ||
- | |||
- | which should produce some lines like that: | ||
- | |||
- | < | ||
- | X-Spam-Status: | ||
- | X-Spam-Flag: | ||
- | </ | ||
- | |||
- | Okay everything seems working... that was the easy part :-) | ||
- | |||
- | |||
- | |||
- | ===== The wrapper script ===== | ||
- | |||
- | For use with Exim here is a small Perl script which implements the Mail::Audit and the Mail: | ||
- | |||
- | <code perl> | ||
- | # | ||
- | # This is an small wrapper script around Mail:: | ||
- | # with the exim MTA. | ||
- | # Modified to eliminate the buggy Mail::Audit use. | ||
- | # This modification also eliminates the need to re-submit the message | ||
- | # to Exim for delivery to the mail spool. Requires localuser director | ||
- | # to use the spamcheck transport so it knows where to append to. | ||
- | # It is released under the Terms of GNU General Public License (GPL) so | ||
- | # use at your own risk! | ||
- | |||
- | use Mail:: | ||
- | use Mail:: | ||
- | |||
- | $savespam = 1; #1/0 should spam be saved centrally? | ||
- | $spamfile = '/ | ||
- | #that nasty spam? Be sure this mailbox | ||
- | #is writable by the user who runs this | ||
- | #script (e.g. mail) | ||
- | #These are given as command line arguments by exim: | ||
- | $sender = shift(@ARGV); | ||
- | $sender = '<>' | ||
- | $recpt = ''; | ||
- | while (@ARGV){ | ||
- | $recpt = $recpt.' | ||
- | } | ||
- | |||
- | ####### Main script ########################################################### | ||
- | |||
- | $mail = Mail:: | ||
- | |||
- | $spamtest = Mail:: | ||
- | $status = $spamtest-> | ||
- | |||
- | #Add the X-Spam Headers: | ||
- | $status-> | ||
- | #Auto Report to Vipul' | ||
- | $status-> | ||
- | |||
- | if ($status-> | ||
- | if ($savespam) { | ||
- | $mail-> | ||
- | } else { | ||
- | $mail-> | ||
- | } | ||
- | } else { | ||
- | $mail-> | ||
- | } | ||
- | </ | ||
- | |||
- | **NOTE**: | ||
- | |||
- | <code bash> | ||
- | touch / | ||
- | chmod 660 / | ||
- | chown mail:mail / | ||
- | </ | ||
- | |||
- | ===== References ===== | ||
- | |||
- | http:// | ||
- | |||
- | http:// |
spamassassin/stopping_spam.1478045571.txt.gz · Last modified: 2020/07/15 09:30 (external edit)