Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] rfc: allow -1 for ACCT_USER_ID and ACCT_GROUP_ID in ::gentoo
Date: Mon, 29 Nov 2021 06:58:25
Message-Id: CAAr7Pr93UzVFS8p6JDgKs1BAaLcFZ7c-pv90Ef=G=1GHfzG3hQ@mail.gmail.com
In Reply to: Re: [gentoo-dev] rfc: allow -1 for ACCT_USER_ID and ACCT_GROUP_ID in ::gentoo by "Michał Górny"
1 On Sun, Nov 28, 2021 at 8:07 PM Michał Górny <mgorny@g.o> wrote:
2 >
3 > On Sun, 2021-11-28 at 16:31 -0600, William Hubbs wrote:
4 > > All,
5 > >
6 > > I want to discuss why we ban -1 as the ACCT_USER_ID and ACCT_GROUP_ID setting
7 > > for all acct-user and acct-group packages in ::gentoo.
8 > >
9 > > Here are my thoughts about it.
10 > >
11 > > - As Gordon pointed out, it isn't necessary for us to care about UIDS/GIDS
12 > > most of the time.
13 > >
14 > > - I realize that our settings are suggestions, but the values we can
15 > > suggest are not infinite. We have run out once, and it is only a matter of
16 > > time until we do again.
17 > >
18 > > - If an end user needs to care about the UID/GID, they can easily override
19 > > the settings in make.conf.
20 > >
21 > > In short, I don't think we should be forcing maintainers to pick a
22 > > specific UID/GID for every package that needs a user/group. Most of the
23 > > time they can set ACCT_USER_ID and ACCT_GROUP_ID to -1.
24 > >
25 > > Thoughts? In particular, I want to hear from folks who disagree with me
26 > > about using -1 in the main tree for most packages.
27 > >
28 >
29 > Let me put this bluntly. Yes, most users don't care. However:
30 >
31 > 1) if we don't assign static UIDs/GIDs, the few users who care are gonna
32 > be in hell having to assign them all manually. Every single one of
33 > them, on every one of their systems.
34
35 I think the challenge here for me is twofold:
36
37 - I need some source of truth in gid / uids. Most places already have
38 one (some kind of identity provider.)
39 - I need some way to distribute the truth to my machines. In industry
40 we use nsscache, or sssd, or ldap, or nis+, or yp, or samba, or you
41 hardcode uid / gids in our configuration management pipeline (ansible,
42 chef, puppet, our container build scripts!) For instance Gentoo Infra
43 does a mix of LDAP (our source of truth for uid / gid) and nsscache
44 (to distribute the uids and gids to machines) as well as hardcoded uid
45 / gids (often for services.)
46
47 Many people have both of these already. They have some identity
48 provider (LDAP, AD, FreeIPA, a yaml file!) and they have some way of
49 getting those identities to their boxes. So when you say things like
50 "well these people have to do this manually" I struggle to really
51 understand who these people are; and how things like a yaml file +
52 ansible script is not sufficient to address this problem for them.
53 Syncing uid / gids across machines is a solved problem. Some of the
54 solutions (freeIPA, LDAP) are gross for home use; but ansible is
55 pretty lightweight, for example.
56
57 >
58 > 2) if we do assign static UIDs/GIDs... what's the problem, again?
59 > Little extra work for a few devs?
60
61 I think we are back to like "why do we care about the uid / gid ranges
62 at all?" and the answer is because many people have an existing
63 identity scheme and the gentoo scheme interacts poorly with it.
64
65 - If Gentoo adds an acct-user/foo user, and that user already exists
66 on my system with the wrong UID: the eclass dies[0].
67 - If Gentoo adds an acct-user/foo user, with uid=12345, and that uid
68 is assigned to a user on my system already, the eclass dies.
69 - Some environments are very old, and so real users have unexpected
70 uids; this includes Gentoo itself.
71 - Gentoo (the community) used to allocate UIDs to devs in the
72 500-1000 range and we have 17 active developers with UIDs in that
73 range. So for example if we allocate one of these UIDs to an acct-*
74 package; that package will not be installable on woodpecker without
75 modification because those UIDs are already taken.
76 - Other organizations are similarly encumbered with state; and
77 these systems do not interact well with the current defaults.
78
79 I'm looking for a documented way to say "hey I want dynamic allocation
80 on this machine; even in ::gentoo, because I have an existing scheme I
81 want to use." I want to do it in one place, and not have to set dozens
82 of package.env files, or copy ebuilds, or hack the eclasses. One idea
83 I had was some bashrc hacks to always set ACCT_USER_ID=-1 (and
84 ACCT_GROUP_ID=-1); as this might achieve that goal...but it would be
85 nicer to probably just set some accepted make.conf var.
86
87 -A
88
89 [0] Also there are just hilarious stories of weird names in industry.
90 We had one person who joined who got assigned the username 'lib' and
91 so their homedirectory was '/home/lib/'. All kinds of random crap
92 broke with that name and we had to bughunting in some apps...and we
93 reserved a bunch of similar names so they would not be taken. Or
94 another case: our uid allocator had a bug and we assigned a real
95 person the nobody uid; turns out NFS does not work well when you do
96 that.
97
98
99
100 >
101 > --
102 > Best regards,
103 > Michał Górny
104 >
105 >

Replies