-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(firehose): add new check
firehose_stream_encrypted_at_rest
(#5635
) Co-authored-by: Sergio Garcia <[email protected]>
- Loading branch information
1 parent
28c7e80
commit c1b050b
Showing
6 changed files
with
395 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
32 changes: 32 additions & 0 deletions
32
...irehose/firehose_stream_encrypted_at_rest/firehose_stream_encrypted_at_rest.metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"Provider": "aws", | ||
"CheckID": "firehose_stream_encrypted_at_rest", | ||
"CheckTitle": "DataFirehose delivery streams should be encrypted at rest.", | ||
"CheckType": [ | ||
"Software and Configuration Checks/Industry and Regulatory Standards/NIST 800-53 Controls" | ||
], | ||
"ServiceName": "firehose", | ||
"SubServiceName": "Ensure DataFirehose delivery streams are encrypted at rest.", | ||
"ResourceIdTemplate": "arn:partition:firehose:region:account-id:deliverystream/delivery-stream-id", | ||
"Severity": "medium", | ||
"ResourceType": "AwsKinesisFirehoseDeliveryStream", | ||
"Description": "", | ||
"Risk": "Without encryption at rest, data in Amazon Kinesis Data Firehose delivery streams is vulnerable to unauthorized access if the storage layer is compromised. This increases the risk of sensitive information exposure, potentially leading to data breaches or non-compliance with security regulations.", | ||
"RelatedUrl": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html", | ||
"Remediation": { | ||
"Code": { | ||
"CLI": "aws firehose update-delivery-stream --delivery-stream-name <delivery-stream-name> --delivery-stream-encryption-configuration-input '{ \"KeyType\": \"CUSTOMER_MANAGED_CMK\", \"KeyARN\": \"<kms-key-arn>\" }'", | ||
"NativeIaC": "https://docs.prowler.com/checks/aws/general-policies/ensure-aws-kinesis-firehoses-delivery-stream-is-encrypted/", | ||
"Other": "https://docs.aws.amazon.com/securityhub/latest/userguide/datafirehose-controls.html#datafirehose-1", | ||
"Terraform": "https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/Firehose/delivery-stream-encrypted-with-kms-customer-master-keys.html" | ||
}, | ||
"Recommendation": { | ||
"Text": "Enable server-side encryption for Kinesis Firehose delivery streams using AWS Key Management Service (KMS). This encrypts data at rest, ensuring that sensitive information remains secure and compliant with regulatory standards.", | ||
"Url": "https://docs.aws.amazon.com/firehose/latest/dev/encryption.html" | ||
} | ||
}, | ||
"Categories": [], | ||
"DependsOn": [], | ||
"RelatedTo": [], | ||
"Notes": "" | ||
} |
43 changes: 43 additions & 0 deletions
43
.../services/firehose/firehose_stream_encrypted_at_rest/firehose_stream_encrypted_at_rest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from typing import List | ||
|
||
from prowler.lib.check.models import Check, Check_Report_AWS | ||
from prowler.providers.aws.services.firehose.firehose_client import firehose_client | ||
from prowler.providers.aws.services.firehose.firehose_service import EncryptionStatus | ||
|
||
|
||
class firehose_stream_encrypted_at_rest(Check): | ||
"""Check if Firehose Streams are encrypted at rest. | ||
This class verifies that all Firehose Streams have at rest encryption enabled by checking if KMS encryption is active and a KMS Key is configured. | ||
""" | ||
|
||
def execute(self) -> List[Check_Report_AWS]: | ||
"""Execute the Firehose Stream Encrypted at Rest check. | ||
Iterates over all Firehose Streams and checks if KMS encryption is enabled and a KMS Key is configured. | ||
Returns: | ||
List[Check_Report_AWS]: A list of reports for each Firehose Stream. | ||
""" | ||
findings = [] | ||
for stream in firehose_client.delivery_streams.values(): | ||
report = Check_Report_AWS(self.metadata()) | ||
report.region = stream.region | ||
report.resource_id = stream.name | ||
report.resource_arn = stream.arn | ||
report.resource_tags = stream.tags | ||
report.status = "PASS" | ||
report.status_extended = ( | ||
f"Firehose Stream {stream.name} does have at rest encryption enabled." | ||
) | ||
|
||
if ( | ||
stream.kms_encryption != EncryptionStatus.ENABLED | ||
or not stream.kms_key_arn | ||
): | ||
report.status = "FAIL" | ||
report.status_extended = f"Firehose Stream {stream.name} does not have at rest encryption enabled." | ||
|
||
findings.append(report) | ||
|
||
return findings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.