brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: curl tls-max shows whether a server still accepts TLS 1.2

Curl
~/tips/tip-curl-tls-max-version

curl -sv -o /dev/null --tlsv1.2 --tls-max 1.2 https://example.com/ 2>&1 | grep 'SSL connection'

Force a TLS version range to see which versions a server accepts.

To find out if a server still speaks TLS 1.2, or already speaks 1.3, I’d pin curl to a single version and see whether the handshake works.

--tlsv1.2 sets the lowest version curl allows, and --tls-max sets the highest. Set both to the same value to test exactly one version:

curl -sv -o /dev/null --tlsv1.2 --tls-max 1.2 https://example.com/ 2>&1 | grep 'SSL connection'
curl -sv -o /dev/null --tlsv1.3 https://example.com/ 2>&1 | grep 'SSL connection'

The verbose line shows what was agreed, for example SSL connection using TLSv1.2 / ECDHE-ECDSA-AES256-GCM-SHA384. If the server refuses that version, curl fails with exit code 35 and a handshake error instead.

It is a good check after changing a reverse proxy config, to see that the old versions you meant to turn off are really off.

The answer also depends on your own curl. A curl built against an older TLS library may not offer 1.3 at all, and modern builds refuse TLS 1.0 and 1.1 by themselves, so a failure for those tells you little about the server. The exact verbose text differs per TLS backend too; the macOS build prints it in another form. For a full list of what a server offers, a scanner like nmap --script ssl-enum-ciphers is the better tool.

Further reading: curl man page, curl docs: SSL certificate verification

Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get

More Curl tips curl --trace-ascii – https://example.com/ Retry-After: 120 curl -fsS --fail-early \ url = "https://example.com/data/latest.json" curl -4 -s -o /dev/null -w '%{remote_ip} %{http_code}\n' https://example.com/ All Curl tips (71) All topics

Link