TLS / Zertifikat abgelaufen
Symptom
'certificate has expired', 'SSL handshake failed', Clients können sich plötzlich nicht mehr verbinden (ohne Codeänderung).
1. Wo bricht es ab: Server, Client oder CA?
Ist das Serverzertifikat abgelaufen, ein Client-Zertifikat oder eine CA in der Kette? Das Symptom lautet meist: 'Gestern ging es, heute nicht, am Code wurde nichts geändert'.
2. Ablaufdatum prüfen
Lies das Ablaufdatum des Zertifikats direkt vom Server (eine schnelle, datenbankunabhängige Methode).
PostgreSQL
openssl s_client -connect host:5432 -starttls postgres </dev/null 2>/dev/null | openssl x509 -noout -datesMongoDB
openssl s_client -connect host:27017 </dev/null 2>/dev/null | openssl x509 -noout -enddateRedis
openssl s_client -connect host:6379 </dev/null 2>/dev/null | openssl x509 -noout -enddate3. Neues Zertifikat installieren und laden
Ersetze das Zertifikat und lade den Dienst in den meisten Fällen neu, ohne ihn neu zu starten.
PostgreSQL
-- Renew ssl_cert_file/ssl_key_file, then:
SELECT pg_reload_conf();MySQL
ALTER INSTANCE RELOAD TLS;SQL Server
-- SQL Server Configuration Manager > Certificate; a service restart is requiredMongoDB
// Renew the net.tls.certificateKeyFile file (at the same path), then load it without a restart (5.0+):
db.adminCommand({rotateCertificates: 1})Redis
CONFIG SET tls-cert-file /path/new.crt
CONFIG SET tls-key-file /path/new.keyElasticsearch
# ES watches the certificate/key files (PEM, PKCS#12) defined under xpack.security.*.ssl and
# reloads them automatically when the file at the SAME path changes (no restart needed).
# If the path, file name or keystore password changes, a rolling restart is required.
# Note: POST _nodes/reload_secure_settings is only for reloadable keystore settings, not for TLS certificates.
# Verify: check the new expiry date with openssl s_client and look in the ES logs for
# an entry showing the certificate was reloaded.4. Prüfen
Bestätige mit dem obigen openssl-Befehl, dass der TLS-Handshake mit dem neuen Zertifikat gelingt und das Ablaufdatum verlängert wurde; stelle mit einem Client eine End-to-End-Verbindung her.
5. Dauerhaft: nie wieder
Richte 30 Tage vor Ablauf des Zertifikats einen Alarm ein; nutze automatische Erneuerung (ACME/Let's Encrypt, HashiCorp Vault, cert-manager). Automatisiere das Neuladen nach der Erneuerung.