Koozali.org: home of the SME Server

Building a central spamfilter

Offline Troels

  • ***
  • 48
  • +0/-0
Building a central spamfilter
« on: September 14, 2009, 01:21:09 AM »
Hello,

I have an idea that I have been working on today. The idea is to run a central SME Server with spam and antivirus
filtering on and several other different mail servers behind it. On SME server1, I would like to control all access to other mail servers running behind it, so if the users are not present on SME Server1 mail is rejected for the domains.

The MX records for a.com would look like this:
Mail server1 is the primary mail exchanger for domain a.com and mail server2 is the second for a.com

IN MX 10 spamzink.0.com
IN MX 20 mail.a.com

The MX records for b.com would look like this:
Mail server1 is the primary mail exchanger for domain b.com and mail server3 is the second for b.com

IN MX 10 spamzink.0.com
IN MX 20 mail.b.com

The same goes for Mailserver4.

SME Server 1 (running spamassassin/clamav, spamzink.0.com)
   |            |      |
   |            |      |
   |            |      |
Mail server2 (mail.a.com) - Mail server3 (mail.b.com)- Mail server4 (mail.c.com)

Q1: In my test setup I configured mail server1 to delegate all mail from a.com to Mailserver2, but if an email is send to laura@a.com and Laura isn't created as a user on mail server1 its still forwarded to mail server2. How can we change this behavior?

Q2: I was thinking, is it possible to make mail server1 store messages tagged as ***spam** in its junk/spam folder? for the corresponding user. Now in my test setup, mail server2 is actually another SME server and the mail coming in tagged as spam is in fact ending in the junk folder here :).

I'm aware of the forwarding feature, but this is not what we are looking for.
« Last Edit: September 14, 2009, 01:26:13 AM by Troels »
Regards Troels

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
Re: Building a central spamfilter
« Reply #1 on: September 14, 2009, 09:26:07 AM »
Troels,

If I understand your question right then you need to have spamzink understand and be able to forward to different server dependant of the domain. To do this you need to alter smtproutes per domain. Also you either need not to filter on individual email addresses within a domain (allow *@domain.com) or add every single user in the goodrcptto (/var/service/qpsmtpd/config/goodrcptto). Trust me there are a lot of places you need to fixup, make new templates, etc. but it can be done. I have just made comparable system myself running this as a hosted spam filter solution (www.scanmailx.com) - all essentially based on SME.

Next real challenge would be the quarantine area and how to access this for all user. Since you are using SME servers I think you are best of letting it store to the junkmail folders.

Rgds,
Jesper


Offline Troels

  • ***
  • 48
  • +0/-0
Re: Building a central spamfilter
« Reply #2 on: September 14, 2009, 01:16:31 PM »
Hello Jesper,

This is exactly what we'd like to do. In our test setup we did get Mail server1 (spamzink) to route the mail by domain using:

# db domains setprop a.com MailServer XXX.XXX.XXX.217
# signal-event email-update

I'm glad to hear it can be done. In our test setup I took @a.com out from /var/service/qpsmtpd/config/goodrcptto and it then blocked the users not created on mail server1. Now the challenge for us is to
change the right template so that @b.com, @c.com is not added to /var/service/qpsmtpd/config/goodrcptto.
Regards Troels