Git, CI/CD & GitOpsXCVII · CI/CD Disaster RecoveryDisasterRecovery
Recovering secrets — the secret store; the rotation
What you'll learn
- Distinguish an external secret store (Vault, AWS Secrets Manager) from a control-plane secret store (GitHub Actions Secrets, GitLab CI Variables)
- Apply the gh secret set command to re-enter a secret after the control plane is recovered
- List the three places a secret value must be available for a CI/CD DR: the password manager, the rebuilt secret store, and the rotated credential
- Identify the rotation discipline that turns a recovered secret into a credential the next incident does not inherit
Prerequisites
Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x
Secrets are the credentials the workflows need to deploy to production, sign artifacts, and authenticate to external systems. A CI/CD disaster that destroys the secret store removes the workflows’ ability to act. The recovery is the third step in the CI/CD DR, after the control plane and the runners are rebuilt.
flowchart LR
A["secret store recovery"] --> B["external store path"]
A --> C["control-plane store path"]
B --> D["Vault unsealed"]
B --> E["AWS Secrets Manager restored"]
C --> F["gh secret set invoked"]
C --> G["GitLab CI variables restored"]
D --> H["jobs can authenticate"]
E --> H
F --> H
G --> H
H --> I["rotate every recovered secret"]
The recovery path depends on whether the secret store lives in the control plane (lost with the orchestrator) or in an external service (recoverable independently).
External secret store
An external secret store — HashiCorp Vault, AWS Secrets Manager, Google Secret Manager — runs in the team’s own infrastructure or in a cloud service separate from the control plane. The store survives the loss of the control plane because the store is not part of the control plane.
The recovery:
- Vault unseal. A Vault cluster is sealed after a restart; the unseal operation requires the unseal keys. Three of five keys (in a typical configuration) are required.
- AWS Secrets Manager restore. A cross-region replica is promoted to primary. The replication lag defines the RPO.
- Audit the access log. Every secret read during the recovery window is logged and reviewed.
Control-plane secret store
A control-plane secret store — GitHub Actions Secrets, GitLab CI Variables — lives inside the control plane and is lost with it. The recovery re-enters the secrets from the password manager once the control plane is rebuilt.
The re-entry command for GitHub Actions Secrets:
gh secret set SECRET_NAME
The command prompts for the value; the value is read from the password manager. For automation, the value is read from a file:
gh secret set SECRET_NAME < $SECRET_VALUE_FILE
The $SECRET_VALUE_FILE is a file the team holds only
during the recovery; the file is deleted after. A file
that lives beyond the recovery is a file the next
incident will find.
The rotation discipline
Every secret that is recovered from the password manager is rotated after the recovery completes. The recovered secret is the secret the team believes is current; the rotation produces a secret the team knows is current.
The rotation sequence:
- Generate the new credential at the source (cloud provider, registry, deploy identity).
- Distribute the new credential to the password manager and to the rebuilt secret store.
- Invalidate the old credential at the source.
- Verify the old credential is rejected.
The runbook includes the rotation as a final step.
Production discipline
- Secrets live in three places, not two. The password manager (source of truth), the secret store (consumed by workflows), and the cloud (validated). All three must agree before a workflow runs.
- Re-entry uses the password manager, not memory. A secret typed from memory is a secret that has drifted.
- Every recovered secret is rotated. The recovery produces the credential the team believes is current; the rotation produces one the team knows is current.
Cross-course references
- Git, CI/CD & GitOps — Part XCIV (Secret-Leak Incident Response) covers the rotation discipline.
- Git, CI/CD & GitOps — Part XCVII-02 (Recovering the Control Plane) covers the control-plane recovery.
- Linux for Production Sysadmins — Part XXXIV (Config Management) covers the password manager.
Quiz
Knowledge check · 4 questions
Q1. After a CI/CD disaster recovery rebuilds the control plane and runners, the team needs to re-enter the production deploy credentials into the GitHub Actions Secrets store. Which command shape is correct?
Q2. A team that recovers the secret store from the password manager and re-enters every secret without rotating any of them has fully recovered the secret store.
Q3. Name the three places a secret value must be available for a CI/CD DR, and state the role each place plays.
Q4. Diagnose the gap in a secret-store recovery and recommend the rotation sequence.
A team uses GitHub Actions Secrets for the CI/CD secret store. The secrets are managed via 1Password and re-entered via `gh secret set` after each rotation. The team's disaster recovery procedure re-enters every secret from 1Password after the control plane is rebuilt but does not include a rotation step. The team has used the same AWS access key for the production deploy identity for fourteen months.
Passing score: 75%. Answers are checked in this browser.