π Solution Landing Page \| π§ Feature request \| π Bug Report
Note: If you want to use the solution without building from source, navigate to Solution Landing Page
Automated Security Response on AWS is an add-on solution that enables AWS Security Hub customers to remediate security findings with a single click using predefined response and remediation actions called βPlaybooksβ. Alternately the playbooks can also be configured to remediate findings in AWS Security Hub automatically. The remediation is performed using AWS Lambda and in some cases using AWS Systems Manager, the playbooks execute steps to remediate security issues, such as unused keys, open security groups, password policies, VPC configurations and public S3 buckets. The solution contains the playbook remediations for some of the security standards defined as part of CIS AWS Foundations Benchmark v1.2.0, CIS AWS Foundations Benchmark v1.4.0, AWS Foundational Security Best Practices v1.0.0, and PCI-DSS v3.2.1.
Note: If your goal is just to deploy the solution, please use the template on the Automated Security Response on AWS Landing Page. There is no need to build the solution from source.
Detailed instructions for creating a new automated remediation in an existing Playbook can be found in the Implementation Guide. Instructions for creating an entirely new Playbook are below.
Note: If you choose to continue, please be aware that reading and adjusting the source code will be necessary.
Building from GitHub source will allow you to modify the solution to suit your specific needs. The process consists of downloading the source from GitHub, creating buckets to be used for deployment, building the solution, and uploading the artifacts needed for deployment.
Clone or download the repository to a local directory on your linux client. Note: if you intend to modify the solution you may wish to create your own fork of the GitHub repo and work from that. This allows you to check in any changes you make to your private copy of the solution.
Git Clone example:
bash
git clone https://github.com/aws-solutions/aws-security-hub-automated-response-and-remediation.git
Download Zip example:
bash
wget https://github.com/aws-solutions/aws-security-hub-automated-response-and-remediation/archive/main.zip
Go to source/playbooks in the solution source downloaded above. In this folder is a Playbook skeleton, NEWPLAYBOOK. Copy this entire folder and its contents as a new folder under source/playbooks. The naming convention is the security standard abbreviation followed by the version number, as they appear in the StandardsControlArn in the AWS Standard Finding Format for the security control.
Example
For PCI-DSS, we used "PCI" for the standard abbreviation. The version is 321: PCI321
yaml
"StandardsControlArn": "arn:aws:securityhub:us-east-1:111111111111:control/pci-dss/v/3.2.1/PCI.IAM.7"
For CIS AWS Foundations Benchmark, we use "CIS". The version is 120: CIS120
yaml
"StandardsControlArn": "arn:aws:securityhub:us-east-1:111111111111:control/cis-aws-foundations-benchmark/v/1.2.0/2.4"
Unless noted, all of the following changes are within the folder you just created for your new playbook.
Edit bin/\<standard>.ts. The following 3 lines are critical to definition of the Playbook. These values enable ASR to map from the StandardsControlArn in a finding to your remediations.
typescript
const standardShortName = 'NPB'
const standardLongName = 'New Playbook'
const standardVersion = '1.1.1' // DO NOT INCLUDE 'V'
standardShortName can be as you wish. General recommendation is to make it short and meaningful. Ex. PCI, CIS, AFSBP. This is the name used in many labels throughout the solution. standardLongName must match the StandardsControlArn, as pci-dss in the above example. standardVersion must match the StandardsControlArn version, as .../v/3.2.1/... in the above example.
Having established these values, your runbooks in /ssmdocs will be named:
As you write your SSM runbooks, you will add them to the stack in the following code, where control must match the field from the StandardsControlArn:
typescript
const remediations: IControl[] = [
{ "control": "RDS.6" }
]
Remediations are executed using SSM Automation Runbooks. Each control has a specific runbook. ASR Runbooks must follow the naming convention in the /ssmdocs folder:
Follow examples from other Playbooks. Your ASR runbook must parse the finding data, extract the fields needed for remediation, and execute a remediation runbook, passing the role name.
Remediation runbooks are defined in the /source/remediation_runbooks and /source/solution_deploy/remediation_runbooks-stack.ts. The remediation examples provided with the solution are fairly robust and self-documenting. Each definition creates an IAM role and an SSM runbook that is called by the ASR runbook.
AWS Solutions use two buckets: a bucket for global access to templates, which is accessed via HTTPS, and regional buckets for access to assets within the region, such as Lambda code. You will need:
Note: When creating your buckets, ensure they are not publicly accessible. Use random bucket names. Disable public access. Use KMS encryption. And verify bucket ownership before uploading.
First ensure that you've run npm install
in the source folder.
Next from the deployment folder in your cloned repo, run build-s3-dist.sh, passing the root name of your bucket (ex. mybucket) and the version you are building (ex. v1.0.0). We recommend using a semver version based on the version downloaded from GitHub (ex. GitHub: v1.0.0, your build: v1.0.0.mybuild)
bash
chmod +x build-s3-dist.sh
build-s3-dist.sh -b <bucketname> -v <version>
Some Python unit tests execute AWS API calls. The calls that create, read, or modify resources are stubbed, but some calls to APIs that do not require any permissions execute against the real AWS APIs (e.g. STS GetCallerIdentity). The recommended way to run the unit tests is to configure your credentials for a no-access console role.
bash
cd ./deployment
chmod +x ./run-unit-tests.sh
./run-unit-tests.sh
Confirm that all unit tests pass.
Note: Verify bucket ownership before uploading.
By default, the templates created by build-s3-dist.sh expect the software to be stored in aws-security-hub-automated-response-and-remediation/v\<version>. If in doubt, view the template.
Use a tool such as the AWS S3 CLI "sync" command to upload your templates to the reference bucket and code to the regional bucket.
See the Automated Security Response on AWS Implementation Guide for deployment instructions, using the link to the SolutionDeployStack.template from your bucket, rather than the one for AWS Solutions. Ex. https://mybucket-reference.s3.amazonaws.com/aws-security-hub-automated-response-and-remediation/v1.3.0.mybuild/aws-sharr-deploy.template
aws-security-hub-automated-response-and-remediation uses AWS CDK for generating the cloudformation templates.
|-source/ |-Lambdalayer [ Common functions loaded as an AWS Lambda Layer for Orchestrator lambdas ] |-Orchestrator [ AWS Step Function and supporting lambdas ] |-playbooks [ Playbooks CloudDevelopment Kit Code and lambda source code] |- AFSBP/ [ AFSBP v1.0.0 playbook code ] |- CIS120/ [ CIS v1.2.0 playbook code ] |- CIS140/ [ CIS v1.4.0 playbook code ] |- PCI321/ [ PCI-DSS v3.2.1 playbook code ] |- SC/ [ SC v2.0.0 playbook code ] |-remediation_runbooks [ Shared remediation runbooks ] |-solution_deploy [ Solution Cloud Development Kit node module ] |-test [ CDK unit tests ]
This solution collects anonymous operational metrics to help AWS improve the quality of features of the solution. For more information, including how to disable this capability, please see the Implementation Guide
See license here
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Newly supported AWS FSBP controls: - CloudFormation.1 - EC2.15 - SNS.1 - SNS.2 - SQS.1
Newly supported CIS v1.2.0 controls: - 1.20
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
The solution's upcoming version will add support for the new Consolidated Control Findings format from AWS Security Hub.
https://aws.amazon.com/about-aws/whats-new/2023/02/aws-security-hub-consolidated-control-findings-view/
Is your feature request related to a problem? Please describe. Out of the box the SHARR solution does not include a number of remediations that we feel would be extremely useful. Namely, AWS foundational best practices control EC2.19. "EC2.19 Security groups should not allow unrestricted access to ports with high risk". This is a fairly difficult rule to keep compliant if it is not being checked for automatically. Describe the feature you'd like We would love to see support for an automatic remediation for this rule. We have already deployed SHARR and implemented a number of controls and thus would like to avoid redeploying the solution with custom modified code to remediate EC2.19. A remediation that, if enabled, would close down offending security groups (as described n the control description) would be extremely useful, possible even the ability to add custom rules regarding security group configurations that we would disallow in our organization.
Additional context If there is any simple way to add this remediation to my existing solution without modifying existing architecture, I would love to know about it.
Remediation for the following PCI DSS control will be available in V2.0.0:
Remediations for the following AFSBP controls will be available in V2.0.0:
Stretch goals: * SecretsManager.3 - Remove unused Secrets Manager secrets * SecretsManager.4 - Secrets Manager secrets should be rotated within a specified number of days * SSM.2 - All EC2 instances managed by Systems Manager should be compliant with patching requirements * SSM.4 - SSM documents should not be public * Lambda.5 - VPC Lambda functions should operate in more than one Availability Zone * KMS.1 - IAM customer managed policies should not allow decryption and re-encryption actions on all KMS keys * ECS.1 to ECS.12
Refer to changelog for more information
Full Changelog: https://github.com/aws-solutions/aws-security-hub-automated-response-and-remediation/compare/v1.4.2...v1.5.0
aws aws-security-automation aws-security-hub