turbot/steampipe-mod-aws-compliance

Control: GuardDuty Malware protection for EC2 should be enabled

Description

This control checks whether GuardDuty Malware protection is enabled. For a standalone account, the control fails if GuardDuty Malware protection is disabled in the account. In a multi-account environment, the control fails if the delegated GuardDuty administrator account and all member accounts don't have Malware protection enabled.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.guardduty_detector_ec2_malware_protection_enabled

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.guardduty_detector_ec2_malware_protection_enabled --share

SQL

This control uses a named query:

with ec2_malware_protection as (
select
arn
from
aws_guardduty_detector,
jsonb_array_elements(features) as f
where
f ->> 'Name' = 'EBS_MALWARE_PROTECTION'
and f ->> 'Status' = 'ENABLED'
)
select
d.arn as resource,
case
when m.arn is not null then 'ok'
else 'alarm'
end as status,
case
when m.arn is not null then title || ' has EC2 malware protection enabled.'
else title || ' has EC2 malware protection disabled.'
end as reason
, region, account_id
from
aws_guardduty_detector as d
left join ec2_malware_protection as m on m.arn = d.arn

Tags