knowledge-base / article_12391858961171.json
intertwine-expel's picture
Upload 155 files
a6ab323
raw
history blame
18.6 kB
{"title": "AWS CloudTrail: Existing CloudTrail with Control Towersetup for Workbench", "url": "https://support.expel.io/hc/en-us/articles/12391858961171-AWS-CloudTrail-Existing-CloudTrail-with-Control-Towersetup-for-Workbench", "date": "2022-12-22T16:21:16Z", "contents": "This article describes how to connect your existing AWS CloudTrail with AWS\nControl Tower to the Expel Workbench.\n\nIf you're...\n\n|\n\nuse...\n\n|\n\nNotes \n \n---|---|--- \n \nconnecting an existing CloudTrail that includes Control Tower,\n\n|\n\nthis article\n\n|\n\nYou need the following to integrate a Control Tower environment with\nWorkbench.\n\n * An AWS Control Tower with Landing Zone.\n\n * Administrator privileges in the AWS Control Tower management and Log Archive accounts.\n\n \n \nsetting up new AWS CloudTrails\n\n|\n\nthe onboarding wizard\n\n|\n\nYou can also use the manual connection procedure. \n \nconnecting an existing CloudTrail\n\n|\n\nthe existing installation steps\n\n| \n \n#### In this article\n\n * About connecting your device\n\n * Before you start\n\n * About console permissions in your devices\n\n * Permissions description and explanation\n\n * Step 1: Setup ExpelIAM role and policy\n\n * Step 2: Update CloudTrail CMK policy if applicable\n\n * Step 3: Confirm S3 log bucket ACL settings\n\n * Step 4: Setup SNS topic for S3 notifications\n\n * Option 1: Using CloudFormation (recommended)\n\n * Option 2: Manual setup\n\n * Step 5: Setup SQS queue for SNS notification\n\n * Step 6: Subscribe SQS to SNS topic\n\n * Step 7: Setup KMS encryption for SNS and SQS\n\n * Step 8: Enable S3 event notifications to SNS topic\n\n * Step 9: Grant ExpelIAM Role necessary access\n\n * Step 10: Complete Workbench setup\n\n## About connecting your device\n\nConnecting your device to Workbench allows Workbench to ingest the logs. AWS\nlogs include a great deal of information that can take hours to manually\nreview. And not all AWS alerts need attention.\n\nExpel collects data through direct API integrations with the AWS platform.\nExpel supports authentication with an IAM Role (recommended) or IAM User with\na set of read-only permissions. To collect data, Expel communicates directly\nwith AWS APIs (like AWS GuardDuty and Inspector) and pulls in CloudTrail data\nfrom S3.\n\nExpel processes all product alerts with a library of Expel created rules\nfocused on the MITRE attack framework. This makes it possible for a product\nalert that wouldn't be reviewed to be elevated to an Expel alert.\n\n## Before you start\n\n**This process requires you to download the attachment, found at the end of\nthis article. The attachment includes the code blocks you need to complete\nthis process.**\n\n### Note\n\nThis article assumes the default service control policies are in play. If you\nrun into any issues during setup, contact your engagement manager for help.\n\n## About console permissions in your devices\n\nAs you connect your devices to Workbench, you provide Workbench access to\nthose devices through permissions in the devices. These permissions vary from\n1 device technology to another, but we typically need at least Read access to\nyour devices to pull in any logs from those devices into Workbench.\n\nWithout minimum permissions to your devices, the SOC analysts are limited in\ntheir insight into your technology. This can mean they surface more benign\nalerts to your team for further investigation, resulting in increasing the\nworkload for your team, and resulting in alert fatigue.\n\nIf you grant Read access to your devices, we can investigate the device and\nthe logs more deeply and surface relevant alerts to you in Workbench. Allowing\nExpel visibility into the console of your security devices helps our SOC\nanalysts make better decisions on whether an alert is benign or malicious. It\nalso allows our SOC analysts to perform health checks to make sure Workbench\nis not missing alerts from your security devices. Depending on what your\norganization purchased from Expel, the SOC analysts may even be able to\ncontain and/or remediate the issues on your behalf.\n\nUltimately, the more permissions you can grant Workbench, the better and\nfaster the SOC analysts can find and investigate alerts in your environment.\n\n### Permissions description and explanation\n\nExpel requires these permissions when connecting to AWS CloudTrail. These\npermissions are set to **Read** , except as shown below.\n\n**This permission...**\n\n|\n\n**does this...**\n\n|\n\n**Notes** \n \n---|---|--- \n \nec2:DescribeRegions\n\n|\n\nDynamically list all enabled regions for a customer account\n\n| \n \nec2:DescribeInstances\n\n|\n\nCloud investigative actions and inventory\n\n|\n\nAllows SOC analysts to triage issues and get additional content for the\nenvironment. \n \nec2:DescribeSecurityGroups \n \niam:List* \n \niam:Get* \n \nlambda:GetFunction \n \nrds:DescribeDBInstances \n \nrds:ListTagsForResource \n \neks:DescribeCluster \n \neks:ListClusters \n \necs:ListContainerInstances \n \necs:DescribeContainerInstances \n \necs:DescribeClusters \n \necs:ListClusters \n \ns3:GetBucketNotification \n \ns3:GetEncryptionConfiguration \n \ncloudtrail:GetTrail \n \ncloudtrail:DescribeTrails \n \ncloudtrail:GetTrailStatus \n \ncloudtrail:ListTrails \n \norganizations:ListAccounts\n\n|\n\nEnumerate accounts in an org\n\n| \n \nsqs:DeleteMessage\n\n|\n\nRemove Processed messages from the queue\n\n|\n\nRequires **Write** permission. \n \nsqs:ReceiveMessage\n\n|\n\nRead messages\n\n| \n \ns3:GetObject\n\n|\n\nDownload cloudtrail log files\n\n| \n \nec2:DescribeVolumes\n\n|\n\nCloud investigative actions and inventory\n\n|\n\nAllows SOC analysts to triage issues and get additional content for the\nenvironment. \n \necs:DescribeTaskDefinition\n\n|\n\nInventory\n\n| \n \necs:ListTaskDefinitions \n \nconfig:ListDiscoveredResources \n \nconfig:GetDiscoveredResourceCounts \n \nlambda:ListFunctions\n\n|\n\nCloud investigative actions and inventory\n\n|\n\nAllows SOC analysts to triage issues and get additional content for the\nenvironment. \n \nlightsail:GetInstances \n \nlightsail:GetRegions \n \ns3:ListAllMyBuckets \n \nkms:Decrypt\n\n|\n\nDecrypt S3 buckets\n\n| \n \norganizations:DescribeOrganization\n\n|\n\nOrganization information\n\n|\n\nRetrieves information about the organization the user's account belongs to. \n \n## Step 1: Setup ExpelIAM role and policy\n\nIn this step we create a permissions policy to assign to the IAM Role.\n\n### Important\n\nFor AWS Control Tower the primary Expel role is created within the\norganization’s Log Archive account where the CloudTrail S3 Log Bucket exists.\n\nThe role and policy must be replicated across all the other accounts in the\norganization to allow Expel to perform investigative actions within your AWS\nenvironment. The policy replicated to the other non-Log Archive sub-accounts\ncan be modified to exclude the policy elements providing access permissions to\nthe S3 resources if necessary.\n\n 1. Create IAM Role and Policy in management account.\n\n * Navigate to the CloudFormation > Stacks service portal.\n\n * Click Create Stack (with new resources) and select Upload a template file as the source.\n\n * Upload a json file containing the stack template. You can find that code in the attachment for this article in the Step 1 area.\n\n * Provide a relevant name to the stack, such as ExpelIAMStack.\n\n * In the WorkbenchExternalID parameter field, type in your Workbench GUID, then click Next.\n\n### Note\n\nYou can find this GUID by logging into Workbench and then navigating to\nhttps://workbench.expel.io/settings/organizations. The redirected URL contains\nthe value to be used for this parameter.\n\n![image4.jpg](https://support.expel.io/hc/article_attachments/12391877518227/uuid-a9d74a89-4757-81b0-a78f-a5d899eb69f9.jpg) \n--- \n \n * You can leave all defaults for configuring the stack options and click Next.\n\n * Verify the stack details, then check the acknowledgement and click Submit.\n\n * The new IAM role and attached policy should exist for Expel within the management account on completion of the stack.\n\n 2. Create IAM Role and Policy in all sub accounts.\n\n * Navigate to the CloudFormation > Stacksets service portal.\n\n * Click Create StackSet and select Upload a template file as the source.\n\n * Follow the same process to fill out the stackset details as was done in deploying the stack above (Step 1.1).\n\n## Step 2: Update CloudTrail CMK policy if applicable\n\n### Note\n\nYou can skip this step if your CloudTrail is not configured to encrypt the S3\nlogs using CMK. Otherwise, we need to update the key policy to provide\nWorkbench with the kms:Decrypt permission so that we can properly get objects\nfrom the S3 bucket containing the CloudTrail logs.\n\nYou can determine if this step applies to you by navigating to Services >\nCloudTrail > Trails and then selecting the trail created by Control Tower in\nyour management account. In the General details section you see a value under\nLog file SSE-KMS encryption and an associated AWS KMS key populated as well.\n\n 1. Navigate to the CMK key used to encrypt the CloudTrail logs.\n\n * You can find the specific key arn by looking for AWS KMS Key in the General details section of the CloudTrail.\n\n 2. Select the Key policy tab and then click Edit to change it.\n\n 3. Add the decrypt permission to the existing list of policy statements. You can find that code in the attachment for this article in the Step 2 area.\n\n### Note\n\nMake sure to update the principal value with the correct arn path to the Expel\nRole created in the Log Archive account as a result of Step 1.2 via the\nStackSet.\n\n 4. Click Save changes.\n\n### Important\n\nThe following steps (Steps 3 - 8) must be performed from within your AWS\nControl Tower Log Archive account. See the AWSdocumentation for any\nclarification on what that is.\n\n## Step 3: Confirm S3 log bucket ACL settings\n\n### Note\n\nAmazon S3 access control lists allow you to manage access to buckets and any\nobjects contained within. We want to confirm that the S3 bucket created in\nyour log archive account allows the bucket owner (Log Archive) and Expel by\nextension through the deployed role read permissions for the objects within.\n\n 1. Navigate to Services > S3 > Buckets > [Your S3 Log Bucket] (usually follows the naming scheme “aws-controltower-logs-”.\n\n 2. Select the Permissions tab, then look at the Object Ownership section to confirm the current ACL setting.\n\n 3. If you keep ACLs enabled on the bucket then confirm the current Object Ownership is set to Bucket owner preferred.\n\n### Important\n\nAWS recommends that you disable ACLs on S3 for a majority of modern use-cases\nwhich then delegate ownership to the bucket owner account (source).\n\n## Step 4: Setup SNS topic for S3 notifications\n\n### Option 1: Using CloudFormation (recommended)\n\n### Important\n\nIf you choose this option, then you can skip to Step 8 when you’re done.\n\n 1. Navigate to Services > CloudFormation > Stacks and click Create stack (with new resources).\n\n 2. In the Specify template section select Upload a template file. Then upload a json file containing the stack template. Then click Next. You can find that code in the attachment for this article in the Step 4, Option 1 area.\n\n 3. Fill in a name for the stack.\n\n 4. Fill in the following required parameters.\n\n * S3LogBucketARN: the ARN associated with the S3 Bucket in your Log Archive account that retains the CloudTrail logs.\n\n * CloudTrailKeyARN: the ARN for the customer-managed kms key configured on your CloudTrail (in your management account).\n\n 5. Proceed through the rest of the wizard keeping the defaults, then click Submit to initiate the stack.\n\n 6. After the stack creation completes, make note of all values returned in the Outputs tab of the stack console. You need these returned values to complete setup in Workbench.\n\n * RoleARN: the IAM Role created in the log archive account needed to complete setup in Workbench.\n\n * SqsURL: the SQS url path needed to complete setup of in Workbench.\n\n### Important\n\nYou can now skip directly to Step 8.\n\n#### Option 2: Manual setup\n\n### Caution\n\nMake sure to create the SNS topic in the same region as the S3 bucket\nCloudTrail events are being sent to!\n\n 1. Navigate to Services > Simple Notification Service > Topics and click Create Topic.\n\n 2. On the next screen, select Standard as the Type and create a Topic Name.\n\n 3. Under Access Policy, select Advanced.\n\nIn the JSON editor, paste the below policy substituting the YOUR_TOPIC_ARN and\nYOUR_S3_ARN fields with your values. This policy allows S3 to publish\nnotifications to the topic for your CloudTrail bucket. You can find that code\nin the attachment for this article in the Step 4, Option 2 area.\n\n 4. Click Create Topic.\n\n## Step 5: Setup SQS queue for SNS notification\n\nIn this step, we create a new SQS queue for S3 notifications. Workbench polls\nnotifications from this queue to know when new CloudTrail data is added.\n\n### Caution\n\nMake sure you create the SQS queue in the same region as the SNS topic and S3\nbucket!\n\n 1. Navigate to Services > Simple Queue Service > Queues and click Create queue.\n\n 2. On the next screen, select Standard Queue and name the new queue.\n\n * Visibility timeout: 30 Seconds.\n\n * Message retention period: 7 days.\n\n * Delivery delay: 0 Seconds.\n\n * Maximum message size: 256 KB.\n\n * Receive message wait time: 0 Seconds.\n\n 3. Under Access Policy, select Advanced.\n\n 4. In the JSON editor, paste the policy substituting the YOUR_SQS_QUEUE_ARN and YOUR_SNS_TOPIC_ARN fields with your values. You can find that code in the attachment for this article in the Step 5 area.\n\n## Step 6: Subscribe SQS to SNS topic\n\nNow that we created an SNS topic and SQS queue, we need to configure SNS to\nsend events to the SQS queue.\n\n 1. Navigate to Services > Simple Notification Service > Subscriptions and click Create subscription.\n\n 2. On the next screen, configure the required fields to complete the subscription.\n\nField\n\n|\n\nValue \n \n---|--- \n \nTopic ARN\n\n|\n\nYour SNS Topic ARN \n \nProtocol\n\n|\n\nSelect Amazon SQS \n \nEndpoint\n\n|\n\nYour SNS Queue ARN \n \nEnable raw message delivery\n\n|\n\n### Important\n\nSelecting enable raw message delivery makes sure SNS doesn’t add extra\nmetadata headers to the message when it sends to SQS. Make sure you select\nthis! \n \n 3. Click Create subscription to finish this step.\n\n## Step 7: Setup KMS encryption for SNS and SQS\n\n 1. Navigate to Services > Key Management Service (KMS) > Customer managed keys and click Create Key.\n\n 2. Retain the default configuration values as shown below, then click Next.\n\n 3. Fill in values for the alias and description for the key, then click Next.\n\n 4. Select any additional key administrators for the new key, then click Next until you get to the Review page.\n\n 5. Look for the Key policy generated for this key in the Review page and add the policies to the statement list to give S3 & SNS the right perms they need to decrypt with this key. You can find that code in the attachment for this article in the Step 7 area.\n\n 6. Click Finish to complete the creation of the new key.\n\n 7. Enable Encryption on the SNS topic you created in Step 3 using the new key.\n\n * Navigate to Services > Simple Notification Service > Topics > YourTopic.\n\n * Click Edit, then click Encryption on.\n\n * In the Customer master key (CMK) selection, click the KMS key you created above.\n\n * Click Save changes.\n\n 8. Enable Encryption on the SQS topic you created in Step 4 using the new key.\n\n * Navigate to Services > Simple Queue Service > Queues > YourQueue.\n\n * Click Edit, then toggle the Encryption option on.\n\n * Set the Server-side encryption option to Enabled.\n\n * Set the Encryption key type to SSE-KMS.\n\n * In the Customer master key selection, click the KMS key you created above.\n\n * Click Save.\n\n## Step 8: Enable S3 event notifications to SNS topic\n\nIn this step, we configure the CloudTrail S3 bucket to send SNS notifications\nwhen CloudTrail adds logs to the bucket.\n\n 1. Navigate to Services > S3 > Your S3 CloudTrail Bucket.\n\n 2. Open Properties for your S3 bucket and navigate to Event notifications. Click Create event notification.\n\n 3. On the next screen:\n\n * Create a name for your notification rule.\n\n * Select All object create events from the Event types section.\n\n * Select SNS topic from the Destination section.\n\n * Select your SNS topic created in Step 3.\n\n 4. Click Save changes.\n\n## Step 9: Grant ExpelIAM Role necessary access\n\n### Tip\n\nSkip this step if you onboarded the Expel resources with CloudFormation using\nStep 4, Option 1. You can go to Step 10.\n\nAt this point we configured S3 notifications → SNS topic → SQS queue. The\nfinal step involves granting the existing ExpelIAM Role the necessary access\nto poll events from the SQS queue and the S3 bucket.\n\n 1. Navigate to Services > IAM > Roles.\n\n 2. Create and add a new inline policy to the Expel Role that was propagated to the Log Archive account as part of Step 1.\n\n### Tip\n\nName it ExpelAssumeRole if you used the provided StackSet template. The policy\ngrants the permissions. You can find that code in the attachment for this\narticle in the Step 9 area.\n\n## Step 10: Complete Workbench setup\n\nCongratulations! You configured S3 notifications to an SQS queue through SNS.\nGo through Step 8: Register AWS in Workbench of the AWS CloudTrail: New\nCloudTrail setup for Workbench complete setup to register the integration in\nWorkbench. Make sure to select Manual Connection for the connection type.\n\nYou require the following details to complete this step:\n\n * Role ARN: Expel Role ARN created in Step 1 specific to the Log Archive account.\n\n * SQS URL: the full URL path of the SQS created in Step 4.\n\n * Organization Management Account: the account ID of your AWS organization’s management account.\n\n### Tip\n\nThis article was accurate at the time of writing, but changes happen. If you\nfind the instructions are outdated, leave a description in the comment field\nbelow and let us know!\n\n"}