Hi, there is how to configure Spamassassin + CWP's mail server.

NOTE: You should enable Anti-SPAM from CWP.admin under MailServer Manager.

* Please note that these changes can disable ClamAV protection and Dovecot rules or custom filters.

First, we have to edit Postifx and SpamAssassin configs.
The /etc/postfix/master.cf has few variants at the time (january 2019)
a) mail server built without ClamAV+SA+Amavis (you must install SpamAssassin manually)

smtp      inet  n       -       n       -       -       smtpd
#  -o content_filter=smtp-amavis:127.0.0.1:10024
#  -o receive_override_options=no_address_mappings

b) mail server built with ClamAV+SA+Amavis

smtp inet n - n - - smtpd -o content_filter=smtp-amavis:127.0.0.1:10024 -o receive_override_options=no_address_mappings

So, there must be added the line below (do NOT forget about two spaces before -o:

  -o content_filter=spamassassin

You must get the one of options below:

a)
smtp      inet  n       -       n       -       -       smtpd
#  -o content_filter=smtp-amavis:127.0.0.1:10024
#  -o receive_override_options=no_address_mappings
  -o content_filter=spamassassin
b)
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=smtp-amavis:127.0.0.1:10024
  -o receive_override_options=no_address_mappings
  -o content_filter=spamassassin

Once it done you have to add the lines below at the bottom /etc/postfix/master.cf

spamassassin      unix -      n      n      -      -      pipe
  user=nobody argv=/usr/bin/spamc -f -e
  /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Next, we have to edit /etc/sysconfig/spamassassin with the code below:

SAHOME="/var/lib/spamassassin/"
SPAMDOPTIONS="-d -c -m5 -u nobody -s ${SAHOME}spamd.log"

Options there:
-d Detach from starting process and run in background (daemonize).
-c Create user preferences files if they don't exist.
-C Set config path.
-m This option specifies the maximum number of children to spawn.
-u Run as the named user.
-s Specify the syslog facility

(do not forget to check if /var/lib/spamassassin/ owned by nobody).

Configure /usr/share/spamassassin/local.cf with default options below:

rewrite_header Subject *****SPAM*****
# report_safe 1
# trusted_networks 212.17.35.
required_score 5.0
use_bayes 1
bayes_auto_learn 1
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
include /usr/share/spamassassin/

Configuration is complete.


sa-update
systemctl restart postfix spamassassin