Repository navigation
feat: server-authenticated TLS for hotrods:// (issue #18) - #19
Merged
Merged
Conversation
Wrap client connections in a TLS session over OpenSSL (server-auth only, PEM trust material). The hotrods:// URI scheme no longer throws; TLS applies to every connection the client opens (seed + topology-discovered). - TlsConfig value type + RemoteCache::setTls(...) (mirrors setAuthentication), pushed down through MultiplexedConnection to Connection at the same build sites as auth/protocol/intelligence. - Connection::startTls(): TLS_client_method, min TLS 1.2, PEM ca_file (empty = system trust store), SSL_VERIFY_PEER always, SNI (skipped for literal IPs), host-name match via SSL_set1_host (toggle: hostname_validation, default on; chain verification unconditional). send/receive route through SSL_write/read. Quiet shutdown on teardown to avoid SIGPIPE writing close_notify to a dead peer. - HotRodURI: hotrods:// enables TLS; recognizes the three Java-named keys that map onto TlsConfig (trust_store_file_name -> ca_file [PEM], sni_host_name, ssl_hostname_validation). Other Java TLS keys (mutual TLS / keystore / cipher tuning) are rejected "not supported yet"; TLS params on hotrod:// error. - OpenSSL::SSL link is now live (was dead weight next to libcrypto). - Tests: TlsConnectionTest drives the real handshake against an in-process OpenSSL echo server with PEM fixtures (SAN=test.local); trusted/untrusted CA and host-name match on/off. HotRodURITest covers the URI surface. 260 unit tests green. Mutual TLS, keystore formats, and cipher/protocol tuning remain deferred (#10). Docs: STATUS (shipped + remaining), DECISIONS (dated rationale, supersedes the OpenSSL::SSL "dead weight" aside), README (feature + URI/setTls usage). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
End-to-end coverage against a real TLS-enabled Infinispan, mirroring the auth suite. New test-configs/infinispan-tls.xml (Hot Rod endpoint with a PKCS12 server identity, no SASL), scripts/start_infinispan_tls.sh, and PEM/PKCS12 fixtures under test-configs/tls/ (CA + server cert, SAN localhost/127.0.0.1). TlsIntegrationTest cases (all green against :latest): - programmatic setTls(ca) -> connect + PUT/GET round-trip over TLS; - hotrods://?trust_store_file_name=<ca> -> same round-trip; - untrusted anchor (empty CA -> system store) -> connect() throws; - host-name mismatch: validation on -> throws; off -> round-trip (chain still verified). Notes captured in DECISIONS: the mounted keystore must be world-readable (the in-container user can't read a 0600 :ro mount), and keystore-password is deprecated in favor of password. Also surfaced a library-robustness follow-up: a dropped TLS connection can raise SIGPIPE on a client write; both test mains install SIG_IGN, and whether the library should be SIGPIPE-safe by default is left as an open item. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…IGN) A write onto a dropped TLS peer raised SIGPIPE, whose default disposition kills the process (the integration suite died with exit 141). The Java client avoids this only because the JVM sets SIGPIPE to SIG_IGN process-wide at startup — a runtime/process-owner decision. This client is a guest in someone else's process and must not flip global signal state (it would, e.g., break a CLI tool relying on shell-pipeline SIGPIPE semantics). So suppress SIGPIPE per connection instead: - plain send() uses MSG_NOSIGNAL on Linux (HOTROD_SEND_FLAGS); - macOS/BSD set SO_NOSIGPIPE on the socket (covers OpenSSL writes too); - the Linux TLS path routes all OpenSSL socket I/O through a custom MSG_NOSIGNAL BIO, covering SSL_write plus the writes SSL_connect/SSL_read trigger internally; - Windows is unaffected (no SIGPIPE) and keeps SSL_set_fd. Observably identical to Java (dropped connection -> thrown exception, process survives) but with a narrower blast radius. The integration test main() no longer installs SIG_IGN, so it proves the library is self-sufficient (exit 0, not 141); the unit test keeps SIG_IGN only to guard its in-process echo server thread. 260 unit tests + 5 TLS integration tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…est server
The cluster and single-server integration suites bring up
quay.io/infinispan/server:latest, but Docker reuses a locally cached tag
instead of pulling. An 8-month-old cached :latest (pre-rest/v3) kept being
reused, so the REST probes 404'd — clusters appeared to never form and
owner/size lookups came back empty.
Pin the pull behaviour (not the API): pull_policy: always on all four nodes
in docker-compose-cluster.yml, and docker run --pull always in the
start_infinispan_{noauth,auth,tls}.sh scripts. The test code is unchanged and
still correctly uses the rest/v3 API. See docs/DECISIONS.md (2026-11-09).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fedora CI builds with OpenSSL 4.0 and -Werror=deprecated-declarations, where SSL_set_hostflags / SSL_set1_host are deprecated, breaking the build (Ubuntu and Windows, on older OpenSSL, were unaffected). Configure host-name validation on the SSL's X509_VERIFY_PARAM directly via SSL_get0_param + X509_VERIFY_PARAM_set_hostflags / X509_VERIFY_PARAM_set1_host. These are the functions the deprecated wrappers alias, so behaviour is identical, and they exist since OpenSSL 1.1.0 — builds clean on 1.1.0 through 4.0. See docs/DECISIONS.md (2026-11-09). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…xtures The TLS test certificates were hand-made with openssl and committed as opaque blobs (unit set in tests/fixtures/tls/, integration set in test-configs/tls/) with no way to regenerate them. Add a documented, self-contained generator that reproduces both sets with the same properties (subjects, SANs, RSA-2048/SHA-256, ~100-year validity). The committed fixtures are left unchanged (they do not expire); the script is for when they must actually change (new SAN, mutual-TLS client certs for #10, rotation). Output dirs are overridable via UNIT_DIR/INT_DIR for self-testing. See docs/DECISIONS.md (2026-11-09). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18.
Summary
Adds server-authenticated TLS so
hotrods://works, over OpenSSL with PEM certs(first slice of #18; mutual TLS / keystore formats remain deferred under #10).
RemoteCache::setTls(...)and thehotrods://scheme wrap every connectionthe client opens (seed + topology-discovered) in a TLS session.
ca_file, empty = system store), SNI (sni_host, skippedfor literal IPs), and host-name validation (
hostname_validation, default on;chain verification always on). Min TLS 1.2.
no process-global signal change — so a dropped connection surfaces as a thrown
exception, not process death.
include/hotrod/TlsConfig.h; handshake insrc/transport/Connection.cpp.Tests
(
tests/integration/TlsIntegrationTest.cpp).Also in this branch (separate commit)
test: force --pull always …— a test-infra fix unrelated to the TLS code: theintegration suites run
quay.io/infinispan/server:latest, but Docker reused astale cached tag, so a server predating the REST
v3API kept running and thecluster/REST probes 404'd. Pins the pull behaviour (
pull_policy: alwaysin thecluster compose;
docker run --pull alwaysin the single-node scripts); the testcode is unchanged. See
docs/DECISIONS.md(2026-11-09).🤖 Generated with Claude Code