The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache SpamAssassin global enable anyone?

Discussion in 'EasyApache' started by Mibble, Sep 1, 2006.

  1. Mibble

    Mibble Active Member

    Joined:
    Apr 2, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    hi there,
    once spamassassin is upgraded on a server, each and every domain has spamassassin and the spamassassin box disabled.
    is there anyway to re-enable these things globally, so i do not have to go into each and every domain?
    thanks,

    John
     
  2. mahinder

    mahinder Well-Known Member

    Joined:
    Jun 12, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    matrix
    I am also looking for similar solution since last many many months. Most of users do not enable spamassassin by default and their email boxes grow to their quota limits causing bounce backs which are also caught by spamtrapps resulting in server being blacklisted by spamcop and other rbls. PLEASE PLEASE PROVIDE OPTION TO FORCE ENABLE SPAMASSASSIN AND SPAM BOX ON ALL ACCOUNTS ON SERVER. ITS JUST NOT POSSIBLE TO LOGIN TO EACH ACCOUNT AND ENABLE SPAMASSASSIN WHEN YOU HAVE 10'S OF SERVER WITH 100s of domains on each server.
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Please don't use CAPS it is considered shouting.
     
  4. Mibble

    Mibble Active Member

    Joined:
    Apr 2, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    perhaps he is trying to make a point?
     
  5. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    Since there is no option in the WHM to enable/activate SpamAssassin for every account, you can write a shell or Perl script to do that.
     
  6. mahinder

    mahinder Well-Known Member

    Joined:
    Jun 12, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    matrix
    I am sorry for using caps, i didn't knew its considered shouting, will not do this again. but, I wanted to make my point louder. You try transferring accounts from one server to another one. You will find that spamassassin get deactivate on new server. This creates huge headache for us. I am going to email cpanel and request them for this feature. I will also send them chocolates once its available in WHM for saving lots of my time and headache dealing with RBL's. :D

    about the script, I tried thinking about it but it seems very difficult. I will do more research tomorrow. :)

    Edit: should i lowercase words in previous post?
     
    #6 mahinder, Sep 22, 2006
    Last edited: Sep 22, 2006
  7. Imai

    Imai Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Need this feature

    I am interested in this feature combined with a global 'Clear Spam Box'.
    I have customers who never login to cpanel only to come back with they can't receive mails.
    Thank You
     
  8. mahinder

    mahinder Well-Known Member

    Joined:
    Jun 12, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    matrix
    i have written this script to enable spamassassin and spambox on all users till cpanel provide this option in WHM, i have tried it on one server and seems to work fine. here is kiddy script

    Code:
    #! /bin/sh
    M_FILENAME=$1
    #echo $M_FILENAME
    M_USERNAME=`find $M_FILENAME -printf %f`
    #echo $M_USERNAME
    
    touch /home/$M_USERNAME/.spamassassinenable
    chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinenable
    touch /home/$M_USERNAME/.spamassassinboxenable
    chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinboxenable
    
    echo $M_USERNAME complete
    echo           
    
    Now save above script and name it /root/enabless.sh and change to chmod 700. now call script like this

    find /var/cpanel/users -type f -exec /root/enabless.sh {} \;

    this will create
    .spamassassinenable
    and
    .spamassassinboxenable
    file in ALL users home directory on server which will enable spamassassin and spambox for domain. works fine on my server. use code on your own risk however it should do no harm to your server.
     
  9. Daniel15

    Daniel15 Well-Known Member

    Joined:
    Oct 7, 2006
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Thanks for that, it's a very nice script, and works fine :D
     
  10. gotini2004

    gotini2004 Member

    Joined:
    Feb 9, 2004
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    dumm question

    ok, the script is great,
    so my question is what about the /home/username/.spamassasin directory and the files in it - files like user_prefs and so on ?

    thanks
     
  11. Daniel15

    Daniel15 Well-Known Member

    Joined:
    Oct 7, 2006
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    I personally just modified the script to copy my .spamassassin directory over, and chown it. I believe it was something like:
    Code:
    cp /home/dansoft/.spamassassin /home/$M_USERNAME/ -R
    chown $M_USERNAME:$M_USERNAME /home/$M_USERNAME/.spamassassin
    
    Right above the echo $M_USERNAME complete line (with /home/dansoft/.spamassassin being an existing spamassassin directory).

    But, I've removed this now, and I'm just using MailScanner server-wide :D
     
  12. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Urk :p I think that's the most marvellously creative use of find(1) I've seen in years of teaching shell scripting, well done! ;)

    Purely from a scripting point of view, a far simpler form of this would be:

    Code:
    cd /home
    for user in `ls /var/cpanel/users`
    do
         test ! -d $user && continue
         touch  $user/.spamassassinenable $user/.spamassassinboxenable
         chown $user.$user  $user/.spamassassinenable $user/.spamassassinboxenable
         echo $user complete
    done
    
    Save it in a file and run it once as a shell script.
     
  13. d-woo

    d-woo Well-Known Member

    Joined:
    Aug 9, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Enabling Spamassassin for All Accounts

    I have Spam Assassin 3.1.7

    I have just migrated about 75 sites to a new server...all secured by ramprage (great job at WebhostingGear.com)

    The default setting for all accounts in cPanel is SpamAssasin (SA) disabled.

    I want to do both of these:
    ---------------------------------
    a. setup the skeleton directory (/root/cpanel3-skel/) to have all future added accounts SA enabled.
    b. SA enable all current accounts (located in /var/cpanel/users)

    What I am seeing is that an account that has never had an email account or been SA enabled looks like this (screenshots from using WinSCP):
    Pic01
    [​IMG]

    and that the same account after turning on SA looks like this:
    Pic02
    [​IMG]


    It appears that I need to have:
    1. the file .spamassassinenable
    and
    2. the folder .spamassassin

    No Problem.

    Now, my question is around the contents of the folder, .spamassassin

    On a newly enabled account, it looks like this:
    Pic03
    [​IMG]

    But on an account that has been around the block for a while, the contents of the folder, .spamassassin looks like this:
    Pic04
    [​IMG]

    2 Questions:
    1. If I am writing a script to enable all accounts in /var/cpanel/users to be SA enabled, what files should be in the folder, .spamassassin?

    2. Will the bayes files and the auto-whitelist file get added/written automatically to the .spamassassin folder as that email account is used?
    The bayes files could be older data from my old server when I used to run MailScanner....not sure.

    I need to know this, so I will determine which files go in the master .spamassassin folder that I will be copying from to all users.
     
    #13 d-woo, Dec 4, 2006
    Last edited: Dec 4, 2006
  14. d-woo

    d-woo Well-Known Member

    Joined:
    Aug 9, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    It turns out that my SpamAssassin (3.1.7) is configured for the entire server.

    So, all I need to do is add the file .spamassassinenable to each /home/<user> directory

    I placed a copy of that file in /master_files/SA/.spamassassinenable

    Here is the script: /my_scripts/SA_enable_all

    Code:
    #! /bin/sh
    cd /home
    for user in `ls /var/cpanel/users`
    do
         test ! -d $user && continue
    
    	rm -rf /home/$user/.spamassassinenable
    
    	cp /master_files/SA/.spamassassinenable /home/$user/ -R
    	chown $user:$user /home/$user/.spamassassinenable
    
         echo $user complete
    done
    chmod it as 700
    [/#] chmod 700 /my_scripts/SA_enable_all

    run the script
    [/#] cd /my_scripts
    [/#] ./SA_enable_all


    All existing accounts are now enabled


    New Accounts

    place a copy of /master_files/SA/.spamassassinenable in /root/cpanel3-skel
    [/#] cp /master_files/SA/.spamassassinenable /root/cpanel3-skel/

    Any new accounts will be SA enabled
     
    #14 d-woo, Dec 5, 2006
    Last edited: Dec 5, 2006
  15. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    Handy little scripts.

    Now if they could come up with a way to trim the memory usage by spamd, that would be great! It is a real memory hog!!

    Thx's
    Mickalo
     
  16. d-woo

    d-woo Well-Known Member

    Joined:
    Aug 9, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Are you running SpamAssassin under Mail Scanner or are you running SA it by itself?

    What version are you using?

    Steve at WebHostingGear.com hooked me up with a sweet global configuration of SA.

    I don't know what he did, but my server load is averaging like .04 and we are getting very few junk mails through.
     
  17. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    we're running Ver., 3.1.7, lastest I believe.

    we are currently running SA alone, without MailScanner, but have been seriously considering switiching over to Chirpy's Cpanel MailScanner package. I've fine tunned our SA over the past week and have reduced our overall total spam atleast 95%, but the drawback is SA uses about 15% more memory then our normal usage. CPU usuage doesn't seem too bad, but memory is an issue sometimes, but we do run 1GB ram, with very little Swap, usually less a couple of percent.

    Can you share the global configuration ?

    TIA,
    Mickalo
     
  18. d-woo

    d-woo Well-Known Member

    Joined:
    Aug 9, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Here is my /etc/mail/spamassassin/local.cf

    Code:
    # SpamAssassin config file for version 3.x
    # NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6
    # See http://www.yrex.com/spam/spamconfig25.php for earlier versions
    # Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)
    
    # How many hits before a message is considered spam.
    required_score           4.8
    
    # Change the subject of suspected spam
    rewrite_header subject         {Spam?}
    
    # Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
    report_safe             0
    
    # Enable the Bayes system
    use_bayes               1
    use_bayes_rules         1
    
    # Enable Bayes auto-learning
    bayes_auto_learn        1
    bayes_min_ham_num               1000
    bayes_min_spam_num      1000
    bayes_learn_during_report       1
    
    # Enable or disable network checks
    skip_rbl_checks         0
    razor_config /var/spool/mqueue/.razor/razor-agent.conf
    dcc_home /var/dcc
    
    use_pyzor               1
    #pyzor_path		/usr/local/bin/pyzor
    #pyzor_max		0
    #pyzor_options --homedir /etc/mail/spamassassin
    
    
    # Mail using languages used in these country codes will not be marked
    # as being possibly spam in a foreign language.
    # ok_languages            all
    
    # Mail using locales used in these country codes will not be marked
    # as being possibly spam in a foreign language.
      ok_locales              all
    
    # Handle header info
    add_header spam Flag _YESNOCAPS_
    add_header all Status _YESBO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
    # add header all Level _STARS(*)_
    # add header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
    
    
     
  19. superiorhost

    superiorhost Well-Known Member

    Joined:
    Nov 16, 2001
    Messages:
    77
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi D-woo,
    It looks like he also installed razor in your server too...
    your not running just spamasassin. It is looking at your razor and pyzor configs... those are not on a standard cpanel server until installed.

    However, it sounds like your getting great results from your set up.

    Tim L
     
  20. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    Which folders to actual use

    I've noticed that there are two folders that SA seems to use, 1) /usr/share/spamassassin and 2) /etc/mail/spamassassin which is where we have been putting are updates into(folder 2).

    Now I thought the files in the /usr/share/spamassassin location wouldn't really been needed and wanted to trim down the amount of files SA needs to read, but after deleting the files in location 1, Spamd constantly fails and is constantly restarted. What files in the /usr/share/spamassassin location must be there? And can those file(s) be moved into the /etc/mail/spamassassin folder location.

    I just want to keep things easy to maintain, so we don't have files spread all over the place. Apparently there must a file or files that Spamassassin requires(for Cpanel), otherwise it constantly fails.

    We also use RulesDuJour add-on which puts it's updates into the /etc/mail/spamassassin folder location. So what needs to be kept in the /usr/share/spamassassin location so Spamd doesn't fail??

    TIA,
    Mickalo
     
Loading...

Share This Page