Date: Mon, 4 Dec 2017 22:56:53 +0100 From: Baptiste Daroussin <bapt@FreeBSD.org> To: Glen Barber <gjb@FreeBSD.org> Cc: "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>, Kris Moore <kris@ixsystems.com>, freebsd-pkgbase@freebsd.org Subject: Re: Recent issue with pkg base missing setuid Message-ID: <20171204215653.4mhaf6thtn2voe4v@ivaldir.net> In-Reply-To: <20171204185956.GH22326@FreeBSD.org> References: <20171204183703.GG22326@FreeBSD.org> <201712041846.vB4IkuiW047326@pdx.rh.CN85.dnsmgr.net> <20171204185956.GH22326@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--g3jupmwithszrajo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 04, 2017 at 06:59:56PM +0000, Glen Barber wrote: > On Mon, Dec 04, 2017 at 10:46:56AM -0800, Rodney W. Grimes wrote: > > > On Mon, Dec 04, 2017 at 12:46:37PM -0500, Kris Moore wrote: > > > > On 12/04/2017 11:37, Brad Davis wrote: > > > > > On Mon, Dec 4, 2017, at 09:25 AM, Kris Moore wrote: > > > > >> Anybody else noticed a recent regression (say past month or so) = where > > > > >> pkg base of latest HEAD is now failing to throw setuid on some f= iles? We > > > > >> saw it at first because /sbin/shutdown lost its setuid bit, so u= sers > > > > >> can't shutdown the box. I rolled back pkg to 1.10.1 which was wo= rking, > > > > >> and that didn't seem to make a difference. Now I suspect somethi= ng in > > > > >> HEAD itself changed, but for the life of me can't find where. > > > > > Hey Kris, > > > > > > > > > > Can you look at the plist file and see if it is correctly flaggin= g the > > > > > file there? > > > > > > > > > > > > > > > Regards, > > > > > Brad Davis > > > > > _______________________________________________ > > > > > freebsd-pkgbase@freebsd.org mailing list > > > > > https://lists.freebsd.org/mailman/listinfo/freebsd-pkgbase > > > > > To unsubscribe, send any mail to "freebsd-pkgbase-unsubscribe@fre= ebsd.org" > > > >=20 > > > > Here's what I have in the plist: > > > >=20 > > > > @(root,operator,04554,) /sbin/shutdown > > > >=20 > > > > I'll note that ping/ping6 also have similar, and they install setuid > > > > properly: > > > >=20 > > > > @(root,wheel,04555,) /sbin/ping > > > > @(root,wheel,04555,) /sbin/ping6 > > > >=20 > > > > Here's what I have in the pkg tarball: > > > >=20 > > > > # tar tvf FreeBSD-runtime-12.0.s20171204170123.txz | grep shutdown > > > > hr-sr-xr-- 0 root operator 0 Dec 4 17:05 /sbin/shutdown lin= k to > > > > /sbin/poweroff > > > >=20 > > > > # tar tvf FreeBSD-runtime-12.0.s20171204170123.txz | grep poweroff > > > > -r-xr-xr-- 0 root wheel 15440 Dec 4 17:05 /sbin/poweroff > > > > hr-sr-xr-- 0 root operator 0 Dec 4 17:05 /sbin/shutdown lin= k to > > > > /sbin/poweroff > > > >=20 > > > >=20 > > > > And installing it again sure enough gives version without setuid: > > > >=20 > > > > # pkg-static add -f FreeBSD-runtime-12.0.s20171204170123.txz > > > > Installing FreeBSD-runtime-12.0.s20171204170123... > > > > package FreeBSD-runtime is already installed, forced install > > > > Extracting FreeBSD-runtime-12.0.s20171204170123: 100% > > > >=20 > > > > [root@chimera] > > > > /usr/obj/usr/src/repo/FreeBSD:12:amd64/12.0.s20171204170123# ls -al > > > > /sbin/shutdown > > > > -r-xr-xr-- 2 root wheel 15440 Dec 4 17:05 /sbin/shutdown > > > >=20 > > >=20 > > > I think this is the problem. I believe /sbin/poweroff should be a ha= rd > > > link to /sbin/shutdown. Meaning, the links are reversed, so the setu= id > > > bit is lost because poweroff is not installed with the setuid bit. > > >=20 > > > The only thing I can think of so far is r325859, which sorts the META= LOG > > > to ensure metadata reproducibility. > > >=20 > > > Glen > > >=20 > >=20 > > I do not believe that order is at issue here at all, or it shouldnt be, > > once the files are hardlinked any chown/chmod effects the one inode > > used by both files. > >=20 >=20 > It does appear to be the problem, because the files are packaged > alphabetically now. In a repository from September, I see: >=20 > % tar tvf FreeBSD-runtime-12.0*.txz | grep -E '/sbin/(poweroff|shutdown)' > -r-sr-xr-- 0 root operator 15864 Sep 27 15:40 /sbin/shutdown > hr-xr-xr-- 0 root wheel 0 Sep 27 15:40 /sbin/poweroff link to = /sbin/shutdown >=20 > In a more recent repository, I see: >=20 > % tar tvf FreeBSD-runtime-12.0*.txz | grep -E '/sbin/(poweroff|shutdown)' > -r-xr-xr-- 0 root wheel 15864 Nov 15 15:28 /sbin/poweroff > hr-sr-xr-- 0 root operator 0 Nov 15 15:28 /sbin/shutdown link to = /sbin/poweroff >=20 So this is the issue, somewhere in the way libarchive is handling the hardl= inks. You can see here the setuid is only set on the hardlink not on the regfile = (the opposite of the previous one) meaning somewhow libarchive seems to be inconsistent. pkg does not set attributes (rights + ownerhsip) to any thing libarchive te= lls it to be a hardlink because it is supposed to be done on the regular file... Don't know how I can fix/workaround that. Bapt --g3jupmwithszrajo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlolxKMACgkQY4mL3PG3 Plp5sg//R64fRA+wGasbB3l/IlILeHBFwUwkaFjDCO8LnARpCcofp3AQ26z7aXZN ULlrztoqnnMESzaDRhxmdC/9DHDm/rVXrB0VubKkO1/0xcpDqxq+xmxStgptgy45 TANEXGs4hVnuUK7vCBpR/ie0YsN5Ef5IQc64WtpZ56Mo+w0VWsQJtxngwOR2oA4p Iz98mgousvlr3xGnJNdQJvw0rNGXHtIrky3kot9HWDms8AOv47qLuRLUv3Q6AFzJ ekOxHlxptV9th4kJYv42MqS/3gPUTsouvQykhyRM39NZBn7u90Tr2vPxcxXdT/+0 nxha+YejG0fp8k2FpcKUclHj1ZtdmjWrzb5quHLwNuRMJpY0+L2EY5SFbVZbkwlI kesCtXumX8Kfagoqspfcl1pEvtW3OW5hxMje4JjKiRkM4N6tu28CoTPOG6SofjT3 Sj1OKBJxFc3ZvY9Q890D46YTnOYfh2S+ppnVPTi0Rvmb0piCJZ3+yfDYh+gluK/i 8jeaQqFYvm1r7crGeDin+KWRbt5TiMI95TD8qWVlmlDx+VKi0eMS8LCdCL5af6dz yFMLbJwBs9ERsRo8s8nAnL45E7M2gS1bwrVeRVrmuwwbP3YDzdSkg6yjd+eDswWn Wiwy/eYpkjVxq59dXugVrkeGJ1t4sBcdPI9zZkSNhyffkNgrg8M= =Kvo6 -----END PGP SIGNATURE----- --g3jupmwithszrajo--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171204215653.4mhaf6thtn2voe4v>