passenger 5.3.1 → 5.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +19 -0
  3. data/build/cxx_tests.rb +3 -1
  4. data/build/support/cxx_dependency_map.rb +120 -27
  5. data/dev/configkit-schemas/index.json +15 -3
  6. data/src/agent/Core/AdminPanelConnector.h +5 -2
  7. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +2 -0
  8. data/src/agent/Core/Config.h +2 -1
  9. data/src/agent/Core/Controller/Config.h +6 -1
  10. data/src/agent/Core/Controller/InitRequest.cpp +6 -1
  11. data/src/agent/Core/CoreMain.cpp +26 -60
  12. data/src/agent/Core/SpawningKit/DirectSpawner.h +18 -6
  13. data/src/agent/Core/SpawningKit/ErrorRenderer.h +8 -8
  14. data/src/agent/Core/SpawningKit/Handshake/Perform.h +217 -61
  15. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +57 -8
  16. data/src/agent/Core/SpawningKit/Handshake/Session.h +34 -1
  17. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +20 -4
  18. data/src/agent/Core/SpawningKit/SmartSpawner.h +90 -27
  19. data/src/agent/ExecHelper/ExecHelperMain.cpp +3 -0
  20. data/src/agent/Shared/ApiAccountUtils.h +2 -2
  21. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +14 -4
  22. data/src/agent/Watchdog/Config.h +2 -1
  23. data/src/agent/Watchdog/WatchdogMain.cpp +38 -0
  24. data/src/apache2_module/Hooks.cpp +1 -0
  25. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1 -1
  26. data/src/cxx_supportlib/ConfigKit/README.md +1 -1
  27. data/src/cxx_supportlib/Constants.h +6 -1
  28. data/src/cxx_supportlib/FileTools/FileManip.cpp +34 -2
  29. data/src/cxx_supportlib/FileTools/FileManip.h +58 -1
  30. data/src/cxx_supportlib/FileTools/PathManip.cpp +3 -2
  31. data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +99 -0
  32. data/src/cxx_supportlib/FileTools/PathSecurityCheck.h +69 -0
  33. data/src/cxx_supportlib/Utils.cpp +37 -6
  34. data/src/cxx_supportlib/Utils.h +6 -0
  35. data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +14 -0
  36. data/src/cxx_supportlib/Utils/IOUtils.cpp +10 -18
  37. data/src/cxx_supportlib/Utils/IOUtils.h +10 -9
  38. data/src/cxx_supportlib/Utils/JsonUtils.h +12 -8
  39. data/src/cxx_supportlib/Utils/SystemMetricsCollector.h +4 -4
  40. data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
  41. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +3 -3
  42. data/src/cxx_supportlib/oxt/system_calls.cpp +25 -1
  43. data/src/cxx_supportlib/oxt/system_calls.hpp +3 -1
  44. data/src/helper-scripts/meteor-loader.rb +115 -28
  45. data/src/helper-scripts/rack-preloader.rb +1 -1
  46. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +4 -4
  47. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +4 -4
  48. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +0 -10
  49. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +0 -42
  50. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +0 -6
  51. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +0 -8
  52. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +10 -0
  53. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +22 -0
  54. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
  55. data/src/nginx_module/ngx_http_passenger_module.c +6 -5
  56. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  57. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +0 -1
  58. data/src/ruby_supportlib/phusion_passenger/common_library.rb +3 -0
  59. data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +3 -3
  60. data/src/ruby_supportlib/phusion_passenger/constants.rb +5 -0
  61. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +4 -2
  62. data/src/ruby_supportlib/phusion_passenger/platform_info.rb +3 -3
  63. data/src/ruby_supportlib/phusion_passenger/request_handler.rb +1 -1
  64. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +1 -1
  65. metadata +4 -2
@@ -40,10 +40,12 @@
40
40
 
