TLS and certificates in practice
Certificate chains, renewal, and the checks that stop outages and attacks.
A TLS certificate binds a public key to a domain name and is signed by a certificate authority (CA) that browsers trust. The server sends its certificate together with the intermediate certificates, forming a chain up to a trusted root.
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null | openssl x509 -noout -subject -issuer -dates- Expiry causes most certificate outages. Automate renewal (ACME, for example Let's Encrypt) and monitor days to expiry.
- A missing intermediate works in some browsers and fails in others and in API clients. Serve the full chain.
- SNI (the
-servername) tells the server which hostname you want, because many sites share one address. - Wildcard certificates (
*.example.com) cover one level of subdomains. Protect their private key carefully.
Good configuration
- Allow TLS 1.2 and 1.3 and disable older versions.
- Redirect HTTP to HTTPS and send HSTS (
Strict-Transport-Security) once you are sure HTTPS works everywhere. - Keep private keys readable only by the service, never in Git.
- Test with an external scanner such as SSL Labs after changes.
mTLS
In mutual TLS the client also presents a certificate. It is common between internal services, which prove who they are with certificates instead of passwords or API keys.
CarefulNever disable certificate verification (curl -k, verify=False) to "make it work" in production. It removes the protection TLS provides and allows interception.
Test yourself
Answer all the questions, then check them. Finish with every answer right to mark the lesson as done.