Skip to main content

AWS Security Compliance Scanner - Automated security scanning aligned with CIS AWS Foundations Benchmark

Project description

CloudGuard - AWS Security Compliance Scanner

Python 3.8+ MIT License AWS Security

CloudGuard is a command-line security compliance scanner for AWS environments. It performs automated security checks aligned with the CIS AWS Foundations Benchmark to help identify misconfigurations and security risks.

Features

  • ๐Ÿ” 26+ Security Checks across 5 AWS services
  • ๐ŸŽฏ CIS Benchmark Aligned - Maps to CIS AWS Foundations Benchmark controls
  • ๐Ÿ“Š Multiple Output Formats - Terminal, JSON, and HTML reports
  • ๐Ÿš€ Easy to Use - Simple CLI with sensible defaults
  • ๐Ÿ”ง Configurable - Filter by service, severity, or region
  • ๐Ÿ’ฐ Cost-Effective - Runs locally with minimal AWS API calls

Supported Services & Checks

S3 (6 checks)

  • Public access block configuration
  • Default encryption
  • Versioning enabled
  • Access logging
  • HTTPS enforcement
  • Public bucket policies

IAM (8 checks)

  • Root account MFA
  • Root access keys
  • Password policy strength
  • Unused credentials (90+ days)
  • Admin privilege usage
  • User MFA enforcement
  • Wildcard policies

EC2 (7 checks)

  • Security groups with risky open ports (SSH, RDP, databases)
  • Unencrypted EBS volumes
  • IMDSv2 enforcement
  • Public AMIs
  • Default security group rules

VPC (5 checks)

  • Flow logs enabled
  • Network ACL configurations
  • Internet gateway exposure
  • Peering connections

CloudTrail (10 checks)

  • Multi-region logging
  • Log file validation
  • S3 bucket security
  • KMS encryption
  • CloudWatch integration

Installation

From PyPI (recommended)

pip install cloudguard

From Source

git clone https://github.com/yourusername/cloudguard.git
cd cloudguard
pip install -e .

Quick Start

Basic Scan

# Scan all services with default settings
cloudguard scan

Using a Specific AWS Profile

cloudguard scan --profile production

Scan Specific Services

cloudguard scan --service s3 --service iam

Generate HTML Report

cloudguard scan --output html --output-file security-report.html

Filter by Severity

cloudguard scan --severity high

CLI Reference

cloudguard scan

Run security compliance scan on your AWS account.

Options:
  -p, --profile TEXT        AWS profile name to use
  -r, --region TEXT         AWS region to scan (default: all regions)
  -s, --service TEXT        Services to scan: s3, iam, ec2, vpc, cloudtrail, all
      --severity TEXT       Minimum severity: critical, high, medium, low, all
  -o, --output TEXT         Output format: terminal, json, html, all
      --output-file PATH    Output file path
  -q, --quiet              Suppress banner and progress output
      --fail-on TEXT       Exit with error if findings at severity level

cloudguard verify

Verify AWS credentials and permissions.

cloudguard verify --profile my-profile

cloudguard list-services

List available services and security checks.

cloudguard list-services

cloudguard convert

Convert a JSON report to HTML format.

cloudguard convert report.json --format html

Examples

CI/CD Integration

# Fail pipeline if critical findings exist
cloudguard scan --quiet --fail-on critical

# Generate JSON for processing
cloudguard scan --output json --output-file results.json --quiet

Daily Security Report

# Generate comprehensive HTML report
cloudguard scan \
  --profile production \
  --output html \
  --output-file "security-report-$(date +%Y%m%d).html"

Quick Check Specific Services

# Check only S3 and IAM for critical issues
cloudguard scan -s s3 -s iam --severity critical

AWS Permissions Required

CloudGuard requires read-only access to scan AWS resources. Here's a minimal IAM policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetBucketAcl",
        "s3:GetBucketPolicy",
        "s3:GetBucketLogging",
        "s3:GetBucketVersioning",
        "s3:GetBucketEncryption",
        "s3:GetPublicAccessBlock",
        "s3:ListAllMyBuckets",
        "iam:GetAccountPasswordPolicy",
        "iam:GetAccountSummary",
        "iam:ListUsers",
        "iam:ListAccessKeys",
        "iam:GetAccessKeyLastUsed",
        "iam:ListAttachedUserPolicies",
        "iam:ListGroupsForUser",
        "iam:ListAttachedGroupPolicies",
        "iam:ListMFADevices",
        "iam:GetLoginProfile",
        "iam:ListPolicies",
        "iam:GetPolicyVersion",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeVolumes",
        "ec2:DescribeInstances",
        "ec2:DescribeImages",
        "ec2:DescribeVpcs",
        "ec2:DescribeFlowLogs",
        "ec2:DescribeNetworkAcls",
        "ec2:DescribeInternetGateways",
        "ec2:DescribeVpcPeeringConnections",
        "ec2:DescribeRegions",
        "cloudtrail:DescribeTrails",
        "cloudtrail:GetTrailStatus",
        "cloudtrail:GetEventSelectors",
        "sts:GetCallerIdentity"
      ],
      "Resource": "*"
    }
  ]
}

Output Examples

Terminal Output

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
                    SECURITY SCAN FINDINGS                      
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ”ด CRITICAL (3)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โ–  Root account MFA not enabled
    Resource: root
    CIS Control: CIS 1.5

  โ–  S3 bucket public access block not configured
    Resource: my-public-bucket
    CIS Control: CIS 2.1.5

๐ŸŸ  HIGH (5)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โ–  Security group allows SSH from internet
    Resource: sg-0123456789abcdef
    Region: us-east-1
    CIS Control: CIS 5.2

HTML Report

Generates a professional, dark-themed HTML report with:

  • Summary statistics
  • Findings grouped by severity
  • Resource details and recommendations
  • CIS control mappings

Development

Setup Development Environment

git clone https://github.com/yourusername/cloudguard.git
cd cloudguard
pip install -e ".[dev]"

Run Tests

pytest

Code Formatting

black src/
isort src/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • CIS (Center for Internet Security) for the AWS Foundations Benchmark
  • AWS for boto3 and comprehensive API documentation
  • The Python community for excellent CLI tools

Made with โค๏ธ for the cloud security community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudguard-1.0.0.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudguard-1.0.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file cloudguard-1.0.0.tar.gz.

File metadata

  • Download URL: cloudguard-1.0.0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cloudguard-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4f20912304584af5bd2aa77d57f0f0421c0160482541a22f5a78b1a95b7d10ad
MD5 90b5beba134fa739b0c07edec84f09ad
BLAKE2b-256 3237c6de78eaea2c0daa7643b00ea1de9f27601fe465ea8648f3180a85d72d1b

See more details on using hashes here.

File details

Details for the file cloudguard-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cloudguard-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cloudguard-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a8ef2fbff1d517949db0db4fd464c066615ad24b06c8c30ae980d9c397b1326
MD5 cb2d11275a9e8d22b3a8b45e8ee2774e
BLAKE2b-256 e8e005315dd5b700b4b3861f607a860615c157cd3464e406f6dd1fa76884fd6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page