TLS and Certificates

Understand how TLS encrypts traffic and proves identity, and how to issue, renew and debug certificates without outages.

Intermediate · about 5 hours · difficulty 3/5

Learn first: HTTP and HTTPS

Expired or misconfigured certificates are a classic self-inflicted outage. TLS knowledge lets you set up HTTPS correctly, automate renewal and debug handshake failures.

How it works

  • Asymmetric crypto (public/private key pairs) authenticates the server and negotiates keys; symmetric crypto encrypts the bulk traffic.
  • A certificate binds a public key to names (SANs) and is signed by a Certificate Authority. Clients trust a chain: leaf, intermediate(s), root in their trust store.
  • The handshake negotiates version (use TLS 1.2+ and prefer 1.3), cipher, and uses SNI so one IP can serve many hostnames.

Operating certificates

  • Let's Encrypt and the ACME protocol give free, automated certificates (certbot, Caddy, cert-manager in Kubernetes).
  • Cloud-managed certificates (AWS ACM, Google-managed) on load balancers remove renewal work.
  • mTLS (mutual TLS) authenticates clients too; service meshes use it between services.
  • Where TLS terminates matters: at the CDN, load balancer, ingress, or the app itself.

Debugging

openssl s_client -connect host:443 -servername host shows the chain and expiry; openssl x509 -in cert.pem -noout -text inspects a file. Common errors: missing intermediate, wrong hostname, expired cert, clock skew.

Good enough to move on: you can issue a certificate with ACME, explain the chain of trust, and diagnose a failing handshake with openssl.

Key concepts

  • Symmetric vs asymmetric crypto
  • Certificates, CAs and chains
  • TLS handshake and SNI
  • Let's Encrypt and ACME
  • openssl debugging
  • Managed certificates (ACM etc.)
  • mTLS

Mini project

Put a small site behind nginx with a Let's Encrypt certificate, automate renewal, then add a Prometheus-style check or cron job that warns you 14 days before any certificate expires.

Check yourself

Browsers accept your site but a curl call from a server fails with a certificate error. What is a common cause?

Free resources