File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -215,8 +215,30 @@ def test_bind_tls_with_multiple_bogus_hosts_ca_check_only_fails
215
215
def test_bind_tls_valid_hostname_system_ca_on_travis_passes
216
216
omit_unless ENV [ 'TRAVIS' ] == 'true'
217
217
218
- @ldap . encryption ( method : :start_tls , tls_options : { } )
218
+ @ldap . encryption (
219
+ method : :start_tls ,
220
+ tls_options : { verify_mode : OpenSSL ::SSL ::VERIFY_PEER } ,
221
+ )
219
222
assert @ldap . bind ( BIND_CREDS ) ,
220
223
@ldap . get_operation_result . inspect
221
224
end
225
+
226
+ # Inverse of the above! Don't run this on Travis, only on Vagrant.
227
+ # Since Vagrant's hypervisor *won't* have the CA in the system
228
+ # x509 store, we can assume validation will fail
229
+ def test_bind_tls_valid_hostname_system_on_vagrant_fails
230
+ omit_if ENV [ 'TRAVIS' ] == 'true'
231
+
232
+ @ldap . encryption (
233
+ method : :start_tls ,
234
+ tls_options : { verify_mode : OpenSSL ::SSL ::VERIFY_PEER } ,
235
+ )
236
+ error = assert_raise Net ::LDAP ::Error do
237
+ @ldap . bind BIND_CREDS
238
+ end
239
+ assert_equal (
240
+ "SSL_connect returned=1 errno=0 state=error: certificate verify failed" ,
241
+ error . message ,
242
+ )
243
+ end
222
244
end
You can’t perform that action at this time.
0 commit comments