tech

AWS Lightsail: Ubuntu 16: Spamassasin

sudo apt-get install spamassassin spamc

sudo groupadd spamd
sudo useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
sudo mkdir /var/log/spamassassin
sudo chown spamd:spamd /var/log/spamassassin
sudo vim /etc/default/spamassassin
ENABLED=1
SAHOME="/var/log/spamassassin/"
OPTIONS="--create-prefs --max-children 5 --helper-home-dir --username spamd -s /var/log/spamassassin/spamd.log"
CRON=1
sudo vim /etc/postfix/master.cf
smtp      inet  n       -       y       -       -       smtpd -o content_filter=spamassassin
spamassassin unix -     n       n       -       -       pipe
  user=spamd argv=/usr/bin/spamc -f -e  
  /usr/sbin/sendmail -oi -f ${sender} ${recipient}
sudo vim /etc/spamassassin/local.cf
rewrite_header Subject [***** SPAM _SCORE_ *****]
#default 5.0, 4.0 more strict
required_score 4.0
use_bayes               1
bayes_auto_learn        1
sudo service postfix restart
sudo service dovecot restart
sudo service spamassassin restart
sudo service postfix status
sudo service dovecot status
sudo service spamassassin status

sudo vim /var/log/spamassassin/spamd.log
Send mail with body to test spam filter:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
Spamassasin not starting with reboot:
sudo systemctl status spamassassin.service
sudo systemctl enable spamassassin.service

sudo vim /lib/systemd/system/spamassassin.service
[Service]
Restart=always
RestartSec=3

Leave a Reply

Your email address will not be published. Required fields are marked *