Page 1 of 1

Increase spam assassin score for gmail

Posted: 10 Feb 2022 12:25
by SelfMan
Hi guys,
is there a way to increase the spam score of all e-mail received from gmail?
Most of the spam these days comes from the fake/overtaken mailboxes at Gmail.
Sadly, most of them manage to pass through the eFa filters.

Thanks

MailWatch Version: 1.2.18
Operating System Version: CentOS Linux 7 (Core)
Postfix Version: 3.5.9
MailScanner Version: 5.4.2
ClamAV Version: 0.103.5
SpamAssassin Version: 3.4.6
PHP Version: 7.4.27
MySQL Version: 10.2.30-MariaDB

Re: Increase spam assassin score for gmail

Posted: 10 Feb 2022 12:53
by shawniverson
Yes.

You could add a custom rule to /etc/mail/spamassassin/local.cf to add a score to anything from gmail.com

https://cwiki.apache.org/confluence/dis ... itingrules

Re: Increase spam assassin score for gmail

Posted: 10 Feb 2022 13:16
by SelfMan
Thanks!
will try that asap.

Re: Increase spam assassin score for gmail

Posted: 11 Feb 2022 11:34
by SelfMan
Hi,
I added the custom rules, but they were not applied.
I found out that I have to run sa-update and sa-compile from /etc/mail/spamassassin/ folder.
Is it enough to run this from the GUI console in webmit or does this need to be run as root? (using sudo)

Are a ny other steps required?

Thanks

Re: Increase spam assassin score for gmail

Posted: 17 Sep 2022 00:11
by barbours
Please share the custom rule that you used. Has it been successful?

Re: Increase spam assassin score for gmail

Posted: 17 Sep 2022 01:31
by SelfMan
I added these 2 lines at the end of the /etc/mail/spamassassin/local.cf

Code: Select all

header LOCAL_DEMONSTRATION_FROM	From =~ /\@gmail\.com/i
score LOCAL_DEMONSTRATION_FROM	2.0
It seems to work partially as I don't see the rule being applied every time a mail from gmail.com is received.

Re: Increase spam assassin score for gmail

Posted: 06 Oct 2022 10:34
by pdwalker
You'll need to post some headers of messages where the rules were not applied.

I added the following rules into /etc/mail/spamassassin/local.cf

Code: Select all

header       ZZ_GMAIL_TEST From =~ /\@gmail\.com/i
score        ZZ_GMAIL_TEST -0.01
describe     ZZ_GMAIL_TEST gmail scoring test using local.cf
I don't know if it matters or not, but I did not use tabs as field separators.

I did not run sa-update and/or sa-compile. In fact these scripts are not in /etc/mail/spamassassin on my installation, but in /usr/bin. I also did not restart any processes.

I then sent an email from my gmail account to the account protected by efa4 and here is what I got:
Screenshot 2022-10-06 at 18.31.png
Screenshot 2022-10-06 at 18.31.png (134.61 KiB) Viewed 2233 times
so the rule clearly works.

The missing description is correct as I did not run the "Update SpamAssassin Rule Descriptions" from the "Tools and Links" menu.

Re: Increase spam assassin score for gmail

Posted: 06 Oct 2022 11:07
by SelfMan
Since I created the rule, there were several updates and restarts of the system. Never the less, I've re-checked all the recent 20 mail from gmail and the rule was applied just fine. I had the problem with the rule not being applied every time only after I created the rule some months ago.
So, from my side the sa-compile mentioned previously helped and everything is fine now.