Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Audit Manager > PCI DSS v3.2.1 controls #570

Merged
merged 68 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8655c6b
Add queries
Priyanka-Chatterjee-2000 Feb 7, 2023
7a547e0
Add other check queries
Priyanka-Chatterjee-2000 Feb 20, 2023
4d66127
Add other queries
Priyanka-Chatterjee-2000 Feb 22, 2023
7caea2e
Add query codebuild_project_build_greater_then_90_days
Priyanka-Chatterjee-2000 Feb 23, 2023
aef2878
Change in aws_efs_file_system query
Priyanka-Chatterjee-2000 Feb 23, 2023
4195ff1
suggestive changes
Priyanka-Chatterjee-2000 Feb 23, 2023
ccbfcbb
Add query cloudwatch cross account sharing iam role
Priyanka-Chatterjee-2000 Feb 23, 2023
b9ca2e6
Suggestive changes
Priyanka-Chatterjee-2000 Feb 23, 2023
ebcea7a
Add extra check queries
madhushreeray30 Feb 23, 2023
5cd0d68
update query
madhushreeray30 Feb 24, 2023
78ccec2
update query
madhushreeray30 Feb 24, 2023
06788df
update query
madhushreeray30 Feb 24, 2023
2dd53ee
update queries
madhushreeray30 Feb 24, 2023
cf45e12
Add controls and query change
Priyanka-Chatterjee-2000 Feb 25, 2023
cde1cb8
Merge branch 'new-other-checks-query-pc' of https://github.com/turbot…
Priyanka-Chatterjee-2000 Feb 25, 2023
9fef87b
query name change
Priyanka-Chatterjee-2000 Feb 25, 2023
4ba694e
query fix
madhushreeray30 Feb 27, 2023
8a6af68
add controls
madhushreeray30 Feb 27, 2023
9a09814
query fix
madhushreeray30 Feb 27, 2023
a663331
fix query
madhushreeray30 Feb 27, 2023
1853737
Minor query changes
Priyanka-Chatterjee-2000 Feb 27, 2023
adf77e5
add description
madhushreeray30 Feb 27, 2023
e3158fd
Merge branch 'new-other-checks-query-pc' of https://github.com/turbot…
madhushreeray30 Feb 27, 2023
1462115
update control description
madhushreeray30 Feb 27, 2023
d5bb8a5
update
khushboo9024 Feb 27, 2023
497920d
update query name
khushboo9024 Feb 28, 2023
31cd21b
Add requirement 1
Priyanka-Chatterjee-2000 Mar 2, 2023
ee67376
Add requirement 2
Priyanka-Chatterjee-2000 Mar 2, 2023
c5eb488
Add requirement 2 and requirement 1
Priyanka-Chatterjee-2000 Mar 2, 2023
472b302
add requirement 2_4
Priyanka-Chatterjee-2000 Mar 2, 2023
168e983
Add till audit_manager_pci_v321_requirement_3_4
Priyanka-Chatterjee-2000 Mar 6, 2023
bea94e5
Add requirement 3
Priyanka-Chatterjee-2000 Mar 8, 2023
247cbf5
change in requirement 1, 2, 3
Priyanka-Chatterjee-2000 Mar 8, 2023
56f6ca2
Add requirement 6
Priyanka-Chatterjee-2000 Mar 8, 2023
6845757
Completed requirement 6
Priyanka-Chatterjee-2000 Mar 9, 2023
15e4e09
Add requirement 7
Priyanka-Chatterjee-2000 Mar 9, 2023
bcff94c
remove extra tags and add requirement 8 half
Priyanka-Chatterjee-2000 Mar 10, 2023
9014512
minor change
Priyanka-Chatterjee-2000 Mar 10, 2023
9293816
resolve merge conflict
khushboo9024 Mar 10, 2023
7b6fa41
update
khushboo9024 Mar 10, 2023
88364bd
requirement 8 complete
Priyanka-Chatterjee-2000 Mar 10, 2023
632c857
Requirement 11 complete and requirement 10 half done
Priyanka-Chatterjee-2000 Mar 13, 2023
4def2a3
Requirement 10 complete
Priyanka-Chatterjee-2000 Mar 13, 2023
7a08d41
Add queries, details, doc and minor changes
Priyanka-Chatterjee-2000 Mar 14, 2023
b43a058
update
khushboo9024 Mar 23, 2023
5e9863d
Merge branch 'release/v0.59' into pci_v321
Priyanka-Chatterjee-2000 Mar 23, 2023
84c3ee1
Merge conflicts resolved
Priyanka-Chatterjee-2000 Mar 23, 2023
9bd47ce
resolve merge conflict
khushboo9024 Mar 27, 2023
7755424
update
khushboo9024 Mar 27, 2023
d19fece
upate
khushboo9024 Mar 27, 2023
32919a7
update
khushboo9024 Mar 27, 2023
82a2b7a
Updates
rajlearner17 Mar 27, 2023
fc2699a
update
khushboo9024 Mar 27, 2023
b370ffb
update title and description
madhushreeray30 Mar 28, 2023
c446f48
update name of benchmarks to `pci_dss_v321`
madhushreeray30 Mar 28, 2023
c348947
update title
madhushreeray30 Mar 28, 2023
0596f13
Remove benchmark pci_v321
rajlearner17 Mar 29, 2023
b018ed8
Fix query to return name of the bucket in s3_bucket_lifecycle_policy_…
rajlearner17 Mar 29, 2023
43ee975
Update mod.sp to include latest aws plugin
rajlearner17 Mar 29, 2023
b7a3ca7
update query
madhushreeray30 Mar 29, 2023
a714f00
Suggestive changes
Priyanka-Chatterjee-2000 Mar 30, 2023
d31eb23
Minor change
Priyanka-Chatterjee-2000 Mar 30, 2023
abbefd9
minor update
Priyanka-Chatterjee-2000 Mar 30, 2023
a53b028
minor changes
Priyanka-Chatterjee-2000 Mar 30, 2023
47d0d70
minor changes
Priyanka-Chatterjee-2000 Mar 30, 2023
78cadc3
update
Priyanka-Chatterjee-2000 Mar 30, 2023
85809ac
update title
khushboo9024 Mar 31, 2023
62c40ca
update
khushboo9024 Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Includes support for:
* [NIST 800-53 Revision 5](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.nist_800_53_rev_5)
* [NIST Cybersecurity Framework (CSF)](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.nist_csf)
* [Other Compliance Checks](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.other)
* [PCI DSS v3.2.1](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.pci_v321)
* [PCI DSS v3.2.1](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.pci_dss_v321)
* [Reserve Bank of India (RBI) Cyber Security Framework](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.rbi_cyber_security)
* [SOC 2](https://hub.steampipe.io/mods/turbot/aws_compliance/controls/benchmark.soc_2)

Expand Down
1 change: 1 addition & 0 deletions conformance_pack/acm.sp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ control "acm_certificate_expires_30_days" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand Down
10 changes: 7 additions & 3 deletions conformance_pack/apigateway.sp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ control "apigateway_stage_cache_encryption_at_rest_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -41,6 +42,7 @@ control "apigateway_stage_logging_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand Down Expand Up @@ -73,6 +75,7 @@ control "apigateway_stage_use_waf_web_acl" {
fedramp_moderate_rev_4 = "true"
ffiec = "true"
nist_800_53_rev_5 = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
})
}
Expand Down Expand Up @@ -119,7 +122,8 @@ query "apigateway_stage_logging_enabled" {
title,
region,
account_id,
tags
tags,
_ctx
from
aws_api_gateway_stage
union
Expand All @@ -130,7 +134,8 @@ query "apigateway_stage_logging_enabled" {
title,
region,
account_id,
tags
tags,
_ctx
from
aws_api_gatewayv2_stage
)
Expand Down Expand Up @@ -201,7 +206,6 @@ query "apigateway_rest_api_authorizers_configured" {
when jsonb_array_length(a.provider_arns) > 0 then p.name || ' authorizers configured.'
else p.name || ' authorizers not configured.'
end as reason

${replace(local.tag_dimensions_qualifier_sql, "__QUALIFIER__", "p.")}
${replace(local.common_dimensions_qualifier_sql, "__QUALIFIER__", "p.")}
from
Expand Down
12 changes: 12 additions & 0 deletions conformance_pack/autoscaling.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ locals {
})
}

