1 |
On 11/02/2014 01:23, Walter Dnes wrote: |
2 |
> On Tue, Feb 11, 2014 at 12:28:43AM +0000, Kerin Millar wrote |
3 |
>> On 10/02/2014 23:57, Walter Dnes wrote: |
4 |
>>> |
5 |
>>> What's the point, if you still have to run as root (or su or sudo) for |
6 |
>>> the emerge update process? |
7 |
>> |
8 |
>> It's the principle of least privilege. Is there any specific reason for |
9 |
>> portage to fork and exec rsync as root? Is rsync sandboxed? Should rsync |
10 |
>> have unfettered read/write access to all mounted filesystems? Can it be |
11 |
>> guaranteed that rsync hasn't been compromised? Can it be guaranteed that |
12 |
>> PORTAGE_RSYNC_OPTS will contain safe options at all times? |
13 |
>> |
14 |
>> The answer to all of these questions is "no". Basically, the combination |
15 |
>> of usersync and non-root ownership of PORTDIR hardens the process in a |
16 |
>> sensible way while conferring no disadvantage. |
17 |
> |
18 |
> If /usr/portage is owned by portage:portage, then wouldn't a user |
19 |
> (member of portage) be able to do mischief by tweaking ebuilds? E.g. |
20 |
> modify an ebuild to point to a tarball located on a usb stick, at |
21 |
> http://127.0.0.1/media/sdc1/my_tarball.tgz. This would allow a local |
22 |
> user to supply code that gets built and then installed in /usr/bin, or |
23 |
> /sbin, etc. |
24 |
|
25 |
Yes, but only if the group write bit is set throughout PORTDIR. By |
26 |
default, rsync - as invoked by portage - preserves the permission bits |
27 |
from the remote and the files stored by the mirrors do not have this bit |
28 |
set. |
29 |
|
30 |
What I have described elsewhere is a method for ensuring that the group |
31 |
write bit is set. In that case, your concern is justified; you would |
32 |
definitely not want to grant membership of the portage group to anyone |
33 |
that you couldn't trust in this context. |
34 |
|
35 |
--Kerin |