Gentoo Archives: gentoo-dev

From: "William L. Thomson Jr." <wlt-ml@××××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: Userkit.eclass
Date: Tue, 29 Nov 2016 23:13:39
Message-Id: assp.01410e347c.4507579.K9JQIjJpey@wlt
In Reply to: Re: [gentoo-dev] RFC: Userkit.eclass by Alan McKinnon
1 On Wednesday, November 30, 2016 12:49:44 AM EST Alan McKinnon wrote:
2 >
3 > Why would you end up with duplicated UIDs and GIDs? The only real ways
4 > that can happen is
5 > - ebuild "edits" passwd and group directly using echo/sed and the like.
6 > - ebuild runs useradd|groupadd specifying the uid/gid as arguments
7
8 I think you mean enewgroup and enewuser
9
10 > Both of which are silly. Just use useradd/groupadd without uid/gid
11 > arguments. The utility will make sure the uid/gids are non-duplicate,
12 > and ensure they are <1000 or whatever for system accounts
13
14 Randomly chosen GID and UID are a problem in the making. If you haven't
15 experienced such yet, give yourself time. Moving files between systems, you
16 have to chown/chgrp, etc it is NOT fun...
17
18 Or worse you mix stuff and give something improper permissions and really mess
19 up security...
20
21 > How do you intend to MAKE devs follow it? More eternal bike-shedding?
22
23 A nifty tool called repoman which could do a quick lookup. As could enewgroup/
24 enewuser. They could hit the list/database. If something is trying to use
25 existing error, etc. Otherwise process to reserve it, etc.
26
27
28 > Who cares what the uid/gid is? There's a range of about 950 to chose
29 > from. The way to ensure a filesystem object has the correct owner and
30 > group is by using chown/chgrp.
31
32 See above, any administrator moving files between systems, restoring backups,
33 etc.
34
35 Say you do a fresh install. What if all your UID/GID differ from your backup?
36 HUGE MESS!!!!
37
38 > Except for a few cases out on left field (like nfs shares - a problem
39 > that nfs must fix) you don't really care what the uid/gid is, as long as
40 > it's not duplicated. The thing you care about is the NAME
41
42 Not really just cases you haven't run into yet, which can be very common.
43
44 > > This is not needless bureaucracy , this is necessary.
45 >
46 > This is a joke right?
47
48 Not at all, others are clearly not aware of all the potential issues, having
49 not experienced them first hand, yet....
50
51 Work with enough systems, move files around, share lots of stuff, restore
52 backups, you will start to see a major need.
53
54 > >> Have you watched the IANA ports assignment registry over the years?
55 > >> Consider how many services and tools you've seen that *don't* respect
56 > >> it.
57 > >
58 > > Yes, how often to ports < 1024 change? Hardly ever.... Proving the exact
59 > > point why this is needed. People can change them themselves but 99% of
60 > > the time its to some other port > 1024.
61 > >
62 > > Why is there IANA port assignment registry in the first place? Likely for
63 > > a
64 > > similar reason.
65 >
66 > It's so that things like browsers, email tools and the like can drop
67 >
68 > :<port> for the most part and be reasonably sure stuffs will still work.
69 >
70 > Of the 65535 +-1 possible port numbers, only the first 1024 are truly
71 > important, and of those less than about a quarter are in common use
72 > (wild guess).
73
74 Most of the UID/GID I speak of are below 1000. System accounts, daemons, etc.
75 Very likely the exact same stuff running on privileged ports but not all.
76
77 > The next 10,000 or so are not standards by any means, just a list of
78 > stuff that happens to have been seen in the wild. Apps can and do pick
79 > any old port they feel like - witness the several things that will use
80 > 5000 out the box. Is this a problem? Not really, as very very few
81 > machines out there will install two apps both trying to use port 5000 by
82 > default.
83
84 Nor would that ever be with any system. All *nix systems have a reserved UID/
85 GID range and users stuff starts above that. Some 500, others 1000, etc.
86
87
88 > I have packaged a few things in Gentoo (privately only)
89
90 Try doing it for the public, which will end up with thousands of installs.
91
92 > , and written
93 > more shell installers, puppet manifests, ansible playbooks and user
94 > account deployers than I care to recall; I've never run into this
95 > problem that I couldn't solve trivially - usually by just knowing the
96 > username|groupname and looking up the corresponding uid/gid. Really,
97 > it's just data mapping and we have tools to do the lookup real fast.
98
99 Clearly you haven't come across it yet, and likely because experience has
100 differed. But I have given you a few examples of how this could happen to
101 anyone and why there would be a need.
102
103 Say it is a failed mail server, and you need to take the queue/spool to
104 another. Same with print, or other jobs... You need them to have the same UID/
105 GID, or you end up wasting MORE time syncing them to the system they go onto.
106 Much easier to ensure all are the same.
107
108 This goes for many other things. Lots of data gets owned by system accounts.
109 Moving that data from system to system, with different UID/GIDs is a
110 nightmare...
111
112 --
113 William L. Thomson Jr.

Attachments

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

Replies

Subject Author
Re: [gentoo-dev] RFC: Userkit.eclass Alan McKinnon <alan.mckinnon@×××××.com>
Re: [gentoo-dev] RFC: Userkit.eclass "Michał Górny" <mgorny@g.o>