+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 25 of 25

Thread: To be continued - Controlling SPAM in my domains

  1. #21

    Default

    OK, with the detailed information above, I am able to get it running... and learn tokens.... but is it possiable to somehow run the sa-learn command from a browser? I am running this once a week, and thinking of once a day (until I start to see a slow down/more accurate reconization of spam/ham) but Id like to beable to run this on the spot if I have alot Id like to learn instead of editing my chron tab each time....

  2. #22
    Join Date
    Mar 2006
    Location
    California
    Posts
    21

    Default

    I believe SSH/Shell Access (see cPanel) will alow you to do this.

  3. #23
    Join Date
    Feb 2006
    Posts
    4

    Post Simple script for teaching your SPAMASSASIN daemon for all your domains

    Hi guys!

    I made a simple script for teaching your SPAMASSASIN daemon with HAM and SPAMUNCAUGTH from all the emails accounts of all your domains. It means with only one script you can add the "SPAM/HAM learning feature" to all your email accounts of all your domains.

    Just set up the variables of the script with your preferences. Run it manually several times to see all is working ok and then run this script once a day using crontab and take a sit while your Spamassasin is learning ;P

    If you have LOGDEBUG enabled, the script will return you something like this:

    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user1/.SpamHam ==========================
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user1/.SpamNoCogido ==========================
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user2/.SpamHam ==========================
    Learned tokens from 0 message(s) (0 message(s) examined)
    Learned tokens from 0 message(s) (0 message(s) examined)
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user2/.SpamNoCogido ==========================
    Learned tokens from 0 message(s) (0 message(s) examined)
    Learned tokens from 3 message(s) (3 message(s) examined)
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user3/.SpamHam ==========================
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user3/.SpamNoCogido ==========================
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user4/.SpamHam ==========================
    ===== Checking /home/bluehostlogin/mail/elsotanillo.net/user4/.SpamNoCogido ==========================
    ===== Checking /home/bluehostlogin/mail/the10thfloor.net/user1/.SpamHam ==========================
    ===== Checking /home/bluehostlogin/mail/the10thfloor.net/user1/.SpamNoCogido ==========================


    Here you are the Script with instructions:

    #!/bin/sh
    # InstruirSpamAssassin.sh
    # TEACH YOUR SPAMASSASSIN script for cpanel (www.bluehost.com in this case) hosting accounts
    # This script teach your SPAMASSASIN daemon with HAM and SPAMUNCAUGTH from all the emails accounts of all your domains

    #"THE BEER-WARE LICENSE" (Revision 42):
    #Juan Sierra Pons wrote this file. As long as you retain this notice you
    #can do whatever you want with this stuff. If we meet some day, and you
    #think this stuff is worth it, you can buy me a beer in return.
    #Juan Sierra Pons - juan [at} elsotanillo {dot] net
    #http://www.elsotanillo.net/
    #Original beerware license is due to Poul-Henning Kamp.

    #SPAMASSASSIN CONFIGURATION
    #1.- Turn On Spamassasin: cPanel->Email Manager->Spam Assassin-> "Enable Spam Assassin"
    #2.- Turn on Bayes (auto learning for SA) "Configure Spam Assassin" -> check the box for "use-bayes".

    #HOW TO SET UP USERS' EMAIL ACCOUNT
    #### always use the same name for HAM and UnCaughtSpam for all yours users
    # 1.- Create one folder for SPAMHAM
    # 2.- Create one folder for SPAMUNCAUGTH

    #USERS' INSTRUCTIONS
    # 1.- Move all your UnCaughtSpam messages to your UnCaughtSpam folder
    # 2.- Move all your HAM messages to your HAM folder

    #HOW TO USE THIS SCRIPT:
    # 1.- Fill the LOGIN variable
    # 2.- Fill the SPAMHAMDIRECTORY variable
    # 3.- Fill the SPAMUNCAUGTH variable
    # 4.- Run this script using the crontab daemon once a day for example
    # 5.- After you check all is running ok for you, you can comment LOGSALEARN and LOGDEBUG lines

    ########################## Variables ###########################
    LOGIN="loginbluehost"
    SPAMHAMDIRECTORY="SpamHam"
    SPAMUNCAUGTH="SpamNoCogido"
    ### uncoment next line if you want to run sa-learn in verbose mode
    #LOGSALEARN="-D"
    ### LOGDEBUG=0 if you wan to see which accounts are being checked - only for debugging pourposes
    LOGDEBUG=0
    ### MOVESPAMHAMMESSAGES=0 if you want to move SPAMHAM messages to each INBOX directory after teach your spamassasin
    MOVESPAMHAMMESSAGES=1
    ### CLEANSPAMUNCAUGTHMESSAGES=0 if you want clean SPAMUNCAUGTH directory after teach your spamassassin
    CLEANSPAMUNCAUGTHMESSAGES=1
    ################################################## ##############
    for i in /home/$LOGIN/mail/*/*
    do
    ##### Teach SpamAssassin with HAM messages from SPAMHAM directory
    if [ $LOGDEBUG = 0 ] ;then echo ===== Checking $i/.$SPAMHAMDIRECTORY ========================== ; fi
    if test -d $i/.$SPAMHAMDIRECTORY/new; then nice -n 19 sa-learn $LOGSALEARN --ham --dir $i/.$SPAMHAMDIRECTORY/new; fi
    if test -d $i/.$SPAMHAMDIRECTORY/cur; then nice -n 19 sa-learn $LOGSALEARN --ham --dir $i/.$SPAMHAMDIRECTORY/cur; fi
    ##### move SPAMHAM messages to each INBOX directory
    if [ $MOVESPAMHAMMESSAGES = 0 ]
    then mv $i/.$SPAMHAMDIRECTORY/new/* $i/new ;mv $i/.$SPAMHAMDIRECTORY/cur/* $i/cur
    fi
    ##### Teach SpamAssassin from SPAMUNCAUGTH directory
    if [ $LOGDEBUG = 0 ] ;then echo ===== Checking $i/.$SPAMUNCAUGTH ========================== ; fi
    if test -d $i/.$SPAMUNCAUGTH/new; then nice -n 19 sa-learn $LOGSALEARN --spam --dir $i/.$SPAMUNCAUGTH/new; fi
    if test -d $i/.$SPAMUNCAUGTH/cur; then nice -n 19 sa-learn $LOGSALEARN --spam --dir $i/.$SPAMUNCAUGTH/cur; fi
    ##### Clean SPAMUNCAUGTH directory
    if [ $CLEANSPAMUNCAUGTHMESSAGES = 0 ]
    then rm $i/.$SPAMUNCAUGTH/new/*;rm $i/.$SPAMUNCAUGTH/cur/*
    fi
    done


    After you see all is working fine you can change MOVESPAMHAMMESSAGES and CLEANSPAMUNCAUGTHMESSAGES to move HAM to each inbox and to clean SpamUncaught directories. For security reasons they are not enabled by default.

    Remember the license of the script

    Happy new year.

    Juanillo
    --
    ----------------------------------------------------------------------------
    Linux User Registered: 257202
    http://www.elsotanillo.net
    ----------------------------------------------------------------------------
    Last edited by juasiepo; 11-26-2008 at 11:25 AM.

  4. #24

    Default

    I however have the feeling that even if the learning process is successful, Spamassassin still uses a global bayes DB rather than the user-defined one.

    Is there a way to check that indeed, SA has run the incoming mail against the local bayes database ?

    Thanks
    S.

  5. #25
    Join Date
    Mar 2006
    Location
    California
    Posts
    21

    Default

    1. Capitaine, Sorry I don't know your answer excpet that it seems to be run against my local databse,

    2. I recently ran sa-learn (same cron job I've been running for a few years) and get back:
    bayes: cannot open bayes databases /ramdisk/etc/spamassassin/data/bayes_* R/W: tie failed: Permission denied
    Any idea what might be causing this, what changed, and what I can do about it?

+ Reply to Thread

Similar Threads

  1. Stop the Spam!
    By pllobell in forum Advanced Scripting, and Coding help!
    Replies: 14
    Last Post: 09-01-2007, 02:09 PM
  2. Bluehost.com servers on spam blacklists?
    By Wes in forum General Questions
    Replies: 3
    Last Post: 03-19-2006, 07:53 AM
  3. spam?
    By steven in forum General Questions
    Replies: 3
    Last Post: 03-06-2006, 10:09 AM
  4. Be careful when getting Spam Box enabled...
    By walker in forum General Questions
    Replies: 0
    Last Post: 03-06-2006, 02:48 AM
  5. Spam
    By alan in forum General Questions
    Replies: 1
    Last Post: 02-19-2006, 09:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts