Git Product home page Git Product logo

terraform-aws-security-hub-glue-aggregator-terraform's Introduction

aws-security-hub-glue-aggregator

Code to deploy a solution to aggregate the findings from Security Hub from different accounts to a centralized account using Amazon Kinesis Data Firehose and AWS Glue

Table of Contents

Description

Admin account module

This Terraform module creates an Amazon Kineses Data Firehose ready to receive Security Hub findings from Event Bridge. After Amazon Firehose will use AWS Glue to get the data model mapping for the Security Hub findings then writes the data to an S3 Bucket in Parquet format. The module includes all needed roles for the proper access of the services.

Member account module

This Terraform module creates an Event Bridge rule that captures the Security Hub findings and forwards it to the Event Bridge in the Admin module.

Architecture

The following diagram describes the full architecture.

Diagram

  1. A Security Hub finding is updated/modified
  2. Security Hub sends an event to the default EventBridge bus in the member account
  3. The EventBridge rule is subscribed to capture those findings and forward them to the dedicated EventBridge bus in the admin account
  4. The EventBridge rule is subscribed to capture any event in the dedicated bus and it will consequently trigger Amazon Firehose
  5. Firehose retrieves the data model mapping from AWS Glue to convert the raw data into Parquet format
  6. Firehose writes the data into the S3 Bucket

Pay attention: Both modules are meant to be used as standalone modules. They have to be deployed independetly to the relevant AWS accounts

Prerequisites

  • AWS Security Hub: This module expects that AWS Security Hub is already up and running in the region where the EventBridge rule will be deployed. The setup can be easily carried out by following the official documentation.

Dependencies

Variables

The available variables are described in variables.tf file for each module.

Usage

Backend Configurations

In case you would like to run the module as a standalone, you will need to initialize the creation of an S3 bucket and a DynamoDB table to track the terraform states.

cd tf-state
terraform init && terraform apply
cd ..
terraform init -backend-config=config/backend.conf

Deployment

Option 1: You can use the following samples to utilize the modules within your code:

module "reporting-admin-standalone" {
  source                        = "./modules/reporting-admin-module"
  name_prefix                   = local.name_prefix
  custom_tags                   = local.tags
  firehose_logs_retention_days  = "1"
  allowed_member_accounts       = ["11111111","22222222"] //Add member accounts here
}
module "reporting-member-standalone" {
  source = "./modules/reporting-member-single-module"

  name_prefix          = local.name_prefix
  admin_events_bus_arn = <<ADD_HERE_THE_ARN_FOR_ADMIN_EVENT_BUS>>
}

Please have a look inside inside variables.tf for all the possible options.

Option 2: Alternatively, if you have Terraform installed on your workstation, you can deploy the example by executing:

export AWS_PROFILE=<profile>
export AWS_DEFAULT_REGION=eu-west-1

terraform plan -target=module.reporting-admin-module -var region=$AWS_DEFAULT_REGION -var profile=$AWS_PROFILE
terraform apply -target=module.reporting-admin-module -var region=$AWS_DEFAULT_REGION -var profile=$AWS_PROFILE

terraform plan -target=module.reporting-member-module -var region=$AWS_DEFAULT_REGION -var profile=$AWS_PROFILE
terraform apply -target=module.reporting-member-module -var region=$AWS_DEFAULT_REGION -var profile=$AWS_PROFILE

Pay attention: you should first modify the AWS_DEFAULT_REGION in accordance to your requirements.

Testing

Using the following script will attempt to test the process by using fake findings:

source ./modules/reporting-admin-module/sh_test_event.cli

Cleanup

Use with caution:

terraform destroy -var region=$AWS_DEFAULT_REGION -var profile=$AWS_PROFILE

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

=======

terraform-aws-security-hub-glue-aggregator-terraform's People

Contributors

amazon-auto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.