Thank you for the reply. I think my question needs clarification. I'm
trying to create single configuration file that I'd be able to clone
across different servers. Manual correction of this file for every
machine is a time-consuming and error-prone step I'd like to avoid.
All servers have static IP configuration with public (within
organization) domain name, they are not moving anywhere. Therefore your
considerations do not exactly apply.
--
With Best Regards,
Marat Khalili
On 19/04/17 18:03, Viktor Dukhovni wrote:
On Apr 19, 2017, at 10:54 AM, Marat Khalili <m...@rqc.ru> wrote:
I'm having trouble creating Postfix config (main.cf) without explicitly
writing domain name in it. I'd like both myhostname and mydomain
automatically set to output of `hostname -f` or contents of /etc/mailname.
Email may persist in the queue across movements of a host (say a laptop)
between networks which may result in changes in the host's FQDN as DHCP
servers assign different domains.
It is important that bounces for a local sender are delivered to that
local sender when delivery fails some time later.
Therefore Postfix systems need a *stable* hostname, that does not
randomly change as the machine moves from place to place.
If you system does not have a stable public domain suffix, go with
"localdomain", it is far better than a time-varying suffix.
Otherwise, explicitly configure a stable public FQDN. Do not depend
on `hostname -f`. Postfix needs to work even when your system is off
the network, and the sender addresses of local users need to be stable.