JaguarPC managed web hosting logo
JaguarPC HomeWeb Hosting ForumHosting client login
Hosting Sales - 1.800.558.5869
Order Web Hosting Now
Welcome Panel

You are not logged in. Please login below.

Statistics

Threads: 20,250, Posts: 149,925, Members: 41,383

Welcome to our newest member, finanxo

Specials

View our Web Hosting Specials



Get your own merchant account!



JaguarPC Community - Web Hosting, VPS Hosting, cPanel VPS Hosting, Hybrid Servers, Dedicated Servers, Virutal Private Servers, Managed Servers » Hosting Community Support » VPS & Dedicated : Everything about SpamAssassin and spam!

VPS & Dedicated Virtual Private Server / Dedicated Server Share tips and ask questions about your server or colocation service among other clients. Can't beat free support!

Reply
 
Thread Tools Display Modes
Old 04-17-2007, 01:28 AM   #1
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
Everything about SpamAssassin and spam!

Contrary to popular belief, spam is easy to combat. All it takes is a well configured SpamAssassin running on the server. Unfortunately the definition of "well configured" is very loosely defined in this context as its completely different for every domain/server.

One such example is the average person who blocks emails that contain the word "viagra", but an actual medical doctor may use that word rather regularly.

So here is how to make SpamAssassin block 99% of spam:


STEP 1 - Raise score for Realtime Blackhole lists (RBL)

The default scores for RBLs are set too low. For example, if an email is marked as spam by SORBS then there is no reason giving it a score of 2. Based on my tests over a two year period RBLs are very safe to use. There are some issues with SpamCop but those always resolve after a few days.

Edit your "/etc/mail/spamassassin/local.cf" and add:

Code:
# Raise RBL scores
score RCVD_IN_BL_SPAMCOP_NET 10
score RCVD_IN_SBL 5
score RCVD_BY_IP 2
score DNS_FROM_AHBL_RHSBL 3
score URIBL_WS_SURBL 3
score RCVD_IN_SORBS_WEB 3
score RCVD_IN_SORBS_SMTP 3
score URIBL_OB_SURBL 5
score RCVD_IN_NJABL_DUL 4
score RCVD_IN_XBL 5
score RCVD_IN_SORBS_DUL 3
score URIBL_SBL 5
score URIBL_JP_SURBL 4

STEP 2 - Raise score for BAYES

The default scores for BAYES are set to the lowest possible. These scores are automaticaly generated by a special script used by the developers of SpamAssassin and its generates the score based on all the rules. Unfortunately the high probability scores are too low, for example a 90% probability is a definit spam, so there is no reason why its score should be 2.

Edit your "/etc/mail/spamassassin/local.cf" and add:

Code:
# Raise bayes scores
score BAYES_80 3.5
score BAYES_95 4.5
score BAYES_99 5.0

STEP 3 - S.A. Rules Emporium (SARE)

There is a special team of commandos who track daily spam. These guys have sat down and written rules that target specific strings within spam. One such tick is to scan for telephones and addresses used in spam, thus they don't need to look for "viagra" in all its different variations instead they look for the phone or address of the guy selling them. As a result, their rules allow a doctor to get emails with "viagra" in them, while blocking spam at the same time.

These guys go even further, they have rules for:
- Rules to detect commonly abused redirectors and uri obfuscation techniques.
- Addresses and phone numbers harvested from spam
- Bayes poison using lists of words with equal length
- HTML coding rules that detect various spammer tricks applied through HTML coding within messages
- Header rules that are not found in other SARE rulesets.
- Rule set which flags specific spam and/or spam from specific spammers
- SARE Adult rules are designed to catch spam with "Adult" material.
- SARE "BML" rules are designed to catch "business, marketing and educational" spam.
- SARE Fraud rules are designed to catch "Nigerian 419", "International Lotto", etc. type scams.
- LOADS OF OTHERS...

Their website is at: http://www.rulesemporium.com/

Below are the safest rule sets which can be used everywhere. Just go to your "/etc/mail/spamassassin/" directory and run the following commands from the shell, thats all you need to do, they are automaticaly included when SA scans that directory.

