passenger 5.3.4 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +69 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +2 -1
- data/Rakefile +0 -5
- data/build/agent.rb +6 -3
- data/build/cxx_tests.rb +28 -19
- data/build/integration_tests.rb +6 -2
- data/build/misc.rb +2 -1
- data/build/packaging.rb +2 -0
- data/build/support/cplusplus.rb +2 -2
- data/build/support/cxx_dependency_map.rb +2651 -2189
- data/dev/colorize-logs +272 -0
- data/dev/show-latest-crashlog-dir +27 -0
- data/resources/templates/standalone/http.erb +2 -0
- data/resources/templates/standalone/server.erb +1 -0
- data/src/agent/AgentMain.cpp +4 -0
- data/src/agent/Core/AdminPanelConnector.h +6 -6
- data/src/agent/Core/ApiServer.h +4 -4
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +2 -2
- data/src/agent/Core/ApplicationPool/Context.h +5 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +13 -20
- data/src/agent/Core/ApplicationPool/Group.h +4 -2
- data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -5
- data/src/agent/Core/ApplicationPool/Options.h +42 -38
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Pool.h +4 -4
- data/src/agent/Core/ApplicationPool/Process.h +13 -15
- data/src/agent/Core/ApplicationPool/Socket.h +5 -5
- data/src/agent/Core/ApplicationPool/TestSession.h +3 -3
- data/src/agent/Core/Config.h +50 -10
- data/src/agent/Core/ConfigChange.cpp +13 -1
- data/src/agent/Core/Controller/Config.h +41 -17
- data/src/agent/Core/Controller/ForwardResponse.cpp +4 -0
- data/src/agent/Core/Controller/InitRequest.cpp +14 -8
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +5 -0
- data/src/agent/Core/Controller/SendRequest.cpp +9 -9
- data/src/agent/Core/Controller/TurboCaching.h +2 -2
- data/src/agent/Core/Controller.h +7 -5
- data/src/agent/Core/CoreMain.cpp +204 -60
- data/src/agent/Core/OptionParser.h +20 -3
- data/src/agent/Core/ResponseCache.h +3 -3
- data/src/agent/Core/SecurityUpdateChecker.h +4 -2
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config.h +3 -2
- data/src/agent/Core/SpawningKit/Context.h +8 -2
- data/src/agent/Core/SpawningKit/DirectSpawner.h +4 -4
- data/src/agent/Core/SpawningKit/DummySpawner.h +3 -3
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +21 -14
- data/src/agent/Core/SpawningKit/Factory.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +14 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +3 -3
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +4 -5
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +34 -17
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result.h +20 -8
- data/src/agent/Core/SpawningKit/SmartSpawner.h +7 -7
- data/src/agent/Core/SpawningKit/Spawner.h +25 -8
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +17 -7
- data/src/agent/Core/TelemetryCollector.h +681 -0
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +198 -0
- data/src/agent/README.md +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +1 -1
- data/src/agent/Shared/ApiServerUtils.h +3 -3
- data/src/agent/Shared/ApplicationPoolApiKey.h +2 -2
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +324 -98
- data/src/agent/Shared/Fundamentals/AbortHandler.h +31 -4
- data/src/agent/Shared/Fundamentals/Initialization.cpp +4 -5
- data/src/agent/Shared/Fundamentals/Initialization.h +9 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +4 -3
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +3 -3
- data/src/agent/Watchdog/ApiServer.h +3 -3
- data/src/agent/Watchdog/Config.h +24 -5
- data/src/agent/Watchdog/CoreWatcher.cpp +2 -2
- data/src/agent/Watchdog/WatchdogMain.cpp +97 -28
- data/src/apache2_module/Config.cpp +14 -14
- data/src/apache2_module/Config.h +8 -16
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +510 -481
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +39 -17
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +69 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +31 -1
- data/src/apache2_module/ConfigGeneral/Common.h +45 -0
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +17 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +16 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +19 -5
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +26 -9
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +19 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +10 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +14 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +11 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +36 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +34 -1
- data/src/apache2_module/DirectoryMapper.h +36 -37
- data/src/apache2_module/Hooks.cpp +27 -8
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +48 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +36 -1
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.cpp +2 -2
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.h +4 -4
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +148 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +147 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +75 -0
- data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +92 -131
- data/src/cxx_supportlib/ConfigKit/README.md +90 -2
- data/src/cxx_supportlib/ConfigKit/Schema.h +60 -15
- data/src/cxx_supportlib/ConfigKit/Store.h +129 -5
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/{Utils → DataStructures}/HashMap.h +4 -4
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +5 -5
- data/src/cxx_supportlib/DataStructures/LString.h +3 -3
- data/src/cxx_supportlib/{Utils → DataStructures}/StringMap.h +36 -36
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +2 -2
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/Hooks.h +2 -2
- data/src/cxx_supportlib/{Utils → IOTools}/BufferedIO.h +5 -5
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.cpp +4 -3
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → IOTools}/MessageIO.h +7 -7
- data/src/cxx_supportlib/{MessageReadersWriters.h → IOTools/MessageSerialization.h} +5 -5
- data/src/cxx_supportlib/InstanceDirectory.h +4 -4
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → JsonTools}/JsonUtils.h +5 -5
- data/src/cxx_supportlib/LoggingKit/Context.h +2 -2
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +3 -3
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +2 -2
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +19 -12
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
- data/src/cxx_supportlib/ProcessManagement/Utils.h +10 -0
- data/src/cxx_supportlib/RandomGenerator.h +2 -2
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/{Crypto.cpp → SecurityKit/Crypto.cpp} +4 -4
- data/src/cxx_supportlib/{Crypto.h → SecurityKit/Crypto.h} +4 -4
- data/src/cxx_supportlib/{Utils → SecurityKit}/MemZeroGuard.h +0 -0
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +2 -2
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/Context.h +2 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +3 -3
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +2 -2
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -10
- data/src/cxx_supportlib/ServerKit/Server.h +3 -4
- data/src/cxx_supportlib/{Utils → StrIntTools}/DateParsing.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.cpp +3 -3
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.h +0 -0
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtilsNoStrictAliasing.cpp +12 -12
- data/src/cxx_supportlib/{Utils → StrIntTools}/StringScanning.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/Template.h +30 -5
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +88 -0
- data/src/cxx_supportlib/{Utils → SystemTools}/ProcessMetricsCollector.h +15 -12
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemMetricsCollector.h +3 -3
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.h +0 -0
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +3 -3
- data/src/cxx_supportlib/Utils/Curl.h +2 -2
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +2 -2
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +2 -2
- data/src/cxx_supportlib/Utils/Timer.h +2 -2
- data/src/cxx_supportlib/Utils/VariantMap.h +3 -3
- data/src/cxx_supportlib/Utils.cpp +2 -2
- data/src/cxx_supportlib/WatchdogLauncher.h +3 -3
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
- data/src/cxx_supportlib/{Utils/MemoryBarrier.h → WrapperRegistry/CBindings.h} +30 -27
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
- data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
- data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +3 -0
- data/src/helper-scripts/download_binaries/extconf.rb +6 -2
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +32 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +12 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +36 -0
- data/src/nginx_module/Configuration.c +23 -3
- data/src/nginx_module/ContentHandler.c +331 -32
- data/src/nginx_module/ContentHandler.h +8 -3
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +10 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +27 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +7 -0
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
- data/src/nginx_module/config +2 -1
- data/src/nginx_module/ngx_http_passenger_module.c +9 -3
- data/src/nginx_module/ngx_http_passenger_module.h +10 -3
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +19 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +19 -16
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +29 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +20 -19
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +22 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +33 -13
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +22 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -1
- data/src/ruby_supportlib/phusion_passenger.rb +7 -5
- data/src/schema_printer/SchemaPrinterMain.cpp +2 -0
- metadata +40 -89
- data/.editorconfig +0 -134
- data/CODE_OF_CONDUCT.md +0 -52
- data/dev/boost-patches/0001-Patch-boost-thread-so-that-oxt-thread-can-use-it.patch +0 -48
- data/dev/boost-patches/0002-Make-boost-thread_interrupted-derive-from-oxt-tracab.patch +0 -33
- data/dev/boost-patches/0003-Disable-a-Clang-pragma-to-prevent-warnings-on-OS-X.patch +0 -25
- data/dev/ci/README.md +0 -134
- data/dev/ci/lib/functions.sh +0 -129
- data/dev/ci/lib/set-container-envvars.sh +0 -53
- data/dev/ci/lib/setup-container.sh +0 -46
- data/dev/ci/run-tests-natively +0 -24
- data/dev/ci/run-tests-with-docker +0 -42
- data/dev/ci/scripts/debug-console-wrapper.sh +0 -29
- data/dev/ci/scripts/docker-entrypoint-stage2.sh +0 -17
- data/dev/ci/scripts/docker-entrypoint.sh +0 -17
- data/dev/ci/scripts/inituidgid +0 -17
- data/dev/ci/scripts/run-tests-natively-stage2.sh +0 -17
- data/dev/ci/scripts/setup-host-natively.sh +0 -11
- data/dev/ci/setup-host +0 -56
- data/dev/ci/tests/apache2/run +0 -6
- data/dev/ci/tests/apache2/setup +0 -4
- data/dev/ci/tests/binaries/Jenkinsfile +0 -105
- data/dev/ci/tests/binaries/build-linux +0 -38
- data/dev/ci/tests/binaries/build-macos +0 -40
- data/dev/ci/tests/binaries/prepare-macos +0 -38
- data/dev/ci/tests/binaries/test-linux +0 -45
- data/dev/ci/tests/binaries/test-macos +0 -38
- data/dev/ci/tests/cxx/run +0 -9
- data/dev/ci/tests/cxx/setup +0 -4
- data/dev/ci/tests/debian/Jenkinsfile +0 -89
- data/dev/ci/tests/debian/run +0 -60
- data/dev/ci/tests/nginx/run +0 -5
- data/dev/ci/tests/nginx/setup +0 -4
- data/dev/ci/tests/nginx-dynamic/run +0 -20
- data/dev/ci/tests/nginx-dynamic/setup +0 -4
- data/dev/ci/tests/nodejs/run +0 -4
- data/dev/ci/tests/nodejs/setup +0 -4
- data/dev/ci/tests/rpm/Jenkinsfile +0 -68
- data/dev/ci/tests/rpm/run +0 -63
- data/dev/ci/tests/ruby/run +0 -4
- data/dev/ci/tests/ruby/setup +0 -4
- data/dev/ci/tests/source-packaging/run +0 -4
- data/dev/ci/tests/source-packaging/setup +0 -4
- data/dev/ci/tests/standalone/run +0 -4
- data/dev/ci/tests/standalone/setup +0 -4
- data/dev/configkit-schemas/index.json +0 -1748
- data/dev/configkit-schemas/update_schema_inline_comments.rb +0 -118
- data/dev/rack.test/config.ru +0 -5
- data/dev/rack.test/public/asset.txt +0 -1
- data/dev/vagrant/apache_default_site.conf +0 -35
- data/dev/vagrant/apache_passenger.conf +0 -5
- data/dev/vagrant/apache_passenger.load +0 -1
- data/dev/vagrant/apache_ports.conf +0 -24
- data/dev/vagrant/apache_rack_test.conf +0 -9
- data/dev/vagrant/bashrc +0 -23
- data/dev/vagrant/nginx.conf +0 -39
- data/dev/vagrant/nginx_rakefile +0 -33
- data/dev/vagrant/nginx_start +0 -32
- data/dev/vagrant/provision.sh +0 -117
- data/dev/vagrant/sudoers.conf +0 -5
- data/resources/templates/error_renderer/.editorconfig +0 -19
- data/src/cxx_supportlib/AppTypes.cpp +0 -109
- data/src/cxx_supportlib/vendor-modified/SmallVector.h +0 -653
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2014-
|
3
|
+
* Copyright (c) 2014-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.
|
@@ -33,7 +33,7 @@
|
|
33
33
|
|
34
34
|
#include <FileDescriptor.h>
|
35
35
|
#include <Exceptions.h>
|
36
|
-
#include <
|
36
|
+
#include <SystemTools/SystemTime.h>
|
37
37
|
#include <ConfigKit/ConfigKit.h>
|
38
38
|
#include <Core/SpawningKit/Context.h>
|
39
39
|
#include <Core/SpawningKit/Config.h>
|
@@ -113,6 +113,19 @@ public:
|
|
113
113
|
}
|
114
114
|
};
|
115
115
|
|
116
|
+
enum Type {
|
117
|
+
UNKNOWN,
|
118
|
+
GENERIC,
|
119
|
+
KURIA,
|
120
|
+
AUTO_SUPPORTED,
|
121
|
+
/**
|
122
|
+
* Indicates that this Process does not refer to a real OS
|
123
|
+
* process. The sockets in the socket list are fake and need not be deleted.
|
124
|
+
* Set to true by DummySpawner, used during unit tests.
|
125
|
+
*/
|
126
|
+
DUMMY
|
127
|
+
};
|
128
|
+
|
116
129
|
private:
|
117
130
|
void validate_autoGeneratedCode(vector<StaticString> &internalFieldErrors,
|
118
131
|
vector<StaticString> &appSuppliedFieldErrors) const;
|
@@ -127,13 +140,9 @@ public:
|
|
127
140
|
pid_t pid;
|
128
141
|
|
129
142
|
/**
|
130
|
-
* If true, then indicates that this Process does not refer to a real OS
|
131
|
-
* process. The sockets in the socket list are fake and need not be deleted.
|
132
|
-
* Set to true by DummySpawner, used during unit tests.
|
133
|
-
*
|
134
143
|
* @hinted_parseable
|
135
144
|
*/
|
136
|
-
|
145
|
+
Type type;
|
137
146
|
|
138
147
|
/**
|
139
148
|
* @hinted_parseable
|
@@ -188,7 +197,7 @@ public:
|
|
188
197
|
|
189
198
|
Result()
|
190
199
|
: pid(-1),
|
191
|
-
|
200
|
+
type(UNKNOWN),
|
192
201
|
spawnStartTime(0),
|
193
202
|
spawnEndTime(0),
|
194
203
|
spawnStartTimeMonotonic(0),
|
@@ -207,6 +216,9 @@ public:
|
|
207
216
|
{
|
208
217
|
validate_autoGeneratedCode(internalFieldErrors, appSuppliedFieldErrors);
|
209
218
|
|
219
|
+
if (type == UNKNOWN) {
|
220
|
+
internalFieldErrors.push_back(P_STATIC_STRING("type may not be unknown"));
|
221
|
+
}
|
210
222
|
if (sockets.empty()) {
|
211
223
|
appSuppliedFieldErrors.push_back(P_STATIC_STRING("sockets are not supplied"));
|
212
224
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
3
|
+
* Copyright (c) 2011-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.
|
@@ -50,12 +50,12 @@
|
|
50
50
|
#include <Exceptions.h>
|
51
51
|
#include <DataStructures/StringKeyTable.h>
|
52
52
|
#include <ProcessManagement/Utils.h>
|
53
|
+
#include <SystemTools/ProcessMetricsCollector.h>
|
54
|
+
#include <SystemTools/SystemTime.h>
|
53
55
|
#include <FileTools/FileManip.h>
|
54
|
-
#include <
|
55
|
-
#include <
|
56
|
-
#include <Utils/JsonUtils.h>
|
56
|
+
#include <IOTools/BufferedIO.h>
|
57
|
+
#include <JsonTools/JsonUtils.h>
|
57
58
|
#include <Utils/ScopeGuard.h>
|
58
|
-
#include <Utils/ProcessMetricsCollector.h>
|
59
59
|
#include <Utils/AsyncSignalSafeUtils.h>
|
60
60
|
#include <LveLoggingDecorator.h>
|
61
61
|
#include <Core/SpawningKit/Spawner.h>
|
@@ -374,14 +374,14 @@ private:
|
|
374
374
|
dup2(stdinCopy, 0);
|
375
375
|
dup2(stdoutAndErrCopy, 1);
|
376
376
|
dup2(stdoutAndErrCopy, 2);
|
377
|
-
closeAllFileDescriptors(2
|
377
|
+
closeAllFileDescriptors(2);
|
378
378
|
|
379
379
|
execlp(agentFilename.c_str(),
|
380
380
|
agentFilename.c_str(),
|
381
381
|
"spawn-env-setupper",
|
382
382
|
session.workDir->getPath().c_str(),
|
383
383
|
"--before",
|
384
|
-
|
384
|
+
(char *) 0);
|
385
385
|
|
386
386
|
char *pos = buf;
|
387
387
|
e = errno;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
3
|
+
* Copyright (c) 2011-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.
|
@@ -31,8 +31,9 @@
|
|
31
31
|
|
32
32
|
#include <modp_b64.h>
|
33
33
|
|
34
|
+
#include <AppLocalConfigFileUtils.h>
|
34
35
|
#include <LoggingKit/Logging.h>
|
35
|
-
#include <
|
36
|
+
#include <SystemTools/SystemTime.h>
|
36
37
|
#include <Core/SpawningKit/Context.h>
|
37
38
|
#include <Core/SpawningKit/Result.h>
|
38
39
|
#include <Core/SpawningKit/UserSwitchingRules.h>
|
@@ -79,7 +80,7 @@ protected:
|
|
79
80
|
void setConfigFromAppPoolOptions(Config *config, Json::Value &extraArgs,
|
80
81
|
const AppPoolOptions &options)
|
81
82
|
{
|
82
|
-
|
83
|
+
TRACE_POINT();
|
83
84
|
string envvarsData;
|
84
85
|
try {
|
85
86
|
envvarsData = modp::b64_decode(options.environmentVariables.data(),
|
@@ -90,16 +91,31 @@ protected:
|
|
90
91
|
envvarsData.clear();
|
91
92
|
}
|
92
93
|
|
94
|
+
AppLocalConfig appLocalConfig = parseAppLocalConfigFile(options.appRoot);
|
95
|
+
string startCommand;
|
96
|
+
|
97
|
+
if (appLocalConfig.appSupportsKuriaProtocol) {
|
98
|
+
config->genericApp = false;
|
99
|
+
config->startsUsingWrapper = false;
|
100
|
+
config->startCommand = options.appStartCommand;
|
101
|
+
} else if (options.appType.empty()) {
|
102
|
+
config->genericApp = true;
|
103
|
+
config->startCommand = options.appStartCommand;
|
104
|
+
} else {
|
105
|
+
startCommand = options.getStartCommand(*context->resourceLocator,
|
106
|
+
*context->wrapperRegistry);
|
107
|
+
config->genericApp = false;
|
108
|
+
config->startsUsingWrapper = true;
|
109
|
+
config->startCommand = startCommand;
|
110
|
+
}
|
111
|
+
|
93
112
|
config->appGroupName = options.getAppGroupName();
|
94
113
|
config->appRoot = options.appRoot;
|
95
114
|
config->logLevel = options.logLevel;
|
96
|
-
config->genericApp = false;
|
97
|
-
config->startsUsingWrapper = true;
|
98
115
|
config->wrapperSuppliedByThirdParty = false;
|
99
116
|
config->findFreePort = false;
|
100
117
|
config->loadShellEnvvars = options.loadShellEnvvars;
|
101
|
-
config->
|
102
|
-
config->startupFile = options.getStartupFile();
|
118
|
+
config->startupFile = options.getStartupFile(*context->wrapperRegistry);
|
103
119
|
config->appType = options.appType;
|
104
120
|
config->appEnv = options.environment;
|
105
121
|
config->baseURI = options.baseURI;
|
@@ -112,7 +128,8 @@ protected:
|
|
112
128
|
config->fileDescriptorUlimit = options.fileDescriptorUlimit;
|
113
129
|
config->startTimeoutMsec = options.startTimeout;
|
114
130
|
|
115
|
-
UserSwitchingInfo info = prepareUserSwitching(options
|
131
|
+
UserSwitchingInfo info = prepareUserSwitching(options,
|
132
|
+
*context->wrapperRegistry);
|
116
133
|
config->user = info.username;
|
117
134
|
config->group = info.groupname;
|
118
135
|
|
@@ -35,6 +35,7 @@
|
|
35
35
|
#include <boost/shared_array.hpp>
|
36
36
|
#include <oxt/backtrace.hpp>
|
37
37
|
#include <oxt/system_calls.hpp>
|
38
|
+
#include <WrapperRegistry/Registry.h>
|
38
39
|
#include <Exceptions.h>
|
39
40
|
#include <Utils.h>
|
40
41
|
#include <Core/SpawningKit/Context.h>
|
@@ -61,7 +62,9 @@ struct UserSwitchingInfo {
|
|
61
62
|
};
|
62
63
|
|
63
64
|
inline UserSwitchingInfo
|
64
|
-
prepareUserSwitching(const AppPoolOptions &options
|
65
|
+
prepareUserSwitching(const AppPoolOptions &options,
|
66
|
+
const WrapperRegistry::Registry &wrapperRegistry)
|
67
|
+
{
|
65
68
|
TRACE_POINT();
|
66
69
|
UserSwitchingInfo info;
|
67
70
|
|
@@ -95,8 +98,8 @@ prepareUserSwitching(const AppPoolOptions &options) {
|
|
95
98
|
|
96
99
|
UPDATE_TRACE_POINT();
|
97
100
|
string defaultGroup;
|
98
|
-
|
99
|
-
|
101
|
+
// This is the file that determines what user we lower privilege to.
|
102
|
+
string referenceFile;
|
100
103
|
struct passwd &pwd = info.lveUserPwd;
|
101
104
|
boost::shared_array<char> &pwdBuf = info.lveUserPwdStrBuf;
|
102
105
|
struct passwd *userInfo;
|
@@ -106,6 +109,13 @@ prepareUserSwitching(const AppPoolOptions &options) {
|
|
106
109
|
boost::shared_array<char> grpBuf;
|
107
110
|
int ret;
|
108
111
|
|
112
|
+
if (options.appType.empty()) {
|
113
|
+
referenceFile = absolutizePath(options.appRoot);
|
114
|
+
} else {
|
115
|
+
referenceFile = absolutizePath(options.getStartupFile(wrapperRegistry),
|
116
|
+
absolutizePath(options.appRoot));
|
117
|
+
}
|
118
|
+
|
109
119
|
// _SC_GETPW_R_SIZE_MAX/_SC_GETGR_R_SIZE_MAX are not maximums:
|
110
120
|
// http://tomlee.co/2012/10/problems-with-large-linux-unix-groups-and-getgrgid_r-getgrnam_r/
|
111
121
|
pwdBufSize = std::max<long>(1024 * 128, sysconf(_SC_GETPW_R_SIZE_MAX));
|
@@ -155,9 +165,9 @@ prepareUserSwitching(const AppPoolOptions &options) {
|
|
155
165
|
}
|
156
166
|
} else {
|
157
167
|
struct stat buf;
|
158
|
-
if (syscalls::lstat(
|
168
|
+
if (syscalls::lstat(referenceFile.c_str(), &buf) == -1) {
|
159
169
|
int e = errno;
|
160
|
-
throw SystemException("Cannot lstat(\"" +
|
170
|
+
throw SystemException("Cannot lstat(\"" + referenceFile +
|
161
171
|
"\")", e);
|
162
172
|
}
|
163
173
|
ret = getpwuid_r(buf.st_uid, &pwd, pwdBuf.get(),
|
@@ -184,10 +194,10 @@ prepareUserSwitching(const AppPoolOptions &options) {
|
|
184
194
|
if (options.group == "!STARTUP_FILE!") {
|
185
195
|
struct stat buf;
|
186
196
|
|
187
|
-
if (syscalls::lstat(
|
197
|
+
if (syscalls::lstat(referenceFile.c_str(), &buf) == -1) {
|
188
198
|
int e = errno;
|
189
199
|
throw SystemException("Cannot lstat(\"" +
|
190
|
-
|
200
|
+
referenceFile + "\")", e);
|
191
201
|
}
|
192
202
|
|
193
203
|
ret = getgrgid_r(buf.st_gid, &grp, grpBuf.get(), grpBufSize,
|