1

Topic: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

==========
Related forum topic: Tutorial for installing Pyzor2, Razor, dcc on Debian/Ubuntu
==========

I've noticed we have a tutorial for installing Pyzor2 and Razor on a Debian based distribution but not CentOS/RHEL, so here it goes smile

Open the following ports on your firewall

DCC port 6277 UDP
Razor2 port 2307 TCP
Pyzor port 24441 UDP

1. Setup required repositories

DAG Wieers RPMforge has the razor-agents and perl-Razor-Agent packages

For i386:

# rpm -Uvh http://rpmforge.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

For x86_64:

# rpm -Uvh http://rpmforge.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Atomic Rocket Turtle has the latest version of pyzor

# wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

Note. If you wish to disable the atomic repository after using it, simply edit /etc/yum.repos.d/atomic.repo and change enabled = 1 to enable = 0 in [atomic] section

2. Install the packages

# yum install pyzor razor-agents

3. Perform the following

# chmod -R a+rX /usr/share/doc/pyzor-0.5.0 /usr/bin/pyzor /usr/bin/pyzord
# chmod -R a+rX /usr/lib/python2.4/site-packages/pyzor
# mkdir /var/spool/amavisd
# chown amavis:amavis /var/spool/amavisd
# su -m amavis -c 'pyzor --homedir /var/spool/amavisd discover'
# su -m amavis -c 'razor-admin -home=/var/spool/amavisd -create'
# su -m amavis -c 'razor-admin -home=/var/spool/amavisd -register'

4. Install DCC

# cd /tmp
# wget http://www.dcc-servers.net/dcc/source/dcc-dccproc.tar.Z
# tar xzvf dcc-dccproc.tar.Z
# cd dcc-dccproc-1.3.103
# ./configure --with-uid=amavis
# make
# make install
# chown -R amavis:amavis /var/dcc
# ln -s /var/dcc/libexec/dccifd /usr/local/bin/dccifd

Note. You can ignore the sendmail build error's you see when you run ./configure --with-uid=amavis

5. Modify Spamassassin

Add the following to /etc/mail/spamassassin/local.cf

# dcc
use_dcc 1
dcc_home /var/dcc
dcc_path /usr/local/bin/dccproc
dcc_timeout     10
add_header all  DCC _DCCB_: _DCCR_

# pyzor
use_pyzor 1
pyzor_path /usr/bin/pyzor

# razor
use_razor2 1
razor_config /var/spool/amavisd/razor-agent.conf

score RAZOR2_CHECK 2.500
score PYZOR_CHECK 2.500
score DCC_CHECK 4.000

Enable the DCC plugin in /etc/mail/spamassassin/v310.pre

# DCC - perform DCC message checks.
#
# DCC is disabled here because it is not open source.  See the DCC
# license for more details.
#
loadplugin Mail::SpamAssassin::Plugin::DCC

Check your Spamassassin configuration

# spamassassin --lint

It shouldn't show any errors.

6. Restart Amavid and test away

# service amavisd restart

testing commands

# spamassassin -t -D razor2 < /usr/share/doc/spamassassin-3.2.5/sample-spam.txt
# spamassassin -t -D pyzor < /usr/share/doc/spamassassin-3.2.5/sample-spam.txt
# cdcc info

2

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Great big_smile i will upgrade my tutorial to include DCC big_smile thx man !

3

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

I installed it successfully!!

I have added these line in /etc/sysconfig/iptables to open the ports

# DDC, Razor2. Pyzor
-A INPUT -p tcp --dport 2307 -j ACCEPT
-A INPUT -p udp -m multiport --dport 6277,24441 -j ACCEPT


Thank you so much