Code:
wget http://www.rulesemporium.com/rules/70_sare_evilnum0.cf
wget http://www.rulesemporium.com/rules/70_sare_evilnum1.cf
wget http://www.rulesemporium.com/rules/70_sare_header0.cf
wget http://www.rulesemporium.com/rules/70_sare_html0.cf
wget http://www.rulesemporium.com/rules/70_sare_oem.cf
wget http://www.rulesemporium.com/rules/72_sare_redirect_post3.0.0.cf
wget http://www.rulesemporium.com/rules/99_sare_fraud_post25x.cf
wget http://www.rulesemporium.com/rules/70_sare_genlsubj0.cf

STEP 4 - Final step

Finally, make sure your required score is still set to the default 5 because all the above rules expect that it hasn't been changed.

Code:
required_score 5.0
Once you've run your system with the above and you are comfortable with the results, you may automaticaly delete spam with a score of 8 or more. The safest way is to create a filter rule in cPanel (Mail -> Email Filtering):

Code:
Select "Any header" that "contains" the string "X-Spam-Level: ********" (without quotes)

The result is this:

$message_headers contains "X-Spam-Level: ********"
thisisit3 is offline   Reply With Quote
Old 04-17-2007, 06:50 AM   #2
R45
JPC Senior Member
 
R45's Avatar
 
Join Date: Mar 2002
Location: Trinidad and Tobago
Posts: 75
Those settings are going to lead to a lot of false matches. The RBL settings aren't bad (though still quite high), but your BAYES settings are going to lead to a ton of wrong catches over time. BAYES is not dependable and should never be able to make a complete match. The beauty of the score system is making sure positive matches aren't arbitrarily done by making sure a combination of tests must be matched. High settings like that just aren't practical for a production setup.
__________________
Adam Alkins
[website]

Last edited by R45; 04-17-2007 at 06:53 AM.
R45 is offline   Reply With Quote
Old 04-17-2007, 06:54 AM   #3
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
I disagree. The default BAYES settings are useless, they raise the score by a few points which doesn't really do anything in practice.

All my servers rely on BAYES to make complete matches (BAYES_99 is 5 points) and it works perfectly. I've monitored emails for 6 months and found 0 (zero!) false positives.

Based on discussions in the SA mailing list, many developers agree with me, that the default is set too low, but they require that defaults are low.
thisisit3 is offline   Reply With Quote
Old 04-17-2007, 07:00 AM   #4
R45
JPC Senior Member
 
R45's Avatar
 
Join Date: Mar 2002
Location: Trinidad and Tobago
Posts: 75
BAYES is not foolproof. You'll have to manually maintain the database to get absolutely accurate matches. It's AI, and by its nature it will get dirty over time. The thing is, it's much better to start with lower settings and adjust upwards when you detect how spam is evading SA, besides the fact that you'll be missing countless numbers of real emails.

I'm sorry but I can't believe you get 0 false positives over 6 months with those settings, unless you don't use much email.
__________________
Adam Alkins
[website]
R45 is offline   Reply With Quote
Old 04-17-2007, 07:42 AM   #5
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
The BAYES database here works 100% perfectly. I've let it collect spam on its own (auto learn, which is enabled by default) and then set all the above settings. I then tracked for 6 months all emails marked with BAYES_80 or above (without deleting anything).

During that time, i never got a single false positive, all BAYES highly marked emails were real spam.

It doesn't get "dirty" over time, even when spammers use poison words, because SA automaticaly cleans the learned data over time.

I've got a high volume of emails and some of my domains are very weird, from newspapers to law offices. Their emails are very important and their business depends on them. I've been very careful while doing the above operation and thats why it took me 6 months to complete.

My findings show that SA version 3.x has a much better bayes engine than 2.x versions. In addition, the default auto learn feature works rather well and never had any problems with it learning false positives. Even with the above scores, there are a few (but very few) spam emails that get through, some of those are the new kind that use a JPEG image as their content.
thisisit3 is offline   Reply With Quote
Old 04-27-2007, 08:20 PM   #6
Connie
Old Hillbilly
 
Connie's Avatar
 
Join Date: Sep 2001
Location: Hills of Missouri
Posts: 2,639
I don't have
Quote:
/etc/mail/spamassassin/local.cf
I have /etc/mail/ " cdl-s.com" and "yourdomain.com".

This site is on a shared server and I don't have the spam box enabled if that makes a difference.

Not sure how to proceed based on your instructions?
__________________

