From bf39c71d2a51a9bd48ce8971060442e29a721b2f Mon Sep 17 00:00:00 2001 From: Parth Agrawal <98726675+pagrawal10@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:58:11 +0530 Subject: [PATCH] Update protocol for MemcachedCache (#16035) --- .../main/java/org/apache/druid/client/cache/MemcachedCache.java | 2 +- .../java/org/apache/druid/client/cache/MemcachedCacheTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java b/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java index d67e01b110b..d5849fad99e 100644 --- a/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java +++ b/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java @@ -413,7 +413,7 @@ public class MemcachedCache implements Cache // Build SSLContext TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init((KeyStore) null); - SSLContext sslContext = SSLContext.getInstance("TLS"); + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, tmf.getTrustManagers(), null); // Create the client in TLS mode connectionFactoryBuilder.setSSLContext(sslContext); diff --git a/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java b/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java index ceb3a828772..d7748c7e48f 100644 --- a/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java +++ b/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java @@ -254,6 +254,8 @@ public class MemcachedCacheTest Assert.assertEquals(connectionFactoryDynamic.getClientMode(), ClientMode.Dynamic); //enableTls is true so sslContext is not null Assert.assertNotNull(connectionFactoryDynamic.getSSLContext()); + // Ensure Protocol is TLSv1.2 + Assert.assertEquals("TLSv1.2", connectionFactoryDynamic.getSSLContext().getProtocol()); } @Test