A flexible, security-focused framework for scanning containers in Kubernetes environments with multiple scanning engines. Built initially with CINC Auditor (open source InSpec), the platform provides secure RBAC configurations, multiple scanning approaches, and comprehensive CI/CD integration for validating container compliance in both standard and distroless containers.
Our solution offers three distinct technical approaches for container scanning:
- Kubernetes API Approach (Recommended): Direct API-based scanning through the Kubernetes API using the train-k8s-container plugin. This is our recommended enterprise solution with future distroless support in development, offering the most scalable and seamless integration. Once distroless support is implemented, this will be a universal solution for all container types.
- Debug Container Approach: Ephemeral debug container with chroot-based scanning for distroless containers, ideal for environments with ephemeral container support.
- Sidecar Container Approach: CINC Auditor sidecar container with shared process namespace for any container type, offering universal compatibility across Kubernetes versions.
These approaches can be deployed via:
- Self-contained shell scripts for direct management and testing
- Modular Helm charts for declarative, enterprise deployment
- CI/CD integration with GitHub Actions and GitLab CI for both minikube-based and existing Kubernetes clusters
The platform works in both local minikube environments and existing production Kubernetes clusters, with specialized security controls that address the fundamental challenges of privileged container scanning:
- Least Privilege Access - Restrict scanning to specific containers only
- Dynamic Access Control - Create temporary, targeted access for scanning
- CI/CD Integration - Ready-to-use scripts and templates for pipeline integration
- Threshold Validation - Integration with MITRE SAF CLI for compliance validation
- Distroless Support - Specialized approach for scanning distroless containers
- Modular Deployment - Supporting both script-based and Helm-based approaches
The project currently offers two complete deployment methods with flexible scanner engine support:
- Shell Script Approach - Simple, self-contained scripts for setup and scanning
- Helm Chart Approach - Modular Helm charts for more complex deployments
Both approaches support:
- Standard container scanning with pluggable scanner engines
- Threshold validation with MITRE SAF CLI
- CI/CD pipeline integration
- Dynamic RBAC with least privilege
- Token-based authentication
- Extensible architecture for adding new scanning engines
We now provide three distinct approaches for scanning distroless containers:
-
Kubernetes API Approach (Enterprise Recommended) - Enhanced train-k8s-container plugin for direct, API-based scanning:
- Implementation: Currently being developed as our strategic enterprise solution
- Advantage: No additional containers required, most efficient and scalable approach
- Advantage: Seamless integration with existing CINC Auditor/InSpec workflows
- Advantage: Transparent to users - same commands for both standard and distroless containers
- Key Advantage: Will become a universal solution for all container types once distroless support is implemented
- Status: In active development with high priority for enterprise environments
-
Debug Container Approach - Uses
kubectl debug
to attach a debug container and scan via chroot:- Implementation: The
scan-distroless-container.sh
script demonstrates this approach - Limitation: Requires Kubernetes clusters with ephemeral container support enabled
- Use Case: Best for testing and development environments with ephemeral container support
- Implementation: The
-
Sidecar Container Approach - Deploys a scanner sidecar in the same pod with shared process namespace:
- Implementation: Fully implemented in
scan-with-sidecar.sh
and integrated with CI/CD examples - Advantage: Works with any Kubernetes cluster, requires no special features
- Advantage: Can scan any container type, including distroless containers
- Limitation: Must be deployed alongside the target container (can't scan existing containers)
- Use Case: Ideal for environments without ephemeral container support or for universal compatibility
- Implementation: Fully implemented in
.
βββ docs/ # Comprehensive documentation
β βββ approaches/ # Scanning approach documentation
β β βββ comparison.md # Comparison of scanning approaches
β β βββ decision-matrix.md # Decision matrix for approach selection
β β βββ direct-commands.md # Direct command usage documentation
β β βββ index.md # Approaches overview
β β βββ inventory.md # Directory contents
β β βββ debug-container/ # Debug container approach
β β βββ kubernetes-api/ # Kubernetes API approach
β β βββ sidecar-container/ # Sidecar container approach
β β βββ helper-scripts/ # Helper scripts documentation
β βββ architecture/ # Architecture documentation
β β βββ components/ # Core and security components
β β βββ deployment/ # Deployment methods
β β βββ diagrams/ # Visual diagrams for workflows
β β βββ integrations/ # Integration architecture
β β βββ workflows/ # Workflow process documentation
β βββ configuration/ # Configuration documentation
β β βββ advanced/ # Advanced configuration
β β βββ integration/ # Integration configuration
β β βββ kubeconfig/ # Kubeconfig management
β β βββ plugins/ # Plugins configuration
β β βββ security/ # Security configuration
β β βββ thresholds/ # Threshold configuration
β βββ learning-paths/ # Guided learning paths
β β βββ new-users.md # For new users
β β βββ security-first.md # Security-focused implementation
β β βββ core-concepts.md # Core concepts
β β βββ implementation.md # Implementation guide
β β βββ advanced-features.md # Advanced features
β βββ tasks/ # Task-oriented guides
β β βββ standard-container-scan.md # Standard container scanning
β β βββ distroless-container-scan.md # Distroless container scanning
β β βββ sidecar-container-scan.md # Sidecar container scanning
β β βββ github-integration.md # GitHub integration
β β βββ gitlab-integration.md # GitLab integration
β β βββ kubernetes-setup.md # Kubernetes setup
β βββ security/ # Security documentation
β β βββ compliance/ # Compliance documentation
β β β βββ nsa-cisa-hardening.md # NSA/CISA Kubernetes Hardening Guide
β β βββ principles/ # Security principles
β β βββ recommendations/ # Security recommendations
β β βββ risk/ # Risk analysis
β β βββ threat-model/ # Threat modeling
β βββ helm-charts/ # Helm chart documentation
β β βββ infrastructure/ # Infrastructure components
β β βββ operations/ # Operations guidance
β β βββ overview/ # Architecture overview
β β βββ scanner-infrastructure/ # Scanner infrastructure
β β βββ scanner-types/ # Scanner implementations
β β βββ security/ # Security considerations
β β βββ usage/ # Usage guides
β βββ integration/ # CI/CD integration guides
β β βββ configuration/ # Integration configuration
β β βββ examples/ # Integration examples
β β βββ platforms/ # Platform-specific guides
β β βββ workflows/ # Integration workflows
β βββ kubernetes-scripts/ # Kubernetes script documentation
β βββ kubernetes-setup/ # Kubernetes setup documentation
β β βββ best-practices.md # Kubernetes best practices
β β βββ existing-cluster-requirements.md # Existing cluster setup
β β βββ minikube-setup.md # Minikube setup guide
β βββ project/ # Project documentation
β β βββ changelog.md # Detailed changelog
β β βββ roadmap.md # Project roadmap
β β βββ tasks.md # Task tracking
β β βββ documentation-structure-progress.md # Documentation progress
β βββ site-index.md # Site index with navigation aids
β βββ common-abbreviations.md # Common abbreviations reference
β βββ rbac/ # RBAC configuration guides
β βββ service-accounts/ # Service account setup
β βββ tokens/ # Token management
βββ scripts/ # Automation scripts
β βββ doc-tools/ # Documentation tools
β β βββ extract-doc-warnings.sh # Extract documentation warnings
β β βββ fix-links.sh # Fix documentation links
β β βββ track-warning-progress.sh # Track warning resolution
β βββ kubernetes/ # Kubernetes scripts
β β βββ generate-kubeconfig.sh # Generate restricted kubeconfig
β β βββ scan-container.sh # End-to-end container scanning
β β βββ scan-distroless-container.sh # Distroless container scanning
β β βββ scan-with-sidecar.sh # Sidecar container scanning
β β βββ setup-minikube.sh # Multi-node minikube setup
β βββ project-maintenance/ # Project maintenance scripts
βββ kubernetes/ # Kubernetes manifests
β βββ templates/ # Template YAML files
βββ helm-charts/ # Modular Helm charts for deployment
β βββ scanner-infrastructure/ # Core RBAC, service accounts
β βββ common-scanner/ # Common scanning components
β βββ standard-scanner/ # Standard container scanning
β βββ distroless-scanner/ # Distroless container scanning
β βββ sidecar-scanner/ # Sidecar approach for container scanning
βββ github-workflow-examples/ # GitHub Actions workflow examples
β βββ setup-and-scan.yml # Basic setup and scan workflow
β βββ dynamic-rbac-scanning.yml # Dynamic pod scanning with RBAC
β βββ ci-cd-pipeline.yml # Complete CI/CD pipeline with scanning
β βββ sidecar-scanner.yml # Sidecar container scanning workflow
βββ gitlab-pipeline-examples/ # GitLab CI examples
β βββ gitlab-ci.yml # Standard GitLab CI configuration
β βββ gitlab-ci-with-services.yml # GitLab CI with services
β βββ gitlab-ci-sidecar.yml # GitLab CI with sidecar approach
β βββ gitlab-ci-sidecar-with-services.yml # GitLab CI sidecar with services
βββ examples/ # Example resources
βββ cinc-profiles/ # Example CINC Auditor profiles
βββ cinc-auditor-scanner/ # Dockerfile for scanner sidecar container
βββ sidecar-scanner-pod.yaml # Example sidecar container pod
The quickest way to set up a test environment is using our automated setup script:
# Set up a 3-node minikube cluster with standard containers
./scripts/setup-minikube.sh
# For distroless container scanning support (experimental)
./scripts/setup-minikube.sh --with-distroless
# For a customized setup
./scripts/setup-minikube.sh --nodes=2 --driver=virtualbox --install-deps
The script will:
- Check and optionally install dependencies
- Create a multi-node minikube cluster
- Deploy the necessary RBAC and service accounts using kubectl directly (not Helm)
- Set up test pods
- Generate a kubeconfig file
- Provide instructions for running scans
- Set up the Kubernetes resources:
kubectl apply -f kubernetes/templates/namespace.yaml
kubectl apply -f kubernetes/templates/service-account.yaml
kubectl apply -f kubernetes/templates/rbac.yaml
kubectl apply -f kubernetes/templates/test-pod.yaml
- Generate a kubeconfig file:
./scripts/generate-kubeconfig.sh inspec-test inspec-scanner ./kubeconfig.yaml
- Run a CINC Auditor scan:
KUBECONFIG=./kubeconfig.yaml cinc-auditor exec ./examples/cinc-profiles/container-baseline \
-t k8s-container://inspec-test/inspec-target/busybox
- Process results with SAF CLI (optional):
# Generate a summary report
saf summary --input inspec-results.json --output-md summary.md
# Validate against threshold requirements
saf threshold -i inspec-results.json -t threshold.yml
We provide specialized Helm charts as an alternative deployment method:
# Install the standard-scanner chart
helm install standard-scanner ./helm-charts/standard-scanner \
--set common-scanner.scanner-infrastructure.targetNamespace=inspec-test \
--set testPod.deploy=true
# Generate a kubeconfig and run a scan
./scripts/generate-kubeconfig.sh inspec-test inspec-scanner ./kubeconfig.yaml
KUBECONFIG=./kubeconfig.yaml cinc-auditor exec ./examples/cinc-profiles/container-baseline \
-t k8s-container://inspec-test/inspec-target/busybox
We provide three approaches for scanning distroless containers:
# Install the distroless-scanner chart
helm install distroless-scanner ./helm-charts/distroless-scanner \
--set common-scanner.scanner-infrastructure.targetNamespace=inspec-test \
--set testPod.deploy=true
# Generate a kubeconfig and run a specialized scan
./scripts/generate-kubeconfig.sh inspec-test inspec-scanner ./kubeconfig.yaml
./scripts/scan-distroless-container.sh inspec-test distroless-target distroless ./examples/cinc-profiles/container-baseline
# Deploy a pod with sidecar container for scanning
kubectl apply -f examples/sidecar-scanner-pod.yaml
# Wait for the pod to be ready
kubectl wait --for=condition=ready pod/app-scanner -n inspec-test --timeout=300s
# Check scan results directly from the sidecar
kubectl exec -it app-scanner -n inspec-test -c scanner -- cat /results/scan-summary.md
We provide ready-to-use CI/CD examples for the sidecar approach:
- GitLab CI:
gitlab-examples/gitlab-ci-sidecar.yml
- GitLab CI with Services:
gitlab-examples/gitlab-ci-sidecar-with-services.yml
- GitHub Actions:
github-workflows/sidecar-scanner.yml
These examples automatically deploy, scan, and retrieve results from a scanner sidecar container.
See the Distroless Container Documentation and Sidecar Container Approach for more details.
- Copy the workflow files to your repository's
.github/workflows
directory:
mkdir -p .github/workflows
cp github-workflows/* .github/workflows/
- Commit and push the changes
- Run the workflows from the GitHub Actions tab in your repository
- Copy the
.gitlab-ci.yml
file to your repository root:
cp gitlab-examples/gitlab-ci.yml .gitlab-ci.yml
- Customize the file for your environment
- Commit and push the changes
For CI/CD pipelines, this project provides:
- GitLab CI/CD example configurations in
gitlab-examples/
- GitHub Actions workflows in
github-workflows/
- Dynamic access creation scripts
- Cleanup procedures to avoid resource leaks
- SAF CLI integration for threshold validation
- No permanent elevated privileges
- No shared access between scans
- Time-limited token generation (default: 15 minutes)
- Fine-grained RBAC controls
- Namespace isolation
- Support for label-based scanning
- Support for named resource restrictions
- Multiple deployment methods (scripts or Helm)
- Configurable threshold validation
- Modular Helm chart structure
- Comprehensive documentation
- Ready-to-use scripts
- Helm chart deployment
- Example profiles and configurations
- GitHub Actions and GitLab CI integration
The project integrates with MITRE Security Automation Framework (SAF) CLI for:
- Results processing and summary generation
- Threshold validation for compliance requirements
- JSON, Markdown, and HTML report generation
Example threshold configuration:
# threshold.yml
compliance:
min: 80 # Minimum 80% compliance required
failed:
critical:
max: 0 # No critical failures allowed
high:
max: 2 # Maximum 2 high failures allowed
Visit our comprehensive documentation at:
We provide a comprehensive documentation system with tools for previewing, validating, and improving documentation quality:
# Use the documentation tools script from the project root
./docs-tools.sh preview # Preview documentation (background server)
./docs-tools.sh status # Check server status
./docs-tools.sh restart # Restart server
./docs-tools.sh stop # Stop server
./docs-tools.sh setup # Install all documentation dependencies
./docs-tools.sh lint # Check Markdown style
./docs-tools.sh fix # Fix common Markdown issues
./docs-tools.sh check-all # Run comprehensive quality checks
./docs-tools.sh help # See all available commands
This project provides a comprehensive set of documentation management tools:
-
docs-tools.sh
- Interactive documentation management tool for developers:- Located at: Available both in project root (symlinked) and in
docs/docs-tools.sh
(original) - Purpose: Day-to-day documentation development and testing
- Features: Preview server, linting, spell checking, link validation, and more
- Usage: Run from either location with
./docs-tools.sh [command]
- Note: The script automatically adapts to being run from either location
- Located at: Available both in project root (symlinked) and in
-
docs-ci.sh
- Automated documentation validation for CI/CD pipelines:- Located at: Project root
- Purpose: Verify documentation quality in automated builds
- Features: Non-interactive validation for continuous integration
- Usage: Used by CI/CD pipelines or run with
./docs-ci.sh [--help]
to validate locally - Supports:
--help
flag for usage information and--verbose
flag for detailed output
-
Documentation Fix Utilities - Specialized tools for documentation maintenance:
- Located at:
scripts/doc-tools/
- Purpose: Fix and track documentation issues
- Key utilities:
extract-doc-warnings.sh
: Generate comprehensive issue reportsfix-links.sh
: Fix broken links using mappings filetrack-warning-progress.sh
: Monitor documentation improvementsfix-cross-references.sh
: Fix cross-references between filesgenerate-doc-mappings.sh
: Generate file mappings for documentation
- Located at:
The documentation system includes:
- MkDocs with Material theme for beautiful documentation
- Markdown style checking with markdownlint
- Spell checking with pyspelling
- Link validation with linkchecker
- Comprehensive quality validation tools
For more details, see Documentation Management
Our documentation covers the following areas:
- Standard Container Scan
- Distroless Container Scan
- Sidecar Container Scan
- GitHub Integration
- GitLab Integration
- Kubernetes Setup
- Approach Comparison
- Decision Matrix
- Kubernetes API Approach
- Debug Container Approach
- Sidecar Container Approach
- Helper Scripts
- Security Principles
- Risk Analysis
- Threat Model
- Compliance
- NSA/CISA Hardening Guide
- Security Recommendations
- RBAC Configuration
- Label-based RBAC
- Service Account Management
- Token Management
- Kubeconfig Management
- Threshold Configuration
- Helm Charts Overview
- Helm Chart Architecture
- Scanner Infrastructure
- Common Scanner
- Standard Scanner
- Distroless Scanner
- Sidecar Scanner
- Kubernetes 1.24+ (for token creation API)
- kubectl
- CINC Auditor with train-k8s-container plugin
- MITRE SAF CLI (for threshold validation)
- Helm 3.2.0+ (for Helm deployment)
- Overall Project Completion: ~90%
- Documentation Completion: 95%
- Core Functionality: 100%
- Testing Coverage: 70%
- Scanner Engine Support:
- CINC Auditor (InSpec): 100%
- Additional engines: Planned for post-v1.0 releases
- Next Major Milestone: Complete API-based approach and v1.0.0 release
- Target Release Date: May 2025
-
Multi-Approach Container Scanning:
- β
Implemented three distinct approaches:
- β Ephemeral debug container (requires special cluster feature)
- β Sidecar container with shared process namespace (works universally)
- π API-based direct scanning approach (20% complete, in progress)
- β Integrated all approaches with CI/CD examples
- β Created comprehensive documentation for all approaches
- β Completed approach comparison and decision matrix
- π Future work will focus on completing the API-based approach
- β
Implemented three distinct approaches:
-
Scanner Engine Support:
- β CINC Auditor (InSpec) integration complete
- π Extensible architecture for additional scanning engines
- π Plugin interface for scanner integration (planned)
- π Scanner results normalization layer (planned)
- π Support for additional scanners post-v1.0
-
Documentation and Resources:
- β Implemented comprehensive MkDocs documentation system
- β Created workflow diagrams for all scanning approaches
- β Developed security analysis and risk documentation
- β Added enterprise integration analysis documentation
- β Reorganized documentation into logical structure
- β Identified documentation gaps for contribution
- β Implemented dark/light mode support for diagrams
- π Addressing high-priority documentation gaps before v1.0.0 release
-
CI/CD Integration:
- β GitLab CI standard pipeline
- β GitLab CI with services
- β GitLab CI for sidecar approach
- β GitLab CI with services for sidecar approach
- β GitHub Actions for standard approach
- β GitHub Actions for sidecar approach
- β Comprehensive integration documentation
- π Future work will include examples for other CI/CD platforms
-
Performance and Container Images:
- β Implemented services-based approach for GitLab CI
- β Created optimized sidecar container implementations
- π Future work will include building and publishing dedicated scanner containers
- π Creating specialized debug containers with scanners pre-installed
- π Creating sidecar container images with optimized configurations
- π Performance optimization with large-scale scanning
For a detailed view of our roadmap and project status, see:
- Project Roadmap - Detailed roadmap with phase completion percentages
- Task Tracker - Comprehensive task list with completion status
- Changelog - Detailed record of recent changes and improvements
- Documentation Gaps - Analysis of remaining documentation needs
Kube Secure Scanner - Developed by the project collaborators with experimental collaboration from Claude Code