unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Contents of /etc/hosts
@ 2016-10-05 18:31 John Darrington
  2016-10-05 20:17 ` Ludovic Courtès
  2016-10-06  9:24 ` Hartmut Goebel
  0 siblings, 2 replies; 11+ messages in thread
From: John Darrington @ 2016-10-05 18:31 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3047 bytes --]

Further to discussions on #guix earlier this week ...

Some of us are concerned about what we currently have in /etc/hosts viz:

127.0.0.1 localhost gambrinus
::1       localhost gambrinus

(my machine is called "gambrinus")


This is a problem becuase it means that "hostname -f" returns the wrong thing.

Further, the man page for hostname (from the net-tools package) says:

   The  recommended  method  of  setting  the  FQDN  is  to make the hostname be
   an alias for the fully qualified name using /etc/hosts, DNS, or NIS.  For
   example, if the hostname was "ursula", one might have a line in /etc/hosts
   which reads:

   127.0.1.1    ursula.example.com ursula

However I would recommend 127.0.0.2 instead of 127.0.1.1 because RFC 3330
mentions that 127.0.0.0/8 is reserved for loopback, but the rest of
127.0.0.0/16 subject to allocation.


Many systems also have a file called /etc/hostname and  according to the hostname man page:

     /etc/hostname  Historically this file was supposed to only contain the
     hostname and not the full canonical FQDN.  Nowadays  most software is able
     to cope with a full FQDN here. This file is read at boot time by the system
     initialization  scripts to set the hostname.


Guix of course uses /etc/config.scm so we don't need /etc/hostname but there
might be some rougue programs which rely on it so perhaps we should have one.


When setting the name via the net-utils "hostname" utility,
HOST_NAME_MAX is the maximum length which can be passed to sethostname.
On Linux, this limit is 64


So security conscious programs (notably kerberos) will refuse to operate if
the forward and reverse DNS do not agree.


Some DHCP servers are configured to return the domain name which they
expect the host to use.

RFC 1034 \union 1123
stipulates that, labels may contain the characters [a-zA-Z0-9-] and \
may not start with - 

In services/base.scm we have:

(define host-name-service-type
  (shepherd-service-type
   'host-name
   (lambda (name)
     (shepherd-service
      (documentation "Initialize the machine's host name.")
      (provision '(host-name))
      (start #~(lambda _
                 (sethostname #$name)))
      (respawn? #f)))))

This will fail if /etc/config.scm has is too long, or has invalid characters.
So we should check it in system reconfigure.


So ... my recommendations:

1. We change /etc/hosts to read


 127.0.0.1 localhost.localdomain localhost 
 ::1       localhost.localdomain localhost

 127.0.0.2 gambrinus


2. We put some checks in guix system to ensure that the host-name field does not
 exceed 63 bytes (not characters) and that it conforms to the format of RFC1034


Any objections if I commit a patch to gnu/system.scm ??

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-10-11 20:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05 18:31 Contents of /etc/hosts John Darrington
2016-10-05 20:17 ` Ludovic Courtès
2016-10-06  0:57   ` John Darrington
2016-10-06 10:07     ` Hartmut Goebel
2016-10-08 14:19       ` John Darrington
2016-10-11 20:25     ` Ludovic Courtès
2016-10-06  9:24 ` Hartmut Goebel
2016-10-08 14:08   ` John Darrington
2016-10-09  9:12     ` Hartmut Goebel
2016-10-09  9:56       ` John Darrington
2016-10-09 10:53         ` Hartmut Goebel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).