I'm struggeling setting up exim 4 with an external SRS daemon (Debian package srs). The srsd is running and converting addresses back and forward just fine. I can't use exim's built-in srs code, since it is not enabled in Debian (in know I can compile myself, but it is not an option).
What I have problems with is the srs_forward router within exim to add SRS tags to forwarded mails. I have the following redirect router in place, which should run only for non-error messages from non-local senders and non-local recipients, which are not relayed for another mx - at least I understand srs to be applied to such messages. Please correct me, if this is wrong. I have the following code:
srs_forward:
debug_print = "R: srs_forward for $local_part@$domain"
driver = redirect
senders = ! :
condition = ${if ! match_domain{$sender_address_domain}{+local_domains}}
domains = ! +local_domains : ! +relay_to_domains
address_data = ${readsocket{/tmp/srsd}\
{FORWARD $sender_address_local_part@$sender_address_domain $domain\n}\
{5s}{\n}{:defer: SRS daemon failure}}
errors_to = ${quote_local_part:${local_part:$address_data}}@${domain:$address_data}
data = ${quote_local_part:$local_part}@$domain
headers_add = X-SRS: Sender address rewritten from $sender_address to ${quote_local_part:${local_part:$address_data}}@$$
repeat_use = false
allow_defer
no_verify
What I could test and works: The return path gets generated right (lines with address_data and errors_to, as well as the to-address (line starting with data).
I'm unsure with the preconditions:
senders = ! :
This line should prevent the router from running for error messages.
condition = ${if ! match_domain{$sender_address_domain}{+local_domains}}
This line should prevent the router from running for messages from local senders.
domains = ! +local_domains : ! +relay_to_domains
This line should prevent the router from running for messages to local recipients or for relayed messages.
Could some one please clarify?
(I used a manual as a starting point, although with no success.)