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.
# 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 ))"'
# 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"
# 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
1. Beim Anbieter (DigiCert, GlobalSign, etc.) einloggen 2. Renewal anfordern 3. CSR hochladen oder neu generieren 4. Validierung durchführen 5. Neues Zertifikat herunterladen
# 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)
# 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
# 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
# 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
# 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
| # | 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 | ☐ |
| 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 |
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."
« ← TLS einrichten | → Firewall-Regeln »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional