[Rspamd-Users] spamassassin meta support

Vsevolod Stakhov vsevolod at rspamd.com
Fri Jan 17 19:48:36 UTC 2020


On 17/01/2020 16:50, Steve Sturges (ststurge) via Users wrote:
> 
> 
> On Jan 15, 2020, at 6:30 PM, Vsevolod Stakhov <vsevolod at rspamd.com<mailto:vsevolod at rspamd.com>> wrote:
> 
> On 15/01/2020 20:56, Steve Sturges (ststurge) via Users wrote:
> Hi-
> 
> I’ve been playing around with rspamd and have a question about the spamassassin plugin…
> I have a few meta rules that are of two different forms:
> 
> meta X (Z - Y) > 0.1
> meta D (A +  0.25 * B + 0.5 * C) >= 1
> 
> When I load them into rspamd using the spamassassin plugin, they are not parsing properly, and I get an error “Cannot parse expression
> (Z - Y) > 0.1“ and “Cannot parse expression (A+ 0.25 * B + 0.5 * C) >= 1” respectively.
> 
> Near as I can tell from the code, with the 1st form, the plugin and expression parser does not handle the - as an arithmetic operator the same way it does with +.  Is this accurate?  Are there alternatives in converting the meta expressions?  Or plans to add support for this in the future?
> 
> For the 2nd example, I have tried swapping the order, making it (A + B * 0.25 + C * 0.5) >= 1, but still get an error.  Step through the debugger, the error message comes back as “Cannot parse atom: callback function failed to parse ‘.25 + C * 0.5) >= 1’”, which implies that the combination of addition and multiplication as part of the expression itself is not working as I expect.
> 
> Any suggestions from people who have migrated from spamassassin to rspamd?
> 
> Thanks!
> 
> 
> These operations (specifically `-` and `*`) have never been implemented
> because there was no particular need in them. In theory, such a support
> is more or less trivial to add (but AST local optimisations might
> require some changes). The question is if they are really useful? I can
> not see any useful appliances of them to be honest.
> 
> Thanks for the response Vsevolod.
> 
> They are definitely useful within the spamassassin world, where you can weight different scalars with different combinations of subrules to convict — see the Meta Rules section here:
> 
> https://cwiki.apache.org/confluence/display/SPAMASSASSIN/WritingRules
> 
> Was looking for alternatives and suggestions relative to doing something similar within rspamd.


Extending expressions in Rspamd is not that difficult, but nobody have
asked me about it so far (and I have more high priority tasks in my
queue as usually).

Alternatively, you can use Lua to get specific symbols and their scores.
It won't be as efficient as extending expressions though.



More information about the Users mailing list