Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Of death and prerm
Date: Wed, 30 Aug 2017 14:45:48
Message-Id: 1504104338.10801.5.camel@gentoo.org
In Reply to: Re: [gentoo-dev] Of death and prerm by Michael Orlitzky
1 W dniu śro, 30.08.2017 o godzinie 09∶15 -0400, użytkownik Michael
2 Orlitzky napisał:
3 > On 08/30/2017 05:25 AM, Michał Górny wrote:
4 > >
5 > > This package does not belong in Gentoo. We do packaging, not some ugly
6 > > malware that prevents users from uninstalling itself. Every package must
7 > > be uninstallable. Even if it destroys my system, developers have no
8 > > right to prevent valid uninstall action from proceeding.
9 > >
10 >
11 > So you're saying I should have it "sleep 2983702947523704" in prerm?
12 >
13 > =)
14 >
15 > I've been working on the user packages GLEP that I started and then
16 > forgot about sometime at the beginning of the year. I'm trying to finish
17 > up the reference implementation.
18 >
19 > When it comes to removing users, everyone's suggestions were along the
20 > same lines:
21 >
22 > 1a. If you try to uninstall a user package, it should die(), because
23 > calling userdel can be a security risk if the user still owns
24 > files.
25 >
26 > 1b. Same as 1a, with an I_KNOW_WHAT_I_AM_DOING override.
27 >
28 > 2. We can scan the file system to see if the user owns anything, and
29 > if he doesn't, call userdel. If he does, warn the user, and die().
30 >
31 > 3. During upgrades, the existing user will be left in place. But If a
32 > user package tries to switch it's UID in a new version, check to
33 > make sure that the old UID doesn't own any files, maybe die(), etc.
34 >
35 >
36 > But all of them involve being able to die() out of a removal action.
37 > It's not refusing to uninstall the system user -- that's already the
38 > status quo -- it's just refusing to remove the /package/ given that we
39 > can't actually remove the system user. Trying to keep the system and the
40 > PM in agreement (with an override).
41 >
42 > Anyway, I was trying to implement (1b), so that's how I found myself
43 > asking this question. Since I'm providing an I_KNOW_WHAT_IM_DOING
44 > override, you still have the ability to shoot yourself in the foot, but
45 > for all of this to work I'd still need a way to stop an uninstallation.
46
47 For a start, I should point out that -- unless I'm mistaken -- there is
48 no guarantee that Portage will remove packages dependency-wise. That is,
49 your 'user package' may actually be removed before packages that
50 requested the user being created, and which installed files owned by
51 that user.
52
53 That put aside, I think the 'usual Gentoo way' of solving the problem
54 you're hitting is to actually print an ewarn that the 'user has not been
55 removed because...' with explicit instructions how to remove it after
56 fixing the cause.
57
58 --
59 Best regards,
60 Michał Górny