Skip to content

rspamd

Create IP based whitelist

In /etc/rspamd/local.d/multimap.conf (create this file if it is missing) add the following:

IP_WHITELIST {
  type = "ip";
  prefilter = true;
  map = "${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
  action = "accept";
}

In /etc/rspamd/local.d add the IP addresses as list, for example:

127.0.0.1
10.0.0.3
192.168.10.5

Also see: https://rspamd.com/doc/modules/multimap.html

Add Pyzor integration

Pyzor is a bulk email scanner similar to Razor2 and DCC, which doesn’t identify spam but instead identifies how often a message (hash) has been seen or how "bulky" a message is.

sudo apt install pyzor

sudo nano /etc/rspamd/local.d/external_services.conf

pyzor {
  # default pyzor settings
  servers = "localhost:5953"
}

sudo systemctl edit --force --full pyzor.socket

[Unit]
Description=Pyzor socket

[Socket]
ListenStream=127.0.0.1:5953
ListenStream=[::1]:5953
Accept=yes

[Install]
WantedBy=sockets.target

sudo systemctl edit --force --full pyzor@.service

[Unit]
Description=Pyzor Socket Service
Requires=pyzor.socket

[Service]
Type=simple
ExecStart=-/usr/bin/pyzor check
StandardInput=socket
StandardError=journal
TimeoutStopSec=10

User=_rspamd
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
PrivateUsers=true
ProtectControlGroups=true
ProtectHome=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict

[Install]
WantedBy=multi-user.target

sudo -u _rspamd mkdir /var/lib/rspamd/.pyzor

sudo systemctl enable pyzor.socket --now