Skip to content

Commit 5d44daa

Browse files
committed
Remove SSL hostname verification bypass
1 parent 6fa902f commit 5d44daa

4 files changed

Lines changed: 1 addition & 96 deletions

File tree

32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.

iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/NoHostnameVerificationTrustManager.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/Utils.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555

5656
import javax.net.ssl.KeyManager;
5757
import javax.net.ssl.TrustManager;
58-
import javax.net.ssl.X509TrustManager;
5958

6059
import java.io.File;
6160
import java.io.FileNotFoundException;
@@ -368,14 +367,8 @@ public static Parameters initRatisConfig(RaftProperties properties, RatisConfig
368367
String trustStorePassword = config.getGrpc().getSslTrustStorePassword();
369368
try {
370369
KeyManager keyManager = RpcSslUtils.createKeyManagers(keyStorePath, keyStorePassword)[0];
371-
TrustManager originalTrustManager =
372-
RpcSslUtils.createTrustManagers(trustStorePath, trustStorePassword)[0];
373-
374-
// The self-signed certification may not set Subject Alternative Name (SAN)
375-
// Thrift with ssl didn't check it, but Grpc did.
376-
// Wrap to disable the verification
377370
TrustManager trustManager =
378-
new NoHostnameVerificationTrustManager((X509TrustManager) originalTrustManager);
371+
RpcSslUtils.createTrustManagers(trustStorePath, trustStorePassword)[0];
379372
GrpcConfigKeys.TLS.setConf(parameters, new GrpcTlsConfig(keyManager, trustManager, true));
380373
} catch (AccessDeniedException e) {
381374
LOGGER.error(ConsensusMessages.FAILED_TO_LOAD_KEYSTORE);

0 commit comments

Comments
 (0)