public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Looking for alternative to RESTRICT=userpriv
@ 2014-07-08 13:25 Michał Górny
  2014-07-08 14:17 ` [gentoo-dev] " Ulrich Mueller
  2014-07-09  9:15 ` [gentoo-dev] " Joshua Kinard
  0 siblings, 2 replies; 17+ messages in thread
From: Michał Górny @ 2014-07-08 13:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: pms-bugs

[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]

Hello, developers.

I've been doing some research wrt use of RESTRICT=userpriv [1] lately
and found out that most of the affected packages use it solely to gain
access to files or devices that are restricted to specific groups. I've
specifically noted three cases:

1) ebuilds using CUDA that needed to access /dev/nvidia* (restricted to
video group),

2) game ebuilds that needed to access game executables (restricted to
games group but hopefully subject to change),

3) qmail-related ebuilds that needed to access restricted files (no
details yet).

I believe that most (if not all) of uses of RESTRICT=userpriv are
overkill. It implies elevating privileges for the whole build process
while what's really needed is an access to a particular file or device,
or a capability of some kind for a single command execution.

I would therefore like to ask the Community for ideas on how
RESTRICT=userpriv could be effectively replaced by something safer.


I can enumerate the following possibilities:

a) explicitly requesting user to alter group membership for the build
user. This is already done in some of the CUDA ebuilds.

Advantages:

- limits elevated privileges to a particular group access,

- works now.

Disadvantages:

- requires manual intervention (we even can't properly name the user
  since there's no PMS function/variable to obtain it),

- increases privileges for all ebuilds rather than the one needing it.
  Developers using it will not get proper failures for ebuilds not
  having the check,

- doesn't cover other uses of FEATURES=userpriv.


b) SUPPLEMENTARY_GROUPS support [2]. The idea is to use setgroups() to
transparently enable group membership for the build process.

Advantages:

- transparent, relatively simple.

Disadvantages:

- quite ugly name ;),

- doesn't cover other uses of FEATURES=userpriv.


c) 'esudo' helper [3]. This is a more generic form of (2), with support
for other potential privilege changes.

Advantages:

- allows to raise privileges precisely for one command,

- flexible -- may alter EUID, EGID, groups, capabilities.

Disadvantages:

- hard to implement -- especially if we want to make it capable of
  running bash functions.


What do you think? Do you have other ideas?


[1]:https://bugs.gentoo.org/show_bug.cgi?id=516568
[2]:https://bugs.gentoo.org/show_bug.cgi?id=516614
[3]:https://bugs.gentoo.org/show_bug.cgi?id=516616

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-10-11  7:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 13:25 [gentoo-dev] Looking for alternative to RESTRICT=userpriv Michał Górny
2014-07-08 14:17 ` [gentoo-dev] " Ulrich Mueller
2014-07-09 14:17   ` Michał Górny
2014-09-25  4:51     ` Zac Medico
2014-09-29  4:23       ` [gentoo-dev] " Steven J. Long
2014-09-29 18:12         ` Zac Medico
2014-09-29 23:31           ` [gentoo-dev] " Steven J. Long
2014-09-30 14:52             ` Zac Medico
2014-10-03  2:32               ` [gentoo-dev] " Steven J. Long
2014-10-03  3:01                 ` Peter Stuge
2014-10-04  3:42                   ` [gentoo-dev] " Steven J. Long
2014-10-04  4:29                     ` Peter Stuge
2014-10-04  7:19                       ` [gentoo-dev] " Steven J. Long
2014-10-05 21:52                 ` Zac Medico
2014-10-11  7:06                   ` [gentoo-dev] " Steven J. Long
2014-10-11  7:48                     ` Zac Medico
2014-07-09  9:15 ` [gentoo-dev] " Joshua Kinard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox