Stream TLS routing diagnostics
Check the build before the route
Begin with binary and package discovery. The local Nginx 1.26.3 reports both stream SSL flags and dynamic stream, but the shared module was not found. The lab cannot be syntax-tested here. In an approved environment locate the matching module through your package inventory, load it at main context if dynamic, and use only the copied lab configuration. Do not change the installed service.
nginx -vnginx -V# P is the absolute path of the disposable lab directorynginx -t -p "$P/" -c "$P/nginx.conf"Test identity and application behavior together
After following the optional lab README, these client commands use a fixed local socket and explicitly verify the requested hostname against the corresponding disposable trust anchor. The HTTP request traverses the TLS tunnel as encrypted bytes; each backend returns its own short marker. Expected output: successful verification and ATLAS or GROVE. A trusted chain without the expected name is insufficient.
printf "GET / HTTP/1.0\r\n\r\n" | openssl s_client -quiet -connect 127.0.0.1:19240 -servername atlas.test -verify_hostname atlas.test -verify_return_error -CAfile certs/atlas.pemprintf "GET / HTTP/1.0\r\n\r\n" | openssl s_client -quiet -connect 127.0.0.1:19240 -servername grove.test -verify_hostname grove.test -verify_return_error -CAfile certs/grove.pemDiagnose absent or concealed SNI
An unknown or absent visible SNI follows the explicit default branch. Our default peer closes; a failed handshake is the expected outcome. ECH is different from simply omitting SNI: a router may see an outer name, not the hidden inner name. A deployment that needs inner-name routing must coordinate ECH-aware endpoints rather than treating preread as decryption. An ALPN offer is also not proof that a backend supports the chosen protocol.
atlas.test → atlas endpoint → verify atlas.test → ATLASunknown.test → closing peer → handshake failsno visible name → closing peer → handshake failsUse minimal session evidence
This stream log fragment records visible SNI and selected peer but no decrypted request body. Names and addresses can still be sensitive; restrict access and retention. The lab uses invented names. Compare direct backend checks, routed certificate identity, and returned application marker. For a failed handshake inspect backend health, route, certificate trust and whether a peer expects PROXY metadata. Stream status alone is not an HTTP response code or proof of TLS success.
log_format route escape=json '{"sni":"$ssl_preread_server_name","upstream":"$upstream_addr","status":"$status"}';access_log logs/route.log route;Practice and next steps
Write a diagnostic decision tree for wrong certificate, missing SNI, unavailable module and unsupported encrypted metadata. Keep hostname verification enabled and do not infer application success from a completed TCP session. Next: mail proxy and specialist modules.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Stream TLS routing diagnostics
Identify missing SNI and unsupported build hypotheses
nginx -V reports --with-stream=dynamic, but nginx -t reports an unknown stream directive. What should you verify next?
What should a correct positive route test verify?
How should the lab handle a connection with no SNI?
Why might a visible ECH outer name differ from the desired service?
What does a successful stream session status prove?