> On Jun 15, 2024, at 06:19, Wietse Venema via Postfix-users 
> <postfix-users@postfix.org> wrote:
> 
> Dan Mahoney via Postfix-users:
>> Hello,
>> 
>> We currently have myorigin = $mydomain, and mydomain = dayjob.org
>> on one of our border MXes, which is also the outbound MX for our
>> whole organization.  We are a fairly large site with mxes in two
>> locations and many machines which send mail which may relay through
>> here.  Mydomain feels like the *correct* origin answer.
>> 
>> However, we would like our rootmail to respect our aliases file,
>> which tells root to go to a specific mail destination on a specific
>> box.
> 
> Use virtual_alias_maps, as shown below.
> 
>> FreeBSD by default sends all its nightly security checks and the
>> like to "root" (bareword), and we globally deploy an alias file
>> that reroutes this to a collector on a single machine, both for
>> our machines that run postfix, as well as our machines that run
>> more simple mailers like dma.  We'd like the expectations consistent
>> across the board.
> 
> Use a virtual alias mapping from "r...@dayjob.org" to the collector
> email address.  This is a variation on
> 
> /usr/local/etc/postfix/main.cf:
>     virtual_alias_maps = hash:/local/etc/postfix/virtual-for-root
> 
> /local/etc/postfix/virtual-for-root:
>    r...@dayjob.org collector-u...@collector-host.dayjob.org
> 
> Run "postmap hash:/local/etc/postfix/virtual-for-root" after
> editing the file.
> 
> Instead of a hash: map you could use a networked table such as *SQL
> or LDAP.

This would still result in rootmail being from root@mydomain, not 
root@myhostname -- regardless of the destination, which makes it way more 
confusing to read.

If I send mail to root@localhost, it respects aliases and does the right thing. 
 If I send mail to "root", it does not, because it already hits our existing 
virtual_maps destination for r...@dayjob.org <mailto:r...@dayjob.org>.  (That 
address reaches people, not a collector script.  Our cron handling script does 
eventually fall-through to those people if it doesn't match the usual cron 
stuff)

We are already setting masquerade_domains for our entire domain:

mydestination = $myhostname, localhost.$mydomain, post.dayjob.org, localhost
masquerade_domains = !lists.dayjob.org, dayjob.org <http://dayjob.org/>
masquerade_exceptions=root

So on every other system that just appends their hostname to rootmail, this 
already works, and we don't rewrite it.

So perhaps the masquerading covers most of the normal uses of 
myorigin=mydomain?  

What else is covered in the definition of "myorigin" when it says "domain that 
appears in mail that is posted on this machine"?

-Dan
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to