Skip to content

Commit 592463c

Browse files
author
iru
authored
doc: enhance permissions and role usage (#89)
* doc: enhance permissions
1 parent d5f2da4 commit 592463c

File tree

4 files changed

+87
-22
lines changed

4 files changed

+87
-22
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,70 @@ $ terraform plan
128128
$ terraform apply
129129
```
130130

131+
## Required Permissions
132+
133+
### Required Permissions
134+
135+
#### Provisioning Permissions
136+
137+
Terraform provider credentials/token, requires `Administrative` permissions in order to be able to create the
138+
resources specified in the per-example diagram.
139+
140+
Some components may vary, and you can check full resources on each module "Resources" section in their README's, but this would be an overall schema of the **created resources**:
141+
142+
- SSM Parameter for Sysdig API Token Storage
143+
- Cloudtrail / SNS / S3 / SQS
144+
145+
- Sysdig Workload: ECS / AppRunner creation (EKS is pre-required, not created)
146+
- each compute solution require a role to assume for execution
147+
148+
- CodeBuild for on-demand image scanning
149+
- Role for Sysdig [Benchmarks](./modules/services/cloud-bench)
150+
151+
#### Runtime Permissions
152+
153+
Modules create several roles to be able to manage the following permissions.
154+
155+
**General Permissions**
156+
157+
```shell
158+
ssm: GetParameters
159+
160+
sqs: ReceiveMessage
161+
sqs: DeleteMessage
162+
163+
s3: ListBucket
164+
s3: GetObject
165+
```
166+
167+
**Image-Scanning specific**
168+
169+
```shell
170+
codebuild: StartBuild
171+
172+
ecr: GetAuthorizationToken
173+
ecr: BatchCheckLayerAvailability
174+
ecr: GetDownloadUrlForLayer
175+
ecr: GetRepositoryPolicy
176+
ecr: DescribeRepositories
177+
ecr: ListImages
178+
ecr: DescribeImages
179+
ecr: BatchGetImage
180+
ecr: GetLifecyclePolicy
181+
ecr: GetLifecyclePolicyPreview
182+
ecr: ListTagsForResource
183+
ecr: DescribeImageScanFindings
184+
185+
ecs:DescribeTaskDefinition
186+
187+
```
188+
189+
Notes:
190+
- only Sysdig workload related permissions are specified above; infrastructure internal resource permissions (such as Cloudtrail permissions to publish on SNS, or SNS-SQS Subscription)
191+
are not detailed.
192+
- For a better security, permissions are resource pinned, instead of `*`
193+
- Check [Organizational Use Case - Role Summary](./examples/organizational/README.md#role-summary) for more details
194+
131195

132196
## Forcing Events
133197

examples/organizational/README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ Deploy Sysdig Secure for Cloud using an [AWS Organizational Cloudtrail](https://
55
* In the **management account**
66
* An Organizational Cloutrail will be deployed (with required S3,SNS)
77
* An additional role `SysdigSecureForCloudRole` will be created
8-
* to be able to read cloudtrail-s3 bucket events from sysdig workload member account.
9-
* will also be used to asummeRole over other roles, and enable the process of scanning on ECR's that may be present in other member accounts.
8+
* to be able to read cloudtrail-s3 bucket events (and query cloudtrail-sqs) from sysdig workload member account.
9+
* scanning-only, to assumeRole over member-account role
10+
* to scan images pushed to ECR's that may be present in other member accounts.
11+
* to describe ECS task definitions and get images to be scanned, on clusters in other member accounts
1012
* In the **user-provided member account**
1113
* All the Sysdig Secure for Cloud service-related resources/workload will be created
1214

@@ -18,22 +20,22 @@ Minimum requirements:
1820

1921
1. Have an existing AWS account as the organization management account
2022
* Within the Organization, following services must be enabled (Organization > Services)
21-
* Organizational CloudTrail
22-
* [Organizational CloudFormation StackSets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-enable-trusted-access.html)
23+
* Organizational CloudTrail
24+
* [Organizational CloudFormation StackSets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-enable-trusted-access.html)
2325
2. Configure [Terraform **AWS** Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) for the `management` account of the organization
2426
* This provider credentials must be [able to manage cloudtrail creation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-trail-organization.html)
2527
> You must be logged in with the management account for the organization to create an organization trail. You must also have sufficient permissions for the IAM user or role in the management account to successfully create an organization trail.
2628
2729
3. Organizational Multi-Account Setup
2830
* An specific role is required, to enable Sysdig to impersonate and be able to provide
29-
* For scanning feature, the ability to pull ECR hosted images when they're allocated in a different account
30-
* For scanning too, the ability to query the ECS tasks that are allocated in different account, in order to fetch the image to be scanned
31-
* A solution to resolve current limitation when accessing an S3 bucket in a different region than where it's being called from
31+
* For scanning feature, the ability to pull ECR hosted images when they're allocated in a different account
32+
* For scanning too, the ability to query the ECS tasks that are allocated in different account, in order to fetch the image to be scanned
33+
* A solution to resolve current limitation when accessing an S3 bucket in a different region than where it's being called from
3234
* By default, it uses [AWS created default role `OrganizationAccountAccessRole`](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html)
33-
* When an account is created within an organization, AWS will create an `OrganizationAccountAccessRole` [for account management](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html), which Sysdig Secure for Cloud will use for member-account provisioning and role assuming.
34-
* However, when the account is invited into the organization, it's required to [create the role manually](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html#orgs_manage_accounts_create-cross-account-role)
35-
> You have to do this manually, as shown in the following procedure. This essentially duplicates the role automatically set up for created accounts. We recommend that you use the same name, OrganizationAccountAccessRole, for your manually created roles for consistency and ease of remembering.
36-
* If role name, `OrganizationAccountAccessRole` wants to be modified, it must be done both on the `aws` member-account provider AND input value `organizational_member_default_admin_role`
35+
* When an account is created within an organization, AWS will create an `OrganizationAccountAccessRole` [for account management](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html), which Sysdig Secure for Cloud will use for member-account provisioning and role assuming.
36+
* However, when the account is invited into the organization, it's required to [create the role manually](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html#orgs_manage_accounts_create-cross-account-role)
37+
> You have to do this manually, as shown in the following procedure. This essentially duplicates the role automatically set up for created accounts. We recommend that you use the same name, OrganizationAccountAccessRole, for your manually created roles for consistency and ease of remembering.
38+
* If role name, `OrganizationAccountAccessRole` wants to be modified, it must be done both on the `aws` member-account provider AND input value `organizational_member_default_admin_role`
3739

3840
3. Provide a member **account ID for Sysdig Secure for Cloud workload** to be deployed.
3941
Our recommendation is for this account to be empty, so that deployed resources are not mixed up with your workload.
@@ -49,27 +51,26 @@ Minimum requirements:
4951
5052
## Role Summary
5153
52-
Permission requirement for this example comes as follows
54+
Role usage for this example comes as follows. Check [permissions](../../README.md#required-permissions) too
5355
5456
- **management account**
5557
- terraform aws provider: default
5658
- `SysdigSecureForCloudRole` will be created
57-
- used by Sysdig to subscribe to cloudtrail events
58-
- used by Sysdig to be able to jump to several member accounts to pull ECR hosted images through the `OrganizationAccountAccessRole` role
59-
- assumming previous role will also enable the access of cloudtrail s3 buckets when they are in a different region than were the terraform module is deployed
60-
59+
- used by Sysdig to subscribe to cloudtrail events
60+
- used by Sysdig, for image scanning feature, to `assumeRole` on `OrganizationAccountAccessRole` to be able to fetch image data from ECS Tasks and scan ECR hosted images
61+
<!-- - assuming previous role will also enable the access of cloudtrail s3 buckets when they are in a different region than were the terraform module is deployed -->
6162
- `SysdigCloudBench` role will be created for SecurityAudit read-only purpose, used by Sysdig to benchmark
6263
6364
- **member accounts**
6465
- terraform aws provider: 'member' aliased
65-
- this provider can be configured as desired, we just provide a default option
66+
- this provider can be configured as desired, we just provide a default option
6667
- by default, we suggest using an assumeRole to the [AWS created default role `OrganizationAccountAccessRole`](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_access.html)
67-
- if this role does not exist provide input var `organizational_member_default_admin_role` with the role
68+
- if this role does not exist provide input var `organizational_member_default_admin_role` with the role
6869
- `SysdigCloudBench` role will be created for SecurityAudit read-only purpose, used by Sysdig to benchmark
6970
7071
- **sysdig workload member account**
71-
- if ECS workload is deployed, `ECSTaskRole` will be used to define its permissions
72-
- used by Sysdig to assumeRole on management account `SysdigSecureForCloudRole` and other organizations `OrganizationAccountAccessRole`
72+
- if ECS workload is deployed, `ECSTaskRole` will be used to define its permissions
73+
- used by Sysdig to assumeRole on management account `SysdigSecureForCloudRole` and other organizations `OrganizationAccountAccessRole`
7374
7475
## Notice
7576

modules/services/cloud-connector-ecs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ A task deployed on an **ECS deployment** will detect events in your infrastructu
8181
| <a name="input_image"></a> [image](#input\_image) | Image of the cloud connector to deploy | `string` | `"quay.io/sysdig/cloud-connector:latest"` | no |
8282
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | whether secure-for-cloud should be deployed in an organizational setup | `bool` | `false` | no |
8383
| <a name="input_name"></a> [name](#input\_name) | Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances | `string` | `"sfc-cloudconnector"` | no |
84-
| <a name="input_organizational_config"></a> [organizational\_config](#input\_organizational\_config) | organizational\_config. following attributes must be given<br><ul><br> <li>`sysdig_secure_for_cloud_role_arn` for cloud-connector assumeRole in order to read cloudtrail s3 events</li><br> <li>`connector_ecs_task_role_name` which has been granted trusted-relationship over the secure\_for\_cloud\_role</li><br> <li>`organizational_role_per_account` is the name of the organizational role deployed by AWS in each account of the organization</li><br></ul> | <pre>object({<br> sysdig_secure_for_cloud_role_arn = string<br> organizational_role_per_account = string<br> connector_ecs_task_role_name = string<br> })</pre> | <pre>{<br> "connector_ecs_task_role_name": null,<br> "organizational_role_per_account": null,<br> "sysdig_secure_for_cloud_role_arn": null<br>}</pre> | no |
84+
| <a name="input_organizational_config"></a> [organizational\_config](#input\_organizational\_config) | organizational\_config. following attributes must be given<br><ul><br> <li>`sysdig_secure_for_cloud_role_arn` for cloud-connector assumeRole in order to read cloudtrail s3 events</li><br> <li>`connector_ecs_task_role_name` which has been granted trusted-relationship over the secure\_for\_cloud\_role</li><br> <li>`organizational_role_per_account` is the name of the organizational role deployed by AWS in each account of the organization. used for image-scanning only</li><br></ul> | <pre>object({<br> sysdig_secure_for_cloud_role_arn = string<br> organizational_role_per_account = string<br> connector_ecs_task_role_name = string<br> })</pre> | <pre>{<br> "connector_ecs_task_role_name": null,<br> "organizational_role_per_account": null,<br> "sysdig_secure_for_cloud_role_arn": null<br>}</pre> | no |
8585
| <a name="input_tags"></a> [tags](#input\_tags) | sysdig secure-for-cloud tags. always include 'product' default tag for resource-group proper functioning | `map(string)` | <pre>{<br> "product": "sysdig-secure-for-cloud"<br>}</pre> | no |
8686
| <a name="input_verify_ssl"></a> [verify\_ssl](#input\_verify\_ssl) | true/false to determine ssl verification for sysdig\_secure\_url | `bool` | `true` | no |
8787

modules/services/cloud-connector-ecs/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ variable "organizational_config" {
7575
<ul>
7676
<li>`sysdig_secure_for_cloud_role_arn` for cloud-connector assumeRole in order to read cloudtrail s3 events</li>
7777
<li>`connector_ecs_task_role_name` which has been granted trusted-relationship over the secure_for_cloud_role</li>
78-
<li>`organizational_role_per_account` is the name of the organizational role deployed by AWS in each account of the organization</li>
78+
<li>`organizational_role_per_account` is the name of the organizational role deployed by AWS in each account of the organization. used for image-scanning only</li>
7979
</ul>
8080
EOT
8181
}

0 commit comments

Comments
 (0)