Author Topic: Install Razor2 for Postfix/Dovecot Spam Filtering along with SpamAssassin  (Read 6001 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Vipul's Razor is a distributed, collaborative, spam detection and filtering network. The primary focus of the system is to identify and disable an email spam before its injection and processing is complete.

Open the following port in your firewall:
TCP 2703 Outgoing : Razor2

Razor Installation
Code: [Select]
# yum install pyzor perl-Razor-Agent
Create Razor Home Directory
Code: [Select]
# mkdir /etc/mail/spamassassin/.razor
Enable the Pyzor plugin
Code: [Select]
# vi /etc/mail/spamassassin/v310.pre
# Razor2 - perform Razor2 message checks.
#
loadplugin Mail::SpamAssassin::Plugin::Razor2

Add the following to /etc/mail/spamassassin/local.cf
Code: [Select]
# razor
use_razor2 1
razor_config /etc/mail/spamassassin/.razor/razor-agent.conf
score RAZOR2_CHECK 3.000

Restart
Code: [Select]
# systemctl restart spamassassin
Discover the Razor
Code: [Select]
# razor-admin -home=/etc/mail/spamassassin/.razor -register
# razor-admin -home=/etc/mail/spamassassin/.razor -create
# razor-admin -home=/etc/mail/spamassassin/.razor -discover

Define Home Directory, Edit /etc/mail/spamassassin/.razor/razor-agent.conf
Code: [Select]
#
# Razor2 config file
#
# Autogenerated by Razor-Agents v2.84
# Sat Feb 29 22:19:37 2020
# Non-default values taken from /etc/mail/spamassassin/.razor/razor-agent.conf
#
# see razor-agent.conf(5) man page
#

debuglevel             = 3
identity               = identity
ignorelist             = 0
listfile_catalogue     = servers.catalogue.lst
listfile_discovery     = servers.discovery.lst
listfile_nomination    = servers.nomination.lst
logfile                = razor-agent.log
logic_method           = 4
min_cf                 = ac
razordiscovery         = discovery.razor.cloudmark.com
razorhome              = /etc/mail/spamassassin/.razor
rediscovery_wait       = 172800
report_headers         = 1
turn_off_discovery     = 0
use_engines            = 4,8
whitelist              = razor-whitelist

Test
Code: [Select]
# spamassassin -t -D razor2 < /usr/share/doc/spamassassin-3.4.0/sample-spam.txt

Check the packages
Code: [Select]
# rpm -qa | grep Razor
# rpm -qa | grep pyzor
# rpm -qa | grep DCC


Offline
*****
Updated directions for AlmaLinux 8/9
« Reply #1 on: June 18, 2026, 12:54:41 AM »
An update on this, since I noticed SpamAssassin's status shows a Razor error on the default CWP install. Plus, many users are crying out due to the deluge of spam they are facing. So I gave these instructions a whirl. Just a few updates to note:

With AlmaLinux 8, you only need to install pyzor:
Code: [Select]
dnf install pyzorAdd 2703 to TCP_OUT in
Code: [Select]
/etc/csf/csf.conf, then issue
Code: [Select]
csf -r to restart the firewall.

You don't need to enable the Pyzor plugin in
Code: [Select]
/etc/mail/spamassassin/v310.pre -- it is already enabled.

The only other change in the directions is that you should create the razor-agent.conf file BEFORE restarting SpamAssassin
Code: [Select]
/etc/mail/spamassassin/.razor/razor-agent.conf
To test Razor with the GTUBE (Generic Test for Unsolicited Bulk Email) test:
Code: [Select]
spamassassin -t -D razor2 < /usr/share/doc/spamassassin/sample-spam.txt