Policy Packs
Check If GCP KMS Crypto Keys Are Rotated Regularly

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

Review policy settings →

Getting Started

Requirements

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.com
export TURBOT_ACCESS_KEY=acce6ac5-access-key-here
export TURBOT_SECRET_KEY=a8af61ec-secret-key-here

Please see Turbot Guardrails Provider authentication for additional authentication methods.

Usage

Install Policy Pack

Note

By 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.git
cd guardrails-samples/policy_packs/gcp/kms/check_crypto_keys_are_rotated_regularly

Run the Terraform to create the policy pack in your workspace:

terraform init
terraform 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.