On Wed, Feb 10, 2021 at 01:11:49PM -0700, Bob Proulx wrote:
> Chris Green wrote:
> > Viktor Dukhovni wrote:
> > > Chris Green wrote:
> > > > Local hostname doesn't have FQDN by default though:-
> > > > 
> > > >     chris@isbdGandi$ hostname
> > > >     isbdGandi
> > > >     chris@isbdGandi$ hostname -f
> > > >     isbdGandi.isbd.uk
> > > > 
> > > > > Do your OS instances have their hostnames?
> > > >
> > > > See above.
> > > 
> > > The simplest solution is to arrange for the systems to instead have
> > > fully-qualified hostnames.  This will likely have additional benefits
> > > down the line.
> >
> > They have, it doesn't seem to help.
> 
> I believe there is some confusion between "hostname" and "hostname -f"
> that is creating problems.  When people say "hostname" should return
> the FQDN they mean that this should be true.
> 
>     $ hostname
>     isbdGandi.isbd.uk  # simulation
> 
> That is completely different from this.  Completely different.
> 
>     $ hostname -f
>     isbdGandi.isbd.uk  # simulation
> 
OK, but every system I know about has hostname as just the hostname
with no domain.  This is how systems are *actually* configured in the
main.  It's not just my systems.  It's how systems are configured 'out
of the box' as installed with various different (OK, mostly LInux)
different operating systems.  It *may* be wrong but I'm afraid it's
the way things are.

I have looked at Debian, Ubuntu, Raspberry Pi - they are all this way.
I have found one exception, one of my hosting services has the full
domain as the hostname.


> Also, it was previously noted that isbdGandi.isbd.uk is not a valid
> domain name.
> 
>     $ host isbdGandi.isbd.uk
>     Host isbdGandi.isbd.uk not found: 3(NXDOMAIN)
> 
> Therefore using that as the system hostname would not be helpful.
> 
So, I have several local systems on a LAN behind a single NATted ipv4
address which is zbmc.eu, they have to have names, those names are
necssarily invalid 'outside'.

The hostname isbdGandi.isbd.uk is similar, it just happens to be a
single system on the isbd.uk IP.  The system has a name, the domain is
isbd.uk, what should I call it?


> Philosophical Discussion Time
> 
> However there is a split in the thinking.  Most of the people on this
> list are in the side that wants the hostname to be a FQDN.  And then
> it applies globally to every program running on the system.  The
> Highlander principle.  "There can only be one."  That's a BSD
> traditional behavior.
> 
> But the other side of the split wants the hostname to be the short
> hostname.  And then the domain is specified in applications.  Then
> there can be many IP addresses on a host and many domains serviced by
> the many IP addresses.  Most GNU/Linux systems default this way.
> 
> You appear to be using a GNU/Linux distribution that is typical and
> defaults to the short hostname.  Which means you can override that
> locally and follow "The BSD Way" and have one IP and one domain
> globally.  Or you can set it for Postfix.  Or you can use a Debian,
> Ubuntu, Mint, Trisquel, others, specific behavior of /etc/myorigin.
> Or you can customize main.cf's myhostname.  Or any other of the many
> possible solutions to this problem.
> 
Yes, I think you have hit exactly on the issue! :-)  Not everyone
agrees what the 'hostname' should be.  I'm stuck in the crossfire.


> > What exactly do you mean by "... have fully-qualified hostnames?". I
> > know what you mean by FQDN but in general although 'hostname -f' and
> > 'dnsdomainname' return the domain name postfix still doesn't use it.
> 
> When Postfix says "hostname" it means "hostname" not "hostname -f".
> 
> The operation of "hostname -f" is to do a reverse DNS lookup on an IP
> address associated with the host.  This is actually not something that
> is guarenteed to be configured on the host.  Unless it is configured
> in /etc/hosts locally it will fall through to DNS and depend upon the
> DNS entry for the IP address.  (Which also requires live networking
> active at that moment too.)  But which IP address?
> 
> The actual configuration values for /etc/hosts is also problematic.
> Because 127.0.0.1 should map to "localhost" and "localhost" should map
> to 127.0.0.1.  However many people have hacked this locally to map to
> The One FQDN globally for the system.  This topic by itself is a large
> discussion of a surprisingly large number of combinations, some of
> which work for some things but not others, and the reverse.
> 
> This area of messy stuff was the motivation for Debian making a local
> patch to default to "myorigin = /etc/myorigin" as that allows a single
> main.cf to be used if /etc/myorigin is customized.  Personally I don't
> like it as much however and don't use that functionality.  But it
> might be perfect for you since it was designed with your case in mind.
> 
Sadly not all of my systems are Debian derived, but it might be one
approach.


> And then there is a systemd module too.  (Isn't there always yet
> another systemd rewrite that does things almost correctly but subtly
> buggy?)  libnss_myhostname is a plugin module for the NSS Name Service
> Switch part of libc and modifies the value returned by gethostname(2).
> 
> It's really quite a messy topic!
> 
> I myself set myhostname to the FQDN in main.cf and main.cf is
> customized on every host.  I recommend a system configuration
> infrastructure as that will generally be useful.  I wrote my own but
> the popular ones are puppet, chef, salt, ansible, others...
> 
Thanks Bob, I think you have convinced me that there probably is no
simple answer to this.  Maybe I'll just have to have more than one
main.cf, one for the systems on the zbmc.uk domain and one (or more)
for systems on other domains.  It's probably the easiest to understand
solution at least.

-- 
Chris Green

Reply via email to