4

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Error log as follow.
and the ports tcp2307 udp6277 24441 do not opened.

Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: pyzor: opening pipe: /usr/bin/pyzor check < /var/amavis/tmp/.spamassassin32974VDQB1tmp
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[5109]: (03297-16) SA dbg: util: setuid: ruid=102 euid=102
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: pyzor: [5109] finished: exit=0x0100
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: pyzor: got response: No servers available! Maybe try the 'discover' command
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: info: leaving helper-app run mode
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: pyzor: failure to parse response "No servers available! Maybe try the 'discover' command"
Aug 25 15:07:38 xxx.com.cn /usr/sbin/amavisd[3297]: (03297-16) SA dbg: dcc: dccifd is not available: no r/w dccifd socket found

5 (edited by sdaniel 2010-08-26 08:41:46)

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Sample of the [ SPAM ] mail's header as follow.

X-Spam-Status: Yes, score=24.431 tagged_above=2 required=6.2
tests=[
BAYES_99=3.5,
DCC_CHECK=4,
DIGEST_MULTIPLE=0.001,
FORGED_MUA_OUTLOOK=3.116,
HTML_IMAGE_ONLY_08=1.787,
HTML_MESSAGE=0.001, INVALID_MSGID=1.9,
MIME_BASE64_TEXT=1.753,
MIME_HTML_MOSTLY=0.001,
MPART_ALT_DIFF=0.739,
RAZOR2_CF_RANGE_51_100=0.5,
RAZOR2_CF_RANGE_E8_51_100=1.5,
RAZOR2_CHECK=2.5,
RCVD_IN_XBL=3.033,
RDNS_NONE=0.1
] autolearn=spam

X-Spam-Status: Yes, score=8.039 tagged_above=2 required=6.2
tests=[
BAYES_50=0.001,
DCC_CHECK=4,
RCVD_IN_PBL=0.905,
RCVD_IN_XBL=3.033,
RDNS_NONE=0.1
] autolearn=no

X-Spam-Status: Yes, score=10.895 tagged_above=2 required=6.2
tests=[
BAYES_99=3.5,
EXTRA_MPART_TYPE=1,
HTML_IMAGE_ONLY_04=2.041,
HTML_MESSAGE=0.001,
MIME_BASE64_TEXT=1.753,
PYZOR_CHECK=2.5,
RDNS_NONE=0.1
] autolearn=no

6 (edited by sdaniel 2010-08-26 08:43:37)

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

It works !!!

Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: part=0 engine=4 contested=0 confidence=0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: part=1 engine=4 contested=0 confidence=0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: part=1 engine=8 contested=0 confidence=0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: results: spam? 0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: results: engine 8, highest cf score: 0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: razor2: results: engine 4, highest cf score: 0
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: pyzor: pyzor is available: /usr/bin/pyzor
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: info: entering helper-app run mode
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: pyzor: opening pipe: /usr/bin/pyzor check < /var/amavis/tmp/.spamassassin17932plptCJtmp
Aug 26 08:29:10 xxx.com.cn /usr/sbin/amavisd[18598]: (17932-12) SA dbg: util: setuid: ruid=102 euid=102
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: pyzor: [18598] finished: exit=0x0100
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: pyzor: got response: public.pyzor.org:24441 (200, 'OK') 0 0
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: info: leaving helper-app run mode
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: dcc: dccifd is available: /var/dcc/dccifd
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: info: entering helper-app run mode
Aug 26 08:29:11 xxx.com.cn /usr/sbin/amavisd[17932]: (17932-12) SA dbg: dcc: dccifd got response: X-DCC-INFN-TO-Metrics: xxx.com.cn 1233; Body=1 Fuz1=1 Fuz2=1

It do not need the iptable for INPUT.  the server only can connect the other server's ports tcp2307 udp 6277 24441.
# DDC, Razor2. Pyzor
-A INPUT -p tcp --dport 2307 -j ACCEPT
-A INPUT -p udp -m multiport --dport 6277,24441 -j ACCEPT

I saw the reference site: http://www.freespamfilter.org/FC4.html#_Toc110999211

7 (edited by bp1 2010-10-04 01:02:28)

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Just a quick note... the configure line in step 4: Install DCC failed for me because I didn't have gcc (a compiler) installed.

