Nginx Certificate Incident Recovery
Start with the client-visible symptom
A certificate incident can arise during validation, issuance, installation or serving. Collect the affected hostname, listener, timestamp, error and certificate metadata. Use an approved test client and never collect private keys, authorization headers or full ACME account data in a ticket. Determine whether TLS terminates at Nginx, a CDN or another load balancer. Inspect all relevant termination points rather than assuming a local file describes the public endpoint.
09:00 renewal issued serial B09:01 configuration test failed: key not readable09:02 old workers still serve serial A09:10 monitoring: serial A expires tomorrowIn this timeline, issuance worked. Deployment did not. Repeating issuance wastes time and can exhaust CA limits. Fix the narrowly scoped access problem, check key/chain compatibility and test the configuration. Retain the currently working service while preparing a verified replacement.
Compare certificate metadata and endpoint behavior
openssl x509 -in /path/to/leaf.pem -noout -subject -issuer -dates -fingerprint -sha256This reads a certificate, not a private key. Compare the validity interval, expected issuer, DNS SAN and fingerprint. Use openssl x509 -ext subjectAltName on the leaf for identity inspection. The command does not verify a chain or prove what Nginx serves.
curl --noproxy "*" --resolve catalog.test:8443:127.0.0.1 \ --cacert ca.crt https://catalog.test:8443/Use the Chapter 19 fixture’s actual CA path and port if different. The hostname remains catalog.test, so SNI and verification use the requested name while the connection stays on loopback. A wrong name calls for a correct certificate or hostname mapping, not disabling verification. An incomplete chain calls for the correct intermediate bundle, not trusting an arbitrary leaf. Expiry requires a valid replacement and verification of system time. A stale certificate after successful issuance may indicate an unperformed reload, wrong TLS termination point or another frontend still using older material.
Diagnose failed challenge responses
HTTP-01: 404 -> inspect webroot and virtual hostHTTP-01: wrong body -> inspect routing and all frontendsDNS-01: stale TXT -> inspect authoritative records and propagationTLS-ALPN-01: unsupported ALPN -> inspect client/listener capabilityCheck A/AAAA resolution, intended listener, firewall policy and challenge content for authorized domains; do not broaden access to unrelated services. Review CAA policy if issuance is prohibited. For rate-limited orders, obey the CA retry guidance and fix the root cause before the next attempt. An offline mock cannot establish public reachability, DNS propagation or CA acceptance.
Recover, verify and learn
Keep versioned, access-controlled deployment history and a tested rollback plan. Roll back to a previously verified certificate/key pair only if it is still valid, authorized and not compromised or revoked. If key compromise is suspected, replace the key and certificate and follow the CA revocation and incident procedure; do not roll back to the compromised material. Test configuration, reload the correct instance, verify fresh handshakes and application response, then document the new expiry and alerting. Avoid restarting blindly or deleting the renewal lineage.
Skipping certificate verification hides the symptom rather than restoring trust. Preserve the client trust policy throughout diagnosis.
Practice
Use the mock incident cases to classify a wrong-name certificate, stale deployment, missing intermediate, expired certificate and missing challenge. Write the smallest safe next action for each.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Nginx Certificate Incident Recovery
Diagnose failed validation, stale deployments, name mismatches and certificate-chain problems without weakening TLS.
A new cert is on disk but the old serial is served. What layer is suspect?
A certificate name does not match the URL. What is the correct fix?
What does a missing intermediate require?
When is rollback to an older certificate inappropriate?
What is the first response to an authorization rate limit?