On 10.02.21 15:55, Chris Green wrote:
> I could just edit the value in each system, but then all the main.cf
> files would be different.

On Wed, Feb 10, 2021 at 05:31:47PM +0100, Matus UHLAR - fantomas wrote:
setting "myhostname = $(dnsdomainname)" what Wietse recommended would not.

On 10.02.21 17:05, Chris Green wrote:
Yes, but since I'd have to add something to each rc.local (and they're
mostly default, i.e. as installed) it's more stuff to keep maintained.

either you have to change system hostname to a FQDN anywhere once
or you have to change postfix's main.cf to correct domain anywhere once
or you have to change rc.local to set postfix domain anywhere at each boot

you still have to change something, because your systems are clearly not
configured enough to find the FQDN by default.

Setting FQDN hostname or maybe setting own IP with FQDN in /etc/hosts would
not (I'm not sure whether te latter one would be enough, you can try)

Yes, I've tried these.  I added the FQDN to /etc/hosts such that
dnsdomainname returns the domain but postfix doesn't use that.  I've
also tried setting 'hostname <FQDN>' and that hasn't helped either.

I have just checked that if I set system hostname to "hostname.domain",
"postconf -d mydomain" immediately changes.
... I don't have "myhostname" or "mydomain" set in main.cf - you do.

I was in your situation some years ago, when I maintained the same configs
for multiple apps on multiple servers. I maintained /etc/hosts and
hostnames per-machine and most of the rest was the same.

So I have the FQDN everywhere:-

   chris@isbdGandi$ hostname
   isbdGandi.isbd.uk
   chris@isbdGandi$ more /etc/hosts
   # The following lines are desirable for IPv4 capable hosts
   127.0.0.1       isbdGandi.isbd.uk isbdGandi isbd localhost

no no no.
127.0.0.1 is always supposed to resolve to "localhost".
If those hosts don't have their assigned IP, Debian uses "127.0.1.1" for
their hostnames.

   ...
   ...
   chris@isbdGandi$ dnsdomainname
   isbd.uk
   chris@isbdGandi$

... and now postfix sends cron mail *to* ch...@isbd.uk as well as from
ch...@isbd.uk which doesn't help at all!

This is exactly what myorigin is supposed to do and since you have in your
main.cf:

   myorigin = $mydomain

It's exactly what you configured:

https://marc.info/?l=postfix-users&m=161296782703357&w=2

I have an entry for chris in
/etc/aliases:-

   chris:ch...@isbd.co.uk

but this doesn't seem to have worked.  What am I doing wrong now? (I
have run 'newaliases').

if you want each host to send mail with its hostname in  "From:" and "To:",
don't set "myorigin" (default is $myhostname) or set it to what you want to
see.

Further, you can alias local recipients to whatever you want to forward mail
to.

--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
You have the right to remain silent. Anything you say will be misquoted,
then used against you.

Reply via email to