This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch ssl_between_nodes
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit b9554ef413812928e99af7f7ecdec5fcfeb895dc
Author: HTHou <[email protected]>
AuthorDate: Mon Jun 16 12:18:56 2025 +0800

    developing...
---
 .../service/thrift/ConfigNodeRPCService.java       | 39 ++++++++----
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 33 ----------
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  | 10 +--
 .../execution/exchange/MPPDataExchangeService.java | 45 ++++++++++----
 .../db/service/DataNodeInternalRPCService.java     | 48 ++++++++++-----
 .../iotdb/db/service/ExternalRPCService.java       | 71 +++++++++++-----------
 .../conf/iotdb-system.properties.template          | 13 +++-
 .../apache/iotdb/commons/conf/CommonConfig.java    | 55 +++++++++++++++++
 .../iotdb/commons/conf/CommonDescriptor.java       |  8 +++
 .../service/AbstractThriftServiceThread.java       |  3 +
 .../iotdb/commons/service/ThriftServiceThread.java | 37 +++++++++++
 11 files changed, 246 insertions(+), 116 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java
index 77134444030..33710cb7594 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java
@@ -61,17 +61,34 @@ public class ConfigNodeRPCService extends ThriftService 
implements ConfigNodeRPC
 
     try {
       thriftServiceThread =
-          new ThriftServiceThread(
-              processor,
-              getID().getName(),
-              ThreadName.CONFIGNODE_RPC_PROCESSOR.getName(),
-              getBindIP(),
-              getBindPort(),
-              configConf.getCnRpcMaxConcurrentClientNum(),
-              configConf.getThriftServerAwaitTimeForStopService(),
-              new ConfigNodeRPCServiceHandler(),
-              commonConfig.isRpcThriftCompressionEnabled(),
-              DeepCopyRpcTransportFactory.INSTANCE);
+          commonConfig.isEnableSSL()
+              ? new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.CONFIGNODE_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  configConf.getCnRpcMaxConcurrentClientNum(),
+                  configConf.getThriftServerAwaitTimeForStopService(),
+                  new ConfigNodeRPCServiceHandler(),
+                  commonConfig.isRpcThriftCompressionEnabled(),
+                  commonConfig.getKeyStorePath(),
+                  commonConfig.getKeyStorePwd(),
+                  commonConfig.getTrustStorePath(),
+                  commonConfig.getTrustStorePwd(),
+                  commonConfig.getCnConnectionTimeoutInMS(),
+                  DeepCopyRpcTransportFactory.INSTANCE)
+              : new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.CONFIGNODE_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  configConf.getCnRpcMaxConcurrentClientNum(),
+                  configConf.getThriftServerAwaitTimeForStopService(),
+                  new ConfigNodeRPCServiceHandler(),
+                  commonConfig.isRpcThriftCompressionEnabled(),
+                  DeepCopyRpcTransportFactory.INSTANCE);
     } catch (RPCServiceException e) {
       throw new IllegalAccessException(e.getMessage());
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 8137959a391..0cd338bf8f3 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -134,15 +134,6 @@ public class IoTDBConfig {
   /** Port which the JDBC server listens to. */
   private int rpcPort = 6667;
 
-  /** Enable the thrift rpcPort Service ssl. */
-  private boolean enableSSL = false;
-
-  /** ssl key Store Path. */
-  private String keyStorePath = "";
-
-  /** ssl key Store password. */
-  private String keyStorePwd = "";
-
   /** Rpc Selector thread num */
   private int rpcSelectorThreadCount = 1;
 
@@ -1261,30 +1252,6 @@ public class IoTDBConfig {
     this.udfCollectorMemoryBudgetInMB = udfCollectorMemoryBudgetInMB;
   }
 
-  public boolean isEnableSSL() {
-    return enableSSL;
-  }
-
-  public void setEnableSSL(boolean enableSSL) {
-    this.enableSSL = enableSSL;
-  }
-
-  public String getKeyStorePath() {
-    return keyStorePath;
-  }
-
-  public void setKeyStorePath(String keyStorePath) {
-    this.keyStorePath = keyStorePath;
-  }
-
-  public String getKeyStorePwd() {
-    return keyStorePwd;
-  }
-
-  public void setKeyStorePwd(String keyStorePwd) {
-    this.keyStorePwd = keyStorePwd;
-  }
-
   public int getUdfInitialByteArrayLengthForMemoryControl() {
     return udfInitialByteArrayLengthForMemoryControl;
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index dfd854f724c..8a4f3d1a4c2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -995,7 +995,7 @@ public class IoTDBDescriptor {
     loadUDFProps(properties);
 
     // Thrift ssl
-    initThriftSSL(properties);
+    commonDescriptor.initThriftSSL(properties);
 
     // Trigger
     loadTriggerProps(properties);
@@ -2375,14 +2375,6 @@ public class IoTDBDescriptor {
     }
   }
 
-  private void initThriftSSL(TrimProperties properties) {
-    conf.setEnableSSL(
-        Boolean.parseBoolean(
-            properties.getProperty("enable_thrift_ssl", 
Boolean.toString(conf.isEnableSSL()))));
-    conf.setKeyStorePath(properties.getProperty("key_store_path", 
conf.getKeyStorePath()));
-    conf.setKeyStorePwd(properties.getProperty("key_store_pwd", 
conf.getKeyStorePath()));
-  }
-
   private void loadTriggerProps(TrimProperties properties) {
     conf.setTriggerDir(properties.getProperty("trigger_lib_dir", 
conf.getTriggerDir()).trim());
     conf.setRetryNumToFindStatefulTrigger(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java
index 51feec4b805..9681896d823 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java
@@ -26,6 +26,8 @@ import 
org.apache.iotdb.commons.client.sync.SyncDataNodeMPPDataExchangeServiceCl
 import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
 import org.apache.iotdb.commons.concurrent.IoTThreadFactory;
 import org.apache.iotdb.commons.concurrent.ThreadName;
+import org.apache.iotdb.commons.conf.CommonConfig;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
 import org.apache.iotdb.commons.exception.runtime.RPCServiceException;
 import org.apache.iotdb.commons.service.ServiceType;
 import org.apache.iotdb.commons.service.ThriftService;
@@ -48,6 +50,9 @@ public class MPPDataExchangeService extends ThriftService 
implements MPPDataExch
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(MPPDataExchangeService.class);
 
+  private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
+  private static final CommonConfig commonConfig = 
CommonDescriptor.getInstance().getConfig();
+
   private final MPPDataExchangeManager mppDataExchangeManager;
   private final ExecutorService executorService;
 
@@ -87,19 +92,35 @@ public class MPPDataExchangeService extends ThriftService 
implements MPPDataExch
   @Override
   public void initThriftServiceThread() throws IllegalAccessException {
     try {
-      IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
       thriftServiceThread =
-          new ThriftServiceThread(
-              processor,
-              getID().getName(),
-              ThreadName.MPP_DATA_EXCHANGE_RPC_PROCESSOR.getName(),
-              getBindIP(),
-              getBindPort(),
-              config.getRpcMaxConcurrentClientNum(),
-              config.getThriftServerAwaitTimeForStopService(),
-              new MPPDataExchangeServiceThriftHandler(),
-              config.isRpcThriftCompressionEnable(),
-              DeepCopyRpcTransportFactory.INSTANCE);
+          commonConfig.isEnableSSL()
+              ? new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.MPP_DATA_EXCHANGE_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new MPPDataExchangeServiceThriftHandler(),
+                  config.isRpcThriftCompressionEnable(),
+                  commonConfig.getKeyStorePath(),
+                  commonConfig.getKeyStorePwd(),
+                  commonConfig.getTrustStorePath(),
+                  commonConfig.getTrustStorePwd(),
+                  config.getConnectionTimeoutInMS(),
+                  DeepCopyRpcTransportFactory.INSTANCE)
+              : new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.MPP_DATA_EXCHANGE_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new MPPDataExchangeServiceThriftHandler(),
+                  config.isRpcThriftCompressionEnable(),
+                  DeepCopyRpcTransportFactory.INSTANCE);
     } catch (RPCServiceException e) {
       throw new IllegalAccessException(e.getMessage());
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
index 9c8be161d85..08904b4e35a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
@@ -20,6 +20,8 @@
 package org.apache.iotdb.db.service;
 
 import org.apache.iotdb.commons.concurrent.ThreadName;
+import org.apache.iotdb.commons.conf.CommonConfig;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
 import org.apache.iotdb.commons.exception.runtime.RPCServiceException;
 import org.apache.iotdb.commons.service.ServiceType;
 import org.apache.iotdb.commons.service.ThriftService;
@@ -36,6 +38,9 @@ import org.apache.iotdb.rpc.DeepCopyRpcTransportFactory;
 public class DataNodeInternalRPCService extends ThriftService
     implements DataNodeInternalRPCServiceMBean {
 
+  private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
+  private static final CommonConfig commonConfig = 
CommonDescriptor.getInstance().getConfig();
+
   private DataNodeInternalRPCServiceImpl impl;
 
   private DataNodeInternalRPCService() {}
@@ -54,22 +59,37 @@ public class DataNodeInternalRPCService extends 
ThriftService
   }
 
   @Override
-  public void initThriftServiceThread()
-      throws IllegalAccessException, InstantiationException, 
ClassNotFoundException {
+  public void initThriftServiceThread() throws IllegalAccessException {
     try {
-      IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
       thriftServiceThread =
-          new ThriftServiceThread(
-              processor,
-              getID().getName(),
-              ThreadName.DATANODE_INTERNAL_RPC_PROCESSOR.getName(),
-              getBindIP(),
-              getBindPort(),
-              config.getRpcMaxConcurrentClientNum(),
-              config.getThriftServerAwaitTimeForStopService(),
-              new InternalServiceThriftHandler(),
-              config.isRpcThriftCompressionEnable(),
-              DeepCopyRpcTransportFactory.INSTANCE);
+          commonConfig.isEnableSSL()
+              ? new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.DATANODE_INTERNAL_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new InternalServiceThriftHandler(),
+                  config.isRpcThriftCompressionEnable(),
+                  commonConfig.getKeyStorePath(),
+                  commonConfig.getKeyStorePwd(),
+                  commonConfig.getTrustStorePath(),
+                  commonConfig.getTrustStorePwd(),
+                  config.getConnectionTimeoutInMS(),
+                  DeepCopyRpcTransportFactory.INSTANCE)
+              : new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.DATANODE_INTERNAL_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new InternalServiceThriftHandler(),
+                  config.isRpcThriftCompressionEnable(),
+                  DeepCopyRpcTransportFactory.INSTANCE);
     } catch (RPCServiceException e) {
       throw new IllegalAccessException(e.getMessage());
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java
index e54680dbd18..031bc4efbd5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java
@@ -19,6 +19,8 @@
 package org.apache.iotdb.db.service;
 
 import org.apache.iotdb.commons.concurrent.ThreadName;
+import org.apache.iotdb.commons.conf.CommonConfig;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
 import org.apache.iotdb.commons.exception.runtime.RPCServiceException;
 import org.apache.iotdb.commons.service.ServiceType;
 import org.apache.iotdb.commons.service.ThriftService;
@@ -37,6 +39,9 @@ import java.lang.reflect.InvocationTargetException;
 /** A service to handle RPC request from client. */
 public class ExternalRPCService extends ThriftService implements 
ExternalRPCServiceMBean {
 
+  private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
+  private static final CommonConfig commonConfig = 
CommonDescriptor.getInstance().getConfig();
+
   private IClientRPCServiceWithHandler impl;
 
   public static ExternalRPCService getInstance() {
@@ -52,47 +57,41 @@ public class ExternalRPCService extends ThriftService 
implements ExternalRPCServ
           InvocationTargetException {
     impl =
         (IClientRPCServiceWithHandler)
-            
Class.forName(IoTDBDescriptor.getInstance().getConfig().getRpcImplClassName())
-                .getDeclaredConstructor()
-                .newInstance();
+            
Class.forName(config.getRpcImplClassName()).getDeclaredConstructor().newInstance();
     initSyncedServiceImpl(null);
     processor = new ProcessorWithMetrics(impl);
   }
 
   @Override
   public void initThriftServiceThread() throws IllegalAccessException {
-    IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
     try {
-      if (config.isEnableSSL()) {
-        thriftServiceThread =
-            new ThriftServiceThread(
-                processor,
-                getID().getName(),
-                ThreadName.CLIENT_RPC_PROCESSOR.getName(),
-                config.getRpcAddress(),
-                config.getRpcPort(),
-                config.getRpcMaxConcurrentClientNum(),
-                config.getThriftServerAwaitTimeForStopService(),
-                new RPCServiceThriftHandler(impl),
-                
IoTDBDescriptor.getInstance().getConfig().isRpcThriftCompressionEnable(),
-                config.getKeyStorePath(),
-                config.getKeyStorePwd(),
-                config.getConnectionTimeoutInMS(),
-                ZeroCopyRpcTransportFactory.INSTANCE);
-      } else {
-        thriftServiceThread =
-            new ThriftServiceThread(
-                processor,
-                getID().getName(),
-                ThreadName.CLIENT_RPC_PROCESSOR.getName(),
-                config.getRpcAddress(),
-                config.getRpcPort(),
-                config.getRpcMaxConcurrentClientNum(),
-                config.getThriftServerAwaitTimeForStopService(),
-                new RPCServiceThriftHandler(impl),
-                
IoTDBDescriptor.getInstance().getConfig().isRpcThriftCompressionEnable(),
-                ZeroCopyRpcTransportFactory.INSTANCE);
-      }
+      thriftServiceThread =
+          commonConfig.isEnableSSL()
+              ? new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.CLIENT_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new RPCServiceThriftHandler(impl),
+                  config.isRpcThriftCompressionEnable(),
+                  commonConfig.getKeyStorePath(),
+                  commonConfig.getKeyStorePwd(),
+                  config.getConnectionTimeoutInMS(),
+                  ZeroCopyRpcTransportFactory.INSTANCE)
+              : new ThriftServiceThread(
+                  processor,
+                  getID().getName(),
+                  ThreadName.CLIENT_RPC_PROCESSOR.getName(),
+                  getBindIP(),
+                  getBindPort(),
+                  config.getRpcMaxConcurrentClientNum(),
+                  config.getThriftServerAwaitTimeForStopService(),
+                  new RPCServiceThriftHandler(impl),
+                  config.isRpcThriftCompressionEnable(),
+                  ZeroCopyRpcTransportFactory.INSTANCE);
     } catch (RPCServiceException e) {
       throw new IllegalAccessException(e.getMessage());
     }
@@ -102,12 +101,12 @@ public class ExternalRPCService extends ThriftService 
implements ExternalRPCServ
 
   @Override
   public String getBindIP() {
-    return IoTDBDescriptor.getInstance().getConfig().getRpcAddress();
+    return config.getRpcAddress();
   }
 
   @Override
   public int getBindPort() {
-    return IoTDBDescriptor.getInstance().getConfig().getRpcPort();
+    return config.getRpcPort();
   }
 
   @Override
diff --git 
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
 
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
index 48c97ad52d1..73479de8274 100644
--- 
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
+++ 
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
@@ -438,7 +438,7 @@ dn_metric_internal_reporter_type=MEMORY
 ### SSL Configuration
 ####################
 
-# Does dn_rpc_port enable SSL
+# Does IoTDB enable SSL
 # effectiveMode: restart
 # Datatype: boolean
 enable_thrift_ssl=false
@@ -459,6 +459,17 @@ key_store_path=
 # Datatype: String
 key_store_pwd=
 
+# SSL trust store path
+# linux e.g. /home/iotdb/server.truststore (absolute path) or 
server.truststore (relative path)
+# windows e.g. C:\\iotdb\\server.truststore (absolute path) or 
server.truststore (relative path)
+# effectiveMode: restart
+key_trust_path=
+
+# SSL trust store password
+# effectiveMode: restart
+# Datatype: String
+key_trust_pwd=
+
 ####################
 ### Connection Configuration
 ####################
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
index e5960a57c6b..038d401cb2c 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
@@ -404,6 +404,21 @@ public class CommonConfig {
 
   private volatile Pattern trustedUriPattern = Pattern.compile("file:.*");
 
+  /** Enable the thrift Service ssl. */
+  private boolean enableSSL = false;
+
+  /** ssl key Store Path. */
+  private String keyStorePath = "";
+
+  /** ssl key Store password. */
+  private String keyStorePwd = "";
+
+  /** ssl trust Store Path. */
+  private String trustStorePath = "";
+
+  /** ssl trust Store password. */
+  private String trustStorePwd = "";
+
   CommonConfig() {
     // Empty constructor
   }
@@ -2561,4 +2576,44 @@ public class CommonConfig {
   public void setTrustedUriPattern(Pattern trustedUriPattern) {
     this.trustedUriPattern = trustedUriPattern;
   }
+
+  public boolean isEnableSSL() {
+    return enableSSL;
+  }
+
+  public void setEnableSSL(boolean enableSSL) {
+    this.enableSSL = enableSSL;
+  }
+
+  public String getKeyStorePath() {
+    return keyStorePath;
+  }
+
+  public void setKeyStorePath(String keyStorePath) {
+    this.keyStorePath = keyStorePath;
+  }
+
+  public String getKeyStorePwd() {
+    return keyStorePwd;
+  }
+
+  public void setKeyStorePwd(String keyStorePwd) {
+    this.keyStorePwd = keyStorePwd;
+  }
+
+  public String getTrustStorePath() {
+    return trustStorePwd;
+  }
+
+  public void setTrustStorePath(String trustStorePath) {
+    this.trustStorePath = trustStorePath;
+  }
+
+  public String getTrustStorePwd() {
+    return trustStorePwd;
+  }
+
+  public void setTrustStorePwd(String trustStorePwd) {
+    this.trustStorePwd = trustStorePwd;
+  }
 }
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
index ab9348f9de3..89f84dea560 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
@@ -444,4 +444,12 @@ public class CommonDescriptor {
     config.setTagAttributeTotalSize(globalConfig.tagAttributeTotalSize);
     
config.setDiskSpaceWarningThreshold(globalConfig.getDiskSpaceWarningThreshold());
   }
+
+  public void initThriftSSL(TrimProperties properties) {
+    config.setEnableSSL(
+        Boolean.parseBoolean(
+            properties.getProperty("enable_thrift_ssl", 
Boolean.toString(config.isEnableSSL()))));
+    config.setKeyStorePath(properties.getProperty("key_store_path", 
config.getKeyStorePath()));
+    config.setKeyStorePwd(properties.getProperty("key_store_pwd", 
config.getKeyStorePath()));
+  }
 }
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/AbstractThriftServiceThread.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/AbstractThriftServiceThread.java
index 2afc66cfe7d..70ef38b09d0 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/AbstractThriftServiceThread.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/AbstractThriftServiceThread.java
@@ -167,6 +167,8 @@ public abstract class AbstractThriftServiceThread extends 
Thread {
       boolean compress,
       String keyStorePath,
       String keyStorePwd,
+      String trustStorePath,
+      String trustStorePwd,
       int clientTimeout,
       TTransportFactory transportFactory) {
     this.transportFactory = transportFactory;
@@ -177,6 +179,7 @@ public abstract class AbstractThriftServiceThread extends 
Thread {
       TSSLTransportFactory.TSSLTransportParameters params =
           new TSSLTransportFactory.TSSLTransportParameters();
       params.setKeyStore(keyStorePath, keyStorePwd);
+      params.setTrustStore(trustStorePath, trustStorePwd);
       params.requireClientAuth(false);
       InetSocketAddress socketAddress = new InetSocketAddress(bindAddress, 
port);
       serverTransport =
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ThriftServiceThread.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ThriftServiceThread.java
index 6a3f5ef42e7..aa53d8eee0f 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ThriftServiceThread.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ThriftServiceThread.java
@@ -62,6 +62,31 @@ public class ThriftServiceThread extends 
AbstractThriftServiceThread {
 
   /** for synced ThriftServiceThread */
   @SuppressWarnings("squid:S107")
+  public ThriftServiceThread(
+      TProcessor processor,
+      String serviceName,
+      String threadsName,
+      String bindAddress,
+      int port,
+      int maxWorkerThreads,
+      int timeoutSecond,
+      TServerEventHandler serverEventHandler,
+      boolean compress,
+      TTransportFactory transportFactory) {
+    super(
+        processor,
+        serviceName,
+        threadsName,
+        bindAddress,
+        port,
+        maxWorkerThreads,
+        timeoutSecond,
+        serverEventHandler,
+        compress,
+        transportFactory);
+  }
+
+  /** for synced ThriftServiceThread with ssl enabled */
   public ThriftServiceThread(
       TProcessor processor,
       String serviceName,
@@ -88,6 +113,8 @@ public class ThriftServiceThread extends 
AbstractThriftServiceThread {
         compress,
         keyStorePath,
         keyStorePwd,
+        null,
+        null,
         clientTimeout,
         transportFactory);
   }
@@ -102,6 +129,11 @@ public class ThriftServiceThread extends 
AbstractThriftServiceThread {
       int timeoutSecond,
       TServerEventHandler serverEventHandler,
       boolean compress,
+      String keyStorePath,
+      String keyStorePwd,
+      String trustStorePath,
+      String trustStorePwd,
+      int clientTimeout,
       TTransportFactory transportFactory) {
     super(
         processor,
@@ -113,6 +145,11 @@ public class ThriftServiceThread extends 
AbstractThriftServiceThread {
         timeoutSecond,
         serverEventHandler,
         compress,
+        keyStorePath,
+        keyStorePwd,
+        trustStorePath,
+        trustStorePwd,
+        clientTimeout,
         transportFactory);
   }
 }

Reply via email to