1 |
On Tue, May 28, 2019 at 10:43 AM William Hubbs <williamh@g.o> wrote: |
2 |
> |
3 |
> On Tue, May 28, 2019 at 02:21:23AM -0400, Mike Gilbert wrote: |
4 |
> > On Tue, May 28, 2019 at 1:41 AM Robin H. Johnson <robbat2@g.o> wrote: |
5 |
> > > |
6 |
> > > On Mon, May 27, 2019 at 08:44:09PM -0400, Mike Gilbert wrote: |
7 |
> > > > On Mon, May 27, 2019 at 11:45 AM William Hubbs <williamh@g.o> wrote: |
8 |
> > > > > |
9 |
> > > > > If a package hard codes the UID or GID when adding a user or group to |
10 |
> > > > > the system and that UID/GID already exists, we should abort rather than |
11 |
> > > > > changing the UID/GID. |
12 |
> > > > These functions have behaved this way for a long time. |
13 |
> > > Yes, I recall this breakage being raised even prior to GLEP27. |
14 |
> > > |
15 |
> > > Some coverage of prior work firstly. |
16 |
> > > 2003/May: eid_database [1] |
17 |
> > > 2004/May: GLEP27 [2] |
18 |
> > > 2006/Summer: GSOC Project for GLEP27 implementation [3] |
19 |
> > > Later: Creandus [4][5] |
20 |
> > > |
21 |
> > > [1] https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-src/eid_database/ |
22 |
> > > [2] https://www.gentoo.org/glep/glep-0027.html |
23 |
> > > [3] https://github.com/creandus/creandus.github.com/blob/master/glep27-proposal.txt |
24 |
> > > [4] https://github.com/creandus/ |
25 |
> > > [5] http://creandus.github.io/ |
26 |
> > > |
27 |
> > > > What problem are you trying to solve here? |
28 |
> > > Specifically: |
29 |
> > > 1. Package A is emerged, and the ebuild specifies enewuser/enewgroup |
30 |
> > > with -1 as the numeric input, and some user or group is created with |
31 |
> > > value X. |
32 |
> > > 2. Package B is emerged, and the ebuild specifies enewuser/enewgroup |
33 |
> > > with a fixed UID/GID value Y && explicitly depends on having that |
34 |
> > > specific value. |
35 |
> > |
36 |
> > Could you provide some examples of packages that require a specific |
37 |
> > numeric UID/GID to function properly? That seems like a significant |
38 |
> > design flaw. |
39 |
> |
40 |
> The example I specifically found was kubernetes security contexts -- to |
41 |
> set one of these up, you need numeric uids/gids [1]. |
42 |
> |
43 |
> [1] https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ |
44 |
> |
45 |
> I agree this could be possibly seen as a flaw, but I don't know enough |
46 |
> about kubernetes to know if symbolic uids/gids could be used. |
47 |
> |
48 |
> I am speculating here, but I'm guessing that if the pod spans |
49 |
> multiple hosts, the uids/gids might need to be the same, which would |
50 |
> require fixed UIDs/GIDs. |
51 |
|
52 |
Your kubernetes example is not a very compelling one. Firstly, none of |
53 |
the kubernetes-related ebuilds in the gentoo repo actually call |
54 |
enewuser or enewgroup with a static id. Secondly, I would expect the |
55 |
sysadmin of a kubernetes cluster to allocate a UID/GID range outside |
56 |
the "system range" defined in /etc/login.defs. |
57 |
|
58 |
> > As mgorny suggests, I suspect the static UID/GID that is sometimes |
59 |
> > passed to enewuser/enewgroup is more of a preference/suggestion than a |
60 |
> > requirement. |
61 |
> > |
62 |
> > I do not believe William's patch should be merged without some very |
63 |
> > good reason for the change in behavior. |
64 |
> |
65 |
> Consider this situation: |
66 |
> |
67 |
> in package-a.ebuild: |
68 |
> enewuser usera 300 ... |
69 |
> enewgroup groupa 300 ... |
70 |
> |
71 |
> in package-b.ebuild: |
72 |
> enewuser userb 300 ... |
73 |
> enewgroup groupb 300 ... |
74 |
> |
75 |
> Ok, cool, if I need a security context for package b, the uid/gid is 300 |
76 |
> correct? Yes, unless package a gets installed on some host where package |
77 |
> b is without me knowing about it. |
78 |
> |
79 |
> I see no way around this other than to make uids/gids fixed when |
80 |
> packages request specific ones. |
81 |
|
82 |
If you are running a cluster system that requires static ids, you |
83 |
should really create these ids yourself as part of the cluster node |
84 |
setup process. |