Bookmark and Share

Configuring Postfix + Spamasassin + Amavis as front-end Mail Transport Agent (MTA) to MS Exchange 2010

Posted: Monday, April 15th, 2013 at 12:15 amUpdated: Monday, April 15th, 2013 at 12:27 am

Configure SpamAsassin

Now that you’ve made sure that Postfix is working fine and emails received to it is forwarded to Exchange, it’s time to configure it to start filtering email. Install the necessary packages by running the following commands:

user@mydomain:~$ sudo apt-get install amavisd-new spamassassin clamav-daemon
user@mydomain:~$ sudo apt-get install libnet-dns-perl pyzor razor
user@mydomain:~$ sudo apt-get install arj bzip2 cabextract cpio file gzip 
user@mydomain:~$ sudo apt-get install lha nomarch pax rar unrar unzip zip
user@mydomain:~$ sudo adduser clamav amavis
user@mydomain:~$ sudo adduser amavis clamav

Next, we need to configure SpamAsassin. Edit /etc/default/spamassassin and enable SpamAsassin and CRON. Leave everything else as is. Below is the relevant changes of the file.

user@mydomain:~$ cat /etc/default/spamassassin
ENABLED=1
CRON=1

Then start SpamAsassin.

user@mydomain:~$ sudo /etc/init.d/spamassassin start

Optionally, you can also configure SpamAsassin to tag email’s header with the word *****SPAM*****. In order to do that, edit /etc/mail/spamassassin/local.cf and uncomment the line where it says rewrite_header Subject.

Pages: 1 2 3 4 5 6 7

6 Responses to “Configuring Postfix + Spamasassin + Amavis as front-end Mail Transport Agent (MTA) to MS Exchange 2010”

  1. Alex Says:

    Hi!
    Thank you for you configuration!
    I am trying to set up postfix and testing SMTP with the telnet.
    From mydomain to my domain I can send letters (postfix forwards them to exchange)
    And from mydomain to non-mydomain (gmail.com) I can\’t send – I receive \"relay access denied\" in postfix logs.
    What do I do wrong?

  2. Maresa Says:

    @Alex: You’ll need to configure Postfix to open relay access. My recommendation is not open it globally. Open it only for authenticated users or from the IP address of your network. I don’t have article on how to do it yet. You can Google in the meanwhile.

    As for my setup, the outgoing mail is actually being sent directly from Exchange server. Hence, Postfix is not involved in sending email. Its sole purpose, in my setup, is to receive email, run antivirus / antispam on it, mark emails for spam as necessary, then forward email to Exchange.

  3. Michael Says:

    Hi,
    Thanks for your configuration!
    I try this and it works good with telnet (local on the Linux-Server).
    But if i send an email extern like (Yahoo) to my domain to relay it to exchange, i get an Relay Access Denied Error. On my Yahoo-Client

    What is wrong?

  4. eltes Says:

    @Michael: You need to add your domain to your postfix-configuration.

    Add this to your main.cf:

    virtual_mailbox_domains = /etc/postfix/virtual_domains

    then create

    /etc/postfix/virtual_domains and add your domain(s):

    domain1.de
    domain2.de

    After this reload/restart postfix.

  5. Martial Says:

    Hello,

    On debian jessie, I have to edit /etc/clamav/clamd.conf
    and change
    AllowSupplementaryGroups false
    By
    AllowSupplementaryGroups true

    bye.

  6. Max Says:

    Hi,

    i’m trying to get everything to work but if i do “tail /var/log/mail.err” i get such an error “postfix/smtpd[4529] : fatal: open dictionary: expecting “type:name” form instead of “content_filter”

    The number is counting up. Any ideas ?

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.