Centos 7 Exim DKIM

Centos 7 has Exim 4.84 in repos, which has DKIM support built-in. So no need for OpenDKIM anymore. See how is it configured:

In /etc/exim/exim.conf, find lines

  driver = smtp

And append the following:

  driver = smtp
  dkim_domain = $sender_address_domain
  dkim_selector = mail
  dkim_private_key = /etc/exim/dkim/mail.pem
  dkim_canon = relaxed

The keys can be generated with

mkdir /etc/exim/dkim
cd /etc/exim/dkim
openssl genrsa -out mail.pem 2048
openssl rsa -in mail.pem -pubout > mail.pub
chown -R root:exim /etc/exim/dkim
chmod 0750 /etc/exim/dkim
chmod 0640 /etc/exim/dkim/*

Then restart exim:

systemctl restart exim Next, publish mail.pub in DNS as mail._domainkey.yourdomain.com and enjoy signed mail.