01/05/2011
Block Spam with russian encoding using spamassassin
Lately the amount of spam with russian encoding/charset that I was getting had increased significantly. Spamassassin’s configuration options “ok_locales” and “ok_languages” were not enough because I didn’t want to whitelist some language, but I just wanted to blacklist some.
So the solution for my problems was the addition of the following lines in the configuration of spamassassin:
header LOCAL_CHARSET_RUSSIAN Subject:raw =~/\=\?koi8-r\?/i score LOCAL_CHARSET_RUSSIAN 7 describe LOCAL_CHARSET_RUSSIAN Contains russian charset that is not acceptable
If you want to add even more charsets:
header LOCAL_CHARSET_BLOCKED Subject:raw =~/\=\?(koi8-r|windows-1251)\?/i score LOCAL_CHARSET_BLOCKED 5 describe LOCAL_CHARSET_BLOCKED Contains charsets that are not acceptable
Be VERY careful with these rules if you place them in the global config (/etc/spamassassin/local.cf) because if any of your users are getting emails in russian those emails will be probably marked as spam!!
Filed by kargig at 13:27 under Internet
Tags: charset, email, russian, spam, spamassassin
2 Comments | 13,605 views
Just from seeing the rules I believe there should be found a cleanest solution.
I added this code to our local.cf, restarted Spamassassin, but about 20 minutes later, we got another Russian email. The Subject line has this:
Subject: =?koi8-r?B?7NXe28nKINvLwcYg2sEg0M/Mw8XO2Swg08vJxMvJIDYwJQ==?=
So theoretically, the test should have caught it, right? I’m not sure why it didn’t. If you have any suggestions, I’m all ears. Thanks!