Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    865

    Thumbs up how to Turn on SpamAssassi for all accounts (i.e. with yes option to disab

    Turn on SpamAssassin™ for all accounts (i.e. with yes option to disable).

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: how to Turn on SpamAssassi for all accounts (i.e. with yes option to di

    So you want to turn it on globally but still allow users to disable it if they want to do so? WHM > Exim Configuration Editor > SpamAssassin™: Forced Global ON option, but this would then not allow the users to disable it. There is not currently an option to globally enable it on all accounts but still allow disabling it.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    865

    Default Re: how to Turn on SpamAssassi for all accounts (i.e. with yes option to di

    So bad
    Is it possible to this from SSH ??

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: how to Turn on SpamAssassi for all accounts (i.e. with yes option to di

    For SpamAssassin to be enabled, you'd have to add the file .spamassassinenable to /home/username, then add the folder .spamassassin to /home/username with a user_prefs file in it. You could enable it on one account to see the file contents for the /home/username/.spamassassin/user_prefs file.

    You could copy that file to /root/spamassassin/user_prefs then create a postwwwacct script for that to enable when the user account is created:

    Code:
    mkdir /root/spamassassin
    cp /home/username/.spamassassin/user_prefs /root/spamassassin
    Above, replace username with the cPanel username in that above command only. Any other instances in the lines below should not be replaced but entered exactly as input.

    Code:
    vi /usr/local/cpanel/scripts/postwwwacct
    In that file put the following:

    Code:
    #!/usr/bin/perl
    
    my %OPTS = @ARGV;
    $ENV{USER} = “$OPTS{‘user’}”;
    system q(mkdir /home/$USER/.spamassassin);
    system q(touch /home/$USER/.spamassassinenable);
    system q(cp /root/spamassassin/user_prefs /home/$USER/.spamassassin/);
    system q(chown $USER:$USER /home/$USER/.spamassassinenable);
    system q(chown -R $USER:$USER /home/$USER/.spamassassin);
    system q(chmod 700 /home/$USER/.spamassassin);
    After creating that file, ensure it can execute:

    Code:
    chmod +x /usr/local/cpanel/scripts/postwwwacct
    I tested the above, and it does work for account creation. As for enabling this on all existing accounts, you could run the following commands:

    Code:
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do mkdir /home/$i/.spamassassin && touch /home/$i/.spamassassinenable ;done
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do cp /root/spamassassin/user_prefs /home/$i/.spamassassin/ ;done
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do chown $i:$i /home/$i/.spamassassinenable && chown -R $i:$i /home/$i/.spamassassin ;done
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    cPanel Staff cpanelnick's Avatar
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    4,597

    Default Re: how to Turn on SpamAssassi for all accounts (i.e. with yes option to di

    Code:
    touch /etc/global_spamassassin_enable
    This should take care of it.
    -Nick
    cPanel Inc.

    Need support? Submit a request here. Complimentary support is available to all license holders regardless of where you purchased your license.
    Need a complimentary support account? Create one here.

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: how to Turn on SpamAssassi for all accounts (i.e. with yes option to di

    By touching that file, it will not allow the user to disable SpamAssassin in cPanel, which was a requirement by the poster per the original request:

    Turn on SpamAssassin™ for all accounts (i.e. with yes option to disable).
    He would like to enable it for all accounts that exist, then to enable it on all accounts that are created, but still allow those users to turn it off after account creation or enabling if they so desire in cPanel > SpamAssassin area. The /etc/global_spamassassin_enable file forces it to be globally on without the option in cPanel > SpamAssassin area to disable it per user.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. Turn on SpamAssassin for all accounts (Global ON)
    By hploh in forum E-mail Discussions
    Replies: 0
    Last Post: 09-14-2007, 04:35 AM
  2. Turn off SSH accounts all at once
    By Def in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-19-2005, 11:29 AM
  3. No Quota option in FTP accounts
    By eyecool in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 05-13-2005, 12:00 AM
  4. How can I turn off urchin for most accounts?
    By Jeff-C in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-15-2004, 04:47 PM
  5. option to turn off "Service Status" in all themes
    By nat in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-03-2003, 06:16 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube