TLS Certificates Explained for Infrastructure Engineers

Chains, SANs, private CAs and automated renewal — plus how to read an expiry incident before it becomes an outage.

Published Apr 28, 202610 min read5 views
  • automation
  • linux
  • security
  • tls

What is actually verified

  1. The certificate is within its validity window.

  2. The hostname matches a Subject Alternative Name — the Common Name is ignored by modern clients.

  3. A chain of signatures reaches a root the client already trusts.

  4. The certificate has not been revoked, where the client checks.

Reading a chain

Bash
openssl s_client -connect api.example.com:443 -servername api.example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer -dates -ext subjectAltName

# verify the served chain is complete
openssl s_client -connect api.example.com:443 -showcerts </dev/null 2>/dev/null | grep -c "BEGIN CERTIFICATE"

Private CA for internal services

Internal services still need certificates. A small offline root, an online issuing CA with short-lived certificates and automated enrolment beats self-signed certificates and permanent exceptions.

YAML
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: api-internal
  namespace: payments
spec:
  secretName: api-internal-tls
  duration: 720h
  renewBefore: 240h
  dnsNames: ["api.payments.svc", "api.internal.example.com"]
  issuerRef:
    name: internal-ca
    kind: ClusterIssuer

Expiry is an operational metric

Bash
# Prometheus blackbox exporter alert
- alert: TLSCertExpiringSoon
  expr: probe_ssl_earliest_cert_expiry - time() < 86400 * 14
  for: 30m
  labels: { severity: ticket }

Renewal habits

  • Automate issuance; a manual renewal will be missed exactly once.

  • Keep the reload step in the automation — a renewed file is useless until the service rereads it.

  • Track certificates you do not own, such as partner endpoints, with external probes.

Back to all docs