Package: cdk-prowler
Author =https://martinmueller.devcdk-prowlerThe current Prowler version is2.10.0An AWS CDK custom construct for deploying Prowler to your AWS Account. The following description about Prowler is taken fromhttps://github.com/prowler-cloud/prowlerProwler is a security tool to perform AWS security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness. It contains all CIS controls listed herehttps://d0.awsstatic.com/whitepapers/compliance/AWS_CIS_Foundations_Benchmark.pdfand more than 100 additional checks that help on GDPR, HIPAA …It generates security html results which are stored in an s3 bucket:And in your Codebuild Report group:AWS AMIIf you just want to make the Prowler security checks in your account try myProwler AWS Marketplace AMI. With just $1 Prowler will do over 180 security checks across a huge amount of AWS services in all your regions. Don't forget the terminate the Ec2 instance when the Prowler stack got created for not paying more than that $1 :).With buying the AMI you support my on my passion for creating open source products like this cdk-prowler construct. Furthermore you enable me to work on future features like mentioned in thePlanned Featuressection. Thank you so much :) !Exampleimport{ProwlerAudit}from'cdk-prowler';...constapp=newApp();conststack=newStack(app,'ProwlerAudit-stack');newProwlerAudit(stack,'ProwlerAudit');Architect diagramCurious how I did the diagram? Have a look herehttps://martinmueller.dev/cdk-dia-eng.cdk-prowler Propertiescdk-prowler supports some properties to tweak your stack. Like for running a Cloudwatch schedule to regualary run the Prowler scan with a defined cron expression.API ReferenceConstructsProwlerAuditCreates a CodeBuild project to audit an AWS account with Prowler and stores the html report in a S3 bucket.This will run onece at the beginning and on a schedule afterwards. Partial contribution fromhttps://github.com/stevecjonesInitializersimport{ProwlerAudit}from'cdk-prowler'newProwlerAudit(parent:Stack,id:string,props?:ProwlerAuditProps)parentRequiredType:@aws-cdk/core.StackidRequiredType:stringpropsOptionalType:cdk-prowler.ProwlerAuditPropsPropertiescodebuildProjectRequiredpublicreadonlycodebuildProject:Project;Type:@aws-cdk/aws-codebuild.ProjectenableSchedulerRequiredpublicreadonlyenableScheduler:boolean;Type:booleanlogsRetentionInDaysRequiredpublicreadonlylogsRetentionInDays:RetentionDays;Type:@aws-cdk/aws-logs.RetentionDaysprowlerOptionsRequiredpublicreadonlyprowlerOptions:string;Type:stringprowlerSchedulerRequiredpublicreadonlyprowlerScheduler:string;Type:stringprowlerVersionRequiredpublicreadonlyprowlerVersion:string;Type:stringserviceNameRequiredpublicreadonlyserviceName:string;Type:stringStructsProwlerAuditPropsInitializerimport{ProwlerAuditProps}from'cdk-prowler'constprowlerAuditProps:ProwlerAuditProps={...}additionalS3CopyArgsOptionalpublicreadonlyadditionalS3CopyArgs:string;Type:stringAn optional parameter to add to the S3 bucket copy command.allowlistOptionalpublicreadonlyallowlist:Asset;Type:@aws-cdk/aws-s3-assets.AssetDefault:undefinedAn Prowler-specific Allowlist file.If a value is provided then this is passed to Prowler on runs using the '-w' flag.
If no value is provided, the -w parameter is not used. If you provide an asset that is zipped, it must contain
an 'allowlist.txt' file which will be passed to Prowler.enableSchedulerOptionalpublicreadonlyenableScheduler:boolean;Type:booleanDefault:falseenables the scheduler for running prowler periodically.Together with prowlerScheduler.logsRetentionInDaysOptionalpublicreadonlylogsRetentionInDays:RetentionDays;Type:@aws-cdk/aws-logs.RetentionDaysDefault:: 3Specifies the number of days you want to retain CodeBuild run log events in the specified log group.Junit reports are kept for 30 days, HTML reports in S3 are not deletedprowlerOptionsOptionalpublicreadonlyprowlerOptions:string;Type:stringDefault:'-M text,junit-xml,html,csv,json'Options to pass to Prowler command, make sure at least -M junit-xml is used for CodeBuild reports.Use -r for the region to send API queries, -f to filter only one region, -M output formats, -c for comma separated checks, for all checks do not use -c or -g, for more options see -h. For a complete assessment use  "-M text,junit-xml,html,csv,json", for SecurityHub integration use "-r region -f region -M text,junit-xml,html,csv,json,json-asff -S -q"prowlerSchedulerOptionalpublicreadonlyprowlerScheduler:string;Type:stringDefault:'cron(0 22 ** ? *)'The time when Prowler will run in cron format.Default is daily at 22:00h or 10PM 'cron(0 22 ** ? *)', for every 5 hours also works 'rate(5 hours)'. More info herehttps://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html.prowlerVersionOptionalpublicreadonlyprowlerVersion:string;Type:stringDefault:2.5.0Specifies the concrete Prowler version.reportBucketOptionalpublicreadonlyreportBucket:IBucket;Type:@aws-cdk/aws-s3.IBucketAn optional S3 bucket to store the Prowler reports.reportBucketPrefixOptionalpublicreadonlyreportBucketPrefix:string;Type:stringAn optional prefix for the report bucket objects.serviceNameOptionalpublicreadonlyserviceName:string;Type:stringDefault:: prowlerSpecifies the service name used within component naming.Cross Account BucketsBy providing your own Bucket you can have the CodeBuild project drop the Prowler results in another account. Make sure that you have your Bucket policy setup to allow the account running the Prowler reports access to writing those record.
Additionally, you will probably want to provide anadditionalS3CopyArgs: '--acl bucket-owner-full-control'to ensure that those object can be read by the account owner.Planned FeaturesSupporting AWS SecurityHubhttps://github.com/prowler-cloud/prowler#security-hub-integrationTriggering an event with SNS when prowler finishes the runAMI EC2 executableArchitectureMiscyes|yarndestroy&&yarndeploy--require-approvalneverRerun Prowler on deployyarndeploy--require-approvalnever-creRunProwler=trueThanks ToMy friend and fellaw ex colleague Tony de la Fuente (https://github.com/toniblyxhttps://twitter.com/ToniBlyx) for developing such a cool security tool asProwlerAs always to the amazing CDK / Projen Community. Join us onSlack!Projenproject and the community around it