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.