From 8ebb551e52bd6a79cf2d082b71dd7ab5d34dad30 Mon Sep 17 00:00:00 2001 From: Chris Kelly Date: Fri, 4 Aug 2023 10:01:46 -0400 Subject: [PATCH] Comply with more things (#6) * Adds Prowler * Enables Access Analyzer * Fixes some checks --- .gitignore | 3 +- README.md | 34 +++++++--- modules/compliant-account/aws-support.tf | 24 +++++++ modules/compliant-account/iam.tf | 11 ++++ modules/compliant-account/main.tf | 24 +++++++ modules/compliant-account/output.tf | 0 modules/compliant-account/prowler.tf | 7 ++ .../compliant-account/s3.tf | 0 modules/compliant-account/variables.tf | 7 ++ modules/compliant-account/vpc.tf | 64 +++++++++++++++++++ tenants/management/access-analyzer.tf | 4 ++ tenants/management/iam.tf | 12 ---- tenants/management/main.tf | 7 ++ tenants/management/organization.tf | 24 +++---- tools/prowler/allowlist.yaml | 10 +++ tools/prowler/install-prowler.sh | 5 ++ tools/prowler/run-prowler.sh | 20 ++++++ 17 files changed, 222 insertions(+), 34 deletions(-) create mode 100644 modules/compliant-account/aws-support.tf create mode 100644 modules/compliant-account/iam.tf create mode 100644 modules/compliant-account/main.tf create mode 100644 modules/compliant-account/output.tf create mode 100644 modules/compliant-account/prowler.tf rename tenants/management/security-controls.tf => modules/compliant-account/s3.tf (100%) create mode 100644 modules/compliant-account/variables.tf create mode 100644 modules/compliant-account/vpc.tf create mode 100644 tenants/management/access-analyzer.tf create mode 100644 tools/prowler/allowlist.yaml create mode 100755 tools/prowler/install-prowler.sh create mode 100755 tools/prowler/run-prowler.sh diff --git a/.gitignore b/.gitignore index 0696b3e..28fc68e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.terraform \ No newline at end of file +.terraform +tools/prowler/output diff --git a/README.md b/README.md index 0335a55..76849ca 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,36 @@ ## Terraform for AWS plaground +The goal of this AWS setup is to have an automated AWS Organization set up that: + +1. Is fully compliant with SOC2 +1. Is fully compliant with AWS, CIS, and NIST security standards. +1. Has minimal AWS cost overhead +1. Facilitates easily testing out things in AWS test accounts + +### Running locally + This requires env vars with user credentials that can assume to adminstrator. +If `aws sts get-caller-identity` works, you are good, otherwise: -``` +```bash export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= ``` -Currently only works in tenants/management with `terraform apply`. +Currently only works in `tenants/management` with `terraform apply`. + +Run `prowler` to populate Security Hub with any breaking things it fines by: +`cd tools/prowler/ && ./install-prowler.sh && ./run-prowler.sh` ### TODO -- [] linters and formatters etc -- [] saml2aws for logging in, what to use for IdP? -- [] import everything in root account, test1 account, test2 account -- [] get some securityhub things passing -- [] setup github actions for terraform plan, terraform apply -- [] terraform plugin caching -- [] Setup AWS Config -- [] lots more +- [ ] linters and formatters etc +- [ ] saml2aws for logging in, what to use for IdP? +- [ ] get test1 and test2 accounts working with `terraform apply` +- [ ] import everything in root account, test1 account, test2 account +- [ ] get prowler checks to 100% green +- [ ] setup github actions for terraform plan, terraform apply, prowler +- [ ] terraform plugin caching +- [ ] Setup AWS Config +- [ ] lots more diff --git a/modules/compliant-account/aws-support.tf b/modules/compliant-account/aws-support.tf new file mode 100644 index 0000000..92ac25c --- /dev/null +++ b/modules/compliant-account/aws-support.tf @@ -0,0 +1,24 @@ +resource "aws_iam_role" "aws_support_access" { + name = "aws-support-access" + assume_role_policy = <