Help - Search - Members - Calendar
Full Version: [How to] Razor2
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
cyberlot
This is my first How to, I just did this on Ensim 4.0.3 with spamassassin 3.x upgrade already done. I copied the steps I used to get razor2 working, Next DCC

This does not report spam back to razor2 as the reporting tools are not installed, The only thing installed is the perl modules required for spamassassin to check the razor2 database ( to my knowledge )

1. Install razor2
Download the razor-agents file from http://razor.sourceforge.net, extract it to a temporary directory (/usr/local/src/razor-agents for this example), and install it as follows (replacing paths as necessary):
cd /usr/local/src/razor-agents
perl Makefile.PL
make
make test
make install
/usr/bin/razor-client
/usr/bin/razor-admin -register

2. Copy razor2 to ensim TEMPLATE
cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Razor2/ /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/

cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Razor2 /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/

Copy the same files to each site, someone could prob throw together a quick script for that

Login to one of your sites and run
spamassassin --lint -D

You should see a ton of new information, what your looking for is
Razor-Log: Computed razorhome from env: /home/cyberlot/.razor
Razor-Log: Found razorhome: /home/cyberlot/.razor
Razor-Log: No /home/cyberlot/.razor/razor-agent.conf found, skipping.
Razor-Log: No razor-agent.conf found, using defaults.

And near the end

Mar 07 09:51:18.768818 check[23253]: [ 7] method 4: mail 1.0: no-contention part, spam=0
Mar 07 09:51:18.768935 check[23253]: [ 7] method 4: mail 1: all non-contention parts not spam, mail not spam
Mar 07 09:51:18.769040 check[23253]: [ 3] mail 1 is not known spam.

No promise is made, No changes to any configs are made so there should be very low risk, spamassassin should just see the modules exist and use them

If you want to tweak the razor settings on a per user basis you will need to add

/home/USERNAME/.razor/razor-agent.conf
To the account in question

--- UPDATED 03/18/05 Ensims Spamassassin hotfix broke razor ---

The ensim upgrade moves some important perl modules, you will need to reinstall razor to get spamassassin working after the upgrade..
webexceed
QUOTE
Originally posted by cyberlot
2. Copy razor2 to ensim TEMPLATE
cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Razor2/ /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/

cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Razor2 /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/

Copy the same files to each site, someone could prob throw together a quick script for that


If you just run Ensim through maintenance and restart it, wouldn't that copy those files out of FILESYSTEMTEMPLATE to each site?
cyberlot
All the files in the FILESYSTEM directory are hard linked to each of the sites directorys so by editing or changing any "EXISTING" files all the sites are changed as well

When adding new files Ensim has to hard link them to copy them over, I did do the maintance restart and these new directorys where not hard linked back to each site.

This leads me to believe that ensim has a file/directory list somewhere that it checks for updates, if you add files not within that coverage they are not copied over..
webexceed
Hmm, that's interesting.

I don't have time this afternoon, but later if nobody else has whipped up a script to do the copying to the sites I'll post one. Should be pretty simple.
webexceed
OK I came up with this script, it's based on another one kicking around here somewhere by someone else.

Put it somewhere such as:

cd /root/stuff
vi add-razor
insert these lines and save the file
CODE
#!/bin/sh

for Domain in `/usr/local/bin/sitelookup -a site_handle`

do

echo "Copying Razor files to $Domain ..."

cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Razor2/ /home/virtual/$Domain/fst/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/

cp -ax /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Razor2 /home/virtual/$Domain/fst/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/

done

echo 'Done!'


save it.
then do a chmod u+x press enter
followed by ./add-razor press enter

It will go through each domain and copy the razor files.

2 things I noticed when following your howto. When I went to download razor I noticed the list of required modules, so I checked and was missing many of those modules, I installed them via cpan.

The other thing I noticed was it installed to /usr/bin instead of /usr/local/bin. Seems to work anyway from within spamassassin.

Let's hope this puts a large nail in the spam coffin. icon_biggrin.gif
cyberlot
Most of the other modules I installed when installing Spamassassin 3.0

Digest::Nilsimsa is the only module not on my system but razor still seems to be working ( spams have almost gone away )
maf
For those running a firewall such as KISS, make sure to open the correct ports for Razor2 to work as noted in the FAQ from the Razor2 site:

QUOTE
Q: I have a firewall. What ports do I need to open in order for
  Razor2 to work?

  Outgoing TCP port 2703 (Razor2) and TCP port 7 (Echo). Razor2
  uses TCP pings to discover what servers are closest to it.
pseconds
Just an interesting observation. I followed the directions on an Ensim 10.1 Box, I see the following when I do a spamassassin --lint -D from a client domain:

dbg: diag: module installed: Razor2::Client::Agent, version 2.82
dbg: config: read file /usr/share/spamassassin/25_razor2.cf
dbg: plugin: loading Mail::SpamAssassin::Plugin::Razor2 from @INC
dbg: razor2: local tests only, skipping Razor
dbg: plugin: registered Mail::SpamAssassin::Plugin::Razor2=HASH(0xa90c5a0)

I dig all over the place to find the settings for local test and gave up. Then I happened to look at the headers of some spam I got and saw:
X-Spam-Status: Yes, score=32.8 required=5.0 tests=BAYES_99,
DATE_IN_FUTURE_48_96,HTML_MESSAGE,RAZOR2_CF_RANGE_51_100,
RAZOR2_CF_RANGE_E4_51_100,RAZOR2_CF_RANGE_E8_51_100,RAZOR2_CHECK,
RCVD_IN_NJABL_DUL,RCVD_IN_SORBS_DUL,URIBL_AB_SURBL,URIBL_JP_SURBL,
URIBL_OB_SURBL,URIBL_SBL,URIBL_SC_SURBL,URIBL_WS_SURBL autolearn=spam
version=3.1.7


And also:
1.5 RAZOR2_CF_RANGE_E8_51_100 Razor2 gives engine 8 confidence level
* above 50%
* [cf: 100]
* 1.5 RAZOR2_CF_RANGE_E4_51_100 Razor2 gives engine 4 confidence level
* above 50%
* [cf: 100]
* 0.5 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/)
* 0.5 RAZOR2_CF_RANGE_51_100 Razor2 gives confidence level above 50%
* [cf: 100]


Soooo... it looks like Razor IS working. Is the diagnostic broken?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.