|
1 | 1 | ID: aws_cis_v300_3_3 |
2 | 2 | Title: "3.3 Ensure AWS Config is enabled in all regions" |
3 | 3 | Description: "AWS Config is a web service that performs configuration management of supported AWS resources within your account and delivers log files to you. The recorded information includes the configuration item (AWS resource), relationships between configuration items (AWS resources), any configuration changes between resources. It is recommended AWS Config be enabled in all regions." |
| 4 | +IntegrationType: |
| 5 | + - aws_cloud_account |
4 | 6 | Query: |
5 | 7 | Engine: CloudQL-v0.0.1 |
6 | | - QueryToExecute: "-- pgFormatter-ignore\n-- Get count for any region with all matching criteria\nwith global_recorders as (\n select\n count(*) as global_config_recorders\n from\n aws_config_configuration_recorder\n where\n recording_group -> 'IncludeGlobalResourceTypes' = 'true'\n and recording_group -> 'AllSupported' = 'true'\n and status ->> 'Recording' = 'true'\n and status ->> 'LastStatus' = 'SUCCESS'\n)\nselect\n 'arn:aws::' || a.region || ':' || a.account_id as resource,\nr.og_account_id as og_account_id,\nr.og_resource_id as og_resource_id,\n case\n -- When any of the region satisfies with above CTE\n -- In left join of <aws_config_configuration_recorder> table, regions now having\n -- 'Recording' and 'LastStatus' matching criteria can be considered as OK\n when\n g.global_config_recorders >= 1\n and status ->> 'Recording' = 'true'\n and status ->> 'LastStatus' = 'SUCCESS'\n then 'ok'\n -- Skip any regions that are disabled in the account.\n when a.opt_in_status = 'not-opted-in' then 'skip'\n else 'alarm'\n end as status,\n -- Below cases are for citing respective reasons for control state\n case\n when a.opt_in_status = 'not-opted-in' then a.region || ' region is disabled.'\n else\n case\n when recording_group -> 'IncludeGlobalResourceTypes' = 'true' then a.region || ' IncludeGlobalResourceTypes enabled,'\n else a.region || ' IncludeGlobalResourceTypes disabled,'\n end ||\n case\n when recording_group -> 'AllSupported' = 'true' then ' AllSupported enabled,'\n else ' AllSupported disabled,'\n end ||\n case\n when status ->> 'Recording' = 'true' then ' Recording enabled'\n else ' Recording disabled'\n end ||\n case\n when status ->> 'LastStatus' = 'SUCCESS' then ' and LastStatus is SUCCESS.'\n else ' and LastStatus is not SUCCESS.'\n end\n end as reason\n \nfrom\n global_recorders as g,\n aws_region as a\n left join aws_config_configuration_recorder as r on r.account_id = a.account_id and r.region = a.name;" |
| 8 | + QueryToExecute: | |
| 9 | + WITH global_recorders AS ( |
| 10 | + SELECT |
| 11 | + COUNT(*) AS global_config_recorders |
| 12 | + FROM |
| 13 | + aws_config_configuration_recorder |
| 14 | + WHERE |
| 15 | + recording_group -> 'IncludeGlobalResourceTypes' = 'true' |
| 16 | + AND recording_group -> 'AllSupported' = 'true' |
| 17 | + AND status ->> 'Recording' = 'true' |
| 18 | + AND status ->> 'LastStatus' = 'SUCCESS' |
| 19 | + ) |
| 20 | + SELECT |
| 21 | + 'arn:aws::' || a.region || ':' || a.account_id AS resource, |
| 22 | + r.og_account_id AS og_account_id, |
| 23 | + r.og_resource_id AS og_resource_id, |
| 24 | + CASE |
| 25 | + WHEN |
| 26 | + g.global_config_recorders >= 1 |
| 27 | + AND status ->> 'Recording' = 'true' |
| 28 | + AND status ->> 'LastStatus' = 'SUCCESS' |
| 29 | + THEN 'OK' |
| 30 | + WHEN a.opt_in_status = 'not-opted-in' THEN 'SKIP' |
| 31 | + ELSE 'ALARM' |
| 32 | + END AS status, |
| 33 | + CASE |
| 34 | + WHEN a.opt_in_status = 'not-opted-in' THEN a.region || ' region is disabled.' |
| 35 | + ELSE |
| 36 | + CASE |
| 37 | + WHEN recording_group -> 'IncludeGlobalResourceTypes' = 'true' THEN a.region || ' IncludeGlobalResourceTypes enabled,' |
| 38 | + ELSE a.region || ' IncludeGlobalResourceTypes disabled,' |
| 39 | + END || |
| 40 | + CASE |
| 41 | + WHEN recording_group -> 'AllSupported' = 'true' THEN ' AllSupported enabled,' |
| 42 | + ELSE ' AllSupported disabled,' |
| 43 | + END || |
| 44 | + CASE |
| 45 | + WHEN status ->> 'Recording' = 'true' THEN ' Recording enabled' |
| 46 | + ELSE ' Recording disabled' |
| 47 | + END || |
| 48 | + CASE |
| 49 | + WHEN status ->> 'LastStatus' = 'SUCCESS' THEN ' and LastStatus is SUCCESS.' |
| 50 | + ELSE ' and LastStatus is not SUCCESS.' |
| 51 | + END |
| 52 | + END AS reason |
| 53 | + FROM |
| 54 | + global_recorders AS g, |
| 55 | + aws_region AS a |
| 56 | + LEFT JOIN aws_config_configuration_recorder AS r ON r.account_id = a.account_id AND r.region = a.name; |
7 | 57 | PrimaryTable: aws_config_configuration_recorder |
8 | 58 | ListOfTables: |
9 | 59 | - aws_config_configuration_recorder |
10 | 60 | - aws_region |
11 | 61 | Parameters: [] |
12 | | -Severity: low |
13 | 62 | Tags: {} |
14 | | -IntegrationType: |
15 | | - - aws_cloud_account |
| 63 | +Severity: low |
0 commit comments