Bug 1020997

Summary: selinux.rb#get_mcs_label assumes integer name is uid
Product: OpenShift Online Reporter: Jhon Honce <jhonce>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.xCC: chunchen, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:25:23 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:

Description Jhon Honce 2013-10-18 17:54:52 UTC
Description of problem:
Method assumes a name that looks like an integer is a uid. A name of 921957316561229358039040 breaks that assumption.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

Actual results:
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.16.0/lib/openshift-origin-node/utils/selinux.rb:118:in `get_mcs_label': Argument resolved to a UID too large for MCS set parameters: 921957316561229358039040 (ArgumentError)
	from /usr/sbin/oo-su:77:in `<main>'


Expected results:
return msc label from this name


Additional info:

Comment 1 openshift-github-bot 2013-10-19 02:36:10 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/fbfaaf1f08dd844c9dbac84f1498971776961c55
Bug 1020997 - Introduce etc_utils.rb

* Add common/lib/openshift-origin-common/utils/etc_utils.rb to safely
  allow the Node and Broker code to map a login name to UNIX user uid
* Add etc_utils to lib include

Comment 2 Xiaoli Tian 2013-10-21 05:39:47 UTC
Verified it on devenv_3921:

Create an gear whose gear name only contains integer number like below:
237981574296734099570688:x:1010:1010:OpenShift guest:/var/lib/openshift/237981574296734099570688:/usr/bin/oo-trap-user

[root@ip-10-191-57-158 ~]# oo-get-mcs-level 237981574296734099570688
s0:c0,c1010


For QE: We need to add a test cases to test the gear name only contains number like above.