mongo 2.9.0.rc0 → 2.9.0.rc1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +1 -3
- data/lib/mongo/client.rb +33 -16
- data/lib/mongo/collection/view/aggregation.rb +3 -2
- data/lib/mongo/collection/view/map_reduce.rb +3 -2
- data/lib/mongo/server/connectable.rb +8 -4
- data/lib/mongo/server/connection.rb +0 -1
- data/lib/mongo/server/monitor/connection.rb +0 -1
- data/lib/mongo/socket/ssl.rb +67 -10
- data/lib/mongo/version.rb +1 -1
- data/spec/README.md +39 -3
- data/spec/integration/auth_spec.rb +2 -2
- data/spec/integration/ssl_uri_options_spec.rb +7 -6
- data/spec/lite_spec_helper.rb +0 -16
- data/spec/mongo/client_construction_spec.rb +13 -13
- data/spec/mongo/collection/view/map_reduce_spec.rb +8 -0
- data/spec/mongo/server_spec.rb +2 -1
- data/spec/mongo/socket/ssl_spec.rb +213 -20
- data/spec/mongo/socket/tcp_spec.rb +1 -1
- data/spec/support/certificates/README.md +101 -0
- data/spec/support/certificates/ca.crt +76 -0
- data/spec/support/certificates/{client_key_encrypted.pem → client-encrypted.key} +0 -0
- data/spec/support/certificates/client-int.crt +78 -0
- data/spec/support/certificates/client-second-level-bundle.pem +179 -0
- data/spec/support/certificates/client-second-level.crt +74 -0
- data/spec/support/certificates/client-second-level.key +27 -0
- data/spec/support/certificates/client-second-level.pem +101 -0
- data/spec/support/certificates/client.crt +74 -0
- data/spec/support/certificates/{client_key.pem → client.key} +1 -1
- data/spec/support/certificates/client.pem +1 -1
- data/spec/support/certificates/multi-ca.crt +152 -0
- data/spec/support/certificates/python-ca.crt +76 -0
- data/spec/support/certificates/server-int.crt +78 -0
- data/spec/support/certificates/server-second-level-bundle.pem +179 -0
- data/spec/support/certificates/server-second-level.crt +74 -0
- data/spec/support/certificates/server-second-level.key +27 -0
- data/spec/support/certificates/server-second-level.pem +101 -0
- data/spec/support/certificates/server.pem +74 -22
- data/spec/support/constraints.rb +3 -7
- data/spec/support/spec_config.rb +84 -16
- metadata +36 -10
- metadata.gz.sig +0 -0
- data/spec/support/certificates/ca.pem +0 -22
- data/spec/support/certificates/client_cert.pem +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7be78062f748710dc54cb80b22913e719ffdd5c066f09390ae701cbc4d5b817
|
4
|
+
data.tar.gz: 64fd81ea9461edf3d4211ea32ad2958cd64a2584d84e9a8d3492e22c4332109e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2e95fc24ce7bea503e60e3c94066010945df1ba3822395fd34a2c8daa27df75cfbae4b4808133dd59663d65bbecdcb68511a46316aa3b3b840efdc3f34519c
|
7
|
+
data.tar.gz: ce9ebadaeabfb7bd01f662fae6b4a06bb9d35d19cc866af4dab0549a5011120df08a5353b3ca56fa8b3f4408a3b6e06736f0662ca65e2c55a552dea636db93c1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
MongoDB Ruby Driver [![
|
1
|
+
MongoDB Ruby Driver [![Code Climate][codeclimate-img]][codeclimate-url] [![Gem Version][rubygems-img]][rubygems-url]
|
2
2
|
-----
|
3
3
|
The officially supported Ruby driver for [MongoDB](http://www.mongodb.org).
|
4
4
|
|
@@ -107,7 +107,5 @@ License
|
|
107
107
|
|
108
108
|
[rubygems-img]: https://badge.fury.io/rb/mongo.svg
|
109
109
|
[rubygems-url]: http://badge.fury.io/rb/mongo
|
110
|
-
[travis-img]: https://secure.travis-ci.org/mongodb/mongo-ruby-driver.svg?branch=master
|
111
|
-
[travis-url]: http://travis-ci.org/mongodb/mongo-ruby-driver?branch=master
|
112
110
|
[codeclimate-img]: https://codeclimate.com/github/mongodb/mongo-ruby-driver.svg?branch=master
|
113
111
|
[codeclimate-url]: https://codeclimate.com/github/mongodb/mongo-ruby-driver?branch=master
|
data/lib/mongo/client.rb
CHANGED
@@ -177,7 +177,9 @@ module Mongo
|
|
177
177
|
#
|
178
178
|
# @param [ Array<String> | String ] addresses_or_uri The array of server addresses in the
|
179
179
|
# form of host:port or a MongoDB URI connection string.
|
180
|
-
# @param [ Hash ] options The options to be used by the client.
|
180
|
+
# @param [ Hash ] options The options to be used by the client. If a MongoDB URI
|
181
|
+
# connection string is also provided, these options take precedence over any
|
182
|
+
# analogous options present in the URI string.
|
181
183
|
#
|
182
184
|
#
|
183
185
|
# @option options [ String, Symbol ] :app_name Application name that is
|
@@ -274,24 +276,39 @@ module Mongo
|
|
274
276
|
# @option options [ true, false ] :ssl Whether to use SSL.
|
275
277
|
# @option options [ String ] :ssl_ca_cert The file containing concatenated
|
276
278
|
# certificate authority certificates used to validate certs passed from the
|
277
|
-
# other end of the connection.
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
# :ssl_ca_cert_object (in order of priority)
|
279
|
+
# other end of the connection. Intermediate certificates should NOT be
|
280
|
+
# specified in files referenced by this option. One of :ssl_ca_cert,
|
281
|
+
# :ssl_ca_cert_string or :ssl_ca_cert_object (in order of priority) is
|
282
|
+
# required when using :ssl_verify.
|
283
|
+
# @option options [ Array<OpenSSL::X509::Certificate> ] :ssl_ca_cert_object
|
284
|
+
# An array of OpenSSL::X509::Certificate objects representing the
|
285
|
+
# certificate authority certificates used to validate certs passed from
|
286
|
+
# the other end of the connection. Intermediate certificates should NOT
|
287
|
+
# be specified in files referenced by this option. One of :ssl_ca_cert,
|
288
|
+
# :ssl_ca_cert_string or :ssl_ca_cert_object (in order of priority)
|
289
|
+
# is required when using :ssl_verify.
|
290
|
+
# @option options [ String ] :ssl_ca_cert_string A string containing
|
291
|
+
# certificate authority certificate used to validate certs passed from the
|
292
|
+
# other end of the connection. This option allows passing only one CA
|
293
|
+
# certificate to the driver. Intermediate certificates should NOT
|
294
|
+
# be specified in files referenced by this option. One of :ssl_ca_cert,
|
295
|
+
# :ssl_ca_cert_string or :ssl_ca_cert_object (in order of priority) is
|
296
|
+
# required when using :ssl_verify.
|
287
297
|
# @option options [ String ] :ssl_cert The certificate file used to identify
|
288
|
-
# the connection against MongoDB.
|
289
|
-
#
|
298
|
+
# the connection against MongoDB. A certificate chain may be passed by
|
299
|
+
# specifying the client certificate first followed by any intermediate
|
300
|
+
# certificates up to the CA certificate. The file may also contain the
|
301
|
+
# certificate's private key, which will be ignored. This option, if present,
|
302
|
+
# takes precedence over the values of :ssl_cert_string and :ssl_cert_object
|
290
303
|
# @option options [ OpenSSL::X509::Certificate ] :ssl_cert_object The OpenSSL::X509::Certificate
|
291
|
-
# used to identify the connection against MongoDB
|
304
|
+
# used to identify the connection against MongoDB. Only one certificate
|
305
|
+
# may be passed through this option.
|
292
306
|
# @option options [ String ] :ssl_cert_string A string containing the PEM-encoded
|
293
|
-
# certificate used to identify the connection against MongoDB.
|
294
|
-
#
|
307
|
+
# certificate used to identify the connection against MongoDB. A certificate
|
308
|
+
# chain may be passed by specifying the client certificate first followed
|
309
|
+
# by any intermediate certificates up to the CA certificate. The string
|
310
|
+
# may also contain the certificate's private key, which will be ignored,
|
311
|
+
# This option, if present, takes precedence over the value of :ssl_cert_object
|
295
312
|
# @option options [ String ] :ssl_key The private keyfile used to identify the
|
296
313
|
# connection against MongoDB. Note that even if the key is stored in the same
|
297
314
|
# file as the certificate, both need to be explicitly specified. This option,
|
@@ -42,6 +42,7 @@ module Mongo
|
|
42
42
|
# The reroute message.
|
43
43
|
#
|
44
44
|
# @since 2.1.0
|
45
|
+
# @deprecated
|
45
46
|
REROUTE = 'Rerouting the Aggregation operation to the primary server.'.freeze
|
46
47
|
|
47
48
|
# Set to true if disk usage is allowed during the aggregation.
|
@@ -120,8 +121,8 @@ module Mongo
|
|
120
121
|
|
121
122
|
def send_initial_query(server, session)
|
122
123
|
unless valid_server?(server)
|
123
|
-
log_warn(
|
124
|
-
server = cluster.next_primary
|
124
|
+
log_warn("Rerouting the Aggregation operation to the primary server - #{server.summary} is not suitable")
|
125
|
+
server = cluster.next_primary
|
125
126
|
end
|
126
127
|
validate_collation!(server)
|
127
128
|
initial_query_op(session).execute(server)
|
@@ -35,6 +35,7 @@ module Mongo
|
|
35
35
|
# Reroute message.
|
36
36
|
#
|
37
37
|
# @since 2.1.0
|
38
|
+
# @deprecated
|
38
39
|
REROUTE = 'Rerouting the MapReduce operation to the primary server.'.freeze
|
39
40
|
|
40
41
|
# @return [ View ] view The collection view.
|
@@ -232,8 +233,8 @@ module Mongo
|
|
232
233
|
|
233
234
|
def send_initial_query(server, session)
|
234
235
|
unless valid_server?(server)
|
235
|
-
log_warn(
|
236
|
-
server = cluster.next_primary
|
236
|
+
log_warn("Rerouting the MapReduce operation to the primary server - #{server.summary} is not suitable")
|
237
|
+
server = cluster.next_primary
|
237
238
|
end
|
238
239
|
validate_collation!(server)
|
239
240
|
initial_query_op(session).execute(server)
|
@@ -23,15 +23,15 @@ module Mongo
|
|
23
23
|
# The ssl option prefix.
|
24
24
|
#
|
25
25
|
# @since 2.1.0
|
26
|
+
# @deprecated
|
26
27
|
SSL = 'ssl'.freeze
|
27
28
|
|
28
29
|
# The default time in seconds to timeout an operation executed on a socket.
|
29
30
|
#
|
30
31
|
# @since 2.0.0
|
31
32
|
#
|
32
|
-
# @deprecated Timeouts on Ruby sockets aren't effective so this default
|
33
|
-
# no longer used.
|
34
|
-
# Will be removed in driver version 3.0.
|
33
|
+
# @deprecated Timeouts on Ruby sockets aren't effective so this default
|
34
|
+
# option is no longer used. Will be removed in driver version 3.0.
|
35
35
|
TIMEOUT = 5.freeze
|
36
36
|
|
37
37
|
# @return [ Integer ] pid The process id when the connection was created.
|
@@ -69,7 +69,11 @@ module Mongo
|
|
69
69
|
private
|
70
70
|
|
71
71
|
def ssl_options
|
72
|
-
@ssl_options[:ssl]
|
72
|
+
@ssl_options ||= if options[:ssl]
|
73
|
+
options.select { |k, v| k.to_s.start_with?('ssl') }
|
74
|
+
else
|
75
|
+
{}
|
76
|
+
end.freeze
|
73
77
|
end
|
74
78
|
|
75
79
|
def ensure_connected
|
data/lib/mongo/socket/ssl.rb
CHANGED
@@ -149,33 +149,90 @@ module Mongo
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def set_cert(context, options)
|
152
|
+
# Since we clear cert_text during processing, we need to examine
|
153
|
+
# ssl_cert_object here to avoid considering it if we have also
|
154
|
+
# processed the text.
|
152
155
|
if options[:ssl_cert]
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
156
|
+
cert_text = File.read(options[:ssl_cert])
|
157
|
+
cert_object = nil
|
158
|
+
elsif cert_text = options[:ssl_cert_string]
|
159
|
+
cert_object = nil
|
160
|
+
else
|
161
|
+
cert_object = options[:ssl_cert_object]
|
162
|
+
end
|
163
|
+
|
164
|
+
# The client certificate may be a single certificate or a bundle
|
165
|
+
# (client certificate followed by intermediate certificates).
|
166
|
+
# The text may also include private keys for the certificates.
|
167
|
+
# OpenSSL supports passing the entire bundle as a certificate chain
|
168
|
+
# to the context via SSL_CTX_use_certificate_chain_file, but the
|
169
|
+
# Ruby openssl extension does not currently expose this functionality
|
170
|
+
# per https://github.com/ruby/openssl/issues/254.
|
171
|
+
# Therefore, extract the individual certificates from the certificate
|
172
|
+
# text, and if there is more than one certificate provided, use
|
173
|
+
# extra_chain_cert option to add the intermediate ones. This
|
174
|
+
# implementation is modeled after
|
175
|
+
# https://github.com/venuenext/ruby-kafka/commit/9495f5daf254b43bc88062acad9359c5f32cb8b5.
|
176
|
+
# Note that the parsing here is not identical to what OpenSSL employs -
|
177
|
+
# for instance, if there is no newline between two certificates
|
178
|
+
# this code will extract them both but OpenSSL fails in this situation.
|
179
|
+
if cert_text
|
180
|
+
certs = cert_text.scan(/-----BEGIN CERTIFICATE-----(?:.|\n)+?-----END CERTIFICATE-----/)
|
181
|
+
if certs.length > 1
|
182
|
+
context.cert = OpenSSL::X509::Certificate.new(certs.shift)
|
183
|
+
context.extra_chain_cert = certs.map do |cert|
|
184
|
+
OpenSSL::X509::Certificate.new(cert)
|
185
|
+
end
|
186
|
+
# All certificates are already added to the context, skip adding
|
187
|
+
# them again below.
|
188
|
+
cert_text = nil
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
if cert_text
|
193
|
+
context.cert = OpenSSL::X509::Certificate.new(cert_text)
|
194
|
+
elsif cert_object
|
195
|
+
context.cert = cert_object
|
158
196
|
end
|
159
197
|
end
|
160
198
|
|
161
199
|
def set_key(context, options)
|
162
200
|
passphrase = options[:ssl_key_pass_phrase]
|
163
201
|
if options[:ssl_key]
|
164
|
-
context.key =
|
165
|
-
OpenSSL::PKey.read(File.open(options[:ssl_key]))
|
202
|
+
context.key = load_private_key(File.read(options[:ssl_key]), passphrase)
|
166
203
|
elsif options[:ssl_key_string]
|
167
|
-
context.key =
|
168
|
-
OpenSSL::PKey.read(options[:ssl_key_string])
|
204
|
+
context.key = load_private_key(options[:ssl_key_string], passphrase)
|
169
205
|
elsif options[:ssl_key_object]
|
170
206
|
context.key = options[:ssl_key_object]
|
171
207
|
end
|
172
208
|
end
|
173
209
|
|
210
|
+
def load_private_key(text, passphrase)
|
211
|
+
args = if passphrase
|
212
|
+
[text, passphrase]
|
213
|
+
else
|
214
|
+
[text]
|
215
|
+
end
|
216
|
+
# On JRuby, PKey.read does not grok cert+key bundles.
|
217
|
+
# https://github.com/jruby/jruby-openssl/issues/176
|
218
|
+
if BSON::Environment.jruby?
|
219
|
+
[OpenSSL::PKey::RSA, OpenSSL::PKey::DSA].each do |cls|
|
220
|
+
begin
|
221
|
+
return cls.send(:new, *args)
|
222
|
+
rescue OpenSSL::PKey::PKeyError
|
223
|
+
# ignore
|
224
|
+
end
|
225
|
+
end
|
226
|
+
# Neither RSA nor DSA worked, fall through to trying PKey
|
227
|
+
end
|
228
|
+
OpenSSL::PKey.send(:read, *args)
|
229
|
+
end
|
230
|
+
|
174
231
|
def set_cert_verification(context, options)
|
175
232
|
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
176
233
|
cert_store = OpenSSL::X509::Store.new
|
177
234
|
if options[:ssl_ca_cert]
|
178
|
-
cert_store.
|
235
|
+
cert_store.add_file(options[:ssl_ca_cert])
|
179
236
|
elsif options[:ssl_ca_cert_string]
|
180
237
|
cert_store.add_cert(OpenSSL::X509::Certificate.new(options[:ssl_ca_cert_string]))
|
181
238
|
elsif options[:ssl_ca_cert_object]
|
data/lib/mongo/version.rb
CHANGED
data/spec/README.md
CHANGED
@@ -58,8 +58,11 @@ to start a replica set.
|
|
58
58
|
|
59
59
|
First, install [mtools](https://github.com/rueckstiess/mtools):
|
60
60
|
|
61
|
-
pip install mtools --user
|
61
|
+
pip install 'mtools[mlaunch]' --user -U --upgrade-strategy eager
|
62
|
+
# On Linux:
|
62
63
|
export PATH=~/.local/bin:$PATH
|
64
|
+
# On MacOS:
|
65
|
+
export PATH=$PATH:~/Library/Python/2.7/bin
|
63
66
|
|
64
67
|
Then, launch a replica set:
|
65
68
|
|
@@ -84,14 +87,40 @@ cluster topology.
|
|
84
87
|
## TLS With Verification
|
85
88
|
|
86
89
|
The test suite includes a set of TLS certificates for configuring a server
|
87
|
-
and a client to perform full TLS verification
|
88
|
-
|
90
|
+
and a client to perform full TLS verification in the `spec/support/certificates`
|
91
|
+
directory. The server can be started as follows, if the current directory is
|
92
|
+
the top of the driver source tree:
|
89
93
|
|
90
94
|
mlaunch init --single --dir /tmp/mdb-ssl --sslMode requireSSL \
|
91
95
|
--sslPEMKeyFile `pwd`/spec/support/certificates/server.pem \
|
92
96
|
--sslCAFile `pwd`/spec/support/certificates/ca.pem \
|
93
97
|
--sslClientCertificate `pwd`/spec/support/certificates/client.pem
|
94
98
|
|
99
|
+
To test that the driver works when the server's certificate is signed by an
|
100
|
+
intermediate certificate (i.e. uses certificate chaining), use the chained
|
101
|
+
server certificate bundle:
|
102
|
+
|
103
|
+
mlaunch init --single --dir /tmp/mdb-ssl --sslMode requireSSL \
|
104
|
+
--sslPEMKeyFile `pwd`/spec/support/certificates/server-second-level-bundle.pem \
|
105
|
+
--sslCAFile `pwd`/spec/support/certificates/ca.pem \
|
106
|
+
--sslClientCertificate `pwd`/spec/support/certificates/client.pem
|
107
|
+
|
108
|
+
The driver's test suite is configured to verify certificates by default.
|
109
|
+
If the server is launched with the certificates from the driver's test suite,
|
110
|
+
the test suite can be run simply by specifying `tls=true` URI option:
|
111
|
+
|
112
|
+
MONGODB_URI='mongodb://localhost:27017/?tls=true' rake
|
113
|
+
|
114
|
+
The driver's test suite can also be executed against a server launched with
|
115
|
+
any other certificates. In this case the certificates need to be explicitly
|
116
|
+
specified in the URI, for example as follows:
|
117
|
+
|
118
|
+
MONGODB_URI='mongodb://localhost:27017/?tls=true&tlsCAFile=path/to/ca.crt&tlsCertificateKeyFile=path/to/client.pem' rake
|
119
|
+
|
120
|
+
Note that some tests (specifically testing TLS verification) expect the server
|
121
|
+
to be launched using the certificates in the driver's test suite, and will
|
122
|
+
fail when run against a server using other certificates.
|
123
|
+
|
95
124
|
## TLS Without Verification
|
96
125
|
|
97
126
|
It is also possible to enable TLS but omit certificate verification. In this
|
@@ -108,6 +137,9 @@ verification, run:
|
|
108
137
|
|
109
138
|
MONGODB_URI='mongodb://localhost:27017/?tls=true&tlsInsecure=true' rake
|
110
139
|
|
140
|
+
Note that there are tests in the test suite that cover TLS verification, and
|
141
|
+
they may fail if the test suite is run in this way.
|
142
|
+
|
111
143
|
## Authentication
|
112
144
|
|
113
145
|
mlaunch can configure authentication on the server:
|
@@ -160,6 +192,10 @@ permissions:
|
|
160
192
|
|
161
193
|
sudo chmod 0666 /tmp/mongodb-27017.sock
|
162
194
|
|
195
|
+
Alternatively, specify the following argument to `mlaunch` or `mongod`:
|
196
|
+
|
197
|
+
--filePermissions 0666
|
198
|
+
|
163
199
|
### Non-Identical Hostnames
|
164
200
|
|
165
201
|
The test suite should be configured to connect to exactly the hostnames
|
@@ -120,7 +120,7 @@ describe 'Auth' do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
context 'attempting to connect to a non-tls server with tls' do
|
123
|
-
|
123
|
+
require_no_tls
|
124
124
|
|
125
125
|
let(:options) { {ssl: true} }
|
126
126
|
|
@@ -138,7 +138,7 @@ describe 'Auth' do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
context 'attempting to connect to a tls server without tls' do
|
141
|
-
|
141
|
+
require_tls
|
142
142
|
|
143
143
|
let(:options) { {} }
|
144
144
|
|
@@ -1,20 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'SSL connections with URI options' do
|
4
|
-
# SpecConfig currently creates clients exclusively through non-URI options.
|
5
|
-
# currently have a way to create what the URI would look
|
6
|
-
# just to test the that TLS works when
|
7
|
-
#
|
4
|
+
# SpecConfig currently creates clients exclusively through non-URI options.
|
5
|
+
# Because we don't currently have a way to create what the URI would look
|
6
|
+
# like for a given client, it's simpler just to test the that TLS works when
|
7
|
+
# configured from a URI on a standalone server without auth required, since
|
8
|
+
# that allows us to build the URI more easily.
|
8
9
|
require_no_auth
|
9
10
|
require_topology :single
|
10
|
-
|
11
|
+
require_tls
|
11
12
|
|
12
13
|
let(:hosts) do
|
13
14
|
SpecConfig.instance.addresses.join(',')
|
14
15
|
end
|
15
16
|
|
16
17
|
let(:uri) do
|
17
|
-
"mongodb://#{hosts}/?tls=true&tlsInsecure=true&tlsCertificateKeyFile=#{SpecConfig.instance.
|
18
|
+
"mongodb://#{hosts}/?tls=true&tlsInsecure=true&tlsCertificateKeyFile=#{SpecConfig.instance.client_pem_path}"
|
18
19
|
end
|
19
20
|
|
20
21
|
it 'successfully connects and runs an operation' do
|
data/spec/lite_spec_helper.rb
CHANGED
@@ -18,22 +18,6 @@ TRANSACTIONS_API_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/transactions_
|
|
18
18
|
CHANGE_STREAMS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/change_streams/*.yml")
|
19
19
|
CMAP_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/cmap/*.yml")
|
20
20
|
|
21
|
-
if ENV['DRIVERS_TOOLS']
|
22
|
-
CLIENT_CERT_PEM = ENV['DRIVER_TOOLS_CLIENT_CERT_PEM']
|
23
|
-
CLIENT_KEY_PEM = ENV['DRIVER_TOOLS_CLIENT_KEY_PEM']
|
24
|
-
CA_PEM = ENV['DRIVER_TOOLS_CA_PEM']
|
25
|
-
CLIENT_KEY_ENCRYPTED_PEM = ENV['DRIVER_TOOLS_CLIENT_KEY_ENCRYPTED_PEM']
|
26
|
-
else
|
27
|
-
SSL_CERTS_DIR = "#{CURRENT_PATH}/support/certificates"
|
28
|
-
CLIENT_PEM = "#{SSL_CERTS_DIR}/client.pem"
|
29
|
-
CA_PEM = "#{SSL_CERTS_DIR}/ca.pem"
|
30
|
-
CRL_PEM = "#{SSL_CERTS_DIR}/crl.pem"
|
31
|
-
CLIENT_KEY_PEM = "#{SSL_CERTS_DIR}/client_key.pem"
|
32
|
-
CLIENT_CERT_PEM = "#{SSL_CERTS_DIR}/client_cert.pem"
|
33
|
-
CLIENT_KEY_ENCRYPTED_PEM = "#{SSL_CERTS_DIR}/client_key_encrypted.pem"
|
34
|
-
CLIENT_KEY_PASSPHRASE = "passphrase"
|
35
|
-
end
|
36
|
-
|
37
21
|
require 'mongo'
|
38
22
|
|
39
23
|
unless ENV['CI']
|
@@ -318,23 +318,23 @@ describe Mongo::Client do
|
|
318
318
|
|
319
319
|
let(:options) do
|
320
320
|
{
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
321
|
+
:ssl => true,
|
322
|
+
:ssl_ca_cert => SpecConfig.instance.ca_cert_path,
|
323
|
+
:ssl_ca_cert_string => 'ca cert string',
|
324
|
+
:ssl_ca_cert_object => 'ca cert object',
|
325
|
+
:ssl_cert => SpecConfig.instance.client_cert_path,
|
326
|
+
:ssl_cert_string => 'cert string',
|
327
|
+
:ssl_cert_object => 'cert object',
|
328
|
+
:ssl_key => SpecConfig.instance.client_key_path,
|
329
|
+
:ssl_key_string => 'key string',
|
330
|
+
:ssl_key_object => 'key object',
|
331
|
+
:ssl_key_pass_phrase => 'passphrase',
|
332
|
+
:ssl_verify => true
|
333
333
|
}
|
334
334
|
end
|
335
335
|
|
336
336
|
let(:client) do
|
337
|
-
new_local_client_nmio(['127.0.0.1:27017'],
|
337
|
+
new_local_client_nmio(['127.0.0.1:27017'], options)
|
338
338
|
end
|
339
339
|
|
340
340
|
it 'sets the ssl option' do
|