Spamassassin: Difference between revisions

From Cheatsheet
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:
= Bayesian Filter =
= Bayesian Filter =
{{notice|Please read the first section}}
{{notice|Please read the first section}}
'''First set the Variables to make this quick and easy:(replace cpanel_username_here with the cpanel account name you are working on...etc..):'''
This is how to enable and configure spamassassin on a cpanel server.
 
At the start of this process please '''login to their WHM''' and make sure that spamd is enabled in their '''Service Manager''', if it isn't enable it since this wont work without it.
 
'''First set the Variables to make this quick and easy (replace cpanel_username_here with the cpanel account name you are working on...etc..):'''
  CpUser=cpanel_username_here
  CpUser=cpanel_username_here
  DomainDotCom=Email_account_domain
  DomainDotCom=Email_account_domain
  EmailUser=Email_account_name
  EmailUser=Email_account_name


Then do the following:  
'''Then copy and paste the rest of this:'''
  echo -e "\n\nThe cpanel accounts username is $CpUser\nand the email account for the bayesian filter is $EmailUser@$DomainDotCom\n\n"
  echo -e "\n\nThe cpanel accounts username is $CpUser\nand the email account for the bayesian filter is $EmailUser@$DomainDotCom\n\n"
  cd /home/$CpUser/.spamassassin/
  cd /home/$CpUser/.spamassassin/
  echo "use_bayes 1" >> user_prefs
  echo -e "use_bayes 1\nbayes_auto_learn 1\nbayes_min_ham_num 50\nbayes_min_spam_num 50" >> user_prefs
echo "bayes_auto_learn 1" >> user_prefs


Make the script
'''Make the script:'''
  echo '#!/bin/bash' >> /home/$CpUser/.spamassassin/spamassassin.sh
  echo '#!/bin/bash' >> /home/$CpUser/.spamassassin/spamassassin.sh
  echo -e "\n#learning spam\n sa-learn --spam /home/$CpUser/mail/$DomainDotCom/$EmailUser/.Spam/{cur,new}\n\n#clean out the spam\n# find /home/$CpUser/mail/$DomainDotCom/$EmailUser/.Spam/{cur,new}/* -type f -maxdepth=1 -delete \n\n#learning safe mail\n sa-learn --ham /home/rapmusic/mail/$DomainDotCom/$EmailUser/.Ham/{cur,new}" >> /home/$CpUser/.spamassassin/spamassassin.sh
  echo -e "\n#learning spam\n sa-learn --spam /home/$CpUser/mail/$DomainDotCom/$EmailUser/.spam/cur\n\n#clean out the spam\n# find /home/$CpUser/mail/$DomainDotCom/$EmailUser/.spam/cur/* -maxdepth 1 -type f -delete \n\n#learning safe mail\n sa-learn --ham /home/$CpUser/mail/$DomainDotCom/$EmailUser/.ham/cur" >> /home/$CpUser/.spamassassin/spamassassin.sh
 
Change perms and add cron:
'''Change perms and add cron:'''
  chown $CpUser. /home/$CpUser/.spamassassin/spamassassin.sh
  chown $CpUser. /home/$CpUser/.spamassassin/spamassassin.sh
  chmod +x /home/$CpUser/.spamassassin/spamassassin.sh
  chmod +x /home/$CpUser/.spamassassin/spamassassin.sh

Latest revision as of 16:52, 30 October 2014

Bayesian Filter

Notice: Please read the first section

This is how to enable and configure spamassassin on a cpanel server.

At the start of this process please login to their WHM and make sure that spamd is enabled in their Service Manager, if it isn't enable it since this wont work without it.

First set the Variables to make this quick and easy (replace cpanel_username_here with the cpanel account name you are working on...etc..):

CpUser=cpanel_username_here
DomainDotCom=Email_account_domain
EmailUser=Email_account_name

Then copy and paste the rest of this:

echo -e "\n\nThe cpanel accounts username is $CpUser\nand the email account for the bayesian filter is $EmailUser@$DomainDotCom\n\n"
cd /home/$CpUser/.spamassassin/
echo -e "use_bayes 1\nbayes_auto_learn 1\nbayes_min_ham_num 50\nbayes_min_spam_num 50" >> user_prefs

Make the script:

echo '#!/bin/bash' >> /home/$CpUser/.spamassassin/spamassassin.sh
echo -e "\n#learning spam\n sa-learn --spam /home/$CpUser/mail/$DomainDotCom/$EmailUser/.spam/cur\n\n#clean out the spam\n# find /home/$CpUser/mail/$DomainDotCom/$EmailUser/.spam/cur/* -maxdepth 1 -type f -delete \n\n#learning safe mail\n sa-learn --ham /home/$CpUser/mail/$DomainDotCom/$EmailUser/.ham/cur" >> /home/$CpUser/.spamassassin/spamassassin.sh

Change perms and add cron:

chown $CpUser. /home/$CpUser/.spamassassin/spamassassin.sh
chmod +x /home/$CpUser/.spamassassin/spamassassin.sh
echo "00 1 * * * /home/$CpUser/.spamassassin/spamassassin.sh" >> /var/spool/cron/$CpUser
/etc/init.d/crond reload

spam assassin upgrades

spam assassin 3.3

spam assassin 3.4