Skip to content

Commit

Permalink
chore: revision
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec committed Nov 5, 2024
1 parent f4daf21 commit 0f473b2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Provider": "aws",
"CheckID": "dms_endpoint_mongodb_authtype_configured",
"CheckID": "dms_endpoint_mongodb_authentication_enabled",
"CheckTitle": "Check if DMS endpoints for MongoDB have an authentication mechanism enabled.",
"CheckType": [
"Software and Configuration Checks/AWS Security Best Practices"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from prowler.providers.aws.services.dms.dms_client import dms_client


class dms_endpoint_mongodb_authtype_configured(Check):
class dms_endpoint_mongodb_authentication_enabled(Check):
"""
Check if AWS DMS Endpoints for MongoDB have an authentication mechanism enabled.
Expand Down Expand Up @@ -35,7 +35,7 @@ def execute(self) -> List[Check_Report_AWS]:
report.status_extended = f"DMS Endpoint '{endpoint.id}' for MongoDB does not have an authentication mechanism enabled."
if endpoint.mongodb_auth_type != "no":
report.status = "PASS"
report.status_extended = f"DMS Endpoint '{endpoint.id}' for MongoDB has an authentication mechanism enabled."
report.status_extended = f"DMS Endpoint '{endpoint.id}' for MongoDB has {endpoint.mongodb_auth_type} as the authentication mechanism."

findings.append(report)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def mock_make_api_call_not_enabled(self, operation_name, kwarg):
return make_api_call(self, operation_name, kwarg)


class Test_dms_endpoint_mongodb_authtype_configured:
class Test_dms_endpoint_mongodb_authentication_enabled:
@mock_aws
def test_no_dms_endpoints(self):
dms_client = client("dms", region_name=AWS_REGION_US_EAST_1)
Expand All @@ -133,15 +133,15 @@ def test_no_dms_endpoints(self):
"prowler.providers.common.provider.Provider.get_global_provider",
return_value=aws_provider,
), mock.patch(
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured.dms_client",
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled.dms_client",
new=DMS(aws_provider),
):
# Test Check
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured import (
dms_endpoint_mongodb_authtype_configured,
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled import (
dms_endpoint_mongodb_authentication_enabled,
)

check = dms_endpoint_mongodb_authtype_configured()
check = dms_endpoint_mongodb_authentication_enabled()
result = check.execute()

assert len(result) == 0
Expand All @@ -161,15 +161,15 @@ def test_dms_not_mongodb_auth_mecanism_enabled(self):
"prowler.providers.common.provider.Provider.get_global_provider",
return_value=aws_provider,
), mock.patch(
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured.dms_client",
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled.dms_client",
new=DMS(aws_provider),
):
# Test Check
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured import (
dms_endpoint_mongodb_authtype_configured,
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled import (
dms_endpoint_mongodb_authentication_enabled,
)

check = dms_endpoint_mongodb_authtype_configured()
check = dms_endpoint_mongodb_authentication_enabled()
result = check.execute()

assert len(result) == 0
Expand All @@ -189,15 +189,15 @@ def test_dms_mongodb_auth_mecanism_not_enabled(self):
"prowler.providers.common.provider.Provider.get_global_provider",
return_value=aws_provider,
), mock.patch(
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured.dms_client",
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled.dms_client",
new=DMS(aws_provider),
):
# Test Check
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured import (
dms_endpoint_mongodb_authtype_configured,
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled import (
dms_endpoint_mongodb_authentication_enabled,
)

check = dms_endpoint_mongodb_authtype_configured()
check = dms_endpoint_mongodb_authentication_enabled()
result = check.execute()

assert len(result) == 1
Expand Down Expand Up @@ -237,21 +237,21 @@ def test_dms_mongodb_auth_mecanism_enabled(self):
"prowler.providers.common.provider.Provider.get_global_provider",
return_value=aws_provider,
), mock.patch(
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured.dms_client",
"prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled.dms_client",
new=DMS(aws_provider),
):
# Test Check
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authtype_configured.dms_endpoint_mongodb_authtype_configured import (
dms_endpoint_mongodb_authtype_configured,
from prowler.providers.aws.services.dms.dms_endpoint_mongodb_authentication_enabled.dms_endpoint_mongodb_authentication_enabled import (
dms_endpoint_mongodb_authentication_enabled,
)

check = dms_endpoint_mongodb_authtype_configured()
check = dms_endpoint_mongodb_authentication_enabled()
result = check.execute()

assert len(result) == 1
assert result[0].status == "PASS"
assert result[0].status_extended == (
"DMS Endpoint 'dms-endpoint' for MongoDB has an authentication mechanism enabled."
"DMS Endpoint 'dms-endpoint' for MongoDB has password as the authentication mechanism."
)
assert result[0].resource_id == "dms-endpoint"
assert (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_dms_endpoint_ssl_none(self):
endpoint_arn: Endpoint(
arn=endpoint_arn,
id="test-endpoint-no-ssl",
mongodb_auth_type="no",
engine_name="test-engine",
region=AWS_REGION_US_EAST_1,
ssl_mode="none",
Expand Down Expand Up @@ -78,6 +79,7 @@ def test_dms_endpoint_ssl_require(self):
endpoint_arn: Endpoint(
arn=endpoint_arn,
id="test-endpoint-ssl-require",
mongodb_auth_type="no",
engine_name="test-engine",
region=AWS_REGION_US_EAST_1,
ssl_mode="require",
Expand Down Expand Up @@ -123,6 +125,7 @@ def test_dms_endpoint_ssl_verify_ca(self):
arn=endpoint_arn,
id="test-endpoint-ssl-verify-ca",
engine_name="test-engine",
mongodb_auth_type="no",
region=AWS_REGION_US_EAST_1,
ssl_mode="verify-ca",
tags=[{"Key": "Name", "Value": "test-endpoint-ssl-verify-ca"}],
Expand Down Expand Up @@ -166,6 +169,7 @@ def test_dms_endpoint_ssl_verify_full(self):
endpoint_arn: Endpoint(
arn=endpoint_arn,
id="test-endpoint-ssl-verify-full",
mongodb_auth_type="no",
engine_name="test-engine",
region=AWS_REGION_US_EAST_1,
ssl_mode="verify-full",
Expand Down

0 comments on commit 0f473b2

Please sign in to comment.