-
Access the leader node through SSH.
-
Launch a shell in the rspamd container.
sudo runagent -m mail1 podman exec -ti rspamd sh
-
Create the directory “dynamic” in /var/lib/rspamd, if it does not exist.
mkdir /var/lib/rspamd/dynamic
-
Create the file multimap.conf in /var/lib/rspamd/dynamic.
vi /var/lib/rspamd/dynamic/multimap.conf
-
Insert the following content into the file multimap.conf. Save & Exit.
BLOCK_SENDER_FROM_TLD { type = "from"; filter = 'email:domain:tld'; symbol = "BLOCK_SENDER_FROM_TLD"; prefilter = true; map = ["${DBDIR}/local_bl_from_tld.map.inc"]; regexp = true; description = "TLD from Blacklist"; action = "reject"; message = "Sender Domain REJECTED"; } BLOCK_SENDER_FROM { type = "header"; header = "from"; filter = 'email'; symbol = "BLOCK_SENDER_FROM"; map = ["${DBDIR}/local_bl_from.map.inc"]; description = "Email Address from Blacklist"; action = "reject"; message = "Sender Email Address REJECTED"; }
-
Set the owner on the directory /var/lib/rspamd/dynamic to ‘rspamd’.
chown -R rspamd: /var/lib/rspamd/dynamic
-
Set the permissions on the directory /var/lib/rspamd/dynamic.
chmod -c 750 /var/lib/rspamd/dynamic
-
Create the file local_bl_from_tld.map.inc /var/lib/rspamd.
vi local_bl_from_tld.map.inc
-
Add the top-level domain(s) to blacklist in the file. Save & Exit.
[.]best
-
Create the file local_bl_from.map.inc in /var/lib/rspamd.
vi local_bl_from.map.inc
-
Add the email address(es) to blacklist in the file. Save & Exit.
info@publiclibrary.best
-
Set the owner on the files to ‘rspamd’.
chown rspamd: /var/lib/rspamd/local_bl_from_tld.map.inc
chown rspamd: /var/lib/rspamd/local_bl_from.map.inc -
Set the permissions on the files.
chmod -c 644 /var/lib/rspamd/local_bl_from_tld.map.inc
chmod -c 644 /var/lib/rspamd/local_bl_from.map.inc
-
Check the config of rspamd.
rspamadm configtest
If no errors, the result will be:syntax OK
-
Reload the rspamd config.
reload-config
-
Exit the container shell.
exit
-
Exit the SSH session.
exit
5 Likes
Hi Dominic,
Many thanks for your howto.
This addition is maybe handy
Herewith you can block spam by subject
Hopely all these setting willbe made standard in NS8 in the future and some options available in the ui
1 Like