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

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.

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.

> 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.

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...

Bob

Reply via email to