Skip to content

Commit d9a93a5

Browse files
author
iru
committed
docs: refresh/clarify org-three-way
1 parent 77fd484 commit d9a93a5

File tree

1 file changed

+93
-48
lines changed

1 file changed

+93
-48
lines changed

use-cases/org-three-way-ecs.md

Lines changed: 93 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,36 @@ With ECS as workload-type.
77
<br/>This is terraform-based guidelines, but can also check [Manual Organizational Setup - Three-Way Cross-Account ](./manual-org-three-way.md)
88

99

10-
- **User Infrastructure Setup**:
10+
**User Infrastructure Setup**
1111

1212
This is the scenario we're going to recreate
1313

14-
1. Management Account / Accounts
15-
- Eithere there is an Organizational Cloudtrail reporting to the log archive account
16-
- Or several accounts reporting to the same log archive account
17-
2. Log Archive Account
18-
- Cloudtrail-S3 bucket, with event notification to an SNS > SQS
19-
3. Workload/Security Member Account
20-
- Sysdig Secure for cloud deployment
21-
- Existing VPC network setup.
14+
1. Management Account / Accounts
15+
- Either there is an Organizational Cloudtrail reporting to the log archive account
16+
- Or several accounts reporting to the same log archive account
17+
2. Log Archive Account
18+
- Cloudtrail-S3 bucket, with event notification to an SNS > SQS
19+
3. Workload/Security Member Account
20+
- Sysdig Secure for cloud deployment
21+
- Optionally, we can re-use an existing VPC/subnet network setup.
2222

