Add TLS channel failure reporting hooks#18299
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds internal (non-user-facing) hooks to report SSL/TLS channel setup failures with both initiator and target endpoints, integrating the reporting into existing audit logging and wiring it through key outbound/inbound transport entry points (Thrift RPC, MPP exchange, consensus RPC, and REST over Jetty HTTPS).
Changes:
- Introduces a shared
TrustedChannelFailureHandlercallback andAbstractAuditLoggerhelpers to detect SSL failures (via cause chain) and emit a trusted-channel failure audit record. - Adds server-side TLS handshake probing/reporting via
TrustedChannelAuditServerEventHandlerfor Thrift services and a JettySslHandshakeListenerimplementation for REST HTTPS. - Wires failure reporting into multiple outbound request paths (clients/dispatchers/handlers) and consensus configuration, plus adds unit tests and i18n message constants.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Adds Jetty jetty-io to dependency management for HTTPS handshake listener support. |
| iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/service/TrustedChannelAuditServerEventHandlerTest.java | Unit tests for server-side Thrift TLS handshake reporting behavior. |
| iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/audit/AbstractAuditLoggerTest.java | Unit tests for SSL failure detection and trusted-channel audit recording. |
| iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/TrustedChannelAuditServerEventHandler.java | Server-side Thrift event handler to force handshake and report failures with endpoints. |
| iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/client/request/AsyncRequestManager.java | Adds an extensibility hook (onRequestFailure) for request-failure reporting. |
| iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/TrustedChannelFailureHandler.java | New shared callback interface for trusted-channel failure reporting. |
| iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/AuditEventType.java | Replaces the prior session-specific encrypt failure event with a generalized trusted-channel event. |
| iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/AbstractAuditLogger.java | Adds SSL-failure detection and a trusted-channel failure audit log emission path (with i18n). |
| iotdb-core/node-commons/src/main/i18n/zh/org/apache/iotdb/commons/i18n/CommonMessages.java | Adds zh i18n template for the trusted-channel failure audit log message. |
| iotdb-core/node-commons/src/main/i18n/en/org/apache/iotdb/commons/i18n/CommonMessages.java | Adds en i18n template for the trusted-channel failure audit log message. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java | Wraps external RPC service handler with the trusted-channel server-side audit handler. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java | Wraps internal RPC service handler with the trusted-channel server-side audit handler. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/FragmentInstanceDispatcherImpl.java | Records trusted-channel failures on dispatch exceptions to remote nodes. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncSendPlanNodeHandler.java | Records trusted-channel failures on async plan-node send errors (captures target endpoint). |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncPlanNodeSender.java | Passes target endpoint into the async send handler for accurate failure reporting. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/source/SourceHandle.java | Records trusted-channel failures on MPP source exchange RPC errors. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/sink/SinkChannel.java | Records trusted-channel failures on MPP sink exchange RPC errors. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java | Wraps MPP exchange service handler with the trusted-channel server-side audit handler. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/dn/AsyncTSStatusRPCHandler.java | Records trusted-channel failures on async TSStatus RPC failures. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java | Records trusted-channel failures when connecting/retrying ConfigNode RPC calls. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/an/AINodeClient.java | Records trusted-channel failures when connecting/retrying AINode RPC calls. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java | Plumbs trusted-channel failure handler into consensus config creation. |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/DNAuditLogger.java | Adds a DataNode-side convenience overload to record failures with inferred local endpoint. |
| iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/service/IoTConsensusV2RPCService.java | Wraps IoTConsensusV2 RPC handler with trusted-channel server-side audit handler; accepts callback. |
| iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/IoTConsensusV2.java | Passes trusted-channel failure handler into IoTConsensusV2 RPC service construction. |
| iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCService.java | Wraps IoTConsensus RPC handler with trusted-channel server-side audit handler; accepts callback. |
| iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java | Passes trusted-channel failure handler into IoTConsensus RPC service construction. |
| iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/ConsensusConfig.java | Adds trusted-channel failure handler to consensus config with NO_OP default and builder setter. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java | Wraps ConfigNode RPC handler with trusted-channel server-side audit handler. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java | Records trusted-channel failures during ConfigNode→DataNode sync request retries. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java | Hooks async request failures to ConfigNode audit logger via the new onRequestFailure extension point. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeHeartbeatClientPool.java | Records trusted-channel failures during async heartbeat dispatch failures. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/audit/CNAuditLogger.java | Adds a ConfigNode-side convenience overload to record failures with inferred local endpoint. |
| external-service-impl/rest/src/test/java/org/apache/iotdb/rest/TrustedChannelAuditHandshakeListenerTest.java | Unit test for capturing endpoints on Jetty HTTPS handshake failures. |
| external-service-impl/rest/src/main/java/org/apache/iotdb/rest/TrustedChannelAuditHandshakeListener.java | Jetty SslHandshakeListener implementation to report TLS handshake failures with endpoints. |
| external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java | Installs the Jetty handshake listener for REST HTTPS connector TLS failures. |
| external-service-impl/rest/pom.xml | Adds Jetty jetty-io dependency required by the handshake listener types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18299 +/- ##
============================================
+ Coverage 42.99% 43.04% +0.05%
- Complexity 374 377 +3
============================================
Files 5362 5365 +3
Lines 381410 381854 +444
Branches 49512 49574 +62
============================================
+ Hits 164003 164387 +384
- Misses 217407 217467 +60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|




Description
This PR adds internal hooks for reporting SSL/TLS channel setup failures together with the initiator and target endpoints. It does not add or expose a new logging or persistence surface.
Failure context
Transport coverage
Validation
mvn test -pl iotdb-core/node-commons -Dtest=AbstractAuditLoggerTest,TrustedChannelAuditServerEventHandlerTestmvn test -pl external-service-impl/rest -am -Dtest=TrustedChannelAuditHandshakeListenerTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=falsemvn test-compile -DskipTests -pl external-service-impl/rest -ammvn test-compile -P with-zh-locale -DskipTests -pl external-service-impl/rest -ammvn dependency:analyze-only -pl external-service-impl/rest -DskipTestsgit diff --checkThis PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
AbstractAuditLoggerTrustedChannelFailureHandlerTrustedChannelAuditServerEventHandlerTrustedChannelAuditHandshakeListenerConsensusConfig