On Sep 29, 9:01 pm, Nigel Kersten <ni...@puppetlabs.com> wrote:
> On Thu, Sep 29, 2011 at 5:28 PM, Doug Balmer <doug.bal...@gmail.com> wrote:
> > 'Note that periods are only allowed when they serve to delimit components
> >> of "domain style names".'
>
> > Let's give this sentence some context.
>
> > <quote>
> >   ASSUMPTIONS
>
> >    1. A "name" (Net, Host, Gateway, or Domain name) is a text string up
> >    to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
> >    sign (-), and period (.).  Note that periods are only allowed when
> >    they serve to delimit components of "domain style names". (See
> >    RFC-921, "Domain Name System Implementation Schedule", for
> >    background).
> > </quote>
>
> > No mention there of a hostname having to be the first component of a
> > "name". The succeeding RFC to this definition is in RFC1123 which states the
> > hostname can be up to 255 characters and begin with a number. No other
> > mention of the first component of the name being the hostname.
>
> I seem to remember having this argument in the past in a workplace...
>
> From memory the conclusion was that it is *labels* that can't have periods
> in them, and hostnames are allowed to be a series of labels connected with
> periods.
>
> I'm not particularly in favor of the original suggestion, but I don't think
> that RFC quoting alone is going to give us the right answer as to whether we
> should do it or not.


So I was all set to jump in saying how absurd the idea of hostnames
with periods in them was, but after all little thought and poking
about I came to a conclusion similar to the one Nigel describes.  The
components of a qualified name may not contain periods, but nothing I
can find defines a machine's "hostname" to be only the leaf component
of (one of) its FQDN(s).  Or any part of any of its FQDNs, for that
matter.

In practice, it is not safe, at least on Linux, to assume that the
"hostname" command will return an unqualified name or that "$
(hostname).$(dnsdomainname)" is even a resolvable name for the node,
much less a FQDN for it.

On the other hand, there is a de facto standard for FQDN, and domain
name established via the 'hostname' and 'dnsdomainname' commands where
those are available.  Their manual on CentOS/RHEL 5 and 6 (dated
January 1996, so it's well established practice) specifies that a
node's FQDN is the name the resolver returns for the host name, and
that the (DNS) domain name is everything after the first dot in the
FQDN.  That dovetails with the documentation of the resolver
configuration file.  It still does not, however, require the hostname
to be the part before the first dot -- that's merely a convention.

After some consideration, I don't think Facter's current behavior of
using the first name component as the value of the "hostname" fact can
reasonably be classified as a bug (but see below).  On the contrary,
this debate highlights the fact that there are at least two distinct,
reasonable definitions for "hostname" in common use:

1) The string returned by gethostname(2)
2) The FQDN less the domain portion, where the domain portion is the
first dot and everything after

I suspect that the average sysadmin is blissfully unaware of the
distinction, or even that there can be a distinction.  Facter simply
uses the latter definition, which I suspect is more often the desired
result when the two disagree.  The best approach would probably be to
add a new fact by which the other interpretation of hostname could be
conveyed.


I do think there are some potential bugs in this area, however:

1) the Darwin R7 version of the hostname fact does not truncate the
hostname at the first dot the way the mainline version does.  Perhaps
this is not an issue in practice (i.e. maybe in that environment the
result can never contain a dot), but that's not clear to me at the
moment

2) When Facter encounters and truncates a hostname containing a dot,
it assumes that the part after the dot was the (DNS) domain name, and
uses that in preference to its other methods for identifying the
domain name.  That relies on the 'hostname' command never to return a
partially-qualified name, which is not safe.

(Facter also appears to have some other questionable behavior in its
"domain" fact, but that's going off-topic.)


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to