Gentoo Archives: gentoo-dev

From: "M. J. Everitt" <m.j.everitt@×××.org>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Requirements for UID/GID management
Date: Sun, 29 Jan 2017 03:05:50
Message-Id: 00e075c1-9668-6224-9be1-d57367853c96@iee.org
In Reply to: Re: [gentoo-dev] Requirements for UID/GID management by Michael Orlitzky
1 On 29/01/17 01:56, Michael Orlitzky wrote:
2 > On 01/27/2017 11:21 PM, Rich Freeman wrote:
3 >> It isn't like inconsistent UIDs are the end of the world. However,
4 >> IMO it still makes sense to at least try to standardize such things.
5 >> Really, if you have a package always installing the same user simply
6 >> sticking a default UID without any effort to avoid collisions is
7 >> better than nothing, but having a wiki page where people can register
8 >> UIDs isn't that big a deal.
9 >>
10 > I threw together an ugly implementation so I could play with both
11 > approaches -- random or fixed UIDs by default. The code to get user and
12 > group management working is of course nice and simple in either case.
13 > Where they both turn to shit is the upgrade path.
14 >
15 > Here's a problem I have no solution for. Suppose we tell everyone to
16 > pick a fixed UID for their user packages. I have a randomly assigned
17 > "tcpdump" user as UID 102 on my machine today. If we roll this out next
18 > week and the tcpdump maintainer chooses UID=321 as his fixed UID, what
19 > happens when I go to install sys-user/tcpdump? Every option is bad:
20 >
21 > * Keep the existing user. Now its UID is wrong. You might say "so
22 > what," but the majority of users on the majority of systems are
23 > going to have this problem, so you have to wonder what we've
24 > gained by deciding on fixed UIDs and then ultimately assigning
25 > them randomly anyway.
26 >
27 > There's the related problem of what to do if the tuxracer maintainer
28 > decides he wants to use UID=102 and I still have tcpdump using it.
29 >
30 > * Overwrite the existing user with the new one. Your packages all
31 > break.
32 >
33 > * Have the ebuild die(), and tell the user to fix the UID and file
34 > ownership himself before emerge can continue. Good luck with that.
35 >
36 > In the mostly-random-UIDs approach, I have an answer, even if it's not
37 > pretty: I can use the pre-existing UID instead of the next available
38 > one. This still fails if the ebuild author requests a specific
39 > (conflicting) UID, but that should be extremely rare in the random-UIDs
40 > model.
41 >
42 > Can anyone think of an upgrade path for fixed UIDs? That issue aside, I
43 > may have convinced myself that fixed UIDs are better.
44 >
45 >
46 I suspect that this would be best handled in an eclass with a stack of
47 functions controlled by USE-flags or an eselect module or something.
48 Seriously outta my league on this one .. but throwing the idea out there
49 for anyone to discuss potential viability or not!

Attachments

File name MIME type
signature.asc application/pgp-signature