|
| 1 | +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: CC-BY-SA-4.0 |
| 2 | + |
| 3 | +# Register Delegated Administrator Account |
| 4 | + |
| 5 | +The register delegated administrator account solution is a common solution to register a delegated administrator |
| 6 | +account (e.g. Security Tooling Account) within the AWS Organizations management account using the AWS Organizations |
| 7 | +APIs. |
| 8 | + |
| 9 | +---- |
| 10 | + |
| 11 | +# Table of Contents |
| 12 | +* [Deployed Resource Details](#deployed-resource-details) |
| 13 | +* [Implementation Instructions](#implementation-instructions) |
| 14 | +* [References](#references) |
| 15 | + |
| 16 | +---- |
| 17 | + |
| 18 | +# Deployed Resource Details |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +## 1.0 Organization Management Account |
| 23 | + |
| 24 | +### 1.1 AWS CloudFormation |
| 25 | + |
| 26 | +**Description:** |
| 27 | + |
| 28 | +All resources are deployed via CloudFormation StackSet and Stacks within member accounts |
| 29 | + |
| 30 | +**Configuration:** |
| 31 | + |
| 32 | +* StackSet Names: |
| 33 | + * RegisterDelegatedAdmin |
| 34 | + |
| 35 | +### 1.2 AWS Lambda Function |
| 36 | + |
| 37 | +**Description:** |
| 38 | + |
| 39 | +The custom CloudFormation Lambda resource is required to delegate an administrator account because this capability |
| 40 | +is not supported by CloudFormation. |
| 41 | + |
| 42 | +**Configuration:** |
| 43 | + |
| 44 | +* Lambda Function Name = [Prefix]-register-delegated-admin |
| 45 | +* Environment Variables and Properties (Configurable and set via CloudFormation) |
| 46 | + * AWS_SERVICE_PRINCIPAL_LIST - AWS service principals to delegate administration for |
| 47 | + * DELEGATED_ADMIN_ACCOUNT_ID - Organization Member Account ID, e.g. Security Tooling Account |
| 48 | + * LOG_LEVEL - Default = info, Valid Values = debug, info, warning, error, critical |
| 49 | + |
| 50 | +**Input Validation** |
| 51 | + |
| 52 | +Validation of environment variables and properties is done to make sure values exist and are the correct type |
| 53 | + |
| 54 | +### 1.3 Lambda CloudWatch Log Group |
| 55 | + |
| 56 | +**Description:** |
| 57 | + |
| 58 | +Contains Lambda function execution logs |
| 59 | + |
| 60 | +**Configuration:** |
| 61 | + |
| 62 | +* Log group name = /aws/lambda/[Lambda Function] |
| 63 | + |
| 64 | +### 1.4 Lambda Execution IAM Role |
| 65 | + |
| 66 | +**Description:** |
| 67 | + |
| 68 | +Used by the custom CloudFormation Lambda function to enable AWS service access for the provided service and register |
| 69 | +an AWS account as the delegated administrator. |
| 70 | + |
| 71 | +**Configuration:** |
| 72 | + |
| 73 | +* Role Name: [Prefix]-register-delegated-admin-lambda |
| 74 | +* Policy Name: [Prefix]-register-delegated-admin-lambda |
| 75 | +* Permissions: |
| 76 | + * CloudWatch Logs - Limited: Write on LogGroupName like /aws/lambda/[Lambda Function] |
| 77 | + * Organizations - Limited: List, Read, Write |
| 78 | + |
| 79 | +### 1.5 AWS Organizations |
| 80 | + |
| 81 | +**Description:** |
| 82 | + |
| 83 | +AWS Organizations APIs are used to delegate the administrator account |
| 84 | + |
| 85 | +**Configuration:** |
| 86 | + |
| 87 | +* Delegated Admin Account ID |
| 88 | +* Service Principal |
| 89 | + |
| 90 | + |
| 91 | +---- |
| 92 | + |
| 93 | +## 2.0 Delegated Administrator Account (Security Tooling) |
| 94 | + |
| 95 | +### 2.1 Services Supported |
| 96 | + |
| 97 | +**Description:** |
| 98 | + |
| 99 | +The services that support a delegated administrator account can be configured and managed within this account. |
| 100 | + |
| 101 | +**Configuration:** |
| 102 | + |
| 103 | +* Service Principal Mapping |
| 104 | + |
| 105 | +| Service | Service Principal | |
| 106 | +| ---------------------------- | -------------------------------------- | |
| 107 | +| AWS IAM Access Analyzer | access-analyzer.amazonaws.com | |
| 108 | +| AWS Audit Manager | auditmanager.amazonaws.com | |
| 109 | +| AWS CloudFormation StackSets | stacksets.cloudformation.amazonaws.com | |
| 110 | +| AWS Config | config.amazonaws.com | |
| 111 | +| AWS Config Conformance Packs | config-multiaccountsetup.amazonaws.com | |
| 112 | +| Amazon Macie | macie.amazonaws.com | |
| 113 | +| AWS Security Hub | securityhub.amazonaws.com | |
| 114 | +| Amazon S3 Storage Lens | storage-lens.s3.amazonaws.com | |
| 115 | + |
| 116 | + |
| 117 | +---- |
| 118 | + |
| 119 | +# Implementation Instructions |
| 120 | + |
| 121 | +### [AWS Control Tower](./aws-control-tower) |
| 122 | +### CloudFormation StackSets |
| 123 | + |
| 124 | +1. Create new or use an existing S3 bucket within the deployment region owned by the Organization Management Account |
| 125 | + * Example bucket name: lambda-zips-[Management Account ID]-[AWS region] |
| 126 | + * [Example CloudFormation Template](../../../extras/lambda-s3-buckets.yaml) |
| 127 | + * Each bucket must allow the s3:GetObject action to the AWS Organization using a bucket policy like the one below |
| 128 | + to allow the accounts within the Organization to get the Lambda files. |
| 129 | +2. Package the Lambda code into a zip file and upload it to the S3 bucket |
| 130 | + * Package and Upload the Lambda zip file to S3 - [Packaging script](../../../extras/packaging-scripts/package-lambda.sh) |
| 131 | + ```shell |
| 132 | + export BUCKET=lambda-zips-CHANGE_ME_ACCOUNT_ID-CHANGE_ME_REGION |
| 133 | + sh ~/aws-security-reference-architecture-examples/extras/packaging-scripts/package-lambda.sh \ |
| 134 | + --file_name common-register-delegated-admin.zip \ |
| 135 | + --bucket $BUCKET \ |
| 136 | + --src_dir ~/aws-security-reference-architecture-examples/solutions/common/register-delegated-admninistrator/code/src |
| 137 | + ``` |
| 138 | +3. Create a CloudFormation StackSet or Stack with the following template |
| 139 | + |
| 140 | + | Account | StackSet Name | Template | |
| 141 | + | --------------- | ----------------- | ---------- | |
| 142 | + | Management | RegisterDelegatedAdmin | templates/register-delegated-admin.yaml | |
| 143 | +4. Verify configuration using the following AWS CLI shell script |
| 144 | + ```shell |
| 145 | + for accountId in $(aws organizations list-delegated-administrators --query 'DelegatedAdministrators[*].Id' \ |
| 146 | + --output text); do echo -e "$accountId\n Service Principals: " \ |
| 147 | + $(aws organizations list-delegated-services-for-account --account-id $accountId \ |
| 148 | + --query 'DelegatedServices[*].ServicePrincipal'); done |
| 149 | + ``` |
| 150 | + |
| 151 | +---- |
| 152 | + |
| 153 | +# References |
| 154 | + |
| 155 | +* [AWS services that you can use with AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services_list.html) |
0 commit comments