passenger 5.0.30 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +30 -1
  3. data/CONTRIBUTING.md +1 -1
  4. data/CONTRIBUTORS +2 -0
  5. data/bin/passenger-install-nginx-module +18 -13
  6. data/build/agent.rb +1 -0
  7. data/build/basics.rb +1 -0
  8. data/build/cxx_tests.rb +6 -1
  9. data/build/misc.rb +3 -0
  10. data/build/packaging.rb +5 -17
  11. data/build/support/cxx_dependency_map.rb +100 -0
  12. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +4 -1
  13. data/build/test_basics.rb +12 -2
  14. data/dev/ci/run_travis.sh +6 -2
  15. data/doc/Users guide Apache.html +7 -2
  16. data/doc/Users guide Apache.txt +4 -0
  17. data/resources/templates/error_layout.css +70 -84
  18. data/resources/templates/error_layout.html.template +84 -93
  19. data/resources/templates/standalone/http.erb +17 -13
  20. data/resources/templates/standalone/server.erb +2 -1
  21. data/resources/templates/undisclosed_error.html.template +52 -51
  22. data/resources/update_check_client_cert.p12 +0 -0
  23. data/resources/update_check_client_cert.pem +89 -0
  24. data/resources/update_check_server_pubkey.pem +14 -0
  25. data/src/agent/Core/ApplicationPool/ErrorRenderer.h +15 -1
  26. data/src/agent/Core/Controller.h +3 -2
  27. data/src/agent/Core/Controller/CheckoutSession.cpp +5 -4
  28. data/src/agent/Core/Controller/ForwardResponse.cpp +1 -1
  29. data/src/agent/Core/Controller/InitRequest.cpp +2 -0
  30. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -0
  31. data/src/agent/Core/Controller/Request.h +1 -0
  32. data/src/agent/Core/CoreMain.cpp +99 -2
  33. data/src/agent/Core/OptionParser.h +18 -1
  34. data/src/agent/Core/SecurityUpdateChecker.h +559 -0
  35. data/src/agent/Shared/Base.cpp +6 -1
  36. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +52 -0
  37. data/src/agent/Watchdog/InstanceDirToucher.cpp +1 -2
  38. data/src/agent/Watchdog/WatchdogMain.cpp +31 -40
  39. data/src/apache2_module/Configuration.cpp +12 -0
  40. data/src/apache2_module/Configuration.hpp +5 -0
  41. data/src/apache2_module/ConfigurationCommands.cpp +19 -19
  42. data/src/apache2_module/ConfigurationCommands.cpp.cxxcodebuilder +2 -2
  43. data/src/apache2_module/ConfigurationFields.hpp +19 -19
  44. data/src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder +2 -2
  45. data/src/apache2_module/ConfigurationSetters.cpp +19 -19
  46. data/src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder +2 -2
  47. data/src/apache2_module/CreateDirConfig.cpp +19 -19
  48. data/src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder +2 -2
  49. data/src/apache2_module/Hooks.cpp +10 -1
  50. data/src/apache2_module/MergeDirConfig.cpp +19 -19
  51. data/src/apache2_module/MergeDirConfig.cpp.cxxcodebuilder +2 -2
  52. data/src/apache2_module/SetHeaders.cpp +19 -19
  53. data/src/apache2_module/SetHeaders.cpp.cxxcodebuilder +2 -2
  54. data/src/cxx_supportlib/Constants.h +22 -22
  55. data/src/cxx_supportlib/Constants.h.cxxcodebuilder +4 -1
  56. data/src/cxx_supportlib/Crypto.cpp +977 -0
  57. data/src/cxx_supportlib/Crypto.h +147 -0
  58. data/src/cxx_supportlib/InstanceDirectory.h +55 -2
  59. data/src/cxx_supportlib/Utils/Curl.h +24 -10
  60. data/src/cxx_supportlib/Utils/JsonUtils.h +1 -1
  61. data/src/cxx_supportlib/oxt/detail/spin_lock_darwin.hpp +2 -0
  62. data/src/cxx_supportlib/vendor-modified/boost/system/error_code.hpp +3 -3
  63. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +167 -92
  64. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +1827 -1542
  65. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +4705 -3652
  66. data/src/cxx_supportlib/vendor-modified/libev/Changes +46 -15
  67. data/src/cxx_supportlib/vendor-modified/libev/LICENSE +1 -1
  68. data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +215 -128
  69. data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +466 -275
  70. data/src/cxx_supportlib/vendor-modified/libev/config.guess +312 -418
  71. data/src/cxx_supportlib/vendor-modified/libev/config.sub +246 -105
  72. data/src/cxx_supportlib/vendor-modified/libev/configure +276 -72
  73. data/src/cxx_supportlib/vendor-modified/libev/configure.ac +2 -1
  74. data/src/cxx_supportlib/vendor-modified/libev/depcomp +346 -185
  75. data/src/cxx_supportlib/vendor-modified/libev/ev++.h +1 -1
  76. data/src/cxx_supportlib/vendor-modified/libev/ev.c +530 -190
  77. data/src/cxx_supportlib/vendor-modified/libev/ev.h +23 -14
  78. data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +12 -6
  79. data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +9 -5
  80. data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +6 -3
  81. data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -4
  82. data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +4 -2
  83. data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +3 -2
  84. data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +3 -4
  85. data/src/cxx_supportlib/vendor-modified/libev/install-sh +433 -219
  86. data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -6
  87. data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +2 -2
  88. data/src/cxx_supportlib/vendor-modified/libev/missing +167 -288
  89. data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +72 -21
  90. data/src/cxx_supportlib/vendor-modified/modp_b64.cpp +4 -106
  91. data/src/cxx_supportlib/vendor-modified/modp_b64_data.h +37 -1
  92. data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +119 -0
  93. data/src/helper-scripts/node-loader.js +72 -1
  94. data/src/nginx_module/CacheLocationConfig.c +52 -19
  95. data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +2 -2
  96. data/src/nginx_module/Configuration.c +26 -1
  97. data/src/nginx_module/Configuration.h +2 -0
  98. data/src/nginx_module/ConfigurationCommands.c +35 -19
  99. data/src/nginx_module/ConfigurationCommands.c.cxxcodebuilder +2 -2
  100. data/src/nginx_module/ContentHandler.c +1 -1
  101. data/src/nginx_module/CreateLocationConfig.c +22 -19
  102. data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +2 -2
  103. data/src/nginx_module/LocationConfig.h +21 -19
  104. data/src/nginx_module/LocationConfig.h.cxxcodebuilder +2 -2
  105. data/src/nginx_module/MergeLocationConfig.c +25 -19
  106. data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +2 -2
  107. data/src/nginx_module/ngx_http_passenger_module.c +8 -4
  108. data/src/ruby_supportlib/phusion_passenger.rb +9 -4
  109. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +2 -2
  110. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
  111. data/src/ruby_supportlib/phusion_passenger/common_library.rb +13 -0
  112. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +5 -2
  113. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
  114. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +15 -3
  115. data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +51 -0
  116. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +7 -0
  117. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +17 -0
  118. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +4 -2
  119. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -0
  120. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +5 -0
  121. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +19 -10
  122. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +25 -0
  123. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +38 -103
  124. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +178 -0
  125. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +94 -0
  126. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +2 -2
  127. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +2 -2
  128. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
  129. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +5 -3
  130. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +9 -7
  131. metadata +14 -4
