====== Runbook: Health Check ======
**Dauer:** ~5 Minuten \\
**Rolle:** PKI-Operator \\
**Häufigkeit:** Täglich (empfohlen: morgens)
----
===== Workflow =====
flowchart LR
subgraph CHECKS["🔍 PRÜFUNGEN"]
C1[CA-Verfügbarkeit]
C2[CRL-Gültigkeit]
C3[OCSP-Status]
C4[Ablaufende Zertifikate]
C5[Disk Space]
end
subgraph STATUS["📊 STATUS"]
S1{OK?}
S2[Dashboard]
end
subgraph ACTION["⚡ AKTION"]
A1[Ticket erstellen]
A2[Eskalieren]
end
C1 --> S1
C2 --> S1
C3 --> S1
C4 --> S1
C5 --> S1
S1 -->|Ja| S2
S1 -->|Nein| A1
A1 -->|Kritisch| A2
style S1 fill:#fff3e0
style A2 fill:#ffebee
----
===== Schnellprüfung (1 Befehl) =====
#!/bin/bash
# pki-health-check.sh - Tägliche PKI-Prüfung
echo "=== PKI Health Check $(date -Iseconds) ==="
# 1. CA-Zertifikate prüfen
echo -e "\n[1] CA-Zertifikate:"
for ca in /etc/pki/CA/ca-*.pem; do
days=$(( ($(openssl x509 -enddate -noout -in "$ca" | cut -d= -f2 | date -f - +%s) - $(date +%s)) / 86400 ))
status="OK"
[ "$days" -lt 365 ] && status="WARNUNG"
[ "$days" -lt 90 ] && status="KRITISCH"
echo " $(basename $ca): $days Tage [$status]"
done
# 2. CRL-Gültigkeit
echo -e "\n[2] CRL-Status:"
for crl in /var/www/pki/*.crl; do
next=$(openssl crl -in "$crl" -nextupdate -noout 2>/dev/null | cut -d= -f2)
if [ -n "$next" ]; then
days=$(( ($(date -d "$next" +%s) - $(date +%s)) / 86400 ))
status="OK"
[ "$days" -lt 3 ] && status="WARNUNG"
[ "$days" -lt 1 ] && status="KRITISCH"
echo " $(basename $crl): $days Tage bis Update [$status]"
fi
done
# 3. OCSP-Responder
echo -e "\n[3] OCSP-Responder:"
ocsp_status=$(curl -s -o /dev/null -w "%{http_code}" http://ocsp.example.com/status)
[ "$ocsp_status" = "200" ] && echo " Status: OK" || echo " Status: FEHLER ($ocsp_status)"
# 4. Ablaufende Zertifikate (30 Tage)
echo -e "\n[4] Ablaufende Zertifikate (<30 Tage):"
count=$(find /etc/ssl/certs -name "*.pem" -exec openssl x509 -checkend 2592000 -noout -in {} \; 2>/dev/null | grep -c "will expire")
echo " Anzahl: $count"
# 5. Speicherplatz
echo -e "\n[5] Speicherplatz:"
df -h /etc/pki /var/log | tail -n +2
echo -e "\n=== Ende Health Check ==="
----
===== Detailprüfungen =====
==== 1. CA-Zertifikate ====
# Root-CA Gültigkeit
openssl x509 -in /etc/pki/CA/root-ca.pem -enddate -noout
# Erwartetes Ergebnis: > 10 Jahre
# Intermediate-CA Gültigkeit
openssl x509 -in /etc/pki/CA/intermediate-ca.pem -enddate -noout
# Erwartetes Ergebnis: > 2 Jahre
# Zertifikatskette prüfen
openssl verify -CAfile /etc/pki/CA/root-ca.pem /etc/pki/CA/intermediate-ca.pem
# Erwartetes Ergebnis: OK
**Schwellwerte:**
| CA-Typ | Warnung | Kritisch |
|--------|---------|----------|
| Root-CA | < 5 Jahre | < 2 Jahre |
| Intermediate-CA | < 1 Jahr | < 6 Monate |
----
==== 2. CRL-Gültigkeit ====
# CRL Metadaten
openssl crl -in /var/www/pki/crl.pem -text -noout | head -20
# Next Update prüfen
openssl crl -in /var/www/pki/crl.pem -nextupdate -noout
# CRL von CDP abrufen
curl -s http://crl.example.com/crl.der | openssl crl -inform DER -text -noout
**Schwellwerte:**
| Metrik | Warnung | Kritisch |
|--------|---------|----------|
| Next Update | < 3 Tage | < 1 Tag |
| CRL-Größe | > 10 MB | > 50 MB |
----
==== 3. OCSP-Responder ====
# OCSP-Verfügbarkeit
curl -s -o /dev/null -w "HTTP: %{http_code}, Zeit: %{time_total}s\n" http://ocsp.example.com/status
# OCSP-Response für Test-Zertifikat
openssl ocsp \
-issuer /etc/pki/CA/intermediate-ca.pem \
-cert /etc/ssl/certs/test.pem \
-url http://ocsp.example.com \
-resp_text
# Erwartetes Ergebnis: "Cert Status: good" (oder "revoked" wenn widerrufen)
**Schwellwerte:**
| Metrik | Warnung | Kritisch |
|--------|---------|----------|
| Response-Zeit | > 500ms | > 2s |
| HTTP-Status | ≠ 200 | Timeout |
----
==== 4. Ablaufende Zertifikate ====
# Server-Zertifikate (30 Tage)
find /etc/ssl/certs -name "*.pem" -exec sh -c '
if openssl x509 -checkend 2592000 -noout -in "$1" 2>/dev/null | grep -q "will expire"; then
echo "ABLAUFEND: $1"
fi
' _ {} \;
# CA-Zertifikate (1 Jahr)
for ca in /etc/pki/CA/*.pem; do
if openssl x509 -checkend 31536000 -noout -in "$ca" 2>/dev/null | grep -q "will expire"; then
echo "CA WARNUNG: $ca"
fi
done
# PowerShell: Ablaufende Zertifikate
Get-ChildItem Cert:\LocalMachine\My | Where-Object {
$_.NotAfter -lt (Get-Date).AddDays(30)
} | Format-Table Subject, NotAfter, Thumbprint -AutoSize
----
==== 5. Systemressourcen ====
# Speicherplatz PKI-Verzeichnisse
df -h /etc/pki /var/log/pki /var/www/pki
# Log-Dateien Größe
du -sh /var/log/pki/*
# Prozesse
ps aux | grep -E "(ocsp|openssl)"
**Schwellwerte:**
| Ressource | Warnung | Kritisch |
|-----------|---------|----------|
| Disk Usage | > 80% | > 95% |
| Log-Größe | > 1 GB | > 5 GB |
----
===== Automatisierung =====
==== Cron-Job ====
# /etc/cron.d/pki-health-check
# Täglich um 08:00
0 8 * * * root /usr/local/bin/pki-health-check.sh | mail -s "PKI Health Check $(date +%Y-%m-%d)" pki-team@example.com
==== Prometheus Exporter (Optional) ====
# prometheus-pki-exporter.yml
- job_name: 'pki'
static_configs:
- targets: ['pki-server:9115']
metrics_path: /probe
params:
module: [certificate]
----
===== Dashboard-Vorlage =====
| Metrik | Status | Wert | Schwelle |
|--------|--------|------|----------|
| Root-CA Gültigkeit | 🟢 | 15 Jahre | > 5 Jahre |
| Intermediate-CA Gültigkeit | 🟡 | 8 Monate | > 1 Jahr |
| CRL Next Update | 🟢 | 5 Tage | > 3 Tage |
| OCSP Response | 🟢 | 120ms | < 500ms |
| Ablaufende Zertifikate | 🟡 | 3 | 0 |
| Disk /etc/pki | 🟢 | 45% | < 80% |
**Legende:**
* 🟢 OK
* 🟡 Warnung
* 🔴 Kritisch
----
===== Eskalationsmatrix =====
| Befund | Aktion | Zeitrahmen |
|--------|--------|------------|
| CA < 6 Monate | CA-Renewal planen | 1 Woche |
| CRL abgelaufen | CRL sofort erneuern | 1 Stunde |
| OCSP nicht erreichbar | Responder neustarten | 30 Min |
| > 10 ablaufende Zertifikate | Renewal-Sprint | 1 Tag |
| Disk > 95% | Logs rotieren/löschen | Sofort |
----
===== Verwandte Runbooks =====
* [[.:zertifikat-erneuern|Zertifikat erneuern]] – Bei ablaufenden Zertifikaten
* [[..:monitoring:ablauf-monitoring|Ablauf-Monitoring]] – Automatisierte Überwachung
* [[..:monitoring:alerting-setup|Alerting Setup]] – Benachrichtigungen
----
<< [[.:zertifikat-widerrufen|← Zertifikat widerrufen]] | [[..:start|→ Operator-Szenarien]] >>
----
//Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional//
{{tag>runbook health-check monitoring operator}}