Jump to content

Recommended Posts

Posted

SpamAssassin's documentation said that to make the Bayesian filter learn spam emails that slipped past it, you should make a cron job that runs salearn on a specific email folder. How would one go about doing this on a TCH Cpanel?

 

Thanks!

Jacob H.

  • 1 month later...
Posted

I'm just starting to see a lot of Bayesian scores in my spams, and I was wondering the same thing.

 

Is there some way for us to tune our own SA Bayes info? I see the files in my .spamassassin directory, but I don't know how to do any tuning.

Posted

In the event someone doesn't come along and answer your question here...

 

I'm hoping to put together a little tweaking spamassassin tutorial/help page soon. I'm planning on tweaking my own (since I get 200+ spams per day of which a good dozen or so still make it through) and will document what needs to be done. It just may take a couple weeks before I have anything substantial, but I'll post it up or make sure it makes it to the help pages when it's done. Stay tuned.... :Nerd:

  • 3 months later...
  • 10 months later...
Posted (edited)
Mike,

 

How is the SA guide coming?

 

Dennis

 

 

Did this ever get done? I would be quite interested.

 

Also, there seems to be a Spam Assassin feature where you can create an IMAP folder called LearnAsSpam, and if any spam slips by, you put it in there and spam assassin checks in there periodically and learns from it.

 

http://wiki.apache.org/spamassassin/Single...28user_prefs%29

 

I can't help but feel like I am not getting the most out of SA, but I am not sure how to crank it up!

 

Any pointers appreciated!

Edited by robok
  • 6 months later...
Posted
Did this ever get done? I would be quite interested.

 

Also, there seems to be a Spam Assassin feature where you can create an IMAP folder called LearnAsSpam, and if any spam slips by, you put it in there and spam assassin checks in there periodically and learns from it.

 

http://wiki.apache.org/spamassassin/Single...28user_prefs%29

 

I can't help but feel like I am not getting the most out of SA, but I am not sure how to crank it up!

 

Any pointers appreciated!

 

 

 

Replying to my own message.... Can someone point me to more resources on using Spam Assassin here at TCH. I would like to customize the filter. Is that possible with the way SA is implemented at TCH?

 

Thanks!

  • 1 year later...
Posted
I'm just starting to see a lot of Bayesian scores in my spams, and I was wondering the same thing.

 

Is there some way for us to tune our own SA Bayes info? I see the files in my .spamassassin directory, but I don't know how to do any tuning.

 

I have found out how to make Spam Assasin learn from it's mistakes! You've got to tell it what the mistakes are of course... This is how I did it:

 

In Squirl Mail ( ******/sqmail ) I created a folder called "spam-learn" to put spam in that SpamAssassin didn't catch.

 

Then I created a file called spam-learn.sh in my cgi-bin, changed it's permissions to 755 and put the following block of code into it:

 

#!/bin/sh

##

## Script to make Spam Assassin learn Ham and Spam from different folders

##

echo "Learning SPAM"

DNAME="$HOME/mail/****/"

for USER in $(ls $DNAME)

do

cd $DNAME

cd $USER

echo ""

echo "Processing SPAM $DNAME$USER"

nice -n 19 sa-learn --spam --mbox --showdots spam-learn

echo ""

echo "Processing HAM $DNAME$USER"

nice -n 19 sa-learn --ham --mbox --showdots ham-learn

cd ..

cd ..

echo ""

echo ""

done

cd $DNAME

echo "Processing Special Email accounts"

echo "Processing spam-learn@****"

nice -n 19 sa-learn --spam --mbox --showdots spam-learn/inbox

echo ""

echo "Processing ham-learn@****"

nice -n 19 sa-learn --ham --mbox --showdots ham-learn/inbox

echo ""

echo ""

echo "Done"

 

 

In the code you will need to replace "****" with your own domain name. This code also looks for a folder called ham-learn to learn from mails that went to your spam box but shouldn't have.

 

Set up cron job to run the script you created every night. Put the following line into the command line (substitute your site login username for the word "username"):

 

/home/username/public_html/cgi-bin/spam-learn.sh

 

The above works if you are checking your mail via IMAP or via a web account (spmail or horde). In order to make it work with Outlook, I set up two new email accounts, called spam-learn@**** and ham-learn@**** (with my own domain name). You can open redirect the message using one of the methods below (note this is NOT the same as forwarding).

 

Your users will then want to Redirect or Resend messages to "SPAM-LEARN@****" or "HAM-LEARN@****" appropriately. This varies depending on how your users check their email.

Web Mail with HORDE - Choose "Redirect"

Outlook (Anyone with a script so this can be done with the push of a button?)

A. Open the message (double click on it)

B. Action-->Resend This Message...

C. Say "Yes" to the warning that you were not the original sender.

D. Change the "To..." line to: "SPAM-LEARN@****" or "HAM-LEARN@****"

E. Hit "Send" (do not change the message)

 

I hope this info helps somebody!

 

Just to credit the source, I extracted and applied the above information from the following pages:

http://www.bluehostforum.com/archive/index.php/t-20.html

http://forums.asmallorange.com/index.php?showtopic=6753&hl=spamass

 

The next thing I am trying to figure out how to do, is to delete mail from those folder that is older than a certain date. I'm guessing I'll just have to add some lines of code to my script, but I'm trying to figure out what those lines would be. If the server was using maildir, then it would be more simple, because each of the mails would be separate files, but it seems that TCH is using mbox, which stores all of the mails for a folder in a single file. If anyone knows How to create a script to do that, it would be helpful. Thanks!

 

Good luck and happy spam catching! ;)

  • 1 year later...
Posted

Jacob did you customize your user_prefs file any or is it just the default?

 

Mine looks like the following anything else that can be tweaked ?

 

 

 

># SpamAssassin user preferences file.  See 'perldoc Mail::SpamAssassin::Conf'
# for details of what can be tweaked.
###########################################################################

# How many points before a mail is considered spam.
# required_score		5

# Whitelist and blacklist addresses are now file-glob-style patterns, so
# "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
# whitelist_from	someone@somewhere.com

# Add your own customised scores for some tests below.  The default scores are
# read from the installed spamassassin rules files, but you can override them
# here.  To see the list of tests and their default scores, go to
# [url="http://spamassassin.apache.org/tests.html"]http://spamassassin.apache.org/tests.html[/url] .
#
# score SYMBOLIC_TEST_NAME n.nn

# Speakers of Asian languages, like Chinese, Japanese and Korean, will almost
# definitely want to uncomment the following lines.  They will switch off some
# rules that detect 8-bit characters, which commonly trigger on mails using CJK
# character sets, or that assume a western-style charset is in use. 
# 
# score HTML_COMMENT_8BITS	0
# score UPPERCASE_25_50		0
# score UPPERCASE_50_75		0
# score UPPERCASE_75_100	0
# score OBSCURED_EMAIL          0

# Speakers of any language that uses non-English, accented characters may wish
# to uncomment the following lines.   They turn off rules that fire on
# misformatted messages generated by common mail apps in contravention of the
# email RFCs.

# score SUBJ_ILLEGAL_CHARS      0

required_score 3.0

Posted

Im having a little bit of a problem with this Im getting this back from my cronjob

 

Processing SPAM /home/domain/mail/domain.com/mike

archive-iterator: unable to open myspam: No such file or directory

 

Learned tokens from 0 message(s) (0 message(s) examined)

 

Processing HAM /home/domain/mail/domain.com/mike

archive-iterator: unable to open myham: No such file or directory

 

Learned tokens from 0 message(s) (0 message(s) examined)

 

I aslo tried changing this line in the script and adding in .myspam and .myham

 

echo "Processing SPAM $DNAME$USER"

nice -n 19 sa-learn --spam --mbox --showdots .myspam

echo ""

echo "Processing HAM $DNAME$USER"

nice -n 19 sa-learn --ham --mbox --showdots .myham

 

I then got the below results

 

Processing SPAM /home/domain/mail/domain.com/mike

 

Learned tokens from 0 message(s) (0 message(s) examined)

 

Processing HAM /home/domain/mail/domain.com/mike

 

Learned tokens from 0 message(s) (0 message(s) examined

 

There are emails in both folders myspam & myham

This is a copy of my current script

>#!/bin/sh
##
## Script to make Spam Assassin learn Ham and Spam from different folders
##
echo "Learning SPAM"
DNAME="$HOME/mail/domain.com/"
for USER in $(ls $DNAME)
do
cd $DNAME
cd $USER
echo ""
echo "Processing SPAM $DNAME$USER"
nice -n 19 sa-learn --spam --mbox --showdots myspam
echo ""
echo "Processing HAM $DNAME$USER"
nice -n 19 sa-learn --ham --mbox --showdots myham
cd ..
cd ..
echo ""
echo ""
done
cd $DNAME
echo "Processing Special Email accounts"
echo "Processing spam-learn@****"
nice -n 19 sa-learn --spam --mbox --showdots spam-learn/inbox
echo ""
echo "Processing ham-learn@****"
nice -n 19 sa-learn --ham --mbox --showdots ham-learn/inbox
echo ""
echo ""
echo "Done"

Posted
I aslo tried changing this line in the script and adding in .myspam and .myham

 

echo "Processing SPAM $DNAME$USER"

nice -n 19 sa-learn --spam --mbox --showdots .myspam

echo ""

echo "Processing HAM $DNAME$USER"

nice -n 19 sa-learn --ham --mbox --showdots .myham

 

I then got the below results

 

Processing SPAM /home/domain/mail/domain.com/mike

 

Learned tokens from 0 message(s) (0 message(s) examined)

 

Processing HAM /home/domain/mail/domain.com/mike

 

Learned tokens from 0 message(s) (0 message(s) examined

I did some further tweaking and changed the line to this

nice -n 19 sa-learn --spam --mbox --showdots .myspam/cur/

echo ""

echo "Processing HAM $DNAME$USER"

nice -n 19 sa-learn --ham --mbox --showdots .myham/cur/

This time I got the message

Processing SPAM /home/domain/mail/domain.com/mike

....

Learned tokens from 4 message(s) (4 message(s) examined)

 

Processing HAM /home/domain/mail/domain.com/mike

 

Learned tokens from 0 message(s) (0 message(s) examined)

 

There is alot more mail in myspam foolder I have had that folder sitting there for about a year for some reason I was under the impression way back that spam assasin looked for this folder and trained from it (silly me). Is there any reason that it would only detect 4 messages there are a total of 63 in there. It also didnt detect anything I had in myham folder and there are a few messages in there.

Posted (edited)

I realize you are discussing the subject on a waaaaay deeper level than I am about to ... but, for what it's worth, spam is a non-issue for me, so maybe the solution that works for me will be of use to someone reading the topic.

 

I use Outlook Express. The sole purpose of my INBOX is to hold "stuff" that is from someone who is not already in my address book. A quick glance and I can delete the lot.

 

I have added all the names in my address book to one "OE rule" that automatically re-directs those emails to a specific folder.

 

Obviously this would not be as efficient for those of you who get a ton of emails from "strangers" that you want to read ... but it's still kind of nice to know that that one folder only contains messages from your friends.

Edited by Mrs. Muddled
Posted

Sorry MikeS but I just don't worry about SPAM either. I handle it client side so I don't bother trying to train Spam Assassin any more than the standard configuration and maybe setting the SPAM threshold level lower that the default. Other than adding emails to the white- or black-list is as far as I am willing to waste my time on.

 

I have filters in my email client (Thunderbird) and it has it's own junk mail filtering that works very well. In a perfect world we wouldn't have to deal with SPAM.

 

If you are getting SPAM in your box to addresses you have not set up forwards or accounts for make sure you have set your default email address in cPanel to :fail:. That will prevent a lot of SPAM from even reaching you.

Posted

I do have my default email to :fail: in the past year I think i have a total of 63 alltogether which pretty much every once in a while I was getting one, I try to be very careful with my main email acct. I noticed recently though that I am averaging a couple a day, which is not bad and easy enough to handle client side. I just figured setting SA up and training it would be a better alternative in the long run. I did lower my threshold down to a 4 but it seams they are still slipping in. If I go into the mailbox and go into \cur directory and read the file It looks like SA is giving it a rating of 3.2 I dont know if thats too low to set my threshold to where I will start getting ham mixed in with my spam. If anyone can give me some advice please feel free to chime in.

Posted

Welcome to the forums MikeS :lol:

 

Looking at the post above, you are setting the format to mbox, which is the incorrect format. You need to remove the --mbox from the command.

Posted

Also if anyone is intrested in removing the spam after it scans the folder you can add a line with this after the sa-learn command

 

rm -rf .spamfoldername/cur/*

  • 5 years later...
Posted

Would the above settings work for the current version of Spam Assasin on cPanel? I am looking for some help learning how to congfigure SA as I am new to it an on a few of our older accounts we are being inudated with spam and I can't keep up with it using filters in Outlook anymore. Is there any 'for dummies' settings or help that is current?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...