Open source cloud security assessment tool for AWS, Azure, GCP, and Kubernetes with hundreds of compliance checks.
npx @tessl/cli install tessl/pypi-prowler@5.10.0Prowler is an open-source cloud security assessment tool that performs comprehensive security audits across AWS, Azure, GCP, Kubernetes, GitHub, and Microsoft 365 environments. It provides hundreds of security checks aligned with industry compliance frameworks including CIS benchmarks, NIST, PCI-DSS, GDPR, HIPAA, and SOC2, enabling automated security assessments, continuous monitoring, and compliance validation for cloud infrastructures.
pip install prowlerimport prowlerMain CLI entry point:
from prowler.__main__ import prowlerCore check execution:
from prowler.lib.check.check import execute_checks
from prowler.lib.check.checks_loader import load_checks_to_execute
from prowler.lib.check.models import CheckMetadata, Severity
from prowler.lib.outputs.finding import FindingProvider management:
from prowler.providers.aws.aws_provider import AWSProvider
from prowler.providers.azure.azure_provider import AzureProvider
from prowler.providers.gcp.gcp_provider import GCPProvider
from prowler.providers.common.provider import ProviderConfiguration and compliance:
from prowler.config.config import (
prowler_version,
get_available_compliance_frameworks,
available_compliance_frameworks,
available_output_formats,
default_output_directory
)Logging:
from prowler.lib.logger import logger, set_logging_configfrom prowler.__main__ import prowler
# Run prowler CLI with arguments
import sys
sys.argv = ['prowler', 'aws', '--region', 'us-east-1']
prowler()from prowler.lib.check.check import execute_checks
from prowler.lib.check.checks_loader import load_checks_to_execute
from prowler.providers.aws.aws_provider import AWSProvider
from prowler.lib.outputs.finding import Finding
# Initialize AWS provider with authentication
provider = AWSProvider(
profile="default",
regions={"us-east-1", "us-west-2"},
resource_tags=["Environment=production"]
)
# Load checks for execution
checks = load_checks_to_execute(provider, check_list=['iam_user_mfa_enabled'])
# Execute security checks
findings = execute_checks(checks, provider)
# Process findings
for finding in findings:
if finding.status == 'FAIL':
print(f"Failed check: {finding.metadata.CheckID}")
print(f"Resource: {finding.resource_uid}")
print(f"Description: {finding.metadata.Description}")from prowler.providers.aws.aws_provider import AWSProvider
from prowler.providers.azure.azure_provider import AzureProvider
from prowler.providers.gcp.gcp_provider import GCPProvider
# AWS with IAM role assumption
aws_provider = AWSProvider(
role_arn="arn:aws:iam::123456789012:role/ProwlerRole",
external_id="unique-external-id",
regions={"us-east-1", "eu-west-1"}
)
# Azure with service principal
azure_provider = AzureProvider(
client_id="12345678-1234-1234-1234-123456789012",
client_secret="your-client-secret",
tenant_id="87654321-4321-4321-4321-210987654321",
subscription_ids=["sub-1", "sub-2"]
)
# GCP with service account
gcp_provider = GCPProvider(
credentials_file="/path/to/service-account.json",
project_ids=["project-1", "project-2"],
organization_id="123456789012"
)Prowler follows a modular architecture organized around key components:
This design enables Prowler to scale across multiple cloud platforms while maintaining consistent security assessment patterns and supporting extensive compliance reporting requirements.
Main command-line interface providing comprehensive cloud security scanning with support for multiple providers, filtering options, compliance frameworks, and output formats.
def prowler():
"""
Main CLI entry point that orchestrates the entire scanning process.
Uses sys.argv for command-line argument parsing.
Returns:
None (exits with appropriate status code)
"""Core functionality for loading, filtering, and executing security checks across cloud providers with support for custom checks, service filtering, and compliance framework mapping.
def execute_checks(checks: list, provider: Provider) -> list[Finding]:
"""
Execute security checks and return findings.
Parameters:
- checks: List of check modules to execute
- provider: Provider instance (AWS, Azure, GCP, etc.)
Returns:
List of Finding objects representing check results
"""
def load_checks_to_execute(provider: Provider, check_list: list = None, service_list: list = None) -> list:
"""
Load checks based on provider and filtering criteria.
Parameters:
- provider: Provider instance
- check_list: Optional list of specific checks to run
- service_list: Optional list of services to include
Returns:
List of check modules to execute
"""Standardized data models for representing security check metadata, severity levels, remediation information, and compliance mappings using Pydantic for validation.
class CheckMetadata:
"""
Pydantic model for check metadata.
Attributes:
- Provider: str - Provider type (aws, azure, gcp, etc.)
- CheckID: str - Unique check identifier
- CheckTitle: str - Human-readable check name
- CheckType: list[str] - Check categories
- ServiceName: str - Cloud service name
- SubServiceName: str - Sub-service name
- Severity: Severity - Severity level enum
- ResourceType: str - Resource type being checked
- Description: str - Check description
- Risk: str - Risk description
- Remediation: Remediation - Remediation information
"""
class Severity(Enum):
"""Severity level enumeration."""
critical = "critical"
high = "high"
medium = "medium"
low = "low"
informational = "informational"Comprehensive finding representation and output generation supporting multiple formats (JSON, CSV, HTML, ASFF, OCSF) with compliance reporting and integration capabilities.
class Finding:
"""
Pydantic model representing a security finding.
Attributes:
- auth_method: str - Authentication method used
- timestamp: datetime - Finding timestamp
- account_uid: str - Account unique identifier
- metadata: CheckMetadata - Check metadata
- status: Status - Finding status (PASS/FAIL/MANUAL)
- resource_uid: str - Resource unique identifier
- region: str - Cloud region
- compliance: dict - Compliance framework mappings
"""
def generate_output(findings: list[Finding], output_format: str, output_directory: str):
"""
Generate output in specified format.
Parameters:
- findings: List of Finding objects
- output_format: Output format (json, csv, html, asff, ocsf)
- output_directory: Directory for output files
Returns:
None (writes files to output directory)
"""Multi-cloud provider abstraction supporting AWS, Azure, GCP, Kubernetes, GitHub, and Microsoft 365 with standardized authentication, session management, and credential handling.
class Provider:
"""
Abstract base class for all cloud providers.
Properties:
- type: str - Provider type identifier
- identity: dict - Provider identity information
- session: object - Provider session object
- audit_config: dict - Audit configuration
Methods:
- setup_session(): Abstract method to setup provider session
- print_credentials(): Abstract method to print credential info
- validate_arguments(): Abstract method to validate provider arguments
"""
class AWSProvider(Provider):
"""AWS provider implementation."""
class AzureProvider(Provider):
"""Azure provider implementation."""
class GCPProvider(Provider):
"""GCP provider implementation."""Configuration management and compliance framework support with mappings to industry standards including CIS benchmarks, NIST, ISO 27001, PCI-DSS, and custom frameworks.
prowler_version: str = "5.10.2"
available_compliance_frameworks: list[str]
available_output_formats: list[str]
default_output_directory: str
def get_available_compliance_frameworks(provider: str = None) -> list[str]:
"""
Get available compliance frameworks for a provider.
Parameters:
- provider: Optional provider name to filter frameworks
Returns:
List of available compliance framework names
"""
def check_current_version() -> dict:
"""
Check for newer Prowler versions.
Returns:
Dictionary with version information and update availability
"""Logging configuration, utility functions, and helper methods for string manipulation, data processing, and common operations across the Prowler ecosystem.
def set_logging_config(log_level: str, log_file: str = None, only_logs: bool = False):
"""
Configure logging for Prowler.
Parameters:
- log_level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- log_file: Optional log file path
- only_logs: Whether to suppress banner and only show logs
Returns:
None
"""
logger: Logger # Global logger instance
logging_levels: dict[str, int] # Mapping of level names to constantsfrom enum import Enum
from typing import Optional, List, Dict, Any
from pydantic import BaseModel
from datetime import datetime
class Status(Enum):
"""Finding status enumeration."""
PASS = "PASS"
FAIL = "FAIL"
MANUAL = "MANUAL"
class Provider(Enum):
"""Supported provider enumeration."""
aws = "aws"
azure = "azure"
gcp = "gcp"
kubernetes = "kubernetes"
github = "github"
m365 = "m365"
nhn = "nhn"
iac = "iac"
class Code(BaseModel):
"""Remediation code model."""
NativeIaC: Optional[str] = None
Terraform: Optional[str] = None
CLI: Optional[str] = None
Other: Optional[str] = None
class Recommendation(BaseModel):
"""Recommendation model."""
Text: str
Url: Optional[str] = None
class Remediation(BaseModel):
"""Remediation information model."""
Code: Optional[Code] = None
Recommendation: Recommendation