Red Hat Bugzilla – Full Text Bug Listing
|Summary:||sudo changes uid before calling SELInux calls, preventing it from setting terminal context when using non priv account|
|Product:||Red Hat Enterprise Linux 5||Reporter:||Daniel Walsh <dwalsh>|
|Component:||sudo||Assignee:||Daniel Kopeček <dkopecek>|
|Status:||CLOSED ERRATA||QA Contact:||Aleš Mareček <amarecek>|
|Version:||5.4||CC:||amarecek, dkopecek, dsikora, ejtr, kzak, pvrabec, todd.miller|
|Fixed In Version:||sudo-1.7.2p1-11.el5||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2012-02-20 22:21:13 EST||Type:||---|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
Description Daniel Walsh 2008-12-19 09:41:36 EST
Description of problem: sudo -u pwalsh sh [sudo] password for dwalsh: sudo: unable to open /dev/pts/10: Permission denied sudo: unable to setup tty context for staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023: Permission denied grep dwalsh /etc/sudoers dwalsh ALL=(ALL) TYPE=unconfined_t ROLE=unconfined_r /bin/sh The problem is the set_perms call happens before the selinux_exec, selinux_exec tries to setfilecon on the terminal and is denied because sudo is no longer running as root. Couple of choices, either split the selinux code up to set the terminal and the execcon separate from the exec and run it before set_perms, or set_perms inside the selinux_exec code when running with selinux. Looks like you chdir after the set_perms so this might change behaviour.
Comment 1 Ted Rule 2009-02-02 09:47:52 EST
Another side effect of what I presume to be the same problem appears to be the inability to redirect sudo's output to a file or pipe when the TYPE= and ROLE= operators are used. When I tried to use this: %sudoers ALL=(ALL) TYPE=unconfined_t ROLE=unconfined_r ALL in /etc/sudoers, I found that whilst sudo appeared to work Ok, the output of the sudo'ed command was apparently sent directly to the parent shell's tty rather than inheriting STDOUT. This meant that redirecting to a pipe didn't work. So this form: $ sudo cat longprivatefile | more just dumped the whole of the file to screen without more'ing it. Even though id -Z showed that I was already set to: unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 the sudoers parameters were enough to disrupt the piping. If I removed the TYPE and ROLE options from sudoers, sudo piping behaves as expected.
Comment 2 Bug Zapper 2009-11-18 05:31:16 EST
This message is a reminder that Fedora 10 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 10. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '10'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 10's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 10 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Daniel Kopeček 2011-10-27 08:43:20 EDT
Created attachment 530477 [details] proposed patch Backport selinux, audit and related code from 1.7.4p5 to 1.7.2p1. This fixes the reported issues with selinux in the 1.7.2p1 version.
Comment 7 errata-xmlrpc 2012-02-20 22:21:13 EST
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0309.html