MailScanner Report removed from spam.whitelist.rules

Discuss our MailScanner install script and MailScanner itself
Post Reply
jimhermann
Junior Member
Posts: 10
Joined: 23 Jun 2011, 18:15

MailScanner Report removed from spam.whitelist.rules

Post by jimhermann »

How do I keep the system from removing my custom spam.whitelist.rules?

I received an email with Subject: cPanel -> MailScanner Report

It included a bunch of lines like this:

foreign-domain-name removed from spam.whitelist.rules

The foreign-domain-name was a custom whitelist rule that I had added before I switched to cPanel:

From: yyyyy@foreign-domain-name and To: aaaaa@local-domain-name yes

I can't add this whitelist rule with the MailScanner FE. It only allows all To:, all From:, or all FromTo:. It does not allow the From: and To: format.

Thanks.

Jim
jimhermann
Junior Member
Posts: 10
Joined: 23 Jun 2011, 18:15

Re: MailScanner Report removed from spam.whitelist.rules

Post by jimhermann »

I found the solution to my problem.

I had to modify the /usr/mscpanel/mscpanel-dot-pl program:

# diff /usr/mscpanel/mscpanel-dot-pl /usr/mscpanel/mscpanel-dot-pl-dot-org
260c260
< if (($swr[$x] =~ /\@([^\t\s\*]*)/) and ($swr[$x] !~ /\#/)) {
---
> if (($swr[$x] =~ /\@([^\t\s\*]*)/) and ($swr[$x] !~ /^\#/)) {

Did you notice the change that I made to line 260?

The original version matches only lines that don't start with #

The modified version matches only lines that don't contain a # anywhere in the line.

So I changed my custom spam.whitelist.rule file to end custom rules with a #

For example:

From: yyyyy@foreign-domain-name and To: aaaaa@local-domain-name yes #

Life is good until the next /usr/mscpanel/mscpanel-dot-pl update. ;)
Daroch
Junior Member
Posts: 3
Joined: 22 Jul 2011, 12:11

Re: MailScanner Report removed from spam.whitelist.rules

Post by Daroch »

Hello, Jimhermann:

Thanks for your advice. Works great with the black list and white list.
Unfortunately, the same problem exists with spam.scanning.rules files. It is overridden when the command /usr/mscpanel/mscpanel(dot)pl is executed.
I tried the same method, modifying the file mscpanel(dot)pl (line 219) and putting a "#" at the end of the linesin spam.scanning.rules but does not work :-(
I think there is another problem in the future. when upgrading the frontend Mailscanner, mscpanel(dot)pl file changes will be lost, right?
Is this normal function Mailscanner? Is there anyone with this problem?
Our versions:
MailScanner - v4.84.5
ConfigServer MailScanner Script - v2.88
ClamAV - v0.97.6
MailScanner Front-End - v4.38

Thanks and sorry for reviving an old post
Bigwebmaster
Junior Member
Posts: 4
Joined: 06 Feb 2015, 17:41

Re: MailScanner Report removed from spam.whitelist.rules

Post by Bigwebmaster »

Had this same issue with whatever lines I was adding to the spam.whitelist.rules being removed daily. Looked at the programming and the problem is this line like mentioned above:

Code: Select all

if (($swr[$x] =~ /\@([^\t\s\*]*)/) and ($swr[$x] !~ /^\#/)) {
       if (not $validdomains{$1} and ($1 ne "") and ($1 ne "*")) {splice (@swr,$x,1);$report .= "$1 removed from spam.whitelist.rules\n";$altered = 1}
}
The real problem with this line is that it is comparing the domain it finds in the line to $validdomains. The $validdomains array only contains domains that reside on the server so it makes no sense to even compare to this as you will want to whitelist domains outside of the server. The way it works now is that unless a domain is local in spam.whitelist.rules file, the line will be removed. All local domains on this whitelist will stay. It also does this for the blacklist file and it shouldn't. So to fix this simply remove this block of code as there is no reason for it:

Code: Select all

        for ($x=0;$x < @sbr;$x++) {
                if (($sbr[$x] =~ /\@([^\t\s\*]*)/) and ($sbr[$x] !~ /^\#/)) {
                        if (not $validdomains{$1} and ($1 ne "") and ($1 ne "*")) {splice (@sbr,$x,1);$report .= "$1 removed from spam.blacklist.rules\n";$altered = 1}
                }
        }
        for ($x=0;$x < @swr;$x++) {            
                if (($swr[$x] =~ /\@([^\t\s\*]*)/) and ($swr[$x] !~ /^\#/)) {
                        if (not $validdomains{$1} and ($1 ne "") and ($1 ne "*")) {splice (@swr,$x,1);$report .= "$1 removed from spam.whitelist.rules\n";$altered = 1}
                }
        }
Post Reply