Re: nss_myhostname as default in Fedora

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry to reply with such a delay.

On Mon, Jan 25, 2016 at 07:43:35PM -0800, Andrew Lutomirski wrote:
> I also think that the whole gethostname(2) mechanism is terminally
> screwed up.  We abuse the hostname for multiple purposes:
> 
> 1. It shows up in the default bash prompt.
>
> 2. It gets sent to remote DHCP servers.  I think this is a mistake on
> desktop machines.

Like discussed elsewhere in the thread, this is used by DDNS, which is
very useful in closed environments. It is also useful for diagnostics:
if I look on the router what leases were made, it's much nicer to see
the names rather than just the MAC addresses. The hostname is
something that essentially is used to identify a machine for humans,
and not allowing the hostname to be visible defeats the purpose.

Not sending the hostname in DHCP requests on non-trusted networks was
discussed in the other part of the thread. It's a great idea, but not
really relevant to this discussion, since DHCP libraries already make
this configurable (e.g. SendHostname=, Hostname= settings described in
systemd.network(5)). The issue is knowing when to set it on and when
to off, but this is needs to be solved at a slightly higher level.

> 3. Some programs seem to thing that gethostbyname(gethostname())
> should return some reasonable concept of "my ip address" despite the
> general nonexistence of such a concept.
> 
> I'll propose a strawman:
> 
>  - gethostname(2) always returns "localhost".
So you are proposing to make the current hostname mechanism useless
and add a replacement mechanism. I don't get the point, if this
got implemented we would be in the same place a few years down the
road. If the point is to avoid DHCP sending out the hostname, this can
already be achieved with a simple config change.

>  - "localhost" always resolves to 127.0.0.1 or ::1
That's what nss-myhostname provides.

>  - bash learns to use some intelligent value derived from whatever
> hostnamectl would return
I think bash is fine now: is shows gethostname(), which defaults
to contents of /etc/hostname.

>  - the default DHCP clients send a client identifier that's a function
> only of the MAC address used to send the query
It's better not to send anything if not desired as discussed above.
DHCP servers don't use this to generate leases, so there's little
point in sending a random value.

>  - Whatever systemd magic special-cases "localhost" as "trust what
> DHCP says" goes away.
No, systemd doesn't do that. First, nss-myhostname resolves
localhost statically to 127.0.0.1. Second, sd-dhcp refuses 'localhost'
as the lease name.

Systemd will use the DHCP provided "transient" name, but only if the
"static" name (from /etc/hostname is not set). The "transient" name
is a fallback value only.

> This trivially solves one silly annoyance: when I install Fedora, why
> on Earth is "what's your hostname" a reasonable question to ask me?
Because all installations of Fedora are similar and a 16 byte UUID
is not something that most humans can remember.

> Servers may have their own considerations, and NetworkManager and/or
> networkd could consider having a client-id override.
(They do.)

> If people really want to force a non-"localhost" hostname on a server,
> then forcing it to resolve to something intelligent might make sense,
> as having everything fail when resolution times out or ends up with
> SERVFAIL or NXDOMAIN is nasty.  But when I force my hostname to
> "foo.corp.bar.com", I probably have something other than 127.0.0.1 in
> mind.

This is something to be discussed, certainly. We already ask for a
user name, so it might be nice to simply to default to a hostname
generated from that, and the automatically detected chassis type (user
'Mikey' → login 'mikey' → pretty hostname "Mikey's Laptop" → hostname
"mikeys-laptop").  This field should still be editable, but a sensible
default would work nicely. IIRC, this is what Windows does more or
less, and it is pretty intuitive. At least for Workstation.

Anaconda could say "This computer will be visible as "Mikey's Laptop"
in the local network." to make people aware that the name is visible.

Zbyszek
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux