Bug 1340000 - PassengerAgent/prespawn helper scripts are missing passenger_exec_t context
Summary: PassengerAgent/prespawn helper scripts are missing passenger_exec_t context
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 24
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-26 10:33 UTC by Dominic Cleal
Modified: 2017-08-08 14:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 14:39:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Dominic Cleal 2016-05-26 10:33:09 UTC
Description of problem:
The 'passenger' RPM ships scripts to help launch Passenger, but they have the wrong context, causing Passenger to load in the web server's context (e.g. httpd_t) instead of passenger_t.

The paths changed and the file context list needs updating.

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

How reproducible:
Always

Steps to Reproduce:
1. ll -Z /usr/lib64/passenger/support-binaries/PassengerAgent
2. ll -Z /usr/share/passenger/helper-scripts/prespawn

Actual results:
-rwxr-xr-x. 1 root root system_u:object_r:lib_t:s0 4392456 Mar 29 07:18 /usr/lib64/passenger/support-binaries/PassengerAgent
-rwxr-xr-x. 1 root root system_u:object_r:usr_t:s0 4001 Mar 29 07:18 /usr/share/passenger/helper-scripts/prespawn

Expected results:
-rwxr-xr-x. 1 root root system_u:object_r:passenger_exec_t:s0 4001 Mar 29 07:18 /usr/share/passenger/helper-scripts/prespawn
-rwxr-xr-x. 1 root root system_u:object_r:passenger_exec_t:s0 4392456 Mar 29 07:18 /usr/lib64/passenger/support-binaries/PassengerAgent

Additional info:
semanage fcontext -l | grep passenger returns:
/usr/lib/gems/.*/ApplicationPoolServerExecutable   regular file       system_u:object_r:passenger_exec_t:s0 
/usr/lib/gems/.*/Passenger.*                       regular file       system_u:object_r:passenger_exec_t:s0 
/usr/share/.*/gems/.*/helper-scripts/prespawn      regular file       system_u:object_r:passenger_exec_t:s0 
/usr/share/gems/.*/ApplicationPoolServerExecutable regular file       system_u:object_r:passenger_exec_t:s0 
/usr/share/gems/.*/Passenger.*                     regular file       system_u:object_r:passenger_exec_t:s0 

Passenger was repackaged from a rubygem to plain "passenger" in Fedora 22. The F24 package content list is at http://koji.fedoraproject.org/koji/rpminfo?rpmID=7541815

This causes Passenger under httpd to run in httpd_t instead of passenger_t:

App 11401 stdout: 
[ 2016-05-26 09:47:19.2498 11297/7f33720cb700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/foreman: An error occurred while starting up the preloader.
  Error ID: 66bc9839
  Error details saved to: /tmp/passenger-error-T9T1T8.html
  Message from application: Permission denied @ rb_sysopen - /usr/share/foreman/tmp/cache/websockets_ssl_key20160526-11401-1jr00ol (Errno::EACCES)
  /usr/share/ruby/tempfile.rb:133:in `initialize'
  /usr/share/ruby/tempfile.rb:133:in `open'
  /usr/share/ruby/tempfile.rb:133:in `block in initialize'
  /usr/share/ruby/tmpdir.rb:130:in `create'
  /usr/share/ruby/tempfile.rb:131:in `initialize'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/core_ext/file/atomic.rb:21:in `new'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/core_ext/file/atomic.rb:21:in `atomic_write'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache/file_store.rb:83:in `write_entry'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache/strategy/local_cache.rb:115:in `write_entry'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache.rb:391:in `block in write'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache.rb:547:in `block in instrument'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/notifications.rb:166:in `instrument'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache.rb:547:in `instrument'
  /usr/share/gems/gems/activesupport-4.2.5.2/lib/active_support/cache.rb:389:in `write'
  /usr/share/foreman/app/models/setting.rb:75:in `[]'
  /usr/share/foreman/app/models/setting/auth.rb:44:in `validate_websockets_encrypt'
  /usr/share/foreman/app/models/setting.rb:20:in `validate'
[..]
  /usr/share/gems/gems/railties-4.2.5.2/lib/rails/initializable.rb:54:in `run_initializers'
  /usr/share/gems/gems/railties-4.2.5.2/lib/rails/application.rb:352:in `initialize!'
  /usr/share/gems/gems/railties-4.2.5.2/lib/rails/railtie.rb:194:in `public_send'
  /usr/share/gems/gems/railties-4.2.5.2/lib/rails/railtie.rb:194:in `method_missing'
  /usr/share/foreman/config/environment.rb:5:in `<top (required)>'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  config.ru:3:in `block in <main>'
  /usr/share/gems/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
  /usr/share/gems/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'


[ 2016-05-26 09:47:19.2538 11297/7f337314e700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-4] Cannot checkout session because a spawning error occurred. The identifier of the error is 66bc9839. Please see earlier logs for details about the error.
[root@ec2-52-51-40-228 ~]# ps -efZ | grep Passenger
system_u:system_r:httpd_t:s0    root     11290 11261  0 09:46 ?        00:00:00 Passenger watchdog
system_u:system_r:httpd_t:s0    root     11297 11290  0 09:46 ?        00:00:00 Passenger core
system_u:system_r:httpd_t:s0    nobody   11302 11290  0 09:46 ?        00:00:00 Passenger ust-router
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 11423 997  0 09:47 pts/0 00:00:00 grep --color=auto Passenger

Comment 1 Fedora End Of Life 2017-07-25 20:54:44 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 Fedora End Of Life 2017-08-08 14:39:44 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 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.


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