control "autoscaling_launch_config_requires_imdsv2" {
title = "Auto Scaling group should configure EC2 instances to require Instance Metadata Service Version 2 (IMDSv2)"
description = "This control checks whether IMDSv2 is enabled on all instances launched by Amazon EC2 Auto Scaling groups. The control fails if the Instance Metadata Service (IMDS) version is not included in the launch configuration or if both IMDSv1 and IMDSv2 are enabled."
query = query.autoscaling_launch_config_requires_imdsv2

tags = merge(local.conformance_pack_autoscaling_common_tags, {
pci_dss_v321 = "true"
})
}

control "autoscaling_group_with_lb_use_health_check" {
title = "Auto Scaling groups with a load balancer should use health checks"
description = "The Elastic Load Balancer (ELB) health checks for Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling groups support maintenance of adequate capacity and availability."
Expand All @@ -19,6 +29,7 @@ control "autoscaling_group_with_lb_use_health_check" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
})
}

Expand All @@ -34,6 +45,7 @@ control "autoscaling_launch_config_public_ip_disabled" {
fedramp_moderate_rev_4 = "true"
ffiec = "true"
nist_800_53_rev_5 = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
})
}
Expand Down
5 changes: 5 additions & 0 deletions conformance_pack/backup.sp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ control "backup_recovery_point_manual_deletion_disabled" {
hipaa = "true"
nist_800_171_rev_2 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}
Expand All @@ -34,6 +35,7 @@ control "backup_plan_min_retention_35_days" {
hipaa = "true"
nist_800_171_rev_2 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}
Expand All @@ -42,13 +44,15 @@ control "backup_recovery_point_encryption_enabled" {
title = "Backup recovery points should be encrypted"
description = "Ensure if a recovery point is encrypted. The rule is non compliant if the recovery point is not encrypted."
query = query.backup_recovery_point_encryption_enabled

tags = merge(local.conformance_pack_backup_common_tags, {
cisa_cyber_essentials = "true"
ffiec = "true"
gxp_eu_annex_11 = "true"
hipaa = "true"
nist_800_171_rev_2 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}
Expand All @@ -63,6 +67,7 @@ control "backup_recovery_point_min_retention_35_days" {
ffiec = "true"
gxp_eu_annex_11 = "true"
nist_800_171_rev_2 = "true"
pci_dss_v321 = "true"
})
}

Expand Down
31 changes: 31 additions & 0 deletions conformance_pack/cloudformation.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ locals {
})
}

control "cloudformation_stack_drift_detection_check" {
title = "CloudFormation stacks differ from the expected configuration"
description = "Ensure if the actual configuration of a Cloud Formation stack differs, or has drifted, from the expected configuration, a stack is considered to have drifted if one or more of its resources differ from their expected configuration."
query = query.cloudformation_stack_drift_detection_check

tags = merge(local.conformance_pack_cloudformation_common_tags, {
pci_dss_v321 = "true"
})
}

control "cloudformation_stack_output_no_secrets" {
title = "CloudFormation stacks outputs should not have any secrets"
description = "Ensure CloudFormation stacks outputs do not contain secrets like user names, passwords, and tokens. It is recommended to remove secrets since outputs cannot be encrypted resulting in any entity with basic read-metadata-only and access to CloudFormation outputs having access to these secrets."
Expand Down Expand Up @@ -44,6 +54,27 @@ control "cloudformation_stack_termination_protection_enabled" {
})
}

query "cloudformation_stack_drift_detection_check" {
sql = <<-EOQ
select
id as resource,
case
when stack_drift_status = 'IN_SYNC' then 'ok'
when stack_drift_status = 'DRIFTED' then 'alarm'
else 'skip'
end as status,
case
when stack_drift_status = 'IN_SYNC' then title || ' drift status is ' || stack_drift_status || '.'
when stack_drift_status = 'DRIFTED' then title || ' drift status is ' || stack_drift_status || '.'
else title || ' drift status is ' || stack_drift_status || '.'
end as reason
${local.tag_dimensions_sql}
${local.common_dimensions_sql}
from
aws_cloudformation_stack;
EOQ
}

query "cloudformation_stack_output_no_secrets" {
sql = <<-EOQ
with stack_output as (
Expand Down
27 changes: 24 additions & 3 deletions conformance_pack/cloudfront.sp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ control "cloudfront_distribution_encryption_in_transit_enabled" {
query = query.cloudfront_distribution_encryption_in_transit_enabled

tags = merge(local.conformance_pack_cloudfront_common_tags, {
gdpr = "true"
hipaa = "true"
soc_2 = "true"
gdpr = "true"
hipaa = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}

Expand Down Expand Up @@ -46,6 +47,26 @@ control "cloudfront_distribution_non_s3_origins_encryption_in_transit_enabled" {
})
}

control "cloudfront_distribution_no_deprecated_ssl_protocol" {
title = "CloudFront distributions should not use deprecated SSL protocols between edge locations and custom origins"
description = "This control checks if Amazon CloudFront distributions are using deprecated SSL protocols for HTTPS communication between CloudFront edge locations and your custom origins. This control fails if a CloudFront distribution has a CustomOriginConfig where OriginSslProtocols includes SSLv3."
query = query.cloudfront_distribution_no_deprecated_ssl_protocol

tags = merge(local.conformance_pack_cloudfront_common_tags, {
pci_dss_v321 = "true"
})
}

control "cloudfront_distribution_custom_origins_encryption_in_transit_enabled" {
title = "CloudFront distributions should encrypt traffic to custom origins"
description = "This control checks if Amazon CloudFront distributions are encrypting traffic to custom origins. This control fails for a CloudFront distribution whose origin protocol policy allows 'http-only'. This control also fails if the distribution's origin protocol policy is 'match-viewer' while the viewer protocol policy is 'allow-all'."
query = query.cloudfront_distribution_custom_origins_encryption_in_transit_enabled

tags = merge(local.conformance_pack_cloudfront_common_tags, {
pci_dss_v321 = "true"
})
}

control "cloudfront_distribution_logging_enabled" {
title = "CloudFront distributions access logs should be enabled"
description = "This control checks if Amazon CloudFront distributions are configured to capture information from Amazon Simple Storage Service (Amazon S3) server access logs. This rule is non compliant if a CloudFront distribution does not have logging configured."
Expand Down
8 changes: 7 additions & 1 deletion conformance_pack/cloudtrail.sp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ control "cloudtrail_trail_integrated_with_logs" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -46,6 +47,7 @@ control "cloudtrail_s3_data_events_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -69,6 +71,7 @@ control "cloudtrail_trail_logs_encrypted_with_kms_cmk" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -92,6 +95,7 @@ control "cloudtrail_multi_region_trail_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -113,6 +117,7 @@ control "cloudtrail_trail_validation_enabled" {
nist_800_171_rev_2 = "true"
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}
Expand All @@ -135,6 +140,7 @@ control "cloudtrail_trail_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand Down Expand Up @@ -228,7 +234,7 @@ query "cloudtrail_s3_data_events_enabled" {
aws_s3_bucket as b
left join s3_selectors on bucket_selector like (b.arn || '%') or bucket_selector = 'arn:aws:s3'
group by
b.account_id, b.region, b.arn, b.name, b.tags;
b.account_id, b.region, b.arn, b.name, b.tags, b._ctx;
EOQ
}

Expand Down
8 changes: 6 additions & 2 deletions conformance_pack/cloudwatch.sp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ control "cloudwatch_alarm_action_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
soc_2 = "true"
})
}
Expand Down Expand Up @@ -49,6 +50,7 @@ control "log_group_encryption_at_rest_enabled" {
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
nist_csf = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand All @@ -69,6 +71,7 @@ control "cloudwatch_log_group_retention_period_365" {
nist_800_171_rev_2 = "true"
nist_800_53_rev_4 = "true"
nist_800_53_rev_5 = "true"
pci_dss_v321 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
Expand Down Expand Up @@ -115,8 +118,9 @@ control "log_metric_filter_iam_policy" {
query = query.log_metric_filter_iam_policy

tags = merge(local.conformance_pack_cloudwatch_common_tags, {
gdpr = "true"
nist_csf = "true"
gdpr = "true"
nist_csf = "true"
pci_dss_v321 = "true"
})
}

Expand Down
17 changes: 14 additions & 3 deletions conformance_pack/codebuild.sp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ control "codebuild_project_build_greater_then_90_days" {
description = "Ensure CodeBuild projects are curently in use. It is recommended to remove the stale ones."
query = query.codebuild_project_build_greater_then_90_days

tags = merge(local.conformance_pack_ecs_common_tags, {
tags = merge(local.conformance_pack_codebuild_common_tags, {
other_checks = "true"
})
}
Expand All @@ -20,6 +20,7 @@ control "codebuild_project_plaintext_env_variables_no_sensitive_aws_values" {
query = query.codebuild_project_plaintext_env_variables_no_sensitive_aws_values

tags = merge(local.conformance_pack_codebuild_common_tags, {
pci_dss_v321 = "true"
cis_controls_v8_ig1 = "true"
cisa_cyber_essentials = "true"
fedramp_low_rev_4 = "true"
Expand All @@ -38,6 +39,7 @@ control "codebuild_project_source_repo_oauth_configured" {
query = query.codebuild_project_source_repo_oauth_configured

tags = merge(local.conformance_pack_codebuild_common_tags, {
pci_dss_v321 = "true"
cis_controls_v8_ig1 = "true"
cisa_cyber_essentials = "true"
fedramp_low_rev_4 = "true"
Expand All @@ -55,13 +57,22 @@ control "codebuild_project_with_user_controlled_buildspec" {
description = "This control checks if buildspec.yml is used from a trusted source which user cant interfere with."
query = query.codebuild_project_with_user_controlled_buildspec

tags = merge(local.conformance_pack_ecs_common_tags, {
tags = merge(local.conformance_pack_codebuild_common_tags, {
other_checks = "true"
})
}

control "codebuild_project_environment_privileged_mode_disabled" {
title = "CodeBuild project environments should not have privileged mode enabled"
description = "This control checks if an AWS CodeBuild project environment has privileged mode enabled. This control fails when an AWS CodeBuild project environment has privileged mode enabled."
Priyanka-Chatterjee-2000 marked this conversation as resolved.
Show resolved Hide resolved
query = query.codebuild_project_environment_privileged_mode_disabled
tags = merge(local.conformance_pack_codebuild_common_tags, {
pci_dss_v321 = "true"
})
}

control "codebuild_project_logging_enabled" {
title = "CodeBuild project logging should be enabled"
title = "CodeBuild projects should have logging enabled"
description = "This control checks if an AWS CodeBuild project environment has at least one log option enabled. The rule is non compliant if the status of all present log configurations is set to 'DISABLED'."
query = query.codebuild_project_logging_enabled

Expand Down
Loading