Bug 1348575 - Many tools from spacewalk-backend-tools package returning Python tracebacks when run under non-root user
Summary: Many tools from spacewalk-backend-tools package returning Python tracebacks w...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Other
Version: 570
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Jiří Dostál
QA Contact: Radovan Drazny
URL:
Whiteboard:
Depends On:
Blocks: sat580-low
TreeView+ depends on / blocked
 
Reported: 2016-06-21 13:28 UTC by Radovan Drazny
Modified: 2017-06-21 12:12 UTC (History)
2 users (show)

Fixed In Version: spacewalk-backend-2.5.3-136-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-21 12:12:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Radovan Drazny 2016-06-21 13:28:40 UTC
Description of problem:

Many tools from spacewalk-backend-tools package crash when unable to read /etc/rhn/rhn.conf file. They usually output following (or similar) traceback:

Traceback (most recent call last):
  File "/usr/bin/spacewalk-update-signatures", line 25, in <module>
    from spacewalk.common.rhnConfig import CFG, initCFG
  File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnConfig.py", line 527, in <module>
    ALL_CFG.parse()
  File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnConfig.py", line 119, in parse
    timeDiff = self.modifiedYN()
  File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnConfig.py", line 98, in modifiedYN
    si = os.stat(self.filename)
spacewalk.common.rhnConfig.ConfigParserError: ('config file read error', '/etc/rhn/rhn.conf', 'Permission denied')

Version-Release number of selected component (if applicable):
spacewalk-backend-tools-2.3.3-42.el6sat

How reproducible:
always

Steps to Reproduce:
Run "$tool -h" as a non-root user, where $tool is one of following commands:
/usr/bin/rhn-charsets
/usr/bin/rhn-entitlement-report
/usr/bin/rhn-satellite-activate
/usr/bin/rhn-schema-version
/usr/bin/rhn-ssl-dbstore
/usr/bin/satpasswd
/usr/bin/spacewalk-repo-sync
/usr/bin/spacewalk-update-signatures


Actual results:
Python traceback.

Expected results:
Display help, or at least "ERROR: must be root to execute" message as other Satellite 5 command tools.

Comment 1 Jiří Dostál 2016-06-22 13:55:22 UTC
spacewalk.git 8050691c91358434d78fb98a079f77ea6c89e3af

Comment 3 Radovan Drazny 2017-05-24 12:05:52 UTC
Tested on:
spacewalk-backend-tools-2.5.3-123.el6sat
Satellite-5.8-RHEL-6-20170509.n.0

Running under non-root user:
$ for item in rhn-charsets rhn-entitlement-report rhn-satellite-activate rhn-schema-version rhn-ssl-dbstore satpasswd spacewalk-repo-sync spacewalk-update-signatures; do echo "Running $item -h";$item -h; done
Running rhn-charsets -h
ERROR: must be root to execute
/usr/bin/rhn-charsets: line 5: [: ==: unary operator expected
/usr/bin/rhn-charsets: line 7: [: ==: unary operator expected
Unknown database backend []
Running rhn-entitlement-report -h
ERROR: must be root to execute
Running rhn-satellite-activate -h
ERROR: must be root to execute
Running rhn-schema-version -h
ERROR: must be root to execute
Running rhn-ssl-dbstore -h
ERROR: must be root to execute
Running satpasswd -h
ERROR: must be root to execute
Running spacewalk-repo-sync -h
ERROR: must be root to execute
Running spacewalk-update-signatures -h
ERROR: must be root to execute

Errors for rhn-charsets are caused by inability to run "spacewalk-cfg-get db_backend" as a non-root user. It doesn't assing anything to $BACKEND variable, and subsequent $BACKEND == 'oracle' or $BACKEND == 'postgresql' tests fail. 

FailedQA

Comment 4 Tomáš Kašpárek 2017-05-24 13:28:19 UTC
spacewalk.git(master): 80158036a063bd3568e0ecb89b826869748efe7a

Comment 7 Radovan Drazny 2017-05-30 08:23:34 UTC
Tested on spacewalk-backend-2.5.3-137.el6sat.

$ for item in rhn-charsets rhn-entitlement-report rhn-satellite-activate rhn-schema-version rhn-ssl-dbstore satpasswd spacewalk-repo-sync spacewalk-update-signatures; do echo "Running $item -h";$item -h; done
Running rhn-charsets -h
ERROR: must be root to execute
Running rhn-entitlement-report -h
ERROR: must be root to execute
Running rhn-satellite-activate -h
ERROR: must be root to execute
Running rhn-schema-version -h
ERROR: must be root to execute
Running rhn-ssl-dbstore -h
ERROR: must be root to execute
Running satpasswd -h
ERROR: must be root to execute
Running spacewalk-repo-sync -h
ERROR: must be root to execute
Running spacewalk-update-signatures -h
ERROR: must be root to execute

VERIFIED


Note You need to log in before you can comment on or make changes to this bug.