Bug 536989

Summary: [satellite 5.3.0] Suggested patch for /usr/sbin/rhn-satellite so it exits cleanly when run by non-root user
Product: Red Hat Satellite 5 Reporter: Xixi <xdmoon>
Component: ServerAssignee: Justin Sherrill <jsherril>
Status: CLOSED CURRENTRELEASE QA Contact: Šimon Lukašík <slukasik>
Severity: medium Docs Contact:
Priority: medium    
Version: 530CC: cperry, jhutar, mmraka, slukasik, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-28 14:51:06 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: 487678    
Attachments:
Description Flags
proposed patch none

Description Xixi 2009-11-12 04:12:50 UTC
Description of problem:
If you run /usr/sbin/rhn-satellite as a non-root user, you can get all kinds of messy results, for example:

-bash-3.2$ /usr/sbin/rhn-satellite status
jabberd router is stopped
Oracle Net Listener (pid 4333) is running...
Oracle DB instance rhnsat is stopped
osa-dispatcher (pid  4389) is running...
/etc/init.d/tomcat5 is already running (4918)
httpd (pid  4939) is running...
Sorry, you *must* be root to use this program
Compilation failed in require at /usr/sbin/Monitoring line 8.
BEGIN failed--compilation aborted at /usr/sbin/Monitoring line 8.
Sorry, you *must* be root to use this program
Compilation failed in require at /usr/sbin/MonitoringScout line 8.
BEGIN failed--compilation aborted at /usr/sbin/MonitoringScout line 8.
rhn-search is running (4985).
cobblerd dead but subsys locked
RHN Taskomatic is running (5033).

With the suggested patch, running the same command will produce a much cleaner result, and stop a non-root user from executing anything:

-bash-3.2$ /usr/sbin/rhn-satellite status
This script must be run as root!

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

How reproducible:
Always.

Steps to Reproduce:
1. su - oracle (or any non-root user);
2. /usr/sbin/rhn-satellite status (or stop/start/restart etc)

Actual results:
Messy output, see problem description above.

Expected results:
Clean exit with message explaining it needs to be run as root.

Additional info:
Proposed patch from customer attached.

Comment 1 Xixi 2009-11-12 04:14:06 UTC
Created attachment 369138 [details]
proposed patch

Comment 2 Michael Mráka 2010-07-22 07:59:00 UTC
Fixed in spacewalk master

commit 01621e7908ea2f405b4cee20e0cc4028fb13f8c3
    536989 - exit cleanly when run by non-root

Comment 3 Šimon Lukašík 2010-10-05 11:14:46 UTC
QA: Changing to VERIFIED:

Testing procedure
$ /usr/sbin/rhn-satellite

Results:
Script printouts "This script must be run as root!\n\n"
for all use cases. (As proposed in the patch).

QA: 
Adding RHTS keywork. This should be extremely easy to automate.

Verified against:
Satellite-5.4.0-RHEL5-re20101001.1

Comment 4 Michael Mráka 2010-10-25 08:15:05 UTC
Verified in stage.

-bash-3.2$  /usr/sbin/rhn-satellite status
This script must be run as root!

Comment 5 Clifford Perry 2010-10-28 14:46:10 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford