RelayCountry plugin doesn't add header

2007-01-02 Thread Nick Radov
I am running SpamAssassin 3.1.7 in serial mode on Windows 2003. I would 
like to use the RelayCountry plugin and have enabled it as described on 
this web page: http://wiki.apache.org/spamassassin/RelayCountryPlugin. 
But when I ran a test message through, the X-Relay-Countries header wasn't 
added. Can anyone suggest how to fix this?

The IP::Country::Fast module is installed. And here is a filtered excerpt 
from the SpamAssassin debugging output which seems to show the plugin is 
being loaded correctly. 

[18136] dbg: plugin: loading Mail::SpamAssassin::Plugin::RelayCountry from 
@INC
[18136] dbg: plugin: registered 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0)
[18136] dbg: plugin: 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0) implements 
'extract_metadata'
[18136] dbg: plugin: 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0) implements 
'parsed_metadata'

The particular test message that I used has this Received header.

Received: from 14.9.17.81.nexcom.ru ([81.17.9.14])
  by ax7.axolotl.com (Lotus Domino Release 7.0.2)
  with ESMTP id 2006122820563462-40926 ;
  Thu, 28 Dec 2006 20:56:34 -0800 

I did a manual whois lookup on IP address 81.17.9.14 and it is registered 
to Russia, so I think I should get a X-Relay-Countries: RU header. But 
it doesn't work.

Re: RelayCountry plugin doesn't add header

2007-01-02 Thread Alan Munday

Nick Radov wrote the following on 02/01/2007 18:35:
I am running SpamAssassin 3.1.7 in serial mode on Windows 2003. I would 
like to use the RelayCountry plugin and have enabled it as described on 
this web page: http://wiki.apache.org/spamassassin/RelayCountryPlugin. 
But when I ran a test message through, the X-Relay-Countries header wasn't 
added. Can anyone suggest how to fix this?


The IP::Country::Fast module is installed. And here is a filtered excerpt 
from the SpamAssassin debugging output which seems to show the plugin is 
being loaded correctly. 

[18136] dbg: plugin: loading Mail::SpamAssassin::Plugin::RelayCountry from 
@INC
[18136] dbg: plugin: registered 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0)
[18136] dbg: plugin: 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0) implements 
'extract_metadata'
[18136] dbg: plugin: 
Mail::SpamAssassin::Plugin::RelayCountry=HASH(0x29b40b0) implements 
'parsed_metadata'


The particular test message that I used has this Received header.

Received: from 14.9.17.81.nexcom.ru ([81.17.9.14])
  by ax7.axolotl.com (Lotus Domino Release 7.0.2)
  with ESMTP id 2006122820 http://www.snapanumber.com/563462-40926 ;
  Thu, 28 Dec 2006 20:56:34 -0800 

I did a manual whois lookup on IP address 81.17.9.14 and it is registered 
to Russia, so I think I should get a X-Relay-Countries: RU header. But 
it doesn't work.



If you just want a header added with the relay countries listed then you'll 
need to patch SA (3.1x) see the wiki (or review recent threads here).


Otherwise you need to specify in either local.cf or a dedicated conf file those 
countries you want to see in the headers and with which score.

