Bug 627543

Summary: The Runas_Spec are ignored in sudoers file
Product: Red Hat Enterprise Linux 5 Reporter: Vishal Gaikwad <vgaikwad>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED ERRATA QA Contact: Aleš Mareček <amarecek>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4CC: amarecek, dkopecek, pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sudo-1.7.2p1-11.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 810147 (view as bug list) Environment:
Last Closed: 2012-02-21 03:21:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 810147    
Attachments:
Description Flags
proposed patch
none
proposed patch none

Description Vishal Gaikwad 2010-08-26 11:07:20 UTC
Description of problem:
Using the Runas_Alias rule vis visudo seems to ne ignored.

Version-Release number of selected component (if applicable):
sudo-1.7.2p1-5.el5

How reproducible:
Always

Steps to Reproduce:
1) Create three user/group "a", "b", "c"

2) Run visudo command to add following lines:

User_Alias OK_GROUP = %a
Runas_Alias OK_RUNAS_GROUP = %b, %c
OK_GROUP ALL = (OK_RUNAS_GROUP) ALL

3) Run as user "a"
 
Actual results:
# sudo -g b ls /etc
Sorry, user a is not allowed to execute '/bin/ls /etc' as a:b on localhost.

Expected results:
$ sudo -g b ls /etc/
a2ps.cfg               conman.conf       firmware              init.d          ltrace.conf     ntp             rc0.d                    screenrc           tftpd.rules

Additional info:

A workaround is to use the following rule in visudo:

%a ALL = (:b, c) ALL

Comment 2 RHEL Program Management 2011-05-31 15:31:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 3 Daniel Kopeček 2011-10-25 12:13:31 UTC
Created attachment 530072 [details]
proposed patch

The attached patch adds interpretation of USERGROUP entries in the _runaslist_matches(user_list, group_list) function. To fix the second issue, it changes the handling of a resolved alias in the group check loop (passes it as a group list, not as an user list).

Comment 4 Daniel Kopeček 2011-10-26 09:00:30 UTC
Created attachment 530259 [details]
proposed patch

Stripped down patch. The case with %group syntax is not a bug (http://www.sudo.ws/pipermail/sudo-workers/2011-October/000699.html).

Comment 5 Daniel Kopeček 2011-10-26 11:28:35 UTC
Upstream fix:
http://www.sudo.ws/repos/sudo/rev/3ab0460a4dee

Comment 8 errata-xmlrpc 2012-02-21 03:21:31 UTC
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