>> > On 21.04.22 17:51, Matus UHLAR - fantomas wrote:
>> > >I'm trying to implement SRS using postsrsd. Since it always rewrites
>> > >non-local sender (even for incoming mail) I'm trying to restrict it
>> > >only for outgoing mail.

>Wietse Venema:
>> SRS sender rewriting is in scope for email that is forwarded from
>> elesewhere to elsewhere through virtual aliasing etc., or for email
>> that is delivered locallly AND FORWARDED through ~/.forward files,
>> or delivery to "|command".

On 28.04.22 13:42, Wietse Venema wrote:
And not in scope is forwarding between different-preference MX
hosts.

as I say, This is luckily not case (at least now) of any servers I maintain.
otherwise, the multi-instance approach would be unavoidable (no objections).

Also, email can have both internal and external recipients,
therefore per-message sender rewriting is incorrect because messages
have recipients with different kinds of SRS scope.

after mail gets delivered to local recipients, it's sent out, which is when SRS needs to happen, no matter how it's sent (aliases, virtual aliases, .forward, |sendmail).

this requires outgoing mail to be processed by cleanup in order to apply canonical_maps, no matter if different instance.

On 28.04.22 10:50, Wietse Venema wrote:
>This delivers remotely with a remote envelope sender.

Matus UHLAR - fantomas:
yes, this is what SRS is for: forwards.

The problem comes from postsrs being called in *_canonical_maps, which are

I don't think you can do what I describe with a single Postfix MTA,
because there is no "smtp_generic_classes = envelope_sender" or
"smtp_sender_generic_maps" support. If someone can figure out if
that would solve the problem, then it could be implemented.

That's why I used smtpd:10027 and cleanup_out hack for outgoing mail.
The envelope from adress got rewritten and mail got back to queue and was handled by the same postfix instance, but with local (srs-ed) envelope from:

Apr 28 18:44:54 fantomas postfix/cleanup[6211]: E137BA01DE: 
message-id=<99c69201-41bf-e8c9-9662-c9a1c3afb...@example.com>
Apr 28 18:45:04 fantomas postfix/qmgr[32719]: E137BA01DE: 
from=<uh...@example.com>, size=1426, nrcpt=2 (queue active)
Apr 28 18:45:04 fantomas postfix/localhost:10027/smtpd[6311]: connect from 
localhost[127.0.0.1]
Apr 28 18:45:04 fantomas postsrsd[6314]: srs_forward: <uh...@example.com> rewritten 
as <SRS0+aKyI4=VG=example.com=uh...@fantomas.sk>
Apr 28 18:45:04 fantomas postsrsd[6314]: srs_forward: 
<SRS0+aKyI4=VG=example.com=uh...@fantomas.sk> not rewritten: Valid SRS address for 
<uh...@example.com>
Apr 28 18:45:04 fantomas postfix/cleanup_out/cleanup[6313]: 8F26DA01E8: 
message-id=<99c69201-41bf-e8c9-9662-c9a1c3afb...@example.com>
Apr 28 18:45:04 fantomas postfix/localhost:10027/smtpd[6311]: disconnect from 
localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 28 18:45:04 fantomas postfix/smtp[6309]: E137BA01DE: to=<forw...@example.com>, 
orig_to=<redac...@fantomas.sk>, relay=localhost[127.0.0.1]:10027, delay=10, 
delays=9.9/0.05/0.02/0.12, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 8F26DA01E8)
Apr 28 18:45:04 fantomas postfix/qmgr[32719]: 8F26DA01E8: 
from=<SRS0+aKyI4=VG=example.com=uh...@fantomas.sk>, size=2204, nrcpt=1 (queue 
active)
Apr 28 18:45:04 fantomas postfix/smtp[6309]: 8F26DA01E8: 
to=<forw...@example.com>, relay=mailhub.example.com[192.0.2.1]:25, delay=0.41, 
delays=0.16/0/0.17/0.09, dsn=2.0.0, status=sent (250 Ok. ...

I think it can be done today with two MTAs: one external (internet
facing) and one internal (hidden behind external MTA).

- Un-SRSify envelope senders on the way from the external MTA to
the internal MTA (internal MTA has dedicated SMTP listener + cleanup
+ envelope sender canonical mapping).

you apparently mean un-SRSify recipients, not senders.

This already works for envelope and header recipients (I sent mail to SRSed address when I tested it)

- SRSify remote envelope senders on the way from the internal MTA
to the external one (external MTA has dedicated SMTP listener +
cleanup + envelope sender canonical mapping).

so far I was successful with SRSifying sender using the way I described above, when I put:

@example.com      smtp:[localhost]:10027

into sender_dependent_default_transport_maps.
if I was able to put wildcard there, I'd have fully working SRS now:

@fantomas.sk    DUNNO
.               smtp:[localhost]:10027


--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"The box said 'Requires Windows 95 or better', so I bought a Macintosh".

Reply via email to