This article describes how to connect your new AWS CloudTrail to the Expel Workbench.
If you're... |
use this... |
Notes |
---|---|---|
setting up new AWS CloudTrails |
this article |
To set up your device, you need:
|
connecting an existing CloudTrail |
||
connecting an existing CloudTrail that includes Control Tower |
Connecting your device to Workbench allows Workbench to ingest the logs. AWS logs include a great deal of information that can take hours to manually review. And not all AWS alerts need attention.
Expel collects data through direct API integrations with the AWS platform. Expel supports authentication with an IAM Role (recommended) or IAM User with a set of read-only permissions. To collect data, Expel communicates directly with AWS APIs (like AWS GuardDuty and Inspector) and pulls in CloudTrail data from S3.
Expel processes all product alerts with a library of Expel created rules focused on the MITRE attack framework. This makes it possible for a product alert that wouldn't be reviewed to be elevated to an Expel alert.
Server Side Encryption with AWS-KMS
AWS KMS (key management services) allows you to manage cryptographic keys to encrypt/decrypt data at-rest. Many AWS services offer server side encryption (SSE) where the service is responsible for encrypting/decrypting the data on a principal’s (user/service) behalf.
We are encrypting all the data at rest (CloudTrail logs, CloudTrail log bucket and SQS queue messages) using a custom managed AWS key. All the required permissions for the AWS services to encrypt/decrypt data are specified in the key policies. Additionally, the custom role that this integration assumes to monitor your AWS account is attached with a policy to decrypt the CloudTrail log S3 bucket using this key.
Step 1: Configure a global CloudTrail
-
Log in to the AWS console. If you have multiple AWS accounts and use AWS Organizations, log into your primary account.
-
Ensure you are in the region you want to be the Home region for the new CloudTrail. The CloudTrail collects data from all regions, but it is stored in S3 in a specific region. You need to supply this region to Expel Workbench later in this process.
-
Navigate to the CloudTrail service and create a new trail.
-
Select trail attributes.
Important
If you select an existing S3 bucket or KMS key, the integration doesn't work. Contact your engagement manager for help.
-
Name Trail: we recommend GlobalCloudTrail.
-
Select Create new S3 bucket and name bucket.
-
When creating a new trail, make sure that Enable for all accounts in my organization is selected if you are using AWS Organizations.
-
Enable Log file SSE-KMS encryption. Select New and type a KMS alias.
-
Enable Log file validation.
-
(Optional) If you are using SNS, select SNS Topic.
-
-
Leave the CloudWatch Logs and Tags sections blank and click Next.
-
Select log events.
-
Events: only select Management events. Leave the rest cleared.
-
Management events: select Read and Write. Leave Exclude AWS KMS events clear.
-
-
Verify Trail attributes and click Create Trail.
Step 2: Enable SSE-KMS encryption in the log S3 bucket
To enable Server Side Encryption (SSE) in the Trail log bucket, you must edit the configuration of the trail log bucket.
-
Navigate to S3 and select the S3 trail log bucket created in Step 1. Select the Properties tab and Edit the Default Encryption section.
-
Edit the Default Encryption as follows:
-
Enable Server Side Encryption.
-
For Key Type, select AWS Key Management Service key (SSE-KMS).
-
For AWS KMS key, select Choose from your AWS KMS keys.
-
Type the key alias given in Step 1 and select it.
-
(Optional) Enable Bucket Key.
-
Note the Bucket ARN.
-
Step 3: Create an SQS queue to receive S3 notifications
To consume CloudTrail events from the trail’s S3 bucket, Workbench must be notified when new event files are added to the S3 bucket. In this step, we create an SQS queue for these notifications.
Note
The SQS queue must be in the same account and region as the S3 bucket created in Step 1.
-
Navigate to Simple Queue Service. If this is the first SQS queue you created, click Get Started Now. If you already defined other SQS queues, click Create New Queue.
-
Create queue.
-
Details: Queue Name is filled in as ExpelMasterCloudTrailNotify. Select Standard Queue.
-
Configuration:
-
Visibility timeout: 30 Seconds.
-
Message retention period: 7 days.
-
Delivery delay: 0 Seconds.
-
Maximum message size: 256 KB.
-
Receive message wait time: 0 Seconds.
-
-
-
Access policy:
-
Select Advanced, change the Resource and aws:SourceArn sections of the following JSON then copy and paste to the text box.
Note
Your SQS ARN is populated after you switch to the Advanced tab.
{ "Version": "2012-10-17", "Id": "__default_policy_ID", "Statement": [ { "Sid": "__owner_statement", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "SQS:SendMessage", "Resource": "<your_sqs_queue_arn>", "Condition": { "ArnLike": { "aws:SourceArn": "<your_S3_bucket_arn>" } } } ] }
-
-
Enable Server Side Encryption and select AWS Key Management Service key (SSE-KMS) for Encryption key type. Type the key alias created in Step 1 and select the key.
-
Click Create Queue.
Step 4: Add key policies
Note
You must add this key policy to configure the S3 event notifications in the following step.
To enable trail log bucket to encrypt messages that are being sent to the SQS queue, you need to add key policies.
Navigate to the KMS key created in Step 1.
-
Click Edit on the Key policy tab.
-
Copy the following JSON key policy snippet and append it to the end of the existing key policies.
, { "Sid": "Allow cloudtrail bucket to encrypt/decrypt SQS", "Effect": "Allow", "Principal": { "Service": "s3.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*", "Condition": { "StringLike": { "aws:SourceArn": "<your_S3_bucket_arn>" } } }
-
Save the key policy and note the KMS ARN.
Step 5: Configure S3 notifications
-
Navigate to the S3 bucket containing your CloudTrail logs created in Step 1.
-
Navigate to Properties.
-
Select Create event notifications.
-
General configuration:
-
Event name: ExpelNotifyQueue.
-
Select All object create events under Event Types.
-
-
Destination:
-
Select SQS Queue under Destination.
-
Select Choose from your SQS queues and select the queue you created from the list. If you don't see your queue, you can select Enter SQS queue ARN and type the queue ARN in the field.
-
-
Save your changes.
Step 6: Create AWSIAM policy
In this step we create a permissions policy to assign to the IAM Role.
Important
If you use AWS organizations, the primary Expel role resides in the organization’s primary account where the CloudTrail, S3, and SQS queue were created for the integration.
The role and policy must be replicated across all the other accounts in the organization to perform AWS investigative actions. The policy in the sub-accounts can be changed to exclude the SQS and S3 resources.
-
Create AWSIAM Policy.
-
Navigate to the IAM service.
-
Go to Policies and click Create Policy.
-
Select the JSON tab and add the following permissions on the JSON tab:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "ec2:DescribeInstances", "ec2:DescribeRegions", "ec2:DescribeSecurityGroups", "iam:List*", "iam:Get*", "rds:DescribeDBInstances", "rds:ListTagsForResource", "organizations:ListAccounts", "ec2:DescribeVolumes", "ecs:DescribeTaskDefinition", "ecs:ListTaskDefinitions", "lambda:GetFunction", "lambda:ListFunctions", "lightsail:GetInstances", "lightsail:GetRegions", "s3:ListAllMyBuckets", "s3:GetBucketNotification", "s3:GetEncryptionConfiguration", "cloudtrail:GetTrailStatus", "cloudtrail:DescribeTrails", "cloudtrail:GetTrail", "cloudtrail:ListTrails", "config:ListDiscoveredResources", "config:GetDiscoveredResourceCounts", "eks:DescribeCluster", "eks:ListClusters", "ecs:ListContainerInstances", "ecs:DescribeContainerInstances", "ecs:DescribeClusters", "ecs:ListClusters", "organizations:DescribeOrganization" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "sqs:DeleteMessage", "sqs:ReceiveMessage" ], "Resource": "<YOUR_SQS_ARN>" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "<YOUR_S3_ARN>/*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "<YOUR_KMS_KEY_ARN>" } ] }
-
Tip
There should be “/*” at the end of your S3 ARN in the Resource section. This allows the role to access all of the sub-folders in your bucket.
-
Review and name the policy ExpelAPIPolicy.
Step 7: Create role
-
From within the IAM service, navigate to Roles and click Create Role.
-
Select Another AWS account and fill out the required fields.
-
Account ID: 012205512454 (the Expel AWS account ID).
-
External ID: this unique identifier is assigned to you by Expel. You can find it in your browser URL after navigating to Settings > My Organization in Workbench.
-
-
Attach the IAM policy from Step 1: Configure a global CloudTrail to the Role.
-
Skip Add Tags.
-
Review: Name the role ExpelServiceRole and create the Role.
Important
All accounts roles must have the same name for the integration to work.
-
Navigate to the role you just created and copy and save the following information:
-
Role ARN.
-
External ID Value on the Trust relationships tab.
-
Step 8: Register AWS in Workbench
Note
Expel secures all login information our SOC analysts need about your devices in a MFA password product. Access to this login information is protected using our internal MFA processes. To learn more about the IP addresses all Expel traffic comes from, go here.
-
Login to https://workbench.expel.io/settings/security-devices?setupIntegration=aws.
-
Answer the questions, being sure to answer No to the second question, and then click Start.
-
Fill out the following fields:
-
Role ARN: the Role ARN.
-
Role session name: use a unique name to identify the use of the role.
Note
External ID is automatically populated.
-
Region: the AWS region containing the trail S3 and SQS.
-
SQS URL: Queue URL.
-
Comments
2 comments
Hi, I'd like to ask. in the Wizard vs. Manual onboarding section it states "If you want to connect an existing CloudTrail, please continue reading through this guide."
However, when you read the steps in "Manual onboarding for existing AWS CloudTrails" at "Step 1: Configure a global CloudTrail". The step 4 say "Select trail attributes. Note: If you select an existing S3 bucket or KMS key, the integration will not work. Contact your Engagement Manager for assistance."
When using Control Tower, it creates a Trail and S3 bucket for you. I was wondering if you could just plug the notification on the existing bucket. Assuming you assume a role in the client AWS account I would think that using the AWS managed KMS key shouldn't be a problem either. What do you think?
Hi David, thank you for the question! Someone from your account team will be reaching out to assist you. We've seen an increase in Control Tower-related questions, and realize the guide may be causing some confusion as a result. We're working to improve both the “manual” and wizard way of onboarding to account for Control Tower, but we can't comment on timing just yet. If you want to speak to someone on our Product team, let your account team know. We'd be happy to get more customer feedback!
Please sign in to leave a comment.