-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(fixer): add Prowler Fixer feature! #3634
Changes from 5 commits
ca6506e
9d47288
85078ee
5e18a82
059ba69
eafc33f
aeae83b
cdd1a9b
6fdec63
387ba70
8c75b1a
a7a4ce9
37f5874
170e301
d5518a9
2b6ec76
31e6108
99fb615
e59245a
87949b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -410,6 +410,18 @@ def __get_ebs_encryption_settings__(self, regional_client): | |
f"{regional_client.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}" | ||
) | ||
|
||
def __enable_ebs_encryption_by_default__(self, region): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a test for this in the service. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
try: | ||
regional_client = self.regional_clients[region] | ||
return regional_client.enable_ebs_encryption_by_default()[ | ||
"EbsEncryptionByDefault" | ||
] | ||
except Exception as error: | ||
logger.error( | ||
f"{region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}" | ||
) | ||
return False | ||
|
||
|
||
class Instance(BaseModel): | ||
id: str | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,3 +544,19 @@ def test__describe_volumes__(self): | |
assert ec2.volumes[0].tags == [ | ||
{"Key": "test", "Value": "test"}, | ||
] | ||
|
||
# Test EC2 EBS Enabling Encryption by Default | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lovely! |
||
@mock_aws | ||
def test__describe_ebs_encryption_by_default__(self): | ||
# Generate EC2 Client | ||
ec2_client = client("ec2", region_name=AWS_REGION_US_EAST_1) | ||
|
||
# EC2 client for this test class | ||
aws_provider = set_mocked_aws_provider( | ||
[AWS_REGION_EU_WEST_1, AWS_REGION_US_EAST_1] | ||
) | ||
ec2 = EC2(aws_provider) | ||
|
||
assert not ec2.__enable_ebs_encryption_by_default__() | ||
ec2_client.enable_ebs_encryption_by_default() | ||
assert ec2.__enable_ebs_encryption_by_default__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need the check name here, you can use
check.CheckID
.