On Tue, 10 Mar 2026 at 14:10, Matus UHLAR - fantomas via Postfix-users
<[email protected]> wrote:
>
> I don't fully understand how you mean that.
> But I guess it would become more complicated than just using multi instance.

I ended up using sender_dependent_default_transport_maps to route
forwarded emails to a separate smtpd service in master.cf with its own
cleanup service defined.
It seems to work fine based on my simple tests.

Any reasons why it could be problematic?

main.cf:
# global reverse SRS
recipient_canonical_maps = socketmap:unix:srs:reverse
recipient_canonical_classes = envelope_recipient, header_recipient
# no global sender_canonical_maps, forward rewriting happens only in
srscleanup (master.cf)
sender_dependent_default_transport_maps =
        pcre:/etc/postfix/checks/sender_nosrs.pcre
        proxy:mysql:/etc/postfix/mysql/mysql-sender-nosrs.cf
        static:srsfwd:[127.0.0.1]:10027

sender_nosrs.pcre - returns DUNNO for null sender, SRS domain and
system domains (mydestination)
mysql-sender-nosrs.cf - returns DUNNO for all virtual domains in
database (SELECTs based on %d)

master.cf:
# SRS for forwarded mail: srsfwd(smtp client) -> 127.0.0.1:10027 ->
srscleanup (postsrsd forward) -> smtp
srsfwd    unix  -       -       y       -       -       smtp
  -o syslog_name=postfix/srsfwd
  -o smtp_tls_security_level=none
  -o smtp_send_xforward_command=yes
  -o disable_mime_output_conversion=yes

127.0.0.1:10027 inet n  -       y       -       -       smtpd
  -o syslog_name=postfix/srsfwd-in
  -o cleanup_service_name=srscleanup
# loop guard: re-injected mail always goes out via smtp, bypassing
sender_dependent_default_transport_maps
  -o content_filter=smtp:
  -o receive_override_options=no_unknown_recipient_checks,no_milters
  -o smtpd_milters=
# keep headers untouched so the original DKIM signature stays valid
  -o local_header_rewrite_clients=
  -o smtpd_client_restrictions=
  -o smtpd_helo_restrictions=
  -o smtpd_sender_restrictions=
  -o smtpd_relay_restrictions=
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o mynetworks=127.0.0.0/8
  -o smtpd_authorized_xforward_hosts=127.0.0.0/8
  -o smtpd_tls_security_level=none
  -o smtpd_error_sleep_time=0
  -o smtpd_soft_error_limit=1001
  -o smtpd_hard_error_limit=1000

srscleanup unix n       -       y       -       0       cleanup
  -o syslog_name=postfix/srscleanup
  -o sender_canonical_maps=socketmap:unix:srs:forward
  -o sender_canonical_classes=envelope_sender
  -o recipient_canonical_maps=
  -o virtual_alias_maps=
  -o header_checks=pcre:/etc/postfix/checks/srs_header_checks.pcre
  -o mime_header_checks=
  -o nested_header_checks=
  -o body_checks=

srs_header_checks.pcre - removes X-Spamd-Result
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to