Using DKIM with Exim and cPanel
Posted by admin | Tagged under exim,howto | Posted on May 10, 2011
16
Similar to the intentions of SPF records and DomainKeys, DKIM is intended to authenticate a sender by using a public/private key pair to digitally sign email, therefore increasing deliverability. At this point in time, while SPF records and DomainKeys are supported in cPanel, outgoing authentication with DKIM is not. That being said, please keep the following points in mind while following this tutorial:
- The cPanel developers indicated that DKIM auth will be a feature in 11.32, therefore, when 11.32 is released it’s possible that a few steps in this guide will become obsolete
- cPanel does not recommend or provide support for some of the changes this tutorial will ask you to make. As usual, make these changes at your own risk or use our server consultation services for help
Upgrade Exim
DKIM is supported in Exim 4.70 and higher – the version current at the time this article was written is 4.69. Therefore, you will need to upgrade. Hop over to the below URL, locate the latest version of Exim 4.7x, and navigate to the folder that corresponds with your operating system to find the RPM:
http://httpupdate.cpanel.net/exim/
In this case, we downloaded the RPM from:
http://httpupdate.cpanel.net/exim/4.70-4/centos/5.6/exim-4.70-4_cpanel_maildir.i386.rpm
On your server, run the following command (replace the URL with the one corresponding to the RPM you found)
rpm -Uvh http://httpupdate.cpanel.net/exim/4.70-4/centos/5.6/exim-4.70-4_cpanel_maildir.i386.rpm --nodeps
Now, verify the version:
root@server [~]# rpm -qa |grep -i exim
exim-4.70-4_cpanel_maildir
You’ll also want to keep cPanel from running an Exim update and reverting the version back to 4.69:
touch /etc/eximupdisable
If you have existing domains on this server, make sure to move local and remote domains files back:
mv -f /etc/localdomains.rpmsave /etc/localdomains
mv -f /etc/remotedomains.rpmsave /etc/remotedomains
*If you have trouble installing the RPM due to fetchmail or a conflict with the previously-install Exim package, do
yum remove fetchmail
rpm -e exim-4.69-29_cpanel_maildir (replace with the actual name of the old Exim package)
Install DomainKeys
The topic of how to install DomainKeys was previously covered in this article. Install the keys for each user, or run a loop as shown in the article to install them for all users. The keys will be in: /var/cpanel/domain_keys/[public|private]/$domain .
Configure Exim
Open /etc/exim.conf and near the top, add the following lines:
DKIM_DOMAIN = ${lc:${domain:$h_from:}}
DKIM_FILE = /var/cpanel/domain_keys/private/${lc:${domain:$h_from:}}
DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
Then scroll down until you see these lines:
remote_smtp:
driver = smtp
Replace this with:
remote_smtp:
driver = smtp
dkim_domain = DKIM_DOMAIN
dkim_selector = default
dkim_private_key = DKIM_PRIVATE_KEY
dkim_canon = relaxed
dkim_strict = 0
Now, restart Exim:
service exim restart
The additions to exim.conf will use a domain’s key, if the domain has one, to sign each message with DKIM.
Now, keep in mind that cPanel will overwrite these changes during cPanel updates. You have the following options:
- Run chattr +ia /etc/exim.conf, OR:
- Copy /etc/exim.conf to /root/exim.conf and create a file called /scripts/posteximup (and chmod to 700) containing the following code:
scp -p /root/exim.conf /etc/exim.conf
service exim restart
Verify
The easiest way to verify the functionality of your new DKIM setup is to send an email from your server to check-auth@verifier.port25.com . You’ll get an autoresponse back letting you now that everything is working (note that with DKIM, DomainKeys are obsolete so a status of “neutral” is normal)
SPF check: pass
DomainKeys check: neutral
DKIM check: pass
Sender-ID check: pass
SpamAssassin check: ham
Related posts:





sending...

