Cloud Security Posture
Overview
Two phases, never mixed: an evidence-based read-only audit, then remediation through gated plans. IAM, secrets and policy changes are critical and need the user.
When to use
- Security or compliance review of an AWS/GCP/Azure account or a cluster.
- Least-privilege work, key rotation, encryption gaps, admission policies.
- After an incident or before a production launch.
Engine
infra action=status - auth hygiene warnings (long-lived keys, root usage, broad kube contexts).
infra action=discover provider=aws|gcp|azure|kubernetes, infra action=graph op=build to find public exposure paths.
infra action=catalog risk=read query=<iam|kms|policy> for audit operations; run them with infra action=run (read-only, allowed at observe).
- Remediation:
infra action=check each command, infra action=plan, user validation, infra action=run, infra action=verify.
Workflow
- Identity - who has admin, unused roles, keys older than 90 days, MFA, cross-account trust, wildcard policies; Kubernetes cluster-admin bindings, default service accounts with tokens.
- Data - encryption at rest (KMS keys, rotation), public buckets, snapshot sharing, TLS everywhere.
- Secrets - Vault/Secrets Manager/Key Vault usage, no secrets in env files, CI variables or manifests.
- Workloads - image vulnerabilities (Trivy), privileged pods, hostPath, runAsRoot, admission policies (Gatekeeper/Kyverno), runtime detection (Falco).
- Benchmarks - CIS (kube-bench, Prowler, Security Hub, Defender for Cloud, Security Command Center).
- Report findings by severity with evidence, then propose remediation plans.
Command families
aws iam get-account-summary; aws iam generate-credential-report && aws iam get-credential-report
aws iam list-attached-role-policies --role-name <r>; aws accessanalyzer list-findings --analyzer-arn <a>
aws kms list-keys; aws kms get-key-rotation-status --key-id <k>
aws s3api get-public-access-block --bucket <b>; aws securityhub get-findings --max-items 50
prowler aws --severity critical high
gcloud projects get-iam-policy <p>; gcloud iam service-accounts keys list --iam-account <sa>
az role assignment list --all -o table; az security assessment list
kubectl get clusterrolebindings -o wide; kubectl auth can-i --list --as system:serviceaccount:<ns>:<sa>
kube-bench run; trivy image <img>; trivy k8s --report summary cluster; trivy config .
kubectl get constraints; kubectl get clusterpolicy; kubectl logs -n falco -l app.kubernetes.io/name=falco --tail=100
vault status; vault policy list; vault audit list
kubectl get certificates -A
Safety rules
- The audit phase is read-only. Never rotate, revoke or delete during the audit.
- IAM/RBAC changes, key disabling, policy enforcement (Gatekeeper/Kyverno
deny/Enforce) are critical: user validation, and start policies in audit/warn mode.
- Never print secret values; reference them by path.
Verification and rollback
- Verify each remediation with the same audit command that found it.
- Rollback: saved previous policy JSON / RoleBinding YAML, policy back to audit mode, re-enable a key during its grace window.
Deliverable
Findings table (severity, resource, evidence, fix, effort), remediation plans with run ids, before/after evidence, residual risks.
1---2name: cloud-security-posture3description: Audit and harden cloud and Kubernetes security posture - IAM, RBAC, KMS, Vault, cert-manager, OPA/Gatekeeper, Kyverno, Trivy, Falco, CIS benchmarks. Read-only audit first, then gated remediation. Use for posture reviews, compliance checks and hardening.4metadata:5 source: https://skillmd.com/skills/navinspire-ia/cloud-security-posture6 navin:7 emoji: 🛡️8 category: security9---1011# Cloud Security Posture1213## Overview1415Two phases, never mixed: an evidence-based read-only audit, then remediation through gated plans. IAM, secrets and policy changes are critical and need the user.1617## When to use1819- Security or compliance review of an AWS/GCP/Azure account or a cluster.20- Least-privilege work, key rotation, encryption gaps, admission policies.21- After an incident or before a production launch.2223## Engine24251. `infra action=status` - auth hygiene warnings (long-lived keys, root usage, broad kube contexts).262. `infra action=discover provider=aws|gcp|azure|kubernetes`, `infra action=graph op=build` to find public exposure paths.273. `infra action=catalog risk=read query=<iam|kms|policy>` for audit operations; run them with `infra action=run` (read-only, allowed at observe).284. Remediation: `infra action=check` each command, `infra action=plan`, user validation, `infra action=run`, `infra action=verify`.2930## Workflow31321. **Identity** - who has admin, unused roles, keys older than 90 days, MFA, cross-account trust, wildcard policies; Kubernetes cluster-admin bindings, default service accounts with tokens.332. **Data** - encryption at rest (KMS keys, rotation), public buckets, snapshot sharing, TLS everywhere.343. **Secrets** - Vault/Secrets Manager/Key Vault usage, no secrets in env files, CI variables or manifests.354. **Workloads** - image vulnerabilities (Trivy), privileged pods, hostPath, runAsRoot, admission policies (Gatekeeper/Kyverno), runtime detection (Falco).365. **Benchmarks** - CIS (kube-bench, Prowler, Security Hub, Defender for Cloud, Security Command Center).376. **Report** findings by severity with evidence, then propose remediation plans.3839## Command families4041```bash42aws iam get-account-summary; aws iam generate-credential-report && aws iam get-credential-report43aws iam list-attached-role-policies --role-name <r>; aws accessanalyzer list-findings --analyzer-arn <a>44aws kms list-keys; aws kms get-key-rotation-status --key-id <k>45aws s3api get-public-access-block --bucket <b>; aws securityhub get-findings --max-items 5046prowler aws --severity critical high47gcloud projects get-iam-policy <p>; gcloud iam service-accounts keys list --iam-account <sa>48az role assignment list --all -o table; az security assessment list49kubectl get clusterrolebindings -o wide; kubectl auth can-i --list --as system:serviceaccount:<ns>:<sa>50kube-bench run; trivy image <img>; trivy k8s --report summary cluster; trivy config .51kubectl get constraints; kubectl get clusterpolicy; kubectl logs -n falco -l app.kubernetes.io/name=falco --tail=10052vault status; vault policy list; vault audit list53kubectl get certificates -A54```5556## Safety rules5758- The audit phase is read-only. Never rotate, revoke or delete during the audit.59- IAM/RBAC changes, key disabling, policy enforcement (Gatekeeper/Kyverno `deny`/`Enforce`) are critical: user validation, and start policies in audit/warn mode.60- Never print secret values; reference them by path.6162## Verification and rollback6364- Verify each remediation with the same audit command that found it.65- Rollback: saved previous policy JSON / RoleBinding YAML, policy back to audit mode, re-enable a key during its grace window.6667## Deliverable6869Findings table (severity, resource, evidence, fix, effort), remediation plans with run ids, before/after evidence, residual risks.