libspamass.so library

Hi,

I'm using Messaging Server version 6.2-6.01.

I need to integrate it with SpamAssassin (version 3.1.3).

I have noticed that some functions (e.g. adding header to e-mail) are done in different way while using spamc client and libspamass.so library.

Libspamass.so library is part of Messaging Server and it is used instead of spamc- SpamAssassin client.

I wonder if libspamass.so version in MS 6.2-6.01 is proper for SpamAssassin version 3.1.3.

Is it possible to download other version of libspamass.so library?

What version of SpamAssassin is supported by Messaging Server version 6.2-6.01?

Best regards,

e2rd

[673 byte] By [e2rd] at [2007-11-26 9:55:59]
# 1

You can use any version of SA with the standard libspamass.so provided with Messaging Server.

I have used versions from 2.64 through 3.1 on my system, with no change in Messaing Server. I anticpate upgrading to the current SA, when I have time to install it....

The reason things are done somewhat differently with our integration is due to scaling and performance reasons.

If you're running a server where people get many messages addressed to multiple users, then it's important to sent one copy of such a message to SA, rather than the potentially hundreds of copies. That's why our integration sends messages out to process before address expansion is done. We also don't sent the message to SA, and then accept it back. Instead, we send the message to SA, and only accept the results back. Messaging keeps the message, and adds the header as configured instead.....

jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 2

Hi,

I give you an example.

My locaf.cf file contains:

# This is the right place to customize your installation of SpamAssassin.

#

# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be

# tweaked.

#

# Only a small subset of options are listed below

#

###########################################################################

#Add *****SPAM***** to the Subject header of spam e-mails

#

rewrite_header Subject *****SPAM(_SCORE_)*****

rewrite_subject 1

fold_headers 1

#Save spam messages as a message/rfc822 MIME attachment instead of

#modifying the original message (0: off, 2: use text/plain instead)

#

report_safe 0

add_header spam Flag _YESNOCAPS_

add_header all Status _YESNO_, hits=_HITS_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_

add_header all Level _STARS(*)_

add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_

#Set which networks or hosts are considered 'trusted' by your mail

#server (i.e. not spammers)

#

# trusted_networks 212.17.35.

#Set file-locking method (flock is not safe over NFS, but is faster)

#

# lock_method flock

#Set the threshold at which a message is considered spam (default: 5.0)

#

required_score 6.0

#Use Bayesian classifier (default: 1)

#

# use_bayes 1

#Bayesian classifier auto-learning (default: 1)

#

# bayes_auto_learn 1

#Set headers which may provide inappropriate cues to the Bayesian

#classifier

#

# bayes_ignore_header X-Bogosity

# bayes_ignore_header X-Spam-Flag

# bayes_ignore_header X-Spam-Status

-

If I run spamc < test.msg I get the return:

X-Spam-Flag: YES

X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on et.era.isp

X-Spam-Level: **************************************************

X-Spam-Status: Yes, hits=1000.0 required=6.0 tests=GTUBE,NO_RECEIVED,

NO_RELAYS autolearn=no version=3.1.3

X-Spam-Report:

* -0.0 NO_RELAYS Informational: message was not relayed via SMTP

* 1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email

* -0.0 NO_RECEIVED Informational: message has no Received headers

Subject: *****SPAM(1000.0)***** Test spam mail (GTUBE)

Message-ID: <GTUBE1.1010101@example.net>

Date: Wed, 23 Jul 2003 23:30:00 +0200

From: Sender <test112@test.com>

To: Recipient <608646171@eranet.pl>

X-Spam-Prev-Subject: Test spam mail (GTUBE)

This is the GTUBE, the

Generic

Test for

Unsolicited

Bulk

Email

If your spam filter supports it, the GTUBE provides a test by which you

can verify that the filter is installed correctly and is detecting incoming

spam. You can send yourself a test mail containing the following string of

characters (in upper case and with no white spaces and line breaks):

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

-

But if I send an e-mail using Messaging Server (with libspamass.so) then this e-mail doesn't contain X-Spam headers:

Return-path: <test111@test.com>

Received: from test111 ([192.168.90.37])

by et.era.isp (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006))

with SMTP id <0J5500I30SLTSA00@et.era.isp> for 608646171@eranet.pl; Wed,

06 Sep 2006 08:59:38 +0200 (CEST)

Date: Wed, 06 Sep 2006 08:58:33 +0200 (CEST)

Date-warning: Date header was inserted by et.era.isp

From: test111@test.com

Subject: Test spam mail (GTUBE)

Bcc:

Message-id: <0J5500I31SNSSA00@et.era.isp>

Original-recipient: rfc822;608646171@eranet.pl

Spam-test: True ; 998.9 / 6.0

This is the GTUBE, the

Generic

Test for

Unsolicited

Bulk

Email

If your spam filter supports it, the GTUBE provides a test by which you

can verify that the filter is installed correctly and is detecting incoming

spam. You can send yourself a test mail containing the following string of

characters (in upper case and with no white spaces and line breaks):

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

-

Spam-test header is added using Sieve rule.

What I need to configure to implement adding X-Spam headers (especiallly X-Spam-Level) to all e-mails received by Messaging Server?

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 3

Um, I feel like you didn't read what I typed yesterday.

No SA settings will actually change any headers in your messages. The reason is that SA doesn't "give" the message back to Messaging Server after processing, all it gives back is "spam or notspam".

You have to configure Messaging Server to add the header, per the documentation. Your local.cf is of no interest to me, and nothing you put in there will cause Messaging Server to add any headers.

jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 4

Hi,

Is it possible to configure Messaging Server to add header like X-Spam-Level or header containing SA score only (integer)?

I need do configure filters (Sieve rules) to read the score.

