On Sun, Jan 29, 2023 at 05:57:45PM -0500, Wietse Venema wrote:

> > > Is there a way to accomplish that?
> > 
> > Yes:
> > 
> >   master.cf:
> > 
> >     smtp       inet  n       -       n       -       -       smtpd
> >         -o { append_at_myorigin = yes }
> >         -o { rewrite_service_name = bh-rewrite }
> >         -o { cleanup_service_name = bh-rewrite }
> 
> (bh-cleanup)

Indeed.  Apologies to the OP about the typo.

> >     bh-cleanup unix  n       -       n       -       0       cleanup
> >         -o { append_at_myorigin = yes }
> >         -o { rewrite_service_name = bh-rewrite }
> >     ...
> >     rewrite    unix  -       -       n       -       -       trivial-rewrite
> >     bh-rewrite unix  -       -       n       -       -       trivial-rewrite
> >         -o { myorigin = blackhole.invalid }
> > 
> > This will affect all unqualified addresses that come in via the SMTP
> > service in question.  All other sources remain unchanged.
> > 
> > You could even use some sort of NAT rules to direct incoming
> > SMTP traffic from just the problem clients to the custom SMTP
> > service on an alternate IP:port.
> 
> I suspect that "-o { append_at_myorigin = yes }" is needed only for
> the bh-rewrite service. The append_at_myorigin value is is referenced
> only in the trivial-rewrite daemon, and is not sent via IPC.

Yes, and I even checked where the parameter is used, but then wrote my
post apparently on auto-pilot.  So the corrected "recipe" (modulo any
new typos, testing recommended) should be:

    smtp       inet  n       -       n       -       -       smtpd
        -o { rewrite_service_name = bh-rewrite }
        -o { cleanup_service_name = bh-cleanup }
    ...
    cleanup    unix  n       -       n       -       0       cleanup
    bh-cleanup unix  n       -       n       -       0       cleanup
        -o { rewrite_service_name = bh-rewrite }
    ...
    rewrite    unix  -       -       n       -       -       trivial-rewrite
    bh-rewrite unix  -       -       n       -       -       trivial-rewrite
        -o { append_at_myorigin = yes }
        -o { myorigin = blackhole.invalid }

-- 
    Viktor.

Reply via email to