/** * @throws Exception If failed. */ @Test public void testNoCommonCipherSuite() throws Exception { cipherSuites = new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkClientStartFailure( new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }, null ); }
/** * @throws Exception If failed. */ @Test public void testSameProtocols() throws Exception { protocols = new String[] { "TLSv1.1", "TLSv1.2" }; startGrid(); checkSuccessfulClientStart(null, new String[] { "TLSv1.1", "TLSv1.2" } ); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stopAllGrids(); protocols = null; cipherSuites = null; }
/** * @return Client config. */ protected ClientConfiguration getClientConfiguration() { ClientConfiguration cfg = new ClientConfiguration(); cfg.setAddresses("127.0.0.1:10800"); cfg.setSslMode(SslMode.REQUIRED); cfg.setSslContextFactory(createSslFactory()); return cfg; }
@Override public Object call() { Ignition.startClient(getClientConfiguration()); return null; } },
/** * @param cipherSuites list of cipher suites * @param protocols list of protocols */ private void checkClientStartFailure(String[] cipherSuites, String[] protocols) { checkClientStartFailure( cipherSuites, protocols, ClientConnectionException.class, "Ignite cluster is unavailable" ); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() .setSslEnabled(true) .setUseIgniteSslContextFactory(true)); cfg.setSslContextFactory(createSslFactory()); CacheConfiguration ccfg = new CacheConfiguration(TEST_CACHE_NAME); cfg.setCacheConfiguration(ccfg); return cfg; }
/** * @param cipherSuites list of cipher suites * @param protocols list of protocols * @throws Exception If failed. */ private void checkSuccessfulClientStart(String[] cipherSuites, String[] protocols) throws Exception { this.cipherSuites = F.isEmpty(cipherSuites) ? null : cipherSuites; this.protocols = F.isEmpty(protocols) ? null : protocols; try (IgniteClient client = Ignition.startClient(getClientConfiguration())) { client.getOrCreateCache(TEST_CACHE_NAME); } }
/** * @throws Exception If failed. */ @Test public void testOneCommonProtocol() throws Exception { protocols = new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }; startGrid(); checkSuccessfulClientStart(null, new String[] { "TLSv1.1", "SSLv3" } ); }
/** * @throws Exception If failed. */ @Test public void testNoCommonProtocols() throws Exception { protocols = new String[] { "TLSv1.1", "SSLv3" }; startGrid(); checkClientStartFailure( null, new String[] { "TLSv1", "TLSv1.2" } ); }
/** * @throws Exception If failed. */ @Test public void testOneCommonCipherSuite() throws Exception { cipherSuites = new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkSuccessfulClientStart( new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }, null ); }
/** * @throws Exception If failed. */ @Test public void testNonExistentProtocol() throws Exception { protocols = new String[] { "SSLv3" }; startGrid(); checkClientStartFailure( null, new String[] { "SSLv3", "SSLvDoesNotExist" }, IllegalArgumentException.class, "SSLvDoesNotExist" ); }
/** * @throws Exception If failed. */ @Test public void testSameCipherSuite() throws Exception { cipherSuites = new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkSuccessfulClientStart( new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }, null ); }
/** * @throws Exception If failed. */ @Test public void testNonExistentCipherSuite() throws Exception { cipherSuites = new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkClientStartFailure( new String[] { "TLC_FAKE_CIPHER", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }, null, IllegalArgumentException.class, "Unsupported ciphersuite" ); }