Re: [Exim] Matching bounce recipients against sender hashes

Góra strony
Delete this message
Reply to this message
Autor: Tony Finch
Data:  
Dla: Tor Slettnes
CC: Exim User's Mailing List
Temat: Re: [Exim] Matching bounce recipients against sender hashes
On Thu, 10 Jun 2004, Tor Slettnes wrote:
>
> Question #1: Does Exim directly or indirectly (e.g. via ${perl...})
> support any two-way hashing mechanism, i.e:
>         value + secret -> hash
>         hash + secret  -> value


That's called symmetric cryptography, not hashing.

What you want to do is create the signed sender address with something
like

$local_part+$message_id.${hmac{md5}{SECRET}{$local_part+$message_id}}@$domain

i.e. you include some uniquifying data (the message ID in this case) in
the address, and you protect it from forgery using an HMAC signature
(keyed-hash message authentication code). Note that all the input for the
signature apart from the secret is repeated outside the signature, so that
someone else who knows the secret can check the signature by re-creating
it and comparing, thus:

${if and{{ match{$local_part}{^([^.]*)} }
         { eq{$local_part}
             {$1.${hmac{md5}{SECRET}{$1}}} }}
     {ok} {bad} }


You might also want to limit the time for which these addresses are valid,
to protect against replay attacks. A fortnight is probably a good period
to use, and anything less than a week is likely to be too short. This is
more difficult because Exim doesn't have a base 62 decode expansion
operator to get the time out of the message ID, or a string less-than
comparison operator for comparing base 62 encoded times.

--
Tony Finch <dot@???> http://dotat.at/