mongo 2.9.0.rc0 → 2.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +1 -3
  5. data/lib/mongo/client.rb +33 -16
  6. data/lib/mongo/collection/view/aggregation.rb +3 -2
  7. data/lib/mongo/collection/view/map_reduce.rb +3 -2
  8. data/lib/mongo/server/connectable.rb +8 -4
  9. data/lib/mongo/server/connection.rb +0 -1
  10. data/lib/mongo/server/monitor/connection.rb +0 -1
  11. data/lib/mongo/socket/ssl.rb +67 -10
  12. data/lib/mongo/version.rb +1 -1
  13. data/spec/README.md +39 -3
  14. data/spec/integration/auth_spec.rb +2 -2
  15. data/spec/integration/ssl_uri_options_spec.rb +7 -6
  16. data/spec/lite_spec_helper.rb +0 -16
  17. data/spec/mongo/client_construction_spec.rb +13 -13
  18. data/spec/mongo/collection/view/map_reduce_spec.rb +8 -0
  19. data/spec/mongo/server_spec.rb +2 -1
  20. data/spec/mongo/socket/ssl_spec.rb +213 -20
  21. data/spec/mongo/socket/tcp_spec.rb +1 -1
  22. data/spec/support/certificates/README.md +101 -0
  23. data/spec/support/certificates/ca.crt +76 -0
  24. data/spec/support/certificates/{client_key_encrypted.pem → client-encrypted.key} +0 -0
  25. data/spec/support/certificates/client-int.crt +78 -0
  26. data/spec/support/certificates/client-second-level-bundle.pem +179 -0
  27. data/spec/support/certificates/client-second-level.crt +74 -0
  28. data/spec/support/certificates/client-second-level.key +27 -0
  29. data/spec/support/certificates/client-second-level.pem +101 -0
  30. data/spec/support/certificates/client.crt +74 -0
  31. data/spec/support/certificates/{client_key.pem → client.key} +1 -1
  32. data/spec/support/certificates/client.pem +1 -1
  33. data/spec/support/certificates/multi-ca.crt +152 -0
  34. data/spec/support/certificates/python-ca.crt +76 -0
  35. data/spec/support/certificates/server-int.crt +78 -0
  36. data/spec/support/certificates/server-second-level-bundle.pem +179 -0
  37. data/spec/support/certificates/server-second-level.crt +74 -0
  38. data/spec/support/certificates/server-second-level.key +27 -0
  39. data/spec/support/certificates/server-second-level.pem +101 -0
  40. data/spec/support/certificates/server.pem +74 -22
  41. data/spec/support/constraints.rb +3 -7
  42. data/spec/support/spec_config.rb +84 -16
  43. metadata +36 -10
  44. metadata.gz.sig +0 -0
  45. data/spec/support/certificates/ca.pem +0 -22
  46. data/spec/support/certificates/client_cert.pem +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdc48b8fb67060880d69ada836cc9c468abe7fd2b2e959cffaeee5edb410f68a
4
- data.tar.gz: c8a365dac958eea89f939f78a668474f9f2e5d1ddb94e8cf772d8eeccb52d6a2
3
+ metadata.gz: f7be78062f748710dc54cb80b22913e719ffdd5c066f09390ae701cbc4d5b817
4
+ data.tar.gz: 64fd81ea9461edf3d4211ea32ad2958cd64a2584d84e9a8d3492e22c4332109e
5
5
  SHA512:
