As part of the migration (mentioned twice previously, I need to replace vpopmail's (increasingly awkward) ability to do POP-before-SMTP with courier-imap. DRAC was the answer.

FreeBSD makes life so easy somtimes. I built the drac port with the WITH_EXIM=yes option, and the courier-imap port with the WITH_DRAC=yes option.

I configured /etc/rc.conf to run drac on bootup:

dracd_enable="YES"
rpcbind_enable="YES"
rpcbind_flags="-l -s"

Then I started rpcbind, drac, and courier-imap's POP3 daemon (easy to test):

# /etc/rc.d/rpcbind start
# /usr/local/etc/rc.d/dracd.sh start
# /usr/local/etc/rc.d/courier-imap-pop3d.sh start

Did a test login, and the /usr/local/etc/dracd.db file was updated. Tested the contents with the db3_dump185 command from the db3 port:

# db3_dump185 dracd.db
format=bytevalue
type=hash
h_ffactor=65536
db_lorder=1234
db_pagesize=16384
HEADER=END
3139362e33302e3136382e37302f333200
3130373636363735323300
3132372e302e302e312f333200
3130373636363736353200

Python (version 2.2 or above, I think) makes it arbitrary to decode the contents:

# python -c 'print "3132372e302e302e312f333200".decode("hex")'
127.0.0.1/32

Now, the hardest part - getting exim to use this database for relaying. After much searching, here's the answer:

hostlist   relay_from_hosts = localhost : net32-dbm;/usr/local/etc/dracd.db

If you're doing this without using FreeBSD's excellent ports infrastructure, make sure drac is built with -DREQ_HASH -DCIDR_KEY in the DEFS make variable.