Bug 1371752

Summary: Rails app runs under httpd with passenger as system_u:system_r:httpd_t:s0 regardless of value of httpd_run_stickshift boolean
Product: [Fedora] Fedora Reporter: Oleg Girko <ol+redhat>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED EOL QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: dwalsh, ol+redhat
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:22:15 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:
Attachments:
Description Flags
Apache HTTPD configuration file to run Rails app none

Description Oleg Girko 2016-08-31 02:44:09 UTC
Created attachment 1196141 [details]
Apache HTTPD configuration file to run Rails app

Description of problem:
Ruby on Rails application started by Phusion Passenger from Apache HTTPD runs as system_u:system_r:httpd_t:s0 no matter whether httpd_run_stickshift boolean set to 0 or 1.

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.13.1-191.13.fc24.noarch
passenger-5.0.26-2.fc24.x86_64
httpd-2.4.23-4.fc24.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Install the following packages:
   httpd
   passenger
   obs-api from
   https://obs.infoserver.lv/repos/obs:/server:/fedora:/2.7/Fedora_24/
   (but I'm sure that it's not specific to this Rails app, any other should have the same effect).
2. Put configuration file attached below to /etc/httpd/conf.d directory.
3. Restart httpd: systemctl restart httpd.service
4. Open web page with Rails application.
5. Notice processes reported by systemctl status https.service
6. Find PID of process listed as "Passenger RubyApp: /usr/share/obs-api"
7. ps lwwZp PID (where PID is pid of the process listed above)

Actual results:
system_u:system_r:httpd_t:s0 in LABEL field of ps output

Expected results:
system_u:system_r:passenger_t:s0 in LABEL field of ps output

Additional info:

Setting httpd_run_stickshift to on or off with setsebool command doesn't have any effect.

Current policy lists the following patterns for passenger_exec_t type
(listed by "semanage fcontext -l | fgrep passenger_exec_t" command):

/usr/lib/gems/.*/ApplicationPoolServerExecutable
/usr/lib/gems/.*/Passenger.* 
/usr/share/.*/gems/.*/helper-scripts/prespawn
/usr/share/gems/.*/ApplicationPoolServerExecutable
/usr/share/gems/.*/Passenger.*

None of files matching these patterns exist in the system.
This list looks outdated to me: there is
/usr/share/passenger/helper-scripts/prespawn
file belonging to passenger package, so it looks like location of passenger files has changed, but selinux policy was not updated.

Changing type of /usr/lib/passenger/support-binaries/PassengerAgent file to passenger_exec_t with commands
  semanage fcontext -a -t passenger_exec_t /usr/lib/passenger/support-binaries/PassengerAgent
  restorecon -Fv /usr/lib/passenger/support-binaries/PassengerAgent
results in ruby-mri process running Rails app to have type passenger_t, but also results in much more selinux errors about attempts to write to files with httpd_log_t type. This is probably the wrong file to change type.

Comment 1 Fedora End Of Life 2017-07-25 22:45:55 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 2 Oleg Girko 2017-07-26 01:04:05 UTC
No, don't close this bug. It's still applicable to Fedora 25.
Didn't test with Fedora 26 yet, though.

Comment 3 Fedora End Of Life 2017-11-16 19:12:03 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 4 Fedora End Of Life 2017-12-12 10:22:15 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.