Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 84146 - games.eclass use of usermod in games_pkg_setup() breaks with sandbox
Summary: games.eclass use of usermod in games_pkg_setup() breaks with sandbox
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-04 18:41 UTC by Alec Warner (RETIRED)
Modified: 2005-03-10 02:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Moves usermod to games_post_inst(), suggests moving other code (games.patch,1.36 KB, patch)
2005-03-04 18:54 UTC, Alec Warner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Warner (RETIRED) archtester gentoo-dev Security 2005-03-04 18:41:01 UTC
kyoto root # emerge games-mud/crystal
Calculating dependencies ...done!
>>> emerge (1 of 1) games-mud/crystal-0.2.1 to /
>>> md5 src_uri ;-) crystal-0.2.1.tar.gz
creating temp dir
ACCESS DENIED  open_wr:   /etc/passwd.13880
usermod: unable to lock password file
sandbox exists- /tmp/sandbox-22311.log
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE = "/tmp/sandbox-22311.log"

open_wr: /etc/passwd.13880
--------------------------------------------------------------------------------
SANDBOX_ON:=1
SANDBOX_DISABLED:=0
SANDBOX_READ:=/:/dev/shm:/var/tmp
SANDBOX_WRITE:=/dev/zero:/dev/fd/:/dev/null:/dev/pts/:/dev/vc/:/dev/tty:/tmp/:/dev/shm/ngpt:/var/log/scrollkeeper.log:/usr/tmp/conftest:/usr/lib/conftest:/usr/lib32/conftest:/usr/lib64/conftest:/usr/tmp/cf:/usr/lib/cf:/usr/lib32/cf:/usr/lib64/cf:/tmp/.gconfd/lock:/tmp/.bash_history::/tmp:/var/tmp:/tmp/:/var/tmp/:/tmp/sandbox-22311.log:/dev/shm:/var/tmp:/tmp/sandbox-22311.log:/var/log/portage/2184-crystal-0.2.1.log
SANDBOX_PREDICT:=/tmp/.:/usr/lib/python2.0/:/usr/lib/python2.1/:/usr/lib/python2.2/:/usr/lib/python2.3/:/usr/lib/python2.4/:/usr/lib/python2.5/:/usr/lib/python3.0/::/proc/self/maps:/dev/console:/usr/lib/portage/pym:/dev/random
SANDBOX_DEBUG:=1
SANDBOX_DEBUG_LOG:=/tmp/sandbox-debug-.log
SANDBOX_LOG:=/tmp/sandbox-22311.log
SANDBOX_ARMED:=unset
phases failed

This only happens if games in /etc/passwd has /bin/false as the shell.

from IRC in portage-dev:
antarus|x86 for the usermod, where in the ebuild is it legal to go? src_install()?
spb preinst/postinst

I'll test it out and make sure it works there.
Comment 1 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-03-04 18:54:09 UTC
Created attachment 52694 [details, diff]
Moves usermod to games_post_inst(), suggests moving other code

right now pre and post inst run with full privs ( to merge to live filesystem
). I left the other enewuser things for you to move; I can't really envision a
situation where they wouldn't exist...but still nice to have them there.
Comment 2 SpanKY gentoo-dev 2005-03-08 18:20:39 UTC
what about this diff:
--- games.eclass        18 Feb 2005 21:55:35 -0000      1.89
+++ games.eclass        9 Mar 2005 02:20:30 -0000
@@ -142,7 +142,7 @@             
        # Dear carpaski and portage-dev team, we are so sorry.  Lots of love, games team
        # See Bug #61680        
        [[ $(getent passwd "${GAMES_USER_DED}" | cut -f7 -d:) == "/bin/false" ]] \
-               && usermod -s /bin/bash "${GAMES_USER_DED}" 
+               && env SANDBOX_ON="0" usermod -s /bin/bash "${GAMES_USER_DED}" 
 }                              
 
 games_src_compile() {
Comment 3 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-03-09 11:14:26 UTC
The whole point is that src_compile is designed to run with reduced privs.  That will in fact work for now; however it will most probably break in future revisions of portage as privs are stripped out ( SELINUX comes to mind ).  I know spb was talking about reducing privs of sections via SElinux policy in which case even with SANDBOX disabled that code will fail.  I don't see the issue moving the usermod stuff to preinst() as a big deal...Any reason why this can't be done?  Your diff seems more like a hack aroundn the issue...
Comment 4 SpanKY gentoo-dev 2005-03-09 16:59:37 UTC
wtf does src_compile() have to do with this ?

our usermod functions run in pkg_setup() which require running as root and really should not have sandbox turned on (imho), but that's a different story
Comment 5 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-03-09 17:37:05 UTC
Sorry, I did mean pkg_setup().  IIRC the only 2 functions not sandbox'd (besides the actual merge to the filesystem ) are pre_inst() and post_inst().  That is why I suggested putting them there.  However I do not think there is confirmed policy on which functions will have which permissions in the future.  Because of that I'm not going to really push moving it somewhere else.

[update] After chatting a bit in #-portage pkg_setup() supposidly shouldn't have sandbox enabled.  Let me file a bug against portage to make sure, if so this one is invalid.
Comment 6 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-03-09 17:41:09 UTC
see 84960 filed against portage HEAD
Comment 7 Jason Stubbs (RETIRED) gentoo-dev 2005-03-10 02:41:16 UTC
Portage HEAD issue