Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » [SOLVED] Spam Filter - Regular Expressions [not working]
  •  
eggadmin

Messages: 4
Karma: 0
Send a private message to this user
Hi everybody,

I can't get regular expression to work in the custom rules section of Kerio connect.
If I configure the following rule [see attachment] and send a test mail with the subject line 'testkeyword', the message passes through the server without problems.

debug.log only shows:
{spam} Spam Filter: Custom spam rules check finished, adding score 0.00


Does anybody have an idea what the problem is here?
The syntax is correct, isn't it?

Greetings
eggadmin

[Updated on: Fri, 23 May 2014 17:55]

  •  
freakinvibe

Messages: 1508
Karma: 58
Send a private message to this user
Why are you using /testkeyword/i ?

If you just put testkeyword it works. What are you trying to achieve?

Dexion AG - The Blackberry Specialists in Switzerland
https://dexionag.ch
  •  
eggadmin

Messages: 4
Karma: 0
Send a private message to this user
I want to use regular expressions.

According to this knowledge base article this should be possible:
h--p://kb.kerio.com/product/kerio-connect/server-configurati on/antispam/creating-custom-rules-for-spam-control-in-kerio- connect-1174.html

[fix http in link]

The testkeyword was just a simple example.
Even so, if it would work, it would match case-insensitive, so messages containing teStKeywOrd would also be rejected.
Maybe this specific case also works with the normal filter, but if I want to match a more complex string, like the one in the kb-article, I need to use regular expressions.
  •  
Macman2013

Messages: 20
Karma: 0
Send a private message to this user
You have /testkeyword/i

I believe it should read

/\btestkeyword\b/i

From SA site.

In regular expressions a \b can be used to indicate where a word-break (anything that isn't an alphanumeric character or underscore) must exist for a match. Our rule above can be made to not match "testing" or "attest"

/i - Now the rule will match any combination of upper or lower case that spells "test" surrounded by word breaks of some form.
  •  
eggadmin

Messages: 4
Karma: 0
Send a private message to this user
Thanks for your answer, but that's not the solution.

Using word-breaks like in /\btestkeyword\b/i just means, that the regular expression would match a subject line containing 'testkeyword anotherword', but not 'testkeywords'.

This is also explained in the kb-article by kerio using the /\bcialis\b/i example, which will match cialis, but not specialist, socialist etc.

Doesn't anybody use regular expressions at all in kerio connect?

I'm thinking about putting my rules directly in an spamassassin .cf-file in /opt/kerio/mailserver/plugins/spamserver/spamassassin/rules/. But I'd rather like to understand, why it doesn't work when using the webgui.
  •  
freakinvibe

Messages: 1508
Karma: 58
Send a private message to this user
In Kerio Connect, it is a big difference if you use the header or body criteria.

The body criteria will write a .cf file to the spamassassin folder and it follows the regular expression syntax of SA.

The header criteria is not handled via SA, it is using KC internal filtering and it does not support regular expressions. It is stored in the .cfg file.

In your case you should probably write your own .cf file. See also this forum post for more information on this topic:

http://forums.kerio.com/t/22167/multiple-entries-in-custom-r ules

Dexion AG - The Blackberry Specialists in Switzerland
https://dexionag.ch
  •  
eggadmin

Messages: 4
Karma: 0
Send a private message to this user
Hey freakinvibe!

Thanks a lot for that information!

Just minutes before your message I was checking where kerio stores my testkeyword rule and found it in mailserver.cfg. I've just begun to write my own .cf-file in the spamassassin folder.

Thanks very much for pointing out the difference in kerio handling body or header filtering.
Now all becomes clear. Smile
They should mention that with a simple oneliner in the knowledge base article.

Have a great weekend!
Previous Topic: IM Service Will not start
Next Topic: Kerio Connect OVF
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Wed Aug 16 15:23:30 CEST 2017

Total time taken to generate the page: 0.00403 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.