"Scan for Spam" setting

General eFa discussion
Post Reply
SteveC
Posts: 12
Joined: 16 May 2023 19:16

"Scan for Spam" setting

Post by SteveC »

When setting up a user, I thought that if I cleared the checkbox "Scan e-mail for Spam" for the "Scan for Spam" setting, it would allow email to pass through unscanned and maybe stored. When I test things, I am still seeing the X-Spam-Status messages, so it appears to be scanned and stored. I actually like that they are still stored.

To test, I sent from another domain and account separate messages to two efa accounts on the same domain with one account having the checkbox cleared, and the headers are identical. I did restart mailscanner from an SSH shell previous to trying this.

This is for MailWatch for MailScanner v1.2.23 running on eFa-5.0.0-11 with
Operating System Version: CentOS Stream 9
Postfix Version: 3.5.25
MailScanner Version: 5.5.1
ClamAV Version: 1.0.8
SpamAssassin Version: 4.0.1
PHP Version: 8.1.27
MySQL Version: 10.5.27-MariaDB

-Steve
SteveC
Posts: 12
Joined: 16 May 2023 19:16

Re: "Scan for Spam" setting

Post by SteveC »

I found the custom end function SQLSpamScores that seems to process the database noscan variable in the SQLSpamSettings.pm perl module. Unfortunately, I don't know perl other than regex/PCRE, so I don't know exactly what is going on. I did find the following code though.

Code: Select all

#
# Close down Spam Settings lists
#
sub EndSQLSpamScores
{
    MailScanner::Log::InfoLog("MailWatch: SQLSpamSettings:: Closing down MailWatch SQL Spam Scores");
}

sub EndSQLHighSpamScores
{
    MailScanner::Log::InfoLog("MailWatch: SQLSpamSettings:: Closing down MailWatch SQL High Spam Scores");
}

sub EndSQLNoScan
{
    MailScanner::Log::InfoLog("MailWatch: SQLSpamSettings:: Closing down MailWatch SQL No Scan");
}
I did a grep of the log and only found traces of the first two. There is no "No Scan" messages in the logs.

Code: Select all

...MailScanner[3864919]: Config: calling custom end function SQLSpamScores
...MailScanner[3864919]: MailWatch: SQLSpamSettings:: Closing down MailWatch SQL Spam Scores
...MailScanner[3864999]: MailWatch: SQLSpamSettings:: Closing down MailWatch SQL High Spam Scores
Is it not being called for some reason?

-Steve
SteveC
Posts: 12
Joined: 16 May 2023 19:16

Re: "Scan for Spam" setting

Post by SteveC »

Guessing by the lack of response, I'm the only one having issues with the no scan.

Just closing out this thread to say that I got it to work the way I need with rules and a bit of bash scripting for a cron job.

In the unlikely event someone lands here....

Change the setting in MailScanner.conf: Scan Messages = %rules-dir%/scan.messages.rules
The scan.messages.rules is where you add exemptions from scanning.

You also need to change the setting of in MailScanner.conf: Non Spam Actions = %rules-dir%/nonspam.actions.rules
The nonspam.actions.rules is where you change the Non Spam Actions to either

store deliver <--- This is for the exemption users

store deliver header "X-Spam-Status:No" custom(nonspam) <--- this is for the normal users.

You cannot edit the nonspam.actions.rules from the webpage editor though. It doesn't like the " character, so edit it from a shell.

The bash script with the cron job just creates these files once a day after scanning the database.

-Steve
Post Reply