[HOWTO] Installing DCC Plugin for SpamAssassin on Ubuntu 22.04

Here is a brief how-to on installing the DCC plugin to reduce spam when self-hosting mail on Ubuntu 22.04 LTS.

Background reading :

  1. Get the latest DCC source code and unzip it
sudo -i # unsafe, poor practice on my part
apt-get install ncompress
wget https://www.dcc-servers.net/dcc/source/dcc.tar.Z
tar xvfZ dcc.tar.Z
  1. Create a dcc user for it to run under
adduser --system --group --no-create-home --disabled-password --disabled-login dcc
  1. Run autoconf and get ready for compile
cd dcc-2.3.168
CFLAGS="-O2 -fstack-protector" DCC_CFLAGS="-O2 -fstack-protector" \
./configure --disable-sys-inst --disable-dccm \
  --homedir=/var/lib/dcc  --bindir=/usr/local/bin --with-uid=dcc
  1. Compile It
CFLAGS="-O2 -fstack-protector" DCC_CFLAGS="-O2 -fstack-protector" \
make -j2
  1. If that worked, install it
make install
  1. Edit /etc/spamassassin/local.cf and add
local.cf:dcc_path /usr/local/bin/dccproc
local.cf:dcc_home /var/lib/dcc
  1. Edit /etc/spamassassin/v310.pre and uncomment
loadplugin Mail::SpamAssassin::Plugin::DCC
  1. Reload and check
systemctl restart spamassassin.service
less /var/log/syslog
less /var/log/mail.log

Hint, you can hit G in less to get to the bottom and f to go into “tail” mode. Ctrl-C to exit so you can scroll up. Check these for a while to make sure there are no errors.