Skip to content

Commit 82b955f

Browse files
Liam SchneiderLiam Schneider
Liam Schneider
authored and
Liam Schneider
committed
Merge branch 'main' into deployment_script
2 parents 026fd1f + 6430297 commit 82b955f

File tree

8 files changed

+88
-18
lines changed

8 files changed

+88
-18
lines changed

aws_sra_examples/docs/CFCT-DEPLOYMENT-INSTRUCTIONS.md

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,28 @@ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-
44

55
---
66

7+
CfCT is a deployment mechanism for SRA solutions within Control Tower enabled AWS environments.
8+
The requisite [SRA solution configuration files](https://github.com/aws-samples/aws-security-reference-architecture-examples/tree/main/aws_sra_examples/solutions) are stored in either CodeCommit (deprecated service) or S3 and programmatically configured in AWS with a CodePipeline. Whether you're using the sra-easy-setup deployment method or deploying SRA controls ADHOC, the CfCT deployment mechanism makes managing and customizing SRA solutions easier.
9+
10+
711
## Table of Contents<!-- omit in toc -->
812

913
- [Prerequisites](#prerequisites)
14+
- [Deploy Control Tower](#deploy-control-tower)
1015
- [Create the AWSControlTowerExecution IAM Role](#create-the-awscontroltowerexecution-iam-role)
1116
- [Deploy Customizations for AWS Control Tower (CFCT) Solution](#deploy-customizations-for-aws-control-tower-cfct-solution)
1217
- [AWS CodeCommit Repo](#aws-codecommit-repo)
18+
- [AWS S3 Repo](#aws-s3-repo)
19+
- [Configure SRA Deployment Repo](#configue-your-sra-deployment-repo)
1320
- [References](#references)
1421

22+
1523
## Prerequisites
1624

25+
### Deploy Control Tower
26+
27+
- These customizations act on existing Control Tower deployments. For more details on Control Tower and Landing Zone deployments, see the [userguide](https://docs.aws.amazon.com/controltower/latest/userguide/quick-start.html).
28+
1729
### Create the AWSControlTowerExecution IAM Role
1830

1931
- The `AWSControlTowerExecution` Role provides the support needed to deploy solutions to the `management account` across regions as CloudFormation `StackSets` and it is required for the SRA CFCT solution deployments.
@@ -27,18 +39,31 @@ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-
2739
<!-- markdownlint-disable-next-line MD034 -->
2840
- `Amazon S3 URL` = https://s3.amazonaws.com/solutions-reference/customizations-for-aws-control-tower/latest/custom-control-tower-initiation.template
2941
- `Stack name` = custom-control-tower-initiation
30-
- `AWS CodePipeline Source` = AWS CodeCommit
42+
- `AWS CodePipeline Source` = AWS CodeCommit | S3
3143
- `Failure Tolerance Percentage` = 0
3244
- Acknowledge that AWS CloudFormation might create IAM resources with custom names
3345

3446
Note: Version 2 or higher of CfCT is expected.
3547

3648
### AWS CodeCommit Repo
49+
*Note: AWS CodeCommit is being deprecated and cannot be deployed to new environments, unless that environment is a part of an AWS Organization with an account that already has CodeCommit deployed. Please see [AWS S3 Repo](#aws-s3-repo) for new AWS Accounts.*
50+
51+
Create a CodeCommit repo for SRA customization [configuration files](#deployment-instructions).
3752

3853
1. On the local machine install [git](https://git-scm.com/downloads) and [git-remote-codecommit](https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-connect.html).
3954
2. Clone the AWS CodeCommit repository via `git clone codecommit::<HOME REGION>://custom-control-tower-configuration custom-control-tower-configuration`
4055

56+
### AWS S3 Repo
57+
58+
Create a CodeCommit repo for SRA cusotmization [configuration files](#deployment-instructions).
59+
60+
- By default, the CodePipeline deployed from the custom-control-tower-initiation CloudFormation will use the `custom-control-tower-configuration-<< ACCOUNT NAME >>-<< REGION NAME >>` S3 bucket as a Source repo. Additionally, it will look for the `custom-control-tower-configuration.zip` file. The pipeline will fail without it. We have provided users with an example `_custom-control-tower-configuration.zip` file in S3 with an example repo for convenience.
61+
62+
- If you would like to change the S3 bucket Source for the CodePipeline, you will need to navigate to the CodePipeline within the AWS console, edit the Source stage for the CodePipeline and update the Bucket name value. Users can also modify the S3 object key value if the ZIP filename differs from default.
63+
64+
4165
## Deployment Instructions<!-- omit in toc -->
66+
*Note: these instructions assume version 2 or higher of the CfCT solution has been installed.*
4267

4368
1. Determine which version of the [Customizations for AWS Control Tower](https://aws.amazon.com/solutions/implementations/customizations-for-aws-control-tower/) solution you have deployed:
4469
1. Within the `management account (home region)` find the **CloudFormation Stack** for the Customizations for Control Tower (e.g. `custom-control-tower-initiation`)
@@ -48,18 +73,59 @@ Note: Version 2 or higher of CfCT is expected.
4873
2. Version 2 = v2.x.x = manifest.yaml version 2021-03-15
4974
2. If version 2 is installed, continue to the deployment instructions below. If not, you will need to update your version of CfCT.
5075

51-
#### Deployment Instructions<!-- omit in toc -->
5276

53-
Note: these instructions assume version 2 or higher of the CfCT solution has been installed.
77+
##### Configue Your SRA Deployment Repo
78+
79+
SRA Customizations with CfCT are deployed via a CodePipeline from either a CodeCommit or S3 source.
80+
Here's an example of an repo for sra-easy-deploy.yaml deployment with controls/parameters for GuardDuty.
81+
82+
> ├── manifest.yaml
83+
> |
84+
> ├── templates
85+
> │   └── sra-easy-setup.yaml
86+
> |
87+
> ├── parameters
88+
> │   └── sra-guardduty-org-main-ssm.json
89+
> |
90+
> ├── policies
91+
92+
93+
###### manifest.yaml file [**required**]
94+
95+
The manifest file will contain all the high level SRA controls that will be deployed to your environment.
96+
An example manifest file for [sra-easy-setup.yaml](https://github.com/aws-samples/aws-security-reference-architecture-examples/blob/main/aws_sra_examples/easy_setup/customizations_for_aws_control_tower/manifest.yaml)
97+
98+
- Define all `parameters`, `organizational unit names`, `account names` and `SSM parameters` necessary for the SRA controls that you want to enable and configure here.
99+
100+
- If you are using a non-standard file structure in your Repo, as outlined above, the [*resource_file* key](https://github.com/aws-samples/aws-security-reference-architecture-examples/blob/main/aws_sra_examples/easy_setup/customizations_for_aws_control_tower/manifest.yaml#L13C5-L13C49) value in your manifest file must reflect the path to your template.
101+
102+
- Be sure to update the [*accounts* key](https://github.com/aws-samples/aws-security-reference-architecture-examples/blob/main/aws_sra_examples/easy_setup/customizations_for_aws_control_tower/manifest.yaml#L310) to reflect your Management Account name.
103+
104+
###### templates [**required**]
105+
106+
The templates directory will contain the actual CloudFormation files that are defined within the manifest file.
107+
We use the sra-easy-setup deployment method as an example for the manifest above, [here's](https://github.com/aws-samples/aws-security-reference-architecture-examples/blob/main/aws_sra_examples/easy_setup/templates/sra-easy-setup.yaml) what the template file looks like.
108+
109+
You can also deploy SRA solutions ADHOC, without the sra-easy-setup, by including their corresponding manifest CFN template entry under the resources list for your manifest.yaml file. Exmaples of manifest files for supported solutions can be found within the `aws_sra_examples` repo [aws_sra_examples/solutions/<< SOLUTION NAME >>/customizations_for_aws_control_tower/manifest.yaml](https://github.com/aws-samples/aws-security-reference-architecture-examples/tree/main/aws_sra_examples/solutions).
110+
111+
- You shouldn't need to modify much in this template file as all SRA controls and parameters are defined in the manifest and files under the parameters directory, respectively.
112+
113+
###### policies [optional]
114+
115+
Service control policy JSON files go here. The files under the Policies directory will depend on what SRA controls that you're deploying to your environment. Not all SRA controls will require policies defined here.
116+
117+
###### parameters [optional]
118+
119+
Service control parameter JSON files go here. The files under the Parameters directory will depend on what SRA controls that you're deploying to your environment. Not all SRA controls will require parameters defined here.
120+
121+
Above, we used the [sra-guardduty-org-main-ssm.json](https://github.com/aws-samples/aws-security-reference-architecture-examples/blob/main/aws_sra_examples/solutions/guardduty/guardduty_org/customizations_for_aws_control_tower/parameters/sra-guardduty-org-main-ssm.json) parameters file as an example for our sra-easy-setup deploying GuardDuty controls in AWS.
122+
123+
You can find examples of parameter files for each security solution that we support within the `aws_sra_examples` repo [aws_sra_examples/solutions/<< SOLUTION NAME >>/customizations_for_aws_control_tower/parameters/](https://github.com/aws-samples/aws-security-reference-architecture-examples/tree/main/aws_sra_examples/solutions).
124+
125+
126+
##### Push To CodeCommit or S3
127+
*Note: If you are using S3, the files above will need to be ZIPPED up and named `custom-control-tower-configuration`.*
54128

55-
1. Copy the files to the Customizations for AWS Control Tower configuration `custom-control-tower-configuration`
56-
- policies [optional]
57-
- service control policies files (\*.json)
58-
- templates [**required**]
59-
- Copy the template files from the `templates` folder that are referenced in the `manifest.yaml`
60-
2. Update the manifest.yaml file with the `parameters`, `organizational unit names`, `account names` and `SSM parameters` for the target environment
61-
- *Be sure to update `deployment_targets` `accounts` with your management account information*
62-
3. Deploy the Customizations for AWS Control Tower configuration by pushing the code to the `AWS CodeCommit` repository or uploading to the `AWS S3 Bucket`
63129

64130
### Delete Instructions<!-- omit in toc -->
65131

@@ -72,6 +138,7 @@ Note: these instructions assume version 2 or higher of the CfCT solution has bee
72138
1. Delete the Stack Instances from the `CustomControlTower-<solution_name>*` CloudFormation StackSets
73139
2. After the Stack Instances are deleted, delete the `CustomControlTower-<solution_name>*` CloudFormation StackSets
74140

141+
75142
## References
76143

77-
- [Customizations for AWS Control Tower](https://aws.amazon.com/solutions/implementations/customizations-for-aws-control-tower/)
144+
- [Customizations for AWS Control Tower](https://aws.amazon.com/solutions/implementations/customizations-for-aws-control-tower/)

aws_sra_examples/solutions/ami_bakery/ami_bakery_org/lambda/src/codepipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def create_codepipeline(
9090
"roleArn": "arn:" + aws_partition + ":iam::" + account_id + ":role/" + codepipeline_role_name,
9191
"artifactStore": {"type": "S3", "location": bucket_name},
9292
"stages": [
93-
{
93+
{ # type: ignore
9494
"name": pipeline_name + "-CodeCommitSource",
9595
"actions": [
9696
{
@@ -104,7 +104,7 @@ def create_codepipeline(
104104
}
105105
],
106106
},
107-
{
107+
{ # type: ignore
108108
"name": pipeline_name + "-DeployEC2ImageBuilder",
109109
"actions": [
110110
{

aws_sra_examples/solutions/config/config_org/lambda/src/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def set_config_in_org(
9292
configuration_recorder: ConfigurationRecorderTypeDef = {
9393
"name": recorder_name,
9494
"roleARN": role_arn,
95-
"recordingGroup": {
95+
"recordingGroup": { # type: ignore
9696
"allSupported": all_supported,
9797
"includeGlobalResourceTypes": include_global_resource_types,
9898
"resourceTypes": resource_types,

aws_sra_examples/solutions/patch_mgmt/patch_mgmt_org/lambda/src/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def manage_task_params(
369369
"""
370370
if task_operation is None and task_reboot_option is None:
371371
no_param_response: MaintenanceWindowTaskInvocationParametersTypeDef = {
372-
"RunCommand": {
372+
"RunCommand": { # type: ignore
373373
"Parameters": {},
374374
"DocumentVersion": "$DEFAULT",
375375
"TimeoutSeconds": 3600,
@@ -382,7 +382,7 @@ def manage_task_params(
382382
task_operation_final: str = "INVALID_TASK_OPERATION_PROVIDED" if task_operation is None else task_operation
383383
task_reboot_option_final: str = "INVALID_TASK_REBOOT_OPTION_PROVIDED" if task_reboot_option is None else task_reboot_option
384384
with_params_response: MaintenanceWindowTaskInvocationParametersTypeDef = {
385-
"RunCommand": {
385+
"RunCommand": { # type: ignore
386386
"Parameters": {
387387
"Operation": [task_operation_final],
388388
"RebootOption": [task_reboot_option_final],

aws_sra_examples/solutions/security_lake/security_lake_org/lambda/src/security_lake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ def set_lake_formation_permissions(lf_client: LakeFormationClient, account: str,
913913
try:
914914
resource: Union[ResourceTypeDef] = {
915915
"Database": {"CatalogId": account, "Name": db_name + "_subscriber"},
916-
"Table": {"CatalogId": account, "DatabaseName": db_name + "_subscriber", "Name": "rl_*"},
916+
"Table": {"CatalogId": account, "DatabaseName": db_name + "_subscriber", "Name": "rl_*"}, # type: ignore
917917
}
918918
lf_client.grant_permissions(
919919
CatalogId=account,

aws_sra_examples/terraform/solutions/inspector/configuration/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ resource "aws_sns_topic_subscription" "inspector_org_topic_subscription" {
437437
########################################################################
438438
# AWS SQS Queue
439439
resource "aws_sqs_queue" "inspector_org_dlq" {
440+
# checkov:skip=CKV2_AWS_73: Using default KMS key
440441
name = "${var.sra_solution_name}-dlq"
441442
kms_master_key_id = "alias/aws/sqs"
442443

aws_sra_examples/terraform/solutions/macie/configuration/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ resource "aws_sns_topic_subscription" "r_macie_org_topic_subscription" {
377377
}
378378

379379
resource "aws_sqs_queue" "macie_org_dlq" {
380+
# checkov:skip=CKV2_AWS_73: Using default KMS key
380381
name = "${var.p_sra_solution_name}-dlq"
381382
kms_master_key_id = "alias/aws/sqs"
382383
tags = {

aws_sra_examples/terraform/solutions/security_hub/configuration/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ resource "aws_sns_topic_subscription" "securityhub_org_topic_subscription" {
435435

436436
# AWS SQS Queue
437437
resource "aws_sqs_queue" "securityhub_org_dlq" {
438+
# checkov:skip=CKV2_AWS_73: Using default KMS key
438439
name = "${var.sra_solution_name}-dlq"
439440
kms_master_key_id = "alias/aws/sqs"
440441

0 commit comments

Comments
 (0)