Check If GCP KMS Crypto Keys Are Rotated Regularly
KMS Crypto Keys should be rotated on regular basis. A rotation schedule defines the frequency of rotation, and optionally the date and time when the first rotation occurs. The rotation schedule can be based on either the key's age or the number or volume of messages encrypted with a key version. Enforcing regular rotation of GCP KMS crypto keys is essential for maintaining the security and integrity of encrypted data. Regular key rotation mitigates the risk of key compromise, ensuring that even if a key is exposed, its usage window is limited, thereby enhancing overall security and ensuring compliance with best practices and regulatory requirements.
This policy pack can help you configure the following settings for KMS crypto keys:
- Check and alarm if crypto keys have rotation period of more than 90 days
Getting Started
Requirements
- Terraform
- Guardrails mods:
Credentials
To create a policy pack through Terraform:
- Ensure you have
Turbot/Admin
permissions (or higher) in Guardrails - Create access keys in Guardrails
And then set your credentials:
export TURBOT_WORKSPACE=myworkspace.acme.comexport TURBOT_ACCESS_KEY=acce6ac5-access-key-hereexport TURBOT_SECRET_KEY=a8af61ec-secret-key-here
Please see Turbot Guardrails Provider authentication for additional authentication methods.
Usage
Install Policy Pack
NoteBy default, installed policy packs are not attached to any resources.
Policy packs must be attached to resources in order for their policy settings to take effect.
Clone:
git clone https://github.com/turbot/guardrails-samples.gitcd guardrails-samples/policy_packs/gcp/kms/check_crypto_keys_are_rotated_regularly
Run the Terraform to create the policy pack in your workspace:
terraform initterraform plan
Then apply the changes:
terraform apply
Apply Policy Pack
Log into your Guardrails workspace and attach the policy pack to a resource.
If this policy pack is attached to a Guardrails folder, its policies will be applied to all accounts and resources in that folder. The policy pack can also be attached to multiple resources.
For more information, please see Policy Packs.