Install rspamd and redis on DirectAdmin
Posted on December 8th, 2020
This is based on Centos8. Using epel-release, it may be possible to do the same changes on centos7.
Rspamd is a much faster anti spam system, that replaces spamassasin. Directadmin supports rspamd, however, custombuild does not install redis which is recommended for rspamd.
To start the install, first install redis via yum
yum install redis systemctl enable redis
Do not start redis yet. Next overwrite /etc/redis.conf with
bind 127.0.0.1 port 0 unixsocket /var/lib/redis/rspamd/rspamd.sock unixsocketperm 770 pidfile /var/run/redis/rspamd.pid logfile /var/log/redis/rspamd.log dir /var/lib/redis/rspamd/
Now create the db dir and set permissions
mkdir -p /var/lib/redis/rspamd/ chown redis:redis /var/lib/redis/rspamd/ systemctl start redis
Next using custombuild we will install rspamd.
cd /usr/local/directadmin/custombuild ./build update ./build set eximconf yes ./build set eximconf_release 4.5 ./build set blockcracking yes ./build set easy_spam_fighter yes ./build set spamd rspamd ./build set exim yes ./build exim ./build set dovecot_conf yes ./build dovecot_conf ./build rspamd ./build update ./build exim_conf
Redis must be enabled in rspamd. Create /etc/rspamd/local.d/redis.conf and add
servers = "/var/lib/redis/rspamd/rspamd.sock";
Verify the config and restart:
[root@wh local.d]# rspamadm configtest syntax OK [root@wh local.d]# systemctl restart rspamd
Rspamd is now enabled. Consider adding additional rules from MailBaby at https://github.com/mailbaby/rspamd-rules If you want to enable rspamd on new account set up please see https://help.directadmin.com/item.php?id=117 – there is additionally a way to enable rspamd on all accounts.