Setup your own email server (MTA) on the cheap - part 4

We’ve already built our POSTFIX based MTA and its relaying mail to our target mailbox. We’ve already added SPAM Protection, but what about Viruses. ClamAV is a well-known, and well reputed, antivirus for Linux. They also have a daemon called clamsmtp which we can have look over our mail and make sure we’re not passing along any viruses. These are the steps I followed to add AV scanning.

    1. First, let’s install ClamAV and ClamSMTP

    sudo apt-get install clamsmtp

    2. Now, let’s configure it. Open /etc/clamsmtpd.conf in your favourite editor. Most lines will be left but update these two configuration lines
    This bug appears to be resolved in the latest version.
    3. There is a small bug at the moment with permissions on some files, to correct these, run these commands:
    sudo chown -R clamav:clamav /var/run/clamav/
    sudo chown -R clamav:clamav /var/spool/clamsmtp
    sudo chown -R clamav:clamav /var/run/clamsmtp/
    4. Now, let’s hook it in to POSTFIX. Edit /etc/postfix/main.cf and add these lines:
    5. Edit /etc/postfix/master.cf and add these lines:Note the no_milters option I’ve added, this stops OpenDKIM re-signing the mail when it comes back in from ClamAV.


    6. Finally, reload everything and you should be on your way
    sudo service clamav-daemon restart
    sudo service clamsmtp restart
    sudo service postfix restart

All going well, the next message you receive should have a header added saying:

Comments

Popular posts from this blog

Sync iTunes with MythMusic

Using Homebridge and Broadlink RM Mini to automate

LetsEncrypt and AWS ELB Load Balancers