This post if a follow up on one of my previous posts that described how you can create a custom exim package on debian.
In this post I will show you how to compile and configure exim with domainkeys support. The configuration will be only for signing outgoing emails but it's easy to make it verify signed messages if you read the exim DomainKeys documentation
To do this first follow the steps described in my previous post and between steps 7 and 8 do these steps :
- install libdomainkeys:
download from: domainkeys.sourceforge.net , extract and make:if it doesn't compile with errors about resolv do this:
- span style="color: #ff0000;">'-lresolv'
to install just copy the static lib and the header files:
cp libdomainkeys.a /usr/local/lib cp domainkeys.h dktrace.h /usr/local/include
and then cleanup :
- Configure the exim custom package for domainkeys:
add domainkeys support to exim makefile:And now continue with step 8 in the previous post
When you're done all that's left to do is edit exim configuration to enable domain keys signing:
open /etc/exim4/exim4.conf or /etc/exim4/exim4.conf.template in an editor
look up for the remote_smtp transport definition and add the following configuration to it:
dk_domain = ${lc:${domain:$h_from:}} dk_selector = default dk_private_key = /etc/exim4/dk_keys/${dk_domain}_priv.key
Key management
create the directory that will hold the keys :
mkdir /etc/exim4/dk_keys
create the scripts that will generate and show the the keys :
span style="color: #ff0000;">"$1" = """Usage: $0 domain_name"'s/ //g' \ -e 's/-----BEGINPUBLICKEY-----//' \ -e 's/-----ENDPUBLICKEY-----//'"\"k=rsa; t=s; p=$p\""
generate a key for a new domain:
After you set the DNS TXT record you can test the new setup by sending an email from the newly configured domain to an account @ gmail or yahoo . At gmail view the new message and click on "details", it should show up as "signed-by: my_new_domain.tld" , yahoo will just show an icon with a key in the message header.
New blog post: exim and domainkeys on debian http://tinyurl.com/5rzre6
Thanks a lot for your posts on this topic.
I'm implementing domainkeys for my mails to Yahoo. Although I have taken many precautions (SPF-Record/clean Blacklists/Reverse DNS/Static IP/no unauthorized relay) , somehow Yahoo still puts most of my mails into the spam-folder.
A small note on your post.
There is a small mistake:
cp domainkeys.h dktrace.h /usr/local/includes
should be
cp domainkeys.h dktrace.h /usr/local/include
That gave me a compilation error, but I can live with the additional minutes spent 😉
Thanks again and cheers!
– leonard
Thanks for the note. I have corrected the post now.
When testing Gmail now says 'mailed-by:' rather than 'signed-by:'
Fantastic guide though! Information on how to build custom debian packages is hard to come by and this couldn't have been simpler. It's only because of the guide that I can give you the above small amendment :]
Many thanks!
if it shows mailed by it means something is not working at the domainkeys level. Look at the message source if it has the signature in there maybe something's wrong with the DNS entries.
Hi,
I get “closed connection in response to sending data block” when I try to send out emails dkim signed. Any clues?