From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 12 21:00:30 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE9C9106564A for ; Thu, 12 Jan 2012 21:00:30 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9232B8FC13 for ; Thu, 12 Jan 2012 21:00:30 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0CL0Uj1029300 for ; Thu, 12 Jan 2012 21:00:30 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0CL0US7029299; Thu, 12 Jan 2012 21:00:30 GMT (envelope-from gnats) Date: Thu, 12 Jan 2012 21:00:30 GMT Message-Id: <201201122100.q0CL0US7029299@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Matthew Story Cc: Subject: Re: conf/164048: /etc/rc.d/hostid is not symlink aware X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthew Story List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 21:00:30 -0000 The following reply was made to PR conf/164048; it has been noted by GNATS. From: Matthew Story To: Dirk-Willem van Gulik Cc: freebsd-bugs@freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: conf/164048: /etc/rc.d/hostid is not symlink aware Date: Thu, 12 Jan 2012 15:51:48 -0500 --20cf307f3aeec4ba1b04b65aeadd Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jan 12, 2012 at 2:47 PM, Dirk-Willem van Gulik wrote: > > On 12 jan. 2012, at 17:48, Matthew Story wrote: > > > On Thu, Jan 12, 2012 at 3:15 AM, Dirk-Willem van Gulik < > dirkx@webweaving.org> wrote: > [...snip] > Totally understood - but wanted to stay close to the behavior of > dhclient-script as I understand it. And this happens to also make the > behavior of /etc/rc.d/sshd on first run the same. Keep in mind that one can > always set the rc variable. > it makes sense to test for existence (and not readability) for rc.d/sshd, as it goes on to create files if they do not exist: if [ -f /etc/ssh/ssh_host_key ]; then echo "You already have an RSA host key" \ "in /etc/ssh/ssh_host_key" echo "Skipping protocol version 1 RSA Key Generation" else /usr/bin/ssh-keygen -t rsa1 -b 1024 \ -f /etc/ssh/ssh_host_key -N '' fi in the existing implementation of rc.d/hostid, it does not create the file on ``start'' if it does not exist, so detection of readability is more correct (although in the typical use-case e.g. running as root, existence and readability are ostensibly synonymous). > [...snip] > > Agreed - as _set is better. > [...snip] > So the question is not about respecting symlinks, but wether or not a ``host_id_file'' should be created if one does not exist, for the ``start'' command. I'm not sure if this behavior is desirable, considering that the de facto behavior is to respect hardware derived ``smbios.system.uuid'', and writing that value to disk would potentially require an additional reset on hardware change. As you can easily generate a ``host_id_file'' if one does not exist by invoking the ``reset'' command, and the sysctl is set at start properly, either from ``host_id_file'', hardware or via the ``uuidgen'' program, this seems superfluous to me ... but I defer to the maintainer. -- regards, matt --20cf307f3aeec4ba1b04b65aeadd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Jan 12, 2012 at 2:47 PM, Dirk-Willem van Gulik &l= t;dirkx@webweaving.org> wrote:

On 12 jan. 2012, at 17:48, Matthew Story wrote:

> On Thu, Jan 12, 2012 at 3:15 AM, Dirk-Willem van Gulik <dirkx@webweaving.org> wrote:
<= /blockquote>
[...snip]=A0
Totally understood - but wanted to stay close to th= e behavior of dhclient-script as I understand it. =A0And this happens to al= so make the behavior of /etc/rc.d/sshd on first run the same. Keep in mind = that one can always set the rc variable.

it makes sense to test for existence (and = not readability) for rc.d/sshd, as it goes on to create files if they do no= t exist:

=A0=A0 =A0if [ -f /etc/ssh/ssh_host_= key ]; then
=A0=A0 =A0 =A0 =A0echo "You already have an RSA host key" \<= /div>
=A0=A0 =A0 =A0 =A0 =A0 =A0"in /etc/ssh/ssh_host_key"
=A0=A0 =A0 =A0 =A0echo "Skipping protocol version 1 RSA Key Ge= neration"
=A0=A0 =A0else
=A0=A0 =A0 =A0 =A0/usr/bin/ssh-keygen -t rsa1 -b 1024 \
=A0= =A0 =A0 =A0 =A0 =A0 =A0-f /etc/ssh/ssh_host_key -N ''
=A0= =A0 =A0fi =A0

in the existing implementation= of rc.d/hostid, it does not create the file on ``start'' if it doe= s not exist, so detection of readability is more correct (although in the t= ypical use-case e.g. running as root, existence and readability are ostensi= bly synonymous).
=A0
[...snip]

Agreed - as _set is better.
[...snip]

So the q= uestion is not about respecting symlinks, but wether or not a ``host_id_fil= e'' should be created if one does not exist, for the ``start'&#= 39; command. =A0I'm not sure if this behavior is desirable, considering= that the de facto behavior is to respect hardware derived ``smbios.system.= uuid'', and writing that value to disk would potentially require an= additional reset on hardware change.

As you can easily generate a ``host_id_file'' if one= does not exist by invoking the ``reset'' command, and the sysctl i= s set at start properly, either from ``host_id_file'', hardware or = via the ``uuidgen'' program, this seems superfluous to me ... but I= defer to the maintainer.

--
regards,
matt
--20cf307f3aeec4ba1b04b65aeadd--