Skip to content

Commit 335b88a

Browse files
committed
updating controls
1 parent bceee13 commit 335b88a

File tree

2,852 files changed

+85292
-53825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,852 files changed

+85292
-53825
lines changed
Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1+
Description: This control checks if an AWS Web Services (AWS) account has security contact information. The control fails if security contact information is not provided for the account.
12
ID: aws_account_alternate_contact_security_registered
2-
Title: "Security contact information should be provided for an AWS account"
3-
Description: "This control checks if an AWS Web Services (AWS) account has security contact information. The control fails if security contact information is not provided for the account."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
7+
ListOfTables:
8+
- aws_account
9+
- aws_account_alternate_contact
10+
Parameters: []
11+
PrimaryTable: aws_account
612
QueryToExecute: |
7-
with alternate_security_contact as (
8-
select
13+
WITH alternate_security_contact AS (
14+
SELECT
915
name,
1016
account_id
11-
from
17+
FROM
1218
aws_account_alternate_contact
13-
where
19+
WHERE
1420
contact_type = 'SECURITY'
1521
)
16-
select
17-
arn as resource,
18-
og_account_id as og_account_id,
19-
og_resource_id as og_resource_id,
20-
case
21-
when a.partition = 'aws-us-gov' then 'info'
22-
-- Name is a required field if setting a security contact
23-
when c.name is not null then 'ok'
24-
else 'alarm'
25-
end as status,
26-
case
27-
when a.partition = 'aws-us-gov' then a.title || ' in GovCloud, manual verification required.'
28-
when c.name is not null then a.title || ' has security contact ' || c.name || ' registered.'
29-
else a.title || ' security contact not registered.'
30-
end as reason
31-
, a.account_id
32-
from
33-
aws_account as a
34-
left join alternate_security_contact as c on c.account_id = a.account_id;
35-
PrimaryTable: aws_account
36-
ListOfTables:
37-
- aws_account
38-
- aws_account_alternate_contact
39-
Parameters: []
22+
SELECT
23+
arn AS resource,
24+
og_account_id AS og_account_id,
25+
og_resource_id AS og_resource_id,
26+
CASE
27+
WHEN a.partition = 'aws-us-gov' THEN 'info'
28+
WHEN c.name IS NOT NULL THEN 'ok'
29+
ELSE 'alarm'
30+
END AS status,
31+
CASE
32+
WHEN a.partition = 'aws-us-gov' THEN a.title || ' in GovCloud, manual verification required.'
33+
WHEN c.name IS NOT NULL THEN a.title || ' has security contact ' || c.name || ' registered.'
34+
ELSE a.title || ' security contact not registered.'
35+
END AS reason,
36+
a.account_id
37+
FROM
38+
aws_account AS a
39+
LEFT JOIN alternate_security_contact AS c ON c.account_id = a.account_id;
4040
Severity: low
4141
Tags:
4242
category:
@@ -57,5 +57,4 @@ Tags:
5757
- aws
5858
service:
5959
- AWS/IAM
60-
IntegrationType:
61-
- aws_cloud_account
60+
Title: Security contact information should be provided for an AWS account
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1+
Description: Ensure that an AWS account is part of AWS Organizations. The rule is non-compliant if an AWS account is not part of AWS Organizations, or AWS Organizations' master account ID does not match rule parameter MasterAccountId.
12
ID: aws_account_part_of_organizations
2-
Title: "AWS account should be part of AWS Organizations"
3-
Description: "Ensure that an AWS account is part of AWS Organizations. The rule is non-compliant if an AWS account is not part of AWS Organizations or AWS Organizations master account ID does not match rule parameter MasterAccountId."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: |
7-
select
8-
arn as resource,
9-
og_account_id as og_account_id,
10-
og_resource_id as og_resource_id,
11-
case
12-
when organization_id is not null then 'ok'
13-
else 'alarm'
14-
end as status,
15-
case
16-
when organization_id is not null then title || ' is part of organization(s).'
17-
else title || ' is not part of organization.'
18-
end as reason
19-
, region, account_id
20-
from
21-
aws_account;
22-
PrimaryTable: aws_account
237
ListOfTables:
248
- aws_account
259
Parameters: []
10+
PrimaryTable: aws_account
11+
QueryToExecute: |
12+
SELECT
13+
arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN organization_id IS NOT NULL THEN 'ok'
18+
ELSE 'alarm'
19+
END AS status,
20+
CASE
21+
WHEN organization_id IS NOT NULL THEN title || ' is part of organization(s).'
22+
ELSE title || ' is not part of organization.'
23+
END AS reason,
24+
region,
25+
account_id
26+
FROM
27+
aws_account;
2628
Severity: medium
2729
Tags:
2830
category:
@@ -39,5 +41,4 @@ Tags:
3941
- aws
4042
service:
4143
- AWS/IAM
42-
IntegrationType:
43-
- aws_cloud_account
44+
Title: AWS account should be part of AWS Organizations

compliance/controls/aws/aws_acm_certificate_expires_30_days.yaml

100755100644
Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1+
Description: Ensure network integrity is protected by ensuring X509 certificates are issued by AWS ACM.
12
ID: aws_acm_certificate_expires_30_days
2-
Title: "ACM certificates should not expire within 30 days"
3-
Description: "Ensure network integrity is protected by ensuring X509 certificates are issued by AWS ACM."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: "select\n certificate_arn as resource,\n og_account_id as og_account_id,\n og_resource_id as og_resource_id,\n case\n when renewal_eligibility = 'INELIGIBLE' then 'skip'\n when date(not_after) - date(current_date) >= 30 then 'ok'\n else 'alarm'\n end as status,\n case\n when renewal_eligibility = 'INELIGIBLE' then title || ' not eligible for renewal.'\n else title || ' expires ' || to_char(not_after, 'DD-Mon-YYYY') ||\n ' (' || extract(day from not_after - current_date) || ' days).'\n end as reason\n \n , region, account_id\nfrom\n aws_acm_certificate;\n"
7-
PrimaryTable: aws_acm_certificate
87
ListOfTables:
98
- aws_acm_certificate
109
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN renewal_eligibility = 'INELIGIBLE' THEN 'skip'
18+
WHEN DATE(not_after) - DATE(current_date) >= 30 THEN 'ok'
19+
ELSE 'alarm'
20+
END AS status,
21+
CASE
22+
WHEN renewal_eligibility = 'INELIGIBLE' THEN title || ' not eligible for renewal.'
23+
ELSE title || ' expires ' || TO_CHAR(not_after, 'DD-Mon-YYYY') ||
24+
' (' || EXTRACT(DAY FROM not_after - current_date) || ' days).'
25+
END AS reason,
26+
region,
27+
account_id
28+
FROM
29+
aws_acm_certificate;
1130
Severity: high
1231
Tags:
1332
category:
@@ -26,12 +45,12 @@ Tags:
2645
- "true"
2746
hipaa_security_rule_2003:
2847
- "true"
29-
nist_800_171_rev_2:
30-
- "true"
3148
nist_800_53_rev_4:
3249
- "true"
3350
nist_800_53_rev_5:
3451
- "true"
52+
nist_800_171_rev_2:
53+
- "true"
3554
nist_csf:
3655
- "true"
3756
pci_dss_v321:
@@ -44,5 +63,4 @@ Tags:
4463
- AWS/ACM
4564
soc_2:
4665
- "true"
47-
IntegrationType:
48-
- aws_cloud_account
66+
Title: ACM certificates should not expire within 30 days
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1+
Description: This control ensures that ACM certificates are not in failed state.
12
ID: aws_acm_certificate_no_failed_certificate
2-
Title: "Ensure that ACM certificates are not in failed state"
3-
Description: "This control ensures that ACM certificates are not in failed state."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: "select\n certificate_arn as resource,\n og_account_id as og_account_id,\n og_resource_id as og_resource_id,\n case\n when status in ('VALIDATION_TIMED_OUT', 'FAILED') then 'alarm'\n else 'ok'\n end as status,\n title || ' status is ' || status || '.' as reason\n \n \nfrom\n aws_acm_certificate;"
7-
PrimaryTable: aws_acm_certificate
87
ListOfTables:
98
- aws_acm_certificate
109
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN status IN ('VALIDATION_TIMED_OUT', 'FAILED') THEN 'alarm'
18+
ELSE 'ok'
19+
END AS status,
20+
title || ' status is ' || status || '.' AS reason
21+
FROM
22+
aws_acm_certificate;
1123
Severity: low
1224
Tags: {}
13-
IntegrationType:
14-
- aws_cloud_account
25+
Title: Ensure that ACM certificates are not in failed state
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1+
Description: This control ensures that ACM certificates are not in pending validation state. When certificates are not validated within 72 hours after the request is made, those certificates become invalid.
12
ID: aws_acm_certificate_no_pending_validation_certificate
2-
Title: "Ensure that ACM certificates are not in pending validation state"
3-
Description: "This control ensures that ACM certificates are not in pending validation state. When certificates are not validated within 72 hours after the request is made, those certificates become invalid."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: "select\n certificate_arn as resource,\n og_account_id as og_account_id,\n og_resource_id as og_resource_id,\n case\n when status = 'PENDING_VALIDATION' then 'info'\n else 'ok'\n end as status,\n title || ' status is ' || status || '.' as reason\n \n \nfrom\n aws_acm_certificate;"
7-
PrimaryTable: aws_acm_certificate
87
ListOfTables:
98
- aws_acm_certificate
109
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN status = 'PENDING_VALIDATION' THEN 'info'
18+
ELSE 'ok'
19+
END AS status,
20+
title || ' status is ' || status || '.' AS reason
21+
FROM
22+
aws_acm_certificate;
1123
Severity: low
1224
Tags: {}
13-
IntegrationType:
14-
- aws_cloud_account
25+
Title: Ensure that ACM certificates are not in pending validation state
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1+
Description: Ensure that ACM single domain name certificates are used instead of wildcard certificates within your AWS account in order to follow security best practices and protect each domain/subdomain with its own unique private key.
12
ID: aws_acm_certificate_no_wildcard_domain_name
2-
Title: "ACM certificates should not use wildcard certificates"
3-
Description: "Ensure that ACM single domain name certificates are used instead of wildcard certificates within your AWS account in order to follow security best practices and protect each domain/subdomain with its own unique private key."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: |-
7-
select
8-
certificate_arn as resource,
9-
og_account_id as og_account_id,
10-
og_resource_id as og_resource_id,
11-
case
12-
when domain_name like '*%' then 'alarm'
13-
else 'ok'
14-
end as status,
15-
case
16-
when domain_name like '*%' then title || ' uses wildcard domain name.'
17-
else title || ' does not use wildcard domain name.'
18-
end as reason
19-
from
20-
aws_acm_certificate;
21-
PrimaryTable: aws_acm_certificate
227
ListOfTables:
238
- aws_acm_certificate
249
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN domain_name LIKE '*%' THEN 'alarm'
18+
ELSE 'ok'
19+
END AS status,
20+
CASE
21+
WHEN domain_name LIKE '*%' THEN title || ' uses wildcard domain name.'
22+
ELSE title || ' does not use wildcard domain name.'
23+
END AS reason
24+
FROM
25+
aws_acm_certificate;
2526
Severity: low
2627
Tags: {}
27-
IntegrationType:
28-
- aws_cloud_account
28+
Title: ACM certificates should not use wildcard certificates
Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
1+
Description: This control ensures that all expired ACM certificates are removed from AWS account.
12
ID: aws_acm_certificate_not_expired
2-
Title: "Ensure that all the expired ACM certificates are removed"
3-
Description: "This control ensures that all expired ACM certificates are removed from AWS account."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: "select\n certificate_arn as resource,\n og_account_id as og_account_id,\n og_resource_id as og_resource_id,\n case\n when renewal_eligibility = 'INELIGIBLE' then 'skip'\n when date(not_after) < (current_date - interval '1' minute) then 'alarm'\n else 'ok'\n end as status,\n case\n when renewal_eligibility = 'INELIGIBLE' then title || ' not eligible for renewal.'\n when date(not_after) < (current_date - interval '1' minute) then title || ' expired ' || to_char(not_after, 'DD-Mon-YYYY') ||\n ' (' || extract(day from not_after - current_date) || ' days ago).'\n else title || ' expires ' || to_char(not_after, 'DD-Mon-YYYY') ||\n ' (' || extract(day from not_after - current_date) || ' days).'\n end as reason\n \n \nfrom\n aws_acm_certificate;"
7-
PrimaryTable: aws_acm_certificate
87
ListOfTables:
98
- aws_acm_certificate
109
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN renewal_eligibility = 'INELIGIBLE' THEN 'skip'
18+
WHEN DATE(not_after) < (CURRENT_DATE - INTERVAL '1' minute) THEN 'alarm'
19+
ELSE 'ok'
20+
END AS status,
21+
CASE
22+
WHEN renewal_eligibility = 'INELIGIBLE' THEN title || ' not eligible for renewal.'
23+
WHEN DATE(not_after) < (CURRENT_DATE - INTERVAL '1' minute) THEN title || ' expired ' || TO_CHAR(not_after, 'DD-Mon-YYYY') ||
24+
' (' || EXTRACT(day FROM not_after - CURRENT_DATE) || ' days ago).'
25+
ELSE title || ' expires ' || TO_CHAR(not_after, 'DD-Mon-YYYY') ||
26+
' (' || EXTRACT(day FROM not_after - CURRENT_DATE) || ' days).'
27+
END AS reason
28+
FROM
29+
aws_acm_certificate;
1130
Severity: low
1231
Tags: {}
13-
IntegrationType:
14-
- aws_cloud_account
32+
Title: Ensure that all the expired ACM certificates are removed
Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1+
Description: This control checks whether RSA certificates managed by AWS Certificate Manager use a key length of at least 2,048 bits. The control fails if the key length is smaller than 2,048 bits.
12
ID: aws_acm_certificate_rsa_key_length_2048_bits_or_greater
2-
Title: "RSA certificates managed by ACM should use a key length of at least 2,048 bits"
3-
Description: "This control checks whether RSA certificates managed by AWS Certificate Manager use a key length of at least 2,048 bits. The control fails if the key length is smaller than 2,048 bits."
3+
IntegrationType:
4+
- aws_cloud_account
45
Query:
56
Engine: CloudQL-v0.0.1
6-
QueryToExecute: "select\n certificate_arn as resource,\n og_account_id as og_account_id,\n og_resource_id as og_resource_id,\n case\n when not key_algorithm like 'RSA-%' then 'skip'\n when key_algorithm = 'RSA_1024' then 'alarm'\n else 'ok'\n end as status,\n case\n when not key_algorithm like 'RSA-%' then title || ' is not a RSA certificate.'\n when key_algorithm = 'RSA_1024' then title || ' is using 1024 bits key length.'\n else title || ' is using ' || split_part(key_algorithm, '-', 2) || ' bits key length.'\n end as reason\n \n \nfrom\n aws_acm_certificate;"
7-
PrimaryTable: aws_acm_certificate
87
ListOfTables:
98
- aws_acm_certificate
109
Parameters: []
10+
PrimaryTable: aws_acm_certificate
11+
QueryToExecute: |
12+
SELECT
13+
certificate_arn AS resource,
14+
og_account_id AS og_account_id,
15+
og_resource_id AS og_resource_id,
16+
CASE
17+
WHEN NOT key_algorithm LIKE 'RSA-%' THEN 'skip'
18+
WHEN key_algorithm = 'RSA_1024' THEN 'alarm'
19+
ELSE 'ok'
20+
END AS status,
21+
CASE
22+
WHEN NOT key_algorithm LIKE 'RSA-%' THEN title || ' is not a RSA certificate.'
23+
WHEN key_algorithm = 'RSA_1024' THEN title || ' is using 1024 bits key length.'
24+
ELSE title || ' is using ' || split_part(key_algorithm, '-', 2) || ' bits key length.'
25+
END AS reason
26+
FROM
27+
aws_acm_certificate;
1128
Severity: low
1229
Tags: {}
13-
IntegrationType:
14-
- aws_cloud_account
30+
Title: RSA certificates managed by ACM should use a key length of at least 2,048 bits

0 commit comments

Comments
 (0)