Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: Christian Kniep <ckniep@××××××.com>
Cc: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] rfc: /etc/hostname on gentoo
Date: Tue, 23 Aug 2016 18:45:32
Message-Id: CAGfcS_mnDnarSPnNeN6=N65e-DL1GSm=BkDnxRM-=K9Vd5fFuQ@mail.gmail.com
In Reply to: Re: [gentoo-dev] rfc: /etc/hostname on gentoo by Christian Kniep
1 On Tue, Aug 23, 2016 at 8:26 AM, Christian Kniep <ckniep@××××××.com> wrote:
2 > Hey Rich,
3 >
4 > nice idea, but unfortunately this provides the hostname of the container
5 > itself.
6 >
7
8 As it should. /etc/hostname inside a container should contain the
9 hostname of the container. It shouldn't actually be possible to
10 determine the hostname of the host from inside a container, or even
11 that there is a host outside the container.
12
13 You could still bind-mount it into the container if you wanted to in
14 order to leak this information into the container. That is up to you,
15 but I would suggest that openrc should not by default expose host
16 information into the container.
17
18 Symlinking /proc into /etc/hostname is still useful because it not
19 only handles container hostnames (keep in mind that two containers
20 could share the same /etc), but it also covers cases where the
21 hostname changes, and it doesn't require writing to etc (which in
22 general shouldn't be used to store state).
23
24 The people who are saying /etc/hostname shouldn't really exist are
25 completely right. However, if for whatever reason we did want to
26 provide it for compatibility (just like mtab), then a symlink to /proc
27 at least ensures it returns the same answer as the system call.
28
29 --
30 Rich

Replies

Subject Author
Re: [gentoo-dev] rfc: /etc/hostname on gentoo William Hubbs <williamh@g.o>