This module implements ...
Run pre-commit install to install any guardrails implemented using pre-commit.
See pre-commit installation on how to install pre-commit.
...
The EC2 dashboard instance bootstraps significantly faster when Prowler and its dependencies are already available on the image. When using an Ubuntu base AMI, install the tools shown below and register the resulting AMI in the account in which you run this module.
sudo apt update -y
sudo apt install pipx unzip -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
pipx install prowler
pipx ensurepath
Reference this repository from your Terraform configuration and provide the required inputs for both the scan backend and the Cognito-protected frontend (VPC, Route53 zone, bucket name, scan definitions, etc.).
module "prowler_stack" {
source = "git::https://github.com/wearetechnative/terraform-aws-module-prowler-frontend.git?ref=<release>"
region = "eu-west-1"
prowlersite_domain = "example.com"
vpc_id = "vpc-0123456789abcdef0"
ecs_cluster_name = "prowler"
container_name = "prowler"
prowler_report_bucket_name = "prowler-reports-example"
prowler_rolename_in_accounts = "ProwlerExecutionRole"
prowler_ami = "ami-0abc123def4567890"
allowed_ips = ["203.0.113.10/32"]
prowler_scans = {
nightly = {
prowler_schedule_timer = "cron(0 1 * * ? *)"
prowler_schedule_timezone = "UTC"
prowler_scan_regions = ["eu-west-1"]
prowler_report_output_format = "csv"
task_definition_name = "prowler-nightly"
fargate_task_cpu = "1024"
fargate_memory = "2048"
ecr_image_uri = "123456789012.dkr.ecr.eu-west-1.amazonaws.com/prowler:latest"
prowler_account_list = ["111122223333"]
compliance_checks = ["cis_aws"]
severity = ["HIGH", "MEDIUM"]
}
}
# See variables.tf for the remaining inputs such as kms_key_arn, dlq_arn, etc.
}Run terraform init, terraform plan, and terraform apply to provision the
scan pipeline, API Gateway, Cognito user pool, CloudFront distribution, and the
dashboard infrastructure.
Only authenticated Cognito users can open the dashboard or trigger scans. After
the infrastructure is deployed, create at least one user in the Cognito user
pool that the module created (its name is derived from var.prowlersite_name).
This can be done through the AWS Console or the CLI:
aws cognito-idp admin-create-user \
--user-pool-id <cognito_user_pool_id> \
--username security@example.com \
--user-attributes Name=email,Value=security@example.com \
--temporary-password 'Prowler#2024'
Replace <cognito_user_pool_id> with the ID of the Cognito pool shown in the
Amazon Cognito console (or obtained from Terraform state via
terraform output -raw cognito_user_pool_id). Share the temporary
password with the intended operator so they can update it at first login.
The module creates an SNS topic named prowler_security_check_fail_notifier
that receives events whenever a scan finishes with failing checks. Subscribe
your operations mailbox (or another notification target) so you receive those
alerts:
aws sns subscribe \
--topic-arn <topic_arn> \
--protocol email \
--notification-endpoint secops@example.com
The topic ARN is visible in the Amazon SNS console or through the Terraform
state using terraform output -raw sns_topic_arn. Confirm the subscription from
the email that AWS sends. Without this step you will not receive alerts
about failed scans.
| Name | Version |
|---|---|
| aws | 5.96.0 |
| null | n/a |
| Name | Source | Version |
|---|---|---|
| api_endpoints | ./modules/api_gateway | n/a |
| ec2_instance_role | git@github.com:wearetechnative/terraform-aws-iam-role | 0fe916c27097706237692122e09f323f55e8237e |
| iam_role_lambda_prowler | git@github.com:wearetechnative/terraform-aws-iam-role.git | 9229bbd0280807cbc49f194ff6d2741265dc108a |
| iam_role_lambda_prowler_failed_task | git@github.com:wearetechnative/terraform-aws-iam-role.git | 9229bbd0280807cbc49f194ff6d2741265dc108a |
| iam_role_lambda_terminate_dashboard | git@github.com:wearetechnative/terraform-aws-iam-role.git | 9229bbd0280807cbc49f194ff6d2741265dc108a |
| key_pair | terraform-aws-modules/key-pair/aws | 2.0.2 |
| lambda_prowler | git@github.com:wearetechnative/terraform-aws-lambda.git | 13eda5f9e8ae40e51f66a45837cd41a6b35af988 |
| lambda_prowler_failed_task | git@github.com:wearetechnative/terraform-aws-lambda.git | 13eda5f9e8ae40e51f66a45837cd41a6b35af988 |
| lambda_terminate_dashboard | git@github.com:wearetechnative/terraform-aws-lambda.git | 13eda5f9e8ae40e51f66a45837cd41a6b35af988 |
| prowler | ./modules/scan | n/a |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| allowed_ips | ips allowed to access prowler dashboard (add /32 to ips) | list(string) |
n/a | yes |
| cognito_id_provider_arns | List of arns of cognito identity providers you want to allow to run prowler scans | list(any) |
n/a | yes |
| container_name | Name of the Container within AWS Fargate | string |
n/a | yes |
| dashboard_frontend_url | Frontend page to launch dashboard from | string |
n/a | yes |
| dashboard_uptime | Running time of prowler dashboard ec2, will self-terminate after certain amount of time (1d, 1h, 2h, 15m) | string |
"1h" |
no |
| dlq_arn | ARN for DLQ for lambda | string |
n/a | yes |
| domain | Domain for dashboard dns record | string |
n/a | yes |
| ecs_cluster_name | Name of cluster | string |
n/a | yes |
| kms_key_arn | ARN of kms key for lambda | string |
n/a | yes |
| mutelist | Contents of the mutelist yaml file | string |
"Mutelist: []" |
no |
| prowler_ami | AMI id with prowler pre-installed (fast boot time) | string |
n/a | yes |
| prowler_container_subnet | Provide a Subnet ID to launch Prowler container | string |
n/a | yes |
| prowler_dashboard_subnet | Provide a Subnet ID to launch Prowler dashboard | string |
"" |
no |
| prowler_report_bucket_name | Name of the bucket where output reports are saved | string |
n/a | yes |
| prowler_rolename_in_accounts | Name of the role in all the accounts that prowler assumes to scan | string |
n/a | yes |
| prowler_scans | prowler config | map(object({ |
n/a | yes |
| region | Region to deploy the resources. | string |
n/a | yes |
| report_retention | Number of days to retain prowler reports in bucket | number |
n/a | yes |
| vpc_id | Provide a VPC ID where prowler_container_subnet resides | string |
n/a | yes |
| Name | Description |
|---|---|
| api_gateway_stage_invoke_url | n/a |
| bucket_arn | n/a |
| eip_allocation_id | n/a |
