Runbooks — Authentication Incident Response
Authentifizierungs-Incident-Runbooks (Phishing, Credential-Reset, MFA, Session-Revocation).
Runbooks
VERSION: 1.1
UPDATED: 2026-02-17
PURPOSE: Step-by-step incident response procedures for auth failures
OWNER: DevOps + Backend Team
FEATURES: OpenSearch Monitoring Setup (5 automated security monitors)🔴 INCIDENT: Auth System Down (All logins failing)
Symptoms
- All
/auth/loginrequests → 500 Internal Server Error - OpenSearch Dashboard: 100% login failure rate
- User reports: "Cannot login to SOCSuite"
Diagnosis Steps
# 1. Check backend pod status
kubectl get pods -n imvee-dev -l app=backend
# Expected: All pods Running, Ready 1/1
# 2. Check recent logs for errors
kubectl logs -n imvee-dev deployment/backend --tail=100 | grep -i error
# Look for: "Failed to connect", "panic", "context deadline exceeded"
# 3. Check Keycloak availability
kubectl get pods -n imvee-dev -l app=keycloak
curl -k https://keycloak.imvee-dev.svc.cluster.local:8443/health
# 4. Check Redis connectivity
kubectl get pods -n imvee-dev -l app=redis
kubectl exec -n imvee-dev deployment/redis -- redis-cli ping
# Expected: PONG
# 5. Check database connectivity
kubectl exec -n imvee-dev deployment/backend -- \
psql $DATABASE_URL -c "SELECT 1"
# Expected: Row with '1'Resolution Priority
| Priority | Component | Resolution |
|---|---|---|
| 1 | Keycloak unreachable | See "Keycloak Down" runbook below |
| 2 | Redis down | See "Redis Down" runbook below |
| 3 | Backend crash loop | Check logs for panic, rollback deployment |
| 4 | Database connection | Check PostgreSQL pod, connection pool |
| 5 | Network issues | Check K8s network policies, DNS |
Rollback Procedure
# Rollback to last known-good version
kubectl rollout history deployment/backend -n imvee-dev
# Rollback (undo last deployment)
kubectl rollout undo deployment/backend -n imvee-dev
# Wait for rollback to complete
kubectl rollout status deployment/backend -n imvee-dev --timeout=5m
# Verify auth works
curl -X POST https://api.socsuite.dev.imvee.de/api/v1/auth/password/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"test","provider":"local"}'
# Expected: 200 OK with session cookiePost-Incident Actions
immediate:
- [ ] Document incident in #incidents Slack channel
- [ ] Update status page (status.dev.imvee.de)
- [ ] Notify affected customers
within_24h:
- [ ] Root cause analysis (RCA) document
- [ ] Update monitoring thresholds
- [ ] Test rollback procedure in dev
- [ ] Review logs in OpenSearch
within_1_week:
- [ ] Update this runbook with lessons learned
- [ ] Improve alerting (prevent future incidents)
- [ ] Conduct team postmortemEscalation: If not resolved within 30 minutes → Escalate to CTO
🟠 INCIDENT: Keycloak Unreachable
Symptoms
- Login redirects fail
- Backend logs:
Failed to connect to Keycloak - OAuth callback errors:
connection refused
Diagnosis
# 1. Check Keycloak pod status
kubectl get pods -n imvee-dev -l app=keycloak
# Look for: CrashLoopBackOff, Error, Pending
# 2. Check Keycloak logs
kubectl logs -n imvee-dev deployment/keycloak --tail=50
# 3. Test connectivity FROM backend pod
kubectl exec -n imvee-dev deployment/backend -- \
curl -k -v https://keycloak.imvee-dev.svc.cluster.local:8443/health
# 4. Check Keycloak database connection
# Keycloak uses PostgreSQL - check DB pod
kubectl get pods -n imvee-dev -l app=postgresql
# 5. Check TLS certificates
kubectl get cert -n imvee-dev
kubectl describe cert keycloak-tls -n imvee-devCommon Causes
| Cause | Fix |
|---|---|
| Pod crashed (OOMKilled) | Increase memory limits in deployment |
| Database connection lost | Restart PostgreSQL, check credentials |
| TLS cert expired | Renew cert-manager certificates |
| Service DNS issue | Check CoreDNS logs, restart pods |
| Port conflict | Check service port mapping |
Resolution
# Quick fix: Restart Keycloak
kubectl rollout restart deployment/keycloak -n imvee-dev
kubectl rollout status deployment/keycloak -n imvee-dev
# If OOMKilled: Increase memory
kubectl patch deployment keycloak -n imvee-dev --patch '
spec:
template:
spec:
containers:
- name: keycloak
resources:
limits:
memory: "2Gi"
requests:
memory: "1Gi"
'
# Verify Keycloak is up
curl -k https://auth.dev.imvee.de/realms/socsuite/.well-known/openid-configuration
# Expected: JSON with "authorization_endpoint", "token_endpoint"Degraded Mode (If Keycloak down >5min)
Enable password authentication fallback:
# Update backend configmap to allow local auth
kubectl patch configmap backend-config -n imvee-dev --patch '
data:
ENABLE_PASSWORD_AUTH_FALLBACK: "true"
'
# Restart backend to apply
kubectl rollout restart deployment/backend -n imvee-devUsers can now login with local accounts while Keycloak is being fixed.
Communication: Notify users via email/Slack: "SSO temporarily unavailable, use password login"
🟡 INCIDENT: Redis Down (All sessions lost)
Symptoms
- All users logged out suddenly
- 401 Unauthorized on all protected endpoints
- Backend logs:
Failed to connect to Redis - Session cookie present but invalid
Impact
severity: HIGH
impact: All active sessions lost (users must re-login)
data_loss: Session data NOT persisted (in-memory only)
affected_users: ALL logged-in users
recovery_time: 5-10 minutes (Redis restart)Diagnosis
# 1. Check Redis pod status
kubectl get pods -n imvee-dev -l app=redis
# 2. Check Redis logs
kubectl logs -n imvee-dev deployment/redis --tail=50
# 3. Test Redis connectivity
kubectl exec -n imvee-dev deployment/redis -- redis-cli ping
# Expected: PONG
# 4. Check Redis memory usage
kubectl exec -n imvee-dev deployment/redis -- redis-cli INFO memory
# 5. Check persistence (if enabled)
kubectl exec -n imvee-dev deployment/redis -- ls -lh /dataResolution
# Restart Redis
kubectl rollout restart deployment/redis -n imvee-dev
kubectl rollout status deployment/redis -n imvee-dev
# Verify Redis is up
kubectl exec -n imvee-dev deployment/redis -- redis-cli ping
# Test session creation
curl -X POST https://api.socsuite.dev.imvee.de/api/v1/auth/password/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"testpass","provider":"local"}'
# Expected: 200 OK with session cookie
# Verify session stored in Redis
kubectl exec -n imvee-dev deployment/redis -- redis-cli --scan --pattern "session:*"Communication Template
**Subject**: [RESOLVED] SOCSuite Authentication Service Restored
**Summary**: Redis session store experienced an outage from 14:30-14:42 UTC. All active sessions
were invalidated. Service is now restored.
**Action Required**: Please re-login to SOCSuite at https://app.socsuite.dev.imvee.de
**Root Cause**: Redis pod restarted due to [OOMKilled / node eviction / manual restart]
**Prevention**: We are implementing Redis persistence and HA cluster to prevent future session loss.
**Questions**: Contact support@imvee.localLong-term Prevention
improvements:
- [ ] Enable Redis RDB persistence (snapshots every 5min)
- [ ] Set up Redis Cluster (3 nodes, HA)
- [ ] Session backup to PostgreSQL (future enhancement)
- [ ] Monitoring: Redis memory usage alerts
- [ ] Alert on Redis pod restarts🔴 INCIDENT: Secrets Compromised (Critical)
Symptoms
- Secrets found in public repo / logs / leak
- Unauthorized access detected in audit logs
- Security researcher/scanner report
IMMEDIATE Actions (within 30 minutes)
# 1. Generate new secrets immediately
cd SOCSuite/scripts
./generate-secrets.sh > /tmp/emergency-secrets.env
# Verify generated secrets
head /tmp/emergency-secrets.env
# 2. Update Kubernetes secrets
kubectl create secret generic backend-secrets \
--from-env-file=/tmp/emergency-secrets.env \
-n imvee-dev --dry-run=client -o yaml | kubectl apply -f -
# 3. Restart backend (invalidates all sessions)
kubectl rollout restart deployment/backend -n imvee-dev
kubectl rollout status deployment/backend -n imvee-dev
# 4. Flush all Redis sessions (force re-login)
kubectl exec -n imvee-dev deployment/redis -- redis-cli FLUSHDB
# 5. Regenerate Keycloak client secrets
# → Keycloak Admin Console (https://auth.dev.imvee.de/admin)
# → Clients → socsuite-frontend → Credentials → Regenerate Secret
# → Update KEYCLOAK_CLIENT_SECRET in backend-secrets
kubectl edit secret backend-secrets -n imvee-dev
# 6. Force all users to re-login
# → Send email: "Security incident: All sessions terminated. Please re-login."
# 7. Audit logs: Check for suspicious activity
curl -X POST "https://opensearch:9200/audit-auth-*/_search" \
-u "admin:$OPENSEARCH_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"query": {
"range": {
"@timestamp": {
"gte": "now-48h"
}
}
},
"sort": [{"@timestamp": "desc"}],
"size": 200
}'
# 8. Remove secrets from git history (if leaked)
# Use BFG Repo-Cleaner: https://rtyley.github.io/bfg-repo-cleaner/
java -jar bfg.jar --delete-files secrets.env
git push --force
# 9. Revoke all API keys (if compromised)
psql $DATABASE_URL -c "UPDATE api_keys SET revoked=true, revoked_at=NOW()"Long-term Actions (within 48 hours)
forensics:
- [ ] Audit trail: Which IPs accessed compromised secrets?
- [ ] Database audit: Was data exfiltrated?
- [ ] OpenSearch query: Failed auth attempts from suspicious IPs?
- [ ] Incident timeline: When was secret leaked? When discovered?
remediation:
- [ ] Git history cleanup (BFG Repo-Cleaner)
- [ ] Update .gitignore and pre-commit hooks
- [ ] Rotate ALL related credentials (DB, Redis, Keycloak, APIs)
- [ ] Security training for team (prevent future leaks)
reporting:
- [ ] Incident report to management/CTO
- [ ] GDPR notification if user data compromised (within 72h)
- [ ] Update security policies
- [ ] Postmortem with lessons learnedEscalation Path: Immediately notify CTO → Consider external security consultant
📞 ESCALATION MATRIX
| Time | Role | Action |
|---|---|---|
| 0-15min | On-call Developer | Diagnose issue, attempt quick fixes |
| 15-30min | DevOps Lead | Rollback deployment, enable degraded mode |
| 30-60min | Engineering Manager | Coordinate team response, update stakeholders |
| 60min+ | CTO | Declare critical incident, external communication |
| Severe | External Consultant | Data breach, critical security incident |
Contact Information
on_call_developer: Check PagerDuty rotation
devops_lead: devops@imvee.local (Slack: #devops)
engineering_manager: engineering@imvee.local
cto: cto@imvee.local (Phone: +49-XXX-XXXXXX)
external_security: security-partner@example.com🛠️ DIAGNOSTIC COMMANDS REFERENCE
Backend Health
# Pod status
kubectl get pods -n imvee-dev -l app=backend
# Recent logs (errors only)
kubectl logs -n imvee-dev deployment/backend --tail=200 | grep -iE "error|panic|fatal"
# Live logs (follow)
kubectl logs -n imvee-dev deployment/backend -f
# Check environment variables
kubectl exec -n imvee-dev deployment/backend -- env | sort
# Test auth endpoint
curl -v -X POST https://api.socsuite.dev.imvee.de/api/v1/auth/password/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"test","provider":"local"}'Keycloak Health
# Pod status
kubectl get pods -n imvee-dev -l app=keycloak
# Health check
curl -k https://auth.dev.imvee.de/health
# OIDC configuration
curl -k https://auth.dev.imvee.de/realms/socsuite/.well-known/openid-configuration
# Admin CLI login
kubectl exec -n imvee-dev deployment/keycloak -- /opt/keycloak/bin/kcadm.sh config credentials \
--server http://localhost:8080 --realm master --user admin --password $KEYCLOAK_ADMIN_PASSWORDRedis Health
# Pod status
kubectl get pods -n imvee-dev -l app=redis
# Ping test
kubectl exec -n imvee-dev deployment/redis -- redis-cli ping
# Memory usage
kubectl exec -n imvee-dev deployment/redis -- redis-cli INFO memory
# Key count
kubectl exec -n imvee-dev deployment/redis -- redis-cli DBSIZE
# Session keys
kubectl exec -n imvee-dev deployment/redis -- redis-cli --scan --pattern "session:*" | head -10OpenSearch Audit Queries
# Failed logins last 24h
curl -X POST "https://opensearch:9200/audit-auth-*/_search" \
-u "admin:$OPENSEARCH_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"query": {
"bool": {
"filter": [
{"term": {"event.keyword": "login"}},
{"term": {"success": false}},
{"range": {"@timestamp": {"gte": "now-24h"}}}
]
}
},
"size": 100
}'
# Logins from specific IP
curl -X POST "https://opensearch:9200/audit-auth-*/_search" \
-u "admin:$OPENSEARCH_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"query": {
"bool": {
"filter": [
{"term": {"ip_address": "192.168.1.100"}},
{"range": {"@timestamp": {"gte": "now-7d"}}}
]
}
}
}'� OPENSEARCH MONITORING SETUP
Overview
5 automated security monitors for authentication threat detection:
monitors:
1. High Authentication Failure Rate (>10 in 5min) - CRITICAL 2. IP-Based Brute Force Attack (>5
from IP) - CRITICAL 3. Account Lockout Pattern (distributed attack) - HIGH 4. Token Refresh
Anomaly (>10 refreshes) - HIGH 5. Session Revocation Events (audit trail) - INFO
deployment: Kubernetes Job (auto-runs on kubectl apply)
index_pattern: audit-auth-*
alerting_plugin: OpenSearch AlertingDeployment
# 1. Deploy monitoring (included in base kustomization)
kubectl apply -k infrastructure/k8s/base
# 2. Verify ConfigMap created
kubectl get configmap opensearch-auth-monitoring -n imvee-dev
# Expected: NAME, DATA=5 (5 monitor definitions)
# 3. Verify init job completed
kubectl get job opensearch-auth-monitoring-init-job -n imvee-dev
# Expected: COMPLETIONS=1/1
# 4. Check job logs
kubectl logs -n imvee-dev job/opensearch-auth-monitoring-init-job
# Expected: "✅ Authentication Monitoring Initialization Complete"Verification
# 1. View monitors in OpenSearch Dashboards
open https://siem.dev.imvee.de
# Navigate: Alerting → Monitors
# Expected: 5 monitors (High Auth Failure, IP Brute Force, etc.)
# 2. Query monitors via API
kubectl port-forward -n imvee-dev opensearch-0 9200:9200
curl -k -u "admin:$OPENSEARCH_PASSWORD" \
"https://localhost:9200/_plugins/_alerting/monitors/_search?size=10" \
| jq '.hits.hits[] | {name: ._source.name, enabled: ._source.enabled}'
# Expected output:
# {
# "name": "High Authentication Failure Rate",
# "enabled": true
# }
# {
# "name": "IP-Based Brute Force Attack",
# "enabled": true
# }
# ...
# 3. Check monitor execution history
curl -k -u "admin:$OPENSEARCH_PASSWORD" \
"https://localhost:9200/.opendistro-alerting-alert-history*/_search?size=5" \
| jq '.hits.hits[] | {monitor: ._source.monitor_name, state: ._source.state}'Test Alert Generation
# Test 1: Trigger "High Authentication Failure Rate" (>10 failures in 5min)
echo "Generating 11 failed login attempts..."
for i in $(seq 1 11); do
curl -X POST http://api.imvee-dev.svc.cluster.local:8080/auth/password/login \
-H "Content-Type: application/json" \
-d '{"username":"test_monitor","password":"wrong_password"}'
sleep 2
done
# Wait 60 seconds for monitor to run
echo "Waiting for monitor execution..."
sleep 60
# Check for alert
curl -k -u "admin:$OPENSEARCH_PASSWORD" \
"https://localhost:9200/.opendistro-alerting-alerts/_search" \
| jq '.hits.hits[] | select(._source.monitor_name == "High Authentication Failure Rate")'
# Expected: Alert document with severity=1, trigger condition met
# Test 2: Trigger "IP-Based Brute Force" (>5 from same IP)
echo "Generating 6 failed logins from same IP..."
for i in $(seq 1 6); do
curl -X POST http://api.imvee-dev.svc.cluster.local:8080/auth/password/login \
-H "Content-Type: application/json" \
-H "X-Forwarded-For: 203.0.113.99" \
-d '{"username":"victim_account","password":"wrong"}'
sleep 2
done
sleep 60
# Check for brute force alert
curl -k -u "admin:$OPENSEARCH_PASSWORD" \
"https://localhost:9200/.opendistro-alerting-alerts/_search" \
| jq '.hits.hits[] | select(._source.monitor_name == "IP-Based Brute Force Attack")'Alert Response Workflow
When monitor triggers alert (view in Dashboards → Alerting → Alerts):
1. High Failure Rate / IP Brute Force:
actions:
- Review alert details (IP, username, attempt count)
- Check IP reputation: https://www.abuseipdb.com/check/[IP]
- Verify rate limiting: kubectl logs deployment/backend | grep "rate limit"
- Consider IP block: kubectl apply -f networkpolicy-block-ip.yaml
- Contact affected user if legitimate lockout
2. Account Lockout Pattern:
actions:
- Identify targeted account from alert
- Contact user via secure channel (phone/Slack DM)
- Verify recent login locations: See "Session API Queries" in RUNBOOKS.md
- Force password reset if suspicious
- Check haveibeenpwned.com for credential breaches
3. Token Refresh Anomaly:
actions:
- Retrieve session details: GET /auth/session/{session_id}
- Check for IP changes within session (potential hijacking)
- Revoke session: POST /auth/session/{session_id}/revoke
- Contact user to verify active devices
- Review user_agent changes (desktop → mobile unexpectedly)
4. Session Revocation:
actions:
- Review audit trail (manual revoke vs. system timeout)
- Verify administrative action authorized
- No action if part of normal operations
- Investigate if bulk revocations (potential attack)Configuring Alerting Destinations (Optional)
# Add Slack webhook destination
curl -X POST "https://opensearch:9200/_plugins/_alerting/destinations" \
-u "admin:$OPENSEARCH_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"name": "security-alerts-slack",
"type": "slack",
"slack": {
"url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
}
}'
# Update monitor to use destination
# 1. Get monitor ID from Dashboards → Alerting → Monitors
# 2. Edit monitor → Actions → Select destination: security-alerts-slack
# 3. Save changes
# Test Slack notification
# (Trigger alert as shown in "Test Alert Generation" above)Troubleshooting
problem: "Job failed (COMPLETIONS=0/1)"
diagnosis:
- kubectl describe job opensearch-auth-monitoring-init-job -n imvee-dev
- kubectl logs job/opensearch-auth-monitoring-init-job -n imvee-dev
causes:
- OpenSearch not ready: Check kubectl get pods -l app=opensearch
- Dashboards not ready: Check kubectl get pods -l app=dashboards
- Invalid OPENSEARCH_PASSWORD secret: Check kubectl get secret opensearch-secret
resolution:
- Wait for OpenSearch/Dashboards pods Running
- Delete job and re-apply: kubectl delete job opensearch-auth-monitoring-init-job && kubectl apply -k .
problem: "Monitors not visible in Dashboards UI"
diagnosis:
- Check job logs for HTTP errors (401, 403, 500)
- Verify monitor creation: curl API endpoint (see Verification above)
causes:
- Authentication failed (wrong password)
- Duplicate monitor names (already exists)
resolution:
- If HTTP 409 (conflict): Monitors already exist, no action needed
- If HTTP 401: Check opensearch-secret → OPENSEARCH_INITIAL_ADMIN_PASSWORD
- Manually delete old monitors: Dashboards → Alerting → Monitors → Delete
problem: "Alerts not triggering"
diagnosis:
- Check monitor execution: Dashboards → Monitors → [Monitor] → History
- Verify audit data exists: curl opensearch:9200/audit-auth-*/_count
causes:
- No failed logins in time window
- Monitor disabled (enabled: false)
- Index pattern wrong (audit-auth-* → audit-login-*)
resolution:
- Generate test data (see "Test Alert Generation")
- Enable monitor: Dashboards → Monitors → Edit → Enable
- Verify audit logging: apps/api/pkg/audit/opensearch.goFiles & References
configmap: infrastructure/k8s/base/opensearch/auth-monitoring.yaml (5 monitor definitions)
init_job: infrastructure/k8s/base/jobs/opensearch-auth-monitoring-init-job.yaml
kustomization: infrastructure/k8s/base/kustomization.yaml (line 48, 77)
documentation: SOCSuite/apps/api/AGENTS.md (Auth architecture reference)
audit_logging: apps/api/pkg/audit/opensearch.go�📚 RELATED DOCUMENTATION
- AUTHENTICATION.md - Auth system architecture
- BACKEND_WORKFLOWS.md (Quelle:
../03_Backend/BACKEND_WORKFLOWS.md) - Secret rotation procedures - AUDIT_LOGGING.md - Audit trail documentation
- K8S_CLUSTER_LIFECYCLE.md (Quelle:
../07_Infrastruktur/K8S_CLUSTER_LIFECYCLE.md) - Cluster operations
Maintained by: DevOps + Backend Team | Updated: 2026-02-17