@@ -25,7 +25,7 @@ passenger_enabled on;
25
25
  union_station_key <%= app[:union_station_key] %>;
26
26
  <% end %>
27
27
  <% app[:envvars].each_pair do |name, value| %>
28
- passenger_env_var '<%= name %>' '<%= value %>';
28
+ passenger_env_var '<%= name %>' '<%= json_config_value(value) %>';
29
29
  <% end %>
30
30
  <% if app[:concurrency_model] && app[:concurrency_model] != DEFAULT_CONCURRENCY_MODEL %>
31
31
  passenger_concurrency_model <%= app[:concurrency_model] %>;
@@ -53,6 +53,7 @@ passenger_enabled on;
53
53
  <%= nginx_option(app, :friendly_error_pages) %>
54
54
  <%= nginx_option(app, :abort_websockets_on_process_shutdown) %>
55
55
  <%= nginx_option(app, :force_max_concurrent_requests_per_process) %>
56
+ <%= nginx_option(app, :max_requests) %>
56
57
 
57
58
  <%= nginx_option(app, :rolling_restarts) %>
58
59
  <%= nginx_option(app, :resist_deployment_errors) %>
@@ -1,55 +1,56 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- .dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- #operator_info_panel {
17
- width: 27em;
18
- margin: 4em auto 0 auto;
19
- line-height: 1.2em;
20
- }
21
- #show_operator_info { text-decoration: none; color: #99f; font-size: smaller; }
22
- #show_operator_info:hover { text-decoration: underline; }
23
- #operator_info { color: #444; text-align: justify; }
24
- </style>
25
- </head>
26
-
27
- <body>
28
- <div class="dialog">
29
- <h1>We're sorry, but something went wrong.</h1>
30
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
31
- </div>
32
- <div id="operator_info_panel">
33
- <a id="show_operator_info" href="javascript:void(showOperatorInfo())">Information for the administrator of this website</a>
34
- <div id="operator_info" style="display: none">
35
- <p>The {{PROGRAM_NAME}} application server encountered an error while starting your web application.
36
- Because you are running this web application in staging or production mode, the details of the error
37
- have been omitted from this web page for security reasons.</p>
38
- <p><strong>Please read <a href="https://www.phusionpassenger.com/library/admin/log_file/">the Passenger log file</a> to find the details of the error.</strong></p>
39
- <p>Alternatively, you can turn on the "friendly error pages" feature (see below), which will make {{PROGRAM_NAME}} show many details about the error right in the browser.</p>
40
- <p>To turn on friendly error pages:</p>
41
- <ul>
42
- <li><a href="https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_friendly_error_pages">Nginx integration mode</a></li>
43
- <li><a href="https://www.phusionpassenger.com/library/config/apache/reference/#passengerfriendlyerrorpages">Apache integration mode</a></li>
44
- <li><a href="https://www.phusionpassenger.com/library/config/standalone/reference/#--friendly-error-pages---no-friendly-error-pages-friendly_error_pages">Standalone mode</a></li>
45
- </ul>
3
+ <head>
4
+ <title>We're sorry, but something went wrong: {{TITLE}}</title>
5
+ <style type="text/css">
6
+ {{CSS|raw}}
7
+ </style>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ <meta name="generator" content="Phusion Passenger">
10
+ </head>
11
+ <body>
12
+ <header>
13
+ <div class="column">
14
+ <svg width="50" height="50" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><path d="m731.234002 153.838666v-18.841339c0-4.417534-3.577416-7.997327-7.990382-7.997327h-6.414571c-4.417012 0-7.990383 3.580525-7.990383 7.997327v18.841339h-18.841339c-4.417534 0-7.997327 3.577416-7.997327 7.990383v6.414571c0 4.417011 3.580525 7.990382 7.997327 7.990382h18.841339v18.841339c0 4.417534 3.577416 7.997328 7.990383 7.997328h6.414571c4.417011 0 7.990382-3.580526 7.990382-7.997328v-18.841339h18.841339c4.417534 0 7.997328-3.577416 7.997328-7.990382v-6.414571c0-4.417012-3.580526-7.990383-7.997328-7.990383z" fill="#f87575" transform="matrix(.70710678 -.70710678 .70710678 .70710678 -593.80455139 424.48059756)"/></svg>
15
+ <h1>We're sorry, but something went wrong.</h1>
16
+ <p class="subtitle">The issue has been logged for investigation. Please try again later.</p>
17
+ </div>
18
+ </header>
19
+ <div class="column">
20
+ <a id="show_operator_info" href="#" onclick="showOperatorInfo()">Technical details for the administrator of this website</a>
21
+ <div id="operator_info">
22
+ <div class="left">
23
+ <h3>Error:</h3>
24
+ <span class="error">{{TITLE}}</span>
25
+ <h3>Error ID:</h3>
26
+ <span class="error">{{ERROR_ID}}</span>
27
+ <h3>Details:</h3>
28
+ <p>Web application could not be started by the {{PROGRAM_NAME}} application server.</p>
29
+ <p class="bold">Please read <a href="https://www.phusionpassenger.com/library/admin/log_file/" class="plain">the Passenger log file</a> (search for the Error ID) to find the details of the error.</p>
30
+ <p>You can also get a detailed report to appear directly on this page, but for security reasons it is only provided if {{PROGRAM_NAME}} is run with <i>environment</i> set to <i>development</i> and/or with the <i>friendly error pages</i> option set to <i>on</i>.</p>
31
+ <p>For more information about configuring environment and friendly error pages, see:</p>
32
+ <ul>
33
+ <li><a href="https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_friendly_error_pages">Nginx integration mode</a></li>
34
+ <li><a href="https://www.phusionpassenger.com/library/config/apache/reference/#passengerfriendlyerrorpages">Apache integration mode</a></li>
35
+ <li><a href="https://www.phusionpassenger.com/library/config/standalone/reference/#--friendly-error-pages---no-friendly-error-pages-friendly_error_pages">Standalone mode</a></li>
36
+ </ul>
37
+ </div>
38
+ </div>
46
39
  </div>