You might want to add a line:

yum install gcc

To make sure gcc + dependents are installed.

Thanks for a great tutorial!

8 (edited by OviVan 2011-12-29 07:51:29)

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Hi folks,

can this tutorial still be used ? any changes ? or I can just go ahead and install/configure it ?
i am asking because I saw that configuration tutorial was posted in 2009 ...

Thank You

9

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

iRedMail 0.7.4 appears to have Razor2 already, I am seeing it in the SA headers.  Trying to install Razor2 as the instructions say, fails on a perl dependency issue with the iRedmail repository.

Does it have DCC and Pyzor?  Anybody have success?

10

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

Hi copart,

iRedMail doesn't install Razor2 explicitly, it could be installed automatically as a software dependence. So iRedMail doesn't configure it by default.

Any error message of failed package installation?

11 (edited by copart 2012-01-22 20:37:44)

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

[root@ ~]# yum install --enablerepo=rpmforge razor-agents
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.aol.com
* extras: centos.aol.com
* rpmforge: ftp-stud.fht-esslingen.de
* updates: mirror.ash.fastserv.com
base                                                                           | 3.7 kB     00:00     
extras                                                                         | 3.5 kB     00:00     
iRedMail                                                                       |  951 B     00:00     
rpmforge                                                                       | 1.1 kB     00:00     
updates                                                                        | 3.5 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package razor-agents.i686 0:2.84-1.el6.rf will be installed
--> Processing Dependency: perl-Razor-Agent = 2.84-1.el6.rf for package: razor-agents-2.84-1.el6.rf.i686
--> Finished Dependency Resolution
Error: Package: razor-agents-2.84-1.el6.rf.i686 (rpmforge)
           Requires: perl-Razor-Agent = 2.84-1.el6.rf
           Installed: perl-Razor-Agent-2.85-6.el6.i686 (@iRedMail)
               perl-Razor-Agent = 2.85-6.el6

           Available: perl-Razor-Agent-2.84-1.el6.rf.i686 (rpmforge)
               perl-Razor-Agent = 2.84-1.el6.rf
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Above is the error when I try to install the razor agent (CentOS 6.2).  However, as I mentioned before, here is one example of a Razor2 hit:
Yes, score=19.407 tag=-9000 tag2=5 kill=15 tests=[HTML_IMAGE_ONLY_24=1.282, HTML_IMAGE_RATIO_02=0.805, HTML_MESSAGE=0.001, HTML_MIME_NO_HTML_TAG=0.635, HTML_SHORT_LINK_IMG_3=0.328, MIME_HTML_ONLY=1.105, RAZOR2_CF_RANGE_51_100=1, RAZOR2_CF_RANGE_E8_51_100=2, RAZOR2_CHECK=3, RCVD_IN_BRBL_LASTEXT=1.644, RDNS_NONE=1.274, TO_NO_BRKTS_DIRECT=2.457, TO_NO_BRKTS_NORDNS_HTML=0.001, URIBL_BLACK=1.775, URIBL_DBL_SPAM=1.7, URIBL_WS_SURBL=0.4] autolearn=spam

In addition I check for settings that usually do get set up, so not sure where razor2 comes in, perhaps it is now built into spamassasin by default:
[root@ ~]# grep razor /etc/mail/spamassassin/local.cf
[root@ ~]# ls -la /var/spool/amavisd/razor-agent.conf
ls: cannot access /var/spool/amavisd/razor-agent.conf: No such file or directory

12

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

rpmforge repo has new version of perl-Razor-Agent, you can try below command instead:

# yum update --enablerepo=rpmforge perl-Razor-Agent

Then try original command again:

# yum install --enablerepo=rpmforge razor-agents

13

Re: Install Pyzor, Razor2 and DCC on your CentOS/RHEL iRedMail Server

This worked for me:
  yum --enablerepo=rpmforge downgrade perl-Razor-Agent