Adding domainkeys support to qmail under FreeBSD

Recently, I have been adding domainkeys support to qmail by following John Simpson’s manual under FreeBSD 6.3-RC2. I will not repeat installation procedure here as it’s all crystal clear from the link above. However, I faced with couple of small issues while doing domainkeys integration – I’m not sure may be it’s specific to FreeBSD only. Anyway, I think it’s worth to mention them here.

First, the latest libdomainkeys package could be installed from ports:

cd /usr/ports/mail/libdomainkeys && make install clean

Second, after applying combined and the domainkeys add-on patches I’ve got an error during building qmail:

./compile qmail-dk.c
qmail-dk.c:23:24: domainkeys.h: No such file or directory
qmail-dk.c:46: error: syntax error before "DK_STAT"
*** Error code 1

Stop in /usr/src/custom/qmail-1.03.

The fix was obvious. Despite the fact that domainkeys.h was correctly placed under /usr/local/include directory qmail-dk.c was not happy about location. Fixed by hardcoding domainkeys.h path (line 23) in qmail-dk.c:

#include "/usr/local/include/domainkeys.h"

UPD [20080721]: Could be fixed by linking /usr/local/include/domainkeys.h with /usr/lib/domainkeys.h, and /usr/local/include/dktrace.h with /usr/include/dktrace.h as well:

ln -s /usr/local/include/domainkeys.h /usr/include/domainkeys.h
ln -s /usr/local/include/dktrace.h /usr/include/dktrace.h

It was not yet over! Here came another error:

./compile qmail-dk.c
qmail-dk.c: In function `main':
qmail-dk.c:162: warning: return type of 'main' is not `int'
./load qmail-dk triggerpull.o fmtqfn.o now.o date822fmt.o datetime.a seek.a ndelay.a open.a sig.a  substdio.a error.a fs.a auto_qmail.o  auto_split.o auto_uids.o fd.a wait.a -ldomainkeys -lcrypto env.a control.o open.a getln.a stralloc.a alloc.a  scan_ulong.o str.a `cat dns.lib`
/usr/bin/ld: cannot find -ldomainkeys
*** Error code 1

Stop in /usr/src/custom/qmail-1.03.

Basically, as you can see from the error, libdomainkeys was not found. Linking libdomainkeys.a, which was placed under /usr/local/lib, with /usr/lib should solve the issue:

ln -s /usr/local/lib/libdomainkeys.a /usr/lib/libdomainkeys.a
ln -s /usr/local/lib/libdomainkeys.so.3 /usr/lib/libdomainkeys.so
ln -s /usr/local/lib/libdomainkeys.so.3 /usr/lib/libdomainkeys.so.3

And finally the last adjustment just to be on the safe side:

ln -s /usr/local/share/libdomainkeys/dknewkey /usr/local/bin/dknewkey

Tags: , ,

2 Responses to “Adding domainkeys support to qmail under FreeBSD”

  1. Andrei says:

    Nice. but following manual dknewkey should be installed directly under /usr/local/bin.

  2. r00t says:

    Not really. Did cvsup couple of minutes ago — same issue:


    %pkg_info | grep libdomainkeys
    libdomainkeys-0.69

    %find /usr/local/* -name dknewkey -print
    /usr/local/share/libdomainkeys/dknewkey

Leave a Reply