Am 2022-02-11 um 15:38 schrieb Wietse Venema:
michael.osi...@siemens.com:
Hi,

I am currently migrating from a sendmail-based relay to Postfix 3.6.3.
Sendmail has the feature to automatically rewrite @localhost to
@$myhostname automatically. As far as I have seen Postfix doesn't do
this with trivial-rewrite(8) by default nor is a config option for this.

What I have come up with is doing in /usr/local/etc/postfix/canonical:
@localhost @myhostname

I had to add the actual hostname since @$myhostname is not supported.
My question: Is this the proper way to go with Postfix to mimic sendmail
behavior?

We can do soething similar in Postfix:

/etc/postfix/main.cf:
    sender_canonical_maps = inline:{{@localhost = @$myhostname}}

The downside of doing this is that the Postfix SMTP server will
accept mail from non-existent@localhost, so if you could make the
rule more specific (a collection of 1:1 mappings) then that would
help.

Forgive me my naive questions, that's the third day I am using Postfix.

Thanks for the input. That sounds like something, but duplicating
the entire NIS map is certainly something I don't want to do and never set up the aliases with NIS before.

What I have figured out now (according to [1]) is to send a message to 'non-existent@localhost' and 'non-existent', Postfix says:
Feb 11 16:03:02 deblndw013x3j postfix/local[44857]: 0628058368: 
to=<m...@deblndw013x3j.ad001.siemens.net>, orig_to=<mumu@localhost>, relay=local, 
delay=0.25, delays=0.13/0/0/0.11, dsn=5.1.1, status=bounced (unknown user: "mumu")
then reads my .foward to send bounce report and delivers to my personal maibox. I see this:
Remote Server returned '554 5.1.1 < #5.1.1 X-Postfix; non-existent: "mumu">'

So leaving with the canonical hash it will reject?

Michael

[1] http://www.postfix.org/LOCAL_RECIPIENT_README.html

Reply via email to