Plan: Operational Runbooks

Status

Step Description Status

1

Create runbooks directory and signing key rotation runbook

Done (2026-04-09)

2

Create incident response runbook (FTI breach, HIPAA, service outage)

Done (2026-04-09)

3

Create database backup and restore runbook

Done (2026-04-09)

4

Create service scaling and deployment runbook

Done (2026-04-09)

5

Integrate runbooks into Antora nav.adoc

Done (2026-04-09)

6

Verification: all runbooks render, links work, procedures testable

Done (2026-04-09)

Branch: docs/operational-runbooks

Context

Canopy operates under federal compliance requirements (IRS Pub 1075, HIPAA, 7 USC 2025(e)) that mandate documented incident response and key management procedures. The codebase has the infrastructure (ECDSA P-256 signing, FTI audit logging, breach detection) but no operator-facing runbooks.

The signing infrastructure in crates/canopy-signing/ supports:

  • VerifyingKeyRegistry with RotationState enum (SingleKey, DualKeyRotation) — src/verifier.rs lines 92-159

  • Environment variables: CANOPY_VERIFY_KEY_{PROGRAM} (current) and CANOPY_VERIFY_KEY_{PROGRAM}_PREV (previous during rotation)

  • SigningKey loaded from CANOPY_{SERVICE}__SIGNING_KEY PEM — src/signer.rs

  • NoopSigner for UAT environments without real keys — src/noop.rs

  • Key generation via canopy-signing keygen — src/keygen.rs

The security service (canopy-security) provides:

  • Wildcard # subscriber to canopy.events exchange with audit persistence

  • Breach detection via hash chain verification — GET /v1/security/verify-chain

  • Alert management — GET/PATCH /v1/security/alerts

  • NIST SP 800-53 control mappings — GET /v1/security/nist-controls

Steps

Step 1: Signing key rotation runbook

File: docs/modules/ROOT/pages/runbooks/signing-key-rotation.adoc (NEW)

Create docs/modules/ROOT/pages/runbooks/ directory and the first runbook.

Contents must include:

= Signing Key Rotation
:description: Step-by-step ECDSA P-256 key rotation for determination signing per ADR-002.

== When to Rotate
* Scheduled: annually or per security policy
* Emergency: suspected key compromise

== Prerequisites
* Access to deployment environment variables
* `canopy-signing` keygen tool available
* Deployment pipeline access (Docker Compose or Kubernetes)

== Procedure

=== Phase 1: Generate new key pair
[source,bash]
  cargo run -p canopy-signing -- keygen --output .keys/new-snap.pem

=== Phase 2: Enter dual-key window
Set both current and new keys:
  CANOPY_SNAP__SIGNING_KEY=<new PEM>
  CANOPY_VERIFY_KEY_SNAP=<new public key>
  CANOPY_VERIFY_KEY_SNAP_PREV=<old public key>

Deploy. `VerifyingKeyRegistry::rotation_status()` returns `DualKeyRotation`.
New determinations signed with new key; old determinations still verifiable.

=== Phase 3: Complete rotation
After all in-flight determinations are verified (typically 24-48 hours):
  Remove CANOPY_VERIFY_KEY_SNAP_PREV

Deploy. `rotation_status()` returns `SingleKey`.

== Rollback
If new key causes verification failures:
1. Restore CANOPY_SNAP__SIGNING_KEY to old PEM
2. Set CANOPY_VERIFY_KEY_SNAP back to old public key
3. Redeploy

== Verification
  curl -s http://localhost:8012/v1/security/verify-chain | jq .valid
  # Should return true

Step 2: Incident response runbook

File: docs/modules/ROOT/pages/runbooks/incident-response.adoc (NEW)

Contents must cover three incident types:

FTI Breach (IRS Pub 1075 §10):

  • Notification timeline: IRS within 24 hours of discovery

  • Contact: Treasury Inspector General for Tax Administration (TIGTA)

  • Containment: disable affected service, preserve audit logs

  • canopy-security breach alerts: GET /v1/security/alerts?severity_level=critical

  • FTI audit log preservation: GET /v1/fti-audit-log?from=<incident_start>

HIPAA Breach (45 CFR 164.408):

  • Notification timeline: HHS within 60 days (500+ individuals); affected individuals within 60 days

  • Risk assessment: determine if PHI was actually accessed/acquired

  • Containment and remediation steps

Service Outage:

  • Health check: GET /healthz on each service

  • Database connectivity: check PostgreSQL connections

  • RabbitMQ: check rabbitmq-diagnostics check_running

  • Keycloak: check token endpoint reachable

  • Recovery: cargo xtask dev restart or individual service restart

  • Verify recovery: cargo xtask test against running services

Step 3: Database backup and restore runbook

File: docs/modules/ROOT/pages/runbooks/database-backup-restore.adoc (NEW)

Contents:

  • PostgreSQL backup commands (pg_dump) for each isolated database:

    • canopy_rules (shared postgres:5432)

    • canopy_persons (shared postgres:5432)

    • canopy_applications (shared postgres:5432)

    • canopy_eligibility (shared postgres:5432)

    • canopy_snap (isolated postgres-snap:5432)

    • canopy_tanf (isolated postgres-tanf:5432)

    • canopy_medicaid (isolated postgres-medicaid:5432)

  • Point-in-time recovery procedure

  • FTI data handling: FTI tables (fti_audit_log, fti_tax_data) must be backed up with encryption at rest per Pub 1075

  • Restore procedure with migration verification (sqlx migrate run)

  • Verification: run integration tests post-restore

Step 4: Service scaling and deployment runbook

File: docs/modules/ROOT/pages/runbooks/scaling-deployment.adoc (NEW)

Contents:

  • Docker Compose profile management:

    • cargo xtask dev start (full profile)

    • cargo xtask dev start --profile snap-only

    • --shared-db flag for resource-constrained environments

  • Adding new service instances (horizontal scaling)

  • Environment variable reference for each service

  • Rolling deployment procedure (zero-downtime via health checks)

  • Rollback: docker compose down && docker compose up -d with previous image tag

  • Verification: health checks + cargo xtask test

Step 5: Integrate into Antora nav

File: docs/modules/ROOT/nav.adoc

Add a Runbooks section under the existing Operations heading:

* Runbooks
** xref:runbooks/signing-key-rotation.adoc[Signing Key Rotation]
** xref:runbooks/incident-response.adoc[Incident Response]
** xref:runbooks/database-backup-restore.adoc[Database Backup & Restore]
** xref:runbooks/scaling-deployment.adoc[Scaling & Deployment]

Step 6: Verification

  1. npx antora antora-playbook.yml (or local Antora build) renders all runbook pages

  2. All internal links (xref:) resolve correctly

  3. Shell commands in runbooks are syntactically valid

  4. Runbooks reference correct environment variable names (verify against docker-compose.yml)

  5. Each runbook has a "Verification" section with testable steps

Files Touched

File Change

docs/modules/ROOT/pages/runbooks/signing-key-rotation.adoc

NEW — key rotation procedure with dual-key window

docs/modules/ROOT/pages/runbooks/incident-response.adoc

NEW — FTI breach, HIPAA breach, service outage procedures

docs/modules/ROOT/pages/runbooks/database-backup-restore.adoc

NEW — per-database backup/restore with FTI handling

docs/modules/ROOT/pages/runbooks/scaling-deployment.adoc

NEW — Docker Compose profiles, scaling, rollback

docs/modules/ROOT/nav.adoc

Add Runbooks section under Operations

Edit this page · default