This tool pulls findings from AWS Security Hub and outputs them for consumption by visualization tools. To use this tool, you need one of the following, depending on whether you provide team data via Athena or a JSON file:
To configure with an Athena table:
- an Athena table of teams to accounts that follows the format expected by the Athena library
- an S3 bucket for Athena query outputs
- a single IAM role that is valid for all of the accounts in the Athena table
To configure with a JSON team map:
- one or more IAM roles that are valid for each account listed in the map of accounts to teams provided to the tool
go get -u github.com/Enterprise-CMCS/mac-fc-security-hub-collector
security-hub-collector
is a CLI for retrieving Security Hub findings for visualization.
To display a full list of CLI options, build the application and run security-hub-collector -h
.
To run the Docker image locally for testing, do the following:
-
Create a file at the top level called
docker-gitconfig
with the following content:[url "https://<username>:<personal access token>@github.com/Enterprise-CMCS/"] insteadOf = https://github.com/Enterprise-CMCS/
-
docker build . -t local-collector-test
-
set AWS creds in the environment (
AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN
) -
run the image:
- using an Athena table
docker run \ -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_ACCESS_KEY_ID \ -e ATHENA_TEAMS_TABLE=athenacurcfn_cms_cloud_cur_monthly.teams \ -e QUERY_OUTPUT_LOCATION=s3://cms-macbis-cost-analysis/professor-mac/teams-query/ \ -e COLLECTOR_ROLE_PATH=delegatedadmin/developer/security-hub-collector \ -e AWS_REGION=us-east-1 \ -e S3_BUCKET=my-bucket \ local-collector-test
- using a team map
export BASE64_TEAM_MAP=$(cat team_map.json | base64) docker run \ -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_ACCESS_KEY_ID \ -e BASE64_TEAM_MAP \ -e AWS_REGION=us-east-1 \ -e S3_BUCKET=my-bucket \ local-collector-test
The repo contains Terraform for:
- an ECR repo that hosts the Collector image, which is deployed in the
MACBIS Shared DSO Dev
account. A team's AWS account ID must be on the access list to have permission to pull the Collector image. The access list is maintained via theecr_read_account_ids
variable interraform/dev/account/terraform.tfvars
. To request access, please open a Jira ticket in theCMCS-MACBIS-DSO
project - those IAM resources needed for the
build-and-push-dev
workflow
This workflow builds and pushes the Collector image to a private ECR registry in MACBIS Shared DSO dev. It tags the image with the SHA. We have deprecated the latest
tag, but the image with this tag should not be removed from the ECR registry because it is in use.
This workflow runs pre-commit, Go tests, and a Docker build upon pull requests