Exim: How to turn off DKIM for forwarded mail

dkimexim

I have DKIM configured in Exim for outgoing mail, as per the documentation. Exim signs all outgoing mail. But some of those outgoing messages are forwards, thanks to a user's .forward file. This is a problem for me, because some of those forwards are spam (my exim configuration does not do any verification) and I don't want to take responsibility for them. But I can't figure out how to configure Exim not to sign these messages.

My configuration is basically the Debian Squeeze default, with a few DKIM_* macros set. I can post more details, but I think seeing any example of conditional DKIM signing would set me right.

Best Answer

Bit of a necropost, but I simply use a line:

dkim_private_key = ${if or {{!def:sender_host_address}{def:authenticated_id}}{DKIM_PRIVATE_KEY}{}}

(where DKIM_PRIVATE_KEY is a macro giving the path to my dkim private key).

Then if this is a 'locally-originated' message (so $sender_host_address is undefined) or the email comes from an authenticated user, dkim_private_key will be set, and the message will be signed.

Else (which should just mean we're forwarding a message, assuming we're not a relay), dkim_private_key will be the empty string which (from the specs) means the message won't be signed.

Related Topic