Hello all,

I would like to implement rewriting of envelope recipient addresses
as they are recieved by smtpd(8) prior to the respective message being
fed into "the queue", based solely on the form of the envelope recipient
addresses in question. So far, I was able to figure out that to accomplish
this task for arbitrary address/domains, the virtual(5) tables are the
means to express these relationships, and that the cleanup(8) daemon
does the actual work.

Specifically, I would like to make sure that the case-insensitive
 <postmaster>  forward-path as required by RFC 5321 [1] is rewritten
to  <postmaster@$mydestination> , where

    mydestination = $myhostname

holds.

Secondly, I would like to have either forward-path  <postmaster@$mydestination>
and each of the  <postmaster@[$inet_interfaces]>  (no  $proxy_interfaces  here)
rewritten to the forward-path  <postmaster@⟨some virtual mailbox domain⟩> .

Assuming that I maintain neither local domains nor relay domains, and only
virtual mailbox domains, and that

    myorigin = $myhostname

holds, the first requirement might be accomplished with having

    append_at_myorigin   = yes
    local_recipient_maps = inline:{ { postmaster = - } }

although I am uncertain about whether the maps specified
for  local_recipient_maps  perform case-folding like virtual(5)
maps do.  The LOCAL_RECIPIENT_README did not help in this regard,
either.

To satisfy the second requirement, I currently have

    virtual_alias_domains =
    virtual_alias_maps    =
        inline:{ { postmaster = postmaster@⟨some virtual mailbox domain⟩ } }

and this is where the problem starts.

The manpage to virtual(5) suggests in section TABLE SEARCH ORDER that
it first tries left hand sides of the form  ⟨local-part⟩@⟨domain⟩ ,
then  ⟨local-part⟩ and finally  @⟨domain⟩ .  It also introduces the
concept of virtual alias domains and that with an empty
 virtual_alias_domains , the /first line/ of (any of) the maps
in  virtual_alias_maps  tell cleanup(8) what that virtual alias domain
is. However, since only the left hand side of that first line is being
evaluated to decide what that virtual alias domain is, an ambiguity is
introduced w.r.t. non-virtual alias domain rewriting.  This is because,
syntactically, a ⟨local-part⟩ like  postmaster  is indistinguishable
from a ⟨domain⟩ [2], more so  firstname.lastname  (notice the dot).

So, the question is, how do I tell Postfix to disable its virtual alias
domain machinery, yet have the full power of address rewriting with
virtual(5) at my disposal?


Thanks,
Mono

[1] https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.3 RECIPIENT 
(RCPT)]
[2] https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.2 Command 
Argument Syntax

Attachment: signature.asc
Description: PGP signature

Reply via email to