On Fri, Jun 11, 2021 at 04:11:14PM -0700, sru...@gemneye.org wrote: > On 2021-06-11 15:12, Viktor Dukhovni wrote: > > > > I will make a bold guess that the real problem you're trying to solve > > dealing with mail from "root" and similar system users, where in a > > network of null-client hosts delivering all mail to a central mail hub, > > you want the sender address to clearly reflect where the mail came > > from. > > > > See: http://www.postfix.org/MULTI_INSTANCE_README.html#split for a > > walk- > > through of how to configure such null-client instances. > > > > Yes, I want null client per se, but not sure I need a multi-instance > setup. It looks overly complicated for what I am trying to accomplish.
The null-client portion of the multi-instance tutorial is self-contained and independent of the rest. You can configure just the null-client "instance" on end-systems and run the "mta instance" on the shared mail hub. > Plus, in the example Makefile it still looked like a static map was > being set per user. The null client example shows how to deal with a few system accounts, and assumes that for interactive user accounts the specific host is should not be used to decorate the sender address. You can adjust the recipe to your needs. > I need users who login with AD credentials (who do not have accounts > in a passwd file), to be able to send mails, but as you have guessed, > I want to include the server name in the user section of the FROM > address instead of include hostname the @domain section (project's > requirement). I've never seen a situation where I'd want such suffixes for mail from interactive human users, but if that's what you need, go for it. > > If you really want to do this for arbitrary sender local parts, you'll > > need a regexp or pcre table, and for bonus points some care to get it > > right for quoted local-part addresses. > > > > /^"(.*)"@local\.domain$/ ${1}-hostname@some.domain > > /^(.*)@local\.domain$/ ${1}-hostname@some.domain > > > > But, unless you have "-" as your recipient delimiter on the central > > mailhub, the resulting sender address is invalid, which is best > > avoided. > > I will use a different delimiter ("+"). Thank you for the tip. > > If I am going to do PCRE table can I still use generic map, or do I need > to use something like smtp_header_checks? Unless stated otherwise, all Postfix features that support table lookups work with all table drivers. In a few cases there are security restrictions on the use of ${n} substitutions regexp/pcre tables, these are documented. When the documentation says "tabletype:tablename" (or similar) it means *any* table type. -- Viktor.