mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
chore(backport): update v3 with latest changes (#4198)
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
@@ -4958,6 +4958,7 @@
|
||||
"ap-southeast-3",
|
||||
"ap-southeast-4",
|
||||
"ca-central-1",
|
||||
"ca-west-1",
|
||||
"eu-central-1",
|
||||
"eu-central-2",
|
||||
"eu-north-1",
|
||||
@@ -10700,9 +10701,11 @@
|
||||
"eu-north-1",
|
||||
"eu-west-1",
|
||||
"eu-west-2",
|
||||
"eu-west-3",
|
||||
"sa-east-1",
|
||||
"us-east-1",
|
||||
"us-east-2",
|
||||
"us-west-1",
|
||||
"us-west-2"
|
||||
],
|
||||
"aws-cn": [],
|
||||
|
||||
@@ -101,5 +101,5 @@ class Cluster(BaseModel):
|
||||
arn: str
|
||||
region: str
|
||||
cache_subnet_group_id: Optional[str]
|
||||
subnets: Optional[list]
|
||||
subnets: list = []
|
||||
tags: Optional[list]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from botocore.exceptions import ClientError
|
||||
from pydantic import BaseModel
|
||||
|
||||
from prowler.lib.logger import logger
|
||||
@@ -72,6 +73,18 @@ class Glue(AWSService):
|
||||
region=regional_client.region,
|
||||
)
|
||||
)
|
||||
except ClientError as error:
|
||||
# Check if the operation is not supported in the region
|
||||
if error.response["Error"]["Message"].startswith(
|
||||
"Operation is not supported"
|
||||
):
|
||||
logger.warning(
|
||||
f"{regional_client.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
else:
|
||||
logger.error(
|
||||
f"{regional_client.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
except Exception as error:
|
||||
logger.error(
|
||||
f"{regional_client.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
|
||||
@@ -232,15 +232,19 @@ class RDS(AWSService):
|
||||
DBClusterParameterGroupName=cluster.parameter_group
|
||||
):
|
||||
for parameter in page["Parameters"]:
|
||||
if parameter["ParameterName"] == "rds.force_ssl":
|
||||
cluster.force_ssl = parameter["ParameterValue"]
|
||||
if (
|
||||
parameter["ParameterName"]
|
||||
== "require_secure_transport"
|
||||
"ParameterValue" in parameter
|
||||
and "ParameterName" in parameter
|
||||
):
|
||||
cluster.require_secure_transport = parameter[
|
||||
"ParameterValue"
|
||||
]
|
||||
if parameter["ParameterName"] == "rds.force_ssl":
|
||||
cluster.force_ssl = parameter["ParameterValue"]
|
||||
if (
|
||||
parameter["ParameterName"]
|
||||
== "require_secure_transport"
|
||||
):
|
||||
cluster.require_secure_transport = parameter[
|
||||
"ParameterValue"
|
||||
]
|
||||
except ClientError as error:
|
||||
if (
|
||||
error.response["Error"]["Code"]
|
||||
|
||||
@@ -84,10 +84,23 @@ class S3(AWSService):
|
||||
logger.warning(
|
||||
f"{bucket['Name']} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
else:
|
||||
logger.error(
|
||||
f"{bucket['Name']} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
except Exception as error:
|
||||
logger.error(
|
||||
f"{bucket['Name']} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
except ClientError as error:
|
||||
if error.response["Error"]["Code"] == "NotSignedUp":
|
||||
logger.warning(
|
||||
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
else:
|
||||
logger.error(
|
||||
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
except Exception as error:
|
||||
logger.error(
|
||||
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
|
||||
+48
@@ -58,6 +58,54 @@ class Test_elasticache_cluster_uses_public_subnet:
|
||||
result = check.execute()
|
||||
assert len(result) == 0
|
||||
|
||||
def test_elasticache_no_subnets(self):
|
||||
# Mock ElastiCache Service
|
||||
elasticache_service = MagicMock
|
||||
elasticache_service.clusters = {}
|
||||
|
||||
elasticache_service.clusters[ELASTICACHE_CLUSTER_ARN] = Cluster(
|
||||
arn=ELASTICACHE_CLUSTER_ARN,
|
||||
name=ELASTICACHE_CLUSTER_NAME,
|
||||
id=ELASTICACHE_CLUSTER_NAME,
|
||||
region=AWS_REGION_US_EAST_1,
|
||||
cache_subnet_group_id=SUBNET_GROUP_NAME,
|
||||
tags=ELASTICACHE_CLUSTER_TAGS,
|
||||
)
|
||||
|
||||
# Mock VPC Service
|
||||
vpc_client = MagicMock
|
||||
vpc_client.vpc_subnets = {}
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.lib.audit_info.audit_info.current_audit_info",
|
||||
new=set_mocked_aws_audit_info([AWS_REGION_US_EAST_1]),
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.elasticache.elasticache_service.ElastiCache",
|
||||
new=elasticache_service,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_service.VPC",
|
||||
new=vpc_client,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.vpc.vpc_client.vpc_client",
|
||||
new=vpc_client,
|
||||
):
|
||||
from prowler.providers.aws.services.elasticache.elasticache_cluster_uses_public_subnet.elasticache_cluster_uses_public_subnet import (
|
||||
elasticache_cluster_uses_public_subnet,
|
||||
)
|
||||
|
||||
check = elasticache_cluster_uses_public_subnet()
|
||||
result = check.execute()
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"Cluster {ELASTICACHE_CLUSTER_NAME} is not using public subnets."
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource_id == ELASTICACHE_CLUSTER_NAME
|
||||
assert result[0].resource_arn == ELASTICACHE_CLUSTER_ARN
|
||||
assert result[0].resource_tags == ELASTICACHE_CLUSTER_TAGS
|
||||
|
||||
def test_elasticache_clusters_using_private_subnets(self):
|
||||
# Mock ElastiCache Service
|
||||
elasticache_service = MagicMock
|
||||
|
||||
Reference in New Issue
Block a user