6
- metadata.gz: 6984456cca54c0a352903f1336a6a5c3674eacdd6abf7f9558900cc11d33806d9c32aa7700bcc950a0a8ca973ea5c7f5ad223dbd49c267c04e68703cfb98eda3
7
- data.tar.gz: 1ea50f9927a8bb622bf0188c1b158d00f80d35fe0fae72e81c6bac9a94775a3be3f7404b6674962db97833d3449f3bed448fff177527c853fd2e8610c78c783a
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 [![Build Status][travis-img]][travis-url] [![Code Climate][codeclimate-img]][codeclimate-url] [![Gem Version][rubygems-img]][rubygems-url]
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. One of :ssl_ca_cert, :ssl_ca_cert_string or
278
- # :ssl_ca_cert_object (in order of priority) is required for :ssl_verify.
279
- # @option options [ Array<OpenSSL::X509::Certificate> ] :ssl_ca_cert_object An array of
280
- # OpenSSL::X509::Certificate representing the certificate authority certificates used
281
- # to validate certs passed from the other end of the connection. One of :ssl_ca_cert,
282
- # :ssl_ca_cert_string or :ssl_ca_cert_object (in order of priority) is required for :ssl_verify.
283
- # @option options [ String ] :ssl_ca_cert_string A string containing concatenated
284
- # certificate authority certificates used to validate certs passed from the
285
- # other end of the connection. One of :ssl_ca_cert, :ssl_ca_cert_string or
286
- # :ssl_ca_cert_object (in order of priority) is required for :ssl_verify.
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. This option, if present, takes precedence
289
- # over the values of :ssl_cert_string and :ssl_cert_object
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. This option, if present,
294
- # takes precedence over the value of :ssl_cert_object
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(REROUTE)
124
- server = cluster.next_primary(false)
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(REROUTE)
236
- server = cluster.next_primary(false)
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 option is
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] == true ? @ssl_options : {}
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
@@ -93,7 +93,6 @@ module Mongo
93
93
  @monitoring = server.monitoring
94
94
  @options = options.freeze
95
95
  @server = server
96
- @ssl_options = options.select { |k, v| k.to_s.start_with?(SSL) }.freeze
97
96
  @socket = nil
98
97
  @last_checkin = nil
99
98
  @auth_mechanism = nil
@@ -114,7 +114,6 @@ module Mongo
114
114
  @address = address
115
115
  @options = options.freeze
116
116
  @app_metadata = options[:app_metadata]
117
- @ssl_options = options.reject { |k, v| !k.to_s.start_with?(SSL) }
118
117
  @socket = nil
119
118
  @pid = Process.pid
120
119
  @compressor = nil
@@ -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
- context.cert = OpenSSL::X509::Certificate.new(File.open(options[:ssl_cert]))
154
- elsif options[:ssl_cert_string]
155
- context.cert = OpenSSL::X509::Certificate.new(options[:ssl_cert_string])
156
- elsif options[:ssl_cert_object]
157
- context.cert = options[:ssl_cert_object]
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 = passphrase ? OpenSSL::PKey.read(File.open(options[:ssl_key]), passphrase) :
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 = passphrase ? OpenSSL::PKey.read(options[:ssl_key_string], passphrase) :
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.add_cert(OpenSSL::X509::Certificate.new(File.open(options[:ssl_ca_cert])))
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
@@ -17,5 +17,5 @@ module Mongo
17
17
  # The current version of the driver.
18
18
  #
19
19
  # @since 2.0.0
20
- VERSION = '2.9.0.rc0'.freeze
20
+ VERSION = '2.9.0.rc1'.freeze
21
21
  end
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. The server can be started as
88
- follows, if the current directory is the top of the driver source tree:
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
- require_no_ssl
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
- require_ssl
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. Because we don't
5
- # currently have a way to create what the URI would look like for a given client, it's simpler
6
- # just to test the that TLS works when configured from a URI on a standalone server without auth
7
- # required, since that allows us to build the URI more easily.
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
- require_ssl
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.client_cert_key_pem}"
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
@@ -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
- :ssl => true,
322
- :ssl_ca_cert => CA_PEM,
323
- :ssl_ca_cert_string => 'ca cert string',
324
- :ssl_ca_cert_object => 'ca cert object',
325
- :ssl_cert => CLIENT_CERT_PEM,
326
- :ssl_cert_string => 'cert string',
327
- :ssl_cert_object => 'cert object',
328
- :ssl_key => CLIENT_KEY_PEM,
329
- :ssl_key_string => 'key string',
330
- :ssl_key_object => 'key object',
331
- :ssl_key_pass_phrase => 'passphrase',
332
- :ssl_verify => true
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'], SpecConfig.instance.test_options.merge(options))
337
+ new_local_client_nmio(['127.0.0.1:27017'], options)
338
338
  end
339
339
 
340
340
  it 'sets the ssl option' do