Chapter 3 · Lesson 22 of 22
Domains and HTTPS

TLS versions and ciphers in plain language

A TLS version is the revision of the protocol that secures a connection, and a cipher suite is the set of algorithms it uses; today you should allow TLS 1.2 and 1.3 and disable older versions.

By the end you will

Set a sensible ssl_protocols line in nginx and test which TLS versions your server accepts with openssl.

Time
12 min
Level
Intermediate
Check
4 questions
You need
  • A server with HTTPS already working
  • openssl installed

TLS is the protocol that encrypts HTTPS traffic. It exists in several versions, and each connection uses one version plus one cipher suite, chosen during the handshake. For a public website the practical advice is short: allow TLS 1.2 and TLS 1.3, turn off everything older, and take cipher settings from a maintained reference instead of writing your own list.

How it works#

When a client connects, it sends a hello message listing the TLS versions it supports and the cipher suites it can use. The server picks the highest version both sides support and a suite from the shared list. Then the two sides agree on session keys, the server proves its identity with its certificate and the encrypted conversation starts. You can see the picture in HTTPS and Let’s Encrypt.

Versions in short:

  • SSL 2.0 and 3.0: obsolete and broken. Never enable them.
  • TLS 1.0 and 1.1: deprecated by RFC 8996 (published in 2021). They rely on older constructions with known weaknesses, and browsers and most vendors removed support. Disable them unless you must serve a specific legacy client.
  • TLS 1.2: still widely used and acceptable when configured with modern suites. It keeps older but reasonable clients working.
  • TLS 1.3: the current version (RFC 8446). The handshake is shorter, only modern algorithms remain, and all suites provide forward secrecy.

What a cipher suite is#

A cipher suite is a named bundle of algorithms. In TLS 1.2 the name spells out the parts, such as the key exchange, the authentication method, the bulk encryption cipher and the integrity function. In TLS 1.3 the suite names are shorter, because key exchange and authentication are negotiated separately and only strong authenticated encryption modes are left. You normally do not choose individual algorithms, but you do choose which suites the server will accept, and that list is where past misconfigurations hide: old suites with weak or removed algorithms.

Do not write cipher lists from memory or copy them from old blog posts. They go out of date. Use the Mozilla SSL Configuration Generator at https://ssl-config.mozilla.org/, choose your server (nginx, Apache, Caddy and others), your software versions and the compatibility level, and paste its output. Mozilla updates the recommendations as research changes.

Forward secrecy#

Forward secrecy (also called perfect forward secrecy) means each connection derives its session keys from a temporary key exchange, not directly from the server’s long term private key. If someone records encrypted traffic today and steals your private key next year, they still cannot decrypt the recorded sessions. TLS 1.3 requires forward secrecy for every connection. In TLS 1.2 it depends on the suite, which is one reason to use a maintained configuration that prefers ephemeral key exchange.

A sane nginx setting#

The version line itself is simple and stable:

nginx
ssl_protocols TLSv1.2 TLSv1.3;

Put it in the http block or the server block that has listen 443 ssl. For the cipher list, copy the matching ssl_ciphers and related lines from the Mozilla generator rather than inventing them. Then test and reload:

bash
sudo nginx -t && sudo systemctl reload nginx

Other settings from the generator, such as session handling and OCSP stapling, can be adopted at the same time. Combine this with HSTS and a correct certificate chain for a complete server setup. Caddy sets safe defaults itself, see Automatic HTTPS with Caddy.

Check it worked#

Test each version with openssl by forcing it:

bash
openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null
openssl s_client -connect example.com:443 -servername example.com -tls1_2 </dev/null
openssl s_client -connect example.com:443 -servername example.com -tls1_1 </dev/null

For the first two you should see a certificate and a line with Protocol (or Protocol version) naming the negotiated version, plus a Cipher line showing the suite in use. For the third, a server that has disabled TLS 1.1 should fail the handshake with an alert, and no certificate chain will be printed. If your local openssl was built without support for old protocols, the flag may be rejected locally, which tells you nothing about the server. In that case use a different tool, such as an online scanner or nmap --script ssl-enum-ciphers -p 443 example.com against a server you own.

With curl you can also force a version, for example curl -sI --tlsv1.2 --tls-max 1.2 https://example.com.

Edge cases and gotchas#

  • Legacy clients: very old devices, embedded systems and some old Java or Android versions may only speak TLS 1.0 or 1.1. Decide per case whether to support them, and isolate them if you must.
  • Reload, not restart: version changes apply on reload, and settings in the wrong block may be ignored if a more specific server block overrides them.
  • Default server block: nginx may apply the protocols of the first or default server for a shared IP, so set it consistently.
  • TLS in other places: databases, mail servers and internal proxies have their own version and cipher settings.
  • A scan is not a guarantee: a clean report only covers the endpoints and options tested.
  • Do not copy stale lists: old recommendations can include suites that are now considered weak, so regenerate periodically.

Troubleshooting#

SymptomLikely causeFix
Old client gets “handshake failure”Server no longer accepts its TLS version or suitesUpdate the client, or decide whether to allow a legacy path
s_client -tls1_1 succeeds on your serverssl_protocols still lists it, or another block answersSet ssl_protocols TLSv1.2 TLSv1.3;, reload, retest
openssl: unknown option -tls1_1Local openssl lacks old protocolsTest with another tool or machine
Changes have no effectnginx not reloaded, or directive overridden in a server blockRun nginx -t, reload and check which block matches
Scanner warns about weak ciphersOutdated ssl_ciphers lineRegenerate from the Mozilla generator
TLS 1.3 not offeredOld nginx or openssl libraryUpgrade packages so the server links a TLS 1.3 capable library

Quick reference#

nginx
ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers and related lines: copy from https://ssl-config.mozilla.org/
bash
openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null
openssl s_client -connect example.com:443 -servername example.com -tls1_2 </dev/null

Next#

Return to the track start with HTTPS and Let’s Encrypt.

Check what you learned4 questions
1Which TLS versions should a public server allow today?
2What is a cipher suite?
3What does forward secrecy give you?
4Which command tests whether a server accepts TLS 1.3?

Frequently asked questions

Which TLS version should I use?

Allow TLS 1.2 and TLS 1.3. TLS 1.3 is preferred by modern clients, and TLS 1.2 keeps older clients working.

Why are TLS 1.0 and 1.1 deprecated?

RFC 8996 formally deprecated them because of known weaknesses and because modern versions replace them. Major browsers and many vendors dropped support for them.

What is a cipher suite?

A cipher suite names the algorithms a connection uses for key exchange, authentication, encryption and message integrity. The client offers a list and the server picks one it supports.

Where can I get a safe nginx TLS configuration?

Use the Mozilla SSL Configuration Generator at https://ssl-config.mozilla.org/. It produces current settings for your server software and chosen compatibility level.

Sources

View MD Edit
Share
Helpful?
Progress is saved in this browser only.

Keep going: guides and tutorials

View MD Edit
Share
Helpful?
Run this on your own server

Levelrail deploys apps from git with health-checked releases and one-click rollback.

docker pull ghcr.io/glincker/levelrail:latest Install Levelrail From GLINR Studios