Gentoo Archives: gentoo-dev

From: "Steven J. Long" <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: Re: Looking for alternative to RESTRICT=userpriv
Date: Mon, 29 Sep 2014 23:00:46
Message-Id: 20140929233118.GA3112@rathaus.eclipse.co.uk
In Reply to: Re: [gentoo-dev] Re: Re: Looking for alternative to RESTRICT=userpriv by Zac Medico
1 On Mon, Sep 29, 2014, Zac Medico wrote:
2 > On 09/28/2014, Steven J. Long wrote:
3 > > On Wed, Sep 24, 2014, Zac Medico wrote:
4 > >> The environment doesn't necessarily have to be isolated, since we could
5 > >> extend the existing environment saving/loading support to be used for by
6 > >> esudo. The steps to implement the shared environment could be as follows:
7 > >>
8 > >> 1) When esudo is called, it saves the current (unprivileged) bash
9 > >> environment to a file.
10 > >>
11 > >> 2) esudo uses IPC to request that a process with elevated privileges be
12 > >> launched to run a specific command using the saved environment, and that
13 > >> the environment of the elevated process be saved to a file after the
14 > >> command completes.
15 > >
16 > > I don't think it's going to be quite that easy to get the output env,
17 > > certainly not from some random command; tbh I don't even see the need
18 > > for it, unless I'm missing something. From the "elevated process" after
19 > > it waits on the child, but not from the child unless you control the
20 > > code.
21 >
22 > We control the shell code that launches the requested command, so we can
23 > save the environment after the requested command completes (using a
24 > modified version of our existing environment persistence code).
25
26 Yeah but think it through; the "elevated process" inherits its environment
27 from us (current state, as normal). It runs a child process: nothing in the
28 env of that child is going to affect our env, by definition. The command
29 completes, and we save back the same env we started with.
30
31 Sure, the child inherits its env from us, but we don't need to do anything
32 to make that happen: it's standard. In fact we take efforts to clean the
33 env in some situations for that reason.
34
35 I just can't see it working, apart from perhaps where a command outputs
36 settings which should be run through eval. In which case, eval them
37 in ebuild space after the command has output whatever under esudo. To
38 be flexible, you're going to want to save them anyway for later use,
39 which again implies that happening in the ebuild/eclass.
40
41 > > Other than that, I agree esudo is the best approach, and gives us
42 > > much better granularity over privilege escalation, as discussed in
43 > > the bug.
44 >
45 > Yeah, me too.
46
47 Cool, glad we're on same page.
48
49 > > Part of me thinks though, that it'd be much cleaner to give the
50 > > portage user access to sudo. Isn't that effectively the purpose
51 > > of the "suid helper"? In which case we get all the options for
52 > > env etc, of sudo, and the admin gets to configure it along with
53 > > the normal wheel setup.
54 >
55 > Depending on our goals, using sudo may or may not have advantages. It.
56 > really depends on whether or not we want esudo to interact with the
57 > local sudo configuration. If we want it to be independent of the local
58 > sudo configuration, then it makes sense for the package manager to use
59 > it's own privilege escalation mechanism.
60
61 IDK; "independent of the local sudo configuration" /sounds/ good, but
62 what we are talking about is the configuration for *one* user, that to
63 run the package manager at the heart of our distro. Speaking as a uadmin
64 (a Gentoo user who's a defacto admin, not what I think of as an "admin",
65 which would be a net-admin) I'd much rather configure that in the same
66 place I configure everything else.
67
68 It's not like I don't see the portage user in /etc/passwd et al, or it's
69 little-known. We set perms for it on /var/tmp/portage so that userpriv
70 can work, at least we did last time I set that up. /usr/portage is
71 set like that too, here. So we already have to deal with the user part
72 of userpriv, as admins.
73
74 On the implementation side, it makes a lot of sense: we delegate the
75 worry to a package used cross-distro for this specific purpose. In fact
76 this conversation has made me understand ubuntu a bit more, where I
77 always used to smile at the overuse of sudo. I certainly wouldn't
78 want the implementation headache of maintaining a secure clone.
79
80 AFAICT functional wrapping can be used for the capability side, but
81 I'd be interested to read otherwise, ie the ins and outs of why not.
82
83 Regards,
84 igli
85 --
86 #friendly-coders -- We're friendly, but we're not /that/ friendly ;-)

Replies