Computer Tips - Setup SpamAssassin for Postfix on RedHat/Fedora/CentOS

Date: 2019sep24 OS: Linux Distro: RedHat/Fedora/CentOS Q. Setup SpamAssassin for Postfix on RedHat/Fedora/CentOS A. Install it. Like this:
# dnf install spamassassin
Tweak the configuration. Make a user for it to run as.
# useradd spamd # chsh -s /sbin/nologin spamd
Modify the config file (/etc/sysconfig/spamassassin) so it runs as this user:
SPAMDOPTIONS="-u spamd ...." ^^^^^^^^ insert this
Do not add -d (for demonize) since that messes with systemd Review /usr/share/spamassassin/local.cf If you don't like any settings overide them in /etc/mail/spamassassin/local.cf You don't need to put very much in there, the defaults are fine. I have File /etc/mail/spamassassin/local.cf
report_safe 0 rewrite_header Subject [SPAM score _SCORE_] required_score 5
Make it run all the time:
# systemctl enable spamassassin
Start it:
# systemctl start spamassassin
Now the SpamAssassin daemon is up and running. Add it to Postfix, in /etc/postfix/master.cf
smtp inet n - n - - 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}
Restart postfix
# systemctl restart postfix
Do some tests!