mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
feat(regions_update): Changes in regions for AWS services. (#1524)
This commit is contained in:
committed by
GitHub
parent
7ff72c048a
commit
27a79d9c8c
File diff suppressed because it is too large
Load Diff
@@ -3,4 +3,4 @@ from prowler.config.config import get_aws_available_regions
|
||||
|
||||
class Test_Config:
|
||||
def test_get_aws_available_regions(self):
|
||||
assert len(get_aws_available_regions()) == 29
|
||||
assert len(get_aws_available_regions()) == 30
|
||||
|
||||
@@ -36,6 +36,7 @@ class Test_cloudtrail_cloudwatch_logging_enabled:
|
||||
)
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.cloudtrail.cloudtrail_cloudwatch_logging_enabled.cloudtrail_cloudwatch_logging_enabled.cloudtrail_client",
|
||||
@@ -111,6 +112,7 @@ class Test_cloudtrail_cloudwatch_logging_enabled:
|
||||
)
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.cloudtrail.cloudtrail_cloudwatch_logging_enabled.cloudtrail_cloudwatch_logging_enabled.cloudtrail_client",
|
||||
@@ -137,8 +139,8 @@ class Test_cloudtrail_cloudwatch_logging_enabled:
|
||||
|
||||
check = cloudtrail_cloudwatch_logging_enabled()
|
||||
result = check.execute()
|
||||
# len of result should be 24 -> (1 multiregion entry per region + 1 entry because of single region trail)
|
||||
assert len(result) == 26
|
||||
# len of result should be 3 -> (1 multiregion entry per region + 1 entry because of single region trail)
|
||||
assert len(result) == 3
|
||||
for report in result:
|
||||
if report.resource_id == trail_name_us:
|
||||
assert report.resource_id == trail_name_us
|
||||
@@ -186,6 +188,7 @@ class Test_cloudtrail_cloudwatch_logging_enabled:
|
||||
)
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.cloudtrail.cloudtrail_cloudwatch_logging_enabled.cloudtrail_cloudwatch_logging_enabled.cloudtrail_client",
|
||||
|
||||
@@ -24,7 +24,7 @@ class Test_Cloudtrail_Service:
|
||||
profile_region=None,
|
||||
credentials=None,
|
||||
assumed_role_info=None,
|
||||
audited_regions=None,
|
||||
audited_regions=["eu-west-1", "us-east-1"],
|
||||
organizations_metadata=None,
|
||||
)
|
||||
return audit_info
|
||||
@@ -83,8 +83,7 @@ class Test_Cloudtrail_Service:
|
||||
)
|
||||
audit_info = self.set_mocked_audit_info()
|
||||
cloudtrail = Cloudtrail(audit_info)
|
||||
# 1 None result per region plus 2 created
|
||||
assert len(cloudtrail.trails) == 25
|
||||
assert len(cloudtrail.trails) == 2
|
||||
for trail in cloudtrail.trails:
|
||||
if trail.name:
|
||||
assert trail.name == trail_name_us or trail.name == trail_name_eu
|
||||
@@ -129,8 +128,7 @@ class Test_Cloudtrail_Service:
|
||||
)
|
||||
audit_info = self.set_mocked_audit_info()
|
||||
cloudtrail = Cloudtrail(audit_info)
|
||||
# 1 None result per region plus 2 created
|
||||
assert len(cloudtrail.trails) == 25
|
||||
assert len(cloudtrail.trails) == 2
|
||||
for trail in cloudtrail.trails:
|
||||
if trail.name:
|
||||
if trail.name == trail_name_us:
|
||||
@@ -171,8 +169,7 @@ class Test_Cloudtrail_Service:
|
||||
)["EventSelectors"]
|
||||
audit_info = self.set_mocked_audit_info()
|
||||
cloudtrail = Cloudtrail(audit_info)
|
||||
# 1 None result per region plus 2 created
|
||||
assert len(cloudtrail.trails) == 25
|
||||
assert len(cloudtrail.trails) == 2
|
||||
for trail in cloudtrail.trails:
|
||||
if trail.name:
|
||||
if trail.name == trail_name_us:
|
||||
|
||||
@@ -13,6 +13,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
from prowler.providers.aws.services.config.config_service import Config
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.config.config_recorder_all_regions_enabled.config_recorder_all_regions_enabled.config_client",
|
||||
@@ -27,7 +28,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
result = check.execute()
|
||||
|
||||
assert (
|
||||
len(result) == 25
|
||||
len(result) == 2
|
||||
) # One fail result per region, since there are no recorders
|
||||
assert result[0].status == "FAIL"
|
||||
|
||||
@@ -43,6 +44,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
from prowler.providers.aws.services.config.config_service import Config
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.config.config_recorder_all_regions_enabled.config_recorder_all_regions_enabled.config_client",
|
||||
@@ -55,7 +57,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
|
||||
check = config_recorder_all_regions_enabled()
|
||||
result = check.execute()
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
# Search for the recorder just created
|
||||
for recorder in result:
|
||||
if recorder.resource_id:
|
||||
@@ -83,6 +85,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
from prowler.providers.aws.services.config.config_service import Config
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.config.config_recorder_all_regions_enabled.config_recorder_all_regions_enabled.config_client",
|
||||
@@ -95,7 +98,7 @@ class Test_config_recorder_all_regions_enabled:
|
||||
|
||||
check = config_recorder_all_regions_enabled()
|
||||
result = check.execute()
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
# Search for the recorder just created
|
||||
for recorder in result:
|
||||
if recorder.resource_id:
|
||||
|
||||
@@ -25,7 +25,7 @@ class Test_Config_Service:
|
||||
profile_region=None,
|
||||
credentials=None,
|
||||
assumed_role_info=None,
|
||||
audited_regions=None,
|
||||
audited_regions=["eu-west-1", "us-east-1"],
|
||||
organizations_metadata=None,
|
||||
)
|
||||
return audit_info
|
||||
@@ -81,7 +81,7 @@ class Test_Config_Service:
|
||||
audit_info = self.set_mocked_audit_info()
|
||||
config = Config(audit_info)
|
||||
# One recorder per region
|
||||
assert len(config.recorders) == 25
|
||||
assert len(config.recorders) == 2
|
||||
# Check the active one
|
||||
# Search for the recorder just created
|
||||
for recorder in config.recorders:
|
||||
|
||||
@@ -15,6 +15,7 @@ class Test_ec2_ami_public:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ami_public.ec2_ami_public.ec2_client",
|
||||
@@ -47,6 +48,7 @@ class Test_ec2_ami_public:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ami_public.ec2_ami_public.ec2_client",
|
||||
@@ -90,6 +92,7 @@ class Test_ec2_ami_public:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ami_public.ec2_ami_public.ec2_client",
|
||||
|
||||
@@ -19,6 +19,7 @@ class Test_ec2_ebs_default_encryption:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_default_encryption.ec2_ebs_default_encryption.ec2_client",
|
||||
@@ -33,7 +34,7 @@ class Test_ec2_ebs_default_encryption:
|
||||
results = check.execute()
|
||||
|
||||
# One result per region
|
||||
assert len(results) == 25
|
||||
assert len(results) == 2
|
||||
for result in results:
|
||||
if result.region == AWS_REGION:
|
||||
assert result.status == "PASS"
|
||||
@@ -49,6 +50,7 @@ class Test_ec2_ebs_default_encryption:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_default_encryption.ec2_ebs_default_encryption.ec2_client",
|
||||
@@ -63,7 +65,7 @@ class Test_ec2_ebs_default_encryption:
|
||||
result = check.execute()
|
||||
|
||||
# One result per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
"EBS Default Encryption is not activated",
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_public_snapshot.ec2_ebs_public_snapshot.ec2_client",
|
||||
@@ -28,7 +29,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
result = check.execute()
|
||||
|
||||
# Default snapshots
|
||||
assert len(result) == 1485
|
||||
assert len(result) == 122
|
||||
|
||||
@mock_ec2
|
||||
def test_ec2_public_snapshot(self):
|
||||
@@ -47,6 +48,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_public_snapshot.ec2_ebs_public_snapshot.ec2_client",
|
||||
@@ -61,7 +63,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
results = check.execute()
|
||||
|
||||
# Default snapshots + 1 created
|
||||
assert len(results) == 1486
|
||||
assert len(results) == 123
|
||||
|
||||
for snap in results:
|
||||
if snap.resource_id == snapshot.id:
|
||||
@@ -83,6 +85,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_public_snapshot.ec2_ebs_public_snapshot.ec2_client",
|
||||
@@ -97,7 +100,7 @@ class Test_ec2_ebs_public_snapshot:
|
||||
results = check.execute()
|
||||
|
||||
# Default snapshots + 1 created
|
||||
assert len(results) == 1486
|
||||
assert len(results) == 123
|
||||
|
||||
for snap in results:
|
||||
if snap.resource_id == snapshot.id:
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_snapshots_encrypted.ec2_ebs_snapshots_encrypted.ec2_client",
|
||||
@@ -28,7 +29,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
result = check.execute()
|
||||
|
||||
# Default snapshots
|
||||
assert len(result) == 1485
|
||||
assert len(result) == 122
|
||||
|
||||
@mock_ec2
|
||||
def test_ec2_unencrypted_snapshot(self):
|
||||
@@ -41,6 +42,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_snapshots_encrypted.ec2_ebs_snapshots_encrypted.ec2_client",
|
||||
@@ -55,7 +57,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
results = check.execute()
|
||||
|
||||
# Default snapshots + 1 created
|
||||
assert len(results) == 1486
|
||||
assert len(results) == 123
|
||||
|
||||
for snap in results:
|
||||
if snap.resource_id == snapshot.id:
|
||||
@@ -77,6 +79,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_snapshots_encrypted.ec2_ebs_snapshots_encrypted.ec2_client",
|
||||
@@ -91,7 +94,7 @@ class Test_ec2_ebs_snapshots_encrypted:
|
||||
results = check.execute()
|
||||
|
||||
# Default snapshots + 1 created
|
||||
assert len(results) == 1486
|
||||
assert len(results) == 123
|
||||
|
||||
for snap in results:
|
||||
if snap.resource_id == snapshot.id:
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_ec2_ebs_volume_encryption:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_volume_encryption.ec2_ebs_volume_encryption.ec2_client",
|
||||
@@ -39,6 +40,7 @@ class Test_ec2_ebs_volume_encryption:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_volume_encryption.ec2_ebs_volume_encryption.ec2_client",
|
||||
@@ -71,6 +73,7 @@ class Test_ec2_ebs_volume_encryption:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_ebs_volume_encryption.ec2_ebs_volume_encryption.ec2_client",
|
||||
|
||||
@@ -25,6 +25,7 @@ class Test_ec2_elastic_ip_shodan:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_shodan.ec2_elastic_ip_shodan.ec2_client",
|
||||
@@ -53,6 +54,7 @@ class Test_ec2_elastic_ip_shodan:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_shodan.ec2_elastic_ip_shodan.ec2_client",
|
||||
@@ -88,6 +90,7 @@ class Test_ec2_elastic_ip_shodan:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_shodan.ec2_elastic_ip_shodan.ec2_client",
|
||||
|
||||
@@ -16,6 +16,7 @@ class Test_ec2_elastic_ip_unassgined:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_unassgined.ec2_elastic_ip_unassgined.ec2_client",
|
||||
@@ -41,6 +42,7 @@ class Test_ec2_elastic_ip_unassgined:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_unassgined.ec2_elastic_ip_unassgined.ec2_client",
|
||||
@@ -84,6 +86,7 @@ class Test_ec2_elastic_ip_unassgined:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_elastic_ip_unassgined.ec2_elastic_ip_unassgined.ec2_client",
|
||||
|
||||
@@ -16,6 +16,7 @@ class Test_ec2_instance_imdsv2_enabled:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_imdsv2_enabled.ec2_instance_imdsv2_enabled.ec2_client",
|
||||
@@ -49,6 +50,7 @@ class Test_ec2_instance_imdsv2_enabled:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_imdsv2_enabled.ec2_instance_imdsv2_enabled.ec2_client",
|
||||
@@ -90,6 +92,7 @@ class Test_ec2_instance_imdsv2_enabled:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_imdsv2_enabled.ec2_instance_imdsv2_enabled.ec2_client",
|
||||
|
||||
@@ -16,6 +16,7 @@ class Test_ec2_instance_internet_facing_with_instance_profile:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_internet_facing_with_instance_profile.ec2_instance_internet_facing_with_instance_profile.ec2_client",
|
||||
@@ -60,6 +61,7 @@ class Test_ec2_instance_internet_facing_with_instance_profile:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_internet_facing_with_instance_profile.ec2_instance_internet_facing_with_instance_profile.ec2_client",
|
||||
@@ -109,6 +111,7 @@ class Test_ec2_instance_internet_facing_with_instance_profile:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_internet_facing_with_instance_profile.ec2_instance_internet_facing_with_instance_profile.ec2_client",
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_instance_older_than_specific_days:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_older_than_specific_days.ec2_instance_older_than_specific_days.ec2_client",
|
||||
@@ -48,6 +49,7 @@ class Test_ec2_instance_older_than_specific_days:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_older_than_specific_days.ec2_instance_older_than_specific_days.ec2_client",
|
||||
@@ -82,6 +84,7 @@ class Test_ec2_instance_older_than_specific_days:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_older_than_specific_days.ec2_instance_older_than_specific_days.ec2_client",
|
||||
|
||||
@@ -16,6 +16,7 @@ class Test_ec2_instance_profile_attached:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_profile_attached.ec2_instance_profile_attached.ec2_client",
|
||||
@@ -60,6 +61,7 @@ class Test_ec2_instance_profile_attached:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_profile_attached.ec2_instance_profile_attached.ec2_client",
|
||||
@@ -102,6 +104,7 @@ class Test_ec2_instance_profile_attached:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_profile_attached.ec2_instance_profile_attached.ec2_client",
|
||||
|
||||
@@ -16,6 +16,7 @@ class Test_ec2_instance_public_ip:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_public_ip.ec2_instance_public_ip.ec2_client",
|
||||
@@ -54,6 +55,7 @@ class Test_ec2_instance_public_ip:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_public_ip.ec2_instance_public_ip.ec2_client",
|
||||
@@ -97,6 +99,7 @@ class Test_ec2_instance_public_ip:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_public_ip.ec2_instance_public_ip.ec2_client",
|
||||
|
||||
@@ -15,6 +15,7 @@ class Test_ec2_instance_secrets_user_data:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_secrets_user_data.ec2_instance_secrets_user_data.ec2_client",
|
||||
@@ -45,6 +46,7 @@ class Test_ec2_instance_secrets_user_data:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_secrets_user_data.ec2_instance_secrets_user_data.ec2_client",
|
||||
@@ -80,6 +82,7 @@ class Test_ec2_instance_secrets_user_data:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_secrets_user_data.ec2_instance_secrets_user_data.ec2_client",
|
||||
@@ -117,6 +120,7 @@ class Test_ec2_instance_secrets_user_data:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_secrets_user_data.ec2_instance_secrets_user_data.ec2_client",
|
||||
@@ -149,6 +153,7 @@ class Test_ec2_instance_secrets_user_data:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_instance_secrets_user_data.ec2_instance_secrets_user_data.ec2_client",
|
||||
|
||||
@@ -14,6 +14,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_any_port.ec2_networkacl_allow_ingress_any_port.ec2_client",
|
||||
@@ -28,7 +29,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default nacl per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 3
|
||||
|
||||
@mock_ec2
|
||||
def test_ec2_non_default_compliant_nacl(self):
|
||||
@@ -37,6 +38,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_any_port.ec2_networkacl_allow_ingress_any_port.ec2_client",
|
||||
@@ -51,7 +53,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 3
|
||||
|
||||
# by default nacls are public
|
||||
assert result[0].status == "FAIL"
|
||||
@@ -81,6 +83,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_any_port.ec2_networkacl_allow_ingress_any_port.ec2_client",
|
||||
@@ -95,7 +98,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
@@ -126,6 +129,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_any_port.ec2_networkacl_allow_ingress_any_port.ec2_client",
|
||||
@@ -140,7 +144,7 @@ class ec2_networkacl_allow_ingress_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_22.ec2_networkacl_allow_ingress_tcp_port_22.ec2_client",
|
||||
@@ -28,7 +29,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default nacl per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
|
||||
@mock_ec2
|
||||
def test_ec2_non_default_compliant_nacl(self):
|
||||
@@ -37,6 +38,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_22.ec2_networkacl_allow_ingress_tcp_port_22.ec2_client",
|
||||
@@ -51,7 +53,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
|
||||
# by default nacls are public
|
||||
assert result[0].status == "FAIL"
|
||||
@@ -82,6 +84,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_22.ec2_networkacl_allow_ingress_tcp_port_22.ec2_client",
|
||||
@@ -96,7 +99,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
@@ -128,6 +131,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_22.ec2_networkacl_allow_ingress_tcp_port_22.ec2_client",
|
||||
@@ -142,7 +146,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_client",
|
||||
@@ -28,7 +29,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default nacl per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
|
||||
@mock_ec2
|
||||
def test_ec2_non_default_compliant_nacl(self):
|
||||
@@ -37,6 +38,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_client",
|
||||
@@ -51,7 +53,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 25
|
||||
assert len(result) == 2
|
||||
|
||||
# by default nacls are public
|
||||
assert result[0].status == "FAIL"
|
||||
@@ -82,6 +84,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_client",
|
||||
@@ -96,7 +99,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
@@ -128,6 +131,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_networkacl_allow_ingress_tcp_port_3389.ec2_client",
|
||||
@@ -142,7 +146,7 @@ class Test_ec2_networkacl_allow_ingress_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + default of new VPC + new NACL
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for nacl in result:
|
||||
if nacl.resource_id == nacl_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_client",
|
||||
@@ -32,7 +33,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -58,6 +59,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_client",
|
||||
@@ -72,7 +74,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -104,6 +106,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_securitygroup_allow_ingress_from_internet_to_any_port.ec2_client",
|
||||
@@ -118,7 +121,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_any_port:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_27018.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_port_mongodb_27017_2
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_ftp_port_20_21:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_client",
|
||||
@@ -32,7 +33,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -60,6 +61,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_client",
|
||||
@@ -74,7 +76,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -108,6 +110,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22.ec2_client",
|
||||
@@ -122,7 +125,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_22:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_client",
|
||||
@@ -32,7 +33,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -60,6 +61,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_client",
|
||||
@@ -74,7 +76,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -108,6 +110,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389.ec2_client",
|
||||
@@ -122,7 +125,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_3389:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7199_9160_8888.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_cassandra_7
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsearch_kibana_9200_9300_5601.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_elasticsear
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -111,6 +113,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092.ec2_client",
|
||||
@@ -127,7 +130,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_kafka_9092:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_11211.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_memcached_1
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mysql_3306:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521_2483.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_oracle_1521
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_5432.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_postgres_54
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -111,6 +113,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379.ec2_client",
|
||||
@@ -127,7 +130,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -112,6 +114,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_1434.ec2_client",
|
||||
@@ -128,7 +131,7 @@ class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_sql_server_1433_
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_client",
|
||||
@@ -34,7 +35,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -62,6 +63,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_client",
|
||||
@@ -78,7 +80,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -111,6 +113,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23.ec2_client",
|
||||
@@ -127,7 +130,7 @@ class Test_ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_client",
|
||||
@@ -32,7 +33,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -58,6 +59,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_client",
|
||||
@@ -72,7 +74,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -104,6 +106,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_securitygroup_allow_wide_open_public_ipv4.ec2_client",
|
||||
@@ -118,7 +121,7 @@ class Test_ec2_securitygroup_allow_wide_open_public_ipv4:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -17,6 +17,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_default_restrict_traffic.ec2_securitygroup_default_restrict_traffic.ec2_client",
|
||||
@@ -31,7 +32,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -52,6 +53,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_default_restrict_traffic.ec2_securitygroup_default_restrict_traffic.ec2_client",
|
||||
@@ -66,7 +68,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -95,6 +97,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_default_restrict_traffic.ec2_securitygroup_default_restrict_traffic.ec2_client",
|
||||
@@ -109,7 +112,7 @@ class Test_ec2_securitygroup_default_restrict_traffic:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -19,6 +19,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_from_launch_wizard.ec2_securitygroup_from_launch_wizard.ec2_client",
|
||||
@@ -33,7 +34,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -50,6 +51,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_from_launch_wizard.ec2_securitygroup_from_launch_wizard.ec2_client",
|
||||
@@ -64,7 +66,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region + created one
|
||||
assert len(result) == 27
|
||||
assert len(result) == 4
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == sg_id:
|
||||
@@ -96,6 +98,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_from_launch_wizard.ec2_securitygroup_from_launch_wizard.ec2_client",
|
||||
@@ -110,7 +113,7 @@ class Test_ec2_securitygroup_from_launch_wizard:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -19,6 +19,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_in_use_without_ingress_filtering.ec2_securitygroup_in_use_without_ingress_filtering.ec2_client",
|
||||
@@ -33,7 +34,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -59,6 +60,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_in_use_without_ingress_filtering.ec2_securitygroup_in_use_without_ingress_filtering.ec2_client",
|
||||
@@ -73,7 +75,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -113,6 +115,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_in_use_without_ingress_filtering.ec2_securitygroup_in_use_without_ingress_filtering.ec2_client",
|
||||
@@ -127,7 +130,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -150,6 +153,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_in_use_without_ingress_filtering.ec2_securitygroup_in_use_without_ingress_filtering.ec2_client",
|
||||
@@ -164,7 +168,7 @@ class Test_ec2_securitygroup_in_use_without_ingress_filtering:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -19,6 +19,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_not_used.ec2_securitygroup_not_used.ec2_client",
|
||||
@@ -33,7 +34,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are unused by default
|
||||
assert result[0].status == "FAIL"
|
||||
|
||||
@@ -50,6 +51,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_not_used.ec2_securitygroup_not_used.ec2_client",
|
||||
@@ -64,7 +66,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -96,6 +98,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_not_used.ec2_securitygroup_not_used.ec2_client",
|
||||
@@ -110,7 +113,7 @@ class Test_ec2_securitygroup_not_used:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -18,6 +18,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_with_many_ingress_egress_rules.ec2_securitygroup_with_many_ingress_egress_rules.ec2_client",
|
||||
@@ -32,7 +33,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# All are compliant by default
|
||||
assert result[0].status == "PASS"
|
||||
|
||||
@@ -61,6 +62,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_with_many_ingress_egress_rules.ec2_securitygroup_with_many_ingress_egress_rules.ec2_client",
|
||||
@@ -75,7 +77,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
@@ -108,6 +110,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
from prowler.providers.aws.services.ec2.ec2_service import EC2
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.ec2.ec2_securitygroup_with_many_ingress_egress_rules.ec2_securitygroup_with_many_ingress_egress_rules.ec2_client",
|
||||
@@ -122,7 +125,7 @@ class Test_ec2_securitygroup_with_many_ingress_egress_rules:
|
||||
result = check.execute()
|
||||
|
||||
# One default sg per region
|
||||
assert len(result) == 26
|
||||
assert len(result) == 3
|
||||
# Search changed sg
|
||||
for sg in result:
|
||||
if sg.resource_id == default_sg_id:
|
||||
|
||||
@@ -28,7 +28,7 @@ class Test_EC2_Service:
|
||||
profile_region=None,
|
||||
credentials=None,
|
||||
assumed_role_info=None,
|
||||
audited_regions=None,
|
||||
audited_regions=["eu-west-1", "us-east-1"],
|
||||
organizations_metadata=None,
|
||||
)
|
||||
return audit_info
|
||||
@@ -195,7 +195,7 @@ class Test_EC2_Service:
|
||||
ec2 = EC2(audit_info)
|
||||
|
||||
# One result per region
|
||||
assert len(ec2.ebs_encryption_by_default) == 25
|
||||
assert len(ec2.ebs_encryption_by_default) == 2
|
||||
for result in ec2.ebs_encryption_by_default:
|
||||
if result.region == AWS_REGION:
|
||||
assert result.status
|
||||
|
||||
@@ -21,6 +21,7 @@ class Test_vpc_endpoint_connections_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_endpoint_connections_trust_boundaries.vpc_endpoint_connections_trust_boundaries.vpc_client",
|
||||
@@ -66,6 +67,7 @@ class Test_vpc_endpoint_connections_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_endpoint_connections_trust_boundaries.vpc_endpoint_connections_trust_boundaries.vpc_client",
|
||||
@@ -118,6 +120,7 @@ class Test_vpc_endpoint_connections_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
current_audit_info.audited_account = ACCOUNT_ID
|
||||
|
||||
with mock.patch(
|
||||
@@ -171,6 +174,7 @@ class Test_vpc_endpoint_connections_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
current_audit_info.audited_account = ACCOUNT_ID
|
||||
|
||||
with mock.patch(
|
||||
@@ -223,6 +227,7 @@ class Test_vpc_endpoint_connections_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
current_audit_info.audited_account = ACCOUNT_ID
|
||||
|
||||
with mock.patch(
|
||||
|
||||
@@ -40,6 +40,7 @@ class Test_vpc_endpoint_services_allowed_principals_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_endpoint_services_allowed_principals_trust_boundaries.vpc_endpoint_services_allowed_principals_trust_boundaries.vpc_client",
|
||||
@@ -53,7 +54,7 @@ class Test_vpc_endpoint_services_allowed_principals_trust_boundaries:
|
||||
check = vpc_endpoint_services_allowed_principals_trust_boundaries()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 25 # one endpoint per region
|
||||
assert len(result) == 2 # one endpoint per region
|
||||
|
||||
@mock_ec2
|
||||
@mock_elbv2
|
||||
@@ -87,6 +88,7 @@ class Test_vpc_endpoint_services_allowed_principals_trust_boundaries:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_endpoint_services_allowed_principals_trust_boundaries.vpc_endpoint_services_allowed_principals_trust_boundaries.vpc_client",
|
||||
@@ -100,7 +102,7 @@ class Test_vpc_endpoint_services_allowed_principals_trust_boundaries:
|
||||
check = vpc_endpoint_services_allowed_principals_trust_boundaries()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 25 # one per region
|
||||
assert len(result) == 2 # one per region
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_vpc_flow_logs_enabled:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_flow_logs_enabled.vpc_flow_logs_enabled.vpc_client",
|
||||
@@ -27,9 +28,7 @@ class Test_vpc_flow_logs_enabled:
|
||||
check = vpc_flow_logs_enabled()
|
||||
result = check.execute()
|
||||
|
||||
assert (
|
||||
len(result) == 25
|
||||
) # Number of AWS regions, one default VPC per region
|
||||
assert len(result) == 2 # Number of AWS regions, one default VPC per region
|
||||
|
||||
@mock_ec2
|
||||
def test_vpc_with_flow_logs(self):
|
||||
@@ -51,6 +50,7 @@ class Test_vpc_flow_logs_enabled:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_flow_logs_enabled.vpc_flow_logs_enabled.vpc_client",
|
||||
@@ -85,6 +85,7 @@ class Test_vpc_flow_logs_enabled:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_flow_logs_enabled.vpc_flow_logs_enabled.vpc_client",
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test_vpc_peering_routing_tables_with_least_privilege:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_peering_routing_tables_with_least_privilege.vpc_peering_routing_tables_with_least_privilege.vpc_client",
|
||||
@@ -61,6 +62,7 @@ class Test_vpc_peering_routing_tables_with_least_privilege:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC, Route
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_peering_routing_tables_with_least_privilege.vpc_peering_routing_tables_with_least_privilege.vpc_client",
|
||||
@@ -123,6 +125,7 @@ class Test_vpc_peering_routing_tables_with_least_privilege:
|
||||
from prowler.providers.aws.services.vpc.vpc_service import VPC, Route
|
||||
|
||||
current_audit_info.audited_partition = "aws"
|
||||
current_audit_info.audited_regions = ["eu-west-1", "us-east-1"]
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_peering_routing_tables_with_least_privilege.vpc_peering_routing_tables_with_least_privilege.vpc_client",
|
||||
|
||||
@@ -27,7 +27,7 @@ class Test_VPC_Service:
|
||||
profile_region=None,
|
||||
credentials=None,
|
||||
assumed_role_info=None,
|
||||
audited_regions=None,
|
||||
audited_regions=["eu-west-1", "us-east-1"],
|
||||
organizations_metadata=None,
|
||||
)
|
||||
return audit_info
|
||||
@@ -76,7 +76,7 @@ class Test_VPC_Service:
|
||||
audit_info = self.set_mocked_audit_info()
|
||||
vpc = VPC(audit_info)
|
||||
assert (
|
||||
len(vpc.vpcs) == 26
|
||||
len(vpc.vpcs) == 3
|
||||
) # Number of AWS regions + created VPC, one default VPC per region
|
||||
|
||||
# Test VPC Describe Flow Logs
|
||||
|
||||
Reference in New Issue
Block a user