Date: Thu, 12 Jan 2012 21:00:30 GMT From: Matthew Story <matthewstory@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: conf/164048: /etc/rc.d/hostid is not symlink aware Message-ID: <201201122100.q0CL0US7029299@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/164048; it has been noted by GNATS. From: Matthew Story <matthewstory@gmail.com> To: Dirk-Willem van Gulik <dirkx@webweaving.org> 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 <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: > [...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 <span dir=3D"ltr">&l= t;<a href=3D"mailto:dirkx@webweaving.org">dirkx@webweaving.org</a>></spa= n> wrote:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" s= tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im"><br> On 12 jan. 2012, at 17:48, Matthew Story wrote:<br> <br> > On Thu, Jan 12, 2012 at 3:15 AM, Dirk-Willem van Gulik <<a href=3D"= mailto:dirkx@webweaving.org">dirkx@webweaving.org</a>> wrote:<br></div><= /blockquote><div>[...snip]=A0</div><blockquote class=3D"gmail_quote" style= =3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im"></div>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.<br> </blockquote><div><br></div><div>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:</div><div><br></div><div><div>=A0=A0 =A0if [ -f /etc/ssh/ssh_host_= key ]; then</div> <div>=A0=A0 =A0 =A0 =A0echo "You already have an RSA host key" \<= /div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0"in /etc/ssh/ssh_host_key"</d= iv><div>=A0=A0 =A0 =A0 =A0echo "Skipping protocol version 1 RSA Key Ge= neration"</div><div>=A0=A0 =A0else</div> <div>=A0=A0 =A0 =A0 =A0/usr/bin/ssh-keygen -t rsa1 -b 1024 \</div><div>=A0= =A0 =A0 =A0 =A0 =A0 =A0-f /etc/ssh/ssh_host_key -N ''</div><div>=A0= =A0 =A0fi =A0</div></div><div><br></div><div>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).</div> <div>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;= border-left:1px #ccc solid;padding-left:1ex">[...snip]<br> <div class=3D"im"><br> </div>Agreed - as _set is better.<br> <div class=3D"im">[...snip]</div></blockquote></div><div><br></div>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.<div> <br></div><div>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.<div> <div><br></div>-- <br>regards,<br>matt<br> </div></div> --20cf307f3aeec4ba1b04b65aeadd--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201122100.q0CL0US7029299>