
Automasscheck is a way to train official SpamAssassin RuleQA
when channel updates, scores are calculated considering also your samples
this helps all community and you to have more accurate scores and hits
( These instruction are adapted to EFA box and extracted from official page 
  https://wiki.apache.org/spamassassin/NightlyMassCheck )
These steps are about installation into an EFA box and are referred to use with root user


---
*1* Send an email to private@spamassassin.apache.org requesting an rsync account for nightly mass-checks
---


---
*2* Create folder and point to it
---
mkdir /automasscheck; chmod 755 /automasscheck; cd /automasscheck


---
*3* Create workfolder
---
mkdir /automasscheck/wrk; chmod 755 /automasscheck/wrk


---
*4* Download software (you must be in /automasscheck)
---
wget https://svn.apache.org/repos/asf/spamassassin/trunk/masses/contrib/automasscheck-minimal/automasscheck-minimal.sh
wget https://svn.apache.org/repos/asf/spamassassin/trunk/masses/contrib/automasscheck-minimal/automasscheck-minimal.cf.dist -o .automasscheck-minimal.cf


---
*5* Edit /automasscheck/.automasscheck-minimal.cf with these data
---
LOGPREFIX="<rsync user that received from email>"
RSYNC_USERNAME="<rsync user that received from email>"
RSYNC_PASSWORD="<rsync password that received from email>"
WORKDIR=/automasscheck/wrk
TRUSTED_NETWORKS="10.1.0.0/16 192.168.2.0/24"   (these are examples, you need to change relating your network)
INTERNAL_NETWORKS="10.1.0.0/16 192.168.2.0/24"  (these are examples, you need to change relating your network)
run_all_masschecks() {
  ### sample: single corpus ###
  run_masscheck single-corpus --all \
          --after=-174182400 ham:dir:/automasscheck/ham/ \
          --after=-4838400 spam:dir:/automasscheck/spam/
(Doing so program is instructed to use folders that not exists, this is intentionally because EFA have ham & spam 
 folders classified by days, i decided to stay these params fixed in the script and make a hardlink before running
 that point to previous day emails)


---
*6* Create file /automasscheck/automasscheck.efa.run.sh whith this code (verifying your paths) :
---
# automasscheck.efa.run.sh
# ------------------------
# Run automasscheck-minimal.sh into EFA environment to train spamassassin community about our scores

# Mail archive paths
VPATH=/var/spool/MailScanner/quarantine
VHAM=nonspam
VSPAM=spam

cd /automasscheck

# Generate yesterday foldername
YDT="$(date "+%Y%m%d" -d "$DAYS days ago")"
echo $YDT;sleep 1

# Changing symbolyc link that point at yesterday mails
rm -f /automasscheck/ham;rm -f /automasscheck/spam
ln -s $VPATH/$YDT/$VHAM /automasscheck/ham;ln -s $VPATH/$YDT/$VSPAM /automasscheck/spam;sleep 1

# Copying local configuration file in root folder
# so you can mantain it in /automasscheck folder
# (Official script use that is in /root folder)
cp -f /automasscheck/.automasscheck.cf /root;sleep 1

# Launching process on yesterday emails
/automasscheck/automasscheck-minimal.sh;sleep 1


---
*7* Chmod 755 /automasscheck/automasscheck.efa.run.sh
---
chmod 755 /automasscheck/automasscheck.efa.run.sh


---
*8* Put in crontab daily (in Italy I put at 11.30 CEST)
---
# Daily AutoMassCheck, train community about our scores
# This helps to have updates with scores more accurate
30 11 * * * /automasscheck/automasscheck.efa.run.sh


---
*9* Watch your data in community site
--- 
https://ruleqa.spamassassin.org/
(You can watch sis site and see that your data are loaded in it after some hours from latest run)









https://ruleqa.spamassassin.org/