47
- </div>
48
-
49
- <script>
50
- function showOperatorInfo() {
51
- document.getElementById('operator_info').style.display = 'block';
52
- }
53
- </script>
54
- </body>
40
+ <footer>
41
+ <!--
42
+ You are free to modify the footer as you see fit,
43
+ but we kindly ask of you to preserve the following
44
+ text. Thank you.
45
+ -->
46
+ <div class="column">
47
+ This website is powered by <b>Passenger</b>&reg;, a rock-solid, feature-rich web application server that integrates with Apache and Nginx.
48
+ </div>
49
+ </footer>
50
+ <script>
51
+ function showOperatorInfo() {
52
+ document.getElementById('operator_info').style.display = 'block';
53
+ }
54
+ </script>
55
+ </body>
55
56
  </html>
@@ -0,0 +1,89 @@
1
+ Bag Attributes
2
+ localKeyID: 00 3F 90 FE DE D7 C2 FF EC 81 5D 3E 39 0A 8D 6B 3F 8A A3 E7
3
+ subject=/C=NL/L=Amsterdam/O=Phusion B.V./CN=Phusion Passenger Open Source
4
+ issuer=/C=NL/L=Amsterdam/O=Phusion B.V./CN=Phusion Passenger Security Check
5
+ -----BEGIN CERTIFICATE-----
6
+ MIIFNzCCAx8CAQEwDQYJKoZIhvcNAQELBQAwYzELMAkGA1UEBhMCTkwxEjAQBgNV
7
+ BAcMCUFtc3RlcmRhbTEVMBMGA1UECgwMUGh1c2lvbiBCLlYuMSkwJwYDVQQDDCBQ
8
+ aHVzaW9uIFBhc3NlbmdlciBTZWN1cml0eSBDaGVjazAeFw0xNjA5MjAxMDU4NTJa
9
+ Fw00NDAyMDUxMDU4NTJaMGAxCzAJBgNVBAYTAk5MMR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jkJS2FJE6GWUqy44s4CzX830lA1g6F/5/3ybOPdbdiAiKVgpN
26
+ 4QHJyInguh7g/bJ/1Q7G+/my6dawhJOmLiULOJZmaXUWwDp4Sm7khtYwJvefT7qF
27
+ oA9U2k14HGDZvKIjwaxRhSGpUnRntOgiomXtTZBZeN7SxNt9+cHBsQXiDfE1Vx2E
28
+ jvawvGTxjDsQlTYPXtkCAKO2FTplB+HRAqGIN4G/umuzDwS9VIIRpoCylCmjbCDP
29
+ EC9CITsiLVMNu3ig3ZYBQHFmO65QPxomxqJ+0WbFLgQPIw75miyuALTJ6gIWYquT
30
+ FlMwbx8yG8xTZ3vDc0tY4H6NdanUxtolBSPQ/MOD6xfwBN0u/CszcKXTyGYtbV74
31
+ lACauhEq1XI4zheTpuTxiEefjj9aJRfiSvIa51fcyezjK6gI6auGnkBCI/UlQJDu
32
+ 9Kx8jBfwkQTIBaESREY/zNmvZV1H28XOxFMKKfzguNbRE0ZLMPNVTuxa6JbWtL55
33
+ 0JHGueYtlIRmYe7YFawFg9xAEns3mr28BPAywE5+SdEJwE8G8IPfxaWAkA==
34
+ -----END CERTIFICATE-----
35
+ Bag Attributes
36
+ localKeyID: 00 3F 90 FE DE D7 C2 FF EC 81 5D 3E 39 0A 8D 6B 3F 8A A3 E7
37
+ Key Attributes: <No Attributes>
38
+ -----BEGIN PRIVATE KEY-----
39
+ MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQClDUeyOXtB9e+W
40
+ 5oPXfcLBBZgzUVf1EX+/nbb7EdqduAVoEzlK2Ii3s+Rm/f6ETRroqvKhufYfqpJ5
41
+ n2zLCCRse+7k7hcZuHASlZijt0AqH6IvB3gCwWl0UDy/99hDusLzHREtG098l366
42
+ II41ctNhFLbZXK+lws5kr5lQzfXRSOjasfMSFJklbKzp/reqr4tpSSTNkEIg2stK
43
+ ABEJMTB5vWcFWc6kSTYyaZUquhN9vFRrHV2RVvDDNAHcYf+8xwZUpoCBUkaBCdzV
44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YlccGogmRupyTEqURSB3dqOp9w2V8bbFxaCZf+74Nfb5KCuSW1Qbsrm4Z
4
+ 3F42eDCs+O7Q/kQ8WghulLMyuNi/7puRlNXjCqQ3gMcnxtSHeoG+2Rh/uVGOxBfq
5
+ MA9xg4M7zeU3Rcmyu5AHyKn/LeTrkJPYaaipCKC/l8TKfThD01wdmsY2jmrCA5JF
6
+ hzPNTUcXKDj0xnK2SEELei+dpRQCEjjk7v+9/eLqPRnuYwmSHgv4KFwGYsLM+ra+
7
+ rC/0GMCgv46YTt4rnhd6EicGUJSf5GnlM9lCp3eQoCdJJ0jrC6KuPhhyliF4BEXN
8
+ rgDfLR3RMQRQ3uJ7x+1uJ5kNsJhObEFBRFjLB2B8BQJoKdCToZXh0as7jG/jMLQQ
9
+ 5ZiUJZwJTZxyj4A8tQy96ePamz4VPNE29OHLL++hXVrOYGaRyL3MRam4CQG0jU6R
10
+ WqlVwTJdyMaSIM4FLPgA5H8ob1mq9M9nU1IMS++8SaM8AFdwvJvNdCGsZtmnk20e
11
+ DqDUfYmLw9PWpRgVfoE8rgTiSAnQL/161Mnbq10335ZaRTv8WDsvqeAc2tD9vgSi
12
+ fpuJZuMeqh+tPp2vyxGRjV0M3j0WoWmSMnD9lI4ua/rZxiRBvk2X6IlxAdAd+CI0
13
+ DW8UYooAygpzviU/V09vY1sCAwEAAQ==
14
+ -----END PUBLIC KEY-----
@@ -100,12 +100,26 @@ public:
100
100
  return Template::apply(readAll(errorLayoutFile), params);
