Sem Agente · Sem Instalação

TLS & mTLS Certificates: The Definitive Guide

TLS Certificates: Everything That Can Go Wrong (and Why mTLS Is Becoming the Standard for Serious Stuff) A complete guide to digital certificates in 2026 — from the basics that still break production to mTLS that's becoming mandatory for serious APIs and CDN integrations.

TLS Certificates: Everything That Can Go Wrong (and Why mTLS Is Becoming the Standard for Serious Stuff)

A complete guide to digital certificates in 2026 — from the basics that still break production to mTLS that's becoming mandatory for serious APIs and CDN integrations.

Introduction

If you manage anything on the internet, you've been through this: the client calls complaining that "the site is showing a security error", you open the browser and see that red screen. Expired certificate. Invalid certificate. Certificate for another name. And always on a Friday afternoon.

TLS certificates are one of those things that seem simple until you need to touch them. And here's the point: certificates aren't just for HTTPS. In 2026, they're the foundation of practically all modern authentication on the internet. mTLS is becoming the standard for APIs between systems. Cloudflare, AWS, Google, and Azure are pushing certificate-based authentication for serious integrations. Service mesh uses certificates to authenticate service-to-service. Zero Trust depends on certificates to identify devices.

Part 1: How TLS Really Works

1.1 What TLS Solves

Three things:

  1. Confidentiality — nobody on the path can read
  2. Integrity — nobody can modify without being detected
  3. Authenticity — you talk to who you think you're talking to

The first two are solved by symmetric cryptography. The third is the hard problem: how do you share a secret key with someone you've never met over a potentially hostile network?

The answer: digital certificates and asymmetric cryptography.

1.2 The TLS Handshake, Simplified

  1. Browser connects and says "I want to speak TLS, I support these versions"
  2. Server responds with its chosen version and its certificate
  3. Browser verifies the certificate (trusted CA? valid? name matches?)
  4. Both do math exchange (ECDHE) to derive a unique session key
  5. From then on, everything is encrypted symmetrically

The magic is in step 4: using elliptic curve Diffie-Hellman, both sides arrive at the same secret key without ever transmitting it on the wire.

1.3 What's Inside a Certificate

  • Owner's name (CN and SANs)
  • Public key
  • Who issued it (CA)
  • Validity period
  • CA's digital signature

The browser/OS "trust store" contains the pre-installed trusted CAs.

1.4 The Certificate Chain

Root CA (in trust store)
    └── Intermediate CA
            └── Your certificate

The server needs to send certificate leaf + intermediates. Forgetting this is one of the most common errors: it works in Chrome (which has a cache) but breaks in curl or Firefox.

Always use fullchain.pem.

Part 2: Certificate Types

2.1 By Validation

DV (Domain Validation) — only verifies control of the domain. Automated, free (Let's Encrypt). Sufficient for 99% of cases.

OV (Organization Validation) — verifies that the company exists. Asks for CNPJ, phone, address. Time: 1-5 days. Cost: tens to hundreds of dollars.

EV (Extended Validation) — extended validation. In 2026, browsers no longer show a differentiated green bar. EV became a compliance requirement, not visual differentiation.

2.2 By Scope

Single domain — one name only.

Wildcard — *.empresa.com.br covers all direct subdomains. Does not cover the root domain or subdomains of subdomains. Let's Encrypt issues via DNS-01.

Multi-Domain (SAN) — specific list of names. Let's Encrypt supports up to 100 SANs.

2.3 By Use

  • TLS Server Authentication — standard
  • TLS Client Authentication — used in mTLS
  • Code Signing — sign binaries
  • S/MIME — sign and encrypt emails

Part 3: Certificate Authorities Today

3.1 Let's Encrypt

The revolution. Today it issues more than half of all public certificates on the internet.

  • Free
  • Total automation via ACME
  • Wildcards via DNS-01
  • 90-day validity (intentional — forces automation)

3.2 ZeroSSL

Free alternative to Let's Encrypt. Also ACME. Useful for diversification.

3.3 Google Trust Services

Google issuing publicly since 2022. Free for Google Cloud customers.

3.4 Classic Commercial CAs

DigiCert, Sectigo, GlobalSign, Entrust. Who still buys: companies with required OV/EV, long validity, commercial SLA, special certificates.

3.5 Private CAs

You can run your own. For internal mTLS, IoT, service mesh, private infrastructure.

Tools:

  • HashiCorp Vault with PKI engine
  • step-ca (Smallstep) — easy, supports ACME
  • EJBCA — complex enterprise
  • cfssl (Cloudflare)

Part 4: Everything That Can Go Wrong

4.1 Expired Certificate

The classic. It already happened to Microsoft Teams, LinkedIn, Spotify, Cisco, Ericsson, everyone.

Root cause: someone installed manually, reminder got lost, person left, nobody knew.

How to avoid:

  1. Total automation (Let's Encrypt + ACME)
  2. Centralized inventory
  3. Alerts at 60/30/14/7 days
  4. Multiple alert channels
  5. Don't depend on one person only

4.2 Incomplete Chain

Works in Chrome, breaks in curl. Symptom: client swears it doesn't work and you can't reproduce it.

openssl s_client -connect empresa.com.br:443 -showcerts
# Or ssllabs.com/ssltest

Solution: always fullchain.pem.

4.3 Hostname Mismatch

Certificate for www.empresa.com.br but someone accesses empresa.com.br. Include all SANs.

4.4 SHA-1 or Weak Ciphers

Minimum acceptable in 2026:

  • Signature: SHA-256+
  • RSA: 2048 bits+ (4096 better)
  • ECDSA: P-256+

4.5 Mixed Content

HTTPS loading HTTP resources. Use relative URLs, explicit https://, Content-Security-Policy: upgrade-insecure-requests as a band-aid.

4.6 HSTS Locking the Site

Once received, browser remembers via max-age. If cert expires, users get locked out. Preload is practically irreversible.

Start with max-age=300, increase gradually.

4.7 Self-signed in Production

If you say "ignore the warning and click advanced", you have a problem. Fix it with Let's Encrypt in 2 minutes.

4.8 Wildcard Used Wrong

*.empresa.com.br does not cover:

  • empresa.com.br (no subdomain)
  • dev.app.empresa.com.br (subdomain of subdomain)

4.9 Private Key Leaked

Revoke immediately and issue a new one. Attacker with your key can impersonate your domain.

Prevention:

  • chmod 600
  • Never in git
  • Secret managers (Vault, Secrets Manager)
  • Periodic rotation

4.10 Certificate Transparency Failure

Since 2018, public certificates need to be in CT logs. Use crt.sh to monitor:

https://crt.sh/?q=empresa.com.br

If a certificate appears that you didn't authorize, it's a sign of compromise.

4.11 Broken OCSP Stapling

Verify:

openssl s_client -connect empresa.com.br:443 -status </dev/null 2>&1 | grep -A 17 'OCSP response:'

Part 5: OCSP, CRL, CT, CAA

5.1 CRL — Obsolete for Public TLS

List of revoked certificates. Grows indefinitely, expensive to download, cached for hours.

5.2 OCSP

Replaces CRL. Client asks the CA directly. Privacy problem.

5.3 OCSP Stapling

Server periodically consults and "staples" to the handshake. Faster, more private.

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/empresa.com.br/chain.pem;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;

5.4 Must-Staple

Requires stapling. Stronger, but requires server always reaches the CA.

5.5 Certificate Transparency

Public auditable log. Today mandatory. Use crt.sh to monitor.

5.6 CAA

Whitelist of authorized CAs via DNS:

empresa.com.br.   IN   CAA   0 issue "letsencrypt.org"
empresa.com.br.   IN   CAA   0 issuewild "letsencrypt.org"
empresa.com.br.   IN   CAA   0 iodef "mailto:security@empresa.com.br"

Always configure. Simple, free, real protection.

Part 6: mTLS

6.1 What Is It

Normal TLS only authenticates the server. mTLS authenticates both sides — client also presents a certificate.

Result: server mathematically knows who the client is before any application data is exchanged.

6.2 Why It's Growing

  1. Zero Trust became mainstream — all communication needs to be authenticated
  2. Server-to-server APIs everywhere
  3. Passwords and tokens are fragile — certificates are more robust (private key never travels)
  4. Financial compliance — Open Banking, Open Finance, BACEN
  5. Service mesh — Istio, Linkerd, Consul Connect
  6. CDNs and proxies — Cloudflare, CloudFront, etc.

6.3 How It Works

  1. Client connects
  2. Server sends certificate
  3. Client verifies
  4. Server requests client's certificate
  5. Client sends
  6. Server verifies against configured CA
  7. If OK, proceeds

6.4 Configuration

Nginx:

server {
    listen 443 ssl;
    server_name api.empresa.com.br;
    
    ssl_certificate /etc/letsencrypt/live/api.empresa.com.br/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api.empresa.com.br/privkey.pem;
    
    # mTLS
    ssl_verify_client on;
    ssl_client_certificate /etc/nginx/ssl/clients-ca.crt;
    ssl_verify_depth 2;
    
    location / {
        proxy_pass http://backend;
        proxy_set_header X-SSL-Client-Verify $ssl_client_verify;
        proxy_set_header X-SSL-Client-DN $ssl_client_s_dn;
        proxy_set_header X-SSL-Client-Serial $ssl_client_serial;
    }
}

Apache:

<VirtualHost *:443>
    ServerName api.empresa.com.br
    
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/api.empresa.com.br/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/api.empresa.com.br/privkey.pem
    
    SSLVerifyClient require
    SSLVerifyDepth 2
    SSLCACertificateFile /etc/apache2/ssl/clients-ca.crt
    
    <Location />
        SSLOptions +StdEnvVars
        RequestHeader set X-SSL-Client-DN "%{SSL_CLIENT_S_DN}s"
    </Location>
</VirtualHost>

Curl Client:

curl --cert client.crt --key client.key https://api.empresa.com.br/recurso

Python Client:

import requests

response = requests.get(
    'https://api.empresa.com.br/recurso',
    cert=('client.crt', 'client.key'),
    verify='ca-bundle.crt'
)

6.5 When It Makes Sense

Makes a lot of sense:

  • Server-to-server APIs (especially B2B)
  • Microservices (service mesh)
  • Webhooks from trusted partners
  • Open Banking
  • Financial integrations
  • Corporate IoT
  • Sensitive API admin access

Doesn't make as much sense:

  • Websites for end users
  • Public APIs with anonymous clients
  • When you can't distribute and rotate certificates

6.6 Practical Challenges

  • Distributing certificates to clients
  • Fast revocation when compromised
  • Validity vs. convenience
  • Private key protection (ideally in hardware)
  • Harder debugging

Part 7: mTLS with CDNs

7.1 The Problem

Cloudflare/CloudFront/Akamai in front of the website. But the origin is still directly accessible — whoever discovers the real IP bypasses the entire CDN, WAF, rate limits.

Attempts to solve:

  1. Restrict by IP — keeping lists updated is a pain
  2. Secret header — if it leaks, it's over
  3. mTLS — practically impossible to bypass

7.2 Cloudflare Authenticated Origin Pulls

  1. Enable in Cloudflare panel
  2. Cloudflare presents client certificate on all requests to origin
  3. You configure the origin to require and validate against Cloudflare's CA
  4. Connections without certificate are rejected

Modes:

  • Origin CA + global certificate — simple, shared CA
  • Per-zone client certificates — more secure, unique certificate per zone
server {
    listen 443 ssl;
    server_name origin.empresa.com.br;
    
    ssl_certificate /etc/ssl/origin.crt;
    ssl_certificate_key /etc/ssl/origin.key;
    
    ssl_client_certificate /etc/ssl/cloudflare-origin-ca.pem;
    ssl_verify_client on;
}

Result: even if they discover the real IP, the connection is rejected at handshake. Origin is effectively hidden.

7.3 AWS CloudFront

Uses AWS Certificate Manager Private CA. Same concept.

7.4 Other Cases

  • API Gateway (AWS, Kong, Tyk) requiring mTLS
  • Internal reverse proxies
  • Partner webhooks
  • ZTNA connectors

7.5 Summary

mTLS with CDN is an elegant solution to an old problem. Implementation costs hours. Protection lasts forever.

Part 8: New Technologies

8.1 ACME

Standard protocol (RFC 8555) for automation. Supported by Let's Encrypt, ZeroSSL, Google Trust, DigiCert, Sectigo, step-ca, Vault.

Clients:

  • certbot — official Let's Encrypt
  • acme.sh — pure shell
  • lego — Go, popular on K8s
  • traefik — proxy with built-in ACME
  • caddy — web server with ACME (probably the easiest)
  • cert-manager — Kubernetes operator

8.2 Ever-Shorter Validity

  • 5 years (old days)
  • 2015: 3 years
  • 2018: 2 years
  • 2020: 1 year (398 days)
  • 2024: discussions for 90 days
  • 2025-2026: Let's Encrypt testing 6 days, industry moving toward 47 days

Why? Limits compromise window. And it only works because automation solved the operational part.

8.3 Post-Quantum Cryptography

Quantum computers will break RSA and ECDSA via Shor's algorithm. NIST finalized standards in 2024:

  • ML-KEM (CRYSTALS-Kyber) — key establishment
  • ML-DSA (CRYSTALS-Dilithium) — signature
  • SLH-DSA (SPHINCS+) — alternative signature

In 2026, browsers and CDNs already implement hybrids (classic + post-quantum). Cloudflare since 2023, Chrome since 2024.

Concern: "harvest now, decrypt later" — attackers capturing today to decrypt when they have quantum.

8.4 Ed25519 and Modern ECC

Ed25519 is state of the art:

  • 256 bits ≈ RSA 3072
  • Faster
  • Resistant to side-channel
  • Deterministic

Prefer ECDSA P-256 or Ed25519 to RSA for new certificates.

8.5 TLS 1.3

Finalized in 2018:

  • 1-RTT handshake
  • Optional 0-RTT
  • Mandatory forward secrecy
  • Removed old ciphers (RC4, 3DES, MD5, SHA-1)
  • Encrypted handshake

In 2026, TLS 1.3 should be mandatory. TLS 1.0/1.1 are dead.

Part 9: Practical Hardening

9.1 Recommended Configuration

Nginx (Mozilla intermediate):

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_ecdh_curve X25519:secp384r1:secp256r1;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/empresa.com.br/chain.pem;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;

Modern (TLS 1.3 only):

ssl_protocols TLSv1.3;

Use Mozilla SSL Configuration Generator: https://ssl-config.mozilla.org/

9.2 Validation

For any production change:

  1. SSL Labs: https://www.ssllabs.com/ssltest/
  2. testssl.sh: command line
  3. Hardenize: https://www.hardenize.com
  4. Mozilla Observatory: https://observatory.mozilla.org

Goal: A+ on both.

9.3 Automatic Renewal

# /etc/cron.d/certbot-renew
0 3 * * * root certbot renew --quiet --post-hook "systemctl reload nginx"

And monitor that it's working. Renewal that silently stopped is the worst case.

Final Checklist

PUBLIC CERTIFICATES
[ ] Trusted CA
[ ] Complete chain (fullchain.pem)
[ ] SAN includes all names
[ ] Wildcard configured correctly
[ ] Validity monitored (60/30/14/7)
[ ] Renewal automated via ACME
[ ] CAA records configured
[ ] Private key chmod 600
[ ] Key never in git
[ ] Monitoring via crt.sh

TLS CONFIGURATION
[ ] TLS 1.2 and 1.3 only
[ ] TLS 1.0 and 1.1 disabled
[ ] Mozilla intermediate or modern ciphers
[ ] OCSP Stapling working
[ ] HSTS configured carefully
[ ] Modern curves (X25519, P-256)
[ ] Session tickets disabled

VALIDATION
[ ] SSL Labs A or A+
[ ] Hardenize A or A+
[ ] testssl.sh no warnings
[ ] No mixed content
[ ] No incomplete chain
[ ] No hostname mismatch

mTLS (when applicable)
[ ] Private CA for issuance
[ ] Secure distribution to clients
[ ] Automated rotation
[ ] Revocation configured
[ ] Authentication logs
[ ] Clear documentation

CDN WITH mTLS
[ ] Authenticated Origin Pulls enabled
[ ] Origin rejects connections without cert
[ ] Real IP not exposed
[ ] Tested from external IP
[ ] Bypass monitoring

OPERATIONAL
[ ] Centralized inventory
[ ] Manual fallback procedure
[ ] Revocation procedure
[ ] Compromise response plan
[ ] Team training

Final Thoughts

TLS certificates are one of those technologies that aged well. SSL was born in 1994, the math is from the 70s-80s, and it's still what keeps the internet running. But the ecosystem changed drastically in the last 10 years: free became standard, automation solved operations, validity keeps getting shorter, mTLS is becoming mandatory for serious integration.

The difference between who understands this and who doesn't is the difference between who sleeps peacefully next Friday and who spends the night explaining to the boss why the site is down.

Clear trend: certificate-based authentication will become increasingly important. Post-quantum, short certificates, mTLS everywhere, universal service mesh, Zero Trust as standard. Whoever masters certificates in the coming years will be well positioned for practically everything.

SentinelHub sweeps exactly these problems: monitors TLS certificates, alerts on expiration (60/30/14/7 days), detects incomplete chain, identifies weak ciphers, verifies TLS 1.0/1.1, detects hostname mismatch, monitors Certificate Transparency for unauthorized issuances. In Portuguese.

Because the problem isn't configuring it once — it's keeping it running every single day.

Found it useful? Share it with your infrastructure team. Especially with that sysadmin who still has a self-signed certificate in production saying "I'll change it later".