control-panels:cpanel-whm:how-can-i-enable-spamassassin-on-all-cpanel-accounts

How can I enable SpamAssassin on all cPanel accounts?

Difficulty
Hard
Hard

The "Apache SpamAssassin: Forced Global ON" option in WHM's Exim Configuration manager does not actually enable SpamAssassin the way you think it does. It creates the SpamAssassin module/option in the cPanel accounts, however if no configurations are set by the end user it's not really doing any good.

The article will cover how to enable SpamAssassin for every cPanel account account on your server with a few steps.

This article requires common knowledge of SSH / Terminal usage.

Enable SpamAssassin on all cPanel accounts

  1. Log in to your server via SSH terminal as the root user.
  2. Make sure the Global SpamAssassin Enable file exists, otherwise create it.
  • touch /etc/global_spamassassin_enable
  1. Create a 'default' or 'blanket' configuration for user preferences. Reference SA Configuration Manual for specifics on creating configuration files. For this example, we're using a simple configuration containing the rule "required_score 3". The default configuration file will be located in /root/support/spamassassin/
  • touch /root/support/spamassassin/user_prefs && echo "required_score 3" » /root/support/spamassassin/user_prefs
  1. Once that's completed, continue with these loops to create the proper files/folders.
    1. Create the "enable" files for each user:
      • for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do mkdir /home/$i/.spamassassin && touch /home/$i/.spamassassinenable ;done
    2. Copy the default configuration we created in step 3 to all cPanel accounts:
      • for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do cp /root/support/spamassassin/user_prefs /home/$i/.spamassassin/ ;done
    3. Correct the permissions and ownership of the files/folders just created:
      • 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
  2. That's it! All cPanel accounts have SpamAssassin enabled with user preferences.
control-panels/cpanel-whm/how-can-i-enable-spamassassin-on-all-cpanel-accounts.txt · Last modified: 2016/10/21 13:56 by Marjorie S.