Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1089729

Summary: script.py does not set multiple groups for running user
Product: [Community] Spacewalk Reporter: Shannon Hughes <shughes>
Component: ClientsAssignee: Stephen Herr <sherr>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.2CC: cperry, xdmoon
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhncfg-5.10.68-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1089730 (view as bug list) Environment:
Last Closed: 2014-07-17 08:41:35 UTC Type: Bug
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: 1119298, 1207293    

Description Shannon Hughes 2014-04-21 19:50:29 UTC
Description of problem:

When running a remote script the script running as a user does not set all groups that specific user is part of.

test and reproducer plan: 

create a testuser that is also part of the test1000 and test1100 groups

#groups testuser
testuser: testuser test1000 test1100

create /test1000 and /test1100

give group ownership

drwxrwxr-x.  2 root test1000  4096 Apr 21 15:21 test1000
drwxrwxr-x.  2 root test1100  4096 Apr 21 15:21 test1100

now schedule remote script: 

#!/bin/sh
echo "----------------------------------------------"
echo " Test script running with..."
echo " Effective User " $(id -un) " - " $(id -u)
echo " Effective Group " $(id -gn) " - " $(id -g)
echo " All groups " $(id -G)
echo " "
echo " Changing to test1000"
cd /test1000
rm -f foo*
touch foo-$(date +"%s")
echo " Changing to test1100"
cd /test1100
rm -f foo*
touch foo-$(date +"%s")
echo " Test complete."
echo "----------------------------------------------"

output from script: 



----------------------------------------------
Test script running with...
Effective User testuser - 500
Effective Group test1000 - 500
All groups 500 0

Changing to test1000
Changing to test1100
touch: cannot touch `foo-1398105014': Permission denied
Test complete.
----------------------------------------------

A patch will be submitted and a pull request will be specified in another comment

Comment 1 Shannon Hughes 2014-04-21 20:09:30 UTC
pull request 

https://github.com/spacewalkproject/spacewalk/pull/45

Comment 2 Shannon Hughes 2014-04-21 20:10:20 UTC
results from patch: 

This action will be executed after 04/21/14 3:21:00 PM EDT.

This action's status is: Completed.
The client picked up this action on 04/21/14 3:21:46 PM EDT.
The client completed this action on 04/21/14 3:21:46 PM EDT.
Client execution returned "Script executed" (code 0)


Run as: root:root
Timeout: 600 seconds

#!/bin/sh
echo "----------------------------------------------"
echo " Test script running with..."
echo " Effective User " $(id -un) " - " $(id -u)
echo " Effective Group " $(id -gn) " - " $(id -g)
echo " All groups " $(id -G)
echo " "
echo " Changing to test1000"
cd /test1000
rm -f foo*
touch foo-$(date +"%s")
echo " Changing to test1100"
cd /test1100
rm -f foo*
touch foo-$(date +"%s")
echo " Test complete."
echo "----------------------------------------------"


Start Date: 2014-04-21 15:21:46
End Date: 2014-04-21 15:21:46
Return Code: 0
Raw Output: view/download raw script output
Filtered Output:

----------------------------------------------
Test script running with...
Effective User root - 0
Effective Group root - 0
All groups 0

Changing to test1000
Changing to test1100
Test complete.
----------------------------------------------

Comment 3 Shannon Hughes 2014-04-21 20:50:48 UTC
pasted wrong output above, here is the patch run: 

Start Date: 2014-04-21 20:49:41
End Date: 2014-04-21 20:49:41
Return Code: 0
Raw Output: view/download raw script output
Filtered Output:

----------------------------------------------
Test script running with...
Effective User testuser - 500
Effective Group test1000 - 500
All groups 500 501 502

Changing to test1000
Changing to test1100
Test complete.

Comment 4 Stephen Herr 2014-04-24 18:59:14 UTC
Wow, great reproducer, thanks!

Committing to Spacewalk master:
9b2612a1123ba62ed6cbf00f11f2908d7a434a69

Comment 5 Milan Zázrivec 2014-07-17 08:41:35 UTC
Spacewalk 2.2 has been released:

    https://fedorahosted.org/spacewalk/wiki/ReleaseNotes22