101
101
  }
102
102
 
103
- string renderWithoutDetails() const {
103
+ string renderWithoutDetails(const SpawnException *e = NULL) const {
104
104
  string templateFile = templatesDir + "/undisclosed_error.html.template";
105
+ string css = readAll(cssFile);
105
106
  StringMap<StaticString> params;
106
107
 
107
108
  params.set("PROGRAM_NAME", PROGRAM_NAME);
109
+ params.set("CSS", css);
110
+ params.set("TITLE", "Web application could not be started");
108
111
 
112
+ if (e != NULL) {
113
+ const map<string, string> &annotations = e->getAnnotations();
114
+ map<string, string>::const_iterator it = annotations.find("error_id");
115
+ if (it != annotations.end()) {
116
+ params.set("ERROR_ID", it->second);
117
+ } else {
118
+ params.set("ERROR_ID", "not available");
119
+ }
120
+ } else {
121
+ params.set("ERROR_ID", "not available");
122
+ }
109
123
  return Template::apply(readAll(templateFile), params);
110
124
  }
111
125
  };
@@ -149,6 +149,7 @@ private:
149
149
  HashedStaticString PASSENGER_APP_GROUP_NAME;
150
150
  HashedStaticString PASSENGER_ENV_VARS;
151
151
  HashedStaticString PASSENGER_MAX_REQUESTS;
