You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "hongzhi-gao (via GitHub)" <gi...@apache.org> on 2026/07/07 02:31:30 UTC
[PR] Add TLS/TLCP SSL support to the C++ client with bundled Tongsuo [iotdb]
hongzhi-gao opened a new pull request, #18130:
URL: https://github.com/apache/iotdb/pull/18130
Add NTLS (TLCP) support to the C++ client. Tongsuo is chosen because it is Apache-2.0 licensed and provides both standard TLS and NTLS in one OpenSSL-compatible stack; it is built from source by default and bundled into the SDK.
## Description
### NTLS / TLCP client support
- Extend C++ and C Session builders with `sslProtocol` (`TLS` / `TLCP`), PKCS12 `trustStore` / `keyStore`, mirroring the Java Session API.
- `RpcSslUtils` wires Thrift `TSSLSocket` for TLS and TLCP (including dual SM2 PKCS12 for mutual auth).
### Why Tongsuo
- **License**: Apache-2.0, suitable for bundling in the IoTDB SDK.
- **Protocol coverage**: one dependency covers both TLS and NTLS; no separate GM/T stack.
- Built from `8.4-stable` at configure time (`WITH_SSL=ON`, default); `libssl` / `libcrypto` shipped in the SDK package.
### Tests & CI
- CTest phases: `plain` → `ssl` (IoTDB TLS) → `ntls` (`openssl s_server`).
- TLS/TLCP examples and Catch2 unit/e2e tests with committed PKCS12 fixtures.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added documentation for new or modified features or behaviors.
- [x] added or updated version, __license__, or notice information
- [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
- [x] added integration tests.
- [x] been tested in a test IoTDB cluster.
<hr>
##### Key changed/added classes
- `RpcSslUtils.{h,cpp}` — TLS/TLCP SSL context and Thrift factory
- `SessionBuilder.h`, `SessionC.{h,cpp}` — client SSL configuration API
- `cmake/FetchOpenSSL.cmake` — Tongsuo source build and SDK bundling
- `test/scripts/run_cpp_it_phases.py` — plain / TLS / NTLS IT phases
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TLS/TLCP SSL support to the C++ client with bundled Tongsuo [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #18130:
URL: https://github.com/apache/iotdb/pull/18130#issuecomment-4900823518
I reviewed this PR locally against head `696ca4872a2a5c03635048a8a990c49b7e1d54b5`. I think there are a few issues worth addressing before merge:
1. `trustStore` does not actually enable server certificate verification in the Thrift socket path.
`RpcSslUtils::createTlsClientContext()` / `createTlcpClientContext()` load the trust store and set `SSL_VERIFY_PEER`, but `RpcSslUtils::createSslSocketFactory()` then calls `factory->authenticate(false)`. In Thrift `TSSLSocketFactory::authenticate(false)` resets the context verify mode to `SSL_VERIFY_NONE`, so the configured trust store is effectively bypassed for normal `Session` / `ThriftConnection` connections. This means the documented TLS one-way/server-authentication and TLCP trust-store behavior is not enforced. The current handshake tests use `SSL_connect` directly, so they do not cover this Thrift socket factory path.
Could we make this conditional, for example call `authenticate(true)` when `config.effectiveTrustStore()` is set and keep `authenticate(false)` only for the legacy no-trust-store mode? It would also be good to add a Session/Thrift-level negative test where a wrong CA must fail.
2. The bundled Tongsuo source is not pinned to an immutable artifact.
`TONGSUO_GIT_REF` defaults to `8.4-stable`, and `FetchOpenSSL.cmake` downloads the branch tarball without an expected hash. Since that branch can move, the same IoTDB commit can produce different SDK binaries over time, which is risky for release reproducibility and dependency auditing. Please consider pinning a tag/commit and verifying the tarball hash.
3. The packaged SDK examples are inconsistent with the updated examples README.
`examples/README.md` documents `cpp_tls_example`, `cpp_ntls_example`, `tls_tree_example`, and `c_ntls_example`, but `src/assembly/client-cpp.xml` only packages the older example sources. Also, `examples/CMakeLists.txt` only creates the new TLS/TLCP example targets in the in-tree build path. After users unpack the released SDK zip, the documented TLS/TLCP examples are not available/buildable from the package.
4. Architectural question: should Tongsuo be the default SSL provider for all C++ SDK builds?
Since most users only need standard TLS, would it be possible to keep the default SDK on upstream OpenSSL and provide a Tongsuo/TLCP-specific build flavor only when TLCP is requested? For example, an explicit provider option/classifier such as `IOTDB_SSL_PROVIDER=TONGSUO` or a separate TLCP package could keep the default TLS path simpler, reduce the default dependency/build-toolchain surface, and limit the impact of Tongsuo to users who actually need TLCP.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TLS/TLCP SSL support to the C++ client with bundled Tongsuo [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #18130:
URL: https://github.com/apache/iotdb/pull/18130#issuecomment-4900918774
One more API/UX note about the new `trustStore` / `keyStore` naming:
It is reasonable to align the C++ Session API with the Java Session API, but in the C/C++ ecosystem this naming can be ambiguous. Some C/C++ clients use similar names, but often with different semantics. For example, Paho MQTT C has `trustStore` / `keyStore` fields but they point to PEM files, while librdkafka supports a PKCS#12 `ssl.keystore.location` for client authentication but still uses CA-style options such as `ssl.ca.location` / `ssl.ca.pem` for server trust. Many C++ APIs instead expose OpenSSL-style inputs directly (`ca/root certs`, `cert chain`, `private key`).
So if this PR keeps the Java-style names, please make the boundary explicit in docs and errors: JKS is not supported by the C++ client; `.p12` / `.pfx` means PKCS#12, and PEM trust files are only supported through the legacy/path-style option. It may also be useful to keep or add OpenSSL-style configuration names (`caFile`, `certFile`, `keyFile`, etc.) so native C++ users do not have to think in Java keystore terms when they already have PEM material.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TLS/TLCP SSL support to the C++ client with bundled Tongsuo [iotdb]
Posted by "hongzhi-gao (via GitHub)" <gi...@apache.org>.
hongzhi-gao closed pull request #18130: Add TLS/TLCP SSL support to the C++ client with bundled Tongsuo
URL: https://github.com/apache/iotdb/pull/18130
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org