passenger 6.1.7 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +29 -2
- data/CONTRIBUTING.md +3 -3
- data/README.md +1 -1
- data/build/cxx_tests.rb +3 -0
- data/build/support/cxx_dependency_map.rb +1486 -665
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +2 -0
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +2 -0
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +2 -0
- data/dev/index_cxx_dependencies.rb +1 -1
- data/dev/runner +2 -0
- data/doc/DeveloperQuickstart.md +1 -1
- data/src/README.md +1 -1
- data/src/agent/Core/Config.h +1 -1
- data/src/agent/Core/Controller/Config.h +1 -1
- data/src/agent/Shared/ApiServerUtils.h +14 -9
- data/src/agent/Watchdog/{AgentWatcher.cpp → AgentWatcher.h} +28 -1
- data/src/agent/Watchdog/ApiServer.h +28 -5
- data/src/agent/Watchdog/Config.h +1 -1
- data/src/agent/Watchdog/{CoreWatcher.cpp → CoreWatcher.h} +18 -1
- data/src/agent/Watchdog/{InstanceDirToucher.cpp → InstanceDirToucher.h} +20 -1
- data/src/agent/Watchdog/WatchdogMain.cpp +11 -77
- data/src/agent/Watchdog/WorkingObjects.h +108 -0
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/IOTools/IOUtils.cpp +2 -17
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +3 -0
- data/src/cxx_supportlib/ServerKit/Server.h +4 -21
- data/src/cxx_supportlib/Utils/Socket.cpp +67 -0
- data/src/cxx_supportlib/Utils/Socket.h +35 -0
- data/src/helper-scripts/meteor-loader.rb +3 -0
- data/src/helper-scripts/rack-loader.rb +3 -0
- data/src/helper-scripts/rack-preloader.rb +3 -0
- data/src/nginx_module/ContentHandler.c +13 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/admin_tools.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +3 -0
- data/src/ruby_supportlib/phusion_passenger/config/about_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/build_native_support_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/compile_agent_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/detach_process_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/main.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/system_metrics_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/constants.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +3 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/curl.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/pcre.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/zlib.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/rack/out_of_band_gc.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +12 -0
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/control_utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/main.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/ansi_colors.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/utils/download.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/utils/file_system_watcher.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/json.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/utils/lock.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/native_support_utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/tee_input.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/terminal_choice_menu.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/tmpio.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/utils.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +4 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger.rb +7 -5
- metadata +9 -6
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
require 'strscan'
|
|
26
26
|
|
|
27
27
|
module CxxHintedParser
|
|
28
|
+
|
|
28
29
|
class Parser
|
|
29
30
|
STRUCT_BEGIN_HINT = /- ?begin hinted parseable (struct|class) ?-/
|
|
30
31
|
STRUCT_END_HINT = /- ?end hinted parseable (struct|class) ?-/
|
|
@@ -236,4 +237,5 @@ module CxxHintedParser
|
|
|
236
237
|
@errors << Error.new(line, column, message)
|
|
237
238
|
end
|
|
238
239
|
end
|
|
240
|
+
|
|
239
241
|
end
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
require File.expand_path(File.dirname(__FILE__) + '/initializer_builder')
|
|
26
26
|
|
|
27
27
|
module CxxCodeBuilder
|
|
28
|
+
|
|
28
29
|
# Builds C/C++ code. Use it as follows:
|
|
29
30
|
#
|
|
30
31
|
# 1. Create a CxxCodeBuilder::Builder object.
|
|
@@ -627,4 +628,5 @@ module CxxCodeBuilder
|
|
|
627
628
|
str
|
|
628
629
|
end
|
|
629
630
|
end
|
|
631
|
+
|
|
630
632
|
end
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
# THE SOFTWARE.
|
|
24
24
|
|
|
25
25
|
module CxxCodeBuilder
|
|
26
|
+
|
|
26
27
|
# Builds array and struct initialization code.
|
|
27
28
|
class InitializerBuilder
|
|
28
29
|
def initialize(builder, start_character, end_character)
|
|
@@ -163,4 +164,5 @@ module CxxCodeBuilder
|
|
|
163
164
|
@builder.add_code_without_newline(@end_character)
|
|
164
165
|
end
|
|
165
166
|
end
|
|
167
|
+
|
|
166
168
|
end
|
|
@@ -221,6 +221,6 @@ def generate_full_map(basic_map)
|
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
result = generate_full_map(generate_basic_map)
|
|
224
|
-
puts "# Autogenerated by dev/index_cxx_dependencies.rb"
|
|
224
|
+
puts "# Autogenerated by dev/index_cxx_dependencies.rb (update with `rake dependency_map`)"
|
|
225
225
|
puts "CXX_DEPENDENCY_MAP ="
|
|
226
226
|
PP.pp(result, STDOUT, 1)
|
data/dev/runner
CHANGED
data/doc/DeveloperQuickstart.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Phusion Passenger Developer QuickStart
|
|
2
2
|
|
|
3
|
-
<a href="https://
|
|
3
|
+
<a href="https://youtu.be/CSpk9mfKdbc"><img src="http://blog.phusion.nl/wp-content/uploads/2014/06/passenger_developer_quickstart.png"></a>
|
|
4
4
|
|
|
5
5
|
_Watch the Developer QuickStart screencast_
|
|
6
6
|
|
data/src/README.md
CHANGED
|
@@ -4,4 +4,4 @@ If you aren't familiar with the Passenger codebase then we encourage you to read
|
|
|
4
4
|
|
|
5
5
|
* [Contributors Guide](https://github.com/phusion/passenger/blob/master/CONTRIBUTING.md)
|
|
6
6
|
* [Design & Architecture](https://www.phusionpassenger.com/documentation/Design%20and%20Architecture.html)
|
|
7
|
-
* [Code walkthrough](
|
|
7
|
+
* [Code walkthrough](https://youtu.be/exugD98pqQc)
|
data/src/agent/Core/Config.h
CHANGED
|
@@ -149,7 +149,7 @@ using namespace std;
|
|
|
149
149
|
* security_update_checker_interval unsigned integer - default(86400)
|
|
150
150
|
* security_update_checker_proxy_url string - -
|
|
151
151
|
* security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
|
|
152
|
-
* server_software string - default("Phusion_Passenger/6.
|
|
152
|
+
* server_software string - default("Phusion_Passenger/6.2.0")
|
|
153
153
|
* show_version_in_header boolean - default(true)
|
|
154
154
|
* single_app_mode_app_root string - default,read_only
|
|
155
155
|
* single_app_mode_app_start_command string - read_only
|
|
@@ -118,7 +118,7 @@ parseControllerBenchmarkMode(const StaticString &mode) {
|
|
|
118
118
|
* old_routing boolean - default(false),read_only
|
|
119
119
|
* request_freelist_limit unsigned integer - default(1024)
|
|
120
120
|
* response_buffer_high_watermark unsigned integer - default(134217728)
|
|
121
|
-
* server_software string - default("Phusion_Passenger/6.
|
|
121
|
+
* server_software string - default("Phusion_Passenger/6.2.0")
|
|
122
122
|
* show_version_in_header boolean - default(true)
|
|
123
123
|
* start_reading_after_accept boolean - default(true)
|
|
124
124
|
* stat_throttle_rate unsigned integer - default(10)
|
|
@@ -167,14 +167,17 @@ authorize(ApiServer *server, Client *client, Request *req) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
if (server->getApiAccountDatabase().empty()) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
/*
|
|
171
|
+
* Deliberately DEBUG, not WARN or INFO. This branch is evaluated on every
|
|
172
|
+
* request before authentication, and the API socket is world-writable, so
|
|
173
|
+
* anything emitted at the default log level lets any local client flood a
|
|
174
|
+
* root-owned log file. The condition is a persistent configuration state
|
|
175
|
+
* rather than a per-request event, so it belongs in a one-time startup
|
|
176
|
+
* diagnostic, not here.
|
|
177
|
+
*/
|
|
178
|
+
SKC_DEBUG_FROM_STATIC(server, client,
|
|
179
|
+
"API account database is empty; refusing unauthenticated access");
|
|
180
|
+
} else if (parseBasicAuthHeader(req, username, password)) {
|
|
178
181
|
SKC_DEBUG_FROM_STATIC(server, client,
|
|
179
182
|
"HTTP basic authentication supplied: " << username);
|
|
180
183
|
if (username == "api") {
|
|
@@ -189,7 +192,9 @@ authorize(ApiServer *server, Client *client, Request *req) {
|
|
|
189
192
|
} else {
|
|
190
193
|
const typename ApiServer::ApiAccount *account =
|
|
191
194
|
server->getApiAccountDatabase().lookup(username);
|
|
192
|
-
if (account != NULL &&
|
|
195
|
+
if (account != NULL && !account->password.empty()
|
|
196
|
+
&& constantTimeCompare(password, account->password))
|
|
197
|
+
{
|
|
193
198
|
SKC_INFO_FROM_STATIC(server, client,
|
|
194
199
|
"Authenticated with administrator account: " << username);
|
|
195
200
|
auth.apiKey = ApplicationPool2::ApiKey::makeSuper();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2026 Asynchronous B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Asynchronous B.V.
|
|
@@ -23,6 +23,27 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
24
|
* THE SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
+
#ifndef _PASSENGER_WATCHDOG_AGENT_WATCHER_H_
|
|
27
|
+
#define _PASSENGER_WATCHDOG_AGENT_WATCHER_H_
|
|
28
|
+
|
|
29
|
+
#include <boost/enable_shared_from_this.hpp>
|
|
30
|
+
#include <oxt/thread.hpp>
|
|
31
|
+
#include <oxt/system_calls.hpp>
|
|
32
|
+
#include <string>
|
|
33
|
+
|
|
34
|
+
#include <LoggingKit/Logging.h>
|
|
35
|
+
#include <FileDescriptor.h>
|
|
36
|
+
#include <ProcessManagement/Utils.h>
|
|
37
|
+
#include <Utils.h>
|
|
38
|
+
#include <Utils/Timer.h>
|
|
39
|
+
|
|
40
|
+
#include <Watchdog/WorkingObjects.h>
|
|
41
|
+
|
|
42
|
+
namespace Passenger {
|
|
43
|
+
namespace Watchdog {
|
|
44
|
+
|
|
45
|
+
using namespace oxt;
|
|
46
|
+
|
|
26
47
|
|
|
27
48
|
/**
|
|
28
49
|
* Abstract base class for watching agent processes.
|
|
@@ -535,3 +556,9 @@ public:
|
|
|
535
556
|
};
|
|
536
557
|
|
|
537
558
|
typedef boost::shared_ptr<AgentWatcher> AgentWatcherPtr;
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
} // namespace Watchdog
|
|
562
|
+
} // namespace Passenger
|
|
563
|
+
|
|
564
|
+
#endif /* _PASSENGER_WATCHDOG_AGENT_WATCHER_H_ */
|
|
@@ -92,6 +92,29 @@ public:
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Builds the config that WatchdogMain.cpp passes to the ApiServer constructor.
|
|
97
|
+
*
|
|
98
|
+
* Must assign `authorizations` to the OUTER key "watchdog_api_server_authorizations",
|
|
99
|
+
* not to the inner "authorizations" key. `watchdogConfig.inspectEffectiveValues()`
|
|
100
|
+
* already contains "watchdog_api_server_authorizations", defaulting to an empty
|
|
101
|
+
* array, and the ApiServer schema translator maps that outer name onto the inner
|
|
102
|
+
* "authorizations". Assigning the inner name here leaves both keys present in the
|
|
103
|
+
* same document; ConfigKit's translator assigns while iterating, jsoncpp iterates
|
|
104
|
+
* keys in sorted order, so the outer key gets applied last and silently overwrites
|
|
105
|
+
* these entries with the empty default, always emptying the API account database.
|
|
106
|
+
*/
|
|
107
|
+
inline Json::Value
|
|
108
|
+
buildConfig(const ConfigKit::Store &watchdogConfig, const Json::Value &authorizations,
|
|
109
|
+
const StaticString &fdPassingPassword)
|
|
110
|
+
{
|
|
111
|
+
Json::Value config = watchdogConfig.inspectEffectiveValues();
|
|
112
|
+
config["fd_passing_password"] = fdPassingPassword.toString();
|
|
113
|
+
config.removeMember("watchdog_api_server_authorizations"); // Replace with scoped auth
|
|
114
|
+
config["authorizations"] = authorizations;
|
|
115
|
+
return config;
|
|
116
|
+
}
|
|
117
|
+
|
|
95
118
|
struct ConfigChangeRequest {
|
|
96
119
|
ServerKit::HttpServerConfigChangeRequest forParent;
|
|
97
120
|
boost::scoped_ptr<ApiAccountUtils::ApiAccountDatabase> apiAccountDatabase;
|
|
@@ -160,12 +183,12 @@ private:
|
|
|
160
183
|
if (req->method == HTTP_GET) {
|
|
161
184
|
if (!authorizeStateInspectionOperation(this, client, req)) {
|
|
162
185
|
apiServerRespondWith401(this, client, req);
|
|
186
|
+
} else {
|
|
187
|
+
HeaderTable headers;
|
|
188
|
+
Json::Value doc = LoggingKit::context->getConfig().inspect();
|
|
189
|
+
headers.insert(req->pool, "Content-Type", "application/json");
|
|
190
|
+
writeSimpleResponse(client, 200, &headers, doc.toStyledString());
|
|
163
191
|
}
|
|
164
|
-
|
|
165
|
-
HeaderTable headers;
|
|
166
|
-
Json::Value doc = LoggingKit::context->getConfig().inspect();
|
|
167
|
-
headers.insert(req->pool, "Content-Type", "application/json");
|
|
168
|
-
writeSimpleResponse(client, 200, &headers, doc.toStyledString());
|
|
169
192
|
if (!req->ended()) {
|
|
170
193
|
endRequest(&client, &req);
|
|
171
194
|
}
|
data/src/agent/Watchdog/Config.h
CHANGED
|
@@ -139,7 +139,7 @@ using namespace std;
|
|
|
139
139
|
* security_update_checker_interval unsigned integer - default(86400)
|
|
140
140
|
* security_update_checker_proxy_url string - -
|
|
141
141
|
* security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
|
|
142
|
-
* server_software string - default("Phusion_Passenger/6.
|
|
142
|
+
* server_software string - default("Phusion_Passenger/6.2.0")
|
|
143
143
|
* setsid boolean - default(false)
|
|
144
144
|
* show_version_in_header boolean - default(true)
|
|
145
145
|
* single_app_mode_app_root string - default,read_only
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2026 Asynchronous B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Asynchronous B.V.
|
|
@@ -23,9 +23,19 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
24
|
* THE SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
+
#ifndef _PASSENGER_WATCHDOG_CORE_WATCHER_H_
|
|
27
|
+
#define _PASSENGER_WATCHDOG_CORE_WATCHER_H_
|
|
26
28
|
|
|
29
|
+
#include <Shared/Fundamentals/Initialization.h>
|
|
27
30
|
#include <Shared/Fundamentals/Utils.h>
|
|
28
31
|
#include <IOTools/MessageIO.h>
|
|
32
|
+
#include <Watchdog/AgentWatcher.h>
|
|
33
|
+
|
|
34
|
+
namespace Passenger {
|
|
35
|
+
namespace Watchdog {
|
|
36
|
+
|
|
37
|
+
using namespace Passenger::Agent::Fundamentals;
|
|
38
|
+
|
|
29
39
|
|
|
30
40
|
class CoreWatcher: public AgentWatcher {
|
|
31
41
|
protected:
|
|
@@ -93,3 +103,10 @@ public:
|
|
|
93
103
|
report["core_password"] = watchdogConfig->get("controller_secure_headers_password").asString();
|
|
94
104
|
}
|
|
95
105
|
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
} // namespace Watchdog
|
|
109
|
+
} // namespace Passenger
|
|
110
|
+
|
|
111
|
+
#endif /* _PASSENGER_WATCHDOG_CORE_WATCHER_H_ */
|
|
112
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2026 Asynchronous B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Asynchronous B.V.
|
|
@@ -23,11 +23,24 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
24
|
* THE SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
+
#ifndef _PASSENGER_WATCHDOG_INSTANCE_DIR_TOUCHER_H_
|
|
27
|
+
#define _PASSENGER_WATCHDOG_INSTANCE_DIR_TOUCHER_H_
|
|
26
28
|
|
|
27
29
|
#include <boost/bind/bind.hpp>
|
|
30
|
+
#include <oxt/thread.hpp>
|
|
31
|
+
|
|
28
32
|
#include <Shared/Fundamentals/Utils.h>
|
|
29
33
|
#include <Utils/AsyncSignalSafeUtils.h>
|
|
30
34
|
|
|
35
|
+
#include <Watchdog/WorkingObjects.h>
|
|
36
|
+
|
|
37
|
+
namespace Passenger {
|
|
38
|
+
namespace Watchdog {
|
|
39
|
+
|
|
40
|
+
using namespace oxt;
|
|
41
|
+
using namespace Passenger::Agent::Fundamentals;
|
|
42
|
+
|
|
43
|
+
|
|
31
44
|
/**
|
|
32
45
|
* Touch all files in the server instance dir every 6 hours in order to prevent /tmp
|
|
33
46
|
* cleaners from weaking havoc:
|
|
@@ -153,3 +166,9 @@ public:
|
|
|
153
166
|
};
|
|
154
167
|
|
|
155
168
|
typedef boost::shared_ptr<InstanceDirToucher> InstanceDirToucherPtr;
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
} // namespace Watchdog
|
|
172
|
+
} // namespace Passenger
|
|
173
|
+
|
|
174
|
+
#endif /* _PASSENGER_WATCHDOG_INSTANCE_DIR_TOUCHER_H_ */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2026 Asynchronous B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Asynchronous B.V.
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
#include <Core/OptionParser.h>
|
|
67
67
|
#include <Watchdog/Config.h>
|
|
68
68
|
#include <Watchdog/ApiServer.h>
|
|
69
|
+
#include <Watchdog/WorkingObjects.h>
|
|
69
70
|
#include <JsonTools/Autocast.h>
|
|
70
71
|
#include <Constants.h>
|
|
71
72
|
#include <InstanceDirectory.h>
|
|
@@ -93,6 +94,7 @@ using namespace std;
|
|
|
93
94
|
using namespace boost;
|
|
94
95
|
using namespace oxt;
|
|
95
96
|
using namespace Passenger;
|
|
97
|
+
using namespace Passenger::Watchdog;
|
|
96
98
|
using namespace Passenger::Agent::Fundamentals;
|
|
97
99
|
|
|
98
100
|
|
|
@@ -101,83 +103,16 @@ enum OomFileType {
|
|
|
101
103
|
OOM_SCORE_ADJ
|
|
102
104
|
};
|
|
103
105
|
|
|
104
|
-
class InstanceDirToucher;
|
|
105
|
-
class AgentWatcher;
|
|
106
|
-
|
|
107
|
-
/***** Working objects *****/
|
|
108
|
-
|
|
109
|
-
namespace Passenger {
|
|
110
|
-
namespace Watchdog {
|
|
111
|
-
struct WorkingObjects {
|
|
112
|
-
RandomGenerator randomGenerator;
|
|
113
|
-
EventFd errorEvent;
|
|
114
|
-
EventFd exitEvent;
|
|
115
|
-
uid_t defaultUid;
|
|
116
|
-
gid_t defaultGid;
|
|
117
|
-
InstanceDirectoryPtr instanceDir;
|
|
118
|
-
int startupReportFile;
|
|
119
|
-
int lockFile;
|
|
120
|
-
vector<string> cleanupPidfiles;
|
|
121
|
-
bool pidsCleanedUp;
|
|
122
|
-
bool pidFileCleanedUp;
|
|
123
|
-
string corePidFile;
|
|
124
|
-
string fdPassingPassword;
|
|
125
|
-
Json::Value extraConfigToPassToSubAgents;
|
|
126
|
-
Json::Value controllerAddresses;
|
|
127
|
-
Json::Value coreApiServerAddresses;
|
|
128
|
-
Json::Value coreApiServerAuthorizations;
|
|
129
|
-
Json::Value watchdogApiServerAddresses;
|
|
130
|
-
Json::Value watchdogApiServerAuthorizations;
|
|
131
|
-
|
|
132
|
-
int apiServerFds[SERVER_KIT_MAX_SERVER_ENDPOINTS];
|
|
133
|
-
BackgroundEventLoop *bgloop;
|
|
134
|
-
ServerKit::Context *serverKitContext;
|
|
135
|
-
ServerKit::Schema serverKitSchema;
|
|
136
|
-
ApiServer::ApiServer *apiServer;
|
|
137
|
-
|
|
138
|
-
WorkingObjects()
|
|
139
|
-
: errorEvent(__FILE__, __LINE__, "WorkingObjects: errorEvent"),
|
|
140
|
-
exitEvent(__FILE__, __LINE__, "WorkingObjects: exitEvent"),
|
|
141
|
-
startupReportFile(-1),
|
|
142
|
-
pidsCleanedUp(false),
|
|
143
|
-
pidFileCleanedUp(false),
|
|
144
|
-
extraConfigToPassToSubAgents(Json::objectValue),
|
|
145
|
-
controllerAddresses(Json::arrayValue),
|
|
146
|
-
coreApiServerAddresses(Json::arrayValue),
|
|
147
|
-
coreApiServerAuthorizations(Json::arrayValue),
|
|
148
|
-
watchdogApiServerAddresses(Json::arrayValue),
|
|
149
|
-
watchdogApiServerAuthorizations(Json::arrayValue),
|
|
150
|
-
bgloop(NULL),
|
|
151
|
-
serverKitContext(NULL),
|
|
152
|
-
apiServer(NULL)
|
|
153
|
-
{
|
|
154
|
-
for (unsigned int i = 0; i < SERVER_KIT_MAX_SERVER_ENDPOINTS; i++) {
|
|
155
|
-
apiServerFds[i] = -1;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
typedef boost::shared_ptr<WorkingObjects> WorkingObjectsPtr;
|
|
161
|
-
} // namespace Watchdog
|
|
162
|
-
} // namespace Passenger
|
|
163
|
-
|
|
164
|
-
using namespace Passenger::Watchdog;
|
|
165
|
-
|
|
166
|
-
static WrapperRegistry::Registry *watchdogWrapperRegistry;
|
|
167
|
-
static Schema *watchdogSchema;
|
|
168
|
-
static ConfigKit::Store *watchdogConfig;
|
|
169
|
-
static WorkingObjects *workingObjects;
|
|
170
|
-
|
|
171
106
|
static void cleanup(const WorkingObjectsPtr &wo);
|
|
172
107
|
|
|
173
|
-
#include
|
|
174
|
-
#include
|
|
175
|
-
#include
|
|
108
|
+
#include <Watchdog/AgentWatcher.h>
|
|
109
|
+
#include <Watchdog/InstanceDirToucher.h>
|
|
110
|
+
#include <Watchdog/CoreWatcher.h>
|
|
176
111
|
|
|
177
112
|
|
|
178
113
|
/***** Functions *****/
|
|
179
114
|
|
|
180
|
-
#if
|
|
115
|
+
#if BOOST_OS_LINUX
|
|
181
116
|
|
|
182
117
|
struct WatchdogOomAdjustResult {
|
|
183
118
|
struct Message {
|
|
@@ -860,7 +795,7 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
|
|
|
860
795
|
* for this watchdog. Note that the OOM score is inherited by child processes
|
|
861
796
|
* so we need to restore it after each fork().
|
|
862
797
|
*/
|
|
863
|
-
#if
|
|
798
|
+
#if BOOST_OS_LINUX
|
|
864
799
|
WatchdogOomAdjustResult oomAdjustResult = setOomScoreNeverKill();
|
|
865
800
|
#endif
|
|
866
801
|
|
|
@@ -877,7 +812,7 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
|
|
|
877
812
|
|
|
878
813
|
wo = boost::make_shared<WorkingObjects>();
|
|
879
814
|
workingObjects = wo.get();
|
|
880
|
-
#if
|
|
815
|
+
#if BOOST_OS_LINUX
|
|
881
816
|
printOomAdjustResultMessages(oomAdjustResult);
|
|
882
817
|
wo->extraConfigToPassToSubAgents["oom_score"] = oomAdjustResult.oldScore;
|
|
883
818
|
#endif
|
|
@@ -1242,9 +1177,8 @@ initializeApiServer(const WorkingObjectsPtr &wo) {
|
|
|
1242
1177
|
wo->serverKitContext->initialize();
|
|
1243
1178
|
|
|
1244
1179
|
UPDATE_TRACE_POINT();
|
|
1245
|
-
Json::Value apiServerConfig = watchdogConfig
|
|
1246
|
-
|
|
1247
|
-
apiServerConfig["authorizations"] = wo->watchdogApiServerAuthorizations;
|
|
1180
|
+
Json::Value apiServerConfig = ApiServer::buildConfig(*watchdogConfig,
|
|
1181
|
+
wo->watchdogApiServerAuthorizations, wo->fdPassingPassword);
|
|
1248
1182
|
wo->apiServer = new ApiServer::ApiServer(
|
|
1249
1183
|
wo->serverKitContext,
|
|
1250
1184
|
watchdogSchema->apiServer.schema,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
+
* Copyright (c) 2010-2026 Asynchronous B.V.
|
|
4
|
+
*
|
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
|
+
* trademarks of Asynchronous B.V.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
|
16
|
+
* all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
* THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
#ifndef _PASSENGER_WATCHDOG_WORKING_OBJECTS_H_
|
|
27
|
+
#define _PASSENGER_WATCHDOG_WORKING_OBJECTS_H_
|
|
28
|
+
|
|
29
|
+
#include <vector>
|
|
30
|
+
#include <string>
|
|
31
|
+
#include <jsoncpp/json.h>
|
|
32
|
+
|
|
33
|
+
#include <RandomGenerator.h>
|
|
34
|
+
#include <InstanceDirectory.h>
|
|
35
|
+
#include <BackgroundEventLoop.h>
|
|
36
|
+
#include <WrapperRegistry/Registry.h>
|
|
37
|
+
#include <ServerKit/Context.h>
|
|
38
|
+
|
|
39
|
+
#include <Watchdog/Config.h>
|
|
40
|
+
#include <Watchdog/ApiServer.h>
|
|
41
|
+
|
|
42
|
+
namespace Passenger {
|
|
43
|
+
namespace Watchdog {
|
|
44
|
+
|
|
45
|
+
using namespace std;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
struct WorkingObjects {
|
|
49
|
+
RandomGenerator randomGenerator;
|
|
50
|
+
EventFd errorEvent;
|
|
51
|
+
EventFd exitEvent;
|
|
52
|
+
uid_t defaultUid;
|
|
53
|
+
gid_t defaultGid;
|
|
54
|
+
InstanceDirectoryPtr instanceDir;
|
|
55
|
+
int startupReportFile;
|
|
56
|
+
int lockFile;
|
|
57
|
+
vector<string> cleanupPidfiles;
|
|
58
|
+
bool pidsCleanedUp;
|
|
59
|
+
bool pidFileCleanedUp;
|
|
60
|
+
string corePidFile;
|
|
61
|
+
string fdPassingPassword;
|
|
62
|
+
Json::Value extraConfigToPassToSubAgents;
|
|
63
|
+
Json::Value controllerAddresses;
|
|
64
|
+
Json::Value coreApiServerAddresses;
|
|
65
|
+
Json::Value coreApiServerAuthorizations;
|
|
66
|
+
Json::Value watchdogApiServerAddresses;
|
|
67
|
+
Json::Value watchdogApiServerAuthorizations;
|
|
68
|
+
|
|
69
|
+
int apiServerFds[SERVER_KIT_MAX_SERVER_ENDPOINTS];
|
|
70
|
+
BackgroundEventLoop *bgloop;
|
|
71
|
+
ServerKit::Context *serverKitContext;
|
|
72
|
+
ServerKit::Schema serverKitSchema;
|
|
73
|
+
ApiServer::ApiServer *apiServer;
|
|
74
|
+
|
|
75
|
+
WorkingObjects()
|
|
76
|
+
: errorEvent(__FILE__, __LINE__, "WorkingObjects: errorEvent"),
|
|
77
|
+
exitEvent(__FILE__, __LINE__, "WorkingObjects: exitEvent"),
|
|
78
|
+
startupReportFile(-1),
|
|
79
|
+
pidsCleanedUp(false),
|
|
80
|
+
pidFileCleanedUp(false),
|
|
81
|
+
extraConfigToPassToSubAgents(Json::objectValue),
|
|
82
|
+
controllerAddresses(Json::arrayValue),
|
|
83
|
+
coreApiServerAddresses(Json::arrayValue),
|
|
84
|
+
coreApiServerAuthorizations(Json::arrayValue),
|
|
85
|
+
watchdogApiServerAddresses(Json::arrayValue),
|
|
86
|
+
watchdogApiServerAuthorizations(Json::arrayValue),
|
|
87
|
+
bgloop(NULL),
|
|
88
|
+
serverKitContext(NULL),
|
|
89
|
+
apiServer(NULL)
|
|
90
|
+
{
|
|
91
|
+
for (unsigned int i = 0; i < SERVER_KIT_MAX_SERVER_ENDPOINTS; i++) {
|
|
92
|
+
apiServerFds[i] = -1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
typedef boost::shared_ptr<WorkingObjects> WorkingObjectsPtr;
|
|
98
|
+
|
|
99
|
+
static WrapperRegistry::Registry *watchdogWrapperRegistry;
|
|
100
|
+
static Schema *watchdogSchema;
|
|
101
|
+
static ConfigKit::Store *watchdogConfig;
|
|
102
|
+
static WorkingObjects *workingObjects;
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
} // namespace Watchdog
|
|
106
|
+
} // namespace Passenger
|
|
107
|
+
|
|
108
|
+
#endif /* _PASSENGER_WATCHDOG_WORKING_OBJECTS_H_ */
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
#define PASSENGER_API_VERSION_MAJOR 0
|
|
85
85
|
#define PASSENGER_API_VERSION_MINOR 3
|
|
86
86
|
#define PASSENGER_DEFAULT_USER "nobody"
|
|
87
|
-
#define PASSENGER_VERSION "6.
|
|
87
|
+
#define PASSENGER_VERSION "6.2.0"
|
|
88
88
|
#define POOL_HELPER_THREAD_STACK_SIZE 262144
|
|
89
89
|
#define PROCESS_SHUTDOWN_TIMEOUT 60
|
|
90
90
|
#define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
#include <Exceptions.h>
|
|
68
68
|
#include <Constants.h>
|
|
69
|
+
#include <Utils/Socket.h>
|
|
69
70
|
#include <Utils/Timer.h>
|
|
70
71
|
#include <IOTools/IOUtils.h>
|
|
71
72
|
#include <StrIntTools/StrIntUtils.h>
|
|
@@ -1301,29 +1302,13 @@ writeFileDescriptor(int fd, int fdToSend, unsigned long long *timeout) {
|
|
|
1301
1302
|
|
|
1302
1303
|
void
|
|
1303
1304
|
readPeerCredentials(int sock, uid_t *uid, gid_t *gid) {
|
|
1304
|
-
union {
|
|
1305
|
-
struct sockaddr genericAddress;
|
|
1306
|
-
struct sockaddr_un unixAddress;
|
|
1307
|
-
struct sockaddr_in inetAddress;
|
|
1308
|
-
struct sockaddr_in6 inetAddress6;
|
|
1309
|
-
} addr;
|
|
1310
|
-
socklen_t len = sizeof(addr);
|
|
1311
|
-
int ret;
|
|
1312
|
-
|
|
1313
1305
|
/*
|
|
1314
1306
|
* The functions for receiving the peer credentials are not guaranteed to
|
|
1315
1307
|
* fail if the socket is not a Unix domain socket. For example, OS X getpeereid()
|
|
1316
1308
|
* just returns garbage when invoked on a TCP socket. So we check here
|
|
1317
1309
|
* whether 'sock' is a Unix domain socket.
|
|
1318
1310
|
*/
|
|
1319
|
-
|
|
1320
|
-
ret = getsockname(sock, &addr.genericAddress, &len);
|
|
1321
|
-
} while (ret == -1 && errno == EINTR);
|
|
1322
|
-
if (ret == -1) {
|
|
1323
|
-
int e = errno;
|
|
1324
|
-
throw SystemException("Unable to autodetect socket type (getsockname() failed)", e);
|
|
1325
|
-
}
|
|
1326
|
-
if (addr.genericAddress.sa_family != AF_LOCAL) {
|
|
1311
|
+
if (!fdIsUnixDomainSocket(sock)) {
|
|
1327
1312
|
throw SystemException("Cannot receive process credentials: the connection is not a Unix domain socket",
|
|
1328
1313
|
EPROTONOSUPPORT);
|
|
1329
1314
|
}
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
#include <ServerKit/Context.h>
|
|
47
47
|
#include <ServerKit/Errors.h>
|
|
48
48
|
#include <Utils.h>
|
|
49
|
+
#include <Utils/Socket.h>
|
|
49
50
|
#include <IOTools/IOUtils.h>
|
|
50
51
|
|
|
51
52
|
namespace Passenger {
|
|
@@ -287,6 +288,7 @@ public:
|
|
|
287
288
|
assert(nEndpoints < SERVER_KIT_MAX_SERVER_ENDPOINTS);
|
|
288
289
|
setNonBlocking(fd);
|
|
289
290
|
int flag = 1;
|
|
291
|
+
if (!fdIsUnixDomainSocket(fd)) {
|
|
290
292
|
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) == -1
|
|
291
293
|
&& errno != ENOPROTOOPT
|
|
292
294
|
&& errno != ENOTSUP
|
|
@@ -296,6 +298,7 @@ public:
|
|
|
296
298
|
P_WARN("Cannot disable Nagle's algorithm on a TCP socket: " <<
|
|
297
299
|
strerror(e) << " (errno=" << e << ")");
|
|
298
300
|
}
|
|
301
|
+
}
|
|
299
302
|
endpoints[nEndpoints] = fd;
|
|
300
303
|
nEndpoints++;
|
|
301
304
|
|