@@ -104,7 +104,13 @@ public void initializeSslSocketFactory() throws Exception {
104104 builder .put ("xpack.security.authc.realms." + REALM_NAME + ".ssl.truststore.path" , truststore );
105105 mockSecureSettings .setString ("xpack.security.authc.realms." + REALM_NAME + ".ssl.truststore.secure_password" , "changeit" );
106106 builder .put ("xpack.security.authc.realms." + REALM_NAME + ".ssl.verification_mode" , VerificationMode .CERTIFICATE );
107+
108+ // If not using global ssl, need to set the truststore for the "full verification" realm
109+ builder .put ("xpack.security.authc.realms.vmode_full.ssl.truststore.path" , truststore );
110+ mockSecureSettings .setString ("xpack.security.authc.realms.vmode_full.ssl.truststore.secure_password" , "changeit" );
107111 }
112+ builder .put ("xpack.security.authc.realms.vmode_full.ssl.verification_mode" , VerificationMode .FULL );
113+
108114 globalSettings = builder .setSecureSettings (mockSecureSettings ).build ();
109115 Environment environment = TestEnvironment .newEnvironment (globalSettings );
110116 sslService = new SSLService (globalSettings , environment );
@@ -188,10 +194,10 @@ public void testStandardLdapConnectionHostnameVerificationFailure() throws Excep
188194 Settings settings = Settings .builder ()
189195 // The certificate used in the vagrant box is valid for "localhost", but not for "127.0.0.1"
190196 .put (buildLdapSettings (OPEN_LDAP_IP_URL , userTemplate , groupSearchBase , LdapSearchScope .ONE_LEVEL ))
191- .put ("ssl.verification_mode" , VerificationMode .FULL )
192197 .build ();
193198
194- RealmConfig config = new RealmConfig ("oldap-test" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
199+ // Pick up the "full" verification mode config
200+ RealmConfig config = new RealmConfig ("vmode_full" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
195201 new ThreadContext (Settings .EMPTY ));
196202 LdapSessionFactory sessionFactory = new LdapSessionFactory (config , sslService , threadPool );
197203
@@ -211,10 +217,10 @@ public void testStandardLdapConnectionHostnameVerificationSuccess() throws Excep
211217 Settings settings = Settings .builder ()
212218 // The certificate used in the vagrant box is valid for "localhost" (but not for "127.0.0.1")
213219 .put (buildLdapSettings (OPEN_LDAP_DNS_URL , userTemplate , groupSearchBase , LdapSearchScope .ONE_LEVEL ))
214- .put ("ssl.verification_mode" , VerificationMode .FULL )
215220 .build ();
216221
217- RealmConfig config = new RealmConfig ("oldap-test" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
222+ // Pick up the "full" verification mode config
223+ RealmConfig config = new RealmConfig ("vmode_full" , settings , globalSettings , TestEnvironment .newEnvironment (globalSettings ),
218224 new ThreadContext (Settings .EMPTY ));
219225 LdapSessionFactory sessionFactory = new LdapSessionFactory (config , sslService , threadPool );
220226
0 commit comments