GCloudCLI icon
If icon
SlackIncomingWebhook icon
Schedule icon

Google Cloud IAM Service Account Key Age and Rotation Sentinel

Audits user-managed Google Cloud IAM service account keys to detect non-rotated credentials older than 90 days.

Categories
CloudInfrastructure

How it works

This workflow enumerates all service accounts in the project via gcloud iam service-accounts list and inspects user-managed keys with gcloud iam service-accounts keys list --managed-by=user. It calculates key ages against the configured rotation threshold (default 90 days per CIS Google Cloud Foundations Benchmark). Stale credentials represent significant security exposure if leaked. Slack is notified with the count of stale keys.

What you get

  • Continuous audit of IAM service account key rotation compliance across your GCP project.
  • Enforces CIS GCP Benchmark 1.4 and SOC2 compliance mandates.
  • Prevents long-lived credential compromise from stale JSON key files.

Who it's for

  • Cloud Security Engineers and Compliance Officers auditing GCP environments.
  • Platform Administrators maintaining IAM identity lifecycle hygiene.

Why orchestrate this with Kestra

  • Comprehensive Project-Wide Scanning: Automatically iterates through all service accounts.
  • Continuous Compliance Enforcement: Run periodic audits without manual security reviews.
  • Clear Actionable Diagnostics: Dispatches precise compliance alerts directly to security teams.

Prerequisites

  • GCP service account with iam.serviceAccounts.list and iam.serviceAccountKeys.list.
  • Secrets GCP_SERVICE_ACCOUNT and SLACK_WEBHOOK configured in Kestra.

Quick start

  1. Import the blueprint.
  2. Configure project ID and max key age.
  3. Run the workflow to inspect service account key rotation.

How to extend

  • Automatically disable keys exceeding 180 days after secondary notification.
  • Transition services to Workload Identity Federation to eliminate static keys entirely.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.