41
41
  typedef struct {
42
42
  ngx_flag_t abort_on_startup_error;
43
+ ngx_uint_t app_file_descriptor_ulimit;
43
44
  ngx_uint_t core_file_descriptor_ulimit;
44
45
  ngx_array_t *ctl;
45
46
  ngx_flag_t disable_security_update_check;
46
47
  ngx_uint_t log_level;
48
+ ngx_uint_t max_instances_per_app;
47
49
  ngx_uint_t max_pool_size;
48
50
  ngx_uint_t pool_idle_time;
49
51
  ngx_array_t *prestart_uris;
@@ -72,6 +74,7 @@ typedef struct {
72
74
  ngx_str_t admin_panel_password_source_file;
73
75
  ngx_str_t admin_panel_url_source_file;
74
76
  ngx_str_t admin_panel_username_source_file;
77
+ ngx_str_t app_file_descriptor_ulimit_source_file;
75
78
  ngx_str_t core_file_descriptor_ulimit_source_file;
76
79
  ngx_str_t ctl_source_file;
77
80
  ngx_str_t data_buffer_dir_source_file;
@@ -83,6 +86,7 @@ typedef struct {
83
86
  ngx_str_t instance_registry_dir_source_file;
84
87
  ngx_str_t log_file_source_file;
85
88
  ngx_str_t log_level_source_file;
89
+ ngx_str_t max_instances_per_app_source_file;
86
90
  ngx_str_t max_pool_size_source_file;
87
91
  ngx_str_t pool_idle_time_source_file;
88
92
  ngx_str_t prestart_uris_source_file;
@@ -100,6 +104,7 @@ typedef struct {
100
104
  ngx_uint_t admin_panel_password_source_line;
101
105
  ngx_uint_t admin_panel_url_source_line;
102
106
  ngx_uint_t admin_panel_username_source_line;
107
+ ngx_uint_t app_file_descriptor_ulimit_source_line;
103
108
  ngx_uint_t core_file_descriptor_ulimit_source_line;
104
109
  ngx_uint_t ctl_source_line;
105
110
  ngx_uint_t data_buffer_dir_source_line;
@@ -111,6 +116,7 @@ typedef struct {
111
116
  ngx_uint_t instance_registry_dir_source_line;
112
117
  ngx_uint_t log_file_source_line;
113
118
  ngx_uint_t log_level_source_line;
119
+ ngx_uint_t max_instances_per_app_source_line;
114
120
  ngx_uint_t max_pool_size_source_line;
115
121
  ngx_uint_t pool_idle_time_source_line;
116
122
  ngx_uint_t prestart_uris_source_line;
@@ -128,6 +134,7 @@ typedef struct {
128
134
  ngx_int_t admin_panel_password_explicitly_set;
129
135
  ngx_int_t admin_panel_url_explicitly_set;
130
136
  ngx_int_t admin_panel_username_explicitly_set;
137
+ ngx_int_t app_file_descriptor_ulimit_explicitly_set;
131
138
  ngx_int_t core_file_descriptor_ulimit_explicitly_set;
132
139
  ngx_int_t ctl_explicitly_set;
133
140
  ngx_int_t data_buffer_dir_explicitly_set;
@@ -139,6 +146,7 @@ typedef struct {
139
146
  ngx_int_t instance_registry_dir_explicitly_set;
140
147
  ngx_int_t log_file_explicitly_set;
141
148
  ngx_int_t log_level_explicitly_set;
149
+ ngx_int_t max_instances_per_app_explicitly_set;
142
150
  ngx_int_t max_pool_size_explicitly_set;
143
151
  ngx_int_t pool_idle_time_explicitly_set;
144
152
  ngx_int_t prestart_uris_explicitly_set;
@@ -283,7 +283,7 @@ open_log_file_for_after_forking(AfterForkData *data, PsgJsonValue *log_target) {
283
283
  }
284
284
 
285
285
  static ngx_int_t
286
- create_file(ngx_cycle_t *cycle, const u_char *filename, const u_char *contents, size_t len) {
286
+ create_file(ngx_cycle_t *cycle, const u_char *filename, const u_char *contents, size_t len, uid_t uid, gid_t gid) {
287
287
  FILE *f;
288
288
  int ret;
289
289
  size_t total_written = 0, written;
@@ -297,6 +297,9 @@ create_file(ngx_cycle_t *cycle, const u_char *filename, const u_char *contents,
297
297
  do {
298
298
  ret = fchmod(fileno(f), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
299
299
  } while (ret == -1 && errno == EINTR);
300
+ do {
301
+ ret = fchown(fileno(f), uid, gid);
302
+ } while (ret == -1 && errno == EINTR);
300
303
  do {
301
304
  written = fwrite(contents + total_written, 1,
302
305
  len - total_written, f);
@@ -372,6 +375,7 @@ start_watchdog(ngx_cycle_t *cycle) {
372
375
  psg_json_value_set_ngx_str_ne(w_config, "default_ruby", &passenger_main_conf.default_ruby);
373
376
  psg_json_value_set_ngx_uint (w_config, "max_pool_size", autogenerated_main_conf->max_pool_size);
374
377
  psg_json_value_set_ngx_uint (w_config, "pool_idle_time", autogenerated_main_conf->pool_idle_time);
378
+ psg_json_value_set_ngx_uint (w_config, "max_instances_per_app", autogenerated_main_conf->max_instances_per_app);
375
379
  psg_json_value_set_ngx_uint (w_config, "response_buffer_high_watermark", autogenerated_main_conf->response_buffer_high_watermark);
376
380
  psg_json_value_set_ngx_uint (w_config, "stat_throttle_rate", autogenerated_main_conf->stat_throttle_rate);
377
381
  psg_json_value_set_ngx_str_ne(w_config, "admin_panel_url", &autogenerated_main_conf->admin_panel_url);
@@ -446,13 +450,10 @@ start_watchdog(ngx_cycle_t *cycle) {
446
450
  "%s/web_server_info/control_process.pid",
447
451
  psg_watchdog_launcher_get_instance_dir(psg_watchdog_launcher, NULL));
448
452
  *last = (u_char) '\0';
449
- if (create_file(cycle, filename, (const u_char *) "", 0) != NGX_OK) {
453
+ if (create_file(cycle, filename, (const u_char *) "", 0, (uid_t) core_conf->user, (gid_t) -1) != NGX_OK) {
450
454
  result = NGX_ERROR;
451
455
  goto cleanup;
452
456
  }
453
- do {
454
- ret = chown((const char *) filename, (uid_t) core_conf->user, (gid_t) -1);
455
- } while (ret == -1 && errno == EINTR);
456
457
  if (ret == -1) {
457
458
  result = NGX_ERROR;
458
459
  goto cleanup;
@@ -31,7 +31,7 @@ module PhusionPassenger
31
31
 
32
32
  PACKAGE_NAME = 'passenger'
33
33
  # Run 'rake src/cxx_supportlib/Constants.h configkit_schemas_inline_comments' after changing this number.
34
- VERSION_STRING = '5.3.1'
34
+ VERSION_STRING = '5.3.2'
35
35
 
36
36
  PREFERRED_NGINX_VERSION = '1.14.0'
37
37
  NGINX_SHA256_CHECKSUM = '5d15becbf69aba1fe33f8d416d97edd95ea8919ea9ac519eff9bafebb6022cb5'
@@ -263,7 +263,6 @@ APACHE2_CONFIGURATION_OPTIONS = [
263
263
  :context => :global,
264
264
  :min_value => 0,
265
265
  :default => 0,
266
- :header => 'PASSENGER_MAX_PROCESSES',
267
266
  :desc => 'The maximum number of simultaneously alive application instances a single application may occupy.'
268
267
  },
269
268
  {
@@ -280,6 +280,9 @@ COMMON_LIBRARY = CommonLibraryBuilder.new do
280
280
  define_component 'FileTools/FileManip.o',
281
281
  :source => 'FileTools/FileManip.cpp',
282
282
  :category => :base
283
+ define_component 'FileTools/PathSecurityCheck.o',
284
+ :source => 'FileTools/PathSecurityCheck.cpp',
285
+ :category => :base
283
286
  define_component 'ProcessManagement/Spawn.o',
284
287
  :source => 'ProcessManagement/Spawn.cpp',
285
288
  :category => :base
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Phusion Passenger - https://www.phusionpassenger.com/
4
- # Copyright (c) 2014-2017 Phusion Holding B.V.
4
+ # Copyright (c) 2014-2018 Phusion Holding B.V.
5
5
  #
6
6
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
7
7
  # trademarks of Phusion Holding B.V.
@@ -227,7 +227,7 @@ module PhusionPassenger
227
227
 
228
228
  # When creating PhusionPassenger.support_binaries_dir, preserve the
229
229
  # parent directory's UID and GID. This way, running `passenger-config compile-agent`
230
- # with sudo privileged, even though Phusion Passenger isn't installed as root,
230
+ # with sudo privilege, even though Phusion Passenger isn't installed as root,
231
231
  # won't mess up permissions.
232
232
  def mkdir_p_preserve_parent_owner(path)
233
233
  Pathname.new(path).descend do |subpath|
@@ -235,7 +235,7 @@ module PhusionPassenger
235
235
  stat = subpath.parent.stat
236
236
  Dir.mkdir(subpath.to_s)
237
237
  if Process.euid == 0
238
- File.chown(stat.uid, stat.gid, subpath.to_s)
238
+ File.lchown(stat.uid, stat.gid, subpath.to_s)
239
239
  end
240
240
  end
241
241
  end
@@ -76,6 +76,11 @@ module PhusionPassenger
76
76
  MESSAGE_SERVER_MAX_USERNAME_SIZE = 100
77
77
  MESSAGE_SERVER_MAX_PASSWORD_SIZE = 100
78
78
  POOL_HELPER_THREAD_STACK_SIZE = 1024 * 256
79
+ SPAWNINGKIT_MAX_SUBPROCESS_ERROR_MESSAGE_SIZE = 1024 * 128
80
+ SPAWNINGKIT_MAX_SUBPROCESS_ENVDUMP_SIZE = 1024 * 128
81
+ SPAWNINGKIT_MAX_PROPERTIES_JSON_SIZE = 1024 * 32
82
+ SPAWNINGKIT_MAX_ERROR_CATEGORY_SIZE = 32
83
+ SPAWNINGKIT_MAX_JOURNEY_STEP_FILE_SIZE = 32
79
84
  # Small mbuf sizes avoid memory overhead (up to 1 blocksize per request), but
80
85
  # also introduce context switching and smaller transfer writes. The size is picked
81
86
  # to balance this out.
@@ -292,15 +292,17 @@ NGINX_CONFIGURATION_OPTIONS = [
292
292
  :name => 'passenger_app_file_descriptor_ulimit',
293
293
  :scope => :global,
294
294
  :type => :uinteger,
295
- :dynamic_default => 'passenger_core_file_descriptor_ulimit'
295
+ :dynamic_default => 'passenger_core_file_descriptor_ulimit',
296
+ :struct => 'NGX_HTTP_MAIN_CONF_OFFSET'
296
297
  },
297
298
  {
298
299
  :name => 'passenger_max_instances_per_app',
299
300
  :scope => :global,
300
301
  :context => [:main],
301
302
  :type => :uinteger,
303
+ :header => nil,
302
304
  :default => 0,
303
- :header => 'PASSENGER_MAX_PROCESSES'
305
+ :struct => 'NGX_HTTP_MAIN_CONF_OFFSET'
304
306
  },
305
307
  {
306
308
  :name => 'passenger_admin_panel_url',
@@ -1,6 +1,6 @@
1
1
  # encoding: binary
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010-2017 Phusion Holding B.V.
3
+ # Copyright (c) 2010-2018 Phusion Holding B.V.
4
4
  #
5
5
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  # trademarks of Phusion Holding B.V.
@@ -260,9 +260,9 @@ module PhusionPassenger
260
260
  filename = "#{dir}/#{basename}"
261
261
  begin
262
262
  File.open(filename, 'w') do |f|
263
+ f.chmod(0700)
263
264
  f.puts("#!/bin/sh")
264
265
  end
265
- File.chmod(0700, filename)
266
266
  if system(filename)
267
267
  return dir
268
268
  else
@@ -283,9 +283,9 @@ module PhusionPassenger
283
283
  filename = "#{dir}/#{basename}"
284
284
  begin
285
285
  File.open(filename, 'w') do |f|
286
+ f.chmod(0700, filename)
286
287
  f.puts("#!/bin/sh")
287
288
  end
288
- File.chmod(0700, filename)
289
289
  if system(filename)
290
290
  return dir
291
291
  else
@@ -1,6 +1,6 @@
1
1
  # encoding: binary
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010-2017 Phusion Holding B.V.
3
+ # Copyright (c) 2010-2018 Phusion Holding B.V.
4
4
  #
5
5
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  # trademarks of Phusion Holding B.V.
@@ -648,8 +648,8 @@ private
648
648
  def run_command_while_capturing_output(command)
649
649
  # Create tempfile for storing the command's output.
650
650
  tempfile = Tempfile.new('daemon-output')
651
+ tempfile.chmod(0666)
651
652
  tempfile_path = tempfile.path
652
- File.chmod(0666, tempfile_path)
653
653
  tempfile.close
654
654
 
655
655
  if self.class.fork_supported? || self.class.spawn_supported?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -450,6 +450,8 @@ files:
450
450
  - src/cxx_supportlib/FileTools/PathManip.h
451
451
  - src/cxx_supportlib/FileTools/PathManipCBindings.cpp
452
452
  - src/cxx_supportlib/FileTools/PathManipCBindings.h
453
+ - src/cxx_supportlib/FileTools/PathSecurityCheck.cpp
454
+ - src/cxx_supportlib/FileTools/PathSecurityCheck.h
453
455
  - src/cxx_supportlib/Hooks.h
454
456
  - src/cxx_supportlib/InstanceDirectory.h
455
457
  - src/cxx_supportlib/Integrations/LibevJsonUtils.h