passenger 5.1.1 → 5.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/CONTRIBUTING.md +4 -8
- data/CONTRIBUTORS +1 -0
- data/INSTALL.md +1 -1
- data/README.md +2 -2
- data/build/misc.rb +1 -0
- data/build/packaging.rb +3 -3
- data/dev/ci/run_travis.sh +81 -20
- data/src/agent/Core/CoreMain.cpp +1 -1
- data/src/agent/Core/SecurityUpdateChecker.h +120 -3
- data/src/cxx_supportlib/Constants.h +2 -2
- data/src/cxx_supportlib/Crypto.cpp +14 -22
- data/src/cxx_supportlib/Crypto.h +1 -1
- data/src/cxx_supportlib/Utils/DateParsing.h +1 -1
- data/src/helper-scripts/node-loader.js +60 -59
- data/src/nodejs_supportlib/phusion_passenger/line_reader.js +9 -9
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +3 -3
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +8 -9
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +10 -10
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +20 -18
- data/src/ruby_supportlib/phusion_passenger.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +27 -7
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +15 -3
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/libs.rb +4 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +16 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d85fbc3f95f6d5fa631a5a5a2a0750087bda1f9
|
4
|
+
data.tar.gz: f257bced65450de07314089bb532424d29b29bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e52abbcbbd0d9412d11e75f683173169b991a8215106a8ec9f4802d807029dd9bebe8894587f855204fb57f8cb46ff25bcd8319443b93f1b4f6b80a3ad567491
|
7
|
+
data.tar.gz: 75a975eac87498c43ebfa2e57a22f3374386d74a20a5ab956b3d94a3da528f079bb3ed02abd6019b4b001f46cb2641416cb729d43b3c782391deba7a0fcaddb0
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
Release 5.1.2
|
2
|
+
-------------
|
3
|
+
|
4
|
+
* Improve curl check for passenger-install- scripts to catch (very old) curl versions that won't compile against 5.1+.
|
5
|
+
* Fixes remaining false positives (logging) from the new Meteor cluster warning system. Closes GH-1905.
|
6
|
+
* Create a private keychain on macOS when the system keychain is defaulted to, this avoids a permissions issue with the system keychain when performing the Security Update Check. This is necessary because the system keychain is the default keychain of daemon users and root on macOS.
|
7
|
+
* Improve `passenger-memory-stats` to include JRuby processes that fail to rename as expected. Closes GH-1878.
|
8
|
+
* [Standalone] Don't download or compile Nginx when using the builtin engine. Closes GH-1910.
|
9
|
+
* [Standalone] Fixes `--nginx-tarball` option of `passenger start` and `passenger-config install-standalone-runtime` (wasn't working). Also verifies that `--nginx-version` is explicitly specified as it should be.
|
10
|
+
|
11
|
+
|
1
12
|
Release 5.1.1
|
2
13
|
-------------
|
3
14
|
|
@@ -39,6 +50,7 @@ Release 5.1.0
|
|
39
50
|
* [Nginx] The preferred Nginx version is now 1.10.2 (previously 1.10.1).
|
40
51
|
* RPM pkg builder fix for breaking SELinux change in RHEL 7.3.
|
41
52
|
* RPM pkg builder fix for RHEL6/CentOS6 incompatibility and replacement in Passenger.
|
53
|
+
* Adds Ubuntu 16.10 "Yakkety" packages.
|
42
54
|
|
43
55
|
|
44
56
|
Release 5.0.30
|
@@ -61,6 +73,7 @@ Release 5.0.29
|
|
61
73
|
* [Nginx] The preferred Nginx version is now 1.10.1 (previously 1.10.0).
|
62
74
|
* [Nginx] The preferred PCRE version is now 8.39 (previously 8.34).
|
63
75
|
* [Standalone] Passenger Standalone now supports /dev/stdout and /dev/stderr as log file path (via `--log-file` or Passengerfile.json). This is especially useful in Docker containers. In previous versions logging to those paths did not work, resulting in nothing getting logged at all.
|
76
|
+
* Adds Ubuntu 16.04 "Xenial" packages, deprecates Ubuntu 15.10 “Wily” packages (in accordance with LTS support policy).
|
64
77
|
|
65
78
|
|
66
79
|
Release 5.0.28
|
data/CONTRIBUTING.md
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
* [Ruby coding style](#ruby_coding_style)
|
18
18
|
* [Systems programming fundamentals](#systems_programming_fundamentals)
|
19
19
|
* [Further reading](#further_reading)
|
20
|
-
* [
|
20
|
+
* [Pull requests](#pull_requests)
|
21
21
|
|
22
22
|
Thank you for your interest in Phusion Passenger. Phusion Passenger is open source so your contributions are very welcome. Although we also provide a [commercial version](https://www.phusionpassenger.com/enterprise) and [commercial support](https://www.phusionpassenger.com/commercial_support), the core remains open source and we remain committed to keep it that way. This guide gives you an overview of the ways with which you can contribute, as well as contribution guidelines.
|
23
23
|
|
@@ -350,11 +350,7 @@ A good and comprehensive, but rather large source for learning POSIX is the [POS
|
|
350
350
|
|
351
351
|
* [Coding Tips and Pitfalls](https://github.com/phusion/passenger/blob/master/doc/CodingTipsAndPitfalls.md)
|
352
352
|
|
353
|
-
<a name="
|
354
|
-
###
|
353
|
+
<a name="pull_requests"></a>
|
354
|
+
### Pull requests
|
355
355
|
|
356
|
-
|
357
|
-
|
358
|
-
Branches like **stable-4.0**, **stable-5.0** are production quality branches (split off from master) for major versions. Each production branch has tags for minor versions, whereby **tag x.0.1** represents the first production-ready version on a branch (there may be some release candidates before that). For example: branch stable-5.0, tagged 5.0.1 is the first release of the 5.0 line that is ready for production.
|
359
|
-
|
360
|
-
In general we apply fixes to the respective stable branch and merge these into the master, so it is easiest if you submit pull requests to the stable branches (unless of course you are working with the unstable master). Conversely, new features always go to the master and are then cherrypicked from one or more branches.
|
356
|
+
Pull requests should normally be submitted against the latest **stable** branch (e.g. **stable-5.1**), because once tested & accepted, we want users to benefit from the work as soon as possible. The stable branch is constantly tested, contains both bugfix and feature commits, and we periodically tag it to produce a new release.
|
data/CONTRIBUTORS
CHANGED
data/INSTALL.md
CHANGED
@@ -4,4 +4,4 @@ Please read README.md for installation instructions.
|
|
4
4
|
|
5
5
|
If you're having trouble installing Phusion Passenger, please refer to [the documentation](https://www.phusionpassenger.com/).
|
6
6
|
|
7
|
-
Documentation and support resources are also available on [the website](https://www.phusionpassenger.com/
|
7
|
+
Documentation and support resources are also available on [the website](https://www.phusionpassenger.com/support).
|
data/README.md
CHANGED
@@ -6,13 +6,13 @@ What makes it so fast and reliable is its **C++** core, its **zero-copy** archit
|
|
6
6
|
|
7
7
|
<a href="http://vimeo.com/phusionnl/review/80475623/c16e940d1f"><img src="http://blog.phusion.nl/wp-content/uploads/2014/01/gameofthrones.jpg" height="300"></a><br><em>Phusion Passenger used in Game of Thrones Ascent</em>
|
8
8
|
|
9
|
-
**Learn more:** [Website](https://www.phusionpassenger.com/) | [Documentation
|
9
|
+
**Learn more:** [Website](https://www.phusionpassenger.com/) | [Documentation & Support](https://www.phusionpassenger.com/support) | [Github](https://github.com/phusion/passenger) | [Twitter](https://twitter.com/phusion_nl) | [Blog](http://blog.phusion.nl/)
|
10
10
|
|
11
11
|
<a href="https://www.phusionpassenger.com"><center><img src="http://blog.phusion.nl/wp-content/uploads/2012/07/Passenger_chair_256x256.jpg" width="160" height="160" alt="Phusion Passenger"></center></a>
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
Please follow [the installation instructions on the website](https://www.phusionpassenger.com/
|
15
|
+
Please follow [the installation instructions on the website](https://www.phusionpassenger.com/get_it_now).
|
16
16
|
|
17
17
|
### Installing the source directly from git
|
18
18
|
|
data/build/misc.rb
CHANGED
@@ -137,6 +137,7 @@ task :contributors do
|
|
137
137
|
entries.push "Sean Wilkinson"
|
138
138
|
entries.push "Yichun Zhang"
|
139
139
|
entries.delete "OnixGH"
|
140
|
+
entries.delete "onix"
|
140
141
|
entries.push "Ruslan Ermilov (NGINX Inc)"
|
141
142
|
File.open("CONTRIBUTORS", "w") do |f|
|
142
143
|
f.puts(entries.sort{ |a, b| a.downcase <=> b.downcase }.join("\n"))
|
data/build/packaging.rb
CHANGED
@@ -404,7 +404,7 @@ task 'package:initiate_binaries_building' do
|
|
404
404
|
request = Net::HTTP::Post.new(uri.request_uri)
|
405
405
|
request.set_form_data("token" => jenkins_token)
|
406
406
|
response = http.request(request)
|
407
|
-
if response.code != 201
|
407
|
+
if response.code != '201'
|
408
408
|
abort "*** ERROR: Cannot initiate building of binaries:\n" +
|
409
409
|
"Status: #{response.code}\n\n" +
|
410
410
|
response.body
|
@@ -451,7 +451,7 @@ task 'package:initiate_debian_building' do
|
|
451
451
|
request = Net::HTTP::Post.new(uri.request_uri)
|
452
452
|
request.set_form_data("token" => jenkins_token)
|
453
453
|
response = http.request(request)
|
454
|
-
if response.code != 201
|
454
|
+
if response.code != '201'
|
455
455
|
abort "*** ERROR: Cannot initiate building of Debian packages:\n" +
|
456
456
|
"Status: #{response.code}\n\n" +
|
457
457
|
response.body
|
@@ -498,7 +498,7 @@ task 'package:initiate_rpm_building' do
|
|
498
498
|
request = Net::HTTP::Post.new(uri.request_uri)
|
499
499
|
request.set_form_data("token" => jenkins_token)
|
500
500
|
response = http.request(request)
|
501
|
-
if response.code != 201
|
501
|
+
if response.code != '201'
|
502
502
|
abort "*** ERROR: Cannot initiate building of RPM packages:\n" +
|
503
503
|
"Status: #{response.code}\n\n" +
|
504
504
|
response.body
|
data/dev/ci/run_travis.sh
CHANGED
@@ -89,6 +89,13 @@ function apt_get_update() {
|
|
89
89
|
fi
|
90
90
|
}
|
91
91
|
|
92
|
+
function brew_update() {
|
93
|
+
if [[ "$brew_updated" = "" ]]; then
|
94
|
+
brew_updated=1
|
95
|
+
run brew update
|
96
|
+
fi
|
97
|
+
}
|
98
|
+
|
92
99
|
function rake_test_install_deps()
|
93
100
|
{
|
94
101
|
# We do not use Bundler here because the goal might be to
|
@@ -108,6 +115,9 @@ function rake_test_install_deps()
|
|
108
115
|
bundle_path=`dirname "$bundle_path"`
|
109
116
|
echo "Adding bundle path $bundle_path to GEM_PATH"
|
110
117
|
export GEM_PATH="$bundle_path:$GEM_PATH"
|
118
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
119
|
+
run brew install ccache
|
120
|
+
fi
|
111
121
|
}
|
112
122
|
|
113
123
|
function install_test_deps_with_doctools()
|
@@ -122,6 +132,9 @@ function install_base_test_deps()
|
|
122
132
|
{
|
123
133
|
if [[ "$install_base_test_deps" = "" ]]; then
|
124
134
|
install_base_test_deps=1
|
135
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
136
|
+
run brew install ccache
|
137
|
+
fi
|
125
138
|
retry_run 3 rake_test_install_deps BASE_DEPS=yes
|
126
139
|
fi
|
127
140
|
}
|
@@ -131,24 +144,47 @@ function install_node_and_modules()
|
|
131
144
|
if [[ "$install_node_and_modules" = "" ]]; then
|
132
145
|
install_node_and_modules=1
|
133
146
|
if [[ -e /host_cache ]]; then
|
134
|
-
if [[
|
135
|
-
|
136
|
-
|
147
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
148
|
+
if [[ ! -e /host_cache/node-v4.7.2-darwin-x64.tar.gz ]]; then
|
149
|
+
run curl --fail -L -o /host_cache/node-v4.7.2-darwin-x64.tar.gz \
|
150
|
+
https://nodejs.org/dist/v4.7.2/node-v4.7.2-darwin-x64.tar.gz
|
151
|
+
fi
|
152
|
+
run tar xzf /host_cache/node-v4.7.2-darwin-x64.tar.gz
|
153
|
+
else
|
154
|
+
if [[ ! -e /host_cache/node-v4.7.2-linux-x64.tar.gz ]]; then
|
155
|
+
run curl --fail -L -o /host_cache/node-v4.7.2-linux-x64.tar.gz \
|
156
|
+
https://nodejs.org/dist/v4.7.2/node-v4.7.2-linux-x64.tar.gz
|
157
|
+
fi
|
158
|
+
run tar xzf /host_cache/node-v4.7.2-linux-x64.tar.gz
|
137
159
|
fi
|
138
|
-
run tar xzf /host_cache/node-v0.10.20-linux-x64.tar.gz
|
139
160
|
else
|
140
|
-
|
141
|
-
|
161
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
162
|
+
run curl --fail -L -O https://nodejs.org/dist/v4.7.2/node-v4.7.2-darwin-x64.tar.gz
|
163
|
+
run tar xzf node-v4.7.2-darwin-x64.tar.gz
|
164
|
+
else
|
165
|
+
run curl --fail -L -O https://nodejs.org/dist/v4.7.2/node-v4.7.2-linux-x64.tar.gz
|
166
|
+
run tar xzf node-v4.7.2-linux-x64.tar.gz
|
167
|
+
fi
|
168
|
+
fi
|
169
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
170
|
+
export PATH=`pwd`/node-v4.7.2-darwin-x64/bin:$PATH
|
171
|
+
else
|
172
|
+
export PATH=`pwd`/node-v4.7.2-linux-x64/bin:$PATH
|
142
173
|
fi
|
143
|
-
export PATH=`pwd`/node-v0.10.20-linux-x64/bin:$PATH
|
144
174
|
retry_run 3 rake_test_install_deps NODE_MODULES=yes
|
145
175
|
fi
|
146
176
|
}
|
147
177
|
|
148
178
|
run uname -a
|
149
|
-
|
150
|
-
run
|
151
|
-
|
179
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
180
|
+
run sysctl -a
|
181
|
+
echo '$ sed -e "s/_USER_/'$USER'/" test/config.json.travis-osx > test/config.json'
|
182
|
+
sed -e "s/_USER_/$USER/" test/config.json.travis-osx > test/config.json
|
183
|
+
else
|
184
|
+
run lsb_release -a
|
185
|
+
run sudo tee /etc/dpkg/dpkg.cfg.d/02apt-speedup >/dev/null <<<"force-unsafe-io"
|
186
|
+
run cp test/config.json.travis test/config.json
|
187
|
+
fi
|
152
188
|
|
153
189
|
# Relax permissions on home directory so that the application root
|
154
190
|
# permission checks pass.
|
@@ -178,7 +214,6 @@ fi
|
|
178
214
|
|
179
215
|
ORIG_GEM_PATH="$GEM_PATH"
|
180
216
|
|
181
|
-
|
182
217
|
if [[ "$INSTALL_ALL_DEPS" = 1 ]]; then
|
183
218
|
run rake_test_install_deps DEVDEPS_DEFAULT=yes
|
184
219
|
INSTALL_DEPS=0
|
@@ -200,13 +235,14 @@ if [[ "$TEST_USH" = 1 ]]; then
|
|
200
235
|
export PASSENGER_CONFIG="$PWD/bin/passenger-config"
|
201
236
|
run "$PASSENGER_CONFIG" install-standalone-runtime --auto
|
202
237
|
|
203
|
-
|
238
|
+
# RVM is bad and should feel bad
|
239
|
+
builtin pushd src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core
|
204
240
|
bundle exec rake spec:travis TRAVIS_WITH_SUDO=1
|
205
|
-
popd
|
241
|
+
builtin popd
|
206
242
|
|
207
|
-
pushd src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails
|
243
|
+
builtin pushd src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails
|
208
244
|
bundle exec rake spec:travis GEM_BUNDLE_PATH="$DEPS_TARGET"
|
209
|
-
popd
|
245
|
+
builtin popd
|
210
246
|
fi
|
211
247
|
|
212
248
|
if [[ "$TEST_NODE" = 1 ]]; then
|
@@ -229,13 +265,30 @@ if [[ "$TEST_NGINX" = 1 ]]; then
|
|
229
265
|
fi
|
230
266
|
|
231
267
|
if [[ "$TEST_APACHE2" = 1 ]]; then
|
232
|
-
|
233
|
-
|
268
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
269
|
+
brew_update
|
270
|
+
run brew install pcre openssl
|
271
|
+
if [[ "`sw_vers -productVersion | sed 's/^10\.\(.*\)/\1>=12.0/' | bc -l`" == "1" ]] ; then
|
272
|
+
run brew install apr apr-util
|
273
|
+
run brew link apr apr-util --force
|
274
|
+
export APR_CONFIG=`brew --prefix`/opt/apr/bin/apr-1-config
|
275
|
+
export APU_CONFIG=`brew --prefix`/opt/apr-util/bin/apu-1-config
|
276
|
+
fi
|
277
|
+
else
|
278
|
+
apt_get_update
|
279
|
+
run sudo apt-get install -y --no-install-recommends \
|
234
280
|
apache2-mpm-worker apache2-threaded-dev
|
281
|
+
fi
|
235
282
|
install_base_test_deps
|
236
283
|
install_node_and_modules
|
237
284
|
run ./bin/passenger-install-apache2-module --auto #--no-update-config
|
238
|
-
|
285
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
286
|
+
# rvmsudo only preserves env vars matching /^(rvm|gemset|http_|PATH|IRBRC)|RUBY|GEM/
|
287
|
+
# https://github.com/rvm/rvm/blob/aae6505001e2d6b5e4dc9a355c18ffcbd073bab2/bin/rvmsudo#L83
|
288
|
+
run sudo -E ./bin/passenger-install-apache2-module --auto --no-compile
|
289
|
+
else
|
290
|
+
run rvmsudo ./bin/passenger-install-apache2-module --auto --no-compile
|
291
|
+
fi
|
239
292
|
run bundle exec drake -j$COMPILE_CONCURRENCY test:integration:apache2
|
240
293
|
fi
|
241
294
|
|
@@ -245,8 +298,16 @@ if [[ "$TEST_STANDALONE" = 1 ]]; then
|
|
245
298
|
fi
|
246
299
|
|
247
300
|
if [[ "$TEST_SOURCE_PACKAGING" = 1 ]]; then
|
248
|
-
|
249
|
-
|
301
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
302
|
+
brew_update
|
303
|
+
run brew install source-highlight
|
304
|
+
else
|
305
|
+
apt_get_update
|
306
|
+
run sudo apt-get install -y --no-install-recommends source-highlight
|
307
|
+
fi
|
250
308
|
install_test_deps_with_doctools
|
251
309
|
run bundle _1.11.2_ exec rspec -f s -c test/integration_tests/source_packaging_test.rb
|
252
310
|
fi
|
311
|
+
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
312
|
+
trap - EXIT
|
313
|
+
fi
|
data/src/agent/Core/CoreMain.cpp
CHANGED
@@ -792,7 +792,7 @@ initializeSecurityUpdateChecker() {
|
|
792
792
|
}
|
793
793
|
string serverVersion = options.get("server_version", false); // not set in case of standalone / builtin
|
794
794
|
|
795
|
-
workingObjects->securityUpdateChecker = new SecurityUpdateChecker(workingObjects->resourceLocator, proxy, serverIntegration, serverVersion);
|
795
|
+
workingObjects->securityUpdateChecker = new SecurityUpdateChecker(workingObjects->resourceLocator, proxy, serverIntegration, serverVersion, options.get("instance_dir",false));
|
796
796
|
workingObjects->securityUpdateChecker->start(24 * 60 * 60);
|
797
797
|
}
|
798
798
|
}
|
@@ -18,6 +18,11 @@
|
|
18
18
|
#include <Utils/Curl.h>
|
19
19
|
#include <modp_b64.h>
|
20
20
|
|
21
|
+
#if BOOST_OS_MACOS
|
22
|
+
#include <sys/syslimits.h>
|
23
|
+
#include <unistd.h>
|
24
|
+
#endif
|
25
|
+
|
21
26
|
namespace Passenger {
|
22
27
|
|
23
28
|
using namespace std;
|
@@ -54,6 +59,11 @@ private:
|
|
54
59
|
string serverVersion;
|
55
60
|
CurlProxyInfo proxyInfo;
|
56
61
|
Crypto *crypto;
|
62
|
+
#if BOOST_OS_MACOS
|
63
|
+
SecKeychainRef defaultKeychain;
|
64
|
+
SecKeychainRef keychain;
|
65
|
+
bool usingPassengerKeychain;
|
66
|
+
#endif
|
57
67
|
|
58
68
|
void threadMain() {
|
59
69
|
TRACE_POINT();
|
@@ -217,7 +227,8 @@ private:
|
|
217
227
|
}
|
218
228
|
|
219
229
|
#if BOOST_OS_MACOS
|
220
|
-
if
|
230
|
+
// if not using a private keychain, preauth the security update check key in the user's keychain (this is for libcurl's benefit because they don't bother to authorize themselves to use the keys they import)
|
231
|
+
if (!usingPassengerKeychain && !crypto->preAuthKey(clientCertPath.c_str(), CLIENT_CERT_PWD, CLIENT_CERT_LABEL)) {
|
221
232
|
return CURLE_SSL_CERTPROBLEM;
|
222
233
|
}
|
223
234
|
if (CURLE_OK != (code = curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "P12"))) {
|
@@ -281,12 +292,89 @@ public:
|
|
281
292
|
* serverIntegration should be one of { nginx, apache, standalone nginx, standalone builtin }, whereby
|
282
293
|
* serverVersion is the version of Nginx or Apache, if relevant (otherwise empty)
|
283
294
|
*/
|
284
|
-
SecurityUpdateChecker(const ResourceLocator &locator, const string &proxy, const string &serverIntegration, const string &serverVersion) {
|
295
|
+
SecurityUpdateChecker(const ResourceLocator &locator, const string &proxy, const string &serverIntegration, const string &serverVersion, const string &instancePath) {
|
285
296
|
crypto = new Crypto();
|
286
297
|
updateCheckThread = NULL;
|
287
298
|
checkIntervalSec = 0;
|
288
299
|
#if BOOST_OS_MACOS
|
289
300
|
clientCertPath = locator.getResourcesDir() + "/update_check_client_cert.p12";
|
301
|
+
// Used to keep track of which approach we are using, false means we are preauthing the key in the running user's own keychain; true means we create a private keychain and set it as the default
|
302
|
+
usingPassengerKeychain = false;
|
303
|
+
defaultKeychain = NULL;
|
304
|
+
keychain = NULL;
|
305
|
+
OSStatus status = 0;
|
306
|
+
char pathName [PATH_MAX];
|
307
|
+
UInt32 length = PATH_MAX;
|
308
|
+
memset(pathName, 0, PATH_MAX);
|
309
|
+
|
310
|
+
status = SecKeychainCopyDefault(&defaultKeychain);
|
311
|
+
if (status) {
|
312
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
313
|
+
P_ERROR(string("Getting default keychain failed: ") +
|
314
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8) +
|
315
|
+
" Passenger will not attempt to create a private keychain.");
|
316
|
+
CFRelease(str);
|
317
|
+
} else {
|
318
|
+
status = SecKeychainGetPath(defaultKeychain, &length, pathName);
|
319
|
+
P_DEBUG(string("username is: ") + getProcessUsername());
|
320
|
+
if (status) {
|
321
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
322
|
+
P_ERROR(string("Checking default keychain path failed: ") +
|
323
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8) +
|
324
|
+
" Passenger may use system keychain.");
|
325
|
+
CFRelease(str);
|
326
|
+
pathName[0] = 0; // ensure the pathName compares cleanly
|
327
|
+
} else {
|
328
|
+
P_DEBUG(string("Old default keychain is: ") + pathName);
|
329
|
+
}
|
330
|
+
}
|
331
|
+
// we don't care so much about which user we are, what we care about is is they have their own keychain, if the default keychain is the system keychain, then we need to try and create our own to avoid permissions issues
|
332
|
+
if (strcmp(pathName, "/Library/Keychains/System.keychain") == 0) {
|
333
|
+
usingPassengerKeychain = true;
|
334
|
+
const uint size = 512;
|
335
|
+
uint8_t keychainPassword[size];
|
336
|
+
if (!crypto->generateRandomChars(keychainPassword, size)) {
|
337
|
+
P_CRITICAL("Creating password for Passenger default keychain failed.");
|
338
|
+
usingPassengerKeychain = false;
|
339
|
+
} else {
|
340
|
+
string keychainDir = instancePath;
|
341
|
+
if (instancePath.length() == 0) {
|
342
|
+
char currentPath[PATH_MAX];
|
343
|
+
if (!getcwd(currentPath, PATH_MAX)) {
|
344
|
+
P_ERROR(string("Failed to get cwd: ") + strerror(errno) + " Attempting to use relative path '.'");
|
345
|
+
keychainDir = ".";
|
346
|
+
} else {
|
347
|
+
keychainDir = string(currentPath);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
// create keychain with long random password, then discard password after creation. We receive the keychain unlocked, and no-one else needs to access the keychain.
|
351
|
+
status = SecKeychainCreate((keychainDir + "/passenger.keychain").c_str(), size, keychainPassword, false, NULL, &keychain);
|
352
|
+
memset(keychainPassword, 0, size);
|
353
|
+
if (status) {
|
354
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
355
|
+
P_ERROR(string("Creating Passenger default keychain failed: ") +
|
356
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8) +
|
357
|
+
" Passenger may fail to access system keychain.");
|
358
|
+
CFRelease(str);
|
359
|
+
usingPassengerKeychain = false;
|
360
|
+
} else {
|
361
|
+
// set keychain as default so libcurl uses it.
|
362
|
+
status = SecKeychainSetDefault(keychain);
|
363
|
+
if (status) {
|
364
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
365
|
+
P_ERROR(string("Setting Passenger default keychain failed: ") +
|
366
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8) +
|
367
|
+
" Passenger may fail to access system keychain.");
|
368
|
+
CFRelease(str);
|
369
|
+
usingPassengerKeychain = false;
|
370
|
+
} else if (!crypto->preAuthKey(clientCertPath.c_str(), CLIENT_CERT_PWD, CLIENT_CERT_LABEL)) {
|
371
|
+
P_ERROR("Failed to preauthorize Passenger Client Cert, you may experience popups from the Keychain.");
|
372
|
+
/* } else {
|
373
|
+
we have loaded the security update check key into the private keychain with the correct permissions, so libcurl should be able to use it. */
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
290
378
|
#else
|
291
379
|
clientCertPath = locator.getResourcesDir() + "/update_check_client_cert.pem";
|
292
380
|
#endif
|
@@ -312,6 +400,32 @@ public:
|
|
312
400
|
if (crypto) {
|
313
401
|
delete crypto;
|
314
402
|
}
|
403
|
+
#if BOOST_OS_MACOS
|
404
|
+
// if using a private keychain, cleanup keychain on shutdown
|
405
|
+
if (usingPassengerKeychain) {
|
406
|
+
OSStatus status = 0;
|
407
|
+
if (defaultKeychain) {
|
408
|
+
status = SecKeychainSetDefault(defaultKeychain);
|
409
|
+
if (status) {
|
410
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
411
|
+
P_ERROR(string("Restoring default keychain failed: ") +
|
412
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8));
|
413
|
+
CFRelease(str);
|
414
|
+
}
|
415
|
+
CFRelease(defaultKeychain);
|
416
|
+
}
|
417
|
+
if (keychain) {
|
418
|
+
status = SecKeychainDelete(keychain);
|
419
|
+
if (status) {
|
420
|
+
CFStringRef str = SecCopyErrorMessageString(status, NULL);
|
421
|
+
P_ERROR(string("Deleting Passenger private keychain failed: ") +
|
422
|
+
CFStringGetCStringPtr(str, kCFStringEncodingUTF8));
|
423
|
+
CFRelease(str);
|
424
|
+
}
|
425
|
+
CFRelease(keychain);
|
426
|
+
}
|
427
|
+
}
|
428
|
+
#endif
|
315
429
|
}
|
316
430
|
|
317
431
|
/**
|
@@ -544,7 +658,10 @@ public:
|
|
544
658
|
} while (0);
|
545
659
|
|
546
660
|
#if BOOST_OS_MACOS
|
547
|
-
|
661
|
+
// if not using a private keychain remove the security update check key from the user's keychain so that if we are stopped/crash and are upgraded or reinstalled before restarting we don't have permission problems
|
662
|
+
if (!usingPassengerKeychain) {
|
663
|
+
crypto->killKey(CLIENT_CERT_LABEL);
|
664
|
+
}
|
548
665
|
#endif
|
549
666
|
|
550
667
|
if (signatureChars) {
|