Forum Moderators - Jag Staff

Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
Organize your Kitchen or purchase Kitchen Accessories at Condells
Ihelpyou Forum - Dedicated to "Best Practices" SEO
Connie is offline   Reply With Quote
Old 04-27-2007, 09:05 PM   #7
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
The above steps are for VPS or Dedicated systems, not for shared servers (were you don't have root access to modify files under /etc/).

For a shared server you can follow all the above steps EXCEPT step 3. Just ignore the file "/etc/mail/spamassassin/local.cf" mentioned about and instead follow the steps by editing the file "/home/<yourusernamehere>/.spamassassin/user_prefs".

For example, if your ssh login name is "connie" then edit: /home/connie/.spamassassin/user_prefs

Everything else is pretty much the same. In case you are wondering why you can't follow STEP 3, thats because shared "spamd" won't load custom rule sets from users home dirs for security reasons. For example if one such rule is a bad regular expression, it could take down the server.
thisisit3 is offline   Reply With Quote
Old 04-28-2007, 04:07 AM   #8
Connie
Old Hillbilly
 
Connie's Avatar
 
Join Date: Sep 2001
Location: Hills of Missouri
Posts: 2,639
OK found it. Thanks. Being the dummie that I am, I proceed with caution. Are you saying to just copy and past the above rules (except #3 on a shared server) in the the user prefs file?

I already have SA set to a score of 4, and to automatically delete spam. Will that make a difference in regard to the rules you posted?
__________________

Forum Moderators - Jag Staff

Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
Organize your Kitchen or purchase Kitchen Accessories at Condells
Ihelpyou Forum - Dedicated to "Best Practices" SEO
Connie is offline   Reply With Quote
Old 04-28-2007, 08:04 AM   #9
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
Yes, just copy/paste them in your user_prefs file.

You mean you have "required_score" set to 4? I'd suggest you reset it back to 5, since the above rules are already "hard" enough. You can just run it as 5 for a test period and see.
thisisit3 is offline   Reply With Quote
Old 04-28-2007, 12:52 PM   #10
Connie
Old Hillbilly
 
Connie's Avatar
 
Join Date: Sep 2001
Location: Hills of Missouri
Posts: 2,639
OK, I'll give it a try.
__________________

Forum Moderators - Jag Staff

Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
Organize your Kitchen or purchase Kitchen Accessories at Condells
Ihelpyou Forum - Dedicated to "Best Practices" SEO
Connie is offline   Reply With Quote
Old 04-28-2007, 07:12 PM   #11
Vin DSL
Yeah, I know a LOT!
 
Vin DSL's Avatar
 
Join Date: Mar 2003
Location: Arizona Uplands Intelligence Quotient: 138+
Posts: 10,384
Heh!

This should be good!
__________________
DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

No Guts, No Story! VinDSL © 2010
Vin DSL is offline   Reply With Quote
Old 05-21-2007, 12:01 PM   #12
Connie
Old Hillbilly
 
Connie's Avatar
 
Join Date: Sep 2001
Location: Hills of Missouri
Posts: 2,639
Everthing is working Great thisisit3. Thanks!
__________________

Forum Moderators - Jag Staff

Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
Organize your Kitchen or purchase Kitchen Accessories at Condells
Ihelpyou Forum - Dedicated to "Best Practices" SEO
Connie is offline   Reply With Quote
Old 05-21-2007, 12:19 PM   #13
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
no problem, i'm glad it works.
thisisit3 is offline   Reply With Quote
Old 10-10-2009, 12:26 AM   #14
thetar
JPC Member
 
Join Date: Sep 2009
Posts: 6
I have been using these settings for a little bit now and there has been some spam that gets through unmarked that gmail (my server email pop3's into my gmail account) was able to tell was spam and moved to the spam filter, but the server never marked it.

Is there any changes that you have made sense your post, or any other rules that are out there that could help reduce spam even more?

Not complaining as these work good, but could always be tweaked...
thetar is offline   Reply With Quote
Old 10-13-2009, 07:16 AM   #15
thisisit3
Jag Veteran
 
thisisit3's Avatar
 
Join Date: Mar 2007
Posts: 602
Its possible that Exim or SA will not mark an email because of one or more of several reasons, for example:

1) email is bigger (in KB) than X amount, as set from your cPanel settings

2) email comes from a trusted source as set from your cPanel settings

3) Exim is set, so as when spamd daemons are either full or dead, to pass/forward emails unscanned.

I solved (3) by editing my /etc/exim.conf and changed the "warn" to "deny" in the spamassassin condition.

Also, if your SA daemons (spamd) die or are full, then that also requires investigation, for example: not enough memory, etc.
thisisit3 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump