Topic: disabling spamfiltering on certain domains

In reference to the following article : http://kb.atmail.com/?p=76

I would like to only spam filter certain domains on the server, there are some people that do not want spamfiltering at all etc etc.

While the article lists changes for how to make a list of domains you dont want it on, i would prefer it to be a list of domains that you do want spam filtering on - this is much easier to maintain from our systems.

However the part that it says to change simply does not exist in the configure file.

The only reference to MYSQL_CHECKSPAM Is as follows:

[root@mx1 ~]# grep MYSQL_CHECKSPAM /usr/local/atmail/mailserver/configure
MYSQL_CHECKSPAM = SELECT DISTINCT '$domain' FROM UserSession WHERE Account ='${quote_mysql:$local_part}@${quote_mysql:$domain}'

As such where do i apply this change?

Also is it not possible to add this type of thing into the domains dbase table rather than using text files?

Thanks.

+ -

Re: disabling spamfiltering on certain domains

@mail staff are currently working on this at the moment. Please keep an eye on this topic for updates.

+ -

Re: disabling spamfiltering on certain domains

Excellent for info i did trac it as well #802

+ -

Re: disabling spamfiltering on certain domains

Been a long time on this so decided to spend some time looking into it.

As you maybe aware from other forum posts i have made we use groups to control who access to the spamfiltering controls and who doesnt. The changes below are based on group names that contain 'spamfilter' are scanned by SA and all others are skipped to avoid unnecessary CPU usage.

So add the following to the 'MYSQL Routers':

MYSQL_SPAMENABLED= select 1 FROM Users where Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' AND Ugroup NOT LIKE '%spamfilter%'

You can change the condition here to match your own group names if you use different naming systems.

Now in the ACL CONFIGURATION find:

# Accept if the address is in a local domain, but only if the recipient can
# be verified. Otherwise deny. The "endpass" line is the border between
# passing on to the next ACL statement (if tests above it fail) or denying
# access (if tests below it fail).

accept  domains       = +local_domains
         endpass
         verify        = recipient



And after this add the following line so it becomes:
accept  domains       = +local_domains
         endpass
         verify        = recipient
         set acl_m0=${lookup mysql {MYSQL_SPAMENABLED}}


The in the <SPAMASSASIN> section find:

# Skip if message over size
accept condition = ${if > {$message_size}{40k} }


And add after it add:

warn message = X-SpamFiltering: SpamFiltering not enabled on this account
condition = ${if eq{${acl_m0}}{1}{1}{0}}

accept condition= $acl_m0


Of course the first two lines arent needed, but useful if you want to make it clear that spamfiltering is not enabled and its available as  feature - it will put a header in the email with that message. the accept condition is what makes it skip the whole spamassassin tests if positive.

+ -

Re: disabling spamfiltering on certain domains

The acl_m0 declarations shouldn't be necessary - you should be able to do a lookup directly:

condition = ${if eq{${lookup mysql {MYSQL_SPAMENABLED}}}{1}{1}{0}}

+ -

Re: disabling spamfiltering on certain domains

Interesting, just looking through my notes of the million different things i tried, and looks like i missed the 'if eq' part out when i tried that actual thing directly. Will give it another try - thanks for the hints!!

+ -