A vault password or SSH key has leaked. What do you do?
AdvancedProductionSecurity and Secrets
Answer
- Contain: revoke the leaked credential (remove the key from
authorized_keysvia a quickexclusive: trueplay, or disable the CI token), and restrict access paths if compromise is suspected. - Rotate: change the vault password with
rekeyand, crucially, rotate every secret the vault protected, because anyone with the repo history and the old password can read earlier versions. - Investigate: check audit logs (AWX activity stream, sudo/auth logs, CloudTrail) for use of the credential.
- Fix the cause: how did it leak (logs, laptop, chat)? Add a control such as a secret scanner or short-lived credentials.
- Document the incident and the new rotation process.
Speed matters most in step 1, and completeness in step 2.
More on Security and Secrets
How do you set up a secure automation user and SSH access?BeginnerHow do you give the automation user sudo with least privilege?IntermediateWhat are the alternatives to Ansible Vault for secrets, and when do you use them?IntermediateHow do you read AWS Secrets Manager and SSM parameters in a playbook?IntermediateHow do you integrate HashiCorp Vault with Ansible?AdvancedHow do you stop secrets from leaking into logs and output?Beginner