GCP Security Command Center (SCC) & Secret Manager 🛡️🔑

Google Cloud provides an integrated security fabric anchored by Security Command Center (SCC) (the centralized CSPM, CWPP, and threat detection engine) and Secret Manager (centralized credentials storage).

SCC stands out from third-party security platforms through its agentless, hypervisor-level inspection engines: Virtual Machine Threat Detection (VMTD) analyzes VM memory from the hypervisor layer without running any software agents inside the guest OS.


Architecture & Mental Model

Security Command Center Detection Engines

┌────────────────────────────────────────────────────────────────────────┐
│                   Security Command Center (SCC)                        │
├───────────────────────────────────┬────────────────────────────────────┤
│ Security Health Analytics (SHA)   │ Misconfigurations: open firewalls, │
│                                   │ public buckets, missing MFA        │
├───────────────────────────────────┼────────────────────────────────────┤
│ Event Threat Detection (ETD)      │ Cloud Audit Logs analysis: brute   │
│                                   │ force, IAM privilege escalation    │
├───────────────────────────────────┼────────────────────────────────────┤
│ Container Threat Detection (CTD)  │ GKE runtime: reverse shells,       │
│                                   │ malicious binaries, unauthorized   │
├───────────────────────────────────┼────────────────────────────────────┤
│ VM Threat Detection (VMTD)        │ Hypervisor memory analysis:        │
│                                   │ cryptominers, kernel rootkits      │
└───────────────────────────────────┴────────────────────────────────────┘
                                    │
                                    ▼
┌────────────────────────────────────────────────────────────────────────┐
│ Findings Database (Severity: CRITICAL, HIGH, MEDIUM, LOW)              │
│ └── Exports: Cloud Pub/Sub ──► Cloud Functions / SIEM (Wazuh, Splunk)  │
└────────────────────────────────────────────────────────────────────────┘

Core Concepts

1. SCC Standard vs. Premium / Enterprise

CapabilityStandard TierPremium / Enterprise Tier
CostFree (Included with GCP)Billed per project usage or organization subscription
Asset DiscoveryBasic inventory of cloud assetsReal-time asset inventory and change history
Vulnerability DetectionBasic web security scannerSecurity Health Analytics (SHA) with CIS Benchmarks
Threat DetectionNoneEvent, Container, and VM Threat Detection (VMTD)
Compliance MappingNoneAutomated reports for PCI-DSS, ISO 27001, SOC 2, NIST

2. Secret Manager

Replaces hard-coded credentials, environment variable leaks, and configuration file secrets:

  • Versioning: Secrets are immutable versions (/versions/1, /versions/latest). Updating a password creates a new version without breaking existing active sessions.
  • Automatic Rotation: Triggers Cloud Functions or Pub/Sub topics on a defined schedule to automatically rotate database passwords in Cloud SQL.
  • Native Cloud Run & GKE Integration:
    • Cloud Run mounts secrets directly as environment variables or volume files without writing code.
    • GKE mounts secrets using the Secrets Store CSI Driver.

3. Cloud KMS & Envelope Encryption

Cloud KMS (Key Management Service) manages cryptographic keys (Symmetric, Asymmetric, and FIPS 140-2 Level 3 Cloud HSM):

  • Envelope Encryption:
    • Data Encryption Key (DEK): Fast symmetric key generated locally to encrypt large data payloads.
    • Key Encryption Key (KEK): Stored inside Cloud KMS. Encrypts the DEK. Only the encrypted DEK is stored alongside the ciphertext on disk.
  • Customer-Managed Encryption Keys (CMEK): Allows enterprise security teams to control and revoke encryption keys used by GCS, BigQuery, and Compute Engine on demand.

Production gcloud CLI Commands

1. Provisioning and Accessing Secrets in Secret Manager

# 1. Create a secret
gcloud secrets create stripe-api-key \
  --replication-policy="automatic" \
  --labels=env=production,team=payments
 
