Runbook: Zertifikat erneuern

Dauer: ~10 Minuten
Rolle: Security-Admin
Häufigkeit: Alle 90 Tage (Let's Encrypt) oder jährlich

Erneuerung des TLS-Zertifikats für das Data Gateway.


Workflow

flowchart TD A[Ablauf-Warnung] --> B{Zertifikatstyp?} B -->|Let's Encrypt| C[certbot renew] B -->|Interne CA| D[Neues Zertifikat anfordern] B -->|Kommerziell| E[Beim Anbieter erneuern] C --> F[Zertifikat austauschen] D --> F E --> F F --> G[Gateway neustarten] G --> H[HTTPS testen] H --> I{OK?} I -->|Ja| J[Fertig] I -->|Nein| K[Altes Zertifikat wiederherstellen] style J fill:#e8f5e9 style K fill:#ffebee


1. Ablauf prüfen

# Aktuelles Zertifikat prüfen
openssl s_client -connect gateway.example.com:443 -servername gateway.example.com 2>/dev/null | \
    openssl x509 -noout -dates
 
# Tage bis Ablauf
echo | openssl s_client -connect gateway.example.com:443 2>/dev/null | \
    openssl x509 -noout -enddate | \
    cut -d= -f2 | \
    xargs -I {} bash -c 'echo "Tage bis Ablauf: $(( ($(date -d "{}" +%s) - $(date +%s)) / 86400 ))"'

2a. Let's Encrypt erneuern

# Automatisch (wenn certbot korrekt eingerichtet)
sudo certbot renew
 
# Mit Pre/Post-Hook für Gateway
sudo certbot renew \
    --pre-hook "systemctl stop data-gateway" \
    --post-hook "systemctl start data-gateway"
 
# Trockenlauf (ohne echte Erneuerung)
sudo certbot renew --dry-run

Automatisierung via Cron:

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

2b. Interne CA erneuern

# CSR erstellen
openssl req -new -key gateway.key -out gateway.csr \
    -subj "/CN=gateway.example.com/O=Example Corp"
 
# CSR an CA senden (z.B. via PQ Crypto)
# → Neues Zertifikat: gateway-new.crt

Siehe: PQ Crypto: Zertifikat erneuern


2c. Kommerzielles Zertifikat

1. Beim Anbieter (DigiCert, GlobalSign, etc.) einloggen 2. Renewal anfordern 3. CSR hochladen oder neu generieren 4. Validierung durchführen 5. Neues Zertifikat herunterladen


3. Backup des alten Zertifikats

# Backup erstellen
cp /opt/data-gateway/certs/gateway.pfx /opt/data-gateway/certs/gateway.pfx.bak.$(date +%Y%m%d)
 
# Oder für PEM
cp /opt/data-gateway/certs/cert.pem /opt/data-gateway/certs/cert.pem.bak.$(date +%Y%m%d)

4. Neues Zertifikat installieren

# PEM-Format
sudo cp new-cert.pem /opt/data-gateway/certs/cert.pem
sudo cp new-key.pem /opt/data-gateway/certs/key.pem
sudo chmod 600 /opt/data-gateway/certs/*.pem
 
# PFX-Format
sudo cp new-gateway.pfx /opt/data-gateway/certs/gateway.pfx
sudo chmod 600 /opt/data-gateway/certs/gateway.pfx

5. Gateway neustarten

# Linux
sudo systemctl restart data-gateway
 
# Windows
Restart-Service -Name "DataGateway"
 
# Docker
docker restart gateway
 
# Kubernetes (Rolling Update)
kubectl rollout restart deployment/data-gateway -n data-gateway

6. Verifizieren

# Neues Zertifikat aktiv?
echo | openssl s_client -connect gateway.example.com:443 2>/dev/null | \
    openssl x509 -noout -subject -dates
 
# Health Check
curl https://gateway.example.com/health
 
# Vollständiger SSL-Test
openssl s_client -connect gateway.example.com:443 -servername gateway.example.com

7. Rollback (falls nötig)

# Backup wiederherstellen
sudo cp /opt/data-gateway/certs/gateway.pfx.bak.20241215 /opt/data-gateway/certs/gateway.pfx
 
# Gateway neustarten
sudo systemctl restart data-gateway
 
# Verifizieren
curl https://gateway.example.com/health

8. Checkliste

# Prüfpunkt
———–
1 Altes Zertifikat gesichert
2 Neues Zertifikat gültig
3 Hostnamen stimmen überein
4 Zertifikat installiert
5 Gateway neugestartet
6 HTTPS funktioniert
7 Monitoring benachrichtigt

Troubleshooting

Problem Ursache Lösung
————————–
Certificate mismatch Key passt nicht Key neu generieren
Chain incomplete Intermediate fehlt Chain-Datei hinzufügen
Permission denied Falsche Rechte chmod 600
Gateway startet nicht Falsches Passwort appsettings.json prüfen

Automatische Überwachung

Prometheus Alert für Zertifikatsablauf:

- alert: GatewayCertExpiringSoon
  expr: |
    (probe_ssl_earliest_cert_expiry{job="gateway-tls"} - time()) / 86400 < 14
  for: 1h
  labels:
    severity: warning
  annotations:
    summary: "Gateway-Zertifikat läuft bald ab"
    description: "Zertifikat läuft in {{ $value | humanize }} Tagen ab."

Verwandte Runbooks


« ← TLS einrichten | → Firewall-Regeln »


Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional

Zuletzt geändert: den 29.01.2026 um 15:12