Skip to main content

cdk-prowler

Project description

NPM version PyPI version .NET version Release

Author = https://martinmueller.dev

cdk-prowler

An AWS CDK custom construct for deploying Prowler to you AWS Account. The following description about Prowler is taken from https://github.com/toniblyx/prowler:

Prowler 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 here https://d0.awsstatic.com/whitepapers/compliance/AWS_CIS_Foundations_Benchmark.pdf and more than 100 additional checks that help on GDPR, HIPAA …

It generates security html results which are stored in an s3 bucket:

html results

And in your Codebuild Report group:

Report group

AWS AMI

If you just want to make the Prowler security checks in your account try my Prowler 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 the Planned Features section. Thank you so much :) !

Example

# Example automatically generated from non-compiling source. May contain errors.
import { ProwlerAudit } from 'cdk-prowler';
...
    const app = new App();

    const stack = new Stack(app, 'ProwlerAudit-stack');

    new ProwlerAudit(stack, 'ProwlerAudit');

Architect diagram

diagram

cdk-prowler Properties

cdk-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 Reference

Constructs

ProwlerAudit

Creates 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 from https://github.com/stevecjones

Initializers

# Example automatically generated from non-compiling source. May contain errors.
import { ProwlerAudit } from 'cdk-prowler'

new ProwlerAudit(parent: Stack, id: string, props?: ProwlerAuditProps)
parentRequired

idRequired
  • Type: string

propsOptional

Properties

codebuildProjectRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly codebuildProject: Project;

enableSchedulerRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly enableScheduler: boolean;
  • Type: boolean

logsRetentionInDaysRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly logsRetentionInDays: RetentionDays;

prowlerOptionsRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerOptions: string;
  • Type: string

prowlerSchedulerRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerScheduler: string;
  • Type: string

prowlerVersionRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerVersion: string;
  • Type: string

serviceNameRequired
# Example automatically generated from non-compiling source. May contain errors.
public readonly serviceName: string;
  • Type: string

Structs

ProwlerAuditProps

Initializer

# Example automatically generated from non-compiling source. May contain errors.
import { ProwlerAuditProps } from 'cdk-prowler'

const prowlerAuditProps: ProwlerAuditProps = { ... }
additionalS3CopyArgsOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly additionalS3CopyArgs: string;
  • Type: string

An optional parameter to add to the S3 bucket copy command.


allowlistOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly allowlist: Asset;

An 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.


enableSchedulerOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly enableScheduler: boolean;
  • Type: boolean
  • Default: false

enables the scheduler for running prowler periodically.

Together with prowlerScheduler.


logsRetentionInDaysOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly logsRetentionInDays: RetentionDays;

Specifies 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 deleted


prowlerOptionsOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerOptions: string;
  • Type: string
  • Default: '-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"


prowlerSchedulerOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerScheduler: string;
  • Type: string
  • Default: '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 here https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html.


prowlerVersionOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly prowlerVersion: string;
  • Type: string
  • Default: 2.5.0

Specifies the concrete Prowler version.


reportBucketOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly reportBucket: IBucket;

An optional S3 bucket to store the Prowler reports.


reportBucketPrefixOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly reportBucketPrefix: string;
  • Type: string

An optional prefix for the report bucket objects.


serviceNameOptional
# Example automatically generated from non-compiling source. May contain errors.
public readonly serviceName: string;
  • Type: string
  • Default: : prowler

Specifies the service name used within component naming.


Cross Account Buckets

By 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 an additionalS3CopyArgs: '--acl bucket-owner-full-control' to ensure that those object can be read by the account owner.

Planned Features

Architecture

cfn

Misc

yes | yarn destroy && yarn deploy --require-approval never

Rerun Prowler on deploy

yarn deploy --require-approval never -c reRunProwler=true

Thanks To

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

cdk-prowler-2.1.3.tar.gz (816.2 kB view details)

Uploaded Source

Built Distribution

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

cdk_prowler-2.1.3-py3-none-any.whl (814.6 kB view details)

Uploaded Python 3

File details

Details for the file cdk-prowler-2.1.3.tar.gz.

File metadata

  • Download URL: cdk-prowler-2.1.3.tar.gz
  • Upload date:
  • Size: 816.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3

File hashes

Hashes for cdk-prowler-2.1.3.tar.gz
Algorithm Hash digest
SHA256 dec6489354a2129b9e7a37925af606356cedb4a08bcd0cda343b5964cb7dc364
MD5 423117f70f263f338d1a6b1270cb89a4
BLAKE2b-256 b213e4007b6516c7d4c1c21db3acc86934c1274ae538a54b70cda61bb11fab52

See more details on using hashes here.

File details

Details for the file cdk_prowler-2.1.3-py3-none-any.whl.

File metadata

  • Download URL: cdk_prowler-2.1.3-py3-none-any.whl
  • Upload date:
  • Size: 814.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3

File hashes

Hashes for cdk_prowler-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c2972fe5a151774bb3ce70b89ccb340d979e532c2c0789397ce7923ed3e90209
MD5 c57b7fdcfdd367a720fd131bf61aee8b
BLAKE2b-256 560a799dd34fd5768591674589fb8d70bb7c16817c52268cdf26e9697c9992f4

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