Centos 7 + Postfix + Amavisd-new + Clamav + OpenDKIM + OpenDMARC

How to setup Postfix, Amavisd-new, Clamav, OpenDKIM & OpenDMARC on Centos 7

    1. Just in case, remove sendmail and install postfix:

Make sure it starts on reboot:

Install amavis and clamav and make sure it starts on reboot:

Fix the issue with clamd not starting:

Install OpenDKIM:

Create keys and check:

Edit the following files:
/etc/opendkim.conf (Main configuration file for opendkim)
/etc/opendkim/KeyTable (Defines the path of private key for the domain)
/etc/opendkim/SigningTable (Tells OpenDKIM how to apply the keys)
/etc/opendkim/TrustedHosts (Defines which hosts are allowed to use keys)

If you’re just verifying incoming mail you don’t actually need to edit any of the above files, the defaults are fine.

Start and enable on reboot:

Next you need to add the following lines to your Postfix main.cf

and restart Postfix.

Now we can install OpenDMARC:

Edit the file /etc/opendmarc.conf and uncomment the line
# AuthservID name
and set “name” to the hostname of your server.

Now enable it on reboot and fire it up:

Now we need to hook it into Postfix, just add the port in main.cf as for opendkim above, i.e. the line in main.cf should now read:

This will pass incoming mail through OpenDKIM first, then OpenDMARC.

It’s a good idea to enable the PublicSuffixList in the opendmarc.conf file and create a weekly cronjob to keep the list up to date, so create the file /etc/cron.weekly/opendmarc

and restart Postfix.