|
| 1 | +// AWS CIS 1.4.0 Rule equivalent 3.1 |
| 2 | +export default { |
| 3 | + id: 'aws-cis-1.5.0-3.1', |
| 4 | + title: 'AWS CIS 3.1 Ensure CloudTrail is enabled in all regions', |
| 5 | + description: `AWS CloudTrail is a web service that records AWS API calls for your account and delivers |
| 6 | + log files to you. The recorded information includes the identity of the API caller, the time of |
| 7 | + the API call, the source IP address of the API caller, the request parameters, and the |
| 8 | + response elements returned by the AWS service. CloudTrail provides a history of AWS API |
| 9 | + calls for an account, including API calls made via the Management Console, SDKs, command |
| 10 | + line tools, and higher-level AWS services (such as CloudFormation).`, |
| 11 | + audit: `Perform the following to determine if CloudTrail is enabled for all regions: |
| 12 | + Via the management Console |
| 13 | +
|
| 14 | + 1. Sign in to the AWS Management Console and open the CloudTrail console at https://console.aws.amazon.com/cloudtrail |
| 15 | + 2. Click on *Trails* on the left navigation pane |
| 16 | +
|
| 17 | + - You will be presented with a list of trails across all regions |
| 18 | +
|
| 19 | + 3. Ensure at least one Trail has *All* specified in the *Region* column |
| 20 | + 4. Click on a trail via the link in the *Name* column |
| 21 | + 5. Ensure *Logging* is set to *ON* |
| 22 | + 6. Ensure *Apply trail to all regions* is set to *Yes* |
| 23 | + 7. In section *Management Events* ensure *Read/Write Events* set to *ALL* |
| 24 | +
|
| 25 | + Via CLI |
| 26 | +
|
| 27 | + aws cloudtrail describe-trails |
| 28 | +
|
| 29 | + Ensure *IsMultiRegionTrail* is set to *true* |
| 30 | +
|
| 31 | + aws cloudtrail get-trail-status --name <trailname shown in describe-trails> |
| 32 | +
|
| 33 | + Ensure *IsLogging* is set to *true* |
| 34 | +
|
| 35 | + aws cloudtrail get-event-selectors --trail-name <trailname shown in describe-trails> |
| 36 | +
|
| 37 | + Ensure there is at least one Event Selector for a Trail with *IncludeManagementEvents* set to *true* and *ReadWriteType* set to *All*`, |
| 38 | + rationale: `The AWS API call history produced by CloudTrail enables security analysis, resource change tracking, and compliance auditing. Additionally, |
| 39 | +
|
| 40 | + - ensuring that a multi-regions trail exists will ensure that unexpected activity occurring in otherwise unused regions is detected |
| 41 | + - ensuring that a multi-regions trail exists will ensure that Global Service Logging is enabled for a trail by default to capture recording of events generated on AWS global services |
| 42 | + - for a multi-regions trail, ensuring that management events configured for all type of Read/Writes ensures recording of management operations that are performed on all resources in an AWS account`, |
| 43 | + remediation: `Perform the following to enable global (Multi-region) CloudTrail logging: |
| 44 | + Via the management Console |
| 45 | +
|
| 46 | + 1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/cloudtrail |
| 47 | + 2. Click on *Trails* on the left navigation pane |
| 48 | + 3. Click *Get Started Now*, if presented |
| 49 | +
|
| 50 | +
|
| 51 | + - Click *Add new trail* |
| 52 | + - Enter a trail name in the *Trail* name box |
| 53 | + - Set the *Apply trail to all regions* option to Yes |
| 54 | + - Specify an S3 bucket name in the *S3 bucket* box |
| 55 | + - Click *Create* |
| 56 | +
|
| 57 | + 4. If 1 or more trails already exist, select the target trail to enable for global logging |
| 58 | + 5. Click the edit icon (pencil) next to *Apply trail to all regions* , Click *Yes* and Click *Save*. |
| 59 | + 6. Click the edit icon (pencil) next to *Management Events* click All for setting Read/Write Events and Click *Save*. |
| 60 | +
|
| 61 | + Via CLI |
| 62 | +
|
| 63 | + aws cloudtrail create-trail --name <trail_name> --bucket-name <s3_bucket_for_cloudtrail> --is-multi-region-trail |
| 64 | + aws cloudtrail update-trail --name <trail_name> --is-multi-region-trail |
| 65 | +
|
| 66 | + Note: Creating CloudTrail via CLI without providing any overriding options configures *Management Events* to set *All* type of *Read/Writes* by default.`, |
| 67 | + references: [ |
| 68 | + 'CCE-78913-1', |
| 69 | + 'https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-management-events', |
| 70 | + 'https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html?icmpid=docs_cloudtrail_console#logging-management-events', |
| 71 | + 'https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-services.html#cloud-trail-supported-services-data-events', |
| 72 | + ], |
| 73 | + gql: `{ |
| 74 | + queryawsAccount { |
| 75 | + id |
| 76 | + __typename |
| 77 | + cloudtrail { |
| 78 | + isMultiRegionTrail |
| 79 | + status { |
| 80 | + isLogging |
| 81 | + } |
| 82 | + eventSelectors { |
| 83 | + readWriteType |
| 84 | + includeManagementEvents |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + }`, |
| 89 | + resource: 'queryawsAccount[*]', |
| 90 | + severity: 'medium', |
| 91 | + conditions: { |
| 92 | + path: '@.cloudtrail', |
| 93 | + array_any: { |
| 94 | + and: [ |
| 95 | + { |
| 96 | + path: '[*].isMultiRegionTrail', |
| 97 | + equal: 'Yes', |
| 98 | + }, |
| 99 | + { |
| 100 | + path: '[*].status.isLogging', |
| 101 | + equal: true, |
| 102 | + }, |
| 103 | + { |
| 104 | + path: '[*].eventSelectors', |
| 105 | + array_any: { |
| 106 | + and: [ |
| 107 | + { path: '[*].readWriteType', equal: 'All' }, |
| 108 | + { |
| 109 | + path: '[*].includeManagementEvents', |
| 110 | + equal: true, |
| 111 | + }, |
| 112 | + ], |
| 113 | + }, |
| 114 | + }, |
| 115 | + ], |
| 116 | + }, |
| 117 | + }, |
| 118 | +} |
0 commit comments