How to configure spam filter on Proxmox gateway

LuckyA$$

New Member
Mar 11, 2019
2
0
1
31
Hi Guys,

I've read many guide how to configure spam filter such as Body filter or Subject filter but i failed to test on my system, i did created a new Object in Mail Filter -> What Objects . But its doesn't work.

Could you guys give me a example how to modify Body filter.

Sorry for my bad english :)

Thanks.
 

Attachments

  • 1.PNG
    1.PNG
    34 KB · Views: 152
The MatchField entry should match case-insensitively - so the '(?i)' should not be necessary.
* a few of your regexes might match some false positives!
* the one with \n - won't work (I assume you try to match multiple headers) - the mail gets decomposed and each header is treated as its own field

As for the body filter - this works by creating custom spamassassin rules - check the pmg-admin-guide (section 4.8): https://www.proxmox.com/images/download/pmg/docs/pmg-admin-guide.pdf

however keep in mind that most of the simple sounding keyword filters might lead to quite some problems (e.g. https://en.wikipedia.org/wiki/Scunthorpe_problem)

Hope this helps!
 
The MatchField entry should match case-insensitively - so the '(?i)' should not be necessary.
* a few of your regexes might match some false positives!
* the one with \n - won't work (I assume you try to match multiple headers) - the mail gets decomposed and each header is treated as its own field

As for the body filter - this works by creating custom spamassassin rules - check the pmg-admin-guide (section 4.8): https://www.proxmox.com/images/download/pmg/docs/pmg-admin-guide.pdf

however keep in mind that most of the simple sounding keyword filters might lead to quite some problems (e.g. https://en.wikipedia.org/wiki/Scunthorpe_problem)

Hope this helps!


Dear Stoiko,

Is there any guidelines /official notes which help us to create these Spam keywords and Spam rules in detail..Because I see lot like this but not getting a good understanding to do my own.

Regards,
Liju
 
Is there any guidelines /official notes which help us to create these Spam keywords and Spam rules in detail..Because I see lot like this but not getting a good understanding to do my own.

Not in our reference documentation, because we try not to encourage users to create their custom rules in general:
* most of the time bad detection rates are due to a misconfigured DNS setup (URIBL_BLOCKED results in the mail.log)
* using simple keywords leads to many false positives
* There are rather specific and rare cases where using a SA customization (more of reweighting the score of a rule than adding a new one ) can help for a while - and in these cases the requirements are quite tight and clear.

So put shortly - check your DNS setup and consider why mails are miscategorized first before considering to add your own custom rules.

Lastly to answer your question - the spamassassin docs have a description of creating custom rules: https://cwiki.apache.org/confluence/display/SPAMASSASSIN/WritingRules
 
Not in our reference documentation, because we try not to encourage users to create their custom rules in general:
* most of the time bad detection rates are due to a misconfigured DNS setup (URIBL_BLOCKED results in the mail.log)
* using simple keywords leads to many false positives
* There are rather specific and rare cases where using a SA customization (more of reweighting the score of a rule than adding a new one ) can help for a while - and in these cases the requirements are quite tight and clear.

So put shortly - check your DNS setup and consider why mails are miscategorized first before considering to add your own custom rules.

Lastly to answer your question - the spamassassin docs have a description of creating custom rules: https://cwiki.apache.org/confluence/display/SPAMASSASSIN/WritingRules


Thankyou Sir..

So in short We dont have to alter the spam filter settings unless we encounter some other problems other than due to DNS .

In my infrastructure most of our real clients sends email by addressing Dear.....XXX, But then Spam assaisn "Dear Something'' spam value will get triggered and adding 1. 7 score to it. How should I reduce it.? Which file I should update it with?

Regards,
Liju..
 
In my infrastructure most of our real clients sends email by addressing Dear.....XXX, But then Spam assaisn "Dear Something'' spam value will get triggered and adding 1. 7 score to it. How should I reduce it.? Which file I should update it with?
Ok - this actually is one use-case where a modification might make sense! (However keep in mind that it is not unlikely that the receiving mail-server also might use SpamAssassin - and that the mail might get tagged on that end with the same result as on yours (more relevant if you use PMG as outbound relay))

@dcsapak is currently working on a feature to make this configurable via GUI (neither finished nor tested yet - so no timeline when it becomes available)

If you need it sooner you can add
Code:
score DEAR_SOMETHING X.Y
to '/etc/mail/spamassassin/custom.cf' to have the rule scored at X.Y (instead of 1.7)

run `spamassassin -D --lint` to check the syntax

and restart `pmg-smtp-filter` if everything looks good
(see also our reference documentation: https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_custom_spamassassin_configuration)

I hope this helps!
 
Ok - this actually is one use-case where a modification might make sense! (However keep in mind that it is not unlikely that the receiving mail-server also might use SpamAssassin - and that the mail might get tagged on that end with the same result as on yours (more relevant if you use PMG as outbound relay))

@dcsapak is currently working on a feature to make this configurable via GUI (neither finished nor tested yet - so no timeline when it becomes available)

If you need it sooner you can add
Code:
score DEAR_SOMETHING X.Y
to '/etc/mail/spamassassin/custom.cf' to have the rule scored at X.Y (instead of 1.7)

run `spamassassin -D --lint` to check the syntax

and restart `pmg-smtp-filter` if everything looks good
(see also our reference documentation: https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_custom_spamassassin_configuration)

I hope this helps!
Thankyou very much sir for your kind and detailed input on my question...I will try it and comeback..

Regards,
Liju
 
  • Like
Reactions: Stoiko Ivanov

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!