Ensure KMS Encryption Keys Are Rotated Within a Period of 90 Days

Risk Level: High
Cloud Entity: Cloud Key Management Service
CloudGuard Rule ID: D9.GCP.CRY.13
Covered by Spectral: Yes
Category: Networking & Content Delivery

GSL LOGIC

KmsKeyRing should not have cryptoKeys with [ rotationPeriodInDays>90 ]

REMEDIATION

From Portal

  1. Go to Cryptographic Keys by visiting: https://console.cloud.google.com/security/kms.
  2. Click on the specific key ring
  3. From the list of keys, choose the specific key and Click on Right side pop up the blade (3 dots).
  4. Click on Edit rotation period.
  5. On the pop-up window, Select a new rotation period in days which should be less than 90 and then choose Starting on date (date from which the rotation period begins).

From Command Line

  1. Update and schedule rotation by ROTATION_PERIOD and NEXT_ROTATION_TIME for each key:
gcloud kms keys update new --keyring=KEY_RING --location=LOCATION --next-rotation-time=NEXT_ROTATION_TIME --rotation-period=ROTATION_PERIOD

From TF

  1. For the resource "google_kms_crypto_key" and for the argument google_kms_crypto_key.rotation_period make sure value set is NOT greater than 90 days in seconds
    See below example;
resource "google_kms_crypto_key" "example-key" {
	name            = "crypto-key-example"
	key_ring        =  google_kms_key_ring.keyring.id
	rotation_period = "2592000s"
	...
}

References

  1. https://workbench.cisecurity.org/sections/507169/recommendations/827553
  2. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/kms_crypto_key#rotation_period
  3. https://cloud.google.com/kms/docs/rotating-keys

Cloud Key Management Service

Cloud KMS is a cloud-hosted key management service that lets you manage cryptographic keys for your cloud services the same way you do on premises. You can generate, use, rotate, and destroy AES256, RSA 2048, RSA 3072, RSA 4096, EC P256, and EC P384 cryptographic keys. Cloud KMS is integrated with Cloud IAM and Cloud Audit Logging so that you can manage permissions on individual keys and monitor how these are used. Use Cloud KMS to protect secrets and other sensitive data that you need to store in Google Cloud Platform.

Compliance Frameworks

  • CloudGuard GCP All Rules Ruleset
  • GCP CIS Controls V 8
  • GCP CIS Foundations v. 1.1.0
  • GCP CIS Foundations v. 1.2.0
  • GCP CIS Foundations v. 1.3.0
  • GCP CIS Foundations v. 2.0
  • GCP CloudGuard Best Practices
  • GCP NIST 800-53 Rev 5
  • GCP PCI-DSS 4.0