152
+ HashedStaticString PASSENGER_SHOW_VERSION_IN_HEADER;
152
153
  HashedStaticString PASSENGER_STICKY_SESSIONS;
153
154
  HashedStaticString PASSENGER_STICKY_SESSIONS_COOKIE_NAME;
154
155
  HashedStaticString PASSENGER_REQUEST_OOB_WORK;
@@ -181,7 +182,7 @@ private:
181
182
  #endif
182
183
 
183
184
 
184
- /****** Stage: initiatelize request ******/
185
+ /****** Stage: initialize request ******/
185
186
 
186
187
  struct RequestAnalysis;
187
188
 
@@ -363,7 +364,7 @@ private:
363
364
 
364
365
 
365
366
  protected:
366
- /****** Stage: initiatelize request ******/
367
+ /****** Stage: initialize request ******/
367
368
 
368
369
  virtual void onRequestBegin(Client *client, Request *req);
369
370
 
@@ -290,17 +290,18 @@ void
290
290
  Controller::writeOtherExceptionErrorResponse(Client *client, Request *req, const ExceptionPtr &e) {
291
291
  TRACE_POINT();
292
292
  string typeName;
293
+ const oxt::tracable_exception &eptr = *e;
293
294
  #ifdef CXX_ABI_API_AVAILABLE
294
295
  int status;
295
- char *tmp = abi::__cxa_demangle(typeid(*e).name(), 0, 0, &status);
296
+ char *tmp = abi::__cxa_demangle(typeid(eptr).name(), 0, 0, &status);
296
297
  if (tmp != NULL) {
297
298
  typeName = tmp;
298
299
  free(tmp);
299
300
  } else {
300
- typeName = typeid(*e).name();
301
+ typeName = typeid(eptr).name();
301
302
  }
302
303
  #else
303
- typeName = typeid(*e).name();
304
+ typeName = typeid(eptr).name();
304
305
  #endif
305
306
 
306
307
  const unsigned int exceptionMessageLen = strlen(e->what());
@@ -362,7 +363,7 @@ Controller::endRequestWithErrorResponse(Client **c, Request **r, const StaticStr
362
363
  }
363
364
  } else {
364
365
  try {
365
- data = renderer.renderWithoutDetails();
366
+ data = renderer.renderWithoutDetails(e);
366
367
  } catch (const SystemException &e2) {
367
368
  SKC_ERROR(client, "Cannot render an error page: " << e2.what() <<
368
369
  "\n" << e2.backtrace());
@@ -767,7 +767,7 @@ Controller::constructHeaderBuffersForResponse(Request *req, struct iovec *buffer
767
767
  PUSH_STATIC_BUFFER("\r\n");
768
768
  }
769
769
 
770
- if (showVersionInHeader) {
770
+ if (req->showVersionInHeader) {
771
771
  #ifdef PASSENGER_IS_ENTERPRISE
772
772
  PUSH_STATIC_BUFFER("X-Powered-By: " PROGRAM_NAME " Enterprise " PASSENGER_VERSION "\r\n\r\n");
773
773
  #else
@@ -489,6 +489,8 @@ Controller::onRequestBegin(Client *client, Request *req) {
489
489
  && getBoolOption(req, UNION_STATION_SUPPORT, false);
490
490
  req->stickySession = getBoolOption(req, PASSENGER_STICKY_SESSIONS,
491
491
  this->stickySessions);
492
+ req->showVersionInHeader = getBoolOption(req, PASSENGER_SHOW_VERSION_IN_HEADER,
493
+ this->showVersionInHeader);
492
494
  req->host = req->headers.lookup(HTTP_HOST);
493
495
 
494
496
  /***************/
@@ -64,6 +64,7 @@ Controller::Controller(ServerKit::Context *context, const VariantMap *_agentsOpt
64
64
  PASSENGER_APP_GROUP_NAME("!~PASSENGER_APP_GROUP_NAME"),
65
65
  PASSENGER_ENV_VARS("!~PASSENGER_ENV_VARS"),
66
66
  PASSENGER_MAX_REQUESTS("!~PASSENGER_MAX_REQUESTS"),
67
+ PASSENGER_SHOW_VERSION_IN_HEADER("!~PASSENGER_SHOW_VERSION_IN_HEADER"),
67
68
  PASSENGER_STICKY_SESSIONS("!~PASSENGER_STICKY_SESSIONS"),
68
69
  PASSENGER_STICKY_SESSIONS_COOKIE_NAME("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME"),
69
70
  PASSENGER_REQUEST_OOB_WORK("!~Request-OOB-Work"),
@@ -72,6 +72,7 @@ public:
72
72
  bool dechunkResponse: 1;
73
73
  bool requestBodyBuffering: 1;
74
74
  bool https: 1;
75
+ bool showVersionInHeader: 1;
75
76
  bool stickySession: 1;
76
77
 
77
78
  // Range: 0..MAX_SESSION_CHECKOUT_TRY
@@ -59,6 +59,8 @@
59
59
  #include <sstream>
60
60
  #include <stdexcept>
61
61
 
62
+ #include <curl/curl.h>
63
+
62
64
  #include <boost/thread.hpp>
63
65
  #include <boost/shared_ptr.hpp>
64
66
  #include <boost/make_shared.hpp>
@@ -89,6 +91,7 @@
89
91
  #include <Core/ApiServer.h>
90
92
  #include <Core/ApplicationPool/Pool.h>
91
93
  #include <Core/UnionStation/Context.h>
94
+ #include <Core/SecurityUpdateChecker.h>
92
95
 
93
96
  using namespace boost;
94
97
  using namespace oxt;
@@ -151,11 +154,15 @@ namespace Core {
151
154
  boost::atomic<unsigned int> shutdownCounter;
152
155
  oxt::thread *prestarterThread;
153
156
 
157
+ SecurityUpdateChecker *securityUpdateChecker;
158
+
154
159
  WorkingObjects()
155
160
  : exitEvent(__FILE__, __LINE__, "WorkingObjects: exitEvent"),
156
161
  allClientsDisconnectedEvent(__FILE__, __LINE__, "WorkingObjects: allClientsDisconnectedEvent"),
157
162
  terminationCount(0),
158
- shutdownCounter(0)
163
+ shutdownCounter(0),
164
+ prestarterThread(NULL),
165
+ securityUpdateChecker(NULL)
159
166
  {
160
167
  for (unsigned int i = 0; i < SERVER_KIT_MAX_SERVER_ENDPOINTS; i++) {
161
168
  serverFds[i] = -1;
@@ -165,6 +172,9 @@ namespace Core {
165
172
 
166
173
  ~WorkingObjects() {
167
174
  delete prestarterThread;
175
+ if (securityUpdateChecker) {
176
+ delete securityUpdateChecker;
177
+ }
168
178
 
169
179
  vector<ThreadWorkingObjects>::iterator it, end = threadWorkingObjects.end();
170
180
  for (it = threadWorkingObjects.begin(); it != end; it++) {
@@ -294,7 +304,9 @@ makeFileWorldReadableAndWritable(const string &path) {
294
304
  }
295
305
 
296
306
  #ifdef USE_SELINUX
297
- // Set next socket context to *:system_r:passenger_instance_httpd_socket_t
307
+ // Set next socket context to *:system_r:passenger_instance_httpd_socket_t.
308
+ // Note that this only sets the context of the socket file descriptor,
309
+ // not the socket file on the filesystem. This is why we need selinuxRelabelFile().
298
310
  static void
299
311
  setSelinuxSocketContext() {
300
312
  security_context_t currentCon;
@@ -332,6 +344,40 @@ makeFileWorldReadableAndWritable(const string &path) {
332
344
  resetSelinuxSocketContext() {
333
345
  setsockcreatecon(NULL);
334
346
  }
347
+
348
+ static void
349
+ selinuxRelabelFile(const string &path, const char *newLabel) {
350
+ security_context_t currentCon;
351
+ string newCon;
352
+ int e;
353
+
354
+ if (getfilecon(path.c_str(), &currentCon) == -1) {
355
+ e = errno;
356
+ P_DEBUG("Unable to obtain SELinux context for file " <<
357
+ path <<": " << strerror(e) << " (errno=" << e << ")");
358
+ return;
359
+ }
360
+
361
+ P_DEBUG("SELinux context for " << path << ": " << currentCon);
362
+
363
+ if (strstr(currentCon, ":object_r:passenger_instance_content_t:") == NULL) {
364
+ goto cleanup;
365
+ }
366
+ newCon = replaceString(currentCon,
367
+ ":object_r:passenger_instance_content_t:",
368
+ StaticString(":object_r:") + newLabel + ":");
369
+ P_DEBUG("Relabeling " << path << " to: " << newCon);
370
+
371
+ if (setfilecon(path.c_str(), (security_context_t) newCon.c_str()) == -1) {
372
+ e = errno;
373
+ P_WARN("Cannot set SELinux context for " << path <<
374
+ " to " << newCon << ": " << strerror(e) <<
375
+ " (errno=" << e << ")");
376
+ }
377
+
378
+ cleanup:
379
+ freecon(currentCon);
380
+ }
335
381
  #endif
336
382
 
337
383
  static void
@@ -352,6 +398,13 @@ startListening() {
352
398
  __FILE__, __LINE__);
353
399
  #ifdef USE_SELINUX
354
400
  resetSelinuxSocketContext();
401
+ if (i == 0 && getSocketAddressType(addresses[0]) == SAT_UNIX) {
402
+ // setSelinuxSocketContext() sets the context of the
403
+ // socket file descriptor but not the file on the filesystem.
404
+ // So we relabel the socket file here.
405
+ selinuxRelabelFile(parseUnixSocketAddress(addresses[0]),
406
+ "passenger_instance_httpd_socket_t");
407
+ }
355
408
  #endif
356
409
  P_LOG_FILE_DESCRIPTOR_PURPOSE(wo->serverFds[i],
357
410
  "Server address: " << addresses[i]);
@@ -542,6 +595,16 @@ spawningKitErrorHandler(const SpawningKit::ConfigPtr &config, SpawnException &e,
542
595
  ApplicationPool2::processAndLogNewSpawnException(e, options, config);
543
596
  }
544
597
 
598
+ static void
599
+ initializeCurl() {
600
+ TRACE_POINT();
601
+ CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Initializes underlying TLS stack
602
+ if (code != CURLE_OK) {
603
+ P_CRITICAL("Could not initialize libcurl: " << curl_easy_strerror(code));
604
+ exit(1);
605
+ }
606
+ }
607
+
545
608
  static void
546
609
  initializeNonPrivilegedWorkingObjects() {
547
610
  TRACE_POINT();
@@ -709,6 +772,28 @@ initializeNonPrivilegedWorkingObjects() {
709
772
  }
710
773
  }
711
774
 
775
+ static void
776
+ initializeSecurityUpdateChecker() {
777
+ TRACE_POINT();
778
+
779
+ VariantMap &options = *agentsOptions;
780
+ if (options.getBool("disable_security_update_check", false, false)) {
781
+ P_NOTICE("Security update check disabled.");
782
+ } else {
783
+ string proxy = options.get("security_update_check_proxy", false);
784
+
785
+ string serverIntegration = options.get("integration_mode"); // nginx / apache / standalone
786
+ string standaloneEngine = options.get("standalone_engine", false); // nginx / builtin
787
+ if (!standaloneEngine.empty()) {
788
+ serverIntegration.append(" " + standaloneEngine);
789
+ }
790
+ string serverVersion = options.get("server_version", false); // not set in case of standalone / builtin
791
+
792
+ workingObjects->securityUpdateChecker = new SecurityUpdateChecker(workingObjects->resourceLocator, proxy, serverIntegration, serverVersion);
793
+ workingObjects->securityUpdateChecker->start(24 * 60 * 60);
794
+ }
795
+ }
796
+
712
797
  static void
713
798
  prestartWebApps() {
714
799
  TRACE_POINT();
@@ -989,7 +1074,9 @@ runCore() {
989
1074
  startListening();
990
1075
  createPidFile();
991
1076
  lowerPrivilege();
1077
+ initializeCurl();
992
1078
  initializeNonPrivilegedWorkingObjects();
1079
+ initializeSecurityUpdateChecker();
993
1080
  prestartWebApps();
994
1081
 
995
1082
  UPDATE_TRACE_POINT();
@@ -1073,6 +1160,10 @@ setAgentsOptionsDefaults() {
1073
1160
  options.set("default_group",
1074
1161
  inferDefaultGroup(options.get("default_user")));
1075
1162
  }
1163
+ options.setDefault("integration_mode", "standalone");
1164
+ if (options.get("integration_mode") == "standalone" && !options.has("standalone_engine")) {
1165
+ options.set("standalone_engine", "builtin");
1166
+ }
1076
1167
  options.setDefaultStrSet("core_addresses", defaultAddress);
1077
1168
  options.setDefaultInt("socket_backlog", DEFAULT_SOCKET_BACKLOG);
1078
1169
  options.setDefaultBool("multi_app", false);
@@ -1193,6 +1284,12 @@ sanityCheckOptions() {
1193
1284
  ok = false;
1194
1285
  #endif
1195
1286
  }
1287
+ if (options.has("max_requests")) {
1288
+ if (options.getInt("max_requests", false, 0) < 0) {
1289
+ fprintf(stderr, "ERROR: the value passed to --max-requests must be at least 0.\n");
1290
+ ok = false;
1291
+ }
1292
+ }
1196
1293
  if (options.has("max_request_time")) {
1197
1294
  if (options.getInt("max_request_time", false, 0) < 1) {
1198
1295
  fprintf(stderr, "ERROR: the value passed to --max-request-time must be at least 1.\n");