Rotate the credential encryption key
If your encryption key is compromised, or your security policy requires you to rotate encryption keys periodically, use the key rotation command to re-encrypt all stored credentials with a new key.
Before you begin
- The automation orchestrator backend is stopped. The rotation command runs offline to prevent concurrent access during re-encryption.
- You have generated a new 64-character hexadecimal encryption key:
$ openssl rand -hex 32
Procedure
Results
Exit codes:
| Exit code | Meaning |
|---|---|
| 0 | All credentials were re-encrypted successfully. |
| 1 | Partial failure. Some credentials could not be re-encrypted. Review the output and re-run the command after resolving the issue. |
| 2 | Fatal error. No credentials were modified. Typically indicates an invalid key format or a database connection failure. |
If the rotation is interrupted, you can safely re-run the command with the same old and new keys. The rotation command skips credentials that were already re-encrypted.
Options:
| Option | Description |
|---|---|
--dry-run |
Verify that all credentials can be decrypted and re-encrypted without writing changes to the database. |
--batch-size |
Number of credential rows to process per database commit (default: 50). |