[exim] SRS - solved!

Top Page

Reply to this message
Author: Marco Gaiarin
To: exim-users
Subject: [exim] SRS - solved!

Ok, many thanks to Andrey Melnikov that, offlist, helped me.

Finally i've solved my issue with SRS. Because could be useful to others, i
post my findings here.

1) the ''bounce'' router HAVE TO EXIST and HAVE NOT the 'no_verify' option
set; Doing the rewrite, exim verify that the SRS-generated local address
exist, and refise to redirect to non-working addresses.

My bounce router currently is:

debug_print = "R: srs_bounce for $local_part@$domain"
driver = redirect
domains = +local_domains
local_part_prefix = srs0+ : srs0- : srs0= : srs1+ : srs1- : srs1=
address_data = ${run{/bin/sh -c "/usr/bin/srs --reverse --secretfile=SRS_SECRETFILE --hashlength=SRS_HASHLENGTH ${local_part_prefix}${local_part}@${domain} 2> /dev/null
data = ${quote_local_part:${local_part:$address_data}}@${domain:$address_data}

Because the hash may contain the '/' character, the local part character
restriction have to be relaxed:

CHECK_RCPT_LOCAL_LOCALPARTS = ^[.] : ^.*[@%!|`#&?]

Then, the router that do the SRS rewriting set the errors_to:

address_data = ${run{/bin/sh -c "/usr/bin/srs --secretfile=SRS_SECRETFILE --hashlength=SRS_HASHLENGTH --alias=SRS_DOMAIN $sender_address 2>/dev/null"}{$value}{:fail: SRS failure}}
errors_to = ${quote_local_part:${local_part:$address_data}}@${domain:$address_data}
headers_add = "X-SRS: Sender address rewritten from <$sender_address> to <${quote_local_part:${local_part:$address_data}}@${domain:$address_data}> by $primary_hostname."
headers_remove = SRS_HEADERS_REMOVE

This not suffices. A rewriter have to be addedd. In debian, the easest way
is to define:

REMOTE_SMTP_HEADERS_REWRITE = *@* "${if !eq{$h_errors_to::}{}{$h_errors_to::}{$sender_address}}" s

Also, if you want some logging, you can set:
MAIN_LOG_SELECTOR == MAIN_LOG_SELECTOR +address_rewrite +return_path_on_delivery +sender_on_delivery

A little note. If i set REMOTE_SMTP_RETURN_PATH, that seemed to me the right
option, not only does nothing, but also the rewrite stop working.
Boh. If someone can explain me...


  STOP. I wanna go home
  take off this uniform and leave the show        (Pink Floyd)