RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 971606 - 'service httpd status' doesn't run as non root _and_ returns incorrect status
Summary: 'service httpd status' doesn't run as non root _and_ returns incorrect status
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: httpd
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: pre-dev-freeze
: 6.6
Assignee: Luboš Uhliarik
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 980134
TreeView+ depends on / blocked
 
Reported: 2013-06-06 22:16 UTC by Pádraig Brady
Modified: 2021-01-14 09:34 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 980134 (view as bug list)
Environment:
Last Closed: 2013-07-01 13:28:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Pádraig Brady 2013-06-06 22:16:55 UTC
There are two closely related issues here:

I would expect this command to succeed as a non root user?

  $ service httpd status
  httpd dead but subsys locked

If that's not possible fair enough.
But the issue is compounded by...


...the init script return code is incorrect:

  $ echo $?
  2

http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
states that "2" means the service is dead.
In this case "4" should be returned so that status
for this service can be presented correctly.

Comment 1 Jan Kaluža 2013-06-07 04:50:23 UTC
I have checked httpd initscript and it uses "status" function from /etc/rc.d/init.d/functions (from package "initscripts") and returns its return code.

This function checks if the /var/run/httpd/httpd.pid exists, but /var/run/httpd directory has mode 0710, so as a user, you are not allowed to read its content. status function in /etc/init.d/functions should probably check for this case and return 4. I think this should be filed as a bug against initscripts package.

I will ask Joe Orton, if it's possible change the /var/run/httpd permissions to allow users reading the PID file. I don't see any reason why not to do that (and lot of daemons do that), but maybe I'm missing something...

Comment 2 Joe Orton 2013-06-10 08:13:41 UTC
We put other stuff in /var/run/httpd - AF_UNIX sockets notably (mod_cgid, mod_wsgi, etc).  I'm not sure it's a actively harmful... do we guarantee that the status command works as non-root?  What do the SELinux rules enforce?

Comment 3 Joe Orton 2013-07-01 13:28:37 UTC
Lacking any strong motivation I don't think we should change this.  I don't think we could or should guarantee that the "status" command will work properly for non-root users in all cases; there may well be many exceptional cases which we couldn't anticipate.  systemd addresses this issue properly.


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