On Sun, Mar 17, 2024 at 01:22:29PM -0700, Glenn Tenney via Postfix-users wrote:
> I have to convert all of my "virtusertable" entries over to postfix. > I've read through > https://www.postfix.org/VIRTUAL_README.html & > https://www.postfix.org/postconf.5.html & > https://www.postfix.org/virtual.5.html and my questions aren't > resolved... > > Question 1: Am I correct that all (or most) of this be done with a > virtual_alias_maps table (i.e. hash:/usr/local/etc/postfix/virtual)? > If not, then: HOW? Most of what? You need to be specific, it's been some decades since many of us have looked at Sendmail. Much depends on what sort of mappings you're looking to emulate. For 1-to-many recipient rewrites, the best vehicle is indeed virtual(5), but if you also use local aliases(5), and $myorigin is listed in $mydestination, then you need to be sure that any RHS recipients in in aliases(5) that require virtual(5) rewriting are qualified with a domain that is not listed in $mydestination. Otherwise, local(8) will deliver these directly, despite any virtual(5) overrides. My general advice is to use aliases(5) very sparingly, just for lists that require an "owner-" or ":include:" lists. All other rewrites should be via virtual(5), and perhaps even keep $mydestination empty! Add "local.invalid local" to the transport(5) table, and rewrite anything that needs local(8) delivery to mailbox@local.invalid. > Question set 2: Here's an excerpt (sanitized) of my "virtusertable". > Does this just go into my hash:/usr/local/etc/postfix/virtual as-is? > or what? The syntax of virtual(5) is documented in that manpage. > Am I correct that this table needs to have all specific user > entries for a domain appear before the "@domain" entry for all other > users at that domain? Entry order does not matter for source files of indexed tables (hash, btree, cdb). > # should this be an alias? (I don't recall how/why/when it ended up in > my virtusertable) > auser@mylocal.domain anotheruser@mylocal.domain This is a fine entry for virtual(5) aliases. > # do all of the other entries just go into > hash:/usr/local/etc/postfix/virtual ??? Well, they go into the source file, the "postmap" command then builds the hash table. See postmap(1) for details. > # just wanting to block email to a local user > user1@mylocal.domain error:nouser 550 No such user here now or ever This is not a rewrite, and so goes into the transport(5) table (also see error(8)). user1@mylocal.domain error:5.1.1 No such user here now or ever and/or an acess(5) table referenced in your recipient restrictions: user1@mylocal.domain REJECT 5.1.1 ... > # send all other email of mylocal.domain to a specific user here > @mylocal.domain another2user@mylocal.domain Wildcard rewrites are supported, but strongly discouraged. > # block all email to a specific user at a hosted domain > user2@hosted1.domain error:nouser 550 Getting too much spam See above. > # send all email to a specific user at a hosted domain to a user at > the local domain > user3@hosted1.domain someuser@mylocal.domain Fine, the domin is irrelevant. > # block all other email of a hosted domain > @hosted1.domain error:nouser 550 Getting too much > spam userid changed See above, but transport and access(5) table entries don't use a leading "@". > # send all email for a hosted domain to some other email somewhere > @somehosted3.domain someuser@someother.domain See above. Overall, read (and if unclear ask) about the functionality and syntax of various Postfix features, rather than whether some random Sendmail syntax does or does not translate directly to virtual(5). Once you what virtual(5) does (rewrite an input envelope recipient address to one or more recipient addresses), your questions are answered. Similar advice for transport(5), (various) access(5), ... tables. -- Viktor. _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org