I don't know how to read it from header like:

Spam-test: True ; 998.9 / 6.0

Could you give me some exemplary Sieve rule that reads the SA score?

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 5

Yes, it's possible. See documentation:

http://docs.sun.com/app/docs/doc/819-2650/6n4u4dtra?a=view#bgatg

specifically, look at the "mode" option, where you can get SA to return a result string. Then look at:

http://docs.sun.com/app/docs/doc/819-2650/6n4u4dtrc?a=view

support for Sieve, with examples.

jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 6

Hi,

I need to configure a Sieve filter in LDAP mailSieveRuleSource entry that reads the SpamAssassin score and makes some action (fileinto, discard) based on it.

At first i try to add a filter in my option.dat file.

I have the entry:

spamfilter1_string_action=data:,require ["spamtest", "relational", "comparator-i;ascii-numeric", "fileinto"]; if spamtest :value "ge" :comparator "i;ascii-numeric" "0" {fileinfo "spam";};

but it doesn't work.

Do you know what is wrong with it?

I prefer to have a header like X-Spam-Level (number of '*' means SA score) in every e-mail tested by SpamAssassin.

It would be simple to test it with Sieve filter in LDAP mailSieveRuleSource entry.

Alternatively I could have a header that contains a score in integer format (but not whole verdict string).

How to configure a Sieve filter in option.dat file to get a header like that.

Could you give some exemplary entry?

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 7

I don't quite understand.

Sieve filters don't "get a header". Messaging will add headers based on SA results, if you configure it based on the documentation I posted earlier. Have you read this, and tried it? Do you get the headers? You have to take these things one step at a time. Until you get headers, you can't filter them with Sieve. I can't tell how far you got.

jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 8

I can only add a header like:

Spam-test: True ; 7.3 / 5.0

using such entry in option.dat file:

spamfilter1_string_action=data:,require ["addheader"];addheader "Spam-test: $U";

But I don't know how to read the score from it in LDAP mailSieveRuleSource entry.

I can't add header like X-Spam-Level or header that contains the score only.

Could you give me an exemplary entry in option.dat that adds such headers?

Or could you write how to test the score in header that contains the whole result string (e.g. Spam-test: True ; 7.3 / 5.0) - exemplary Sieve rule, please.

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 9
What's wrong with reading the Spam-test for results? You should be able to parse that for the 7.3/5.0 results, and make your decision, based on that.
jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 10

Hi,

I have successfully configured Sieve filter that reads SA score.

The reason of my problem was a misprint in the documentation you sent me.

The exemplary Sieve script is:

spamfilter1_string_action=require ["spamtest", "relational", \

"comparator-i;ascii-numeric", "fileinto"];\

if anyof (address :matches "from" ["*@siroe.com",\

"*@*.siroe.com"]) \

{keep;} \

elsif spamtest :value "ge" :comparator "i;ascii-numeric" "8" \

{discard;}\

elsif spamtest :value "ge" :comparator "i;ascii-numeric" "5" \

{fileinfo "spam-likely";}\

else \

{keep;}

There is "fileinfo" instead of "fileinto".

Please correct that to avoid problems like mine in the future.

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 11
A doc bug has been filed. This should be fixed with the release of the next version.
jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 12

Hi,

My Sieve filter still doesn't work correct.

I have such filter in LDAP mailSieveRuleSource entry:

require ["spamtest", "relational", "comparator-i;ascii-numeric", "fileinto"]; if (spamtest :value "gt" :comparator "i;ascii-numeric" "5"){fileinto "spam";}

Every message tested by SpamAssassin has a header like:

Spam-test: True ; 7.3 / 5.0

The condition in my filter is always false, even if the SA score is greater than 5.

It is true if I change the condition to: spamtest :value "eq" :comparator "i;ascii-numeric" "0".

That means filter could not determine whether any test was done.

Why my filter doesn't read correct the SA score from message header?

What should be the correct format/name of header?

How to add such header to every message tested by SA?

Best regards,

e2rd

e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 13

require ["spamtest", "relational", "comparator-i;ascii-numeric", "fileinto"]; if (spamtest :value "gt" :comparator "i;ascii-numeric" "5"){fileinto "spam";}

Every message tested by SpamAssassin has a header like:

Spam-test: True ; 7.3 / 5.0

Hm. "spamtest" does not equal "Spam-test".

jay_plesset at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 14
Changing the header's name doesn't help.What else could be wrong?
e2rd at 2007-7-7 1:17:32 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 15
I'm truly sorry, I am not a programmer. I gave that up 20 years ago.I used exactly the setup as shown in the documentation, and have my spam delievered into a "spam" folder. This works just fine for me.
jay_plesseta at 2007-7-21 15:22:56 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 16

Hi,

this is bug

6485247 spamfilterX_string_action can only accept sieve filters of 256 characters

It's not fixed yet as of 118207-59. It should be fixed in a coming patch.

The workaround is to define long sieve filters within a channel or system sieve

and only use the spamadjust/addheader in the sieve.

For ex:

<option.dat>

spamfilter1_string_action=data:, require ["addheader","spamtest"]; \

spamadjust "$U"; addheader "Spam-Test: $U"

<imta.cnf>

ims-master <--snip--> destinationfilter file:IMTA_TABLE:spamassassin.filte

r

<msg_root/config/spamassassin.filter>

require ["spamtest","relational","comparator-i;ascii-numeric","fileinto"];

if spamtest :value "ge" :comparator "i;ascii-numeric" "10" {discard;}

elsif spamtest :value "ge" :comparator "i;ascii-numeric" "5" {fileinto "spam";}

else {keep;}

LB

LBJa at 2007-7-21 15:22:56 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...