Cis benchmarks

From frank-luongt/faos-skills-marketplace · View interactive version

Cis benchmarks is an AI agent skill from the GitHub repository frank-luongt/faos-skills-marketplace. CIS Benchmarks reference for Kubernetes, Docker, and GCP hardening with automated scanning guidance

How to use this skill

Skill file

<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->


name: cis-benchmarks

description: CIS Benchmarks reference for Kubernetes, Docker, and GCP hardening with automated scanning guidance


CIS Benchmarks Reference

Overview

The Center for Internet Security (CIS) publishes consensus-based security configuration benchmarks for operating systems, cloud platforms, containers, and orchestrators. CIS Benchmarks provide prescriptive, testable hardening recommendations organized into two levels:

This skill covers the three benchmarks most relevant to the FAOS platform:

| Benchmark | Current Version | Controls | Primary Tool |

|----------------------------|-----------------|----------|-------------------|

| CIS Kubernetes Benchmark | v1.9.0 | ~120 | kube-bench |

| CIS Docker Benchmark | v1.6.0 | ~100 | docker-bench-security |

| CIS GCP Foundations | v3.0.0 | ~80 | Forseti / SCC |

Each benchmark maps to broader frameworks (NIST 800-53, ISO 27001, SOC 2) making CIS compliance a strong foundation for multi-framework audits.

When to Use This Skill

How It Works

Step 1: Select the Applicable Benchmark

Identify which benchmarks apply based on your infrastructure stack. For a typical FAOS deployment on GKE:

Download the latest benchmark PDFs from the CIS website (free registration required) or use the CIS-CAT Pro tool for automated assessment.

Step 2: Run Automated Scans

Use purpose-built tools to assess compliance automatically:

# Kubernetes: kube-bench (runs CIS Kubernetes Benchmark checks)
# Install via Helm or run as a Job
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml
kubectl logs -l app=kube-bench --tail=-1

# Docker: docker-bench-security
git clone https://github.com/docker/docker-bench-security.git
cd docker-bench-security
sudo sh docker-bench-security.sh

# GCP: Security Command Center (SCC) with CIS compliance module
gcloud scc findings list organizations/$ORG_ID \
  --filter="category=\"CIS_BENCHMARK\"" \
  --format=json

For GKE specifically, Google Cloud Security Command Center provides built-in CIS Kubernetes Benchmark scanning without additional tooling.

Step 3: Review Findings

Scan output categorizes findings as PASS, FAIL, WARN, or INFO. Focus triage on:

  1. FAIL at Level 1 -- these are baseline gaps that should be remediated first
  2. FAIL at Level 2 -- evaluate based on your security requirements
  3. WARN -- manual verification needed; the tool could not determine status automatically

Map each finding to its control ID (e.g., 1.2.3) for tracking in your compliance management system.

Step 4: Remediate by Priority

Prioritize remediation using this order:

  1. Critical exposure -- unauthenticated API access, anonymous auth enabled, unencrypted etcd
  2. Privilege escalation -- excessive RBAC permissions, privileged containers, hostPID/hostNetwork
  3. Data protection -- secrets not encrypted at rest, audit logging disabled
  4. Network hardening -- missing NetworkPolicies, overly permissive firewall rules
  5. Operational hygiene -- missing resource limits, missing labels, outdated images

Step 5: Re-validate After Remediation

After applying fixes, re-run the automated scans to confirm remediation:

# Re-run kube-bench and compare
kubectl apply -f kube-bench-job.yaml
kubectl logs -l app=kube-bench --tail=-1 | grep -E "^\[FAIL\]" | wc -l

# Track progress over time
echo "$(date +%Y-%m-%d),$(kubectl logs -l app=kube-bench --tail=-1 | grep -c FAIL)" >> cis-progress.csv

Integrate CIS scanning into CI/CD pipelines to catch regressions on every infrastructure change.

Examples

Example 1: Running kube-bench on GKE and Interpreting Results

Deploy kube-bench as a Kubernetes Job targeting the GKE-specific benchmark:

# kube-bench-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: kube-bench
spec:
  template:
    spec:
      hostPID: true
      containers:
      - name: kube-bench
        image: aquasec/kube-bench:v0.8.0
        command: ["kube-bench", "run", "--benchmark", "gke-1.6.0", "--json"]
        volumeMounts:
        - name: var-lib-kubelet
          mountPath: /var/lib/kubelet
          readOnly: true
        - name: etc-systemd
          mountPath: /etc/systemd
          readOnly: true
      restartPolicy: Never
      volumes:
      - name: var-lib-kubelet
        hostPath:
          path: /var/lib/kubelet
      - name: etc-systemd
        hostPath:
          path: /etc/systemd

Interpreting the JSON output:

{
  "Controls": [
    {
      "id": "4.2",
      "text": "Pod Security Standards",
      "tests": [
        {
          "section": "4.2.1",
          "desc": "Minimize the admission of privileged containers",
          "status": "FAIL",
          "remediation": "Apply PodSecurity admission controller with 'restricted' profile"
        }
      ]
    }
  ],
  "Totals": { "total_pass": 42, "total_fail": 8, "total_warn": 12, "total_info": 3 }
}

A total_fail of 8 means 8 controls need immediate attention. Filter for Level 1 failures first.

Example 2: Docker Daemon Hardening Configuration

Apply CIS Docker Benchmark Level 1 recommendations via /etc/docker/daemon.json:

{
  "icc": false,
  "iptables": true,
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "live-restore": true,
  "no-new-privileges": true,
  "userland-proxy": false,
  "userns-remap": "default",
  "storage-driver": "overlay2",
  "default-ulimits": {
    "nofile": {
      "Name": "nofile",
      "Hard": 65536,
      "Soft": 32768
    }
  },
  "tls": true,
  "tlscacert": "/etc/docker/certs/ca.pem",
  "tlscert": "/etc/docker/certs/server-cert.pem",
  "tlskey": "/etc/docker/certs/server-key.pem",
  "tlsverify": true
}

Key settings explained:

| Setting | CIS Control | Purpose |

|--------------------|-------------|----------------------------------------------|

| icc: false | 2.1 | Disable inter-container communication |

| no-new-privileges| 2.18 | Prevent privilege escalation in containers |

| userns-remap | 2.8 | Enable user namespace remapping |

| tls/tlsverify | 2.6 | Protect Docker daemon socket with TLS |

| live-restore | 2.14 | Keep containers running during daemon restart |

| log-driver | 2.12 | Ensure container logging is configured |

Best Practices

Do This

Don't Do This

Security Checklist

Kubernetes Hardening

Docker Hardening

GCP Hardening

Related Skills

Additional Resources

<!-- Source: .faos/custom/skills/security/cis-benchmarks/SKILL.md -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.