# 2. Add a secret version
echo -n "sk_live_51AbcDef1234567890" | gcloud secrets versions add stripe-api-key --data-file=-
 
# 3. Grant a service account read access to the secret
gcloud secrets add-iam-policy-binding stripe-api-key \
  --member="serviceAccount:payment-worker@my-prod-project.iam.gserviceaccount.com" \
  --role="roles/secretmanager.secretAccessor"
 
# 4. Read secret payload (CLI verification)
gcloud secrets versions access latest --secret=stripe-api-key

2. Exporting SCC Findings to Pub/Sub for SIEM Ingestion (Wazuh / Splunk)

# Create continuous finding export for all HIGH and CRITICAL security alerts
gcloud scc findings-exports create scc-to-siem \
  --organization=123456789012 \
  --dataset="projects/my-prod-project/topics/scc-high-alerts" \
  --filter="severity=\"HIGH\" OR severity=\"CRITICAL\""

Quotas & Limits

ParameterLimitProduction Notes
Max payload size (Secret Manager)64 KiB per secret versionStore text tokens, certs, keys; not binary files
Secret Manager read rate10,000 requests/secScales globally across regions
KMS Key rotation scheduleMinimum 24 hoursRecommended 90 days for compliance
SCC Findings retention13 monthsHistorical findings queryable for over a year

References


Pricing Examples

Scenario 1: Secret Manager for Cloud-Native Fleet

  • 50 Microservices in GKE accessing 150 unique secrets.
  • Secrets stored: 150 active secret versions (9.00 / month**).
  • Secret Access Operations: 2 million API calls / month (6.00 / month**).
  • Free Tier: First 6 secret versions and 10,000 operations free.
  • Total Monthly Cost: ~$15.00 / month.

Scenario 2: Security Command Center Premium

  • Mid-sized organization with 25 active projects across compute, storage, and GKE.
  • Pay-As-You-Go model (based on compute utilization):
    • Compute Engine charges: ~$0.0071 / core-hour.
    • 100 active vCPUs running 24/7 (73,000 core-hours) = ~$518.30 / month.
  • Delivers continuous CIS benchmark compliance scanning, hypervisor-level cryptomining detection, and GKE container runtime monitoring.

Nuggets & Gotchas

  1. The Trailing Newline Bug in Secret Manager: When piping secrets into gcloud secrets versions add via bash (e.g. echo "my-password" | gcloud ...), standard echo appends an invisible \n newline character to the end of the secret! When your application reads the token to authenticate with an external API, the request fails with 401 Unauthorized because the secret payload includes the invisible newline. Always use echo -n or upload a file directly.
  2. secretmanager.secretAccessor vs secretmanager.admin: To read a secret value, an identity only needs roles/secretmanager.secretAccessor. Granting roles/secretmanager.admin or viewer allows inspecting metadata and deleting secrets, but does not grant permission to read the actual secret payload!
  3. CMEK Revocation Can Freeze Resources Irreversibly: If you configure Customer-Managed Encryption Keys on BigQuery or Cloud Storage and later disable or delete the KMS key in Cloud KMS, all reads and writes to those tables and buckets fail instantly. If a key is destroyed after the 30-day scheduled destruction window, the encrypted data is permanently and irreversibly lost.
  4. Agentless VMTD Limitations: Virtual Machine Threat Detection (VMTD) operates directly inside the hypervisor, meaning it cannot be disabled or blinded by an attacker who gains root on the guest OS. However, VMTD is only supported on specific machine series (N1, N2, N2D, C2) and cannot inspect memory on ARM-based T2A instances.
  5. Secret Version Destruction Grace Period: When you destroy a secret version, it immediately becomes inaccessible to workloads. However, Google retains the metadata in a DESTROYED state for 30 days before permanent deletion. You cannot reuse the numeric version ID (e.g. version 2 will never be re-allocated).

Across the wiki