tree: c9380d12236a7e37f8d5246ec582f04d50b97f36
  1. cert.pem
  2. client-cert.pem
  3. client-key.pem
  4. key.pem
  5. README.md
tests/fixtures/tls/README.md

TLS test fixtures

Self-signed certificates + PKCS#8 keys used only by the loopback TLS tests (connection::tls_tests, cargo feature tls) and the opt-in live TLS test. Not secrets — the keys never protect anything.

FileRole
cert.pem + key.pemserver identity (loopback rustls server, live-server keystore)
client-cert.pem + client-key.pemclient identity for the mutual-TLS tests

The current server certificate expires 2028-11-09. Regenerate it before then with the extensions required by the WebPKI verifier:

cd tests/fixtures/tls
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
  -days 820 -nodes -subj "/CN=localhost" \
  -addext "basicConstraints=critical,CA:FALSE" \
  -addext "subjectAltName=DNS:localhost,IP:127.0.0.1" \
  -addext "extendedKeyUsage=serverAuth" \
  -addext "keyUsage=critical,digitalSignature,keyEncipherment"

The client certificate (expires 2028-11-09 as well) is a standalone self-signed client identity. The rustls loopback server explicitly trusts it and requires it during the mutual-TLS test:

cd tests/fixtures/tls
openssl req -x509 -newkey rsa:2048 -keyout client-key.pem -out client-cert.pem \
  -days 820 -nodes -subj "/CN=iotdb-client-rust-test-client" \
  -addext "basicConstraints=critical,CA:FALSE" \
  -addext "extendedKeyUsage=clientAuth" \
  -addext "keyUsage=critical,digitalSignature,keyEncipherment"

Live TLS server keystore

The end-to-end test (live_tls_roundtrip, gated by IOTDB_TLS_URL) needs a TLS-enabled IoTDB. Build a PKCS#12 keystore from the server fixture pair (regenerate whenever cert.pem is regenerated; not checked in):

cd tests/fixtures/tls
openssl pkcs12 -export -in cert.pem -inkey key.pem \
  -out server-keystore.p12 -name iotdb -passout pass:iotdbtls

Then run a throwaway TLS-enabled server and point the test at it (the docker env-var mechanism appends any lowercase var to iotdb-system.properties; IoTDB ≥ 2.x reads enable_thrift_ssl, key_store_path, key_store_pwd — client RPC port only, internal cluster ports stay plain):

docker run -d --name iotdb-rust-tls-test -p 6668:6667 \
  -e enable_thrift_ssl=true \
  -e key_store_path=/tls/server-keystore.p12 \
  -e key_store_pwd=iotdbtls \
  -v "$PWD/server-keystore.p12":/tls/server-keystore.p12:ro \
  apache/iotdb:2.0.6-standalone

IOTDB_TLS_URL=127.0.0.1:6668 \
IOTDB_TLS_CA=tests/fixtures/tls/cert.pem \
cargo test --features tls live_tls_roundtrip

docker rm -f iotdb-rust-tls-test