23-
- Besides, we will make use of an **existing VPC/Subnet configuration**.
24-
25-
- Required **Sysdig Secure For Cloud [Features](https://docs.sysdig.com/en/docs/installation/sysdig-secure-for-cloud/)**
23+
**Sysdig Secure For Cloud [Features](https://docs.sysdig.com/en/docs/installation/sysdig-secure-for-cloud/)** covered
2624
- Threat-Detection
2725
- Posture; Compliance + Identity Access Management
28-
- :warning: Cloud image scanning is not supported yet
26+
- :warning: Cloud image scanning is not available for this use-case
2927
<br/><br/>
3028

3129

3230
## Suggested setup
3331

3432
- Default `organizational` example is pre-configured to work with managed-account level resources (cloudtrail, s3, sns and sqs resources).
35-
- We will make use of an alternative event ingestion vía S3 Event Notification through an SNS-SQS.
36-
- It's important that all existing resources (cloudtrail-s3, cloudtrail-s3-sns-sqs, and sysdig workload), are **within same AWS_REGION**. Otherwise, contact us, so we can alleviate this limitation.
37-
- We will need some permission setup, in order to let Sysdig Modules to be able to read resources from customer's infrastructure setup.
38-
- For existing VPC/Subnet usage, we will make use of the optional variables. Right now these two fields also require an ECS cluster to be configured.
33+
- We will make use of an **alternative event ingestion vía S3 Event Notification, with a SNS-SQS forwarder**.
34+
- It's important that all existing resources (cloudtrail-s3, cloudtrail-s3-sns-sqs, and sysdig workload), are **within same AWS_REGION**.
35+
- If cross-account resources are to be accessed, we will need to set up some IAM Roles.
36+
- Optionally, for **existing VPC/Subnet** usage, we will make use of the optional variables. Right now these two fields also require an ECS cluster to be configured.
3937

4038

41-
### Step by Step Example Guide
39+
### Step-by-Step Example Guide
4240

4341
<!--
4442
@@ -88,7 +86,7 @@ log archive account - s3, sns, sqs
8886

8987
#### 1. Configure `AWS_PROFILE` with an organizational Administration credentials
9088

91-
Module is intended to create resources on your management account, as well as member-accounts.
89+
Sysdig Secure for cloud will create resources both on your management account, and member-accounts.
9290

9391
Refer to [General Permissions](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud#required-permissions) to get more detail on what's required,
9492
and [Organizational Role Summary](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/tree/master/examples/organizational#role-summary) for this specific use-case scenario.
@@ -99,15 +97,18 @@ This accountID will be required in the `SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_I
9997

10098
#### 3. Pre-Terraform Requirements
10199

102-
#### 3.1 ECS Cluster
100+
#### 3.1 (Optional) Re-use of existing VPC/Subnet
103101

104102
- Create an ECS cluster and configure it with the existing VPC/Subnet/... network configuration suiting your needs.
105103
- Refer to [Sysdig SASS Region and IP Ranges Documentation](https://docs.sysdig.com/en/docs/administration/saas-regions-and-ip-ranges/) to get Sysdig SaaS endpoint and allow both outbound (for compute vulnerability report) and inbound (for scheduled compliance checkups)
106104
- ECS type deployment will create following [security-group setup](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/blob/master/modules/services/cloud-connector-ecs/sec-group.tf)
107105

108-
#### 3.2 Permissions - SysdigSecureForCloud-S3AccessRole
106+
#### 3.2 (Optional) S3 and Sysdig Workload are in different accounts
107+
108+
If `SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID` is differnt to the account where the S3 is located, we need to allow
109+
cross-account access through a role.
109110

110-
Required action to allow AWS S3 cross-account access.
111+
Permission setup for SysdigSecureForCloud-S3AccessRole
111112

112113
- Create a `SysdigSecureForCloud-S3AccessRole` in the same account where the S3 bucket exists.
113114
- Give it whatever trust-permissions you feel comfortable with, we will edit it later.
@@ -124,11 +125,54 @@ Required action to allow AWS S3 cross-account access.
124125
```
125126
- Fetch the created role arn as `CLOUDTRAIL_S3_ROLE_ARN`
126127

127-
#### 4. Launch Terraform
128128

129-
We will use this Terraform Manifest. Get detailed explanation of each variable bellow.
129+
#### 3.3 Cloudtrail S3 ingestion through Event-Forward
130+
131+
When Cloudtrail-SNS is not available, or the Cloudtrail-S3 events are in an account different to the management
132+
account, we will rely on a S3 Event Forwarder, to allow the workload to ingest events more easily.
133+
134+
Secure for Cloud requires an SQS queue from which it can ingest events, and this will provide
135+
`CLOUDTRAIL_S3_SNS_SQS_ARN` and `CLOUDTRAIL_S3_SNS_SQS_URL` for later installation.
136+
137+
We provide a module to create this
138+
[Cloudtrail S3 bucket event-forwarder into an SNS>SQS](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/tree/master/modules/infrastructure/cloudtrail_s3-sns-sqs)
139+
but you can do it manually too.
140+
141+
General usage is described within the module source, and will be explained in the next point, with the variables to
142+
be used.
143+
144+
#### 4. Launch Terraform Manifest
145+
146+
Let's create the Terraform manifest module parametrization, based on `examples/organizational`.
147+
Get detailed explanation of each variable bellow.
130148

131149
```terraform
150+
151+
152+
# --------------------------------------------------
153+
# Optional. for Cloudtrail S3-SNS-SQS creation
154+
# --------------------------------------------------
155+
156+
# provider for S3 account
157+
# this is a sample authentication, can adapt it as long as alias is maintaned
158+
provider "aws"{
159+
alias = "s3"
160+
region = "<AWS_REGION>"
161+
assume_role {
162+
role_arn = "arn:aws:iam::<S3_BUCKET_ACCOUNT_ID>:role/OrganizationAccountAccessRole"
163+
}
164+
}
165+
166+
module "cloudtrail_s3_sns_sqs" {
167+
providers = {
168+
aws = aws.s3
169+
}
170+
source = "sysdiglabs/secure-for-cloud/aws//modules/infrastructure/cloudtrail_s3-sns-sqs"
171+
cloudtrail_s3_name = "<CLOUDTRAIL_S3_NAME>"
172+
}
173+
# --------------------------------------------------
174+
175+
132176
terraform {
133177
required_providers {
134178
sysdig = {
@@ -144,13 +188,14 @@ provider "sysdig" {
144188
145189
# provider used to deploy RO compliance role on organizational accounts
146190
provider "aws" {
147-
region = "<AWS_REGION>" # must match s3 AND sqs region
191+
region = "<AWS_REGION>"
148192
}
149193
150194
# provider used to deploy sfc on the selected member-account
195+
# this is a sample authentication, can adapt it as long as alias is maintaned
151196
provider "aws" {
152197
alias = "member"
153-
region = "<AWS_REGION>" # must match s3 AND sqs region
198+
region = "<AWS_REGION>"
154199
assume_role {
155200
# 'OrganizationAccountAccessRole' is the default role created by AWS for management-account users to be able to admin member accounts.
156201
# if this is changed, please change to the `examples/organizational` input var `organizational_member_default_admin_role` too
@@ -169,35 +214,41 @@ module "sysdig-sfc" {
169214
170215
sysdig_secure_for_cloud_member_account_id="<SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID>"
171216
217+
# optional, if no VCP wants to be re-used
172218
ecs_cluster_name = "<ECS_CLUSTER_NAME>"
173219
ecs_vpc_id = "<ECS_VPC_ID>"
174220
ecs_vpc_subnets_private_ids = ["<ECS_VPC_SUBNET_PRIVATE_ID_1>","<ECS_VPC_SUBNET_PRIVATE_ID_2>"]
175221
176222
existing_cloudtrail_config={
177-
cloudtrail_s3_sns_sqs_arn = "<CLOUDTRAIL_S3_SNS_SQS_ARN>"
178-
cloudtrail_s3_sns_sqs_url = "<CLOUDTRAIL_S3_SNS_SQS_URL>"
179-
cloudtrail_s3_role_arn = "<CLOUDTRAIL_S3_ROLE_ARN>"
223+
cloudtrail_s3_sns_sqs_arn = "<CLOUDTRAIL_S3_SNS_SQS_ARN>"
224+
cloudtrail_s3_sns_sqs_url = "<CLOUDTRAIL_S3_SNS_SQS_URL>"
225+
226+
# optional, only if CLOUDTRAIL_S3 and SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID are in different accounts
227+
cloudtrail_s3_role_arn = "<CLOUDTRAIL_S3_ROLE_ARN>"
180228
}
181229
}
182230
```
183231

184232
- We'll use the **organizational** example
185233
- **General** parameters
186234
- `AWS_REGION` Same region is to be used for both organizational managed account and Sysdig workload member account resources.<br/>
187-
- Region MUST match both S3 bucket, SNS and SQS
188-
- `SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID` where Sysdig Workload is to be deployed under the pre-existing ECS<br/><br/>
235+
- Region MUST be unique for all values, and match the location of S3 bucket, SNS and SQS
236+
- `SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID` where Sysdig Workload is to be deployed, optionally, under the pre-existing ECS<br/><br/>
237+
238+
- **Cloudtrail S3 SNS-SQS** Setup
239+
- `S3_BUCKET_ACCOUNT_ID` in order to authenticate aws provider on the member account
240+
- `CLOUDTRAIL_S3_NAME` name of the cloudtrail s3 bucket
241+
- `CLOUDTRAIL_S3_SNS_SQS_ARN` if manged through terraform should have value `module.cloudtrail_s3_sns_sqs.cloudtrail_subscribed_sqs_arn`
242+
- `CLOUDTRAIL_S3_SNS_SQS_URL` if manged through terraform should have value `module.cloudtrail_s3_sns_sqs.cloudtrail_subscribed_sqs_url"`
243+
- (Optional) `CLOUDTRAIL_S3_ROLE_ARN` ARN of the `SysdigSecureForCloud-S3AccessRole` created in step 3.2, for ECSTaskRole to assumeRole and access S3
189244

190-
- Existing **ECS Cluster and networking** setup
245+
- (Optional) Existing **ECS Cluster and networking** setup
191246
- `ECS_CLUSTER_NAME` ex.: "sfc"
192247
- `ECS_VPC_ID` ex.: "vpc-0e91bfef6693f296b"
193248
- `ECS_VPC_SUBNET_PRIVATE_ID_X` Two subnets for the VPC. ex.: "subnet-0c7d803ecdc88437b"<br/><br/>
194249

195-
- Existing Organizational **Cloudtrail setup** vía S3 event notification through SNS-SQS.
196-
- `CLOUDTRAIL_S3_SNS_SQS_ARN` ARN of the queue, for us to setup ECSTaskRole to be able to access SQS
197-
- `CLOUDTRAIL_S3_SNS_SQS_URL` URL of the queue from were to ingest events in the cloud-connector compute deployment
198-
- `CLOUDTRAIL_S3_ROLE_ARN` ARN of the `SysdigSecureForCloud-S3AccessRole` created in step 3.2, for ECSTaskRole to assumeRole and access S3
199250

200-
#### 5. Use-Case Specific Permissions
251+
#### 5.Optional. Permission setup when S3_BUCKET_ACCOUNT_ID != SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID
201252

202253
When applying Terraform manifest it will create resources, and we should have no errors there.
203254
However, deployed compute will fail (can check the logs in the ECS Task) due to permissions.
@@ -211,8 +262,9 @@ Let's fix that; we need to allow S3 and SQS resources to be accessed by the comp
211262
Get this ARN at hand, because it's what you'll use to configure your pre-existing CLOUDTRAIL_S3 and CLOUDTRAIL_S3_SNS_SQS permissions to allow SysdigWorkload to operate with it.
212263

213264
Default `SYSDIG_ECS_TASK_ROLE_ARN` should be `arn:aws:iam::<SYSDIG_SECURE_FOR_CLOUD_MEMBER_ACCOUNT_ID>:role/sfc-organizational-ECSTaskRole`
214-
but you can check its value accessing the ECS Cluster and checking deployed Task definition, or launching following CLI:
215-
```terraform
265+
but you can check its value accessing the ECS Cluster and checking deployed Task definition, or launching following CLI
266+
267+
```bash
216268
$ terraform state list | grep aws_iam_role.connector_ecs_task
217269
<RESULTING_RESOURCE>
218270

@@ -260,12 +312,5 @@ We should not need to restart ECSTask as this changes will be applied on runtime
260312

261313
### 6. Check-up
262314

263-
Suggested steps
264-
265-
1. Access ECS logs for the SecureForCloud task
266-
- check that there are no errors and events are being ingested
267-
2. If logs are OK, check in Sysdig Secure
268-
- Integrations > Data Sources - Cloud Accounts
269-
- Posture > Identity and Access Management - Overview
270-
- Posture > Compliance - AWS
271-
- Insights > Cloud Activity
315+
- Access ECS logs for the SecureForCloud task and check that there are no errors and events are being ingested
316+
- If logs are ok, [Sysdig Secure Docs - Secure for cloud - AWS - Confirm services are working](https://docs.sysdig.com/en/docs/installation/sysdig-secure-for-cloud/deploy-sysdig-secure-for-cloud-on-aws/#confirm-the-services-are-working)

0 commit comments

Comments
 (0)