|
| 1 | +# Sysdig Secure for Cloud in AWS<br/>:: Organizational, threat-detection with pre-existing resources (EKS + cloudtrail through S3-SNS-SQS events) |
| 2 | + |
| 3 | + |
| 4 | +- Sysdig **Helm** chart will be used to deploy threat-detection |
| 5 | + - [Cloud-Connector Chart](https://charts.sysdig.com/charts/cloud-connector/) |
| 6 | + - This charts requires specific AWS credentials to be passed by parameter (accessKeyId and secretAccessKey) |
| 7 | +- An existing cloudtrail is used, but instead of sending events directly to an SNS topic (disabled), we will make use of a topic (SQS) |
| 8 | + which will be subscribed to the multiple possible SNS topics listening to the cloudtrail-S3 bucket changes. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +All the required resources and workloads will be run under the same AWS account, held in a member-account of the organization. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +Minimum requirements: |
| 17 | + |
| 18 | +1. **AWS** profile credentials configured within yor `aws` provider |
| 19 | +2. A **Kubernetes** cluster configured within your `helm` provider |
| 20 | +3. **Sysdig** Secure API token , as input variable value |
| 21 | + ``` |
| 22 | + sysdig_secure_api_token=<SECURE_API_TOKEN> |
| 23 | + ``` |
| 24 | +4. S3 event-notification subscribed SNS topic(s).<br/>see `modules/infrastructure/cloudtrail_s3-sns-sqs` for guidance<br/><br/> |
| 25 | +5. **SQS topic** subscribed to the S3-SNS event notifications.<br/>The ARN of this SQS will be used as an input parameter to the module.<br/> |
| 26 | + see `modules/infrastructure/sqs-sns-subscription` for guidance`<br/><br/> |
| 27 | +6. If the module is to be deployed on an AWS Organization **member account** which is not the same where the Cloudtrail-S3 events are located, |
| 28 | + the `organization_managed_role_arn` input variable must be used<br/> |
| 29 | + This will provide the **ARN of a role** that `cloud-connector` module will use to fetch the events from the S3 bucket.<br/> |
| 30 | + see `modules/infrastructure/permissions/eks-org-role` for guidance`<br/><br/> |
| 31 | +
|
| 32 | +## Usage |
| 33 | +
|
| 34 | +For quick testing, use this snippet on your terraform files. |
| 35 | +
|
| 36 | +```terraform |
| 37 | +provider "aws" { |
| 38 | + region = var.region |
| 39 | + ... |
| 40 | +} |
| 41 | +
|
| 42 | +provider "helm" { |
| 43 | + ... |
| 44 | +} |
| 45 | +
|
| 46 | +module "org_k8s_threat_reuse_cloudtrail" { |
| 47 | + source = "sysdiglabs/secure-for-cloud/aws//examples-internal/organizational-k8s-threat-reuse_cloudtrail" |
| 48 | +
|
| 49 | + sysdig_secure_api_token = "00000000-1111-2222-3333-444444444444" |
| 50 | +
|
| 51 | + region = "CLOUDTRAIL_SNS_SQS_REGION" |
| 52 | + cloudtrail_s3_sns_sqs_url = "SQS-URL" |
| 53 | + organization_managed_role_arn = "ARN_ROLE_FOR_MEMBER_ACCOUNT_PERMISSIONS" |
| 54 | +
|
| 55 | + aws_access_key_id = "AWS_ACCESSK_KEY" |
| 56 | + aws_secret_access_key = "AWS_SECRET_ACCESS_KEY" |
| 57 | +} |
| 58 | +
|
| 59 | +``` |
| 60 | + |
| 61 | +See [inputs summary](#inputs) or module module [`variables.tf`](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/blob/master/examples-internal/organizational-k8s-threat-reuse_cloudtrail/variables.tf) file for more optional configuration. |
| 62 | + |
| 63 | +To run this example you need have your [aws account profile configured in CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) and to execute: |
| 64 | +```terraform |
| 65 | +$ terraform init |
| 66 | +$ terraform plan |
| 67 | +$ terraform apply |
| 68 | +``` |
| 69 | + |
| 70 | +Notice that: |
| 71 | +* This example will create resources that cost money.<br/>Run `terraform destroy` when you don't need them anymore |
| 72 | +* All created resources will be created within the tags `product:sysdig-secure-for-cloud`, within the resource-group `sysdig-secure-for-cloud` |
| 73 | + |
| 74 | +<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 75 | +## Requirements |
| 76 | + |
| 77 | +| Name | Version | |
| 78 | +|------|---------| |
| 79 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.15.0 | |
| 80 | +| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.50.0 | |
| 81 | +| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >=2.3.0 | |
| 82 | + |
| 83 | +## Providers |
| 84 | + |
| 85 | +| Name | Version | |
| 86 | +|------|---------| |
| 87 | +| <a name="provider_helm"></a> [helm](#provider\_helm) | >=2.3.0 | |
| 88 | + |
| 89 | +## Modules |
| 90 | + |
| 91 | +| Name | Source | Version | |
| 92 | +|------|--------|---------| |
| 93 | +| <a name="module_resource_group"></a> [resource\_group](#module\_resource\_group) | ../../modules/infrastructure/resource-group | | |
| 94 | +| <a name="module_ssm"></a> [ssm](#module\_ssm) | ../../modules/infrastructure/ssm | | |
| 95 | + |
| 96 | +## Resources |
| 97 | + |
| 98 | +| Name | Type | |
| 99 | +|------|------| |
| 100 | +| [helm_release.cloud_connector](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | |
| 101 | + |
| 102 | +## Inputs |
| 103 | + |
| 104 | +| Name | Description | Type | Default | Required | |
| 105 | +|------|-------------|------|---------|:--------:| |
| 106 | +| <a name="input_aws_access_key_id"></a> [aws\_access\_key\_id](#input\_aws\_access\_key\_id) | cloud-connector. aws credentials in order to access required aws resources. aws.accessKeyId | `string` | n/a | yes | |
| 107 | +| <a name="input_aws_secret_access_key"></a> [aws\_secret\_access\_key](#input\_aws\_secret\_access\_key) | cloud-connector. aws credentials in order to access required aws resources. aws.secretAccessKey | `string` | n/a | yes | |
| 108 | +| <a name="input_cloudtrail_s3_sns_sqs_url"></a> [cloudtrail\_s3\_sns\_sqs\_url](#input\_cloudtrail\_s3\_sns\_sqs\_url) | Organization cloudtrail event notification S3-SNS-SQS URL to listen to | `string` | n/a | yes | |
| 109 | +| <a name="input_sysdig_secure_api_token"></a> [sysdig\_secure\_api\_token](#input\_sysdig\_secure\_api\_token) | Sysdig Secure API token | `string` | n/a | yes | |
| 110 | +| <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"` | no | |
| 111 | +| <a name="input_organization_managed_role_arn"></a> [organization\_managed\_role\_arn](#input\_organization\_managed\_role\_arn) | `sysdig_secure_for_cloud_role_arn` for cloud-connector assumeRole in order to read cloudtrail s3 events</li><li>and the `connector_ecs_task_role_name` which has been granted trusted-relationship over the secure\_for\_cloud\_role | `string` | `"none"` | no | |
| 112 | +| <a name="input_region"></a> [region](#input\_region) | Default region for resource creation in both organization master and secure-for-cloud member account | `string` | `"eu-central-1"` | no | |
| 113 | +| <a name="input_sysdig_secure_endpoint"></a> [sysdig\_secure\_endpoint](#input\_sysdig\_secure\_endpoint) | Sysdig Secure API endpoint | `string` | `"https://secure.sysdig.com"` | no | |
| 114 | +| <a name="input_tags"></a> [tags](#input\_tags) | sysdig secure-for-cloud tags | `map(string)` | <pre>{<br> "product": "sysdig-secure-for-cloud"<br>}</pre> | no | |
| 115 | + |
| 116 | +## Outputs |
| 117 | + |
| 118 | +No outputs. |
| 119 | +<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 120 | + |
| 121 | + |
| 122 | +## Troubleshooting |
| 123 | + |
| 124 | +- Q1: When I deploy it, cloud-connector gives an error saying `api error AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version` |
| 125 | + S1: make use of the `var.region` to specify where the resources are on the organzation managed account (sqs) |
| 126 | + |
| 127 | +## Authors |
| 128 | + |
| 129 | +Module is maintained and supported by [Sysdig](https://sysdig.com). |
| 130 | + |
| 131 | +## License |
| 132 | + |
| 133 | +Apache 2 Licensed. See LICENSE for full details. |
0 commit comments