Wow…thanks.. 100% working
The DKIM part works well but not so much from the domain keys part.
I get “Domain keys are not installed on this machine.” Suggestions? and thanks
Does this happen before or after upgrading Exim? I wasn’t able to reproduce the problem yet but I’ll take a look.
Man… I can’t believe it! I finally got DKIM protocol installed on my RedHat Linux Server without having to wait on poor ol’ cPanel.
Thank you… Thank you… Thank you…
You don’t know how long I’ve waited for this moment…
Too Darn Long…. Many Thanks — Christopher :)))
I keep getting the following error message:
Retrieving http://httpupdate.cpanel.net/exim/4.70-4/centos/5.7/exim-4.70-4_cpanel_maildir.i386.rpm
Preparing… ########################################### [100%]
file /usr/sbin/exicyclog from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/eximstats from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/exinext from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/exiwhat from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
Any help? Iv tried doing the yum fetchmail thing but it says its been found but its not installed so nothing to do. Any help would be great.
Any ideas?
root@lazarus [/]# rpm -Uvh http://httpupdate.cpanel.net/exim/4.70-4/centos/5.6/exim-4.70-4_cpanel_maildir.i386.rpm –nodeps
Retrieving http://httpupdate.cpanel.net/exim/4.70-4/centos/5.6/exim-4.70-4_cpanel_maildir.i386.rpm
Preparing… ########################################### [100%]
file /usr/sbin/exicyclog from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/eximstats from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/exinext from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
file /usr/sbin/exiwhat from install of exim-4.70-4_cpanel_maildir.i386 conflicts with file from package exim-4.69-30_cpanel_maildir.x86_64
Disregard. I got it.
Thanks! Got DKIM to work by following these instructions.
Not directly related but I’m getting to a dead end :( so I thought I might ask anyway:
I’m still hitting the Junk folder on hotmail. Any ideas?
So my yum is broken. And I’m having a conflict to install Exim 4.7 over the previous version..
Since I can’t use yum to remove fetchmail.. And I can’t fix the yum right now.. Do I have any other way to install Exim 4.7?
I could stop exim 4.6, update to version 4.7 and restart Exim 4.6.. right?
If you upgrade Exim to 4.7, 4.6 would no longer be installed. You’d have to downgrade again, which would essentially be running /scripts/eximup –force.
You don’t have to use Yum. You can remove the RPMs manually and then install the Exim 4.7 ones the same way:
service exim stop
rpm -qa |grep -i exim
For each RPM listed, do ‘rpm -e $rpmname’
Then download the Exim 4.7 rpm and install with rpm -i. I don’t use Yum in this tutorial except to remove fetchmail. You can remove it via rpm -e as well.
Hi, Vanessa !
#rpm -qa |grep -i exim
exim-4.69-30_cpanel_maildir
Problems:
[~]# rpm -Uvh http://httpupdate.cpanel.net/exim/4.70-4/64/centos/5.0/exim-4.70-4_cpanel_maildir.x86_64.rpm
Retrieving http://httpupdate.cpanel.net/exim/4.70-4/64/centos/5.0/exim-4.70-4_cpanel_maildir.x86_64.rpm
error: Failed dependencies:
libresolv.so.2(GLIBC_PRIVATE)(64bit) is needed by exim-4.70-4_cpanel_maildir.x86_64
perl(SafeFile) is needed by exim-4.70-4_cpanel_maildir.x86_64
# uname -a
Linux server 2.6.18-274.7.1.el5 #1 SMP Thu Oct 20 16:21:01 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Help-me
King Regards !
As per the instructions, you need to use –force and –nodeps when installing the new RPM.
Hi, Vanessa !
Thank you so much !
King Regards !
Hi Vanessa !
#rpm -qa |grep -i exim
exim-4.69-30_cpanel_maildir
#rpm -Uvh http://httpupdate.cpanel.net/exim/4.70-4/64/centos/5.0/exim-4.70-4_cpanel_maildir.x86_64.rpm –nodeps –force
Retrieving http://httpupdate.cpanel.net/exim/4.70-4/64/centos/5.0/exim-4.70-4_cpanel_maildir.x86_64.rpm
error: skipping http://httpupdate.cpanel.net/exim/4.70-4/64/centos/5.0/exim-4.70-4_cpanel_maildir.x86_64.rpm – transfer failed – Unknown or unexpected error
4.70-4_cpanel_maildir.x86_64.rpm – transfer failed – Unknown or unexpected error ?
Help-me !
King regards !