To test these I wrote a simple script (I'm no programmer) below which writes 
Relay_Countries.cf which you can put in your spamassassin directory. You can 
enable/disable each entry by toggling the value of the 1st field and adjust the 
scores by amending the last field. You can then tweak to just track those 
countries you are interested in. I did include all the country codes as listed 
on the ISO site.

Alan




#! /bin/bash

echo start


# shopt -s -o xtrace


OUTPUT_FILE=Relay_Countries.cf
OUTPUT_DIR=.
#OUTPUT_DIR=/etc/mail/spamassassin


#
# Fields:  
#

USE=1   # yes=1, no=0
CODE=2  # Country Code
DESCRIPTION=3   # Description
SCORE=4 # Score

NUM_FIELDS=4

#
# Data:
#
COUNTRY[1]=1~AD~Andorra~0.001
COUNTRY[2]=1~AE~United Arab Emirates~0.001
COUNTRY[3]=1~AF~Afghanistan~0.001
COUNTRY[4]=1~AG~Antigua and Barbuda~0.001
COUNTRY[5]=1~AI~Anguilla~0.001
COUNTRY[6]=1~AL~Albania~0.001
COUNTRY[7]=1~AM~Armenia~0.001
COUNTRY[8]=1~AN~Netherlands Antilles~0.001
COUNTRY[9]=1~AO~Angola~0.001
COUNTRY[10]=1~AQ~Antarctica~0.001
COUNTRY[11]=1~AR~Argentina~0.001
COUNTRY[12]=1~AS~American Samoa~0.001
COUNTRY[13]=1~AT~Austria~0.001
COUNTRY[14]=1~AU~Australia~0.001
COUNTRY[15]=1~AW~Aruba~0.001
COUNTRY[16]=1~AX~Åland Islands~0.001
COUNTRY[17]=1~AZ~Azerbaijan~0.001
COUNTRY[18]=1~BA~Bosnia and Herzegovina~0.001
COUNTRY[19]=1~BB~Barbados~0.001
COUNTRY[20]=1~BD~Bangladesh~0.001
COUNTRY[21]=1~BE~Belgium~0.001
COUNTRY[22]=1~BF~Burkina Faso~0.001
COUNTRY[23]=1~BG~Bulgaria~0.001
COUNTRY[24]=1~BH~Bahrain~0.001
COUNTRY[25]=1~BI~Burundi~0.001
COUNTRY[26]=1~BJ~Benin~0.001
COUNTRY[27]=1~BM~Bermuda~0.001
COUNTRY[28]=1~BN~Brunei Darussalam~0.001
COUNTRY[29]=1~BO~Bolivia~0.001
COUNTRY[30]=1~BR~Brazil~0.001
COUNTRY[31]=1~BS~Bahamas~0.001
COUNTRY[32]=1~BT~Bhutan~0.001
COUNTRY[33]=1~BV~Bouvet Island~0.001
COUNTRY[34]=1~BW~Botswana~0.001
COUNTRY[35]=1~BY~Belarus~0.001
COUNTRY[36]=1~BZ~Belize~0.001
COUNTRY[37]=1~CA~Canada~0.001
COUNTRY[38]=1~CC~Cocos (Keeling) Islands~0.001
COUNTRY[39]=1~CD~Congo, the Democratic Republic of the~0.001
COUNTRY[40]=1~CF~Central African Republic~0.001
COUNTRY[41]=1~CG~Congo~0.001
COUNTRY[42]=1~CH~Switzerland~0.001
COUNTRY[43]=1~CI~Côte d'Ivoire~0.001
COUNTRY[44]=1~CK~Cook Islands~0.001
COUNTRY[45]=1~CL~Chile~0.001
COUNTRY[46]=1~CM~Cameroon~0.001
COUNTRY[47]=1~CN~China~0.001
COUNTRY[48]=1~CO~Colombia~0.001
COUNTRY[49]=1~CR~Costa Rica~0.001
COUNTRY[50]=1~CU~Cuba~0.001
COUNTRY[51]=1~CV~Cape Verde~0.001
COUNTRY[52]=1~CX~Christmas Island~0.001
COUNTRY[53]=1~CY~Cyprus~0.001
COUNTRY[54]=1~CZ~Czech Republic~0.001
COUNTRY[55]=1~DE~Germany~0.001
COUNTRY[56]=1~DJ~Djibouti~0.001
COUNTRY[57]=1~DK~Denmark~0.001
COUNTRY[58]=1~DM~Dominica~0.001
COUNTRY[59]=1~DO~Dominican Republic~0.001
COUNTRY[60]=1~DZ~Algeria~0.001
COUNTRY[61]=1~EC~Ecuador~0.001
COUNTRY[62]=1~EE~Estonia~0.001
COUNTRY[63]=1~EG~Egypt~0.001
COUNTRY[64]=1~EH~Western Sahara~0.001
COUNTRY[65]=1~ER~Eritrea~0.001
COUNTRY[66]=1~ES~Spain~0.001
COUNTRY[67]=1~ET~Ethiopia~0.001
COUNTRY[68]=1~FI~Finland~0.001
COUNTRY[69]=1~FJ~Fiji~0.001
COUNTRY[70]=1~FK~Falkland Islands (Malvinas)~0.001
COUNTRY[71]=1~FM~Micronesia, Federated States of~0.001
COUNTRY[72]=1~FO~Faroe Islands~0.001
COUNTRY[73]=1~FR~France~0.001
COUNTRY[74]=1~GA~Gabon~0.001
COUNTRY[75]=1~GB~United